@docsector/docsector-reader 4.0.1 → 4.2.0
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 +19 -0
- package/bin/docsector.js +1 -1
- package/package.json +1 -1
- package/public/api/manual/http-client.json +91 -0
- package/public/quasar-api/QSeparator.json +39 -0
- package/src/components/DBlockApi.vue +634 -0
- package/src/components/DBlockApiEntry.js +623 -0
- package/src/components/DBlockCodeExample.vue +445 -0
- package/src/components/DBlockSourceCode.vue +3 -11
- package/src/components/DMenu.vue +70 -25
- package/src/components/DPageTokens.vue +22 -0
- package/src/components/api-block-model.js +326 -0
- package/src/components/code-block-highlighting.js +16 -0
- package/src/components/code-example-source.js +363 -0
- package/src/components/page-section-tokens.js +141 -1
- package/src/components/source-code-lines.js +17 -0
- package/src/examples/manual/code-examples/BasicCounter.vue +63 -0
- package/src/examples/manual/code-examples/InlineNotice.vue +60 -0
- package/src/pages/manual/content/blocks/api-reference.overview.en-US.md +40 -0
- package/src/pages/manual/content/blocks/api-reference.overview.pt-BR.md +40 -0
- package/src/pages/manual/content/blocks/api-reference.showcase.en-US.md +33 -0
- package/src/pages/manual/content/blocks/api-reference.showcase.pt-BR.md +33 -0
- package/src/pages/manual/content/blocks/code-examples.overview.en-US.md +56 -0
- package/src/pages/manual/content/blocks/code-examples.overview.pt-BR.md +56 -0
- package/src/pages/manual/content/blocks/code-examples.showcase.en-US.md +38 -0
- package/src/pages/manual/content/blocks/code-examples.showcase.pt-BR.md +38 -0
- package/src/pages/manual.index.js +56 -0
- package/src/quasar.factory.js +77 -0
- package/src/store/Page.js +26 -2
|
@@ -514,6 +514,34 @@ export default {
|
|
|
514
514
|
}
|
|
515
515
|
},
|
|
516
516
|
|
|
517
|
+
'/content/blocks/code-examples': {
|
|
518
|
+
config: {
|
|
519
|
+
icon: 'integration_instructions',
|
|
520
|
+
status: 'new',
|
|
521
|
+
meta: {
|
|
522
|
+
description: {
|
|
523
|
+
'en-US': 'Code examples — Documentation of Docsector Reader',
|
|
524
|
+
'pt-BR': 'Exemplos de código — Documentacao do Docsector Reader'
|
|
525
|
+
}
|
|
526
|
+
},
|
|
527
|
+
book: 'manual',
|
|
528
|
+
menu: {},
|
|
529
|
+
subpages: {
|
|
530
|
+
showcase: true
|
|
531
|
+
}
|
|
532
|
+
},
|
|
533
|
+
data: {
|
|
534
|
+
'en-US': { title: 'Code examples' },
|
|
535
|
+
'pt-BR': { title: 'Exemplos de código' }
|
|
536
|
+
},
|
|
537
|
+
metadata: {
|
|
538
|
+
tags: {
|
|
539
|
+
'en-US': 'code examples live preview vue sfc source codepen component demo',
|
|
540
|
+
'pt-BR': 'exemplos código preview ao vivo vue sfc fonte codepen componente demo'
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
},
|
|
544
|
+
|
|
517
545
|
'/content/blocks/mermaid-diagrams': {
|
|
518
546
|
config: {
|
|
519
547
|
icon: 'account_tree',
|
|
@@ -851,6 +879,34 @@ export default {
|
|
|
851
879
|
}
|
|
852
880
|
},
|
|
853
881
|
|
|
882
|
+
'/content/blocks/api-reference': {
|
|
883
|
+
config: {
|
|
884
|
+
icon: 'api',
|
|
885
|
+
status: 'new',
|
|
886
|
+
meta: {
|
|
887
|
+
description: {
|
|
888
|
+
'en-US': 'API Reference Block — Documentation of Docsector Reader',
|
|
889
|
+
'pt-BR': 'Bloco de Referência de API — Documentacao do Docsector Reader'
|
|
890
|
+
}
|
|
891
|
+
},
|
|
892
|
+
book: 'manual',
|
|
893
|
+
menu: {},
|
|
894
|
+
subpages: {
|
|
895
|
+
showcase: true
|
|
896
|
+
}
|
|
897
|
+
},
|
|
898
|
+
data: {
|
|
899
|
+
'en-US': { title: 'API Reference' },
|
|
900
|
+
'pt-BR': { title: 'Referência de API' }
|
|
901
|
+
},
|
|
902
|
+
metadata: {
|
|
903
|
+
tags: {
|
|
904
|
+
'en-US': 'api json quasar reference props methods events docs metadata custom block',
|
|
905
|
+
'pt-BR': 'api json quasar referência props métodos eventos docs metadados bloco customizado'
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
},
|
|
909
|
+
|
|
854
910
|
'/content/structures': {
|
|
855
911
|
config: null,
|
|
856
912
|
data: {
|
package/src/quasar.factory.js
CHANGED
|
@@ -1144,6 +1144,82 @@ function createBooksPlugin (projectRoot) {
|
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
1146
1146
|
|
|
1147
|
+
function buildVirtualCodeExamplesModule () {
|
|
1148
|
+
return `const componentModules = import.meta.glob('/src/examples/**/*.vue')
|
|
1149
|
+
const sourceModules = import.meta.glob('/src/examples/**/*.vue', { query: '?raw', import: 'default' })
|
|
1150
|
+
|
|
1151
|
+
const trimSlashes = (value) => String(value || '').replace(/\\\\/g, '/').replace(/^\\/+|\\/+$/g, '')
|
|
1152
|
+
const toKebabSegment = (value) => String(value || '')
|
|
1153
|
+
.replace(/\\.vue$/i, '')
|
|
1154
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
1155
|
+
.replace(/[\\s_]+/g, '-')
|
|
1156
|
+
.replace(/-+/g, '-')
|
|
1157
|
+
.toLowerCase()
|
|
1158
|
+
|
|
1159
|
+
export const normalizeCodeExampleId = (value) => trimSlashes(value)
|
|
1160
|
+
.replace(/^src\\/examples\\//i, '')
|
|
1161
|
+
.replace(/^examples\\//i, '')
|
|
1162
|
+
.replace(/\\.vue$/i, '')
|
|
1163
|
+
.split('/')
|
|
1164
|
+
.filter(Boolean)
|
|
1165
|
+
.map(toKebabSegment)
|
|
1166
|
+
.join('/')
|
|
1167
|
+
|
|
1168
|
+
export const codeExamples = Object.keys(componentModules).reduce((examples, filePath) => {
|
|
1169
|
+
const id = normalizeCodeExampleId(filePath)
|
|
1170
|
+
|
|
1171
|
+
examples[id] = {
|
|
1172
|
+
id,
|
|
1173
|
+
filePath,
|
|
1174
|
+
loadComponent: componentModules[filePath],
|
|
1175
|
+
loadSource: sourceModules[filePath]
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
return examples
|
|
1179
|
+
}, {})
|
|
1180
|
+
|
|
1181
|
+
export const codeExampleIds = Object.keys(codeExamples).sort()
|
|
1182
|
+
|
|
1183
|
+
export const resolveCodeExample = (value) => {
|
|
1184
|
+
const id = normalizeCodeExampleId(value)
|
|
1185
|
+
const entry = codeExamples[id]
|
|
1186
|
+
|
|
1187
|
+
if (!entry) {
|
|
1188
|
+
return {
|
|
1189
|
+
id,
|
|
1190
|
+
filePath: '',
|
|
1191
|
+
exists: false,
|
|
1192
|
+
loadComponent: null,
|
|
1193
|
+
loadSource: null
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
return {
|
|
1198
|
+
...entry,
|
|
1199
|
+
exists: true
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
export default codeExamples
|
|
1204
|
+
`
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
function createCodeExamplesPlugin () {
|
|
1208
|
+
const virtualId = 'virtual:docsector-code-examples'
|
|
1209
|
+
const resolvedId = '\0' + virtualId
|
|
1210
|
+
|
|
1211
|
+
return {
|
|
1212
|
+
name: 'docsector-code-examples',
|
|
1213
|
+
resolveId (id) {
|
|
1214
|
+
if (id === virtualId) return resolvedId
|
|
1215
|
+
},
|
|
1216
|
+
load (id) {
|
|
1217
|
+
if (id !== resolvedId) return null
|
|
1218
|
+
return buildVirtualCodeExamplesModule()
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1147
1223
|
/**
|
|
1148
1224
|
* Create the HJSON Vite plugin for loading .hjson files as ES modules.
|
|
1149
1225
|
*/
|
|
@@ -2919,6 +2995,7 @@ export function createQuasarConfig (options = {}) {
|
|
|
2919
2995
|
|
|
2920
2996
|
vitePlugins: [
|
|
2921
2997
|
createBooksPlugin(projectRoot),
|
|
2998
|
+
createCodeExamplesPlugin(),
|
|
2922
2999
|
createHjsonPlugin(),
|
|
2923
3000
|
createHomePageOverridePlugin(projectRoot),
|
|
2924
3001
|
createGitDatesPlugin(projectRoot),
|
package/src/store/Page.js
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
const getNodePath = (nodes, targetId, ancestry = []) => {
|
|
2
|
+
for (const node of nodes) {
|
|
3
|
+
const nextAncestry = [...ancestry, node.id]
|
|
4
|
+
|
|
5
|
+
if (node.id === targetId) {
|
|
6
|
+
return nextAncestry
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if (Array.isArray(node.children) && node.children.length > 0) {
|
|
10
|
+
const childPath = getNodePath(node.children, targetId, nextAncestry)
|
|
11
|
+
|
|
12
|
+
if (childPath !== null) {
|
|
13
|
+
return childPath
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return null
|
|
19
|
+
}
|
|
20
|
+
|
|
1
21
|
export default {
|
|
2
22
|
namespaced: true,
|
|
3
23
|
|
|
@@ -82,8 +102,12 @@ export default {
|
|
|
82
102
|
state.nodesExpanded = [0]
|
|
83
103
|
},
|
|
84
104
|
pushNodesExpanded (state, nodeId) {
|
|
85
|
-
|
|
86
|
-
|
|
105
|
+
const nodePath = getNodePath(state.nodes, nodeId) || [nodeId]
|
|
106
|
+
|
|
107
|
+
for (const pathNodeId of nodePath) {
|
|
108
|
+
if (!state.nodesExpanded.includes(pathNodeId)) {
|
|
109
|
+
state.nodesExpanded.push(pathNodeId)
|
|
110
|
+
}
|
|
87
111
|
}
|
|
88
112
|
},
|
|
89
113
|
|