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.
- package/README.md +3 -1
- package/dist/astro/index.d.ts +43 -0
- package/dist/astro/index.d.ts.map +1 -0
- package/dist/astro/index.js +223 -0
- package/{src → dist}/client/Admin.svelte +20 -11
- package/dist/client/Admin.svelte.d.ts +11 -0
- package/dist/client/Admin.svelte.d.ts.map +1 -0
- package/dist/client/components/BackendPicker.svelte.d.ts +4 -0
- package/dist/client/components/BackendPicker.svelte.d.ts.map +1 -0
- package/dist/client/components/DraftChip.svelte.d.ts +10 -0
- package/dist/client/components/DraftChip.svelte.d.ts.map +1 -0
- package/dist/client/components/MetadataForm.svelte.d.ts +12 -0
- package/dist/client/components/MetadataForm.svelte.d.ts.map +1 -0
- package/dist/client/components/ThemeToggle.svelte.d.ts +19 -0
- package/dist/client/components/ThemeToggle.svelte.d.ts.map +1 -0
- package/dist/client/components/dialogs/DeleteDraftDialog.svelte.d.ts +11 -0
- package/dist/client/components/dialogs/DeleteDraftDialog.svelte.d.ts.map +1 -0
- package/{src → dist}/client/components/dialogs/FilenameDialog.svelte +1 -2
- package/dist/client/components/dialogs/FilenameDialog.svelte.d.ts +13 -0
- package/dist/client/components/dialogs/FilenameDialog.svelte.d.ts.map +1 -0
- package/dist/client/components/editor/EditorPane.svelte.d.ts +4 -0
- package/dist/client/components/editor/EditorPane.svelte.d.ts.map +1 -0
- package/dist/client/components/editor/EditorTabs.svelte.d.ts +8 -0
- package/dist/client/components/editor/EditorTabs.svelte.d.ts.map +1 -0
- package/dist/client/components/editor/EditorToolbar.svelte.d.ts +4 -0
- package/dist/client/components/editor/EditorToolbar.svelte.d.ts.map +1 -0
- package/dist/client/components/editor/FormatSelector.svelte.d.ts +4 -0
- package/dist/client/components/editor/FormatSelector.svelte.d.ts.map +1 -0
- package/dist/client/components/editor/Toolbar.svelte.d.ts +19 -0
- package/dist/client/components/editor/Toolbar.svelte.d.ts.map +1 -0
- package/dist/client/components/fields/ArrayField.svelte.d.ts +15 -0
- package/dist/client/components/fields/ArrayField.svelte.d.ts.map +1 -0
- package/dist/client/components/fields/ArrayItem.svelte.d.ts +28 -0
- package/dist/client/components/fields/ArrayItem.svelte.d.ts.map +1 -0
- package/dist/client/components/fields/BooleanField.svelte.d.ts +16 -0
- package/dist/client/components/fields/BooleanField.svelte.d.ts.map +1 -0
- package/dist/client/components/fields/DateField.svelte.d.ts +16 -0
- package/dist/client/components/fields/DateField.svelte.d.ts.map +1 -0
- package/dist/client/components/fields/EnumField.svelte.d.ts +17 -0
- package/dist/client/components/fields/EnumField.svelte.d.ts.map +1 -0
- package/dist/client/components/fields/FieldWrapper.svelte.d.ts +18 -0
- package/dist/client/components/fields/FieldWrapper.svelte.d.ts.map +1 -0
- package/dist/client/components/fields/NumberField.svelte.d.ts +16 -0
- package/dist/client/components/fields/NumberField.svelte.d.ts.map +1 -0
- package/dist/client/components/fields/ObjectField.svelte.d.ts +16 -0
- package/dist/client/components/fields/ObjectField.svelte.d.ts.map +1 -0
- package/dist/client/components/fields/SchemaField.svelte.d.ts +16 -0
- package/dist/client/components/fields/SchemaField.svelte.d.ts.map +1 -0
- package/dist/client/components/fields/StringField.svelte.d.ts +16 -0
- package/dist/client/components/fields/StringField.svelte.d.ts.map +1 -0
- package/{src → dist}/client/components/sidebar/AdminSidebar.svelte +2 -4
- package/dist/client/components/sidebar/AdminSidebar.svelte.d.ts +19 -0
- package/dist/client/components/sidebar/AdminSidebar.svelte.d.ts.map +1 -0
- package/dist/client/components/sidebar/AdminSidebarSort.svelte.d.ts +12 -0
- package/dist/client/components/sidebar/AdminSidebarSort.svelte.d.ts.map +1 -0
- package/dist/client/css/icons.css +29 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/js/drafts/merge.svelte.d.ts +24 -0
- package/dist/client/js/drafts/merge.svelte.d.ts.map +1 -0
- package/dist/client/js/drafts/merge.svelte.js +106 -0
- package/dist/client/js/drafts/ops.svelte.d.ts +31 -0
- package/dist/client/js/drafts/ops.svelte.d.ts.map +1 -0
- package/dist/client/js/drafts/ops.svelte.js +182 -0
- package/dist/client/js/drafts/storage.d.ts +45 -0
- package/dist/client/js/drafts/storage.d.ts.map +1 -0
- package/dist/client/js/drafts/storage.js +76 -0
- package/dist/client/js/drafts/workers/diff.d.ts +2 -0
- package/dist/client/js/drafts/workers/diff.d.ts.map +1 -0
- package/dist/client/js/drafts/workers/diff.js +20 -0
- package/dist/client/js/editor/editor.svelte.d.ts +124 -0
- package/dist/client/js/editor/editor.svelte.d.ts.map +1 -0
- package/dist/client/js/editor/editor.svelte.js +294 -0
- package/dist/client/js/editor/languages.d.ts +11 -0
- package/dist/client/js/editor/languages.d.ts.map +1 -0
- package/dist/client/js/editor/languages.js +93 -0
- package/dist/client/js/editor/link-wrap.d.ts +6 -0
- package/dist/client/js/editor/link-wrap.d.ts.map +1 -0
- package/{src/client/js/editor/link-wrap.ts → dist/client/js/editor/link-wrap.js} +17 -24
- package/dist/client/js/editor/markdown-shortcuts.d.ts +4 -0
- package/dist/client/js/editor/markdown-shortcuts.d.ts.map +1 -0
- package/dist/client/js/editor/markdown-shortcuts.js +219 -0
- package/dist/client/js/handlers/admin.d.ts +64 -0
- package/dist/client/js/handlers/admin.d.ts.map +1 -0
- package/dist/client/js/handlers/admin.js +186 -0
- package/dist/client/js/state/dialogs.svelte.d.ts +16 -0
- package/dist/client/js/state/dialogs.svelte.d.ts.map +1 -0
- package/dist/client/js/state/dialogs.svelte.js +28 -0
- package/dist/client/js/state/router.svelte.d.ts +44 -0
- package/dist/client/js/state/router.svelte.d.ts.map +1 -0
- package/dist/client/js/state/router.svelte.js +141 -0
- package/dist/client/js/state/schema.svelte.d.ts +51 -0
- package/dist/client/js/state/schema.svelte.d.ts.map +1 -0
- package/{src/client/js/state/schema.svelte.ts → dist/client/js/state/schema.svelte.js} +55 -70
- package/dist/client/js/state/state.svelte.d.ts +68 -0
- package/dist/client/js/state/state.svelte.d.ts.map +1 -0
- package/dist/client/js/state/state.svelte.js +300 -0
- package/dist/client/js/state/theme.svelte.d.ts +24 -0
- package/dist/client/js/state/theme.svelte.d.ts.map +1 -0
- package/{src/client/js/state/theme.svelte.ts → dist/client/js/state/theme.svelte.js} +54 -91
- package/dist/client/js/storage/adapter.d.ts +130 -0
- package/dist/client/js/storage/adapter.d.ts.map +1 -0
- package/dist/client/js/storage/adapter.js +5 -0
- package/dist/client/js/storage/client.d.ts +72 -0
- package/dist/client/js/storage/client.d.ts.map +1 -0
- package/dist/client/js/storage/client.js +121 -0
- package/dist/client/js/storage/db.d.ts +8 -0
- package/dist/client/js/storage/db.d.ts.map +1 -0
- package/dist/client/js/storage/db.js +35 -0
- package/dist/client/js/storage/fsa.d.ts +51 -0
- package/dist/client/js/storage/fsa.d.ts.map +1 -0
- package/dist/client/js/storage/fsa.js +91 -0
- package/dist/client/js/storage/github.d.ts +62 -0
- package/dist/client/js/storage/github.d.ts.map +1 -0
- package/dist/client/js/storage/github.js +216 -0
- package/dist/client/js/storage/storage.d.ts +32 -0
- package/dist/client/js/storage/storage.d.ts.map +1 -0
- package/dist/client/js/storage/storage.js +68 -0
- package/dist/client/js/storage/workers/frontmatter.d.ts +2 -0
- package/dist/client/js/storage/workers/frontmatter.d.ts.map +1 -0
- package/dist/client/js/storage/workers/frontmatter.js +253 -0
- package/dist/client/js/storage/workers/storage.d.ts +2 -0
- package/dist/client/js/storage/workers/storage.d.ts.map +1 -0
- package/dist/client/js/storage/workers/storage.js +167 -0
- package/dist/client/js/storage/workers/toml-parser.d.ts +2 -0
- package/dist/client/js/storage/workers/toml-parser.d.ts.map +1 -0
- package/dist/client/js/storage/workers/toml-parser.js +75 -0
- package/dist/client/js/storage/workers/yaml-parser.d.ts +2 -0
- package/dist/client/js/storage/workers/yaml-parser.d.ts.map +1 -0
- package/dist/client/js/storage/workers/yaml-parser.js +100 -0
- package/dist/client/js/utils/file-types.d.ts +58 -0
- package/dist/client/js/utils/file-types.d.ts.map +1 -0
- package/{src/client/js/utils/file-types.ts → dist/client/js/utils/file-types.js} +75 -107
- package/dist/client/js/utils/format.d.ts +8 -0
- package/dist/client/js/utils/format.d.ts.map +1 -0
- package/{src/client/js/utils/format.ts → dist/client/js/utils/format.js} +5 -6
- package/dist/client/js/utils/frontmatter.d.ts +12 -0
- package/dist/client/js/utils/frontmatter.d.ts.map +1 -0
- package/dist/client/js/utils/frontmatter.js +29 -0
- package/dist/client/js/utils/schema-utils.d.ts +110 -0
- package/dist/client/js/utils/schema-utils.d.ts.map +1 -0
- package/dist/client/js/utils/schema-utils.js +242 -0
- package/dist/client/js/utils/slug.d.ts +8 -0
- package/dist/client/js/utils/slug.d.ts.map +1 -0
- package/{src/client/js/utils/slug.ts → dist/client/js/utils/slug.js} +6 -7
- package/dist/client/js/utils/sort.d.ts +41 -0
- package/dist/client/js/utils/sort.d.ts.map +1 -0
- package/dist/client/js/utils/sort.js +65 -0
- package/dist/client/js/utils/stable-stringify.d.ts +8 -0
- package/dist/client/js/utils/stable-stringify.d.ts.map +1 -0
- package/dist/client/js/utils/stable-stringify.js +23 -0
- package/dist/client/js/utils/url-utils.d.ts +11 -0
- package/dist/client/js/utils/url-utils.d.ts.map +1 -0
- package/{src/client/js/utils/url-utils.ts → dist/client/js/utils/url-utils.js} +22 -23
- package/dist/client/types/browser-apis.d.ts +39 -0
- package/dist/types.d.ts +22 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +13 -3
- package/.github/workflows/ci.yml +0 -27
- package/.github/workflows/publish.yml +0 -34
- package/.mcp.json +0 -12
- package/.prettierignore +0 -5
- package/.prettierrc.cjs +0 -22
- package/AGENTS.md +0 -183
- package/playground/astro.config.mjs +0 -7
- package/playground/node_modules/.bin/astro +0 -21
- package/playground/node_modules/.vite/deps/@astrojs_svelte_client__js.js +0 -85
- package/playground/node_modules/.vite/deps/@astrojs_svelte_client__js.js.map +0 -7
- package/playground/node_modules/.vite/deps/_metadata.json +0 -184
- package/playground/node_modules/.vite/deps/astro___aria-query.js +0 -6776
- package/playground/node_modules/.vite/deps/astro___aria-query.js.map +0 -7
- package/playground/node_modules/.vite/deps/astro___axobject-query.js +0 -3754
- package/playground/node_modules/.vite/deps/astro___axobject-query.js.map +0 -7
- package/playground/node_modules/.vite/deps/astro___html-escaper.js +0 -34
- package/playground/node_modules/.vite/deps/astro___html-escaper.js.map +0 -7
- package/playground/node_modules/.vite/deps/chunk-AJXJMYAF.js +0 -0
- package/playground/node_modules/.vite/deps/chunk-AJXJMYAF.js.map +0 -7
- package/playground/node_modules/.vite/deps/chunk-BUSYA2B4.js +0 -8
- package/playground/node_modules/.vite/deps/chunk-BUSYA2B4.js.map +0 -7
- package/playground/node_modules/.vite/deps/chunk-CNYJBM5F.js +0 -21
- package/playground/node_modules/.vite/deps/chunk-CNYJBM5F.js.map +0 -7
- package/playground/node_modules/.vite/deps/chunk-DBPNBGEI.js +0 -223
- package/playground/node_modules/.vite/deps/chunk-DBPNBGEI.js.map +0 -7
- package/playground/node_modules/.vite/deps/chunk-FPEUJ7DG.js +0 -27
- package/playground/node_modules/.vite/deps/chunk-FPEUJ7DG.js.map +0 -7
- package/playground/node_modules/.vite/deps/chunk-MHDZ3SK7.js +0 -1005
- package/playground/node_modules/.vite/deps/chunk-MHDZ3SK7.js.map +0 -7
- package/playground/node_modules/.vite/deps/chunk-RBDTDTPY.js +0 -204
- package/playground/node_modules/.vite/deps/chunk-RBDTDTPY.js.map +0 -7
- package/playground/node_modules/.vite/deps/chunk-RJGEXL5C.js +0 -688
- package/playground/node_modules/.vite/deps/chunk-RJGEXL5C.js.map +0 -7
- package/playground/node_modules/.vite/deps/chunk-YL4MIWGJ.js +0 -5099
- package/playground/node_modules/.vite/deps/chunk-YL4MIWGJ.js.map +0 -7
- package/playground/node_modules/.vite/deps/chunk-ZOV3DWEJ.js +0 -4376
- package/playground/node_modules/.vite/deps/chunk-ZOV3DWEJ.js.map +0 -7
- package/playground/node_modules/.vite/deps/chunk-ZP4UNCSN.js +0 -23
- package/playground/node_modules/.vite/deps/chunk-ZP4UNCSN.js.map +0 -7
- package/playground/node_modules/.vite/deps/chunk-ZREFNRZZ.js +0 -148
- package/playground/node_modules/.vite/deps/chunk-ZREFNRZZ.js.map +0 -7
- package/playground/node_modules/.vite/deps/package.json +0 -3
- package/playground/node_modules/.vite/deps/smol-toml.js +0 -843
- package/playground/node_modules/.vite/deps/smol-toml.js.map +0 -7
- package/playground/node_modules/.vite/deps/svelte.js +0 -55
- package/playground/node_modules/.vite/deps/svelte.js.map +0 -7
- package/playground/node_modules/.vite/deps/svelte___clsx.js +0 -9
- package/playground/node_modules/.vite/deps/svelte___clsx.js.map +0 -7
- package/playground/node_modules/.vite/deps/svelte_animate.js +0 -57
- package/playground/node_modules/.vite/deps/svelte_animate.js.map +0 -7
- package/playground/node_modules/.vite/deps/svelte_attachments.js +0 -15
- package/playground/node_modules/.vite/deps/svelte_attachments.js.map +0 -7
- package/playground/node_modules/.vite/deps/svelte_easing.js +0 -67
- package/playground/node_modules/.vite/deps/svelte_easing.js.map +0 -7
- package/playground/node_modules/.vite/deps/svelte_events.js +0 -11
- package/playground/node_modules/.vite/deps/svelte_events.js.map +0 -7
- package/playground/node_modules/.vite/deps/svelte_internal.js +0 -5
- package/playground/node_modules/.vite/deps/svelte_internal.js.map +0 -7
- package/playground/node_modules/.vite/deps/svelte_internal_client.js +0 -402
- package/playground/node_modules/.vite/deps/svelte_internal_client.js.map +0 -7
- package/playground/node_modules/.vite/deps/svelte_internal_disclose-version.js +0 -10
- package/playground/node_modules/.vite/deps/svelte_internal_disclose-version.js.map +0 -7
- package/playground/node_modules/.vite/deps/svelte_internal_flags_async.js +0 -8
- package/playground/node_modules/.vite/deps/svelte_internal_flags_async.js.map +0 -7
- package/playground/node_modules/.vite/deps/svelte_internal_flags_legacy.js +0 -8
- package/playground/node_modules/.vite/deps/svelte_internal_flags_legacy.js.map +0 -7
- package/playground/node_modules/.vite/deps/svelte_internal_flags_tracing.js +0 -8
- package/playground/node_modules/.vite/deps/svelte_internal_flags_tracing.js.map +0 -7
- package/playground/node_modules/.vite/deps/svelte_legacy.js +0 -35
- package/playground/node_modules/.vite/deps/svelte_legacy.js.map +0 -7
- package/playground/node_modules/.vite/deps/svelte_motion.js +0 -545
- package/playground/node_modules/.vite/deps/svelte_motion.js.map +0 -7
- package/playground/node_modules/.vite/deps/svelte_reactivity.js +0 -29
- package/playground/node_modules/.vite/deps/svelte_reactivity.js.map +0 -7
- package/playground/node_modules/.vite/deps/svelte_reactivity_window.js +0 -127
- package/playground/node_modules/.vite/deps/svelte_reactivity_window.js.map +0 -7
- package/playground/node_modules/.vite/deps/svelte_store.js +0 -103
- package/playground/node_modules/.vite/deps/svelte_store.js.map +0 -7
- package/playground/node_modules/.vite/deps/svelte_transition.js +0 -208
- package/playground/node_modules/.vite/deps/svelte_transition.js.map +0 -7
- package/playground/package.json +0 -16
- package/playground/pnpm-lock.yaml +0 -3167
- package/playground/src/content/authors/jane-doe.json +0 -8
- package/playground/src/content/config/build.toml +0 -2
- package/playground/src/content/courses/web-fundamentals.json +0 -29
- package/playground/src/content/docs/advanced.mdx +0 -6
- package/playground/src/content/docs/intro.md +0 -6
- package/playground/src/content/guides/getting-started.mdx +0 -6
- package/playground/src/content/posts/hello-world.md +0 -7
- package/playground/src/content/products/t-shirt.json +0 -16
- package/playground/src/content/recipes/pancakes.mdoc +0 -8
- package/playground/src/content/settings/site.yml +0 -2
- package/playground/src/content.config.ts +0 -198
- package/playground/src/env.d.ts +0 -1
- package/playground/src/pages/index.astro +0 -11
- package/playground/src/pages/nebula.astro +0 -14
- package/pnpm-workspace.yaml +0 -2
- package/scripts/subset-icons.mjs +0 -178
- package/src/astro/index.ts +0 -295
- package/src/client/js/drafts/merge.svelte.ts +0 -121
- package/src/client/js/drafts/ops.svelte.ts +0 -227
- package/src/client/js/drafts/storage.ts +0 -108
- package/src/client/js/drafts/workers/diff.ts +0 -40
- package/src/client/js/editor/editor.svelte.ts +0 -343
- package/src/client/js/editor/languages.ts +0 -98
- package/src/client/js/editor/markdown-shortcuts.ts +0 -261
- package/src/client/js/handlers/admin.ts +0 -246
- package/src/client/js/state/dialogs.svelte.ts +0 -35
- package/src/client/js/state/router.svelte.ts +0 -156
- package/src/client/js/state/state.svelte.ts +0 -334
- package/src/client/js/storage/adapter.ts +0 -102
- package/src/client/js/storage/client.ts +0 -150
- package/src/client/js/storage/db.ts +0 -36
- package/src/client/js/storage/fsa.ts +0 -110
- package/src/client/js/storage/github.ts +0 -297
- package/src/client/js/storage/storage.ts +0 -83
- package/src/client/js/storage/workers/frontmatter.ts +0 -320
- package/src/client/js/storage/workers/storage.ts +0 -177
- package/src/client/js/storage/workers/toml-parser.ts +0 -106
- package/src/client/js/storage/workers/yaml-parser.ts +0 -132
- package/src/client/js/utils/frontmatter.ts +0 -38
- package/src/client/js/utils/schema-utils.ts +0 -295
- package/src/client/js/utils/sort.ts +0 -84
- package/src/client/js/utils/stable-stringify.ts +0 -27
- package/src/types.ts +0 -25
- package/svelte.config.js +0 -4
- package/tests/astro/build.test.ts +0 -63
- package/tests/astro/index.test.ts +0 -689
- package/tests/client/components/Admin.test.ts +0 -446
- package/tests/client/components/BackendPicker.test.ts +0 -239
- package/tests/client/components/DraftChip.test.ts +0 -53
- package/tests/client/components/MetadataForm.test.ts +0 -164
- package/tests/client/components/dialogs/DeleteDraftDialog.test.ts +0 -91
- package/tests/client/components/dialogs/FilenameDialog.test.ts +0 -209
- package/tests/client/components/dialogs/dialog-stubs.ts +0 -19
- package/tests/client/components/editor/EditorPane.test.ts +0 -100
- package/tests/client/components/editor/EditorTabs.test.ts +0 -253
- package/tests/client/components/editor/EditorToolbar.test.ts +0 -252
- package/tests/client/components/editor/fixtures.ts +0 -31
- package/tests/client/components/fields/ArrayField.test.ts +0 -197
- package/tests/client/components/fields/BooleanField.test.ts +0 -206
- package/tests/client/components/fields/DateField.test.ts +0 -210
- package/tests/client/components/fields/EnumField.test.ts +0 -246
- package/tests/client/components/fields/NumberField.test.ts +0 -240
- package/tests/client/components/fields/ObjectField.test.ts +0 -157
- package/tests/client/components/fields/SchemaField.test.ts +0 -190
- package/tests/client/components/fields/StringField.test.ts +0 -223
- package/tests/client/components/sidebar/AdminSidebar.test.ts +0 -285
- package/tests/client/components/sidebar/AdminSidebarSort.test.ts +0 -135
- package/tests/client/components/sidebar/sort-mock.ts +0 -23
- package/tests/client/js/drafts/fixtures.ts +0 -22
- package/tests/client/js/drafts/merge.test.ts +0 -282
- package/tests/client/js/drafts/ops.test.ts +0 -658
- package/tests/client/js/drafts/storage.test.ts +0 -200
- package/tests/client/js/drafts/workers/diff.test.ts +0 -165
- package/tests/client/js/editor/editor.test.ts +0 -616
- package/tests/client/js/editor/link-wrap.test.ts +0 -225
- package/tests/client/js/editor/markdown-shortcuts.test.ts +0 -370
- package/tests/client/js/handlers/admin.test.ts +0 -467
- package/tests/client/js/state/router.test.ts +0 -619
- package/tests/client/js/state/schema.test.ts +0 -266
- package/tests/client/js/state/state.test.ts +0 -328
- package/tests/client/js/storage/adapter.test.ts +0 -115
- package/tests/client/js/storage/client.test.ts +0 -250
- package/tests/client/js/storage/db.test.ts +0 -59
- package/tests/client/js/storage/fsa.test.ts +0 -284
- package/tests/client/js/storage/github.test.ts +0 -349
- package/tests/client/js/storage/mock-port.ts +0 -95
- package/tests/client/js/storage/storage.test.ts +0 -77
- package/tests/client/js/storage/workers/frontmatter.test.ts +0 -479
- package/tests/client/js/storage/workers/storage.test.ts +0 -299
- package/tests/client/js/storage/workers/toml-parser.test.ts +0 -169
- package/tests/client/js/storage/workers/yaml-parser.test.ts +0 -168
- package/tests/client/js/utils/file-types.test.ts +0 -268
- package/tests/client/js/utils/frontmatter.test.ts +0 -87
- package/tests/client/js/utils/schema-utils.test.ts +0 -318
- package/tests/client/js/utils/slug.test.ts +0 -58
- package/tests/client/js/utils/sort.test.ts +0 -276
- package/tests/client/js/utils/stable-stringify.test.ts +0 -68
- package/tests/client/js/utils/url-utils.test.ts +0 -70
- package/tests/e2e/backend-connection.test.ts +0 -301
- package/tests/e2e/draft-lifecycle.test.ts +0 -388
- package/tests/e2e/editing.test.ts +0 -355
- package/tests/e2e/github-adapter.test.ts +0 -330
- package/tests/e2e/helpers/mock-adapter.ts +0 -166
- package/tests/e2e/helpers/test-app.ts +0 -155
- package/tests/e2e/navigation.test.ts +0 -358
- package/tests/e2e/publishing.test.ts +0 -345
- package/tests/e2e/unsaved-changes.test.ts +0 -317
- package/tests/setup.ts +0 -2
- package/tests/stubs/codemirror.ts +0 -197
- package/tsconfig.json +0 -19
- package/vitest.config.ts +0 -178
- /package/{src → dist}/client/components/BackendPicker.svelte +0 -0
- /package/{src → dist}/client/components/DraftChip.svelte +0 -0
- /package/{src → dist}/client/components/MetadataForm.svelte +0 -0
- /package/{src → dist}/client/components/ThemeToggle.svelte +0 -0
- /package/{src → dist}/client/components/dialogs/DeleteDraftDialog.svelte +0 -0
- /package/{src → dist}/client/components/editor/EditorPane.svelte +0 -0
- /package/{src → dist}/client/components/editor/EditorTabs.svelte +0 -0
- /package/{src → dist}/client/components/editor/EditorToolbar.svelte +0 -0
- /package/{src → dist}/client/components/editor/FormatSelector.svelte +0 -0
- /package/{src → dist}/client/components/editor/Toolbar.svelte +0 -0
- /package/{src → dist}/client/components/fields/ArrayField.svelte +0 -0
- /package/{src → dist}/client/components/fields/ArrayItem.svelte +0 -0
- /package/{src → dist}/client/components/fields/BooleanField.svelte +0 -0
- /package/{src → dist}/client/components/fields/DateField.svelte +0 -0
- /package/{src → dist}/client/components/fields/EnumField.svelte +0 -0
- /package/{src → dist}/client/components/fields/FieldWrapper.svelte +0 -0
- /package/{src → dist}/client/components/fields/NumberField.svelte +0 -0
- /package/{src → dist}/client/components/fields/ObjectField.svelte +0 -0
- /package/{src → dist}/client/components/fields/SchemaField.svelte +0 -0
- /package/{src → dist}/client/components/fields/StringField.svelte +0 -0
- /package/{src → dist}/client/components/sidebar/AdminSidebarSort.svelte +0 -0
- /package/{src → dist}/client/css/a11y.css +0 -0
- /package/{src → dist}/client/css/btn.css +0 -0
- /package/{src → dist}/client/css/dialog.css +0 -0
- /package/{src → dist}/client/css/field-input.css +0 -0
- /package/{src → dist}/client/css/reset.css +0 -0
- /package/{src → dist}/client/css/theme.css +0 -0
- /package/{src/client/index.ts → dist/client/index.js} +0 -0
- /package/{src → dist}/virtual.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../src/client/js/storage/adapter.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { StorageRequest, FileEntry, FileWrite } from './adapter';
|
|
2
|
+
export declare class StorageClient {
|
|
3
|
+
private port;
|
|
4
|
+
private pending;
|
|
5
|
+
private idCounter;
|
|
6
|
+
/**
|
|
7
|
+
* Creates a client wrapping the given port.
|
|
8
|
+
* @param {MessagePort} port - The port connected to the storage SharedWorker
|
|
9
|
+
*/
|
|
10
|
+
constructor(port: MessagePort);
|
|
11
|
+
/**
|
|
12
|
+
* Routes responses to their pending promises. Responses without an _id are broadcast (like port-connected) and are ignored here.
|
|
13
|
+
* @param {StorageResponse & { _id?: string }} data - The response data
|
|
14
|
+
* @return {void}
|
|
15
|
+
*/
|
|
16
|
+
private handleResponse;
|
|
17
|
+
/**
|
|
18
|
+
* Sends a request and waits for the matching response.
|
|
19
|
+
* @param {StorageRequest} msg - The request to send
|
|
20
|
+
* @return {Promise<StorageResponse>} The matched response
|
|
21
|
+
*/
|
|
22
|
+
private send;
|
|
23
|
+
/**
|
|
24
|
+
* Initializes the backend adapter in the SharedWorker.
|
|
25
|
+
* @param {StorageRequest & { type: 'init' }} config - The init config
|
|
26
|
+
* @return {Promise<void>}
|
|
27
|
+
*/
|
|
28
|
+
init(config: StorageRequest & {
|
|
29
|
+
type: 'init';
|
|
30
|
+
}): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Lists files in a collection matching the given extensions.
|
|
33
|
+
* @param {string} collection - The collection name
|
|
34
|
+
* @param {string[]} extensions - File extensions to include (e.g. ['.md', '.mdx'])
|
|
35
|
+
* @return {Promise<FileEntry[]>} Array of file entries
|
|
36
|
+
*/
|
|
37
|
+
listFiles(collection: string, extensions: string[]): Promise<FileEntry[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Reads a single file's content.
|
|
40
|
+
* @param {string} collection - The collection name
|
|
41
|
+
* @param {string} filename - The filename
|
|
42
|
+
* @return {Promise<string>} The file content
|
|
43
|
+
*/
|
|
44
|
+
readFile(collection: string, filename: string): Promise<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Writes a single file.
|
|
47
|
+
* @param {string} collection - The collection name
|
|
48
|
+
* @param {string} filename - The filename
|
|
49
|
+
* @param {string} content - The content to write
|
|
50
|
+
* @return {Promise<void>}
|
|
51
|
+
*/
|
|
52
|
+
writeFile(collection: string, filename: string, content: string): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Writes multiple files atomically.
|
|
55
|
+
* @param {FileWrite[]} files - Array of files to write
|
|
56
|
+
* @return {Promise<void>}
|
|
57
|
+
*/
|
|
58
|
+
writeFiles(files: FileWrite[]): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Deletes a file from a collection. Used during file type conversion to remove the old file after the new one is written.
|
|
61
|
+
* @param {string} collection - The collection name
|
|
62
|
+
* @param {string} filename - The filename to delete
|
|
63
|
+
* @return {Promise<void>}
|
|
64
|
+
*/
|
|
65
|
+
deleteFile(collection: string, filename: string): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Tears down the active backend adapter.
|
|
68
|
+
* @return {Promise<void>}
|
|
69
|
+
*/
|
|
70
|
+
teardown(): Promise<void>;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/client/js/storage/client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,cAAc,EAEd,SAAS,EACT,SAAS,EACV,MAAM,WAAW,CAAC;AAEnB,qBAAa,aAAa;IACxB,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,OAAO,CAGX;IACJ,OAAO,CAAC,SAAS,CAAK;IAEtB;;;OAGG;gBACS,IAAI,EAAE,WAAW;IAQ7B;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAYtB;;;;OAIG;IACH,OAAO,CAAC,IAAI;IAQZ;;;;OAIG;IACG,IAAI,CAAC,MAAM,EAAE,cAAc,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpE;;;;;OAKG;IACG,SAAS,CACb,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAAE,GACnB,OAAO,CAAC,SAAS,EAAE,CAAC;IAWvB;;;;;OAKG;IACG,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAWrE;;;;;;OAMG;IACG,SAAS,CACb,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;OAIG;IACG,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD;;;;;OAKG;IACG,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrE;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Typed client for communicating with the storage SharedWorker over a MessagePort.
|
|
3
|
+
* Wraps postMessage/onmessage into async request/response calls.
|
|
4
|
+
*/
|
|
5
|
+
export class StorageClient {
|
|
6
|
+
port;
|
|
7
|
+
pending = new Map();
|
|
8
|
+
idCounter = 0;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a client wrapping the given port.
|
|
11
|
+
* @param {MessagePort} port - The port connected to the storage SharedWorker
|
|
12
|
+
*/
|
|
13
|
+
constructor(port) {
|
|
14
|
+
this.port = port;
|
|
15
|
+
this.port.addEventListener('message', (event) => {
|
|
16
|
+
this.handleResponse(event.data);
|
|
17
|
+
});
|
|
18
|
+
this.port.start();
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Routes responses to their pending promises. Responses without an _id are broadcast (like port-connected) and are ignored here.
|
|
22
|
+
* @param {StorageResponse & { _id?: string }} data - The response data
|
|
23
|
+
* @return {void}
|
|
24
|
+
*/
|
|
25
|
+
handleResponse(data) {
|
|
26
|
+
if (!data._id)
|
|
27
|
+
return;
|
|
28
|
+
const entry = this.pending.get(data._id);
|
|
29
|
+
if (!entry)
|
|
30
|
+
return;
|
|
31
|
+
this.pending.delete(data._id);
|
|
32
|
+
if ('ok' in data && data.ok === false && 'error' in data) {
|
|
33
|
+
entry.reject(new Error(data.error));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
entry.resolve(data);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Sends a request and waits for the matching response.
|
|
41
|
+
* @param {StorageRequest} msg - The request to send
|
|
42
|
+
* @return {Promise<StorageResponse>} The matched response
|
|
43
|
+
*/
|
|
44
|
+
send(msg) {
|
|
45
|
+
const _id = String(++this.idCounter);
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
this.pending.set(_id, { resolve, reject });
|
|
48
|
+
this.port.postMessage({ ...msg, _id });
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Initializes the backend adapter in the SharedWorker.
|
|
53
|
+
* @param {StorageRequest & { type: 'init' }} config - The init config
|
|
54
|
+
* @return {Promise<void>}
|
|
55
|
+
*/
|
|
56
|
+
async init(config) {
|
|
57
|
+
await this.send(config);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Lists files in a collection matching the given extensions.
|
|
61
|
+
* @param {string} collection - The collection name
|
|
62
|
+
* @param {string[]} extensions - File extensions to include (e.g. ['.md', '.mdx'])
|
|
63
|
+
* @return {Promise<FileEntry[]>} Array of file entries
|
|
64
|
+
*/
|
|
65
|
+
async listFiles(collection, extensions) {
|
|
66
|
+
const res = await this.send({
|
|
67
|
+
type: 'listFiles',
|
|
68
|
+
collection,
|
|
69
|
+
extensions,
|
|
70
|
+
});
|
|
71
|
+
return res.files;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Reads a single file's content.
|
|
75
|
+
* @param {string} collection - The collection name
|
|
76
|
+
* @param {string} filename - The filename
|
|
77
|
+
* @return {Promise<string>} The file content
|
|
78
|
+
*/
|
|
79
|
+
async readFile(collection, filename) {
|
|
80
|
+
const res = await this.send({
|
|
81
|
+
type: 'readFile',
|
|
82
|
+
collection,
|
|
83
|
+
filename,
|
|
84
|
+
});
|
|
85
|
+
return res.content;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Writes a single file.
|
|
89
|
+
* @param {string} collection - The collection name
|
|
90
|
+
* @param {string} filename - The filename
|
|
91
|
+
* @param {string} content - The content to write
|
|
92
|
+
* @return {Promise<void>}
|
|
93
|
+
*/
|
|
94
|
+
async writeFile(collection, filename, content) {
|
|
95
|
+
await this.send({ type: 'writeFile', collection, filename, content });
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Writes multiple files atomically.
|
|
99
|
+
* @param {FileWrite[]} files - Array of files to write
|
|
100
|
+
* @return {Promise<void>}
|
|
101
|
+
*/
|
|
102
|
+
async writeFiles(files) {
|
|
103
|
+
await this.send({ type: 'writeFiles', files });
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Deletes a file from a collection. Used during file type conversion to remove the old file after the new one is written.
|
|
107
|
+
* @param {string} collection - The collection name
|
|
108
|
+
* @param {string} filename - The filename to delete
|
|
109
|
+
* @return {Promise<void>}
|
|
110
|
+
*/
|
|
111
|
+
async deleteFile(collection, filename) {
|
|
112
|
+
await this.send({ type: 'deleteFile', collection, filename });
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Tears down the active backend adapter.
|
|
116
|
+
* @return {Promise<void>}
|
|
117
|
+
*/
|
|
118
|
+
async teardown() {
|
|
119
|
+
await this.send({ type: 'teardown' });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opens (or returns the cached) shared IndexedDB database, creating or upgrading stores as needed.
|
|
3
|
+
* The connection is opened once and reused, avoiding a new indexedDB.open() round-trip per call.
|
|
4
|
+
* Version 1: handles store only. Version 2: adds drafts store.
|
|
5
|
+
* @return {Promise<IDBDatabase>} Promise resolving to the database instance
|
|
6
|
+
*/
|
|
7
|
+
export declare function openDB(): Promise<IDBDatabase>;
|
|
8
|
+
//# sourceMappingURL=db.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../../../src/client/js/storage/db.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,wBAAgB,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC,CAqB7C"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Database name for admin CMS persistence
|
|
2
|
+
const DB_NAME = 'cms-admin';
|
|
3
|
+
// Current database version — bumped from 1 to add the drafts store
|
|
4
|
+
const DB_VERSION = 2;
|
|
5
|
+
// Cached database promise — opened once, reused by all callers
|
|
6
|
+
let dbPromise = null;
|
|
7
|
+
/**
|
|
8
|
+
* Opens (or returns the cached) shared IndexedDB database, creating or upgrading stores as needed.
|
|
9
|
+
* The connection is opened once and reused, avoiding a new indexedDB.open() round-trip per call.
|
|
10
|
+
* Version 1: handles store only. Version 2: adds drafts store.
|
|
11
|
+
* @return {Promise<IDBDatabase>} Promise resolving to the database instance
|
|
12
|
+
*/
|
|
13
|
+
export function openDB() {
|
|
14
|
+
if (dbPromise)
|
|
15
|
+
return dbPromise;
|
|
16
|
+
dbPromise = new Promise((resolve, reject) => {
|
|
17
|
+
const request = indexedDB.open(DB_NAME, DB_VERSION);
|
|
18
|
+
request.onupgradeneeded = () => {
|
|
19
|
+
const db = request.result;
|
|
20
|
+
if (!db.objectStoreNames.contains('handles')) {
|
|
21
|
+
db.createObjectStore('handles');
|
|
22
|
+
}
|
|
23
|
+
if (!db.objectStoreNames.contains('drafts')) {
|
|
24
|
+
db.createObjectStore('drafts', { keyPath: 'id' });
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
request.onsuccess = () => resolve(request.result);
|
|
28
|
+
request.onerror = () => {
|
|
29
|
+
// Reset cache so the next caller retries instead of getting a stale rejection
|
|
30
|
+
dbPromise = null;
|
|
31
|
+
reject(request.error);
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
return dbPromise;
|
|
35
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { StorageAdapter, FileEntry, FileWrite } from './adapter';
|
|
2
|
+
export declare class FsaAdapter implements StorageAdapter {
|
|
3
|
+
private root;
|
|
4
|
+
/**
|
|
5
|
+
* Creates an FSA adapter rooted at the given directory handle.
|
|
6
|
+
* @param {FileSystemDirectoryHandle} root - The project root directory handle
|
|
7
|
+
*/
|
|
8
|
+
constructor(root: FileSystemDirectoryHandle);
|
|
9
|
+
/**
|
|
10
|
+
* Traverses root → src → content → {collection}.
|
|
11
|
+
* @param {string} collection - The collection name
|
|
12
|
+
* @return {Promise<FileSystemDirectoryHandle>} The collection directory handle
|
|
13
|
+
*/
|
|
14
|
+
private getCollectionDir;
|
|
15
|
+
/**
|
|
16
|
+
* Lists files in the collection matching the given extensions, with their content.
|
|
17
|
+
* @param {string} collection - The collection name
|
|
18
|
+
* @param {string[]} extensions - File extensions to include (e.g. ['.md', '.mdx'])
|
|
19
|
+
* @return {Promise<FileEntry[]>} Array of filename + content pairs
|
|
20
|
+
*/
|
|
21
|
+
listFiles(collection: string, extensions: string[]): Promise<FileEntry[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Deletes a file from the collection directory.
|
|
24
|
+
* @param {string} collection - The collection name
|
|
25
|
+
* @param {string} filename - The filename to delete
|
|
26
|
+
* @return {Promise<void>}
|
|
27
|
+
*/
|
|
28
|
+
deleteFile(collection: string, filename: string): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Reads a single file's content from the collection.
|
|
31
|
+
* @param {string} collection - The collection name
|
|
32
|
+
* @param {string} filename - The filename
|
|
33
|
+
* @return {Promise<string>} The file content
|
|
34
|
+
*/
|
|
35
|
+
readFile(collection: string, filename: string): Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Writes content to a file, creating it if necessary.
|
|
38
|
+
* @param {string} collection - The collection name
|
|
39
|
+
* @param {string} filename - The filename
|
|
40
|
+
* @param {string} content - The content to write
|
|
41
|
+
* @return {Promise<void>}
|
|
42
|
+
*/
|
|
43
|
+
writeFile(collection: string, filename: string, content: string): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Writes multiple files sequentially (FSA has no atomic multi-file write).
|
|
46
|
+
* @param {FileWrite[]} files - Array of files to write
|
|
47
|
+
* @return {Promise<void>}
|
|
48
|
+
*/
|
|
49
|
+
writeFiles(files: FileWrite[]): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=fsa.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fsa.d.ts","sourceRoot":"","sources":["../../../../src/client/js/storage/fsa.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtE,qBAAa,UAAW,YAAW,cAAc;IAKnC,OAAO,CAAC,IAAI;IAJxB;;;OAGG;gBACiB,IAAI,EAAE,yBAAyB;IAEnD;;;;OAIG;YACW,gBAAgB;IAQ9B;;;;;OAKG;IACG,SAAS,CACb,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAAE,GACnB,OAAO,CAAC,SAAS,EAAE,CAAC;IAmBvB;;;;;OAKG;IACG,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKrE;;;;;OAKG;IACG,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOrE;;;;;;OAMG;IACG,SAAS,CACb,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC;IAQhB;;;;OAIG;IACG,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAKpD"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Storage adapter backed by the File System Access API.
|
|
3
|
+
* Traverses from a project root handle through src/content/{collection}/ for all operations.
|
|
4
|
+
*/
|
|
5
|
+
// FSA adapter implementation
|
|
6
|
+
export class FsaAdapter {
|
|
7
|
+
root;
|
|
8
|
+
/**
|
|
9
|
+
* Creates an FSA adapter rooted at the given directory handle.
|
|
10
|
+
* @param {FileSystemDirectoryHandle} root - The project root directory handle
|
|
11
|
+
*/
|
|
12
|
+
constructor(root) {
|
|
13
|
+
this.root = root;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Traverses root → src → content → {collection}.
|
|
17
|
+
* @param {string} collection - The collection name
|
|
18
|
+
* @return {Promise<FileSystemDirectoryHandle>} The collection directory handle
|
|
19
|
+
*/
|
|
20
|
+
async getCollectionDir(collection) {
|
|
21
|
+
const src = await this.root.getDirectoryHandle('src');
|
|
22
|
+
const content = await src.getDirectoryHandle('content');
|
|
23
|
+
return content.getDirectoryHandle(collection);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Lists files in the collection matching the given extensions, with their content.
|
|
27
|
+
* @param {string} collection - The collection name
|
|
28
|
+
* @param {string[]} extensions - File extensions to include (e.g. ['.md', '.mdx'])
|
|
29
|
+
* @return {Promise<FileEntry[]>} Array of filename + content pairs
|
|
30
|
+
*/
|
|
31
|
+
async listFiles(collection, extensions) {
|
|
32
|
+
const dir = await this.getCollectionDir(collection);
|
|
33
|
+
const entries = [];
|
|
34
|
+
for await (const [name, entry] of dir.entries()) {
|
|
35
|
+
if (entry.kind !== 'file' ||
|
|
36
|
+
!extensions.some((ext) => name.endsWith(ext))) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const file = await entry.getFile();
|
|
40
|
+
const content = await file.text();
|
|
41
|
+
entries.push({ filename: name, content });
|
|
42
|
+
}
|
|
43
|
+
return entries;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Deletes a file from the collection directory.
|
|
47
|
+
* @param {string} collection - The collection name
|
|
48
|
+
* @param {string} filename - The filename to delete
|
|
49
|
+
* @return {Promise<void>}
|
|
50
|
+
*/
|
|
51
|
+
async deleteFile(collection, filename) {
|
|
52
|
+
const dir = await this.getCollectionDir(collection);
|
|
53
|
+
await dir.removeEntry(filename);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Reads a single file's content from the collection.
|
|
57
|
+
* @param {string} collection - The collection name
|
|
58
|
+
* @param {string} filename - The filename
|
|
59
|
+
* @return {Promise<string>} The file content
|
|
60
|
+
*/
|
|
61
|
+
async readFile(collection, filename) {
|
|
62
|
+
const dir = await this.getCollectionDir(collection);
|
|
63
|
+
const fileHandle = await dir.getFileHandle(filename);
|
|
64
|
+
const file = await fileHandle.getFile();
|
|
65
|
+
return file.text();
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Writes content to a file, creating it if necessary.
|
|
69
|
+
* @param {string} collection - The collection name
|
|
70
|
+
* @param {string} filename - The filename
|
|
71
|
+
* @param {string} content - The content to write
|
|
72
|
+
* @return {Promise<void>}
|
|
73
|
+
*/
|
|
74
|
+
async writeFile(collection, filename, content) {
|
|
75
|
+
const dir = await this.getCollectionDir(collection);
|
|
76
|
+
const fileHandle = await dir.getFileHandle(filename, { create: true });
|
|
77
|
+
const writable = await fileHandle.createWritable();
|
|
78
|
+
await writable.write(content);
|
|
79
|
+
await writable.close();
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Writes multiple files sequentially (FSA has no atomic multi-file write).
|
|
83
|
+
* @param {FileWrite[]} files - Array of files to write
|
|
84
|
+
* @return {Promise<void>}
|
|
85
|
+
*/
|
|
86
|
+
async writeFiles(files) {
|
|
87
|
+
for (const f of files) {
|
|
88
|
+
await this.writeFile(f.collection, f.filename, f.content);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { StorageAdapter, FileEntry, FileWrite } from './adapter';
|
|
2
|
+
export declare class GitHubAdapter implements StorageAdapter {
|
|
3
|
+
private token;
|
|
4
|
+
private owner;
|
|
5
|
+
private repo;
|
|
6
|
+
private defaultBranch;
|
|
7
|
+
/**
|
|
8
|
+
* @param {string} token - GitHub Personal Access Token
|
|
9
|
+
* @param {string} repoSlug - Repository in "owner/repo" format
|
|
10
|
+
*/
|
|
11
|
+
constructor(token: string, repoSlug: string);
|
|
12
|
+
/**
|
|
13
|
+
* Validates credentials by fetching repo metadata and caches the default branch.
|
|
14
|
+
* @return {Promise<void>}
|
|
15
|
+
*/
|
|
16
|
+
validate(): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Lists files in a collection matching the given extensions, with their raw content.
|
|
19
|
+
* @param {string} collection - The collection name
|
|
20
|
+
* @param {string[]} extensions - File extensions to include (e.g. ['.md', '.mdx'])
|
|
21
|
+
* @return {Promise<FileEntry[]>} Array of filename + content pairs
|
|
22
|
+
*/
|
|
23
|
+
listFiles(collection: string, extensions: string[]): Promise<FileEntry[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Deletes a file from the repository via the Contents API.
|
|
26
|
+
* @param {string} collection - The collection name
|
|
27
|
+
* @param {string} filename - The filename to delete
|
|
28
|
+
* @return {Promise<void>}
|
|
29
|
+
*/
|
|
30
|
+
deleteFile(collection: string, filename: string): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Reads a single file's raw content via the raw+json Accept header.
|
|
33
|
+
* @param {string} collection - The collection name
|
|
34
|
+
* @param {string} filename - The filename
|
|
35
|
+
* @return {Promise<string>} The file content
|
|
36
|
+
*/
|
|
37
|
+
readFile(collection: string, filename: string): Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Writes a single file via the Contents API. Fetches the current SHA for updates.
|
|
40
|
+
* @param {string} collection - The collection name
|
|
41
|
+
* @param {string} filename - The filename
|
|
42
|
+
* @param {string} content - The content to write
|
|
43
|
+
* @return {Promise<void>}
|
|
44
|
+
*/
|
|
45
|
+
writeFile(collection: string, filename: string, content: string): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Writes multiple files in a single atomic commit using the Git Trees + Commits API.
|
|
48
|
+
* @param {FileWrite[]} files - Array of files to write
|
|
49
|
+
* @return {Promise<void>}
|
|
50
|
+
*/
|
|
51
|
+
writeFiles(files: FileWrite[]): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Makes an authenticated request to the GitHub API.
|
|
54
|
+
* @param {string} method - HTTP method
|
|
55
|
+
* @param {string} path - API path (appended to https://api.github.com)
|
|
56
|
+
* @param {Record<string, string>} [extraHeaders] - Additional headers to merge
|
|
57
|
+
* @param {unknown} [body] - JSON body to send
|
|
58
|
+
* @return {Promise<Response>} The fetch response
|
|
59
|
+
*/
|
|
60
|
+
private request;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=github.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../../src/client/js/storage/github.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAatE,qBAAa,aAAc,YAAW,cAAc;IAClD,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,IAAI,CAAS;IAErB,OAAO,CAAC,aAAa,CAAkB;IAEvC;;;OAGG;gBACS,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAO3C;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAc/B;;;;;OAKG;IACG,SAAS,CACb,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAAE,GACnB,OAAO,CAAC,SAAS,EAAE,CAAC;IA2BvB;;;;;OAKG;IACG,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBrE;;;;;OAKG;IACG,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAarE;;;;;;OAMG;IACG,SAAS,CACb,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC;IAgChB;;;;OAIG;IACG,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA4EnD;;;;;;;OAOG;YACW,OAAO;CAyBtB"}
|