inicontent 1.0.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.
Files changed (205) hide show
  1. package/.github/pull_request.yml +18 -0
  2. package/CONTRIBUTING.md +67 -0
  3. package/LICENSE +21 -0
  4. package/README.md +142 -0
  5. package/app/app.vue +106 -0
  6. package/app/assets/main.css +974 -0
  7. package/app/components/Api/EndpointCard.vue +169 -0
  8. package/app/components/Api/SchemaDocsTable.vue +208 -0
  9. package/app/components/Asset/Card.vue +1363 -0
  10. package/app/components/Asset/Grid.vue +295 -0
  11. package/app/components/Asset/Icon.vue +38 -0
  12. package/app/components/Asset/Preview.vue +486 -0
  13. package/app/components/Asset/Scanner.vue +700 -0
  14. package/app/components/Asset/Thumb.vue +708 -0
  15. package/app/components/Auth/Reset.vue +99 -0
  16. package/app/components/Auth/index.vue +346 -0
  17. package/app/components/ChatInterface.vue +2326 -0
  18. package/app/components/ChatPagePreview.vue +34 -0
  19. package/app/components/Column/Array.vue +29 -0
  20. package/app/components/Column/Asset.vue +21 -0
  21. package/app/components/Column/Boolean.vue +12 -0
  22. package/app/components/Column/Color.vue +9 -0
  23. package/app/components/Column/Date.vue +57 -0
  24. package/app/components/Column/Edit.vue +215 -0
  25. package/app/components/Column/Email.vue +9 -0
  26. package/app/components/Column/Html.vue +27 -0
  27. package/app/components/Column/Id.vue +20 -0
  28. package/app/components/Column/Locale.vue +32 -0
  29. package/app/components/Column/Object.vue +18 -0
  30. package/app/components/Column/Password.vue +7 -0
  31. package/app/components/Column/Role.vue +15 -0
  32. package/app/components/Column/S.vue +14 -0
  33. package/app/components/Column/Table/Single.vue +49 -0
  34. package/app/components/Column/Table/index.vue +42 -0
  35. package/app/components/Column/Tags.vue +31 -0
  36. package/app/components/Column/Text.vue +9 -0
  37. package/app/components/Column/Url.vue +9 -0
  38. package/app/components/Column/index.vue +41 -0
  39. package/app/components/Dashboard/Editor.vue +221 -0
  40. package/app/components/Dashboard/Grid.vue +270 -0
  41. package/app/components/Dashboard/View.vue +131 -0
  42. package/app/components/Dashboard/Widget/BarChart.vue +73 -0
  43. package/app/components/Dashboard/Widget/Counter.vue +51 -0
  44. package/app/components/Dashboard/Widget/LineChart.vue +76 -0
  45. package/app/components/Dashboard/Widget/PieChart.vue +75 -0
  46. package/app/components/Dashboard/Widget/Table.vue +94 -0
  47. package/app/components/Dashboard/WidgetEditor.vue +274 -0
  48. package/app/components/Data/Array.vue +102 -0
  49. package/app/components/Data/Html.vue +9 -0
  50. package/app/components/Data/Icon.vue +9 -0
  51. package/app/components/Data/Object.vue +10 -0
  52. package/app/components/Data/S.vue +16 -0
  53. package/app/components/Data/Table.vue +53 -0
  54. package/app/components/Data/Value.vue +34 -0
  55. package/app/components/Data/index.vue +14 -0
  56. package/app/components/Field/Array.vue +324 -0
  57. package/app/components/Field/Asset/Actions.vue +97 -0
  58. package/app/components/Field/Asset/index.vue +639 -0
  59. package/app/components/Field/Boolean.vue +26 -0
  60. package/app/components/Field/Checkbox.vue +48 -0
  61. package/app/components/Field/Color.vue +27 -0
  62. package/app/components/Field/Date.vue +30 -0
  63. package/app/components/Field/Email.vue +51 -0
  64. package/app/components/Field/EmailTemplate.vue +420 -0
  65. package/app/components/Field/Html/ColorPicker.vue +127 -0
  66. package/app/components/Field/Html/Editor.vue +544 -0
  67. package/app/components/Field/Html/index.vue +25 -0
  68. package/app/components/Field/Icon.vue +114 -0
  69. package/app/components/Field/JSON.vue +113 -0
  70. package/app/components/Field/Mention.vue +36 -0
  71. package/app/components/Field/Number.vue +27 -0
  72. package/app/components/Field/Object.vue +92 -0
  73. package/app/components/Field/Password.vue +55 -0
  74. package/app/components/Field/Radio.vue +47 -0
  75. package/app/components/Field/S.vue +44 -0
  76. package/app/components/Field/Select.vue +49 -0
  77. package/app/components/Field/Table.vue +348 -0
  78. package/app/components/Field/Tags.vue +113 -0
  79. package/app/components/Field/Text.vue +31 -0
  80. package/app/components/Field/Textarea.vue +33 -0
  81. package/app/components/Field/Url.vue +40 -0
  82. package/app/components/Field/Wrapper.vue +128 -0
  83. package/app/components/Field/index.vue +68 -0
  84. package/app/components/FloatingChatbot.vue +73 -0
  85. package/app/components/Form/Card.vue +151 -0
  86. package/app/components/Form/Drawer.vue +195 -0
  87. package/app/components/Form/index.vue +621 -0
  88. package/app/components/Header.vue +328 -0
  89. package/app/components/Offline/ConflictModal.vue +200 -0
  90. package/app/components/Offline/SyncStatus.vue +249 -0
  91. package/app/components/PlatformFeatureLanding.vue +65 -0
  92. package/app/components/Table/Backups.vue +638 -0
  93. package/app/components/Table/Flows.vue +814 -0
  94. package/app/components/Table/Grid.vue +296 -0
  95. package/app/components/Table/Icon.vue +36 -0
  96. package/app/components/Table/Logs.vue +181 -0
  97. package/app/components/Table/Schedules.vue +722 -0
  98. package/app/components/Table/Search/Button.vue +256 -0
  99. package/app/components/Table/Search/Items.vue +286 -0
  100. package/app/components/Table/Search/index.vue +87 -0
  101. package/app/components/Table/Settings/Schema.vue +801 -0
  102. package/app/components/Table/Settings/index.vue +631 -0
  103. package/app/components/Table/TranslateDrawer.vue +526 -0
  104. package/app/components/Table/Views/Kanban.vue +289 -0
  105. package/app/components/Table/Views/Table.vue +1273 -0
  106. package/app/components/Table/index.vue +890 -0
  107. package/app/composables/Translation/define.ts +41 -0
  108. package/app/composables/Translation/fetch.ts +107 -0
  109. package/app/composables/Translation/languages.ts +1 -0
  110. package/app/composables/Translation/loadCoreTranslations.ts +38 -0
  111. package/app/composables/Translation/translate.ts +250 -0
  112. package/app/composables/databaseCookies.ts +79 -0
  113. package/app/composables/fieldValidator.ts +72 -0
  114. package/app/composables/fieldsList.ts +301 -0
  115. package/app/composables/formatDatabase.ts +101 -0
  116. package/app/composables/index.ts +444 -0
  117. package/app/composables/openDrawer.ts +118 -0
  118. package/app/composables/optimizeFile.ts +287 -0
  119. package/app/composables/renderLabel.ts +88 -0
  120. package/app/composables/schemaClipboard.ts +95 -0
  121. package/app/composables/search.ts +353 -0
  122. package/app/composables/setThemeConfig.ts +48 -0
  123. package/app/composables/translationValue.ts +169 -0
  124. package/app/composables/useAssetPreview.ts +84 -0
  125. package/app/composables/useAssetUploader.ts +56 -0
  126. package/app/composables/useDashboardData.ts +310 -0
  127. package/app/composables/useDocumentThumbnail.ts +351 -0
  128. package/app/composables/useEcharts.ts +33 -0
  129. package/app/composables/useLocalDatabaseConfig.ts +51 -0
  130. package/app/composables/useOcr.ts +300 -0
  131. package/app/composables/useOfflineFetch.ts +194 -0
  132. package/app/composables/useOfflineItem.ts +107 -0
  133. package/app/composables/useOfflineQueue.ts +302 -0
  134. package/app/composables/useOfflineSync.ts +235 -0
  135. package/app/composables/usePasskeyAuth.ts +156 -0
  136. package/app/composables/usePdfCompressor.ts +180 -0
  137. package/app/composables/usePlatformRedirect.ts +72 -0
  138. package/app/composables/useRealtimeSync.ts +233 -0
  139. package/app/composables/useReferencedItems.ts +180 -0
  140. package/app/composables/useScanner.ts +664 -0
  141. package/app/composables/useSubscription.ts +650 -0
  142. package/app/composables/useThumbnailCache.ts +136 -0
  143. package/app/composables/useVideoCompressor.ts +194 -0
  144. package/app/error.vue +112 -0
  145. package/app/layouts/api.vue +188 -0
  146. package/app/layouts/dashboard.vue +91 -0
  147. package/app/layouts/default.vue +228 -0
  148. package/app/layouts/table.vue +471 -0
  149. package/app/locales/ar.ts +996 -0
  150. package/app/locales/en.ts +655 -0
  151. package/app/locales/es.ts +996 -0
  152. package/app/locales/fr.ts +997 -0
  153. package/app/middleware/dashboard.ts +33 -0
  154. package/app/middleware/database.ts +83 -0
  155. package/app/middleware/global.ts +1 -0
  156. package/app/middleware/sid-ingest.global.ts +29 -0
  157. package/app/middleware/table.ts +54 -0
  158. package/app/middleware/user.ts +26 -0
  159. package/app/pages/[[database]]/admin/api/auth/index.vue +306 -0
  160. package/app/pages/[[database]]/admin/api/index.vue +18 -0
  161. package/app/pages/[[database]]/admin/api/tables/[table]/index.vue +497 -0
  162. package/app/pages/[[database]]/admin/api/tables/index.vue +87 -0
  163. package/app/pages/[[database]]/admin/billing/index.vue +16 -0
  164. package/app/pages/[[database]]/admin/dashboards/[id]/edit.vue +66 -0
  165. package/app/pages/[[database]]/admin/dashboards/[id]/index.vue +117 -0
  166. package/app/pages/[[database]]/admin/dashboards/index.vue +20 -0
  167. package/app/pages/[[database]]/admin/index.vue +28 -0
  168. package/app/pages/[[database]]/admin/settings.vue +526 -0
  169. package/app/pages/[[database]]/admin/tables/[table]/[id]/edit.vue +143 -0
  170. package/app/pages/[[database]]/admin/tables/[table]/[id]/index.vue +146 -0
  171. package/app/pages/[[database]]/admin/tables/[table]/flows.vue +10 -0
  172. package/app/pages/[[database]]/admin/tables/[table]/index.vue +10 -0
  173. package/app/pages/[[database]]/admin/tables/[table]/new.vue +12 -0
  174. package/app/pages/[[database]]/admin/tables/[table]/schedules.vue +10 -0
  175. package/app/pages/[[database]]/admin/tables/[table]/settings.vue +30 -0
  176. package/app/pages/[[database]]/admin/tables/assets/[...path].vue +24 -0
  177. package/app/pages/[[database]]/admin/tables/assets/flows.vue +10 -0
  178. package/app/pages/[[database]]/admin/tables/backups/index.vue +10 -0
  179. package/app/pages/[[database]]/admin/tables/blocks/index.vue +16 -0
  180. package/app/pages/[[database]]/admin/tables/index.vue +20 -0
  181. package/app/pages/[[database]]/admin/tables/pages/index.vue +16 -0
  182. package/app/pages/[[database]]/admin/tables/templates/index.vue +16 -0
  183. package/app/pages/[[database]]/api/index.vue +120 -0
  184. package/app/pages/[[database]]/auth/index.vue +12 -0
  185. package/app/pages/[[database]]/auth/reset.vue +10 -0
  186. package/app/pages/[[database]]/index.vue +10 -0
  187. package/app/plugins/offline-warmup.client.ts +53 -0
  188. package/app/plugins/template-globals.ts +9 -0
  189. package/app/spa-loading-template.html +93 -0
  190. package/biome.json +53 -0
  191. package/index.d.ts +380 -0
  192. package/modules/naiveui.ts +41 -0
  193. package/nuxt.config.ts +269 -0
  194. package/package.json +56 -0
  195. package/pnpm-workspace.yaml +5 -0
  196. package/public/apple-touch-icon.png +0 -0
  197. package/public/favicon-16x16.png +0 -0
  198. package/public/favicon-32x32.png +0 -0
  199. package/public/favicon.ico +0 -0
  200. package/public/pwa-192x192.png +0 -0
  201. package/public/pwa-512x512.png +0 -0
  202. package/public/pwa-maskable-192x192.png +0 -0
  203. package/public/pwa-maskable-512x512.png +0 -0
  204. package/public/vendor/opencv.js +48 -0
  205. package/tsconfig.json +9 -0
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Warm the runtime caches on the very first visit.
3
+ *
4
+ * The page's boot requests — notably the database metadata fetch in
5
+ * middleware/database.ts — fire before the freshly installed service worker
6
+ * activates and claims the page. They are therefore NOT intercepted by workbox
7
+ * and never populate the runtime caches, so offline used to work only from the
8
+ * second visit onward.
9
+ *
10
+ * When the service worker takes control for the first time (clientsClaim), we
11
+ * reload the page once: every boot request on the reloaded page flows through
12
+ * the SW, caching the DB metadata (and anything else requested early) plus the
13
+ * still-warming chunks. Offline then works from the very first visit.
14
+ *
15
+ * The reload is a one-shot: `sessionStorage` survives the reload and the module
16
+ * flag guards the rest of the page's lifetime, so a later SW update that
17
+ * re-claims the page never triggers another reload.
18
+ */
19
+ export default defineNuxtPlugin(() => {
20
+ if (typeof navigator === "undefined" || !("serviceWorker" in navigator))
21
+ return;
22
+
23
+ // Already controlled: this page's boot requests were intercepted and the
24
+ // caches are warm — no reload needed.
25
+ if (navigator.serviceWorker.controller) return;
26
+
27
+ const WARMED_FLAG = "inicontent:sw-first-claim-warmed";
28
+ let reloadRequested = false;
29
+
30
+ const hasWarmed = () => {
31
+ try {
32
+ return sessionStorage.getItem(WARMED_FLAG) !== null;
33
+ } catch {
34
+ return reloadRequested;
35
+ }
36
+ };
37
+
38
+ const markWarmed = () => {
39
+ reloadRequested = true;
40
+ try {
41
+ sessionStorage.setItem(WARMED_FLAG, "1");
42
+ } catch {
43
+ /* the module flag still prevents a second reload this page */
44
+ }
45
+ };
46
+
47
+ navigator.serviceWorker.addEventListener("controllerchange", () => {
48
+ if (!navigator.serviceWorker.controller) return;
49
+ if (hasWarmed()) return;
50
+ markWarmed();
51
+ window.location.reload();
52
+ });
53
+ });
@@ -0,0 +1,9 @@
1
+ import * as composables from "@/composables";
2
+
3
+ export default defineNuxtPlugin((nuxtApp) => {
4
+ for (const [key, val] of Object.entries(composables)) {
5
+ if (typeof val === "function") {
6
+ (nuxtApp.vueApp.config.globalProperties as any)[key] = val;
7
+ }
8
+ }
9
+ });
@@ -0,0 +1,93 @@
1
+ <div id="loaderDIV">
2
+ <svg id="loaderSVG" width="283.953125" height="60.5859375" viewBox="0 0 283.953125 62.5859375"
3
+ xmlns="http://www.w3.org/2000/svg" style="vertical-align: text-top;">
4
+ <title>Loading</title>
5
+ <g stroke-linecap="round" stroke="#000" fill="transparent">
6
+ <path d="M10.87 60L5.89 60L5.89 17.17L10.87 17.17L10.87 60Z"
7
+ style="stroke-dasharray: 95, 97;stroke-dashoffset: 96;animation: 1000ms linear 0ms infinite alternate forwards running STAdraw;">
8
+ </path>
9
+ <path
10
+ d="M48.72 60L43.86 60L43.86 39.23Q43.86 35.30 42.07 33.37Q40.28 31.44 36.47 31.44L36.47 31.44Q31.44 31.44 29.09 34.16Q26.75 36.88 26.75 43.15L26.75 43.15L26.75 60L21.88 60L21.88 27.89L25.84 27.89L26.63 32.29L26.87 32.29Q28.36 29.91 31.05 28.61Q33.75 27.30 37.06 27.30L37.06 27.30Q42.86 27.30 45.79 30.10Q48.72 32.90 48.72 39.05L48.72 39.05L48.72 60Z"
11
+ style="stroke-dasharray: 169, 171; stroke-dashoffset: 170;">
12
+ </path>
13
+ <path
14
+ d="M63.57 27.89L63.57 60L58.71 60L58.71 27.89L63.57 27.89ZM58.30 19.19L58.30 19.19Q58.30 17.52 59.12 16.74Q59.94 15.97 61.17 15.97L61.17 15.97Q62.34 15.97 63.19 16.76Q64.04 17.55 64.04 19.19L64.04 19.19Q64.04 20.83 63.19 21.64Q62.34 22.44 61.17 22.44L61.17 22.44Q59.94 22.44 59.12 21.64Q58.30 20.83 58.30 19.19Z"
15
+ style="stroke-dasharray: 93, 95; stroke-dashoffset: 94;">
16
+ </path>
17
+ <path
18
+ d="M86.72 60.59L86.72 60.59Q79.75 60.59 75.92 56.29Q72.10 52.00 72.10 44.15L72.10 44.15Q72.10 36.09 75.98 31.70Q79.86 27.30 87.04 27.30L87.04 27.30Q89.36 27.30 91.67 27.80Q93.98 28.30 95.30 28.97L95.30 28.97L93.81 33.11Q92.20 32.46 90.29 32.04Q88.39 31.61 86.92 31.61L86.92 31.61Q77.14 31.61 77.14 44.09L77.14 44.09Q77.14 50.01 79.53 53.17Q81.91 56.34 86.60 56.34L86.60 56.34Q90.62 56.34 94.83 54.61L94.83 54.61L94.83 58.92Q91.61 60.59 86.72 60.59Z"
19
+ style="stroke-dasharray: 127, 129; stroke-dashoffset: 128;">
20
+ </path>
21
+ <path
22
+ d="M130.17 43.92L130.17 43.92Q130.17 51.77 126.21 56.18Q122.26 60.59 115.28 60.59L115.28 60.59Q110.98 60.59 107.64 58.56Q104.30 56.54 102.48 52.76Q100.66 48.98 100.66 43.92L100.66 43.92Q100.66 36.06 104.59 31.68Q108.52 27.30 115.49 27.30L115.49 27.30Q122.23 27.30 126.20 31.79Q130.17 36.27 130.17 43.92ZM105.70 43.92L105.70 43.92Q105.70 50.07 108.16 53.29Q110.63 56.51 115.40 56.51L115.40 56.51Q120.18 56.51 122.65 53.31Q125.13 50.10 125.13 43.92L125.13 43.92Q125.13 37.79 122.65 34.61Q120.18 31.44 115.34 31.44L115.34 31.44Q110.57 31.44 108.13 34.57Q105.70 37.71 105.70 43.92Z"
23
+ style="stroke-dasharray: 172, 174; stroke-dashoffset: 173;">
24
+ </path>
25
+ <path
26
+ d="M165.53 60L160.66 60L160.66 39.23Q160.66 35.30 158.88 33.37Q157.09 31.44 153.28 31.44L153.28 31.44Q148.24 31.44 145.90 34.16Q143.55 36.88 143.55 43.15L143.55 43.15L143.55 60L138.69 60L138.69 27.89L142.65 27.89L143.44 32.29L143.67 32.29Q145.17 29.91 147.86 28.61Q150.56 27.30 153.87 27.30L153.87 27.30Q159.67 27.30 162.60 30.10Q165.53 32.90 165.53 39.05L165.53 39.05L165.53 60Z"
27
+ style="stroke-dasharray: 169, 171; stroke-dashoffset: 170;">
28
+ </path>
29
+ <path
30
+ d="M185.89 56.57L185.89 56.57Q187.18 56.57 188.38 56.38Q189.58 56.19 190.28 55.99L190.28 55.99L190.28 59.71Q189.49 60.09 187.95 60.34Q186.42 60.59 185.19 60.59L185.19 60.59Q175.87 60.59 175.87 50.77L175.87 50.77L175.87 31.67L171.27 31.67L171.27 29.33L175.87 27.30L177.92 20.45L180.73 20.45L180.73 27.89L190.05 27.89L190.05 31.67L180.73 31.67L180.73 50.57Q180.73 53.47 182.11 55.02Q183.49 56.57 185.89 56.57Z"
31
+ style="stroke-dasharray: 127, 129; stroke-dashoffset: 128;">
32
+ </path>
33
+ <path
34
+ d="M210.26 60.59L210.26 60.59Q203.14 60.59 199.03 56.25Q194.91 51.91 194.91 44.21L194.91 44.21Q194.91 36.45 198.74 31.88Q202.56 27.30 209.00 27.30L209.00 27.30Q215.04 27.30 218.55 31.27Q222.07 35.24 222.07 41.75L222.07 41.75L222.07 44.82L199.95 44.82Q200.10 50.48 202.81 53.41Q205.52 56.34 210.44 56.34L210.44 56.34Q215.63 56.34 220.69 54.17L220.69 54.17L220.69 58.51Q218.12 59.62 215.82 60.10Q213.52 60.59 210.26 60.59ZM208.95 31.38L208.95 31.38Q205.08 31.38 202.78 33.90Q200.48 36.42 200.07 40.87L200.07 40.87L216.86 40.87Q216.86 36.27 214.80 33.82Q212.75 31.38 208.95 31.38Z"
35
+ style="stroke-dasharray: 186, 188; stroke-dashoffset: 187;">
36
+ </path>
37
+ <path
38
+ d="M257.20 60L252.33 60L252.33 39.23Q252.33 35.30 250.55 33.37Q248.76 31.44 244.95 31.44L244.95 31.44Q239.91 31.44 237.57 34.16Q235.22 36.88 235.22 43.15L235.22 43.15L235.22 60L230.36 60L230.36 27.89L234.32 27.89L235.11 32.29L235.34 32.29Q236.84 29.91 239.53 28.61Q242.23 27.30 245.54 27.30L245.54 27.30Q251.34 27.30 254.27 30.10Q257.20 32.90 257.20 39.05L257.20 39.05L257.20 60Z"
39
+ style="stroke-dasharray: 169, 171; stroke-dashoffset: 170;">
40
+ </path>
41
+ <path
42
+ d="M277.56 56.57L277.56 56.57Q278.85 56.57 280.05 56.38Q281.25 56.19 281.95 55.99L281.95 55.99L281.95 59.71Q281.16 60.09 279.62 60.34Q278.09 60.59 276.86 60.59L276.86 60.59Q267.54 60.59 267.54 50.77L267.54 50.77L267.54 31.67L262.94 31.67L262.94 29.33L267.54 27.30L269.59 20.45L272.40 20.45L272.40 27.89L281.72 27.89L281.72 31.67L272.40 31.67L272.40 50.57Q272.40 53.47 273.78 55.02Q275.16 56.57 277.56 56.57Z"
43
+ style="stroke-dasharray: 127, 129; stroke-dashoffset: 128;">
44
+ </path>
45
+ </g>
46
+ </svg>
47
+ </div>
48
+ <style>
49
+ #loaderDIV {
50
+ display: flex;
51
+ justify-content: center;
52
+ align-items: center;
53
+ position: fixed;
54
+ z-index: 1031;
55
+ background-color: #fff;
56
+ top: 0;
57
+ left: 0;
58
+ right: 0;
59
+ bottom: 0;
60
+ overflow: hidden;
61
+ }
62
+
63
+ #loaderSVG {
64
+ fill: transparent;
65
+ fill-opacity: 0;
66
+ }
67
+
68
+ #loaderSVG>g {
69
+ stroke: #333333;
70
+ stroke-width: 2px;
71
+ }
72
+
73
+ #loaderSVG path {
74
+ animation: 1000ms linear 0ms infinite normal forwards running STAdraw
75
+ }
76
+
77
+ @keyframes STAdraw {
78
+ to {
79
+ stroke-dashoffset: 0;
80
+ fill-opacity: 1;
81
+ }
82
+ }
83
+
84
+ @media (prefers-color-scheme: dark) {
85
+ #loaderDIV {
86
+ background-color: #18181c;
87
+ }
88
+
89
+ #loaderSVG>g {
90
+ stroke: #fff;
91
+ }
92
+ }
93
+ </style>
package/biome.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.3.8/schema.json",
3
+ "vcs": {
4
+ "enabled": true,
5
+ "clientKind": "git",
6
+ "useIgnoreFile": true
7
+ },
8
+ "files": {
9
+ "ignoreUnknown": false
10
+ },
11
+ "formatter": {
12
+ "enabled": true,
13
+ "indentStyle": "tab"
14
+ },
15
+ "linter": {
16
+ "enabled": true,
17
+ "rules": {
18
+ "recommended": true
19
+ }
20
+ },
21
+ "javascript": {
22
+ "formatter": {
23
+ "quoteStyle": "double"
24
+ }
25
+ },
26
+ "assist": {
27
+ "enabled": true,
28
+ "actions": {
29
+ "source": {
30
+ "organizeImports": "on"
31
+ }
32
+ }
33
+ },
34
+ "overrides": [
35
+ {
36
+ "includes": ["**/*.svelte", "**/*.astro", "**/*.vue"],
37
+ "linter": {
38
+ "rules": {
39
+ "style": {
40
+ "useConst": "off",
41
+
42
+ "useImportType": "off"
43
+ },
44
+ "correctness": {
45
+ "noUnusedVariables": "off",
46
+
47
+ "noUnusedImports": "off"
48
+ }
49
+ }
50
+ }
51
+ }
52
+ ]
53
+ }
package/index.d.ts ADDED
@@ -0,0 +1,380 @@
1
+ import type {
2
+ ComparisonOperator,
3
+ Data,
4
+ TableObject,
5
+ Field as dbField,
6
+ FieldType as dbFieldType,
7
+ pageInfo,
8
+ } from "inibase";
9
+ import type { DataTableColumns, SelectOption } from "naive-ui";
10
+ import type { MessageApiInjection } from "naive-ui/es/message/src/MessageProvider";
11
+ import type { NotificationApiInjection } from "naive-ui/es/notification/src/NotificationProvider";
12
+ import type languages from "~/composables/Translation/languages";
13
+
14
+ // type onCreateCallback = (index: number) => any
15
+ // type onCreateType = string | number | boolean | Data | onCreateType[]
16
+
17
+ interface SingleLanguageTranslations {
18
+ [key: string]: string | SingleLanguageTranslations;
19
+ }
20
+
21
+ declare global {
22
+ interface Window {
23
+ $message: MessageApiInjection;
24
+ $notification: NotificationApiInjection;
25
+ }
26
+ type CMS_FieldType =
27
+ | "text"
28
+ | "textarea"
29
+ | "radio"
30
+ | "checkbox"
31
+ | "tags"
32
+ | "color"
33
+ | "select"
34
+ | "role"
35
+ | "mention"
36
+ | "icon"
37
+ | "multiple"
38
+ | "slider"
39
+ | "asset"
40
+ | "range"
41
+ | "array-select"
42
+ | "array-asset"
43
+ | "array-table"
44
+ | "locale"
45
+ | "custom"
46
+ | "emailTemplate";
47
+ type DB_FieldType = dbFieldType;
48
+ type Field = Omit<dbField, "type" | "children"> & {
49
+ type: CMS_FieldType | DB_FieldType | DB_FieldType[];
50
+ children?: DB_FieldType | DB_FieldType[] | Schema;
51
+ subType?: CMS_FieldType;
52
+ accept?: string[];
53
+ isArray?: boolean;
54
+ searchIn?: string[];
55
+ image?: string;
56
+ options?: (
57
+ | (string | number)
58
+ | SelectOption
59
+ | Record<string, string | number | (string | number)[]>
60
+ | [string | number, string]
61
+ )[];
62
+ labelProps?: any;
63
+ inputProps?: any;
64
+ onCreate?: any;
65
+ onDelete?: (index: number) => void;
66
+ isTable?: boolean;
67
+ disableActions?: boolean;
68
+ disableItemActions?: boolean;
69
+ defaultValue?: any;
70
+ custom?: boolean;
71
+ min?: number;
72
+ max?: number;
73
+ date?:
74
+ | "date"
75
+ | "datetime"
76
+ | "daterange"
77
+ | "datetimerange"
78
+ | "month"
79
+ | "monthrange"
80
+ | "year"
81
+ | "yearrange"
82
+ | "quarter"
83
+ | "quarterrange"
84
+ | "week";
85
+ expand?: boolean;
86
+ suffix?: string;
87
+ optimize?: boolean;
88
+ where?: string | Record<string, any>;
89
+ description?: string;
90
+ render?: any;
91
+ extraActions?: VNode | undefined;
92
+ extraButtons?: VNode | undefined;
93
+ itemExtraActions?: (index: number) => VNode | undefined;
94
+ itemExtraButtons?: (index: number) => VNode | VNode[] | undefined;
95
+ width?: number;
96
+ labelKey?: string;
97
+ label?: any;
98
+ };
99
+ type Schema = Field[];
100
+ type FlowType = (
101
+ | [
102
+ "set",
103
+ string | null,
104
+ string | number | boolean | null | (string | number | boolean | null)[],
105
+ ]
106
+ | ["unset", null | string | string[]]
107
+ | ["error", null | string]
108
+ | ["email", null | string, null | string]
109
+ | [
110
+ `@${"user" | "data" | "where"}.${string | number}` | "@method",
111
+ ComparisonOperator,
112
+ string | number | boolean | null | (string | number | boolean | null)[],
113
+ ]
114
+ | [null, null, null]
115
+ )[];
116
+ type TableImportStatus = {
117
+ id: string;
118
+ state: "queued" | "running" | "completed" | "failed";
119
+ fileName: string;
120
+ format: "csv" | "json";
121
+ progress: number;
122
+ processedRows: number;
123
+ processedBytes: number;
124
+ totalBytes: number;
125
+ createdAt: number;
126
+ updatedAt: number;
127
+ startedAt?: number;
128
+ finishedAt?: number;
129
+ error?: string;
130
+ };
131
+ type Table = {
132
+ id?: string;
133
+ slug: string;
134
+ label?: string;
135
+ icon?: string;
136
+ defaultSearchableColumns?: number[];
137
+ defaultTableColumns?: number[];
138
+ allowedMethods?: string;
139
+ schema?: Schema;
140
+ onRequest?: FlowType[];
141
+ onResponse?: FlowType[];
142
+ currentJob?: "export" | "import";
143
+ config?: TableObject["config"] & { log?: boolean; realtime?: boolean };
144
+ customLabel?: (item?: Item) => string;
145
+ customLabelColumns?: string[];
146
+ columns?: string[];
147
+ displayAs?: "table" | "kanban" | "cards";
148
+ groupBy?: string;
149
+ show?: boolean;
150
+ size?: number;
151
+ };
152
+ type Item = Data & {
153
+ createdBy?: User;
154
+ };
155
+ type SchedulesPreset = "hourly" | "daily" | "weekly" | "monthly" | "custom";
156
+ type Schedules = Item & {
157
+ databaseSlug: string;
158
+ table: string;
159
+ name: string;
160
+ preset?: SchedulesPreset;
161
+ cronExpression: string;
162
+ timezone: "UTC";
163
+ isActive: boolean;
164
+ payload: Record<string, any>;
165
+ excludeWeekdays?: number[];
166
+ nextRunAt?: number;
167
+ lastRunAt?: number;
168
+ lastError?: string;
169
+ };
170
+ type User = Item & {
171
+ username: string;
172
+ email: string;
173
+ password: string;
174
+ role: string;
175
+ };
176
+ type Database = Item & {
177
+ slug?: string;
178
+ icon?: Asset;
179
+ primaryColor?: string;
180
+ primaryDarkColor?: string;
181
+ domains?: string[];
182
+ primaryLanguage?: LanguagesType;
183
+ secondaryLanguages?: LanguagesType[];
184
+ roles?: { name: string; id: string }[];
185
+ tables?: Table[];
186
+ size?: number;
187
+ email?: {
188
+ smtp_host?: string;
189
+ smtp_port?: number;
190
+ smtp_user?: string;
191
+ smtp_pass?: string;
192
+ smtp_secure?: boolean;
193
+ from_email?: string;
194
+ from_name?: string;
195
+ };
196
+ };
197
+ type DatabaseExportStatus = {
198
+ id: string;
199
+ databaseSlug: string;
200
+ state: "queued" | "running" | "completed" | "failed" | "expired";
201
+ progress: number;
202
+ processedBytes: number;
203
+ totalBytes: number;
204
+ destination: "tenant" | "platform";
205
+ consistency: "best-effort";
206
+ createdAt: number;
207
+ updatedAt: number;
208
+ expiresAt: number;
209
+ startedAt?: number;
210
+ finishedAt?: number;
211
+ error?: string;
212
+ };
213
+ type apiResponse<T = any> = {
214
+ result: T;
215
+ message: string;
216
+ options: pageInfo;
217
+ code: string | number;
218
+ };
219
+ type Asset = Item & {
220
+ name: string;
221
+ type: string;
222
+ extension: string;
223
+ size: number;
224
+ publicURL: string;
225
+ };
226
+ type Backup = Item & {
227
+ name: string;
228
+ extension: string;
229
+ size: number;
230
+ publicURL?: string;
231
+ type?: "full" | "table";
232
+ table?: string;
233
+ automatic?: boolean;
234
+ state?: "queued" | "running" | "completed" | "failed";
235
+ error?: string;
236
+ restoreState?: "running" | "completed" | "failed";
237
+ restoreError?: string;
238
+ restoredAt?: number;
239
+ };
240
+ type ThemeConfig = {
241
+ primaryColor: string;
242
+ primaryColorHover: string;
243
+ primaryColorPressed: string;
244
+ primaryColorSuppl: string;
245
+ revert?: boolean;
246
+ };
247
+
248
+ type LanguagesType = (typeof languages)[number];
249
+
250
+ interface TranslationsType {
251
+ [language in LanguagesType]: SingleLanguageTranslations;
252
+ }
253
+
254
+ type searchTypeValueItem =
255
+ | [string | null, string, any]
256
+ | [string | null, string, any, any];
257
+ type searchTypeValue = (searchTypeValueItem | searchType)[];
258
+ type searchType = {
259
+ and?: searchTypeValue;
260
+ or?: searchTypeValue;
261
+ };
262
+
263
+ type TableRef = {
264
+ search?: searchType;
265
+ columns?: DataTableColumns<any>;
266
+ delete: (id?: string | string[]) => Promise<void>;
267
+ data?: apiResponse<Item[]>;
268
+ };
269
+
270
+ type FormRef = {
271
+ create: () => Promise<void>;
272
+ update: () => Promise<void>;
273
+ delete: () => Promise<void>;
274
+ schema: Schema;
275
+ data?: Item;
276
+ };
277
+
278
+ type DrawerRef = {
279
+ show?: boolean;
280
+ id?: string | number;
281
+ table?: string;
282
+ data?: Item;
283
+ schema?: Schema;
284
+ width?: number | string;
285
+ nestedWidthIncrements?: number[];
286
+ mode?: "view" | "edit";
287
+ }[];
288
+
289
+ type TablesCookie = Record<
290
+ string,
291
+ {
292
+ columns?: number[];
293
+ view?: "kanban" | "table";
294
+ size?: "small" | "medium" | "large";
295
+ }
296
+ >;
297
+
298
+ type WidgetType = "counter" | "line" | "bar" | "pie" | "table";
299
+ type WidgetSize = "small" | "medium" | "large";
300
+ type WidgetOperation = "count" | "sum" | "max" | "min";
301
+ type WidgetDateRange = "7d" | "30d" | "90d" | "1y" | "all";
302
+
303
+ type Widget = {
304
+ id: string;
305
+ icon?: string;
306
+ type: WidgetType;
307
+ title: string;
308
+ table: string;
309
+ field?: string;
310
+ operation?: WidgetOperation;
311
+ groupBy?: string;
312
+ dateField?: string;
313
+ dateRange?: WidgetDateRange;
314
+ limit?: number;
315
+ color?: string;
316
+ size?: WidgetSize;
317
+ searchArray?: searchType;
318
+ columns?: string[];
319
+ sortField?: string;
320
+ sortOrder?: "asc" | "desc";
321
+ };
322
+
323
+ type Dashboard = Item & {
324
+ name: string;
325
+ description?: string;
326
+ icon?: string;
327
+ widgets?: Widget[];
328
+ };
329
+ }
330
+ declare module "nuxt/schema" {
331
+ interface runtimeConfig {
332
+ public: {
333
+ apiBase: string;
334
+ idOne: string;
335
+ database?: string;
336
+ };
337
+ }
338
+ }
339
+
340
+ import type * as _LayerComposables from "./app/composables/index";
341
+ /** All function exports from layer composables become available as Vue template globals */
342
+ // biome-ignore lint/suspicious/noExplicitAny: required for TypeScript function-type discrimination in conditional mapped types
343
+ type LayerComposables = {
344
+ [K in keyof _LayerComposables as _LayerComposables[K] extends (
345
+ ...args: any[]
346
+ ) => any
347
+ ? K
348
+ : never]: _LayerComposables[K];
349
+ };
350
+
351
+ declare module "vue" {
352
+ interface ComponentCustomProperties extends LayerComposables {}
353
+ }
354
+
355
+ export type {
356
+ CMS_FieldType,
357
+ DB_FieldType,
358
+ Field,
359
+ Schema,
360
+ Table,
361
+ User,
362
+ Item,
363
+ Database,
364
+ Asset,
365
+ Backup,
366
+ apiResponse,
367
+ ThemeConfig,
368
+ LanguagesType,
369
+ TranslationsType,
370
+ TableRef,
371
+ FormRef,
372
+ DrawerRef,
373
+ TablesCookie,
374
+ WidgetType,
375
+ WidgetSize,
376
+ WidgetOperation,
377
+ WidgetDateRange,
378
+ Widget,
379
+ Dashboard,
380
+ };
@@ -0,0 +1,41 @@
1
+ import { addComponent, defineNuxtModule } from "@nuxt/kit"
2
+ import naive from "naive-ui"
3
+
4
+ export default defineNuxtModule({
5
+ hooks: {
6
+ "prepare:types": ({ references }) => {
7
+ references.push({
8
+ types: "naive-ui/volar",
9
+ })
10
+ },
11
+ },
12
+ setup(_options, _nuxt) {
13
+ // Setup transpile
14
+ const transpile = process.env.NODE_ENV === "production" ? ["naive-ui"] : []
15
+ if (!_nuxt.options.build.transpile)
16
+ _nuxt.options.build.transpile = transpile
17
+ else
18
+ _nuxt.options.build.transpile =
19
+ _nuxt.options.build.transpile.concat(transpile)
20
+
21
+ for (const key of Object.keys(naive).filter((name) =>
22
+ /^N[A-Z]|n-[a-z]/.test(name),
23
+ )) {
24
+ // Add types for each component.
25
+ //
26
+ // NOTE: these must stay `global: false` (the default). Registering
27
+ // every naive-ui component as a runtime global forces Nuxt to
28
+ // eagerly import the whole library (all ~100 components + their
29
+ // dark/rtl styles) into the initial SPA shell chunk. With the
30
+ // default mode Nuxt still resolves N* components used in SFC
31
+ // templates at compile time, but only bundles the ones actually
32
+ // referenced (and code-splits them per chunk).
33
+ addComponent({
34
+ export: key,
35
+ name: key,
36
+ filePath: "naive-ui",
37
+ mode: "all",
38
+ })
39
+ }
40
+ },
41
+ })