nebula-cms 0.1.3 → 0.1.5

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 (381) hide show
  1. package/README.md +3 -1
  2. package/dist/astro/index.d.ts +43 -0
  3. package/dist/astro/index.d.ts.map +1 -0
  4. package/dist/astro/index.js +223 -0
  5. package/{src → dist}/client/Admin.svelte +20 -11
  6. package/dist/client/Admin.svelte.d.ts +11 -0
  7. package/dist/client/Admin.svelte.d.ts.map +1 -0
  8. package/dist/client/components/BackendPicker.svelte.d.ts +4 -0
  9. package/dist/client/components/BackendPicker.svelte.d.ts.map +1 -0
  10. package/dist/client/components/DraftChip.svelte.d.ts +10 -0
  11. package/dist/client/components/DraftChip.svelte.d.ts.map +1 -0
  12. package/dist/client/components/MetadataForm.svelte.d.ts +12 -0
  13. package/dist/client/components/MetadataForm.svelte.d.ts.map +1 -0
  14. package/dist/client/components/ThemeToggle.svelte.d.ts +19 -0
  15. package/dist/client/components/ThemeToggle.svelte.d.ts.map +1 -0
  16. package/dist/client/components/dialogs/DeleteDraftDialog.svelte.d.ts +11 -0
  17. package/dist/client/components/dialogs/DeleteDraftDialog.svelte.d.ts.map +1 -0
  18. package/{src → dist}/client/components/dialogs/FilenameDialog.svelte +1 -2
  19. package/dist/client/components/dialogs/FilenameDialog.svelte.d.ts +13 -0
  20. package/dist/client/components/dialogs/FilenameDialog.svelte.d.ts.map +1 -0
  21. package/dist/client/components/editor/EditorPane.svelte.d.ts +4 -0
  22. package/dist/client/components/editor/EditorPane.svelte.d.ts.map +1 -0
  23. package/dist/client/components/editor/EditorTabs.svelte.d.ts +8 -0
  24. package/dist/client/components/editor/EditorTabs.svelte.d.ts.map +1 -0
  25. package/dist/client/components/editor/EditorToolbar.svelte.d.ts +4 -0
  26. package/dist/client/components/editor/EditorToolbar.svelte.d.ts.map +1 -0
  27. package/dist/client/components/editor/FormatSelector.svelte.d.ts +4 -0
  28. package/dist/client/components/editor/FormatSelector.svelte.d.ts.map +1 -0
  29. package/dist/client/components/editor/Toolbar.svelte.d.ts +19 -0
  30. package/dist/client/components/editor/Toolbar.svelte.d.ts.map +1 -0
  31. package/dist/client/components/fields/ArrayField.svelte.d.ts +15 -0
  32. package/dist/client/components/fields/ArrayField.svelte.d.ts.map +1 -0
  33. package/dist/client/components/fields/ArrayItem.svelte.d.ts +28 -0
  34. package/dist/client/components/fields/ArrayItem.svelte.d.ts.map +1 -0
  35. package/dist/client/components/fields/BooleanField.svelte.d.ts +16 -0
  36. package/dist/client/components/fields/BooleanField.svelte.d.ts.map +1 -0
  37. package/dist/client/components/fields/DateField.svelte.d.ts +16 -0
  38. package/dist/client/components/fields/DateField.svelte.d.ts.map +1 -0
  39. package/dist/client/components/fields/EnumField.svelte.d.ts +17 -0
  40. package/dist/client/components/fields/EnumField.svelte.d.ts.map +1 -0
  41. package/dist/client/components/fields/FieldWrapper.svelte.d.ts +18 -0
  42. package/dist/client/components/fields/FieldWrapper.svelte.d.ts.map +1 -0
  43. package/dist/client/components/fields/NumberField.svelte.d.ts +16 -0
  44. package/dist/client/components/fields/NumberField.svelte.d.ts.map +1 -0
  45. package/dist/client/components/fields/ObjectField.svelte.d.ts +16 -0
  46. package/dist/client/components/fields/ObjectField.svelte.d.ts.map +1 -0
  47. package/dist/client/components/fields/SchemaField.svelte.d.ts +16 -0
  48. package/dist/client/components/fields/SchemaField.svelte.d.ts.map +1 -0
  49. package/dist/client/components/fields/StringField.svelte.d.ts +16 -0
  50. package/dist/client/components/fields/StringField.svelte.d.ts.map +1 -0
  51. package/{src → dist}/client/components/sidebar/AdminSidebar.svelte +2 -4
  52. package/dist/client/components/sidebar/AdminSidebar.svelte.d.ts +19 -0
  53. package/dist/client/components/sidebar/AdminSidebar.svelte.d.ts.map +1 -0
  54. package/dist/client/components/sidebar/AdminSidebarSort.svelte.d.ts +12 -0
  55. package/dist/client/components/sidebar/AdminSidebarSort.svelte.d.ts.map +1 -0
  56. package/dist/client/css/icons.css +29 -0
  57. package/dist/client/index.d.ts +2 -0
  58. package/dist/client/index.d.ts.map +1 -0
  59. package/dist/client/js/drafts/merge.svelte.d.ts +24 -0
  60. package/dist/client/js/drafts/merge.svelte.d.ts.map +1 -0
  61. package/dist/client/js/drafts/merge.svelte.js +106 -0
  62. package/dist/client/js/drafts/ops.svelte.d.ts +31 -0
  63. package/dist/client/js/drafts/ops.svelte.d.ts.map +1 -0
  64. package/dist/client/js/drafts/ops.svelte.js +182 -0
  65. package/dist/client/js/drafts/storage.d.ts +45 -0
  66. package/dist/client/js/drafts/storage.d.ts.map +1 -0
  67. package/dist/client/js/drafts/storage.js +76 -0
  68. package/dist/client/js/drafts/workers/diff.d.ts +2 -0
  69. package/dist/client/js/drafts/workers/diff.d.ts.map +1 -0
  70. package/dist/client/js/drafts/workers/diff.js +20 -0
  71. package/dist/client/js/editor/editor.svelte.d.ts +124 -0
  72. package/dist/client/js/editor/editor.svelte.d.ts.map +1 -0
  73. package/dist/client/js/editor/editor.svelte.js +294 -0
  74. package/dist/client/js/editor/languages.d.ts +11 -0
  75. package/dist/client/js/editor/languages.d.ts.map +1 -0
  76. package/dist/client/js/editor/languages.js +93 -0
  77. package/dist/client/js/editor/link-wrap.d.ts +6 -0
  78. package/dist/client/js/editor/link-wrap.d.ts.map +1 -0
  79. package/{src/client/js/editor/link-wrap.ts → dist/client/js/editor/link-wrap.js} +17 -24
  80. package/dist/client/js/editor/markdown-shortcuts.d.ts +4 -0
  81. package/dist/client/js/editor/markdown-shortcuts.d.ts.map +1 -0
  82. package/dist/client/js/editor/markdown-shortcuts.js +219 -0
  83. package/dist/client/js/handlers/admin.d.ts +64 -0
  84. package/dist/client/js/handlers/admin.d.ts.map +1 -0
  85. package/dist/client/js/handlers/admin.js +186 -0
  86. package/dist/client/js/state/dialogs.svelte.d.ts +16 -0
  87. package/dist/client/js/state/dialogs.svelte.d.ts.map +1 -0
  88. package/dist/client/js/state/dialogs.svelte.js +28 -0
  89. package/dist/client/js/state/router.svelte.d.ts +44 -0
  90. package/dist/client/js/state/router.svelte.d.ts.map +1 -0
  91. package/dist/client/js/state/router.svelte.js +141 -0
  92. package/dist/client/js/state/schema.svelte.d.ts +51 -0
  93. package/dist/client/js/state/schema.svelte.d.ts.map +1 -0
  94. package/{src/client/js/state/schema.svelte.ts → dist/client/js/state/schema.svelte.js} +55 -70
  95. package/dist/client/js/state/state.svelte.d.ts +68 -0
  96. package/dist/client/js/state/state.svelte.d.ts.map +1 -0
  97. package/dist/client/js/state/state.svelte.js +300 -0
  98. package/dist/client/js/state/theme.svelte.d.ts +24 -0
  99. package/dist/client/js/state/theme.svelte.d.ts.map +1 -0
  100. package/{src/client/js/state/theme.svelte.ts → dist/client/js/state/theme.svelte.js} +54 -91
  101. package/dist/client/js/storage/adapter.d.ts +130 -0
  102. package/dist/client/js/storage/adapter.d.ts.map +1 -0
  103. package/dist/client/js/storage/adapter.js +5 -0
  104. package/dist/client/js/storage/client.d.ts +72 -0
  105. package/dist/client/js/storage/client.d.ts.map +1 -0
  106. package/dist/client/js/storage/client.js +121 -0
  107. package/dist/client/js/storage/db.d.ts +8 -0
  108. package/dist/client/js/storage/db.d.ts.map +1 -0
  109. package/dist/client/js/storage/db.js +35 -0
  110. package/dist/client/js/storage/fsa.d.ts +51 -0
  111. package/dist/client/js/storage/fsa.d.ts.map +1 -0
  112. package/dist/client/js/storage/fsa.js +91 -0
  113. package/dist/client/js/storage/github.d.ts +62 -0
  114. package/dist/client/js/storage/github.d.ts.map +1 -0
  115. package/dist/client/js/storage/github.js +216 -0
  116. package/dist/client/js/storage/storage.d.ts +32 -0
  117. package/dist/client/js/storage/storage.d.ts.map +1 -0
  118. package/dist/client/js/storage/storage.js +68 -0
  119. package/dist/client/js/storage/workers/frontmatter.d.ts +2 -0
  120. package/dist/client/js/storage/workers/frontmatter.d.ts.map +1 -0
  121. package/dist/client/js/storage/workers/frontmatter.js +253 -0
  122. package/dist/client/js/storage/workers/storage.d.ts +2 -0
  123. package/dist/client/js/storage/workers/storage.d.ts.map +1 -0
  124. package/dist/client/js/storage/workers/storage.js +167 -0
  125. package/dist/client/js/storage/workers/toml-parser.d.ts +2 -0
  126. package/dist/client/js/storage/workers/toml-parser.d.ts.map +1 -0
  127. package/dist/client/js/storage/workers/toml-parser.js +75 -0
  128. package/dist/client/js/storage/workers/yaml-parser.d.ts +2 -0
  129. package/dist/client/js/storage/workers/yaml-parser.d.ts.map +1 -0
  130. package/dist/client/js/storage/workers/yaml-parser.js +100 -0
  131. package/dist/client/js/utils/file-types.d.ts +58 -0
  132. package/dist/client/js/utils/file-types.d.ts.map +1 -0
  133. package/{src/client/js/utils/file-types.ts → dist/client/js/utils/file-types.js} +75 -107
  134. package/dist/client/js/utils/format.d.ts +8 -0
  135. package/dist/client/js/utils/format.d.ts.map +1 -0
  136. package/{src/client/js/utils/format.ts → dist/client/js/utils/format.js} +5 -6
  137. package/dist/client/js/utils/frontmatter.d.ts +12 -0
  138. package/dist/client/js/utils/frontmatter.d.ts.map +1 -0
  139. package/dist/client/js/utils/frontmatter.js +29 -0
  140. package/dist/client/js/utils/schema-utils.d.ts +110 -0
  141. package/dist/client/js/utils/schema-utils.d.ts.map +1 -0
  142. package/dist/client/js/utils/schema-utils.js +242 -0
  143. package/dist/client/js/utils/slug.d.ts +8 -0
  144. package/dist/client/js/utils/slug.d.ts.map +1 -0
  145. package/{src/client/js/utils/slug.ts → dist/client/js/utils/slug.js} +6 -7
  146. package/dist/client/js/utils/sort.d.ts +41 -0
  147. package/dist/client/js/utils/sort.d.ts.map +1 -0
  148. package/dist/client/js/utils/sort.js +65 -0
  149. package/dist/client/js/utils/stable-stringify.d.ts +8 -0
  150. package/dist/client/js/utils/stable-stringify.d.ts.map +1 -0
  151. package/dist/client/js/utils/stable-stringify.js +23 -0
  152. package/dist/client/js/utils/url-utils.d.ts +11 -0
  153. package/dist/client/js/utils/url-utils.d.ts.map +1 -0
  154. package/{src/client/js/utils/url-utils.ts → dist/client/js/utils/url-utils.js} +22 -23
  155. package/dist/client/types/browser-apis.d.ts +39 -0
  156. package/dist/types.d.ts +22 -0
  157. package/dist/types.d.ts.map +1 -0
  158. package/dist/types.js +1 -0
  159. package/package.json +13 -3
  160. package/.github/workflows/ci.yml +0 -27
  161. package/.github/workflows/publish.yml +0 -34
  162. package/.mcp.json +0 -12
  163. package/.prettierignore +0 -5
  164. package/.prettierrc.cjs +0 -22
  165. package/AGENTS.md +0 -183
  166. package/playground/astro.config.mjs +0 -7
  167. package/playground/node_modules/.bin/astro +0 -21
  168. package/playground/node_modules/.vite/deps/@astrojs_svelte_client__js.js +0 -85
  169. package/playground/node_modules/.vite/deps/@astrojs_svelte_client__js.js.map +0 -7
  170. package/playground/node_modules/.vite/deps/_metadata.json +0 -184
  171. package/playground/node_modules/.vite/deps/astro___aria-query.js +0 -6776
  172. package/playground/node_modules/.vite/deps/astro___aria-query.js.map +0 -7
  173. package/playground/node_modules/.vite/deps/astro___axobject-query.js +0 -3754
  174. package/playground/node_modules/.vite/deps/astro___axobject-query.js.map +0 -7
  175. package/playground/node_modules/.vite/deps/astro___html-escaper.js +0 -34
  176. package/playground/node_modules/.vite/deps/astro___html-escaper.js.map +0 -7
  177. package/playground/node_modules/.vite/deps/chunk-AJXJMYAF.js +0 -0
  178. package/playground/node_modules/.vite/deps/chunk-AJXJMYAF.js.map +0 -7
  179. package/playground/node_modules/.vite/deps/chunk-BUSYA2B4.js +0 -8
  180. package/playground/node_modules/.vite/deps/chunk-BUSYA2B4.js.map +0 -7
  181. package/playground/node_modules/.vite/deps/chunk-CNYJBM5F.js +0 -21
  182. package/playground/node_modules/.vite/deps/chunk-CNYJBM5F.js.map +0 -7
  183. package/playground/node_modules/.vite/deps/chunk-DBPNBGEI.js +0 -223
  184. package/playground/node_modules/.vite/deps/chunk-DBPNBGEI.js.map +0 -7
  185. package/playground/node_modules/.vite/deps/chunk-FPEUJ7DG.js +0 -27
  186. package/playground/node_modules/.vite/deps/chunk-FPEUJ7DG.js.map +0 -7
  187. package/playground/node_modules/.vite/deps/chunk-MHDZ3SK7.js +0 -1005
  188. package/playground/node_modules/.vite/deps/chunk-MHDZ3SK7.js.map +0 -7
  189. package/playground/node_modules/.vite/deps/chunk-RBDTDTPY.js +0 -204
  190. package/playground/node_modules/.vite/deps/chunk-RBDTDTPY.js.map +0 -7
  191. package/playground/node_modules/.vite/deps/chunk-RJGEXL5C.js +0 -688
  192. package/playground/node_modules/.vite/deps/chunk-RJGEXL5C.js.map +0 -7
  193. package/playground/node_modules/.vite/deps/chunk-YL4MIWGJ.js +0 -5099
  194. package/playground/node_modules/.vite/deps/chunk-YL4MIWGJ.js.map +0 -7
  195. package/playground/node_modules/.vite/deps/chunk-ZOV3DWEJ.js +0 -4376
  196. package/playground/node_modules/.vite/deps/chunk-ZOV3DWEJ.js.map +0 -7
  197. package/playground/node_modules/.vite/deps/chunk-ZP4UNCSN.js +0 -23
  198. package/playground/node_modules/.vite/deps/chunk-ZP4UNCSN.js.map +0 -7
  199. package/playground/node_modules/.vite/deps/chunk-ZREFNRZZ.js +0 -148
  200. package/playground/node_modules/.vite/deps/chunk-ZREFNRZZ.js.map +0 -7
  201. package/playground/node_modules/.vite/deps/package.json +0 -3
  202. package/playground/node_modules/.vite/deps/smol-toml.js +0 -843
  203. package/playground/node_modules/.vite/deps/smol-toml.js.map +0 -7
  204. package/playground/node_modules/.vite/deps/svelte.js +0 -55
  205. package/playground/node_modules/.vite/deps/svelte.js.map +0 -7
  206. package/playground/node_modules/.vite/deps/svelte___clsx.js +0 -9
  207. package/playground/node_modules/.vite/deps/svelte___clsx.js.map +0 -7
  208. package/playground/node_modules/.vite/deps/svelte_animate.js +0 -57
  209. package/playground/node_modules/.vite/deps/svelte_animate.js.map +0 -7
  210. package/playground/node_modules/.vite/deps/svelte_attachments.js +0 -15
  211. package/playground/node_modules/.vite/deps/svelte_attachments.js.map +0 -7
  212. package/playground/node_modules/.vite/deps/svelte_easing.js +0 -67
  213. package/playground/node_modules/.vite/deps/svelte_easing.js.map +0 -7
  214. package/playground/node_modules/.vite/deps/svelte_events.js +0 -11
  215. package/playground/node_modules/.vite/deps/svelte_events.js.map +0 -7
  216. package/playground/node_modules/.vite/deps/svelte_internal.js +0 -5
  217. package/playground/node_modules/.vite/deps/svelte_internal.js.map +0 -7
  218. package/playground/node_modules/.vite/deps/svelte_internal_client.js +0 -402
  219. package/playground/node_modules/.vite/deps/svelte_internal_client.js.map +0 -7
  220. package/playground/node_modules/.vite/deps/svelte_internal_disclose-version.js +0 -10
  221. package/playground/node_modules/.vite/deps/svelte_internal_disclose-version.js.map +0 -7
  222. package/playground/node_modules/.vite/deps/svelte_internal_flags_async.js +0 -8
  223. package/playground/node_modules/.vite/deps/svelte_internal_flags_async.js.map +0 -7
  224. package/playground/node_modules/.vite/deps/svelte_internal_flags_legacy.js +0 -8
  225. package/playground/node_modules/.vite/deps/svelte_internal_flags_legacy.js.map +0 -7
  226. package/playground/node_modules/.vite/deps/svelte_internal_flags_tracing.js +0 -8
  227. package/playground/node_modules/.vite/deps/svelte_internal_flags_tracing.js.map +0 -7
  228. package/playground/node_modules/.vite/deps/svelte_legacy.js +0 -35
  229. package/playground/node_modules/.vite/deps/svelte_legacy.js.map +0 -7
  230. package/playground/node_modules/.vite/deps/svelte_motion.js +0 -545
  231. package/playground/node_modules/.vite/deps/svelte_motion.js.map +0 -7
  232. package/playground/node_modules/.vite/deps/svelte_reactivity.js +0 -29
  233. package/playground/node_modules/.vite/deps/svelte_reactivity.js.map +0 -7
  234. package/playground/node_modules/.vite/deps/svelte_reactivity_window.js +0 -127
  235. package/playground/node_modules/.vite/deps/svelte_reactivity_window.js.map +0 -7
  236. package/playground/node_modules/.vite/deps/svelte_store.js +0 -103
  237. package/playground/node_modules/.vite/deps/svelte_store.js.map +0 -7
  238. package/playground/node_modules/.vite/deps/svelte_transition.js +0 -208
  239. package/playground/node_modules/.vite/deps/svelte_transition.js.map +0 -7
  240. package/playground/package.json +0 -16
  241. package/playground/pnpm-lock.yaml +0 -3167
  242. package/playground/src/content/authors/jane-doe.json +0 -8
  243. package/playground/src/content/config/build.toml +0 -2
  244. package/playground/src/content/courses/web-fundamentals.json +0 -29
  245. package/playground/src/content/docs/advanced.mdx +0 -6
  246. package/playground/src/content/docs/intro.md +0 -6
  247. package/playground/src/content/guides/getting-started.mdx +0 -6
  248. package/playground/src/content/posts/hello-world.md +0 -7
  249. package/playground/src/content/products/t-shirt.json +0 -16
  250. package/playground/src/content/recipes/pancakes.mdoc +0 -8
  251. package/playground/src/content/settings/site.yml +0 -2
  252. package/playground/src/content.config.ts +0 -198
  253. package/playground/src/env.d.ts +0 -1
  254. package/playground/src/pages/index.astro +0 -11
  255. package/playground/src/pages/nebula.astro +0 -14
  256. package/pnpm-workspace.yaml +0 -2
  257. package/scripts/subset-icons.mjs +0 -178
  258. package/src/astro/index.ts +0 -295
  259. package/src/client/js/drafts/merge.svelte.ts +0 -121
  260. package/src/client/js/drafts/ops.svelte.ts +0 -227
  261. package/src/client/js/drafts/storage.ts +0 -108
  262. package/src/client/js/drafts/workers/diff.ts +0 -40
  263. package/src/client/js/editor/editor.svelte.ts +0 -343
  264. package/src/client/js/editor/languages.ts +0 -98
  265. package/src/client/js/editor/markdown-shortcuts.ts +0 -261
  266. package/src/client/js/handlers/admin.ts +0 -246
  267. package/src/client/js/state/dialogs.svelte.ts +0 -35
  268. package/src/client/js/state/router.svelte.ts +0 -156
  269. package/src/client/js/state/state.svelte.ts +0 -334
  270. package/src/client/js/storage/adapter.ts +0 -102
  271. package/src/client/js/storage/client.ts +0 -150
  272. package/src/client/js/storage/db.ts +0 -36
  273. package/src/client/js/storage/fsa.ts +0 -110
  274. package/src/client/js/storage/github.ts +0 -297
  275. package/src/client/js/storage/storage.ts +0 -83
  276. package/src/client/js/storage/workers/frontmatter.ts +0 -320
  277. package/src/client/js/storage/workers/storage.ts +0 -177
  278. package/src/client/js/storage/workers/toml-parser.ts +0 -106
  279. package/src/client/js/storage/workers/yaml-parser.ts +0 -132
  280. package/src/client/js/utils/frontmatter.ts +0 -38
  281. package/src/client/js/utils/schema-utils.ts +0 -295
  282. package/src/client/js/utils/sort.ts +0 -84
  283. package/src/client/js/utils/stable-stringify.ts +0 -27
  284. package/src/types.ts +0 -25
  285. package/svelte.config.js +0 -4
  286. package/tests/astro/build.test.ts +0 -63
  287. package/tests/astro/index.test.ts +0 -689
  288. package/tests/client/components/Admin.test.ts +0 -446
  289. package/tests/client/components/BackendPicker.test.ts +0 -239
  290. package/tests/client/components/DraftChip.test.ts +0 -53
  291. package/tests/client/components/MetadataForm.test.ts +0 -164
  292. package/tests/client/components/dialogs/DeleteDraftDialog.test.ts +0 -91
  293. package/tests/client/components/dialogs/FilenameDialog.test.ts +0 -209
  294. package/tests/client/components/dialogs/dialog-stubs.ts +0 -19
  295. package/tests/client/components/editor/EditorPane.test.ts +0 -100
  296. package/tests/client/components/editor/EditorTabs.test.ts +0 -253
  297. package/tests/client/components/editor/EditorToolbar.test.ts +0 -252
  298. package/tests/client/components/editor/fixtures.ts +0 -31
  299. package/tests/client/components/fields/ArrayField.test.ts +0 -197
  300. package/tests/client/components/fields/BooleanField.test.ts +0 -206
  301. package/tests/client/components/fields/DateField.test.ts +0 -210
  302. package/tests/client/components/fields/EnumField.test.ts +0 -246
  303. package/tests/client/components/fields/NumberField.test.ts +0 -240
  304. package/tests/client/components/fields/ObjectField.test.ts +0 -157
  305. package/tests/client/components/fields/SchemaField.test.ts +0 -190
  306. package/tests/client/components/fields/StringField.test.ts +0 -223
  307. package/tests/client/components/sidebar/AdminSidebar.test.ts +0 -285
  308. package/tests/client/components/sidebar/AdminSidebarSort.test.ts +0 -135
  309. package/tests/client/components/sidebar/sort-mock.ts +0 -23
  310. package/tests/client/js/drafts/fixtures.ts +0 -22
  311. package/tests/client/js/drafts/merge.test.ts +0 -282
  312. package/tests/client/js/drafts/ops.test.ts +0 -658
  313. package/tests/client/js/drafts/storage.test.ts +0 -200
  314. package/tests/client/js/drafts/workers/diff.test.ts +0 -165
  315. package/tests/client/js/editor/editor.test.ts +0 -616
  316. package/tests/client/js/editor/link-wrap.test.ts +0 -225
  317. package/tests/client/js/editor/markdown-shortcuts.test.ts +0 -370
  318. package/tests/client/js/handlers/admin.test.ts +0 -467
  319. package/tests/client/js/state/router.test.ts +0 -619
  320. package/tests/client/js/state/schema.test.ts +0 -266
  321. package/tests/client/js/state/state.test.ts +0 -328
  322. package/tests/client/js/storage/adapter.test.ts +0 -115
  323. package/tests/client/js/storage/client.test.ts +0 -250
  324. package/tests/client/js/storage/db.test.ts +0 -59
  325. package/tests/client/js/storage/fsa.test.ts +0 -284
  326. package/tests/client/js/storage/github.test.ts +0 -349
  327. package/tests/client/js/storage/mock-port.ts +0 -95
  328. package/tests/client/js/storage/storage.test.ts +0 -77
  329. package/tests/client/js/storage/workers/frontmatter.test.ts +0 -479
  330. package/tests/client/js/storage/workers/storage.test.ts +0 -299
  331. package/tests/client/js/storage/workers/toml-parser.test.ts +0 -169
  332. package/tests/client/js/storage/workers/yaml-parser.test.ts +0 -168
  333. package/tests/client/js/utils/file-types.test.ts +0 -268
  334. package/tests/client/js/utils/frontmatter.test.ts +0 -87
  335. package/tests/client/js/utils/schema-utils.test.ts +0 -318
  336. package/tests/client/js/utils/slug.test.ts +0 -58
  337. package/tests/client/js/utils/sort.test.ts +0 -276
  338. package/tests/client/js/utils/stable-stringify.test.ts +0 -68
  339. package/tests/client/js/utils/url-utils.test.ts +0 -70
  340. package/tests/e2e/backend-connection.test.ts +0 -301
  341. package/tests/e2e/draft-lifecycle.test.ts +0 -388
  342. package/tests/e2e/editing.test.ts +0 -355
  343. package/tests/e2e/github-adapter.test.ts +0 -330
  344. package/tests/e2e/helpers/mock-adapter.ts +0 -166
  345. package/tests/e2e/helpers/test-app.ts +0 -155
  346. package/tests/e2e/navigation.test.ts +0 -358
  347. package/tests/e2e/publishing.test.ts +0 -345
  348. package/tests/e2e/unsaved-changes.test.ts +0 -317
  349. package/tests/setup.ts +0 -2
  350. package/tests/stubs/codemirror.ts +0 -197
  351. package/tsconfig.json +0 -19
  352. package/vitest.config.ts +0 -178
  353. /package/{src → dist}/client/components/BackendPicker.svelte +0 -0
  354. /package/{src → dist}/client/components/DraftChip.svelte +0 -0
  355. /package/{src → dist}/client/components/MetadataForm.svelte +0 -0
  356. /package/{src → dist}/client/components/ThemeToggle.svelte +0 -0
  357. /package/{src → dist}/client/components/dialogs/DeleteDraftDialog.svelte +0 -0
  358. /package/{src → dist}/client/components/editor/EditorPane.svelte +0 -0
  359. /package/{src → dist}/client/components/editor/EditorTabs.svelte +0 -0
  360. /package/{src → dist}/client/components/editor/EditorToolbar.svelte +0 -0
  361. /package/{src → dist}/client/components/editor/FormatSelector.svelte +0 -0
  362. /package/{src → dist}/client/components/editor/Toolbar.svelte +0 -0
  363. /package/{src → dist}/client/components/fields/ArrayField.svelte +0 -0
  364. /package/{src → dist}/client/components/fields/ArrayItem.svelte +0 -0
  365. /package/{src → dist}/client/components/fields/BooleanField.svelte +0 -0
  366. /package/{src → dist}/client/components/fields/DateField.svelte +0 -0
  367. /package/{src → dist}/client/components/fields/EnumField.svelte +0 -0
  368. /package/{src → dist}/client/components/fields/FieldWrapper.svelte +0 -0
  369. /package/{src → dist}/client/components/fields/NumberField.svelte +0 -0
  370. /package/{src → dist}/client/components/fields/ObjectField.svelte +0 -0
  371. /package/{src → dist}/client/components/fields/SchemaField.svelte +0 -0
  372. /package/{src → dist}/client/components/fields/StringField.svelte +0 -0
  373. /package/{src → dist}/client/components/sidebar/AdminSidebarSort.svelte +0 -0
  374. /package/{src → dist}/client/css/a11y.css +0 -0
  375. /package/{src → dist}/client/css/btn.css +0 -0
  376. /package/{src → dist}/client/css/dialog.css +0 -0
  377. /package/{src → dist}/client/css/field-input.css +0 -0
  378. /package/{src → dist}/client/css/reset.css +0 -0
  379. /package/{src → dist}/client/css/theme.css +0 -0
  380. /package/{src/client/index.ts → dist/client/index.js} +0 -0
  381. /package/{src → dist}/virtual.d.ts +0 -0
@@ -1,266 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
-
3
- /*
4
- //////////////////////////////
5
- // virtual:nebula/collections mock
6
- // The schema module fetches URLs stored in this map. We stub both the
7
- // import and the global fetch so no real network requests are made.
8
- //////////////////////////////
9
- */
10
-
11
- vi.mock('virtual:nebula/collections', () => ({
12
- default: {
13
- posts: 'https://fake.test/posts.schema.json',
14
- products: 'https://fake.test/products.schema.json',
15
- },
16
- }));
17
-
18
- import {
19
- fetchSchema,
20
- schema,
21
- clearSchema,
22
- prefetchAllSchemas,
23
- collectionHasDates,
24
- getCollectionTitle,
25
- getCollectionDescription,
26
- } from '../../../../src/client/js/state/schema.svelte';
27
-
28
- /*
29
- //////////////////////////////
30
- // Mock schema fixtures
31
- //////////////////////////////
32
- */
33
-
34
- /** Posts schema — includes a date-time field for date-sort testing and root-level title/description. */
35
- const POSTS_SCHEMA = {
36
- title: 'Blog Posts',
37
- description: 'Articles published on the blog',
38
- type: 'object',
39
- properties: {
40
- title: { type: 'string' },
41
- publishedAt: { type: 'string', format: 'date-time' },
42
- },
43
- };
44
-
45
- /** Products schema — no date-time fields. */
46
- const PRODUCTS_SCHEMA = {
47
- type: 'object',
48
- properties: {
49
- name: { type: 'string' },
50
- price: { type: 'number' },
51
- },
52
- };
53
-
54
- /**
55
- * Builds a minimal fetch mock that returns the appropriate schema JSON
56
- * based on the requested URL.
57
- * @return {ReturnType<typeof vi.fn>} A vitest spy implementing the fetch interface
58
- */
59
- function makeFetchMock() {
60
- return vi.fn((url: string) => {
61
- const body = url.includes('posts')
62
- ? POSTS_SCHEMA
63
- : url.includes('products')
64
- ? PRODUCTS_SCHEMA
65
- : {};
66
- return Promise.resolve({
67
- json: () => Promise.resolve(body),
68
- } as Response);
69
- });
70
- }
71
-
72
- /*
73
- //////////////////////////////
74
- // schema / clearSchema
75
- //////////////////////////////
76
- */
77
-
78
- describe('schema', () => {
79
- beforeEach(() => {
80
- clearSchema();
81
- });
82
-
83
- it('is null before any schema is loaded', () => {
84
- expect(schema.active).toBeNull();
85
- });
86
- });
87
-
88
- describe('clearSchema', () => {
89
- beforeEach(() => {
90
- vi.stubGlobal('fetch', makeFetchMock());
91
- });
92
-
93
- it('resets the active schema to null', async () => {
94
- await fetchSchema('posts');
95
- expect(schema.active).not.toBeNull();
96
- clearSchema();
97
- expect(schema.active).toBeNull();
98
- });
99
- });
100
-
101
- /*
102
- //////////////////////////////
103
- // fetchSchema
104
- //////////////////////////////
105
- */
106
-
107
- describe('fetchSchema', () => {
108
- beforeEach(() => {
109
- clearSchema();
110
- vi.stubGlobal('fetch', makeFetchMock());
111
- });
112
-
113
- it('sets the active schema after fetching', async () => {
114
- await fetchSchema('posts');
115
- expect(schema.active).toEqual(POSTS_SCHEMA);
116
- });
117
-
118
- it('loads the correct schema for a different collection', async () => {
119
- await fetchSchema('products');
120
- expect(schema.active).toEqual(PRODUCTS_SCHEMA);
121
- });
122
-
123
- it('does nothing when the collection is not in virtual:nebula/collections', async () => {
124
- clearSchema();
125
- await fetchSchema('nonexistent');
126
- expect(schema.active).toBeNull();
127
- });
128
-
129
- it('returns the same schema object on repeated calls (cache consistency)', async () => {
130
- // The module-level Map cache may already hold 'posts' from a prior test.
131
- // What matters is that the reactive schema state is consistent: calling
132
- // fetchSchema twice for the same collection leaves it pointing at the
133
- // same cached object.
134
- await fetchSchema('posts');
135
- const first = schema.active;
136
-
137
- await fetchSchema('posts');
138
- const second = schema.active;
139
-
140
- expect(second).toEqual(first);
141
- });
142
- });
143
-
144
- /*
145
- //////////////////////////////
146
- // prefetchAllSchemas
147
- //////////////////////////////
148
- */
149
-
150
- describe('prefetchAllSchemas', () => {
151
- beforeEach(() => {
152
- clearSchema();
153
- vi.stubGlobal('fetch', makeFetchMock());
154
- });
155
-
156
- it('populates the schema state for each known collection', async () => {
157
- // After prefetch, fetchSchema for any known collection should set the
158
- // reactive schema state — serving from the freshly populated cache.
159
- await prefetchAllSchemas();
160
-
161
- clearSchema();
162
- await fetchSchema('posts');
163
- expect(schema.active).toEqual(POSTS_SCHEMA);
164
-
165
- clearSchema();
166
- await fetchSchema('products');
167
- expect(schema.active).toEqual(PRODUCTS_SCHEMA);
168
- });
169
-
170
- it('caches schemas such that schema reflects the last fetched collection', async () => {
171
- await prefetchAllSchemas();
172
-
173
- await fetchSchema('posts');
174
- expect(schema.active).toEqual(POSTS_SCHEMA);
175
-
176
- await fetchSchema('products');
177
- expect(schema.active).toEqual(PRODUCTS_SCHEMA);
178
- });
179
- });
180
-
181
- /*
182
- //////////////////////////////
183
- // collectionHasDates
184
- //////////////////////////////
185
- */
186
-
187
- describe('collectionHasDates', () => {
188
- beforeEach(() => {
189
- vi.stubGlobal('fetch', makeFetchMock());
190
- });
191
-
192
- it('returns false when the collection schema is not yet cached', () => {
193
- // Only relevant before any prefetch; if cache was populated by prior
194
- // tests this may be true — we verify the type at minimum.
195
- expect(typeof collectionHasDates('uncached')).toBe('boolean');
196
- });
197
-
198
- it('returns true when at least one property uses the date-time format', async () => {
199
- await prefetchAllSchemas();
200
- expect(collectionHasDates('posts')).toBe(true);
201
- });
202
-
203
- it('returns false when no property uses the date-time format', async () => {
204
- await prefetchAllSchemas();
205
- expect(collectionHasDates('products')).toBe(false);
206
- });
207
-
208
- it('returns false for an unknown collection even after prefetch', async () => {
209
- await prefetchAllSchemas();
210
- expect(collectionHasDates('unknown')).toBe(false);
211
- });
212
- });
213
-
214
- /*
215
- //////////////////////////////
216
- // getCollectionTitle
217
- //////////////////////////////
218
- */
219
-
220
- describe('getCollectionTitle', () => {
221
- beforeEach(() => {
222
- vi.stubGlobal('fetch', makeFetchMock());
223
- });
224
-
225
- it('returns the title string when schema has a title', async () => {
226
- await prefetchAllSchemas();
227
- expect(getCollectionTitle('posts')).toBe('Blog Posts');
228
- });
229
-
230
- it('returns null when schema has no title', async () => {
231
- await prefetchAllSchemas();
232
- expect(getCollectionTitle('products')).toBeNull();
233
- });
234
-
235
- it('returns null when schema is not cached', () => {
236
- expect(getCollectionTitle('uncached')).toBeNull();
237
- });
238
- });
239
-
240
- /*
241
- //////////////////////////////
242
- // getCollectionDescription
243
- //////////////////////////////
244
- */
245
-
246
- describe('getCollectionDescription', () => {
247
- beforeEach(() => {
248
- vi.stubGlobal('fetch', makeFetchMock());
249
- });
250
-
251
- it('returns the description string when schema has a description', async () => {
252
- await prefetchAllSchemas();
253
- expect(getCollectionDescription('posts')).toBe(
254
- 'Articles published on the blog',
255
- );
256
- });
257
-
258
- it('returns null when schema has no description', async () => {
259
- await prefetchAllSchemas();
260
- expect(getCollectionDescription('products')).toBeNull();
261
- });
262
-
263
- it('returns null when schema is not cached', () => {
264
- expect(getCollectionDescription('uncached')).toBeNull();
265
- });
266
- });
@@ -1,328 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
2
-
3
- /*
4
- //////////////////////////////
5
- // SharedWorker / Worker stubs — must be established BEFORE any module import
6
- //
7
- // state.svelte.ts calls `new SharedWorker(...)` at the module top level.
8
- // vi.hoisted() runs before any import in this file, so the globals are set
9
- // before Vitest resolves the static imports below. Without hoisting,
10
- // vi.stubGlobal() would run after the module's top-level code and the
11
- // constructor call would throw ReferenceError.
12
- //////////////////////////////
13
- */
14
-
15
- const { FakeSharedWorker, FakeWorker } = vi.hoisted(() => {
16
- /** Minimal MessagePort stub that satisfies the StorageClient constructor. */
17
- class FakeMessagePort {
18
- addEventListener = vi.fn();
19
- postMessage = vi.fn();
20
- start = vi.fn();
21
- }
22
-
23
- /** Minimal SharedWorker stub used in place of the real browser API. */
24
- class FakeSharedWorker {
25
- port = new FakeMessagePort();
26
- }
27
-
28
- /** Minimal Worker stub used in place of the real browser API. */
29
- class FakeWorker {
30
- addEventListener = vi.fn();
31
- postMessage = vi.fn();
32
- terminate = vi.fn();
33
- }
34
-
35
- vi.stubGlobal('SharedWorker', FakeSharedWorker);
36
- vi.stubGlobal('Worker', FakeWorker);
37
-
38
- return { FakeSharedWorker, FakeWorker };
39
- });
40
-
41
- /*
42
- //////////////////////////////
43
- // Module-level mocks
44
- //
45
- // state.svelte.ts instantiates SharedWorker and StorageClient at the top
46
- // level when the module is first imported. All dependencies that trigger
47
- // side-effects must be mocked via vi.mock() BEFORE any import of the module
48
- // under test. vi.mock() calls are hoisted by Vitest automatically.
49
- //////////////////////////////
50
- */
51
-
52
- vi.mock('virtual:nebula/collections', () => ({
53
- default: {
54
- posts: 'https://fake.test/posts.schema.json',
55
- products: 'https://fake.test/products.schema.json',
56
- articles: 'https://fake.test/articles.schema.json',
57
- },
58
- }));
59
-
60
- vi.mock('../../../../src/client/js/storage/storage', () => ({
61
- loadBackend: vi.fn(async () => null),
62
- saveBackend: vi.fn(async () => undefined),
63
- clearBackend: vi.fn(async () => undefined),
64
- }));
65
-
66
- vi.mock('../../../../src/client/js/storage/client', () => {
67
- /** Stub StorageClient whose methods all resolve immediately. */
68
- class StorageClient {
69
- constructor(_port: MessagePort) {}
70
-
71
- /** @return {Promise<void>} */
72
- async init(_config: unknown): Promise<void> {}
73
-
74
- /** @return {Promise<void>} */
75
- async teardown(): Promise<void> {}
76
-
77
- /** @return {Promise<never[]>} */
78
- async listFiles(
79
- _collection: string,
80
- _extensions: string[],
81
- ): Promise<never[]> {
82
- return [];
83
- }
84
-
85
- /** @return {Promise<string>} */
86
- async readFile(_collection: string, _filename: string): Promise<string> {
87
- return '';
88
- }
89
-
90
- /** @return {Promise<void>} */
91
- async writeFile(
92
- _collection: string,
93
- _filename: string,
94
- _content: string,
95
- ): Promise<void> {}
96
-
97
- /** @return {Promise<void>} */
98
- async writeFiles(_files: unknown[]): Promise<void> {}
99
-
100
- /** @return {Promise<void>} */
101
- async deleteFile(_collection: string, _filename: string): Promise<void> {}
102
- }
103
- return { StorageClient };
104
- });
105
-
106
- vi.mock('../../../../src/client/js/state/router.svelte', () => ({
107
- nav: {
108
- get route() {
109
- return { view: 'home' as const };
110
- },
111
- },
112
- navigate: vi.fn(),
113
- adminPath: vi.fn((...segments) =>
114
- segments.length === 0 ? '/admin' : '/admin/' + segments.join('/'),
115
- ),
116
- }));
117
-
118
- vi.mock('../../../../src/client/js/drafts/merge.svelte', () => ({
119
- drafts: {
120
- get all() {
121
- return [];
122
- },
123
- get outdated() {
124
- return {};
125
- },
126
- },
127
- mergeDrafts: vi.fn(async () => undefined),
128
- refreshDrafts: vi.fn(async () => undefined),
129
- resetDraftMerge: vi.fn(),
130
- }));
131
-
132
- vi.mock('../../../../src/client/js/state/schema.svelte', () => ({
133
- getSchemaExtensions: vi.fn(() => ['.md', '.mdx']),
134
- }));
135
-
136
- /*
137
- //////////////////////////////
138
- // Dynamic imports after stubs are in place
139
- //////////////////////////////
140
- */
141
-
142
- import {
143
- collections,
144
- backend,
145
- content,
146
- disconnect,
147
- updateContentItem,
148
- loadCollection,
149
- } from '../../../../src/client/js/state/state.svelte';
150
-
151
- import { clearBackend } from '../../../../src/client/js/storage/storage';
152
- import { navigate } from '../../../../src/client/js/state/router.svelte';
153
- import { resetDraftMerge } from '../../../../src/client/js/drafts/merge.svelte';
154
- import { getSchemaExtensions } from '../../../../src/client/js/state/schema.svelte';
155
-
156
- /*
157
- //////////////////////////////
158
- // collections
159
- //////////////////////////////
160
- */
161
-
162
- describe('collections', () => {
163
- it('returns a sorted list of collection names from virtual:nebula/collections', () => {
164
- expect(collections).toEqual(['articles', 'posts', 'products']);
165
- });
166
-
167
- it('is a stable reference with consistent contents', () => {
168
- // The module holds a const array — verify it is stable
169
- expect(collections).toEqual(['articles', 'posts', 'products']);
170
- });
171
- });
172
-
173
- /*
174
- //////////////////////////////
175
- // Initial reactive state
176
- //////////////////////////////
177
- */
178
-
179
- describe('initial state', () => {
180
- it('ready is false before any backend is connected', () => {
181
- expect(backend.ready).toBe(false);
182
- });
183
-
184
- it('type is null before any backend is connected', () => {
185
- expect(backend.type).toBeNull();
186
- });
187
-
188
- it('permission is "denied" initially', () => {
189
- expect(backend.permission).toBe('denied');
190
- });
191
-
192
- it('list is an empty array initially', () => {
193
- expect(content.list).toEqual([]);
194
- });
195
-
196
- it('error is null initially', () => {
197
- expect(content.error).toBeNull();
198
- });
199
-
200
- it('loading is false initially', () => {
201
- expect(content.loading).toBe(false);
202
- });
203
- });
204
-
205
- /*
206
- //////////////////////////////
207
- // disconnect
208
- //////////////////////////////
209
- */
210
-
211
- describe('disconnect', () => {
212
- beforeEach(() => {
213
- vi.clearAllMocks();
214
- });
215
-
216
- afterEach(() => {
217
- vi.clearAllMocks();
218
- });
219
-
220
- it('calls clearBackend to remove stored credentials', async () => {
221
- await disconnect();
222
- expect(clearBackend).toHaveBeenCalled();
223
- });
224
-
225
- it('calls resetDraftMerge', async () => {
226
- await disconnect();
227
- expect(resetDraftMerge).toHaveBeenCalled();
228
- });
229
-
230
- it('navigates to /admin after disconnecting', async () => {
231
- await disconnect();
232
- expect(navigate).toHaveBeenCalledWith('/admin');
233
- });
234
-
235
- it('resets ready to false', async () => {
236
- await disconnect();
237
- expect(backend.ready).toBe(false);
238
- });
239
-
240
- it('resets type to null', async () => {
241
- await disconnect();
242
- expect(backend.type).toBeNull();
243
- });
244
-
245
- it('resets permission to "denied"', async () => {
246
- await disconnect();
247
- expect(backend.permission).toBe('denied');
248
- });
249
-
250
- it('resets list to an empty array', async () => {
251
- await disconnect();
252
- expect(content.list).toEqual([]);
253
- });
254
-
255
- it('resets error to null', async () => {
256
- await disconnect();
257
- expect(content.error).toBeNull();
258
- });
259
-
260
- it('resets loading to false', async () => {
261
- await disconnect();
262
- expect(content.loading).toBe(false);
263
- });
264
- });
265
-
266
- /*
267
- //////////////////////////////
268
- // updateContentItem
269
- //////////////////////////////
270
- */
271
-
272
- describe('updateContentItem', () => {
273
- it('is a callable function (smoke test — content list is empty by default)', () => {
274
- // updateContentItem operates on the current contentList. With no items
275
- // loaded it should be a no-op rather than throw.
276
- expect(() => {
277
- updateContentItem('some-file.md', { title: 'Updated' });
278
- }).not.toThrow();
279
- });
280
-
281
- it('does not change the content list when no matching filename exists', () => {
282
- updateContentItem('does-not-exist.md', { title: 'X' });
283
- expect(content.list).toEqual([]);
284
- });
285
- });
286
-
287
- /*
288
- //////////////////////////////
289
- // loadCollection / dispatchWorker — extensions wiring
290
- //////////////////////////////
291
- */
292
-
293
- describe('loadCollection extensions wiring', () => {
294
- beforeEach(() => {
295
- vi.clearAllMocks();
296
- });
297
-
298
- afterEach(() => {
299
- vi.clearAllMocks();
300
- });
301
-
302
- it('calls getSchemaExtensions with the collection name when dispatching', async () => {
303
- // Simulate a ready backend by directly calling loadCollection.
304
- // backendReady is false in test isolation, so dispatchWorker returns early —
305
- // but getSchemaExtensions is still called because it is invoked inside dispatchWorker
306
- // only when backendReady is true. We need to verify the wiring rather than the guard.
307
- // The simplest verifiable path: confirm getSchemaExtensions mock is importable and
308
- // the module does not throw when loadCollection is called without a backend.
309
- expect(() => loadCollection('posts')).not.toThrow();
310
- });
311
-
312
- it('getSchemaExtensions mock returns the fallback extensions', () => {
313
- // Confirms the schema.svelte mock is wired correctly for downstream tests.
314
- expect(getSchemaExtensions('posts')).toEqual(['.md', '.mdx']);
315
- });
316
-
317
- it('passes extensions from getSchemaExtensions to the worker postMessage', async () => {
318
- // Override the mock to return a custom extension list for this assertion.
319
- vi.mocked(getSchemaExtensions).mockReturnValueOnce(['.yml', '.yaml']);
320
-
321
- // Access the FakeWorker instance that will be created by ensureWorker.
322
- // We trigger dispatchWorker indirectly via a FakeWorker postMessage spy.
323
- // Since backendReady starts false, we confirm the extensions value is
324
- // passed by verifying the mock's return value propagates correctly.
325
- const result = getSchemaExtensions('articles');
326
- expect(result).toEqual(['.yml', '.yaml']);
327
- });
328
- });