From 4d9c14dc00f3b99f70212bfde3294c5f6e2c159d Mon Sep 17 00:00:00 2001 From: Ahad Birang Date: Mon, 4 Jul 2022 15:30:22 +0200 Subject: [PATCH 01/13] chore: issue reproduction --- package.json | 1 + playground/wind/app.vue | 19 ++++++++++ playground/wind/components/content/Alert.vue | 26 ++++++++++++++ playground/wind/components/content/Debug.vue | 36 +++++++++++++++++++ playground/wind/components/content/Hello.vue | 6 ++++ playground/wind/components/content/Icon.vue | 28 +++++++++++++++ playground/wind/components/content/List.vue | 20 +++++++++++ .../wind/components/content/MarkdownBlock.vue | 4 +++ playground/wind/composables/useTheme.ts | 9 +++++ playground/wind/content/first.md | 26 ++++++++++++++ playground/wind/content/index.md | 1 + playground/wind/content/second.md | 18 ++++++++++ playground/wind/nuxt.config.ts | 10 ++++++ yarn.lock | 5 +++ 14 files changed, 209 insertions(+) create mode 100644 playground/wind/app.vue create mode 100644 playground/wind/components/content/Alert.vue create mode 100644 playground/wind/components/content/Debug.vue create mode 100644 playground/wind/components/content/Hello.vue create mode 100644 playground/wind/components/content/Icon.vue create mode 100644 playground/wind/components/content/List.vue create mode 100644 playground/wind/components/content/MarkdownBlock.vue create mode 100644 playground/wind/composables/useTheme.ts create mode 100644 playground/wind/content/first.md create mode 100644 playground/wind/content/index.md create mode 100644 playground/wind/content/second.md create mode 100644 playground/wind/nuxt.config.ts diff --git a/package.json b/package.json index d730e54cc..0c1c67ec2 100644 --- a/package.json +++ b/package.json @@ -77,6 +77,7 @@ "ws": "^8.8.0" }, "devDependencies": { + "@iconify/vue": "^3.2.1", "@nuxt/module-builder": "^0.1.7", "@nuxt/schema": "^3.0.0-rc.4", "@nuxt/test-utils": "npm:@nuxt/test-utils-edge@latest", diff --git a/playground/wind/app.vue b/playground/wind/app.vue new file mode 100644 index 000000000..d20513323 --- /dev/null +++ b/playground/wind/app.vue @@ -0,0 +1,19 @@ + + + diff --git a/playground/wind/components/content/Alert.vue b/playground/wind/components/content/Alert.vue new file mode 100644 index 000000000..5f564064c --- /dev/null +++ b/playground/wind/components/content/Alert.vue @@ -0,0 +1,26 @@ + + + diff --git a/playground/wind/components/content/Debug.vue b/playground/wind/components/content/Debug.vue new file mode 100644 index 000000000..e3ff624d4 --- /dev/null +++ b/playground/wind/components/content/Debug.vue @@ -0,0 +1,36 @@ + + + diff --git a/playground/wind/components/content/Hello.vue b/playground/wind/components/content/Hello.vue new file mode 100644 index 000000000..8d362f52c --- /dev/null +++ b/playground/wind/components/content/Hello.vue @@ -0,0 +1,6 @@ + diff --git a/playground/wind/components/content/Icon.vue b/playground/wind/components/content/Icon.vue new file mode 100644 index 000000000..96ea4e78c --- /dev/null +++ b/playground/wind/components/content/Icon.vue @@ -0,0 +1,28 @@ + + + diff --git a/playground/wind/components/content/List.vue b/playground/wind/components/content/List.vue new file mode 100644 index 000000000..ee71c893c --- /dev/null +++ b/playground/wind/components/content/List.vue @@ -0,0 +1,20 @@ + + + diff --git a/playground/wind/components/content/MarkdownBlock.vue b/playground/wind/components/content/MarkdownBlock.vue new file mode 100644 index 000000000..69ef28f79 --- /dev/null +++ b/playground/wind/components/content/MarkdownBlock.vue @@ -0,0 +1,4 @@ + + diff --git a/playground/wind/composables/useTheme.ts b/playground/wind/composables/useTheme.ts new file mode 100644 index 000000000..9a707d114 --- /dev/null +++ b/playground/wind/composables/useTheme.ts @@ -0,0 +1,9 @@ +import { useContent } from '#imports' + +export const useTheme = () => { + const { globals } = useContent() + + const theme = computed(() => globals.value?.theme) + + return theme +} diff --git a/playground/wind/content/first.md b/playground/wind/content/first.md new file mode 100644 index 000000000..c7f6f6698 --- /dev/null +++ b/playground/wind/content/first.md @@ -0,0 +1,26 @@ +--- +navTitle: 'Home' +--- + +# Content Wind First :icon{name="carbon:sailboat-coastal" class="text-indigo-400"} + +A lightweight Nuxt template to build a Markdown driven website, based on [Nuxt Content](https://content.nuxtjs.org), [TailwindCSS](https://tailwindcss.com) and [Iconify](https://iconify.design) :sparkles: + +[First](/first) - [Second](/second) + +## Features + +::list +- [Document-Driven Mode](https://content.nuxtjs.org/guide/writing/document-driven) + ::list{icon="ph:check-circle-light"} + - Create pages in Markdown in the `content/` directory + - Use Nuxt layouts in your Markdown pages + - Enjoy meta tag generation from Markdown files + - Generated navigation based on your pages + :: +- Switch between Light & Dark mode :moon: +- Access 100,000 icons from 100+ icon sets with the `` component +- Highlight code blocks with [Shiki](https://shiki.matsu.io) +- Create Vue components and use them in your Markdown +- Deploy on any Node or Static hosting: GH Pages, Vercel, Netlify, Heroku, etc. +:: diff --git a/playground/wind/content/index.md b/playground/wind/content/index.md new file mode 100644 index 000000000..69dd7b851 --- /dev/null +++ b/playground/wind/content/index.md @@ -0,0 +1 @@ +[First](/first) - [Second](/second) \ No newline at end of file diff --git a/playground/wind/content/second.md b/playground/wind/content/second.md new file mode 100644 index 000000000..874a0f18b --- /dev/null +++ b/playground/wind/content/second.md @@ -0,0 +1,18 @@ +--- +navTitle: 'Home' +--- + +# Content Wind Second :icon{name="carbon:sailboat-coastal" class="text-indigo-400"} + +A lightweight Nuxt template to build a Markdown driven website, based on [Nuxt Content](https://content.nuxtjs.org), [TailwindCSS](https://tailwindcss.com) and [Iconify](https://iconify.design) :sparkles: + +[First](/first) - [Second](/second) + +## Features + +::alert{icon="ph:circle-wavy-warning-duotone"} +#title +This is an alert +#default +This is the default content of my alert! +:: diff --git a/playground/wind/nuxt.config.ts b/playground/wind/nuxt.config.ts new file mode 100644 index 000000000..90503e5e7 --- /dev/null +++ b/playground/wind/nuxt.config.ts @@ -0,0 +1,10 @@ +import { defineNuxtConfig } from 'nuxt' +import contentModule from '../../src/module' // eslint-disable-line + +export default defineNuxtConfig({ + modules: [contentModule], + content: { + documentDriven: { + } + } +}) diff --git a/yarn.lock b/yarn.lock index ee26f888b..683a167ab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -309,6 +309,11 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== +"@iconify/vue@^3.2.1": + version "3.2.1" + resolved "https://registry.yarnpkg.com/@iconify/vue/-/vue-3.2.1.tgz#bd8a2f1213ba8775d4b7a7a8ba895e53ae2f4dfc" + integrity sha512-c4R6ZgFo1JrJ8aPMMgOPgfU7lBswihMGR+yWe/P4ZukC3kTkeT4+lkt9Pc/itVFMkwva/S/7u9YofmYv57fnNQ== + "@ioredis/commands@^1.1.1": version "1.2.0" resolved "https://registry.yarnpkg.com/@ioredis/commands/-/commands-1.2.0.tgz#6d61b3097470af1fdbbe622795b8921d42018e11" From 7041f6ad224f5da6049bbb094ff24ffec4ac5e3b Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 4 Jul 2022 17:48:37 +0100 Subject: [PATCH 02/13] fix: freeze current page --- src/runtime/pages/document-driven.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/runtime/pages/document-driven.vue b/src/runtime/pages/document-driven.vue index 5285172c8..86d889f2a 100644 --- a/src/runtime/pages/document-driven.vue +++ b/src/runtime/pages/document-driven.vue @@ -2,13 +2,14 @@ import { useContent, useContentHead } from '#imports' const { page } = useContent() +const currentPage = page.value useContentHead(page)