@md-plugins/quasar-app-extension-q-press 0.1.0-alpha.10

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.
Files changed (200) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +230 -0
  3. package/old/prompts.js +44 -0
  4. package/old/uninstall.js +9 -0
  5. package/package.json +60 -0
  6. package/scripts/build.js +33 -0
  7. package/src/index.js +63 -0
  8. package/src/install.js +49 -0
  9. package/src/templates/.gitkeep +0 -0
  10. package/src/templates/init/src/_q-press/.gitkeep +0 -0
  11. package/src/templates/init/src/_q-press/api/components/DarkModeToggle.json +37 -0
  12. package/src/templates/init/src/_q-press/api/components/MarkdownApi.json +67 -0
  13. package/src/templates/init/src/_q-press/api/components/MarkdownApiEntry.json +76 -0
  14. package/src/templates/init/src/_q-press/api/components/MarkdownCardLink.json +28 -0
  15. package/src/templates/init/src/_q-press/api/components/MarkdownCardTitle.json +48 -0
  16. package/src/templates/init/src/_q-press/api/components/MarkdownCode.json +37 -0
  17. package/src/templates/init/src/_q-press/api/components/MarkdownCodePrism.json +29 -0
  18. package/src/templates/init/src/_q-press/api/components/MarkdownCodepen.json +21 -0
  19. package/src/templates/init/src/_q-press/api/components/MarkdownCopyButton.json +36 -0
  20. package/src/templates/init/src/_q-press/api/components/MarkdownDrawerSidebar.json +17 -0
  21. package/src/templates/init/src/_q-press/api/components/MarkdownDrawerToc.json +17 -0
  22. package/src/templates/init/src/_q-press/api/components/MarkdownExample.json +22 -0
  23. package/src/templates/init/src/_q-press/api/components/MarkdownHeader.json +28 -0
  24. package/src/templates/init/src/_q-press/api/components/MarkdownHeaderIconLinks.json +16 -0
  25. package/src/templates/init/src/_q-press/api/components/MarkdownHeaderMenu.json +77 -0
  26. package/src/templates/init/src/_q-press/api/components/MarkdownHeaderTextLinks.json +33 -0
  27. package/src/templates/init/src/_q-press/api/components/MarkdownInstallation.json +33 -0
  28. package/src/templates/init/src/_q-press/api/components/MarkdownLayout.json +52 -0
  29. package/src/templates/init/src/_q-press/api/components/MarkdownLink.json +23 -0
  30. package/src/templates/init/src/_q-press/api/components/MarkdownPage.json +71 -0
  31. package/src/templates/init/src/_q-press/api/components/MarkdownPageFooter.json +21 -0
  32. package/src/templates/init/src/_q-press/api/components/MarkdownPageSidebar.json +56 -0
  33. package/src/templates/init/src/_q-press/api/components/MarkdownPageToc.json +17 -0
  34. package/src/templates/init/src/_q-press/api/components/MarkdownPrerender.json +25 -0
  35. package/src/templates/init/src/_q-press/api/components/MarkdownTree.json +27 -0
  36. package/src/templates/init/src/_q-press/api/composables/dark.json +29 -0
  37. package/src/templates/init/src/_q-press/api/composables/scroll.json +34 -0
  38. package/src/templates/init/src/_q-press/assets/get-meta.ts +29 -0
  39. package/src/templates/init/src/_q-press/components/DarkModeToggle.vue +105 -0
  40. package/src/templates/init/src/_q-press/components/MarkdownApi.vue +588 -0
  41. package/src/templates/init/src/_q-press/components/MarkdownApiEntry.ts +594 -0
  42. package/src/templates/init/src/_q-press/components/MarkdownCardLink.vue +25 -0
  43. package/src/templates/init/src/_q-press/components/MarkdownCardTitle.vue +21 -0
  44. package/src/templates/init/src/_q-press/components/MarkdownCode.vue +25 -0
  45. package/src/templates/init/src/_q-press/components/MarkdownCodePrism.ts +36 -0
  46. package/src/templates/init/src/_q-press/components/MarkdownCodepen.vue +183 -0
  47. package/src/templates/init/src/_q-press/components/MarkdownCopyButton.vue +104 -0
  48. package/src/templates/init/src/_q-press/components/MarkdownExample.vue +221 -0
  49. package/src/templates/init/src/_q-press/components/MarkdownInstallation.vue +166 -0
  50. package/src/templates/init/src/_q-press/components/MarkdownLink.vue +38 -0
  51. package/src/templates/init/src/_q-press/components/MarkdownPrerender.ts +82 -0
  52. package/src/templates/init/src/_q-press/components/MarkdownTree.vue +105 -0
  53. package/src/templates/init/src/_q-press/components/markdown-utils.ts +105 -0
  54. package/src/templates/init/src/_q-press/composables/dark.ts +39 -0
  55. package/src/templates/init/src/_q-press/composables/scroll.ts +115 -0
  56. package/src/templates/init/src/_q-press/css/app.scss +662 -0
  57. package/src/templates/init/src/_q-press/css/fonts.scss +100 -0
  58. package/src/templates/init/src/_q-press/css/prism-theme.scss +298 -0
  59. package/src/templates/init/src/_q-press/css/themes/default.scss +68 -0
  60. package/src/templates/init/src/_q-press/css/themes/newspaper.scss +69 -0
  61. package/src/templates/init/src/_q-press/css/themes/sunrise.scss +67 -0
  62. package/src/templates/init/src/_q-press/css/themes/tawny.scss +69 -0
  63. package/src/templates/init/src/_q-press/layouts/MarkdownDrawerSidebar.vue +32 -0
  64. package/src/templates/init/src/_q-press/layouts/MarkdownDrawerToc.vue +37 -0
  65. package/src/templates/init/src/_q-press/layouts/MarkdownHeader.vue +412 -0
  66. package/src/templates/init/src/_q-press/layouts/MarkdownHeaderIconLinks.vue +31 -0
  67. package/src/templates/init/src/_q-press/layouts/MarkdownHeaderMenu.ts +93 -0
  68. package/src/templates/init/src/_q-press/layouts/MarkdownHeaderTextLinks.vue +37 -0
  69. package/src/templates/init/src/_q-press/layouts/MarkdownLayout.vue +239 -0
  70. package/src/templates/init/src/_q-press/layouts/MarkdownPage.vue +307 -0
  71. package/src/templates/init/src/_q-press/layouts/MarkdownPageFooter.vue +187 -0
  72. package/src/templates/init/src/_q-press/layouts/MarkdownPageSidebar.scss +54 -0
  73. package/src/templates/init/src/_q-press/layouts/MarkdownPageSidebar.ts +218 -0
  74. package/src/templates/init/src/_q-press/layouts/MarkdownPageToc.vue +23 -0
  75. package/src/templates/init/src/_q-press/layouts/MarkdownSearch.vue +449 -0
  76. package/src/templates/init/src/_q-press/stores/markdown.ts +101 -0
  77. package/src/templates/init/src/components/LandingPage/LandingPage.vue +341 -0
  78. package/src/templates/init/src/components/Releases/PackageReleases.vue +164 -0
  79. package/src/templates/init/src/components/Releases/PublicReleases.vue +149 -0
  80. package/src/templates/init/src/components/Releases/ReleasesAvailable.vue +74 -0
  81. package/src/templates/init/src/examples/QAvatar/BasicExample.vue +11 -0
  82. package/src/templates/init/src/markdown/__elements.md +548 -0
  83. package/src/templates/init/src/markdown/__elements2.md +347 -0
  84. package/src/templates/init/src/markdown/faq/best-practices.md +0 -0
  85. package/src/templates/init/src/markdown/faq/general.md +0 -0
  86. package/src/templates/init/src/markdown/faq/troubleshooting.md +0 -0
  87. package/src/templates/init/src/markdown/getting-started/introduction.md +67 -0
  88. package/src/templates/init/src/markdown/guides/contributing.md +101 -0
  89. package/src/templates/init/src/markdown/guides/faq.md +115 -0
  90. package/src/templates/init/src/markdown/guides/release-notes.md +0 -0
  91. package/src/templates/init/src/markdown/guides/style-guide.md +0 -0
  92. package/src/templates/init/src/markdown/landing-page.md +11 -0
  93. package/src/templates/init/src/markdown/listing.ts +3 -0
  94. package/src/templates/init/src/markdown/md-plugins/blockquote/advanced.md +83 -0
  95. package/src/templates/init/src/markdown/md-plugins/blockquote/overview.md +183 -0
  96. package/src/templates/init/src/markdown/md-plugins/codeblocks/advanced.md +210 -0
  97. package/src/templates/init/src/markdown/md-plugins/codeblocks/overview.md +616 -0
  98. package/src/templates/init/src/markdown/md-plugins/containers/advanced.md +301 -0
  99. package/src/templates/init/src/markdown/md-plugins/containers/overview.md +206 -0
  100. package/src/templates/init/src/markdown/md-plugins/frontmatter/advanced.md +164 -0
  101. package/src/templates/init/src/markdown/md-plugins/frontmatter/overview.md +131 -0
  102. package/src/templates/init/src/markdown/md-plugins/headers/advanced.md +236 -0
  103. package/src/templates/init/src/markdown/md-plugins/headers/overview.md +134 -0
  104. package/src/templates/init/src/markdown/md-plugins/image/advanced.md +114 -0
  105. package/src/templates/init/src/markdown/md-plugins/image/overview.md +124 -0
  106. package/src/templates/init/src/markdown/md-plugins/imports/advanced.md +105 -0
  107. package/src/templates/init/src/markdown/md-plugins/imports/overview.md +80 -0
  108. package/src/templates/init/src/markdown/md-plugins/inline-code/advanced.md +133 -0
  109. package/src/templates/init/src/markdown/md-plugins/inline-code/overview.md +101 -0
  110. package/src/templates/init/src/markdown/md-plugins/link/advanced.md +157 -0
  111. package/src/templates/init/src/markdown/md-plugins/link/overview.md +126 -0
  112. package/src/templates/init/src/markdown/md-plugins/shared/overview.md +175 -0
  113. package/src/templates/init/src/markdown/md-plugins/table/advanced.md +190 -0
  114. package/src/templates/init/src/markdown/md-plugins/table/overview.md +186 -0
  115. package/src/templates/init/src/markdown/md-plugins/title/advanced.md +88 -0
  116. package/src/templates/init/src/markdown/md-plugins/title/overview.md +99 -0
  117. package/src/templates/init/src/markdown/other/release-notes.md +12 -0
  118. package/src/templates/init/src/markdown/privacy-policy.md +12 -0
  119. package/src/templates/init/src/markdown/quasar-app-extensions/qpress/advanced.md +101 -0
  120. package/src/templates/init/src/markdown/quasar-app-extensions/qpress/components.md +69 -0
  121. package/src/templates/init/src/markdown/quasar-app-extensions/qpress/overview.md +254 -0
  122. package/src/templates/init/src/markdown/quasar-app-extensions/qpress/themes.md +4 -0
  123. package/src/templates/init/src/markdown/quasar-app-extensions/vitemdpluginappext/advanced.md +4 -0
  124. package/src/templates/init/src/markdown/quasar-app-extensions/vitemdpluginappext/overview.md +103 -0
  125. package/src/templates/init/src/markdown/vite-plugins/index.md +6 -0
  126. package/src/templates/init/src/markdown/vite-plugins/viteexamplesplugin/advanced.md +138 -0
  127. package/src/templates/init/src/markdown/vite-plugins/viteexamplesplugin/overview.md +88 -0
  128. package/src/templates/init/src/markdown/vite-plugins/vitemdplugin/advanced.md +226 -0
  129. package/src/templates/init/src/markdown/vite-plugins/vitemdplugin/index.md +6 -0
  130. package/src/templates/init/src/markdown/vite-plugins/vitemdplugin/overview.md +166 -0
  131. package/src/templates/init/src/q-press.globals.d.ts +36 -0
  132. package/src/templates/init/src/siteConfig/index.ts +440 -0
  133. package/src/templates/update/src/_q-press/.gitkeep +0 -0
  134. package/src/templates/update/src/_q-press/api/components/DarkModeToggle.json +37 -0
  135. package/src/templates/update/src/_q-press/api/components/MarkdownApi.json +67 -0
  136. package/src/templates/update/src/_q-press/api/components/MarkdownApiEntry.json +76 -0
  137. package/src/templates/update/src/_q-press/api/components/MarkdownCardLink.json +28 -0
  138. package/src/templates/update/src/_q-press/api/components/MarkdownCardTitle.json +48 -0
  139. package/src/templates/update/src/_q-press/api/components/MarkdownCode.json +37 -0
  140. package/src/templates/update/src/_q-press/api/components/MarkdownCodePrism.json +29 -0
  141. package/src/templates/update/src/_q-press/api/components/MarkdownCodepen.json +21 -0
  142. package/src/templates/update/src/_q-press/api/components/MarkdownCopyButton.json +36 -0
  143. package/src/templates/update/src/_q-press/api/components/MarkdownDrawerSidebar.json +17 -0
  144. package/src/templates/update/src/_q-press/api/components/MarkdownDrawerToc.json +17 -0
  145. package/src/templates/update/src/_q-press/api/components/MarkdownExample.json +22 -0
  146. package/src/templates/update/src/_q-press/api/components/MarkdownHeader.json +28 -0
  147. package/src/templates/update/src/_q-press/api/components/MarkdownHeaderIconLinks.json +16 -0
  148. package/src/templates/update/src/_q-press/api/components/MarkdownHeaderMenu.json +77 -0
  149. package/src/templates/update/src/_q-press/api/components/MarkdownHeaderTextLinks.json +33 -0
  150. package/src/templates/update/src/_q-press/api/components/MarkdownInstallation.json +33 -0
  151. package/src/templates/update/src/_q-press/api/components/MarkdownLayout.json +52 -0
  152. package/src/templates/update/src/_q-press/api/components/MarkdownLink.json +23 -0
  153. package/src/templates/update/src/_q-press/api/components/MarkdownPage.json +71 -0
  154. package/src/templates/update/src/_q-press/api/components/MarkdownPageFooter.json +21 -0
  155. package/src/templates/update/src/_q-press/api/components/MarkdownPageSidebar.json +56 -0
  156. package/src/templates/update/src/_q-press/api/components/MarkdownPageToc.json +17 -0
  157. package/src/templates/update/src/_q-press/api/components/MarkdownPrerender.json +25 -0
  158. package/src/templates/update/src/_q-press/api/components/MarkdownTree.json +27 -0
  159. package/src/templates/update/src/_q-press/api/composables/dark.json +29 -0
  160. package/src/templates/update/src/_q-press/api/composables/scroll.json +34 -0
  161. package/src/templates/update/src/_q-press/assets/get-meta.ts +29 -0
  162. package/src/templates/update/src/_q-press/components/DarkModeToggle.vue +105 -0
  163. package/src/templates/update/src/_q-press/components/MarkdownApi.vue +588 -0
  164. package/src/templates/update/src/_q-press/components/MarkdownApiEntry.ts +594 -0
  165. package/src/templates/update/src/_q-press/components/MarkdownCardLink.vue +25 -0
  166. package/src/templates/update/src/_q-press/components/MarkdownCardTitle.vue +21 -0
  167. package/src/templates/update/src/_q-press/components/MarkdownCode.vue +25 -0
  168. package/src/templates/update/src/_q-press/components/MarkdownCodePrism.ts +36 -0
  169. package/src/templates/update/src/_q-press/components/MarkdownCodepen.vue +183 -0
  170. package/src/templates/update/src/_q-press/components/MarkdownCopyButton.vue +104 -0
  171. package/src/templates/update/src/_q-press/components/MarkdownExample.vue +221 -0
  172. package/src/templates/update/src/_q-press/components/MarkdownInstallation.vue +166 -0
  173. package/src/templates/update/src/_q-press/components/MarkdownLink.vue +38 -0
  174. package/src/templates/update/src/_q-press/components/MarkdownPrerender.ts +82 -0
  175. package/src/templates/update/src/_q-press/components/MarkdownTree.vue +105 -0
  176. package/src/templates/update/src/_q-press/components/markdown-utils.ts +105 -0
  177. package/src/templates/update/src/_q-press/composables/dark.ts +39 -0
  178. package/src/templates/update/src/_q-press/composables/scroll.ts +115 -0
  179. package/src/templates/update/src/_q-press/css/app.scss +662 -0
  180. package/src/templates/update/src/_q-press/css/fonts.scss +100 -0
  181. package/src/templates/update/src/_q-press/css/prism-theme.scss +298 -0
  182. package/src/templates/update/src/_q-press/css/themes/default.scss +68 -0
  183. package/src/templates/update/src/_q-press/css/themes/newspaper.scss +69 -0
  184. package/src/templates/update/src/_q-press/css/themes/sunrise.scss +67 -0
  185. package/src/templates/update/src/_q-press/css/themes/tawny.scss +69 -0
  186. package/src/templates/update/src/_q-press/layouts/MarkdownDrawerSidebar.vue +32 -0
  187. package/src/templates/update/src/_q-press/layouts/MarkdownDrawerToc.vue +37 -0
  188. package/src/templates/update/src/_q-press/layouts/MarkdownHeader.vue +412 -0
  189. package/src/templates/update/src/_q-press/layouts/MarkdownHeaderIconLinks.vue +31 -0
  190. package/src/templates/update/src/_q-press/layouts/MarkdownHeaderMenu.ts +93 -0
  191. package/src/templates/update/src/_q-press/layouts/MarkdownHeaderTextLinks.vue +37 -0
  192. package/src/templates/update/src/_q-press/layouts/MarkdownLayout.vue +239 -0
  193. package/src/templates/update/src/_q-press/layouts/MarkdownPage.vue +307 -0
  194. package/src/templates/update/src/_q-press/layouts/MarkdownPageFooter.vue +187 -0
  195. package/src/templates/update/src/_q-press/layouts/MarkdownPageSidebar.scss +54 -0
  196. package/src/templates/update/src/_q-press/layouts/MarkdownPageSidebar.ts +218 -0
  197. package/src/templates/update/src/_q-press/layouts/MarkdownPageToc.vue +23 -0
  198. package/src/templates/update/src/_q-press/layouts/MarkdownSearch.vue +449 -0
  199. package/src/templates/update/src/_q-press/stores/markdown.ts +101 -0
  200. package/src/templates/update/src/q-press.globals.d.ts +36 -0
@@ -0,0 +1,588 @@
1
+ <template>
2
+ <q-card class="markdown-api q-my-xl" flat bordered>
3
+ <div class="header-toolbar row items-center q-pr-sm">
4
+ <MarkdownCardTitle :title="nameBanner" />
5
+
6
+ <div
7
+ class="col markdown-api__search-field row items-center no-wrap"
8
+ @click="onSearchFieldClick"
9
+ >
10
+ <input
11
+ class="col markdown-api__search text-right"
12
+ ref="inputRef"
13
+ v-model="filter"
14
+ name="filter"
15
+ placeholder="Filter..."
16
+ />
17
+ <q-btn
18
+ :icon="inputIcon"
19
+ class="header-btn q-ml-xs"
20
+ dense
21
+ flat
22
+ round
23
+ @click="onFilterClick"
24
+ />
25
+ </div>
26
+
27
+ <q-btn
28
+ class="q-ml-sm header-btn"
29
+ v-if="props.pageLink"
30
+ size="sm"
31
+ padding="xs sm"
32
+ no-caps
33
+ outline
34
+ :to="apiPath"
35
+ >
36
+ <q-icon name="launch" />
37
+ <div class="q-ml-xs">Docs</div>
38
+ </q-btn>
39
+ </div>
40
+
41
+ <q-linear-progress v-if="loading" color="brand-primary" indeterminate class="q-mt-xs" />
42
+ <template v-else-if="nothingToShow">
43
+ <q-separator />
44
+ <div class="markdown-api__nothing-to-show">Nothing to display</div>
45
+ </template>
46
+ <template v-else>
47
+ <q-tabs
48
+ class="header-tabs"
49
+ v-model="currentTab"
50
+ active-color="brand-primary"
51
+ indicator-color="brand-primary"
52
+ align="left"
53
+ :breakpoint="0"
54
+ >
55
+ <q-tab v-for="tab in tabsList" :key="`api-tab-${tab}`" :name="tab" class="header-btn">
56
+ <div class="row no-wrap items-center">
57
+ <span class="q-mr-xs text-capitalize">{{ tab }}</span>
58
+ <q-badge v-if="filteredApiCount[tab].overall" :label="filteredApiCount[tab].overall" />
59
+ </div>
60
+ </q-tab>
61
+ </q-tabs>
62
+
63
+ <q-separator />
64
+
65
+ <q-tab-panels v-model="currentTab" animated>
66
+ <q-tab-panel class="q-pa-none" v-for="tab in tabsList" :name="tab" :key="tab">
67
+ <div class="markdown-api__container row no-wrap" v-if="innerTabsList[tab].length !== 1">
68
+ <div class="col-auto">
69
+ <q-tabs
70
+ class="header-tabs markdown-api__subtabs"
71
+ v-model="currentInnerTab"
72
+ active-color="brand-primary"
73
+ indicator-color="brand-primary"
74
+ :breakpoint="0"
75
+ vertical
76
+ dense
77
+ shrink
78
+ >
79
+ <q-tab
80
+ class="markdown-api__subtabs-item header-btn"
81
+ v-for="innerTab in innerTabsList[tab]"
82
+ :key="`api-inner-tab-${innerTab}`"
83
+ :name="innerTab"
84
+ >
85
+ <div class="row no-wrap items-center self-stretch q-pl-sm">
86
+ <span class="q-mr-xs text-capitalize">{{ innerTab }}</span>
87
+ <div class="col" />
88
+ <q-badge
89
+ v-if="filteredApiCount[tab].category[innerTab]"
90
+ :label="filteredApiCount[tab].category[innerTab]"
91
+ />
92
+ </div>
93
+ </q-tab>
94
+ </q-tabs>
95
+ </div>
96
+
97
+ <q-separator vertical />
98
+
99
+ <q-tab-panels
100
+ class="col"
101
+ v-model="currentInnerTab"
102
+ animated
103
+ transition-prev="slide-down"
104
+ transition-next="slide-up"
105
+ >
106
+ <q-tab-panel
107
+ class="q-pa-none"
108
+ v-for="innerTab in innerTabsList[tab]"
109
+ :name="innerTab"
110
+ :key="innerTab"
111
+ >
112
+ <MarkdownApiEntry :type="tab" :definition="filteredApi[tab][innerTab]" />
113
+ </q-tab-panel>
114
+ </q-tab-panels>
115
+ </div>
116
+ <div class="markdown-api__container" v-else>
117
+ <MarkdownApiEntry :type="tab" :definition="filteredApi[tab][defaultInnerTabName]" />
118
+ </div>
119
+ </q-tab-panel>
120
+ </q-tab-panels>
121
+ </template>
122
+ </q-card>
123
+ </template>
124
+
125
+ <script setup lang="js">
126
+ import { ref, computed, watch, onMounted } from 'vue'
127
+ import { mdiClose, mdiMagnify } from '@quasar/extras/mdi-v7'
128
+
129
+ import MarkdownCardTitle from './MarkdownCardTitle.vue'
130
+ import MarkdownApiEntry from './MarkdownApiEntry'
131
+
132
+ const defaultInnerTabName = '__default'
133
+
134
+ function getPropsCategories(props) {
135
+ const acc = new Set()
136
+
137
+ for (const key in props) {
138
+ if (props[key] !== void 0) {
139
+ const value = props[key]
140
+
141
+ value.category.split('|').forEach((groupKey) => {
142
+ acc.add(groupKey)
143
+ })
144
+ }
145
+ }
146
+
147
+ return acc.size === 1 ? [defaultInnerTabName] : Array.from(acc).sort()
148
+ }
149
+
150
+ function getInnerTabs(api, tabs, apiType) {
151
+ const acc = {}
152
+
153
+ tabs.forEach((tab) => {
154
+ acc[tab] =
155
+ apiType === 'component' && tab === 'props'
156
+ ? getPropsCategories(api[tab])
157
+ : [defaultInnerTabName]
158
+ })
159
+
160
+ return acc
161
+ }
162
+
163
+ function parseApi(api, tabs, innerTabs) {
164
+ const acc = {}
165
+
166
+ tabs.forEach((tab) => {
167
+ const apiValue = api[tab]
168
+
169
+ if (innerTabs[tab].length > 1) {
170
+ const inner = {}
171
+
172
+ innerTabs[tab].forEach((subTab) => {
173
+ inner[subTab] = {}
174
+ })
175
+
176
+ for (const key in apiValue) {
177
+ if (apiValue[key] !== void 0) {
178
+ const value = apiValue[key]
179
+
180
+ value.category.split('|').forEach((groupKey) => {
181
+ inner[groupKey][key] = value
182
+ })
183
+ }
184
+ }
185
+
186
+ acc[tab] = inner
187
+ } else {
188
+ acc[tab] = {}
189
+ acc[tab][defaultInnerTabName] = apiValue
190
+ }
191
+ })
192
+
193
+ return acc
194
+ }
195
+
196
+ function passesFilter(filter, name, desc) {
197
+ return (
198
+ name.toLowerCase().indexOf(filter) > -1 ||
199
+ (desc !== void 0 && desc.toLowerCase().indexOf(filter) > -1)
200
+ )
201
+ }
202
+
203
+ function getFilteredApi(parsedApi, filter, tabs, innerTabs) {
204
+ if (filter === '') {
205
+ return parsedApi
206
+ }
207
+
208
+ const acc = {}
209
+
210
+ tabs.forEach((tab) => {
211
+ if (tab === 'injection') {
212
+ const name = parsedApi[tab][defaultInnerTabName]
213
+ acc[tab] = {}
214
+ acc[tab][defaultInnerTabName] = passesFilter(filter, name, '') === true ? name : {}
215
+ return
216
+ }
217
+
218
+ if (tab === 'quasarConfOptions') {
219
+ const api = parsedApi[tab][defaultInnerTabName]
220
+ acc[tab] = {}
221
+ acc[tab][defaultInnerTabName] = {
222
+ ...api,
223
+ definition: {},
224
+ }
225
+ const result = acc[tab][defaultInnerTabName]
226
+
227
+ for (const name in api.definition || {}) {
228
+ const entry = api.definition[name]
229
+ if (passesFilter(filter, name, entry.desc) === true) {
230
+ result.definition[name] = entry
231
+ }
232
+ }
233
+
234
+ if (
235
+ Object.keys(result.definition).length === 0 &&
236
+ passesFilter(filter, api.propName, '') === false
237
+ ) {
238
+ acc[tab][defaultInnerTabName] = {}
239
+ }
240
+
241
+ return
242
+ }
243
+
244
+ const tabApi = parsedApi[tab]
245
+ const tabCategories = innerTabs[tab]
246
+
247
+ acc[tab] = {}
248
+ tabCategories.forEach((categ) => {
249
+ const subTabs = {}
250
+ const categoryEntries = tabApi[categ]
251
+
252
+ for (const name in categoryEntries) {
253
+ const entry = categoryEntries[name]
254
+ if (passesFilter(filter, name, entry.desc) === true) {
255
+ subTabs[name] = entry
256
+ }
257
+ }
258
+
259
+ acc[tab][categ] = subTabs
260
+ })
261
+ })
262
+
263
+ return acc
264
+ }
265
+
266
+ function getApiCount(parsedApi, tabs, innerTabs) {
267
+ const acc = {}
268
+
269
+ tabs.forEach((tab) => {
270
+ const tabApi = parsedApi[tab]
271
+ const tabCategories = innerTabs[tab]
272
+
273
+ if (['value', 'arg', 'injection'].includes(tab)) {
274
+ acc[tab] = {
275
+ overall: Object.keys(tabApi[tabCategories[0]]).length === 0 ? 0 : 1,
276
+ }
277
+ return
278
+ }
279
+
280
+ if (tab === 'quasarConfOptions') {
281
+ const api = tabApi[tabCategories[0]]
282
+ acc[tab] = {
283
+ overall:
284
+ Object.keys(api).length === 0
285
+ ? 0
286
+ : api.definition === void 0
287
+ ? 1
288
+ : Object.keys(api.definition).length,
289
+ }
290
+ return
291
+ }
292
+
293
+ acc[tab] = { overall: 0 }
294
+
295
+ if (tabCategories.length === 1) {
296
+ const categ = tabCategories[0]
297
+ const count = Object.keys(tabApi[categ]).length
298
+
299
+ acc[tab] = {
300
+ overall: count,
301
+ category: { [categ]: count },
302
+ }
303
+ } else {
304
+ acc[tab].category = {}
305
+
306
+ tabCategories.forEach((categ) => {
307
+ const count = Object.keys(tabApi[categ]).length
308
+ acc[tab].category[categ] = count
309
+ acc[tab].overall += count
310
+ })
311
+ }
312
+ })
313
+
314
+ return acc
315
+ }
316
+
317
+ const getJsonUrl =
318
+ process.env.DEV === true
319
+ ? (file) => `/@fs/${process.env.FS_QUASAR_FOLDER}/dist/api/${file}.json`
320
+ : (file) => `/quasar-api/${file}.json`
321
+
322
+ const props = defineProps({
323
+ file: {
324
+ type: String,
325
+ required: false,
326
+ },
327
+ api: {
328
+ type: Object,
329
+ required: false,
330
+ },
331
+ name: String,
332
+ pageLink: Boolean,
333
+ })
334
+
335
+ const inputRef = ref(null)
336
+
337
+ const loading = ref(true)
338
+ const nameBanner = ref(`Loading ${props.file || props.name} API...`)
339
+ const nothingToShow = ref(false)
340
+
341
+ const apiPath = ref('')
342
+
343
+ const filter = ref('')
344
+ const apiDef = ref({})
345
+
346
+ const tabsList = ref([])
347
+ const innerTabsList = ref({})
348
+
349
+ const currentTab = ref(null)
350
+ const currentInnerTab = ref(null)
351
+
352
+ watch(currentTab, (val) => {
353
+ currentInnerTab.value = innerTabsList.value[val][0]
354
+ })
355
+
356
+ const inputIcon = computed(() => (filter.value !== '' ? mdiClose : mdiMagnify))
357
+ const filteredApi = computed(() =>
358
+ getFilteredApi(apiDef.value, filter.value.toLowerCase(), tabsList.value, innerTabsList.value),
359
+ )
360
+ const filteredApiCount = computed(() =>
361
+ getApiCount(filteredApi.value, tabsList.value, innerTabsList.value),
362
+ )
363
+
364
+ function parseApiFile(name, { type, behavior, meta, addedIn, ...api }) {
365
+ nameBanner.value = `${name} API`
366
+ apiPath.value = meta.docsUrl
367
+
368
+ const { internal: _, ...apiSections } = api
369
+ const tabs = Object.keys(apiSections)
370
+
371
+ if (tabs.length === 0) {
372
+ nothingToShow.value = true
373
+ return
374
+ }
375
+
376
+ tabsList.value = tabs
377
+ currentTab.value = tabs[0]
378
+
379
+ const subTabs = getInnerTabs(api, tabs, type)
380
+ innerTabsList.value = subTabs
381
+ apiDef.value = parseApi(api, tabs, subTabs)
382
+ }
383
+
384
+ function onSearchFieldClick() {
385
+ inputRef.value.focus()
386
+ }
387
+
388
+ function onFilterClick() {
389
+ if (filter.value !== '') {
390
+ filter.value = ''
391
+ }
392
+ }
393
+
394
+ if (process.env.CLIENT) {
395
+ onMounted(() => {
396
+ if (props.file) {
397
+ fetch(getJsonUrl(props.file))
398
+ .then((response) => response.json())
399
+ .then((json) => {
400
+ parseApiFile(props.file, json)
401
+ loading.value = false
402
+ })
403
+ } else if (props.api) {
404
+ parseApiFile(props.name, props.api)
405
+ loading.value = false
406
+ }
407
+ })
408
+ }
409
+ </script>
410
+
411
+ <style lang="scss">
412
+ .markdown-api {
413
+ &__subtabs .q-tabs__content {
414
+ padding: 8px 0;
415
+ }
416
+
417
+ &__subtabs-item {
418
+ justify-content: left;
419
+ min-height: 36px !important;
420
+
421
+ .q-tab__content {
422
+ width: 100%;
423
+ }
424
+ }
425
+
426
+ &__subtabs,
427
+ &__subtabs-item {
428
+ border-radius: 0 !important;
429
+ }
430
+
431
+ &__container {
432
+ max-height: 600px;
433
+ }
434
+
435
+ &__nothing-to-show {
436
+ padding: 16px;
437
+ }
438
+
439
+ &__search-field {
440
+ cursor: text;
441
+ min-width: 10em !important;
442
+ }
443
+
444
+ &__search {
445
+ border: 0;
446
+ outline: 0;
447
+ background: none;
448
+ color: inherit;
449
+ width: 1px !important; // required when on narrow width window to not overflow the page
450
+ height: 37px;
451
+ }
452
+ }
453
+
454
+ .markdown-api-entry {
455
+ padding: 16px;
456
+ color: $header-btn-color--light;
457
+
458
+ .markdown-api-entry {
459
+ padding: 8px;
460
+ }
461
+
462
+ & + & {
463
+ border-top: 1px solid #ddd;
464
+ }
465
+
466
+ &__expand-btn {
467
+ margin-left: 4px;
468
+ }
469
+
470
+ &__item {
471
+ min-height: 25px;
472
+
473
+ & + & {
474
+ margin-top: 4px;
475
+ }
476
+ }
477
+
478
+ &__subitem {
479
+ padding: 4px 0 0 8px;
480
+ border-radius: $generic-border-radius;
481
+
482
+ > div {
483
+ border: 1px solid rgba(0, 0, 0, 0.12) !important;
484
+ border-radius: inherit;
485
+ }
486
+
487
+ > div + div {
488
+ margin-top: 8px;
489
+ }
490
+ }
491
+
492
+ &__type {
493
+ line-height: ($font-size + 8px);
494
+ }
495
+
496
+ &__value {
497
+ color: $light-text;
498
+ }
499
+
500
+ &--indent {
501
+ padding-left: 8px;
502
+ }
503
+
504
+ .markdown-token {
505
+ margin: 4px;
506
+ display: inline-block;
507
+ }
508
+
509
+ &__added-in,
510
+ &__pill {
511
+ font-size: ($font-size - 1px);
512
+ letter-spacing: $letter-spacing-brand;
513
+ line-height: 1.4em;
514
+ }
515
+
516
+ &__added-in {
517
+ font-size: ($font-size - 4px);
518
+ }
519
+ }
520
+
521
+ body.body--light {
522
+ .markdown-api .q-badge {
523
+ color: $brand-light;
524
+ background-color: $brand-dark;
525
+ }
526
+
527
+ .markdown-api .markdown-token {
528
+ background-color: #eee;
529
+ border: 1px solid $separator-color;
530
+ color: $light-text;
531
+ }
532
+
533
+ .markdown-api-entry__pill {
534
+ color: #fff;
535
+ }
536
+
537
+ .markdown-api-entry__added-in {
538
+ color: $red-7;
539
+ border-color: $red;
540
+ background-color: $red-1;
541
+ }
542
+ }
543
+
544
+ body.body--dark {
545
+ .markdown-api .q-badge {
546
+ color: $brand-dark;
547
+ background-color: $brand-primary;
548
+ }
549
+
550
+ .markdown-api .markdown-token {
551
+ background-color: $dark-bg;
552
+ border: 1px solid $separator-dark-color;
553
+ color: $dark-text;
554
+ }
555
+
556
+ .markdown-api__search {
557
+ color: $dark-text;
558
+ }
559
+
560
+ .markdown-api-entry {
561
+ color: $brand-medium;
562
+
563
+ & + .markdown-api-entry,
564
+ &__subitem > div {
565
+ border-color: $separator-dark-color !important;
566
+ }
567
+
568
+ &__value {
569
+ color: $dark-text;
570
+ }
571
+
572
+ &__example {
573
+ color: $brand-primary;
574
+ border-color: $brand-primary;
575
+ }
576
+
577
+ &__pill {
578
+ color: $dark;
579
+ }
580
+
581
+ &__added-in {
582
+ color: $red;
583
+ border-color: $red;
584
+ background-color: $dark-bg;
585
+ }
586
+ }
587
+ }
588
+ </style>