@md-plugins/quasar-app-extension-q-press 0.1.0-beta.8 → 0.1.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +1 -1
- package/dist/install.js +1 -1
- package/dist/templates/init/src/_q-press/api/components/MarkdownCodepen.json +6 -9
- package/dist/templates/init/src/_q-press/api/components/MarkdownExample.json +27 -2
- package/dist/templates/init/src/_q-press/components/MarkdownCodepen.vue +161 -49
- package/dist/templates/init/src/_q-press/components/MarkdownExample.vue +52 -17
- package/dist/templates/init/src/markdown/guides/upgrade-guide.md +3 -3
- package/dist/templates/init/src/markdown/quasar-app-extensions/qpress/overview.md +1 -1
- package/dist/templates/init/src/markdown/quasar-app-extensions/vite-md-plugin-app-ext/overview.md +1 -1
- package/dist/templates/init/src/siteConfig/index.ts +11 -0
- package/dist/templates/update/src/_q-press/api/components/MarkdownCodepen.json +6 -9
- package/dist/templates/update/src/_q-press/api/components/MarkdownExample.json +27 -2
- package/dist/templates/update/src/_q-press/components/MarkdownCodepen.vue +161 -49
- package/dist/templates/update/src/_q-press/components/MarkdownExample.vue +52 -17
- package/package.json +18 -18
- package/src/index.ts +1 -1
- package/src/install.ts +1 -1
- package/src/templates/init/src/_q-press/api/components/MarkdownCodepen.json +6 -9
- package/src/templates/init/src/_q-press/api/components/MarkdownExample.json +27 -2
- package/src/templates/init/src/_q-press/components/MarkdownCodepen.vue +161 -49
- package/src/templates/init/src/_q-press/components/MarkdownExample.vue +52 -17
- package/src/templates/init/src/markdown/guides/upgrade-guide.md +3 -3
- package/src/templates/init/src/markdown/quasar-app-extensions/qpress/overview.md +1 -1
- package/src/templates/init/src/markdown/quasar-app-extensions/vite-md-plugin-app-ext/overview.md +1 -1
- package/src/templates/init/src/siteConfig/index.ts +11 -0
- package/src/templates/update/src/_q-press/api/components/MarkdownCodepen.json +6 -9
- package/src/templates/update/src/_q-press/api/components/MarkdownExample.json +27 -2
- package/src/templates/update/src/_q-press/components/MarkdownCodepen.vue +161 -49
- package/src/templates/update/src/_q-press/components/MarkdownExample.vue +52 -17
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ See the [documentation](https://md-plugins.netlify.app/quasar-app-extensions/qpr
|
|
|
6
6
|
|
|
7
7
|
> Current beta release: `0.1.0-beta.8`.
|
|
8
8
|
>
|
|
9
|
-
> Q-Press currently targets Quasar Vite projects using `@quasar/app-vite` `>=3.0.0-beta.
|
|
9
|
+
> Q-Press currently targets Quasar Vite projects using `@quasar/app-vite` `>=3.0.0-beta.29`. TypeScript processing is required.
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
package/dist/index.js
CHANGED
|
@@ -46,7 +46,7 @@ export default defineIndexScript((api) => {
|
|
|
46
46
|
throw new Error('This extension requires Vite');
|
|
47
47
|
}
|
|
48
48
|
api.compatibleWith('quasar', '^2.0.0');
|
|
49
|
-
api.compatibleWith('@quasar/app-vite', '>=3.0.0-beta.
|
|
49
|
+
api.compatibleWith('@quasar/app-vite', '>=3.0.0-beta.29');
|
|
50
50
|
// here we extend /quasar.config, so we can add some Vite/Vue stuff
|
|
51
51
|
api.extendQuasarConf(async (config) => {
|
|
52
52
|
config.build ??= {};
|
package/dist/install.js
CHANGED
|
@@ -11,7 +11,7 @@ export default defineInstallScript(async (api) => {
|
|
|
11
11
|
throw new Error('This extension requires Vite');
|
|
12
12
|
}
|
|
13
13
|
api.compatibleWith('quasar', '^2.0.0');
|
|
14
|
-
api.compatibleWith('@quasar/app-vite', '>=3.0.0-beta.
|
|
14
|
+
api.compatibleWith('@quasar/app-vite', '>=3.0.0-beta.29');
|
|
15
15
|
// project must have pinia installed
|
|
16
16
|
if ((await api.getStorePackageName()) !== 'pinia') {
|
|
17
17
|
console.error('-----------------------------');
|
|
@@ -4,18 +4,15 @@
|
|
|
4
4
|
"docsUrl": "https://path-to-your-docs/markdown-codepen"
|
|
5
5
|
},
|
|
6
6
|
"props": {
|
|
7
|
-
"
|
|
8
|
-
"type": "Boolean",
|
|
9
|
-
"desc": "Flag to indicate if the form should be active",
|
|
10
|
-
"category": "state"
|
|
11
|
-
},
|
|
12
|
-
"options": {
|
|
7
|
+
"title": {
|
|
13
8
|
"type": "String",
|
|
14
|
-
"desc": "
|
|
9
|
+
"desc": "Title used for the generated CodePen",
|
|
10
|
+
"required": true,
|
|
15
11
|
"examples": [
|
|
16
|
-
"'
|
|
12
|
+
"'Basic Example'",
|
|
13
|
+
"'Advanced Playground'"
|
|
17
14
|
],
|
|
18
15
|
"category": "content"
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
|
-
}
|
|
18
|
+
}
|
|
@@ -13,10 +13,35 @@
|
|
|
13
13
|
],
|
|
14
14
|
"category": "content"
|
|
15
15
|
},
|
|
16
|
+
"file": {
|
|
17
|
+
"type": "String",
|
|
18
|
+
"desc": "Vue example file name without the .vue extension",
|
|
19
|
+
"required": true,
|
|
20
|
+
"examples": [
|
|
21
|
+
"'Basic'",
|
|
22
|
+
"'AdvancedUsage'"
|
|
23
|
+
],
|
|
24
|
+
"category": "content"
|
|
25
|
+
},
|
|
26
|
+
"noEdit": {
|
|
27
|
+
"type": "Boolean",
|
|
28
|
+
"desc": "Hide the CodePen edit button",
|
|
29
|
+
"category": "behavior"
|
|
30
|
+
},
|
|
16
31
|
"noGithub": {
|
|
17
32
|
"type": "Boolean",
|
|
18
|
-
"desc": "
|
|
33
|
+
"desc": "Hide the GitHub source button",
|
|
34
|
+
"category": "behavior"
|
|
35
|
+
},
|
|
36
|
+
"scrollable": {
|
|
37
|
+
"type": "Boolean",
|
|
38
|
+
"desc": "Constrain the example content to a scrollable area",
|
|
39
|
+
"category": "content"
|
|
40
|
+
},
|
|
41
|
+
"overflow": {
|
|
42
|
+
"type": "Boolean",
|
|
43
|
+
"desc": "Allow the example content to manage overflow automatically",
|
|
19
44
|
"category": "behavior"
|
|
20
45
|
}
|
|
21
46
|
}
|
|
22
|
-
}
|
|
47
|
+
}
|
|
@@ -17,39 +17,164 @@ import { ref, reactive, computed, nextTick } from 'vue'
|
|
|
17
17
|
|
|
18
18
|
import { slugify } from '@md-plugins/shared'
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
import siteConfig from '../../siteConfig'
|
|
21
|
+
|
|
22
|
+
type CodepenParts = {
|
|
23
|
+
Template?: string
|
|
24
|
+
Script?: string
|
|
25
|
+
Style?: string
|
|
26
|
+
[key: string]: string | undefined
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const defaultCssResources = [
|
|
21
30
|
'https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons',
|
|
22
31
|
`https://cdn.jsdelivr.net/npm/quasar@${Quasar.version}/dist/quasar.min.css`,
|
|
23
|
-
]
|
|
32
|
+
]
|
|
24
33
|
|
|
25
|
-
const
|
|
34
|
+
const defaultJsResources = [
|
|
26
35
|
'https://cdn.jsdelivr.net/npm/vue@3/dist/vue.global.prod.js',
|
|
27
36
|
`https://cdn.jsdelivr.net/npm/quasar@${Quasar.version}/dist/quasar.umd.prod.js`,
|
|
28
|
-
]
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
function indent(code: string, spaces = 2) {
|
|
40
|
+
const padding = ' '.repeat(spaces)
|
|
41
|
+
return code
|
|
42
|
+
.split('\n')
|
|
43
|
+
.map((line) => (line.trim().length > 0 ? padding + line : line))
|
|
44
|
+
.join('\n')
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function getImportNames(content: string, packageName: string) {
|
|
48
|
+
const names = new Set<string>()
|
|
49
|
+
const importRe = new RegExp(`import\\s+{([^}'"\\n]+)}\\s+from\\s+['"]${packageName}['"];?`, 'g')
|
|
50
|
+
let match: RegExpExecArray | null
|
|
51
|
+
|
|
52
|
+
while ((match = importRe.exec(content)) !== null) {
|
|
53
|
+
for (const part of match[1].split(',')) {
|
|
54
|
+
const name = part.trim().replace(/\s+as\s+/g, ': ')
|
|
55
|
+
|
|
56
|
+
if (name.length > 0) {
|
|
57
|
+
names.add(name)
|
|
58
|
+
}
|
|
44
59
|
}
|
|
45
|
-
return text.join('\n')
|
|
46
60
|
}
|
|
47
61
|
|
|
62
|
+
return [...names]
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function getGlobalImportLines(content: string) {
|
|
66
|
+
const vueImports = getImportNames(content, 'vue')
|
|
67
|
+
const quasarImports = getImportNames(content, 'quasar')
|
|
68
|
+
|
|
69
|
+
return [
|
|
70
|
+
vueImports.length > 0 ? `const { ${vueImports.join(', ')} } = Vue` : '',
|
|
71
|
+
quasarImports.length > 0 ? `const { ${quasarImports.join(', ')} } = Quasar` : '',
|
|
72
|
+
].filter((line) => line.length > 0)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function stripImports(content: string) {
|
|
76
|
+
return content
|
|
77
|
+
.replace(/^\s*import\s+type\s+[\s\S]*?\s+from\s+['"][^'"]+['"];?\s*$/gm, '')
|
|
78
|
+
.replace(/^\s*import\s+[\s\S]*?\s+from\s+['"][^'"]+['"];?\s*$/gm, '')
|
|
79
|
+
.replace(/^\s*import\s+['"][^'"]+['"];?\s*$/gm, '')
|
|
80
|
+
.trim()
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function getScriptBlock(script: string, setup: boolean) {
|
|
84
|
+
const re = setup
|
|
85
|
+
? /<script\s+setup([^>]*)>([\s\S]*?)<\/script>/
|
|
86
|
+
: /<script(?!\s+setup)([^>]*)>([\s\S]*?)<\/script>/
|
|
87
|
+
const match = re.exec(script)
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
attrs: match?.[1] ?? '',
|
|
91
|
+
content: match?.[2] ?? '',
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function getSetupReturnNames(content: string) {
|
|
96
|
+
const names = new Set<string>()
|
|
97
|
+
const declarationRe = /(?:^|\n)\s*(?:const|let|var)\s+([A-Za-z_$][\w$]*)/g
|
|
98
|
+
const functionRe = /(?:^|\n)\s*function\s+([A-Za-z_$][\w$]*)/g
|
|
99
|
+
let match: RegExpExecArray | null
|
|
100
|
+
|
|
101
|
+
while ((match = declarationRe.exec(content)) !== null) {
|
|
102
|
+
names.add(match[1])
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
while ((match = functionRe.exec(content)) !== null) {
|
|
106
|
+
names.add(match[1])
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return [...names]
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function getAppSetup() {
|
|
113
|
+
return ['app.use(Quasar, { config: {} })', siteConfig.codepen?.jsSetup ?? '']
|
|
114
|
+
.map((line) => line.trim())
|
|
115
|
+
.filter((line) => line.length > 0)
|
|
116
|
+
.join('\n')
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function createSetupScript(script: string) {
|
|
120
|
+
const { content } = getScriptBlock(script, true)
|
|
121
|
+
const globalImports = getGlobalImportLines(content)
|
|
122
|
+
const setupContent = stripImports(content)
|
|
123
|
+
const returnNames = getSetupReturnNames(setupContent)
|
|
124
|
+
const setupBody = [
|
|
125
|
+
setupContent.length > 0 ? indent(setupContent, 4) : '',
|
|
126
|
+
returnNames.length > 0 ? ` return { ${returnNames.join(', ')} }` : '',
|
|
127
|
+
]
|
|
128
|
+
.filter((line) => line.length > 0)
|
|
129
|
+
.join('\n\n')
|
|
130
|
+
|
|
131
|
+
return [
|
|
132
|
+
...globalImports,
|
|
133
|
+
`const app = Vue.createApp({
|
|
134
|
+
setup () {
|
|
135
|
+
${setupBody}
|
|
136
|
+
}
|
|
137
|
+
})`,
|
|
138
|
+
getAppSetup(),
|
|
139
|
+
"app.mount('#q-app')",
|
|
140
|
+
].join('\n\n')
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function createOptionsScript(script: string) {
|
|
144
|
+
const { content } = getScriptBlock(script, false)
|
|
145
|
+
const globalImports = getGlobalImportLines(content)
|
|
146
|
+
const match = /export\s+default\s+{([\s\S]*)}/.exec(content)
|
|
147
|
+
const beforeDefault = match === null ? stripImports(content) : stripImports(content.slice(0, match.index))
|
|
148
|
+
let component = match?.[1]?.trim() ?? ''
|
|
149
|
+
|
|
150
|
+
if (component.length > 0) {
|
|
151
|
+
component = '\n ' + component + '\n'
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return [
|
|
155
|
+
...globalImports,
|
|
156
|
+
beforeDefault,
|
|
157
|
+
`const app = Vue.createApp({${component}})`,
|
|
158
|
+
getAppSetup(),
|
|
159
|
+
"app.mount('#q-app')",
|
|
160
|
+
]
|
|
161
|
+
.filter((line) => line.length > 0)
|
|
162
|
+
.join('\n\n')
|
|
163
|
+
}
|
|
164
|
+
|
|
48
165
|
const props = defineProps({ title: { type: String, required: true } })
|
|
49
166
|
|
|
50
167
|
const active = ref(false)
|
|
51
168
|
const formRef = ref(null)
|
|
52
|
-
const def = reactive({ parts: {} })
|
|
169
|
+
const def = reactive<{ parts: CodepenParts }>({ parts: {} })
|
|
170
|
+
|
|
171
|
+
const cssResources = computed(() => {
|
|
172
|
+
return [...defaultCssResources, ...(siteConfig.codepen?.cssExternal ?? [])].join(';')
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
const jsResources = computed(() => {
|
|
176
|
+
return [...defaultJsResources, ...(siteConfig.codepen?.jsExternal ?? [])].join(';')
|
|
177
|
+
})
|
|
53
178
|
|
|
54
179
|
const css = computed(() => {
|
|
55
180
|
return (def.parts.Style || '').replace(/(<style.*?>|<\/style>)/g, '').trim()
|
|
@@ -62,32 +187,19 @@ const cssPreprocessor = computed(() => {
|
|
|
62
187
|
})
|
|
63
188
|
|
|
64
189
|
const js = computed(() => {
|
|
65
|
-
const
|
|
66
|
-
const vueImports = /import\s+{([^}'\n]+)}\s+from\s+'vue'/g
|
|
67
|
-
const otherImports = /import ([^'\n]*) from ([^\n]*)/g
|
|
68
|
-
let component = /export default {([\s\S]*)}/g.exec(def.parts.Script || '')
|
|
190
|
+
const script = def.parts.Script ?? ''
|
|
69
191
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
let script = /<script>([\s\S]*)export default {/g.exec(def.parts.Script || '')
|
|
76
|
-
script = ((script && script[1]) || '')
|
|
77
|
-
.replace(quasarImports, replace('Quasar'))
|
|
78
|
-
.replace(vueImports, replace('Vue'))
|
|
79
|
-
.replace(otherImports, '')
|
|
80
|
-
.trim()
|
|
192
|
+
return script.includes('<script setup') === true
|
|
193
|
+
? createSetupScript(script)
|
|
194
|
+
: createOptionsScript(script)
|
|
195
|
+
})
|
|
81
196
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
197
|
+
const jsPreProcessor = computed(() => {
|
|
198
|
+
const setupBlock = getScriptBlock(def.parts.Script ?? '', true)
|
|
199
|
+
const optionsBlock = getScriptBlock(def.parts.Script ?? '', false)
|
|
200
|
+
const attrs = setupBlock.content.length > 0 ? setupBlock.attrs : optionsBlock.attrs
|
|
86
201
|
|
|
87
|
-
|
|
88
|
-
app.mount('#q-app')
|
|
89
|
-
`
|
|
90
|
-
)
|
|
202
|
+
return siteConfig.codepen?.jsPreProcessor ?? (/lang=["']ts["']/.test(attrs) ? 'typescript' : 'babel')
|
|
91
203
|
})
|
|
92
204
|
|
|
93
205
|
const html = computed(() => {
|
|
@@ -157,14 +269,14 @@ ${location.origin + location.pathname}#${slugifiedTitle.value}
|
|
|
157
269
|
<div id="q-app" style="min-height: 100vh;">
|
|
158
270
|
${html.value}
|
|
159
271
|
</div>`,
|
|
160
|
-
head: '',
|
|
161
272
|
html_pre_processor: 'none',
|
|
162
273
|
css: css.value,
|
|
163
274
|
css_pre_processor: cssPreprocessor.value,
|
|
164
|
-
css_external: cssResources,
|
|
275
|
+
css_external: cssResources.value,
|
|
165
276
|
js: js.value,
|
|
166
|
-
js_pre_processor:
|
|
167
|
-
js_external: jsResources,
|
|
277
|
+
js_pre_processor: jsPreProcessor.value,
|
|
278
|
+
js_external: jsResources.value,
|
|
279
|
+
head: siteConfig.codepen?.head ?? '',
|
|
168
280
|
editors: editors.value,
|
|
169
281
|
}
|
|
170
282
|
return JSON.stringify(data)
|
|
@@ -175,7 +287,7 @@ ${html.value}
|
|
|
175
287
|
*
|
|
176
288
|
* @param {string} whichParts - The parts of the application to open.
|
|
177
289
|
*/
|
|
178
|
-
function open(whichParts) {
|
|
290
|
+
function open(whichParts: CodepenParts) {
|
|
179
291
|
def.parts = whichParts
|
|
180
292
|
|
|
181
293
|
if (active.value) {
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
</template>
|
|
94
94
|
|
|
95
95
|
<script setup lang="ts">
|
|
96
|
-
import { computed, inject, markRaw, ref, reactive, onMounted } from 'vue'
|
|
96
|
+
import { computed, inject, markRaw, ref, reactive, onBeforeUnmount, onMounted } from 'vue'
|
|
97
97
|
import { openURL } from 'quasar'
|
|
98
98
|
|
|
99
99
|
import { fabGithub, fabCodepen } from '@quasar/extras/fontawesome-v6'
|
|
@@ -134,6 +134,7 @@ const def = reactive({
|
|
|
134
134
|
})
|
|
135
135
|
const currentTab = ref('Template')
|
|
136
136
|
const expanded = ref(false)
|
|
137
|
+
let removeHmrListener = () => {}
|
|
137
138
|
|
|
138
139
|
/**
|
|
139
140
|
* A computed property that returns the CSS class for the component.
|
|
@@ -186,7 +187,8 @@ function parseComponent(comp) {
|
|
|
186
187
|
}
|
|
187
188
|
|
|
188
189
|
function openGitHub() {
|
|
189
|
-
|
|
190
|
+
const root = siteConfig.githubSourceRootSrc ?? siteConfig.githubEditRootSrc.replace('/edit/', '/tree/')
|
|
191
|
+
openURL(`${root}/examples/${examples.name}/${props.file}.vue`)
|
|
190
192
|
}
|
|
191
193
|
|
|
192
194
|
function openCodepen() {
|
|
@@ -197,23 +199,56 @@ function toggleExpand() {
|
|
|
197
199
|
expanded.value = expanded.value === false
|
|
198
200
|
}
|
|
199
201
|
|
|
202
|
+
async function loadExample() {
|
|
203
|
+
const list = await examples.list
|
|
204
|
+
const devFile = `/src/examples/${examples.name}/${props.file}.vue`
|
|
205
|
+
|
|
206
|
+
if (import.meta.env.QUASAR_DEV) {
|
|
207
|
+
const loadComponent = list.code[devFile]
|
|
208
|
+
const loadSource = list.source[devFile]
|
|
209
|
+
|
|
210
|
+
if (loadComponent === void 0 || loadSource === void 0) {
|
|
211
|
+
throw new Error(`Markdown example not found: ${devFile}`)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const componentModule = await loadComponent()
|
|
215
|
+
const source = await loadSource()
|
|
216
|
+
|
|
217
|
+
component.value = markRaw(componentModule.default)
|
|
218
|
+
parseComponent(source)
|
|
219
|
+
} else {
|
|
220
|
+
component.value = markRaw(list[props.file])
|
|
221
|
+
parseComponent(list[`Raw${props.file}`])
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
isBusy.value = false
|
|
225
|
+
}
|
|
226
|
+
|
|
200
227
|
if (import.meta.env.QUASAR_CLIENT) {
|
|
201
228
|
onMounted(() => {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
229
|
+
void loadExample()
|
|
230
|
+
|
|
231
|
+
if (import.meta.hot) {
|
|
232
|
+
const examplePath = `/src/examples/${examples.name}/${props.file}.vue`
|
|
233
|
+
const onAfterUpdate = (payload) => {
|
|
234
|
+
const shouldReload = payload.updates.some(
|
|
235
|
+
(update) => update.path === examplePath || update.acceptedPath === examplePath,
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
if (shouldReload === true) {
|
|
239
|
+
void loadExample()
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
import.meta.hot.on('vite:afterUpdate', onAfterUpdate)
|
|
244
|
+
removeHmrListener = () => {
|
|
245
|
+
import.meta.hot?.off('vite:afterUpdate', onAfterUpdate)
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
onBeforeUnmount(() => {
|
|
251
|
+
removeHmrListener()
|
|
217
252
|
})
|
|
218
253
|
}
|
|
219
254
|
</script>
|
|
@@ -7,16 +7,16 @@ related:
|
|
|
7
7
|
- vite-plugins/vite-md-plugin/overview
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
The `0.1.0` beta line moves MD-Plugins and Q-Press to the Quasar CLI Vite 3 beta toolchain. It is the right version to use when your Quasar application is being upgraded to `@quasar/app-vite` `>=3.0.0-beta.
|
|
10
|
+
The `0.1.0` beta line moves MD-Plugins and Q-Press to the Quasar CLI Vite 3 beta toolchain. It is the right version to use when your Quasar application is being upgraded to `@quasar/app-vite` `>=3.0.0-beta.29`.
|
|
11
11
|
|
|
12
12
|
::: warning
|
|
13
|
-
Q-Press and the Quasar app extensions now target Quasar Vite projects using `@quasar/app-vite` `>=3.0.0-beta.
|
|
13
|
+
Q-Press and the Quasar app extensions now target Quasar Vite projects using `@quasar/app-vite` `>=3.0.0-beta.29`. They are not intended for Webpack projects or JavaScript-only Quasar projects.
|
|
14
14
|
:::
|
|
15
15
|
|
|
16
16
|
## Before You Upgrade
|
|
17
17
|
|
|
18
18
|
- Make sure your app is already on a Quasar Vite setup.
|
|
19
|
-
- Upgrade the app to `@quasar/app-vite` `>=3.0.0-beta.
|
|
19
|
+
- Upgrade the app to `@quasar/app-vite` `>=3.0.0-beta.29`.
|
|
20
20
|
- Use TypeScript in the consuming Quasar project.
|
|
21
21
|
- Import `defineConfig` in `quasar.config.ts` directly from `@quasar/app-vite`.
|
|
22
22
|
- Use `/// <reference types="@quasar/app-vite/client" />` in `src/env.d.ts`.
|
|
@@ -6,7 +6,7 @@ desc: Q-Press App-Extension for Quasar.
|
|
|
6
6
|
The Q-Press App Extension is a powerful tool for Quasar developers that simplifies the integration of Markdown content into Quasar applications. It leverages the capabilities of Vite and various Markdown plugins to transform Markdown files into Vue components, enabling a seamless and efficient workflow for content management.
|
|
7
7
|
|
|
8
8
|
::: warning
|
|
9
|
-
Q-Press is for Quasar Vite projects using `@quasar/app-vite` `>=3.0.0-beta.
|
|
9
|
+
Q-Press is for Quasar Vite projects using `@quasar/app-vite` `>=3.0.0-beta.29` at this time. TypeScript processing is also required. Do not use if you are using Webpack or have a JavaScript-only project.
|
|
10
10
|
:::
|
|
11
11
|
|
|
12
12
|
::: tip
|
package/dist/templates/init/src/markdown/quasar-app-extensions/vite-md-plugin-app-ext/overview.md
CHANGED
|
@@ -9,7 +9,7 @@ related:
|
|
|
9
9
|
The `viteMdPluginAppExt` is a [Quasar App Extension](https://quasar.dev/app-extensions/introduction) that integrates the `viteMdPlugin` into your Quasar project. This extension allows you to use Markdown files as Vue components, enabling a seamless integration of Markdown content into your Quasar application.
|
|
10
10
|
|
|
11
11
|
::: warning
|
|
12
|
-
This app extension targets Quasar Vite projects using `@quasar/app-vite` `>=3.0.0-beta.
|
|
12
|
+
This app extension targets Quasar Vite projects using `@quasar/app-vite` `>=3.0.0-beta.29`.
|
|
13
13
|
:::
|
|
14
14
|
|
|
15
15
|
## Key Features
|
|
@@ -70,6 +70,14 @@ export interface PrivacyConfig {
|
|
|
70
70
|
link: string
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
export interface CodepenConfig {
|
|
74
|
+
cssExternal?: string[]
|
|
75
|
+
jsExternal?: string[]
|
|
76
|
+
jsSetup?: string
|
|
77
|
+
jsPreProcessor?: string
|
|
78
|
+
head?: string
|
|
79
|
+
}
|
|
80
|
+
|
|
73
81
|
export interface SiteConfig {
|
|
74
82
|
lang: string
|
|
75
83
|
title: string
|
|
@@ -78,6 +86,8 @@ export interface SiteConfig {
|
|
|
78
86
|
version: string
|
|
79
87
|
copyright: CopyrightConfig
|
|
80
88
|
githubEditRootSrc: string // src folder for github edit links (appended with 'markdown' and 'examples')
|
|
89
|
+
githubSourceRootSrc?: string // src folder for GitHub source links (appended with 'markdown' and 'examples')
|
|
90
|
+
codepen?: CodepenConfig
|
|
81
91
|
license: LicenseConfig
|
|
82
92
|
privacy: PrivacyConfig
|
|
83
93
|
logoConfig: LogoConfig
|
|
@@ -391,6 +401,7 @@ const config = {
|
|
|
391
401
|
line2: '',
|
|
392
402
|
} as CopyrightConfig,
|
|
393
403
|
githubEditRootSrc: 'https://github.com/md-plugins/md-plugins/edit/dev/packages/docs/src/',
|
|
404
|
+
githubSourceRootSrc: 'https://github.com/md-plugins/md-plugins/tree/dev/packages/docs/src/',
|
|
394
405
|
license: {
|
|
395
406
|
label: 'MIT License',
|
|
396
407
|
link: 'https://github.com/md-plugins/md-plugins/blob/dev/LICENSE.md',
|
|
@@ -4,18 +4,15 @@
|
|
|
4
4
|
"docsUrl": "https://path-to-your-docs/markdown-codepen"
|
|
5
5
|
},
|
|
6
6
|
"props": {
|
|
7
|
-
"
|
|
8
|
-
"type": "Boolean",
|
|
9
|
-
"desc": "Flag to indicate if the form should be active",
|
|
10
|
-
"category": "state"
|
|
11
|
-
},
|
|
12
|
-
"options": {
|
|
7
|
+
"title": {
|
|
13
8
|
"type": "String",
|
|
14
|
-
"desc": "
|
|
9
|
+
"desc": "Title used for the generated CodePen",
|
|
10
|
+
"required": true,
|
|
15
11
|
"examples": [
|
|
16
|
-
"'
|
|
12
|
+
"'Basic Example'",
|
|
13
|
+
"'Advanced Playground'"
|
|
17
14
|
],
|
|
18
15
|
"category": "content"
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
|
-
}
|
|
18
|
+
}
|
|
@@ -13,10 +13,35 @@
|
|
|
13
13
|
],
|
|
14
14
|
"category": "content"
|
|
15
15
|
},
|
|
16
|
+
"file": {
|
|
17
|
+
"type": "String",
|
|
18
|
+
"desc": "Vue example file name without the .vue extension",
|
|
19
|
+
"required": true,
|
|
20
|
+
"examples": [
|
|
21
|
+
"'Basic'",
|
|
22
|
+
"'AdvancedUsage'"
|
|
23
|
+
],
|
|
24
|
+
"category": "content"
|
|
25
|
+
},
|
|
26
|
+
"noEdit": {
|
|
27
|
+
"type": "Boolean",
|
|
28
|
+
"desc": "Hide the CodePen edit button",
|
|
29
|
+
"category": "behavior"
|
|
30
|
+
},
|
|
16
31
|
"noGithub": {
|
|
17
32
|
"type": "Boolean",
|
|
18
|
-
"desc": "
|
|
33
|
+
"desc": "Hide the GitHub source button",
|
|
34
|
+
"category": "behavior"
|
|
35
|
+
},
|
|
36
|
+
"scrollable": {
|
|
37
|
+
"type": "Boolean",
|
|
38
|
+
"desc": "Constrain the example content to a scrollable area",
|
|
39
|
+
"category": "content"
|
|
40
|
+
},
|
|
41
|
+
"overflow": {
|
|
42
|
+
"type": "Boolean",
|
|
43
|
+
"desc": "Allow the example content to manage overflow automatically",
|
|
19
44
|
"category": "behavior"
|
|
20
45
|
}
|
|
21
46
|
}
|
|
22
|
-
}
|
|
47
|
+
}
|