@kardalum/plugin-sdk 0.16.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +105 -0
- package/README.md +4 -3
- package/dist/admin-section-registry.d.ts +14 -5
- package/dist/admin-section-registry.js +14 -4
- package/dist/assets/asset-picker.d.ts +11 -0
- package/dist/assets/asset-picker.js +109 -0
- package/dist/assets/asset-tree.d.ts +30 -0
- package/dist/assets/asset-tree.js +150 -0
- package/dist/built-in-editor-ids.d.ts +1 -0
- package/dist/built-in-editor-ids.js +20 -0
- package/dist/built-in-settings-schemas.d.ts +2 -0
- package/dist/built-in-settings-schemas.js +27 -0
- package/dist/built-in-value-schemas.js +3 -0
- package/dist/built-ins.js +10 -1
- package/dist/capabilities.js +5 -3
- package/dist/datatype-validation.js +18 -4
- package/dist/datatypes-entry.d.ts +1 -0
- package/dist/datatypes-entry.js +1 -0
- package/dist/entitlement-entry.d.ts +3 -2
- package/dist/entitlement-entry.js +13 -1
- package/dist/entitlement-gate.d.ts +18 -0
- package/dist/entitlement-gate.js +95 -21
- package/dist/entitlement-plan.d.ts +21 -0
- package/dist/entitlement-plan.js +26 -0
- package/dist/entitlement-types.d.ts +21 -4
- package/dist/entitlement.d.ts +29 -1
- package/dist/entitlement.js +39 -0
- package/dist/grid-arrow-step.d.ts +7 -0
- package/dist/grid-arrow-step.js +20 -0
- package/dist/host-entry.d.ts +1 -1
- package/dist/host-entry.js +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.js +13 -18
- package/dist/license-verdict-keys.d.ts +4 -3
- package/dist/license-verdict-keys.js +4 -7
- package/dist/manifest-entry.d.ts +6 -2
- package/dist/manifest-entry.js +5 -1
- package/dist/manifest-schema.d.ts +56 -63
- package/dist/manifest-schema.js +103 -249
- package/dist/manifest.d.ts +61 -73
- package/dist/manifest.js +13 -36
- package/dist/media/media-picker.js +32 -32
- package/dist/notify.d.ts +17 -0
- package/dist/notify.js +17 -0
- package/dist/plugin-screen-context.d.ts +11 -1
- package/dist/richtext/block-panel.js +19 -20
- package/dist/richtext/extensions.js +10 -1
- package/dist/richtext/insert-menu.js +1 -1
- package/dist/richtext/kardalum-block.js +17 -17
- package/dist/richtext/style-listbox.js +4 -4
- package/dist/richtext-html-entry.d.ts +35 -0
- package/dist/richtext-html-entry.js +73 -0
- package/dist/structured-storage-types.d.ts +11 -0
- package/dist/tailwind.js +10 -3
- package/dist/tokens/tailwind-theme.css +176 -0
- package/dist/tokens/tokens.css +2 -0
- package/dist/tokens/tokens.json +4 -2
- package/dist/type-equality.d.ts +2 -0
- package/dist/type-equality.js +1 -0
- package/dist/vendor-check.d.ts +39 -0
- package/dist/vendor-check.js +79 -0
- package/dist/vendor-entry.d.ts +3 -0
- package/dist/vendor-entry.js +9 -0
- package/dist/vendor-service.d.ts +20 -0
- package/dist/vendor-service.js +20 -0
- package/dist/views/asset-view.d.ts +6 -0
- package/dist/views/asset-view.js +55 -0
- package/dist/views/content-list-settings-view.js +1 -1
- package/dist/views/content-list-view.js +1 -1
- package/dist/views/html-code-editor.js +0 -1
- package/dist/views/html-view.js +1 -1
- package/dist/views/image-view.js +1 -1
- package/dist/views/rich-text-view.js +30 -30
- package/node_modules/@kardalum/api-schemas/README.md +1 -1
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +90 -0
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +43 -10
- package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.d.ts +21 -0
- package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.js +42 -0
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +23 -1
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +60 -18
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +204 -0
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +134 -0
- package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.d.ts +36 -0
- package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.js +46 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +22 -6
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +2 -2
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +2 -1
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +52 -10
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +33 -14
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +50 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +25 -5
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.js +28 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +42 -2
- package/node_modules/@kardalum/api-schemas/dist/home.schema.d.ts +130 -0
- package/node_modules/@kardalum/api-schemas/dist/home.schema.js +87 -0
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +73 -31
- package/node_modules/@kardalum/api-schemas/dist/index.js +47 -17
- package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/issue-list.d.ts +6 -0
- package/node_modules/@kardalum/api-schemas/dist/issue-list.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +216 -63
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +117 -5
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +17 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +16 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-use.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-use.js +4 -4
- package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +93 -0
- package/node_modules/@kardalum/api-schemas/dist/news.schema.js +86 -0
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +410 -0
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +193 -0
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +86 -0
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +92 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +6 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +8 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +8 -18
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +3 -19
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +13 -15
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +17 -7
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +18 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +97 -85
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +35 -68
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +60 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +116 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +9 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +22 -7
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +240 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +164 -32
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +4 -3
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +14 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +37 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.d.ts +64 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.js +134 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +19 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +33 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.d.ts +83 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +152 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.js +15 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +35 -23
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.d.ts +83 -0
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +73 -0
- package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/role.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +11 -2
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +21 -3
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +126 -0
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.js +70 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +6 -6
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +58 -25
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +194 -48
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +18 -6
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +2 -2
- package/node_modules/@kardalum/api-schemas/dist/strict-url.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/strict-url.js +31 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +115 -1
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +65 -10
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +37 -2
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +34 -8
- package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.js +29 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +16 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/uuid.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/uuid.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +88 -0
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +100 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.d.ts +32 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +27 -0
- package/node_modules/@kardalum/api-schemas/package.json +2 -2
- package/node_modules/@kardalum/design-tokens/README.md +1 -1
- package/node_modules/@kardalum/design-tokens/dist/build-theme-css.d.ts +16 -0
- package/node_modules/@kardalum/design-tokens/dist/build-theme-css.js +76 -0
- package/node_modules/@kardalum/design-tokens/dist/generate.js +4 -1
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +176 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +2 -1
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +4 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +4 -2
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +2 -0
- package/node_modules/@kardalum/design-tokens/package.json +6 -3
- package/node_modules/@kardalum/plugin-package/README.md +5 -2
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +6 -21
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +13 -8
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +4 -4
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +59 -16
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +4 -0
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +25 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +25 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +203 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +73 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.d.ts +8 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +77 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.js +2052 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icons.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icons.js +51 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +8 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +7 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +119 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +14 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +21 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/locales.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +148 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.js +76 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.d.ts +22 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +137 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +90 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/support.d.ts +24 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/support.js +55 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +7 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +215 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +53 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.js +1 -0
- package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +3 -2
- package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +4 -2
- package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +92 -3
- package/node_modules/@kardalum/plugin-package/dist/extract.js +251 -41
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +13 -4
- package/node_modules/@kardalum/plugin-package/dist/index.js +10 -3
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +56 -19
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +119 -25
- package/node_modules/@kardalum/plugin-package/dist/manifest-entry.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/manifest-entry.js +20 -0
- package/node_modules/@kardalum/plugin-package/dist/reference-entry.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/reference-entry.js +1 -0
- package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +21 -3
- package/node_modules/@kardalum/plugin-package/dist/sample-content.js +37 -9
- package/node_modules/@kardalum/plugin-package/dist/shipped-files.d.ts +39 -0
- package/node_modules/@kardalum/plugin-package/dist/shipped-files.js +133 -0
- package/node_modules/@kardalum/plugin-package/dist/shipped-locales.d.ts +7 -0
- package/node_modules/@kardalum/plugin-package/dist/shipped-locales.js +27 -0
- package/node_modules/@kardalum/plugin-package/dist/vendor-token.d.ts +24 -0
- package/node_modules/@kardalum/plugin-package/dist/vendor-token.js +118 -0
- package/node_modules/@kardalum/plugin-package/package.json +4 -2
- package/node_modules/@kardalum/ui/README.md +1 -1
- package/node_modules/@kardalum/ui/dist/components/button.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/checkbox.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.js +5 -2
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +3 -3
- package/node_modules/@kardalum/ui/dist/components/input.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/popover-panel.d.ts +4 -0
- package/node_modules/@kardalum/ui/dist/components/popover-panel.js +13 -0
- package/node_modules/@kardalum/ui/dist/components/sheet.js +5 -4
- package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/tab-strip.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/toast.js +1 -1
- package/node_modules/@kardalum/ui/dist/index.d.ts +1 -0
- package/node_modules/@kardalum/ui/dist/index.js +1 -0
- package/node_modules/@kardalum/ui/package.json +1 -1
- package/package.json +19 -6
|
@@ -12,7 +12,7 @@ import { BlockPanel, BlockPreviewPopover } from "../richtext/block-panel.js";
|
|
|
12
12
|
import { StyleListbox } from "../richtext/style-listbox.js";
|
|
13
13
|
// The rich content editor (S197 spec §3): one TipTap editor definition
|
|
14
14
|
// (buildRichtextExtensions), mounted here with a fixed compact toolbar per
|
|
15
|
-
// the mockup's screen 3
|
|
15
|
+
// the mockup's screen 3: the same commands the on-page bubble toolbar
|
|
16
16
|
// offers, plus "Edit on page" (a later task wires the navigation; this
|
|
17
17
|
// task ships it as a disabled placeholder, spec-listed toolbar chrome).
|
|
18
18
|
//
|
|
@@ -25,7 +25,7 @@ const CONTENT_CLASSES = "text-sm text-text-primary [&_h1]:text-xl [&_h1]:font-bo
|
|
|
25
25
|
"[&_a]:text-primary-700 [&_a]:underline " +
|
|
26
26
|
"[&_blockquote]:border-s-2 [&_blockquote]:border-border-default [&_blockquote]:ps-3 [&_blockquote]:italic [&_blockquote]:text-text-secondary";
|
|
27
27
|
// Source view (Item 3, S197 QA-wave B): a light prettification, not a real
|
|
28
|
-
// formatter
|
|
28
|
+
// formatter: no dependency is worth pulling in just to indent nested
|
|
29
29
|
// markup. TipTap's own getHTML() emits one unbroken string with no
|
|
30
30
|
// whitespace between block elements at all (`<p>a</p><p>b</p>`); parsing it
|
|
31
31
|
// back and re-joining each TOP-LEVEL node's own outerHTML with a newline is
|
|
@@ -50,7 +50,7 @@ function useTextStyles() {
|
|
|
50
50
|
setLoading(true);
|
|
51
51
|
fetchApi(`${MANAGE_API}/render/text-styles`)
|
|
52
52
|
.then(async (response) => {
|
|
53
|
-
// The endpoint doesn't exist yet (a later task ships it)
|
|
53
|
+
// The endpoint doesn't exist yet (a later task ships it), so a 404,
|
|
54
54
|
// any other error status, and a genuinely empty declared list all
|
|
55
55
|
// render the same "no styles" state, so treat them identically.
|
|
56
56
|
if (!response.ok)
|
|
@@ -76,8 +76,8 @@ function useTextStyles() {
|
|
|
76
76
|
// Roving tabindex over the toolbar's top-level buttons (WAI-ARIA toolbar
|
|
77
77
|
// pattern): one stop in the page Tab order, arrow keys move focus among
|
|
78
78
|
// buttons, Home/End jump to the ends. Disabled buttons (Block, Edit on
|
|
79
|
-
// page
|
|
80
|
-
// native disabled-control behavior
|
|
79
|
+
// page, both placeholders this task) are skipped entirely, matching
|
|
80
|
+
// native disabled-control behavior, so they can never hold focus.
|
|
81
81
|
function useToolbarRovingTabIndex(focusableKeys) {
|
|
82
82
|
const [activeKey, setActiveKey] = useState(focusableKeys[0] ?? null);
|
|
83
83
|
const refs = useRef(new Map());
|
|
@@ -128,7 +128,7 @@ function useToolbarRovingTabIndex(focusableKeys) {
|
|
|
128
128
|
return { activeKey, setActiveKey, registerRef, handleKeyDown };
|
|
129
129
|
}
|
|
130
130
|
function ToolbarButton({ itemKey, label, ariaLabel, title, active, disabled, expanded, hasPopup, isRovingActive, registerRef, onFocus, onClick, }) {
|
|
131
|
-
return (_jsx("button", { ref: registerRef, type: "button", "data-testid": `rt-toolbar-${itemKey}`, "aria-label": ariaLabel, "aria-pressed": active, "aria-haspopup": hasPopup, "aria-expanded": hasPopup ? expanded : undefined, title: title, disabled: disabled, tabIndex: disabled ? -1 : isRovingActive ? 0 : -1, onFocus: onFocus, onClick: onClick, className: cn("inline-flex h-8 items-center gap-1 rounded-md px-2 text-xs font-medium text-text-secondary hover:bg-background-hover disabled:pointer-events-none disabled:opacity-50", "focus-visible:outline-
|
|
131
|
+
return (_jsx("button", { ref: registerRef, type: "button", "data-testid": `rt-toolbar-${itemKey}`, "aria-label": ariaLabel, "aria-pressed": active, "aria-haspopup": hasPopup, "aria-expanded": hasPopup ? expanded : undefined, title: title, disabled: disabled, tabIndex: disabled ? -1 : isRovingActive ? 0 : -1, onFocus: onFocus, onClick: onClick, className: cn("inline-flex h-8 items-center gap-1 rounded-md px-2 text-xs font-medium text-text-secondary hover:bg-background-hover disabled:pointer-events-none disabled:opacity-50", "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600", active && "bg-primary-100 text-primary-800"), children: label }));
|
|
132
132
|
}
|
|
133
133
|
function ToolbarSeparator() {
|
|
134
134
|
return _jsx("span", { "aria-hidden": "true", className: "mx-1 inline-block h-4 w-px bg-border-default" });
|
|
@@ -154,10 +154,10 @@ function LinkPopover({ initialHref, hasLink, onApply, onRemove, onClose }) {
|
|
|
154
154
|
if (href.trim())
|
|
155
155
|
onApply(href.trim());
|
|
156
156
|
}
|
|
157
|
-
}, className: "mb-2 w-full rounded-md border border-border-default bg-background-elevated px-2 py-1 text-sm text-text-primary focus-visible:outline-
|
|
157
|
+
}, className: "mb-2 w-full rounded-md border border-border-default bg-background-elevated px-2 py-1 text-sm text-text-primary focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600" }), _jsxs("div", { className: "flex justify-end gap-2", children: [hasLink && (_jsx("button", { type: "button", onClick: onRemove, className: "rounded-md px-2 py-1 text-xs text-danger-600 hover:bg-background-hover", children: "Remove link" })), _jsx("button", { type: "button", disabled: !href.trim(), onClick: () => onApply(href.trim()), className: "rounded-md bg-primary-600 px-2 py-1 text-xs font-medium text-text-inverse hover:bg-primary-700 disabled:opacity-50", children: "Apply" })] })] }));
|
|
158
158
|
}
|
|
159
159
|
// S197 Task 12: bubbles up so a mount that HAS routing (content-editor.tsx,
|
|
160
|
-
// admin-ui) can navigate to /content/:id/edit-on-page
|
|
160
|
+
// admin-ui) can navigate to /content/:id/edit-on-page, the same "plain DOM
|
|
161
161
|
// CustomEvent, no framework-specific callback" idiom the block chip's own
|
|
162
162
|
// "preview" button already uses (kardalum-block.ts's own doc comment), for
|
|
163
163
|
// the identical reason: this package has no router of its own, and the
|
|
@@ -185,7 +185,7 @@ function RichTextToolbar({ editor, containerRef, sourceMode, onToggleSource }) {
|
|
|
185
185
|
"editOnPage",
|
|
186
186
|
];
|
|
187
187
|
// Every other command is disabled in source mode (editing raw HTML has no
|
|
188
|
-
// "toggle bold" equivalent)
|
|
188
|
+
// "toggle bold" equivalent); Source itself is the only tab stop then, so
|
|
189
189
|
// the roving tabindex's own focusable set shrinks to match, same as the
|
|
190
190
|
// doc comment above useToolbarRovingTabIndex describes for disabled items.
|
|
191
191
|
const focusableKeys = sourceMode ? ["source"] : allItemKeys;
|
|
@@ -202,7 +202,7 @@ function RichTextToolbar({ editor, containerRef, sourceMode, onToggleSource }) {
|
|
|
202
202
|
}
|
|
203
203
|
}, [sourceMode]);
|
|
204
204
|
// The picked/uploaded item (S197 Task 2 contract) becomes a mediaId-backed
|
|
205
|
-
// image node
|
|
205
|
+
// image node: src is the item's path-relative downloadUrl, alt starts
|
|
206
206
|
// empty (there is no filename to fall back to once MediaPicker reports
|
|
207
207
|
// only {id, downloadUrl, alt}).
|
|
208
208
|
function handleMediaPick(item) {
|
|
@@ -234,11 +234,11 @@ function RichTextToolbar({ editor, containerRef, sourceMode, onToggleSource }) {
|
|
|
234
234
|
function RichTextEditor({ editable }) {
|
|
235
235
|
const { value, onChange } = usePluginValue();
|
|
236
236
|
// Guards the sync effect below against reacting to the update it just
|
|
237
|
-
// caused itself
|
|
237
|
+
// caused itself. Without this, every keystroke would round-trip
|
|
238
238
|
// through setContent and reset the cursor.
|
|
239
239
|
const isInternalUpdate = useRef(false);
|
|
240
240
|
// The host renders this inside a PropertyField, but TipTap's editable
|
|
241
|
-
// surface is a contenteditable <div role="textbox"
|
|
241
|
+
// surface is a contenteditable <div role="textbox">, not a labelable
|
|
242
242
|
// element, so the field's <label for> can never name it. editorProps
|
|
243
243
|
// .attributes is the only way to get aria onto that exact node, so the
|
|
244
244
|
// field's identity is stamped there instead (WCAG 4.1.2; axe reports
|
|
@@ -249,14 +249,14 @@ function RichTextEditor({ editable }) {
|
|
|
249
249
|
content: value ?? "",
|
|
250
250
|
editable,
|
|
251
251
|
// @tiptap/react 3.31 no longer re-renders the owning component on every
|
|
252
|
-
// transaction by default
|
|
252
|
+
// transaction by default. Without this the toolbar's isActive()/
|
|
253
253
|
// getAttributes() reads (bold state, the active heading level, the
|
|
254
254
|
// current link href) would go stale the instant the selection moves.
|
|
255
255
|
shouldRerenderOnTransaction: true,
|
|
256
256
|
editorProps: {
|
|
257
257
|
attributes: {
|
|
258
258
|
// ProseMirror's editable surface is a plain contenteditable div
|
|
259
|
-
// with NO role of its own
|
|
259
|
+
// with NO role of its own, which makes it a `generic` element,
|
|
260
260
|
// and aria-labelledby is *prohibited* on generic (axe flags the
|
|
261
261
|
// field's own label as "needs review": aria-prohibited-attr). The
|
|
262
262
|
// element genuinely IS a multi-line text field, so declaring that
|
|
@@ -273,7 +273,7 @@ function RichTextEditor({ editable }) {
|
|
|
273
273
|
const json = updated.getJSON();
|
|
274
274
|
// Non-edit 'update' events must not arm the echo guard below (they
|
|
275
275
|
// would swallow the next genuine external value change). The one
|
|
276
|
-
// programmatic emitter here
|
|
276
|
+
// programmatic emitter here (setEditable) is silenced at the
|
|
277
277
|
// source (emitUpdate: false, see the effect below), so any doc that
|
|
278
278
|
// still equals the external value is TipTap's own construction-time
|
|
279
279
|
// normalization pass, not an edit.
|
|
@@ -284,7 +284,7 @@ function RichTextEditor({ editable }) {
|
|
|
284
284
|
},
|
|
285
285
|
});
|
|
286
286
|
// Item 3 (S197 QA-wave B): the HTML source view. `null` means "not in
|
|
287
|
-
// source mode"
|
|
287
|
+
// source mode"; the textarea's own in-progress edits live here, entirely
|
|
288
288
|
// separate from `value`/onChange, until the toggle-back below commits
|
|
289
289
|
// them. Typing in source deliberately does NOT flow through onChange (the
|
|
290
290
|
// spec's own choice of the two offered): a half-typed `<p` mid-edit is not
|
|
@@ -292,21 +292,21 @@ function RichTextEditor({ editable }) {
|
|
|
292
292
|
// there is no debounce that makes an in-progress HTML string safe to
|
|
293
293
|
// parse. Commit happens on toggling back to the rich view; blurring the
|
|
294
294
|
// textarea without toggling back does NOT commit (the other choice the
|
|
295
|
-
// spec allows)
|
|
295
|
+
// spec allows): staying in source mode until the user explicitly asks to
|
|
296
296
|
// leave it means a click elsewhere never silently discards or applies an
|
|
297
297
|
// edit the user hasn't finished. Declared before the value-sync effect
|
|
298
298
|
// below (not just before its own toggle handler) because that effect
|
|
299
299
|
// needs to read the refs declared here.
|
|
300
300
|
const [sourceHtml, setSourceHtml] = useState(null);
|
|
301
301
|
const sourceMode = sourceHtml !== null;
|
|
302
|
-
// The HTML sourceHtml was last (re-)seeded with
|
|
302
|
+
// The HTML sourceHtml was last (re-)seeded with; sourceHtml !== this
|
|
303
303
|
// means the user has typed something, i.e. the buffer is "dirty". Used
|
|
304
304
|
// only by the external value-sync effect below to decide whether an
|
|
305
305
|
// external change can safely replace the buffer or must leave it (and
|
|
306
306
|
// the user's in-progress edits) alone. A ref, not state: nothing here
|
|
307
307
|
// needs to re-render on its own.
|
|
308
308
|
const sourceSeedRef = useRef(null);
|
|
309
|
-
// Whether an external value change arrived while the buffer was dirty
|
|
309
|
+
// Whether an external value change arrived while the buffer was dirty,
|
|
310
310
|
// shown as a small notice; cleared on toggle-back (the buffer commits,
|
|
311
311
|
// resolving the conflict) or on a later external change against a
|
|
312
312
|
// by-then-pristine buffer (re-seeded silently instead).
|
|
@@ -329,11 +329,11 @@ function RichTextEditor({ editable }) {
|
|
|
329
329
|
return;
|
|
330
330
|
}
|
|
331
331
|
// setContent's default emitUpdate: true fires the same onUpdate path a
|
|
332
|
-
// live edit would (JSON.stringify guard included)
|
|
332
|
+
// live edit would (JSON.stringify guard included), so no separate commit
|
|
333
333
|
// plumbing needed, this is the exact mechanism the external value-sync
|
|
334
334
|
// effect below already relies on. If an external change arrived while
|
|
335
335
|
// this buffer was dirty (sourceStale), this is the "informed overwrite"
|
|
336
|
-
// the notice warned about
|
|
336
|
+
// the notice warned about: the user's buffer wins, same as any other
|
|
337
337
|
// edit made after seeing the notice.
|
|
338
338
|
editor.commands.setContent(sourceHtml);
|
|
339
339
|
sourceSeedRef.current = null;
|
|
@@ -357,18 +357,18 @@ function RichTextEditor({ editable }) {
|
|
|
357
357
|
// back would setContent() the STALE buffer over it, re-emitting the
|
|
358
358
|
// stale content as a fresh edit and clobbering the external change.
|
|
359
359
|
// Refs (not state) so this effect doesn't need sourceMode/sourceHtml
|
|
360
|
-
// in its deps
|
|
360
|
+
// in its deps; it only needs their CURRENT values when `value`
|
|
361
361
|
// actually changes.
|
|
362
362
|
if (sourceModeRef.current) {
|
|
363
363
|
const pristine = sourceHtmlRef.current === sourceSeedRef.current;
|
|
364
364
|
if (!pristine) {
|
|
365
|
-
// The user has unsaved edits in the buffer
|
|
365
|
+
// The user has unsaved edits in the buffer: keep them (their
|
|
366
366
|
// choice to make, not this effect's), just flag that leaving
|
|
367
367
|
// source view now will overwrite the external change.
|
|
368
368
|
setSourceStale(true);
|
|
369
369
|
return;
|
|
370
370
|
}
|
|
371
|
-
// No local edits yet
|
|
371
|
+
// No local edits yet: safe to re-seed from the fresh external doc,
|
|
372
372
|
// same as the non-source branch below but keeping the textarea's
|
|
373
373
|
// displayed HTML in sync too.
|
|
374
374
|
editor.commands.setContent(value ?? "");
|
|
@@ -381,18 +381,18 @@ function RichTextEditor({ editable }) {
|
|
|
381
381
|
editor.commands.setContent(value ?? "");
|
|
382
382
|
}, [value, editor]);
|
|
383
383
|
useEffect(() => {
|
|
384
|
-
// emitUpdate: false
|
|
384
|
+
// emitUpdate: false, since setEditable's unconditional 'update' event is
|
|
385
385
|
// not an edit; silencing it at the source keeps onUpdate's arming
|
|
386
386
|
// logic honest (review fix, Editor.ts:307-313 in @tiptap/core 3.31).
|
|
387
387
|
editor?.setEditable(editable, false);
|
|
388
388
|
}, [editable, editor]);
|
|
389
389
|
// The block chip's "preview ⤢" button (kardalum-block.ts) is plain DOM with
|
|
390
|
-
// no React tree of its own
|
|
390
|
+
// no React tree of its own: it dispatches a bubbling
|
|
391
391
|
// "kardalum:preview-block" CustomEvent instead of fetching directly, since
|
|
392
392
|
// only this mount has the authenticated fetchApi and somewhere to render
|
|
393
393
|
// a popover. Listening on the wrapper (rather than threading a callback
|
|
394
394
|
// through buildRichtextExtensions' options) keeps the extension mount-
|
|
395
|
-
// agnostic
|
|
395
|
+
// agnostic: a vanilla mount can dispatch/listen for the same event with
|
|
396
396
|
// no React involved either.
|
|
397
397
|
const wrapperRef = useRef(null);
|
|
398
398
|
const [previewRequest, setPreviewRequest] = useState(null);
|
|
@@ -413,13 +413,13 @@ function RichTextEditor({ editable }) {
|
|
|
413
413
|
// right signal rather than separate open/close state.
|
|
414
414
|
const selection = editor?.state.selection;
|
|
415
415
|
const blockSelection = editor && selection instanceof NodeSelection && selection.node.type.name === "kardalumBlock" ? selection : null;
|
|
416
|
-
return (_jsxs("div", { ref: wrapperRef, className: cn(editable && "overflow-hidden rounded-md border border-border-default bg-background-elevated"), children: [_jsxs("div", { inert: editable && Boolean(blockSelection) ? true : undefined, children: [editable && editor && (_jsx(RichTextToolbar, { editor: editor, containerRef: wrapperRef, sourceMode: sourceMode, onToggleSource: handleToggleSource })), sourceMode ? (_jsxs(_Fragment, { children: [sourceStale && (_jsx("div", { role: "alert", "data-testid": "rt-source-stale-notice", className: "border-b border-warning-100 bg-warning-100 px-5 py-2 text-xs text-warning-800", children: "Content changed elsewhere. Leaving source view will overwrite it." })), _jsx("textarea", { "data-testid": "rt-source-textarea", "aria-label": "HTML source", value: sourceHtml, onChange: (event) => setSourceHtml(event.target.value), spellCheck: false, className: "block min-h-72 w-full resize-y border-0 bg-background-elevated px-5 py-4 font-mono text-xs text-text-primary focus-visible:outline-
|
|
416
|
+
return (_jsxs("div", { ref: wrapperRef, className: cn(editable && "overflow-hidden rounded-md border border-border-default bg-background-elevated"), children: [_jsxs("div", { inert: editable && Boolean(blockSelection) ? true : undefined, children: [editable && editor && (_jsx(RichTextToolbar, { editor: editor, containerRef: wrapperRef, sourceMode: sourceMode, onToggleSource: handleToggleSource })), sourceMode ? (_jsxs(_Fragment, { children: [sourceStale && (_jsx("div", { role: "alert", "data-testid": "rt-source-stale-notice", className: "border-b border-warning-100 bg-warning-100 px-5 py-2 text-xs text-warning-800", children: "Content changed elsewhere. Leaving source view will overwrite it." })), _jsx("textarea", { "data-testid": "rt-source-textarea", "aria-label": "HTML source", value: sourceHtml, onChange: (event) => setSourceHtml(event.target.value), spellCheck: false, className: "block min-h-72 w-full resize-y border-0 bg-background-elevated px-5 py-4 font-mono text-xs text-text-primary focus-visible:outline-hidden" })] })) : (_jsx(EditorContent, { editor: editor, className: cn(CONTENT_CLASSES, editable &&
|
|
417
417
|
// min-h-72 (18rem) matches the mockup's .rtbody proportions (S197
|
|
418
|
-
// screen 3)
|
|
418
|
+
// screen 3): the editor grows with content past that floor, it
|
|
419
419
|
// never shrinks below a real working height. px-5/py-4 are the
|
|
420
420
|
// token scale's closest steps to the mockup's literal 1.3rem/
|
|
421
421
|
// 1.1rem .rtbody padding (design-tokens has no 1.1/1.3rem step).
|
|
422
|
-
"min-h-72 px-5 py-4 focus-within:outline-
|
|
422
|
+
"min-h-72 px-5 py-4 focus-within:outline-hidden focus-within:ring-2 focus-within:ring-primary-600 focus-within:ring-offset-2 focus-within:ring-offset-background-base") }))] }), editable && editor && blockSelection && (_jsx(BlockPanel, { editor: editor, pos: blockSelection.from, partial: blockSelection.node.attrs.partial, params: blockSelection.node.attrs.params ?? {} })), previewRequest && (_jsx(BlockPreviewPopover, { partial: previewRequest.partial, params: previewRequest.params, anchorRect: previewRequest.anchorRect, onClose: () => setPreviewRequest(null) }))] }));
|
|
423
423
|
}
|
|
424
424
|
export function RichTextInputView() {
|
|
425
425
|
return _jsx(RichTextEditor, { editable: true });
|
|
@@ -14,6 +14,11 @@ export declare const AssetTreeEntrySchema: z.ZodObject<{
|
|
|
14
14
|
pluginId: z.ZodNullable<z.ZodString>;
|
|
15
15
|
}, z.core.$strip>;
|
|
16
16
|
export type AssetTreeEntry = z.infer<typeof AssetTreeEntrySchema>;
|
|
17
|
+
export declare const AssetTreeSkipSchema: z.ZodObject<{
|
|
18
|
+
path: z.ZodString;
|
|
19
|
+
reason: z.ZodString;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export type AssetTreeSkip = z.infer<typeof AssetTreeSkipSchema>;
|
|
17
22
|
export declare const AssetTreeResponseSchema: z.ZodObject<{
|
|
18
23
|
entries: z.ZodArray<z.ZodObject<{
|
|
19
24
|
path: z.ZodString;
|
|
@@ -28,6 +33,10 @@ export declare const AssetTreeResponseSchema: z.ZodObject<{
|
|
|
28
33
|
pluginId: z.ZodNullable<z.ZodString>;
|
|
29
34
|
}, z.core.$strip>>;
|
|
30
35
|
truncated: z.ZodBoolean;
|
|
36
|
+
skipped: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
37
|
+
path: z.ZodString;
|
|
38
|
+
reason: z.ZodString;
|
|
39
|
+
}, z.core.$strip>>>;
|
|
31
40
|
}, z.core.$strip>;
|
|
32
41
|
export type AssetTreeResponse = z.infer<typeof AssetTreeResponseSchema>;
|
|
33
42
|
export declare const AssetContentResponseSchema: z.ZodObject<{
|
|
@@ -87,3 +96,84 @@ export declare const AssetSyncReportSchema: z.ZodObject<{
|
|
|
87
96
|
healed: z.ZodArray<z.ZodString>;
|
|
88
97
|
}, z.core.$strip>;
|
|
89
98
|
export type AssetSyncReport = z.infer<typeof AssetSyncReportSchema>;
|
|
99
|
+
export declare const AssetVersionParamsSchema: z.ZodObject<{
|
|
100
|
+
version: z.ZodCoercedNumber<unknown>;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
export type AssetVersionParams = z.infer<typeof AssetVersionParamsSchema>;
|
|
103
|
+
export declare const AssetVersionListQuerySchema: z.ZodObject<{
|
|
104
|
+
cursor: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
105
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
106
|
+
path: z.ZodString;
|
|
107
|
+
}, z.core.$strip>;
|
|
108
|
+
export type AssetVersionListQuery = z.infer<typeof AssetVersionListQuerySchema>;
|
|
109
|
+
export declare const AssetVersionQuerySchema: z.ZodObject<{
|
|
110
|
+
path: z.ZodString;
|
|
111
|
+
}, z.core.$strip>;
|
|
112
|
+
export type AssetVersionQuery = z.infer<typeof AssetVersionQuerySchema>;
|
|
113
|
+
export declare const AssetVersionListResponseSchema: z.ZodObject<{
|
|
114
|
+
items: z.ZodArray<z.ZodObject<{
|
|
115
|
+
id: z.ZodString;
|
|
116
|
+
createdAt: z.ZodString;
|
|
117
|
+
source: z.ZodEnum<{
|
|
118
|
+
admin: "admin";
|
|
119
|
+
"plugin-install": "plugin-install";
|
|
120
|
+
"file-sync": "file-sync";
|
|
121
|
+
}>;
|
|
122
|
+
version: z.ZodNumber;
|
|
123
|
+
hash: z.ZodString;
|
|
124
|
+
assetId: z.ZodString;
|
|
125
|
+
}, z.core.$strict>>;
|
|
126
|
+
nextCursor: z.ZodNullable<z.ZodNumber>;
|
|
127
|
+
}, z.core.$strip>;
|
|
128
|
+
export type AssetVersionListResponse = z.infer<typeof AssetVersionListResponseSchema>;
|
|
129
|
+
export declare const AssetVersionResponseSchema: z.ZodObject<{
|
|
130
|
+
version: z.ZodObject<{
|
|
131
|
+
id: z.ZodString;
|
|
132
|
+
assetId: z.ZodString;
|
|
133
|
+
version: z.ZodNumber;
|
|
134
|
+
content: z.ZodString;
|
|
135
|
+
hash: z.ZodString;
|
|
136
|
+
source: z.ZodEnum<{
|
|
137
|
+
admin: "admin";
|
|
138
|
+
"plugin-install": "plugin-install";
|
|
139
|
+
"file-sync": "file-sync";
|
|
140
|
+
}>;
|
|
141
|
+
createdAt: z.ZodString;
|
|
142
|
+
}, z.core.$strict>;
|
|
143
|
+
}, z.core.$strip>;
|
|
144
|
+
export type AssetVersionResponse = z.infer<typeof AssetVersionResponseSchema>;
|
|
145
|
+
export declare const MakeAssetVersionCurrentRequestSchema: z.ZodObject<{
|
|
146
|
+
path: z.ZodString;
|
|
147
|
+
}, z.core.$strict>;
|
|
148
|
+
export type MakeAssetVersionCurrentRequest = z.infer<typeof MakeAssetVersionCurrentRequestSchema>;
|
|
149
|
+
export declare const RestoreAssetRequestSchema: z.ZodObject<{
|
|
150
|
+
path: z.ZodString;
|
|
151
|
+
id: z.ZodString;
|
|
152
|
+
}, z.core.$strict>;
|
|
153
|
+
export type RestoreAssetRequest = z.infer<typeof RestoreAssetRequestSchema>;
|
|
154
|
+
export declare const RestoreAssetResponseSchema: z.ZodObject<{
|
|
155
|
+
path: z.ZodString;
|
|
156
|
+
content: z.ZodString;
|
|
157
|
+
size: z.ZodNumber;
|
|
158
|
+
registered: z.ZodBoolean;
|
|
159
|
+
pluginId: z.ZodNullable<z.ZodString>;
|
|
160
|
+
version: z.ZodNullable<z.ZodNumber>;
|
|
161
|
+
foldedFile: z.ZodBoolean;
|
|
162
|
+
}, z.core.$strip>;
|
|
163
|
+
export type RestoreAssetResponse = z.infer<typeof RestoreAssetResponseSchema>;
|
|
164
|
+
export declare const AssetTrashListQuerySchema: z.ZodObject<{
|
|
165
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
166
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
167
|
+
}, z.core.$strip>;
|
|
168
|
+
export type AssetTrashListQuery = z.infer<typeof AssetTrashListQuerySchema>;
|
|
169
|
+
export declare const AssetTrashListResponseSchema: z.ZodObject<{
|
|
170
|
+
items: z.ZodArray<z.ZodObject<{
|
|
171
|
+
id: z.ZodString;
|
|
172
|
+
path: z.ZodString;
|
|
173
|
+
pluginId: z.ZodNullable<z.ZodString>;
|
|
174
|
+
currentVersion: z.ZodNumber;
|
|
175
|
+
deletedAt: z.ZodString;
|
|
176
|
+
}, z.core.$strict>>;
|
|
177
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
178
|
+
}, z.core.$strip>;
|
|
179
|
+
export type AssetTrashListResponse = z.infer<typeof AssetTrashListResponseSchema>;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { TrashCursorSchema } from "./trash-cursor.schema.js";
|
|
3
|
+
import { AssetPathSchema, AssetRoutePathSchema, AssetVersionMetaSchema, AssetVersionSchema, TrashedAssetSchema } from "./asset.schema.js";
|
|
4
|
+
import { VersionListQuerySchema } from "./content-api.schema.js";
|
|
3
5
|
// S192 asset tree browser: caps mirror the content-tree pagination
|
|
4
6
|
// philosophy (never load an unbounded subtree) even though the tree
|
|
5
7
|
// walk itself isn't cursor-paginated — depth/entry caps bound the work.
|
|
6
8
|
export const ASSET_TREE_MAX_DEPTH = 8;
|
|
7
9
|
export const ASSET_TREE_MAX_ENTRIES = 2000;
|
|
8
10
|
export const AssetTreeEntrySchema = z.object({
|
|
9
|
-
path:
|
|
11
|
+
path: AssetRoutePathSchema,
|
|
10
12
|
kind: z.enum(["file", "folder"]),
|
|
11
13
|
size: z.number().int().min(0).nullable(),
|
|
12
14
|
mtimeMs: z.number().nullable(),
|
|
@@ -14,12 +16,16 @@ export const AssetTreeEntrySchema = z.object({
|
|
|
14
16
|
registered: z.boolean(),
|
|
15
17
|
pluginId: z.string().min(1).nullable(),
|
|
16
18
|
});
|
|
19
|
+
// S314j (D1, P2): a name under public/ the walk left out, with the rule of
|
|
20
|
+
// AssetPathSchema it broke. Present only when the walk left something out.
|
|
21
|
+
export const AssetTreeSkipSchema = z.object({ path: z.string(), reason: z.string() });
|
|
17
22
|
export const AssetTreeResponseSchema = z.object({
|
|
18
23
|
entries: z.array(AssetTreeEntrySchema),
|
|
19
24
|
truncated: z.boolean(),
|
|
25
|
+
skipped: z.array(AssetTreeSkipSchema).optional(),
|
|
20
26
|
});
|
|
21
27
|
export const AssetContentResponseSchema = z.object({
|
|
22
|
-
path:
|
|
28
|
+
path: AssetRoutePathSchema,
|
|
23
29
|
content: z.string(),
|
|
24
30
|
size: z.number().int(),
|
|
25
31
|
registered: z.boolean(),
|
|
@@ -27,22 +33,24 @@ export const AssetContentResponseSchema = z.object({
|
|
|
27
33
|
version: z.number().int().min(1).nullable(),
|
|
28
34
|
});
|
|
29
35
|
export const WriteAssetContentRequestSchema = z
|
|
30
|
-
.object({ path:
|
|
36
|
+
.object({ path: AssetRoutePathSchema, content: z.string() })
|
|
31
37
|
.strict();
|
|
32
|
-
export const CreateAssetFolderRequestSchema = z.object({ path:
|
|
38
|
+
export const CreateAssetFolderRequestSchema = z.object({ path: AssetRoutePathSchema }).strict();
|
|
33
39
|
export const RenameAssetRequestSchema = z
|
|
34
|
-
.object({ path:
|
|
35
|
-
.strict()
|
|
40
|
+
.object({ path: AssetRoutePathSchema, newPath: AssetRoutePathSchema })
|
|
41
|
+
.strict()
|
|
42
|
+
// S314c6 (D6): both fields would otherwise show the same path, a rename that moves nothing.
|
|
43
|
+
.meta({ example: { path: "css/site.css", newPath: "css/main.css" } });
|
|
36
44
|
// DELETE /api/manage/v1/assets is a two-step confirm gate like content trash and
|
|
37
45
|
// plugin uninstall: confirm is a literal "true" query string (not a
|
|
38
46
|
// boolean) because query params are always strings on the wire.
|
|
39
47
|
export const DeleteAssetQuerySchema = z.object({
|
|
40
|
-
path:
|
|
48
|
+
path: AssetRoutePathSchema,
|
|
41
49
|
confirm: z.enum(["true"]).optional(),
|
|
42
50
|
});
|
|
43
51
|
export const AssetDeleteBlockedResponseSchema = z.object({
|
|
44
52
|
requiresConfirmation: z.literal(true),
|
|
45
|
-
path:
|
|
53
|
+
path: AssetRoutePathSchema,
|
|
46
54
|
kind: z.enum(["file", "folder"]),
|
|
47
55
|
entryCount: z.number().int().min(0),
|
|
48
56
|
registered: z.boolean(),
|
|
@@ -51,10 +59,35 @@ export const AssetDeleteBlockedResponseSchema = z.object({
|
|
|
51
59
|
export const ZipExtractReportSchema = z.object({
|
|
52
60
|
extracted: z.number().int().min(0),
|
|
53
61
|
skipped: z.array(z.object({ path: z.string(), reason: z.string() })),
|
|
54
|
-
targetFolder: AssetPathSchema.nullable(),
|
|
62
|
+
targetFolder: AssetPathSchema.meta({ example: "css" }).nullable(),
|
|
55
63
|
});
|
|
56
64
|
export const AssetSyncReportSchema = z.object({
|
|
57
65
|
checked: z.number().int(),
|
|
58
66
|
updated: z.array(z.string()),
|
|
59
67
|
healed: z.array(z.string()),
|
|
60
68
|
});
|
|
69
|
+
// S314g (D5, P3): a registered text asset's history, addressed by its path as
|
|
70
|
+
// the other asset routes are. Same paging as the template history.
|
|
71
|
+
export const AssetVersionParamsSchema = z.object({ version: z.coerce.number().int().positive() });
|
|
72
|
+
export const AssetVersionListQuerySchema = VersionListQuerySchema.extend({ path: AssetRoutePathSchema });
|
|
73
|
+
export const AssetVersionQuerySchema = z.object({ path: AssetRoutePathSchema });
|
|
74
|
+
export const AssetVersionListResponseSchema = z.object({
|
|
75
|
+
items: z.array(AssetVersionMetaSchema),
|
|
76
|
+
nextCursor: z.number().int().positive().nullable(),
|
|
77
|
+
});
|
|
78
|
+
export const AssetVersionResponseSchema = z.object({ version: AssetVersionSchema });
|
|
79
|
+
export const MakeAssetVersionCurrentRequestSchema = z.object({ path: AssetRoutePathSchema }).strict();
|
|
80
|
+
// The path D5 names, and the trashed row's id from the trash list: 0014 lets
|
|
81
|
+
// several trashed rows share one path, so the path alone cannot say which.
|
|
82
|
+
export const RestoreAssetRequestSchema = z.object({ path: AssetRoutePathSchema, id: z.string().uuid() }).strict();
|
|
83
|
+
// The restore's answer: the asset's content response, and whether a file found
|
|
84
|
+
// at the path was kept as a file-sync version first (as RestoreTemplateResponse).
|
|
85
|
+
export const RestoreAssetResponseSchema = AssetContentResponseSchema.extend({ foldedFile: z.boolean() });
|
|
86
|
+
export const AssetTrashListQuerySchema = z.object({
|
|
87
|
+
cursor: TrashCursorSchema.optional(),
|
|
88
|
+
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
89
|
+
});
|
|
90
|
+
export const AssetTrashListResponseSchema = z.object({
|
|
91
|
+
items: z.array(TrashedAssetSchema),
|
|
92
|
+
nextCursor: z.string().nullable(),
|
|
93
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { DataTypeConfig } from "./data-type-config.schema.js";
|
|
3
|
+
export declare const ASSET_EDITOR_ID = "com.kardalum.asset";
|
|
4
|
+
export declare const ASSET_DATA_TYPE_ID = "b1e00000-0000-4000-8000-000000000014";
|
|
5
|
+
export declare const ASSET_IMAGE_EXTENSIONS: readonly ["png", "jpg", "jpeg", "gif", "webp", "svg", "avif"];
|
|
6
|
+
export declare const ASSET_ACCEPTS: readonly ["images", "any"];
|
|
7
|
+
export type AssetAccepts = (typeof ASSET_ACCEPTS)[number];
|
|
8
|
+
export declare const AssetFieldSettingsSchema: z.ZodObject<{
|
|
9
|
+
accepts: z.ZodDefault<z.ZodEnum<{
|
|
10
|
+
any: "any";
|
|
11
|
+
images: "images";
|
|
12
|
+
}>>;
|
|
13
|
+
startFolder: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
export type AssetFieldSettings = z.infer<typeof AssetFieldSettingsSchema>;
|
|
16
|
+
/** The last segment's extension, lower-cased, or "" when it has none (a leading dot is not one). */
|
|
17
|
+
export declare function assetExtension(path: string): string;
|
|
18
|
+
export declare function assetPathIsImage(path: string): boolean;
|
|
19
|
+
/** Whether a field with this `accepts` setting takes the file: a stored settings bag may lack the key, which means images. */
|
|
20
|
+
export declare function assetPathAccepted(path: string, accepts: unknown): boolean;
|
|
21
|
+
export declare const ASSET_DATA_TYPE_CONFIG: DataTypeConfig;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AssetPathSchema } from "./asset.schema.js";
|
|
3
|
+
// S314p (D3): the Asset data type. Its field points at a file under Settings, Assets (public/),
|
|
4
|
+
// stored as the path that screen shows, so a script can write it and a site built from an HTML
|
|
5
|
+
// kit can use the pictures it already has. A template gets the file's address, worked out at
|
|
6
|
+
// render (spec C5).
|
|
7
|
+
export const ASSET_EDITOR_ID = "com.kardalum.asset";
|
|
8
|
+
// The b1e00000 block continues: 0001 to 0009, 0012 and 0013 are seeded, and 0010 and 0011 are
|
|
9
|
+
// fixtures in document-type.schema.test.ts (see media-rendition.schema.ts).
|
|
10
|
+
export const ASSET_DATA_TYPE_ID = "b1e00000-0000-4000-8000-000000000014";
|
|
11
|
+
export const ASSET_IMAGE_EXTENSIONS = ["png", "jpg", "jpeg", "gif", "webp", "svg", "avif"];
|
|
12
|
+
export const ASSET_ACCEPTS = ["images", "any"];
|
|
13
|
+
// `.strict()` with defaults, the crop's idiom: the JSON Schema mirror in plugin-sdk is generated
|
|
14
|
+
// in input mode, and a strict object keeps `additionalProperties: false` there.
|
|
15
|
+
export const AssetFieldSettingsSchema = z
|
|
16
|
+
.object({
|
|
17
|
+
accepts: z.enum(ASSET_ACCEPTS).default("images"),
|
|
18
|
+
startFolder: AssetPathSchema.nullable().default(null),
|
|
19
|
+
})
|
|
20
|
+
.strict();
|
|
21
|
+
/** The last segment's extension, lower-cased, or "" when it has none (a leading dot is not one). */
|
|
22
|
+
export function assetExtension(path) {
|
|
23
|
+
const name = path.slice(path.lastIndexOf("/") + 1);
|
|
24
|
+
const dot = name.lastIndexOf(".");
|
|
25
|
+
return dot <= 0 ? "" : name.slice(dot + 1).toLowerCase();
|
|
26
|
+
}
|
|
27
|
+
export function assetPathIsImage(path) {
|
|
28
|
+
return ASSET_IMAGE_EXTENSIONS.includes(assetExtension(path));
|
|
29
|
+
}
|
|
30
|
+
/** Whether a field with this `accepts` setting takes the file: a stored settings bag may lack the key, which means images. */
|
|
31
|
+
export function assetPathAccepted(path, accepts) {
|
|
32
|
+
return accepts === "any" || assetPathIsImage(path);
|
|
33
|
+
}
|
|
34
|
+
// Seeded by migration 0033 on every install, never by BUILT_IN_DATA_TYPE_CONFIGS (0006 inserts
|
|
35
|
+
// that array only while it creates the table). The settings are parsed, so the stored row is the
|
|
36
|
+
// object the data types screen saves back unchanged.
|
|
37
|
+
export const ASSET_DATA_TYPE_CONFIG = {
|
|
38
|
+
id: ASSET_DATA_TYPE_ID,
|
|
39
|
+
name: "Asset",
|
|
40
|
+
editorId: ASSET_EDITOR_ID,
|
|
41
|
+
settings: AssetFieldSettingsSchema.parse({}),
|
|
42
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const AssetPathSchema: z.ZodString;
|
|
3
|
+
export declare const AssetRoutePathSchema: z.ZodString;
|
|
3
4
|
export declare const AssetDefinitionSchema: z.ZodObject<{
|
|
4
5
|
id: z.ZodString;
|
|
5
6
|
path: z.ZodString;
|
|
@@ -15,10 +16,31 @@ export declare const AssetVersionSchema: z.ZodObject<{
|
|
|
15
16
|
content: z.ZodString;
|
|
16
17
|
hash: z.ZodString;
|
|
17
18
|
source: z.ZodEnum<{
|
|
18
|
-
"plugin-install": "plugin-install";
|
|
19
19
|
admin: "admin";
|
|
20
|
+
"plugin-install": "plugin-install";
|
|
20
21
|
"file-sync": "file-sync";
|
|
21
22
|
}>;
|
|
22
23
|
createdAt: z.ZodString;
|
|
23
24
|
}, z.core.$strict>;
|
|
24
25
|
export type AssetVersion = z.infer<typeof AssetVersionSchema>;
|
|
26
|
+
export declare const AssetVersionMetaSchema: z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
createdAt: z.ZodString;
|
|
29
|
+
source: z.ZodEnum<{
|
|
30
|
+
admin: "admin";
|
|
31
|
+
"plugin-install": "plugin-install";
|
|
32
|
+
"file-sync": "file-sync";
|
|
33
|
+
}>;
|
|
34
|
+
version: z.ZodNumber;
|
|
35
|
+
hash: z.ZodString;
|
|
36
|
+
assetId: z.ZodString;
|
|
37
|
+
}, z.core.$strict>;
|
|
38
|
+
export type AssetVersionMeta = z.infer<typeof AssetVersionMetaSchema>;
|
|
39
|
+
export declare const TrashedAssetSchema: z.ZodObject<{
|
|
40
|
+
id: z.ZodString;
|
|
41
|
+
path: z.ZodString;
|
|
42
|
+
pluginId: z.ZodNullable<z.ZodString>;
|
|
43
|
+
currentVersion: z.ZodNumber;
|
|
44
|
+
deletedAt: z.ZodString;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
export type TrashedAsset = z.infer<typeof TrashedAssetSchema>;
|