@kardalum/plugin-sdk 0.0.0-stage → 0.15.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 +108 -0
- package/LICENSE +202 -0
- package/README.md +70 -2
- package/dist/admin-section-registry.d.ts +34 -0
- package/dist/admin-section-registry.js +49 -0
- package/dist/built-in-serializers.d.ts +3 -0
- package/dist/built-in-serializers.js +18 -0
- package/dist/built-in-settings-schemas.d.ts +14 -0
- package/dist/built-in-settings-schemas.js +225 -0
- package/dist/built-in-value-schemas.d.ts +4 -0
- package/dist/built-in-value-schemas.js +47 -0
- package/dist/built-ins.d.ts +1 -0
- package/dist/built-ins.js +257 -0
- package/dist/capabilities.d.ts +99 -0
- package/dist/capabilities.js +363 -0
- package/dist/data-type-plugin.d.ts +28 -0
- package/dist/data-type-plugin.js +1 -0
- package/dist/datatype-validation.d.ts +26 -0
- package/dist/datatype-validation.js +110 -0
- package/dist/datatypes-entry.d.ts +4 -0
- package/dist/datatypes-entry.js +18 -0
- package/dist/define-plugin.d.ts +25 -0
- package/dist/define-plugin.js +51 -0
- package/dist/entitlement-entry.d.ts +5 -0
- package/dist/entitlement-entry.js +24 -0
- package/dist/entitlement-gate.d.ts +36 -0
- package/dist/entitlement-gate.js +201 -0
- package/dist/entitlement-types.d.ts +39 -0
- package/dist/entitlement-types.js +1 -0
- package/dist/entitlement.d.ts +57 -0
- package/dist/entitlement.js +170 -0
- package/dist/host-entry.d.ts +1 -0
- package/dist/host-entry.js +11 -0
- package/dist/icon-name.d.ts +1 -0
- package/dist/icon-name.js +1 -0
- package/dist/icons.d.ts +2 -0
- package/dist/icons.js +10 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +93 -0
- package/dist/license-verdict-keys.d.ts +18 -0
- package/dist/license-verdict-keys.js +22 -0
- package/dist/local-host.d.ts +3 -0
- package/dist/local-host.js +38 -0
- package/dist/manifest-entry.d.ts +8 -0
- package/dist/manifest-entry.js +13 -0
- package/dist/manifest-schema.d.ts +408 -0
- package/dist/manifest-schema.js +774 -0
- package/dist/manifest.d.ts +546 -0
- package/dist/manifest.js +86 -0
- package/dist/media/media-picker.d.ts +39 -0
- package/dist/media/media-picker.js +438 -0
- package/dist/media/upload-error.d.ts +12 -0
- package/dist/media/upload-error.js +30 -0
- package/dist/plugin-context.d.ts +75 -0
- package/dist/plugin-context.js +70 -0
- package/dist/plugin-screen-context.d.ts +40 -0
- package/dist/plugin-screen-context.js +16 -0
- package/dist/register-built-ins.d.ts +1 -0
- package/dist/register-built-ins.js +41 -0
- package/dist/registry.d.ts +4 -0
- package/dist/registry.js +17 -0
- package/dist/rendition-eligibility.d.ts +24 -0
- package/dist/rendition-eligibility.js +40 -0
- package/dist/richtext/block-panel.d.ts +27 -0
- package/dist/richtext/block-panel.js +232 -0
- package/dist/richtext/extensions.d.ts +19 -0
- package/dist/richtext/extensions.js +56 -0
- package/dist/richtext/insert-menu.d.ts +24 -0
- package/dist/richtext/insert-menu.js +142 -0
- package/dist/richtext/kardalum-block.d.ts +33 -0
- package/dist/richtext/kardalum-block.js +282 -0
- package/dist/richtext/style-listbox.d.ts +10 -0
- package/dist/richtext/style-listbox.js +69 -0
- package/dist/richtext/text-style-class.d.ts +18 -0
- package/dist/richtext/text-style-class.js +36 -0
- package/dist/simple-storage-value-provider.d.ts +9 -0
- package/dist/simple-storage-value-provider.js +96 -0
- package/dist/structured-storage-types.d.ts +61 -0
- package/dist/structured-storage-types.js +11 -0
- package/dist/tailwind.d.ts +1 -0
- package/dist/tailwind.js +5 -0
- package/dist/tokens/system-dark.css +75 -0
- package/dist/tokens/tokens.css +239 -0
- package/dist/tokens/tokens.json +212 -0
- package/dist/tokens.d.ts +1 -0
- package/dist/tokens.js +11 -0
- package/dist/ui-entry.d.ts +5 -0
- package/dist/ui-entry.js +42 -0
- package/dist/views/content-list-preview.d.ts +1 -0
- package/dist/views/content-list-preview.js +14 -0
- package/dist/views/content-list-settings-view.d.ts +1 -0
- package/dist/views/content-list-settings-view.js +97 -0
- package/dist/views/content-list-view.d.ts +19 -0
- package/dist/views/content-list-view.js +248 -0
- package/dist/views/crop-view.d.ts +55 -0
- package/dist/views/crop-view.js +161 -0
- package/dist/views/date-range-view.d.ts +6 -0
- package/dist/views/date-range-view.js +55 -0
- package/dist/views/file-upload-view.d.ts +43 -0
- package/dist/views/file-upload-view.js +104 -0
- package/dist/views/html-code-editor.d.ts +10 -0
- package/dist/views/html-code-editor.js +101 -0
- package/dist/views/html-view.d.ts +3 -0
- package/dist/views/html-view.js +53 -0
- package/dist/views/image-view.d.ts +3 -0
- package/dist/views/image-view.js +387 -0
- package/dist/views/rich-text-view.d.ts +2 -0
- package/dist/views/rich-text-view.js +429 -0
- package/node_modules/@kardalum/api-schemas/LICENSE +202 -0
- package/node_modules/@kardalum/api-schemas/README.md +56 -0
- package/node_modules/@kardalum/api-schemas/dist/action.schema.d.ts +30 -0
- package/node_modules/@kardalum/api-schemas/dist/action.schema.js +88 -0
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +75 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +36 -0
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +89 -0
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +60 -0
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +24 -0
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +47 -0
- package/node_modules/@kardalum/api-schemas/dist/auth.schema.d.ts +38 -0
- package/node_modules/@kardalum/api-schemas/dist/auth.schema.js +38 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +537 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +353 -0
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +158 -0
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +139 -0
- package/node_modules/@kardalum/api-schemas/dist/content-path.d.ts +125 -0
- package/node_modules/@kardalum/api-schemas/dist/content-path.js +256 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +20 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +23 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.d.ts +151 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +82 -0
- package/node_modules/@kardalum/api-schemas/dist/content-version.schema.d.ts +18 -0
- package/node_modules/@kardalum/api-schemas/dist/content-version.schema.js +22 -0
- package/node_modules/@kardalum/api-schemas/dist/content.schema.d.ts +17 -0
- package/node_modules/@kardalum/api-schemas/dist/content.schema.js +20 -0
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +302 -0
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +97 -0
- package/node_modules/@kardalum/api-schemas/dist/culture-direction.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/culture-direction.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +36 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +32 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.d.ts +9 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +32 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +296 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +138 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.d.ts +121 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +147 -0
- package/node_modules/@kardalum/api-schemas/dist/health.schema.d.ts +6 -0
- package/node_modules/@kardalum/api-schemas/dist/health.schema.js +5 -0
- package/node_modules/@kardalum/api-schemas/dist/html-entities.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/html-entities.js +250 -0
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +102 -0
- package/node_modules/@kardalum/api-schemas/dist/index.js +58 -0
- package/node_modules/@kardalum/api-schemas/dist/licensing.schema.d.ts +15 -0
- package/node_modules/@kardalum/api-schemas/dist/licensing.schema.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +381 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +197 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +167 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +214 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.d.ts +77 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.js +53 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-use.d.ts +75 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-use.js +117 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference.d.ts +27 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference.js +279 -0
- package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.d.ts +74 -0
- package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.js +157 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +80 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +156 -0
- package/node_modules/@kardalum/api-schemas/dist/nav.schema.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/nav.schema.js +55 -0
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.d.ts +846 -0
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +356 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +20 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +27 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +169 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +80 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.d.ts +65 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.js +889 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +89 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +134 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +31 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +38 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +369 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +393 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +22 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +87 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +31 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +25 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.d.ts +15 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +24 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +306 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +328 -0
- package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +79 -0
- package/node_modules/@kardalum/api-schemas/dist/render-editing.js +50 -0
- package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.d.ts +9 -0
- package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/reserved-slugs.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/reserved-slugs.js +16 -0
- package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +90 -0
- package/node_modules/@kardalum/api-schemas/dist/role.schema.js +69 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content-outcome.schema.d.ts +17 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content-outcome.schema.js +27 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +108 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +93 -0
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +243 -0
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +296 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +43 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +25 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +30 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.js +19 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +112 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +74 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +39 -0
- package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.d.ts +21 -0
- package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +89 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +68 -0
- package/node_modules/@kardalum/api-schemas/package.json +35 -0
- package/node_modules/@kardalum/design-tokens/LICENSE +202 -0
- package/node_modules/@kardalum/design-tokens/README.md +29 -0
- package/node_modules/@kardalum/design-tokens/dist/build-css.d.ts +32 -0
- package/node_modules/@kardalum/design-tokens/dist/build-css.js +88 -0
- package/node_modules/@kardalum/design-tokens/dist/generate.d.ts +1 -0
- package/node_modules/@kardalum/design-tokens/dist/generate.js +18 -0
- package/node_modules/@kardalum/design-tokens/dist/index.d.ts +6 -0
- package/node_modules/@kardalum/design-tokens/dist/index.js +4 -0
- package/node_modules/@kardalum/design-tokens/dist/system-dark.css +75 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +33 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +54 -0
- package/node_modules/@kardalum/design-tokens/dist/theme-css.d.ts +12 -0
- package/node_modules/@kardalum/design-tokens/dist/theme-css.js +42 -0
- package/node_modules/@kardalum/design-tokens/dist/theme-types.d.ts +43 -0
- package/node_modules/@kardalum/design-tokens/dist/theme-types.js +1 -0
- package/node_modules/@kardalum/design-tokens/dist/themes/dark.d.ts +13 -0
- package/node_modules/@kardalum/design-tokens/dist/themes/dark.js +120 -0
- package/node_modules/@kardalum/design-tokens/dist/themes/index.d.ts +5 -0
- package/node_modules/@kardalum/design-tokens/dist/themes/index.js +4 -0
- package/node_modules/@kardalum/design-tokens/dist/themes/light.d.ts +9 -0
- package/node_modules/@kardalum/design-tokens/dist/themes/light.js +13 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +239 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +25 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +276 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +212 -0
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +91 -0
- package/node_modules/@kardalum/design-tokens/dist/types.js +5 -0
- package/node_modules/@kardalum/design-tokens/package.json +42 -0
- package/node_modules/@kardalum/plugin-package/LICENSE +202 -0
- package/node_modules/@kardalum/plugin-package/README.md +71 -0
- package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +50 -0
- package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +659 -0
- package/node_modules/@kardalum/plugin-package/dist/envelope.d.ts +19 -0
- package/node_modules/@kardalum/plugin-package/dist/envelope.js +104 -0
- package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +37 -0
- package/node_modules/@kardalum/plugin-package/dist/extract.js +199 -0
- package/node_modules/@kardalum/plugin-package/dist/hash.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/hash.js +69 -0
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +11 -0
- package/node_modules/@kardalum/plugin-package/dist/index.js +7 -0
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +185 -0
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +236 -0
- package/node_modules/@kardalum/plugin-package/dist/package-contract.d.ts +50 -0
- package/node_modules/@kardalum/plugin-package/dist/package-contract.js +115 -0
- package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/sample-content.js +17 -0
- package/node_modules/@kardalum/plugin-package/dist/types.d.ts +45 -0
- package/node_modules/@kardalum/plugin-package/dist/types.js +1 -0
- package/node_modules/@kardalum/plugin-package/package.json +49 -0
- package/node_modules/@kardalum/ui/LICENSE +202 -0
- package/node_modules/@kardalum/ui/README.md +35 -0
- package/node_modules/@kardalum/ui/dist/components/alert-dialog.d.ts +14 -0
- package/node_modules/@kardalum/ui/dist/components/alert-dialog.js +38 -0
- package/node_modules/@kardalum/ui/dist/components/badge.d.ts +9 -0
- package/node_modules/@kardalum/ui/dist/components/badge.js +30 -0
- package/node_modules/@kardalum/ui/dist/components/button.d.ts +11 -0
- package/node_modules/@kardalum/ui/dist/components/button.js +37 -0
- package/node_modules/@kardalum/ui/dist/components/checkbox.d.ts +5 -0
- package/node_modules/@kardalum/ui/dist/components/checkbox.js +7 -0
- package/node_modules/@kardalum/ui/dist/components/dialog.d.ts +17 -0
- package/node_modules/@kardalum/ui/dist/components/dialog.js +48 -0
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.d.ts +18 -0
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +53 -0
- package/node_modules/@kardalum/ui/dist/components/empty-state.d.ts +30 -0
- package/node_modules/@kardalum/ui/dist/components/empty-state.js +9 -0
- package/node_modules/@kardalum/ui/dist/components/input.d.ts +4 -0
- package/node_modules/@kardalum/ui/dist/components/input.js +6 -0
- package/node_modules/@kardalum/ui/dist/components/panel.d.ts +5 -0
- package/node_modules/@kardalum/ui/dist/components/panel.js +6 -0
- package/node_modules/@kardalum/ui/dist/components/property-field.d.ts +19 -0
- package/node_modules/@kardalum/ui/dist/components/property-field.js +86 -0
- package/node_modules/@kardalum/ui/dist/components/sheet.d.ts +17 -0
- package/node_modules/@kardalum/ui/dist/components/sheet.js +55 -0
- package/node_modules/@kardalum/ui/dist/components/skeleton.d.ts +3 -0
- package/node_modules/@kardalum/ui/dist/components/skeleton.js +9 -0
- package/node_modules/@kardalum/ui/dist/components/switch.d.ts +5 -0
- package/node_modules/@kardalum/ui/dist/components/switch.js +7 -0
- package/node_modules/@kardalum/ui/dist/components/tab-strip.d.ts +34 -0
- package/node_modules/@kardalum/ui/dist/components/tab-strip.js +72 -0
- package/node_modules/@kardalum/ui/dist/components/toast.d.ts +18 -0
- package/node_modules/@kardalum/ui/dist/components/toast.js +42 -0
- package/node_modules/@kardalum/ui/dist/components/toaster.d.ts +12 -0
- package/node_modules/@kardalum/ui/dist/components/toaster.js +11 -0
- package/node_modules/@kardalum/ui/dist/components/use-toast.d.ts +17 -0
- package/node_modules/@kardalum/ui/dist/components/use-toast.js +62 -0
- package/node_modules/@kardalum/ui/dist/index.d.ts +18 -0
- package/node_modules/@kardalum/ui/dist/index.js +18 -0
- package/node_modules/@kardalum/ui/dist/lib/cn.d.ts +2 -0
- package/node_modules/@kardalum/ui/dist/lib/cn.js +5 -0
- package/node_modules/@kardalum/ui/package.json +63 -0
- package/package.json +146 -4
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
// Settings schemas for built-in editors that have real, validated settings
|
|
2
|
+
// (Session 69) — keyed by the SAME id built-ins.tsx registers under
|
|
3
|
+
// (com.kardalum.<name>). Editors with no entry here have no server-side
|
|
4
|
+
// settings validation: either they have no settings at all (empty
|
|
5
|
+
// settingsSchema, e.g. number/boolean/date), or they're a third-party/
|
|
6
|
+
// remote plugin the server has no way to load code for (Module Federation
|
|
7
|
+
// remotes only ever run in the browser — see manifest-entry.ts). This is a
|
|
8
|
+
// deliberate, documented scope boundary, not an oversight.
|
|
9
|
+
//
|
|
10
|
+
// Zero React import: this file (and the @kardalum/plugin-sdk/datatypes
|
|
11
|
+
// subpath that re-exports it) must stay importable from apps/server.
|
|
12
|
+
export const TEXT_SETTINGS_SCHEMA = {
|
|
13
|
+
type: "object",
|
|
14
|
+
properties: {
|
|
15
|
+
placeholder: { type: "string" },
|
|
16
|
+
maxLength: { type: "integer", minimum: 1 },
|
|
17
|
+
},
|
|
18
|
+
additionalProperties: false,
|
|
19
|
+
};
|
|
20
|
+
// Deliberately {} — resolve-data-type.ts falls back to editor.defaultSettings
|
|
21
|
+
// for any config with empty settings (all six seeded built-ins today), so a
|
|
22
|
+
// non-empty default here would silently change every existing Text field's
|
|
23
|
+
// behavior the moment this ships.
|
|
24
|
+
export const TEXT_DEFAULT_SETTINGS = {};
|
|
25
|
+
// S234d Task 2. Now the hand-kept JSON Schema mirror of
|
|
26
|
+
// ImageSettingsSchema in @kardalum/api-schemas, which became the source
|
|
27
|
+
// of truth for this editor's settings when `rendition` joined them; the
|
|
28
|
+
// two members above it predate the Zod twin and used to live only here.
|
|
29
|
+
// built-ins.test.tsx compares this against the generator's literal output
|
|
30
|
+
// so the two cannot diverge silently, which is why `maxSizeBytes` now
|
|
31
|
+
// says `exclusiveMinimum: 0` with a `maximum` rather than the equivalent
|
|
32
|
+
// `minimum: 1` it was written with by hand.
|
|
33
|
+
//
|
|
34
|
+
// The generator is called with `io: "input"` for this one, as it is for
|
|
35
|
+
// crop and thumbnail below, and unlike content list and file upload
|
|
36
|
+
// (neither of which has a member carrying a default, so both modes agree
|
|
37
|
+
// for them). In the default "output" mode z.toJSONSchema lists a member
|
|
38
|
+
// carrying a `default` under `required`, because after parsing it is
|
|
39
|
+
// always present. What this schema validates is not a parsed value
|
|
40
|
+
// though, it is the settings a client SENDS, and image data types have
|
|
41
|
+
// been saving settings of `{}` since Session 69. A mirror that required
|
|
42
|
+
// `rendition` would start refusing rows that were valid the day before it
|
|
43
|
+
// shipped.
|
|
44
|
+
export const IMAGE_SETTINGS_SCHEMA = {
|
|
45
|
+
type: "object",
|
|
46
|
+
properties: {
|
|
47
|
+
acceptedTypes: {
|
|
48
|
+
type: "array",
|
|
49
|
+
items: {
|
|
50
|
+
type: "string",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
maxSizeBytes: {
|
|
54
|
+
type: "integer",
|
|
55
|
+
exclusiveMinimum: 0,
|
|
56
|
+
maximum: 9007199254740991,
|
|
57
|
+
},
|
|
58
|
+
rendition: {
|
|
59
|
+
default: null,
|
|
60
|
+
anyOf: [
|
|
61
|
+
{
|
|
62
|
+
type: "string",
|
|
63
|
+
minLength: 1,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
type: "null",
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
additionalProperties: false,
|
|
72
|
+
};
|
|
73
|
+
export const IMAGE_DEFAULT_SETTINGS = {};
|
|
74
|
+
// S197 Task 8 (spec §7, D7): the raw-HTML datatype's one setting is an
|
|
75
|
+
// honest trust boundary, not a UX preference — default OFF, and the
|
|
76
|
+
// input view's settings screen states the trade-off inline (verbatim
|
|
77
|
+
// copy lives in html-view.tsx's HtmlSettingsView, not duplicated here).
|
|
78
|
+
export const HTML_SETTINGS_SCHEMA = {
|
|
79
|
+
type: "object",
|
|
80
|
+
properties: {
|
|
81
|
+
trusted: { type: "boolean" },
|
|
82
|
+
},
|
|
83
|
+
additionalProperties: false,
|
|
84
|
+
};
|
|
85
|
+
export const HTML_DEFAULT_SETTINGS = { trusted: false };
|
|
86
|
+
// S232. The hand-kept JSON Schema mirror of ContentListSettingsSchema in
|
|
87
|
+
// @kardalum/api-schemas, which stays the single source of truth (this
|
|
88
|
+
// module is deliberately import-free so apps/server can read it without
|
|
89
|
+
// dragging anything else in; built-ins.test.tsx compares the two so a
|
|
90
|
+
// drift fails loudly). `additionalProperties: false` at every level and
|
|
91
|
+
// `minItems: 1` are the Zod `.strict()` and `.min(1)` it mirrors, so an
|
|
92
|
+
// unknown property, an unknown key and an empty column list are all
|
|
93
|
+
// refused on the server as well as in the picker.
|
|
94
|
+
export const CONTENT_LIST_SETTINGS_SCHEMA = {
|
|
95
|
+
type: "object",
|
|
96
|
+
properties: {
|
|
97
|
+
columns: {
|
|
98
|
+
minItems: 1,
|
|
99
|
+
type: "array",
|
|
100
|
+
items: {
|
|
101
|
+
oneOf: [
|
|
102
|
+
{
|
|
103
|
+
type: "object",
|
|
104
|
+
properties: {
|
|
105
|
+
kind: { type: "string", const: "property" },
|
|
106
|
+
property: {
|
|
107
|
+
type: "string",
|
|
108
|
+
enum: ["name", "id", "url", "status", "updatedAt", "publishedAt"],
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
required: ["kind", "property"],
|
|
112
|
+
additionalProperties: false,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
type: "object",
|
|
116
|
+
properties: {
|
|
117
|
+
kind: { type: "string", const: "field" },
|
|
118
|
+
fieldId: { type: "string", minLength: 1 },
|
|
119
|
+
label: { type: "string", minLength: 1 },
|
|
120
|
+
},
|
|
121
|
+
required: ["kind", "fieldId"],
|
|
122
|
+
additionalProperties: false,
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
required: ["columns"],
|
|
129
|
+
additionalProperties: false,
|
|
130
|
+
};
|
|
131
|
+
// S234a Task 4c item 1. The hand-kept JSON Schema mirror of
|
|
132
|
+
// FileUploadSettingsSchema in @kardalum/api-schemas, the same idiom as
|
|
133
|
+
// CONTENT_LIST_SETTINGS_SCHEMA above: built-ins.test.tsx compares this
|
|
134
|
+
// against z.toJSONSchema(FileUploadSettingsSchema) so the two can never
|
|
135
|
+
// diverge silently. `exclusiveMinimum: 0` (not `minimum: 1`) and
|
|
136
|
+
// `maximum: 9007199254740991` on maxSizeBytes are exactly what
|
|
137
|
+
// z.toJSONSchema emits for `.int().positive()`: copy its literal output
|
|
138
|
+
// here rather than a hand-guessed equivalent, or this schema drifts from
|
|
139
|
+
// the one it is supposed to mirror the moment either changes.
|
|
140
|
+
export const FILE_UPLOAD_SETTINGS_SCHEMA = {
|
|
141
|
+
type: "object",
|
|
142
|
+
properties: {
|
|
143
|
+
extensions: { type: "array", items: { type: "string", pattern: "^[a-z0-9]+$" } },
|
|
144
|
+
maxSizeBytes: { type: "integer", exclusiveMinimum: 0, maximum: 9007199254740991 },
|
|
145
|
+
},
|
|
146
|
+
required: ["extensions"],
|
|
147
|
+
additionalProperties: false,
|
|
148
|
+
};
|
|
149
|
+
// S234c Task 4. The hand-kept JSON Schema mirrors of CropSettingsSchema
|
|
150
|
+
// and ThumbnailSettingsSchema in @kardalum/api-schemas, the same idiom
|
|
151
|
+
// as the two above: built-ins.test.tsx compares each against
|
|
152
|
+
// z.toJSONSchema(<the Zod schema>) so they cannot diverge silently.
|
|
153
|
+
// Literal output copied from that generator rather than hand-guessed
|
|
154
|
+
// equivalents, which is why `exclusiveMinimum: 0` with
|
|
155
|
+
// `maximum: 9007199254740991` stands for `.int().positive()`, and why
|
|
156
|
+
// `maxWidth` is an `anyOf` with its own `default: null` rather than a
|
|
157
|
+
// nullable type.
|
|
158
|
+
//
|
|
159
|
+
// BOTH ARE GENERATED WITH `io: "input"`, like the image mirror above and
|
|
160
|
+
// unlike content list and file upload, and getting that wrong is a real
|
|
161
|
+
// defect rather than a style choice. In the default "output" mode
|
|
162
|
+
// z.toJSONSchema lists a member carrying a `default` under `required`,
|
|
163
|
+
// because after a parse it is always present. What these mirrors
|
|
164
|
+
// validate is not a parsed value, it is the settings a client SENDS, and
|
|
165
|
+
// `CropSettingsSchema` accepts `{ ratio: "3:4" }` and fills `maxWidth`
|
|
166
|
+
// in. The mirror shipped in output mode, so it said
|
|
167
|
+
// `required: ["ratio", "maxWidth"]` while its Zod twin did not, and the
|
|
168
|
+
// server's ajv (no `useDefaults`) turned a manifest declaring a crop by
|
|
169
|
+
// ratio alone into a 400. The admin's crop settings view always sends
|
|
170
|
+
// both members, which is the only reason nobody hit it.
|
|
171
|
+
//
|
|
172
|
+
// Input mode alone is not enough: on a NON-strict Zod object it also
|
|
173
|
+
// drops `additionalProperties: false`. That is why both Zod schemas are
|
|
174
|
+
// `.strict()` now, the thumbnail included even though its one member has
|
|
175
|
+
// no default and its `required` was correct either way.
|
|
176
|
+
//
|
|
177
|
+
// Without these mirrors, the server validated a crop's settings not at
|
|
178
|
+
// all: validateDataTypeSettings skips an editor id it has no schema for,
|
|
179
|
+
// so a client could have stored a ratio of "banana" or a negative
|
|
180
|
+
// maximum width. The pattern is the ratio's own, leading zeros included,
|
|
181
|
+
// so one shape has exactly one spelling and therefore one rendition
|
|
182
|
+
// filename.
|
|
183
|
+
export const CROP_SETTINGS_SCHEMA = {
|
|
184
|
+
type: "object",
|
|
185
|
+
properties: {
|
|
186
|
+
ratio: { type: "string", pattern: "^[1-9][0-9]*:[1-9][0-9]*$" },
|
|
187
|
+
maxWidth: {
|
|
188
|
+
default: null,
|
|
189
|
+
anyOf: [{ type: "integer", exclusiveMinimum: 0, maximum: 9007199254740991 }, { type: "null" }],
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
required: ["ratio"],
|
|
193
|
+
additionalProperties: false,
|
|
194
|
+
};
|
|
195
|
+
export const THUMBNAIL_SETTINGS_SCHEMA = {
|
|
196
|
+
type: "object",
|
|
197
|
+
properties: {
|
|
198
|
+
longestEdge: { type: "integer", exclusiveMinimum: 0, maximum: 9007199254740991 },
|
|
199
|
+
},
|
|
200
|
+
required: ["longestEdge"],
|
|
201
|
+
additionalProperties: false,
|
|
202
|
+
};
|
|
203
|
+
// Both schemas above have required members, so like the content list
|
|
204
|
+
// below (and unlike text/image/html) these defaults are real values
|
|
205
|
+
// rather than `{}`: they are the settings migration 0024 seeds into the
|
|
206
|
+
// two shipped rows (MEDIA_RENDITION_DATA_TYPES in db-adapter), and a
|
|
207
|
+
// default that differed from the seed would be a row a webmaster could
|
|
208
|
+
// not open and save back unchanged.
|
|
209
|
+
export const CROP_DEFAULT_SETTINGS = { ratio: "1:1", maxWidth: null };
|
|
210
|
+
export const THUMBNAIL_DEFAULT_SETTINGS = { longestEdge: 320 };
|
|
211
|
+
// com.kardalum.contentlist is the first entry whose schema has a REQUIRED
|
|
212
|
+
// member (`columns`), so unlike the three above it cannot fall back to the
|
|
213
|
+
// "stored settings are {} until a webmaster edits them" convention: its
|
|
214
|
+
// seed row (CONTENT_LIST_DATA_TYPE_CONFIG in @kardalum/api-schemas)
|
|
215
|
+
// stores the real default columns instead, which is what keeps that row
|
|
216
|
+
// saveable back unchanged through the data-types route.
|
|
217
|
+
export const BUILT_IN_SETTINGS_SCHEMAS = {
|
|
218
|
+
"com.kardalum.text": TEXT_SETTINGS_SCHEMA,
|
|
219
|
+
"com.kardalum.image": IMAGE_SETTINGS_SCHEMA,
|
|
220
|
+
"com.kardalum.html": HTML_SETTINGS_SCHEMA,
|
|
221
|
+
"com.kardalum.contentlist": CONTENT_LIST_SETTINGS_SCHEMA,
|
|
222
|
+
"com.kardalum.fileupload": FILE_UPLOAD_SETTINGS_SCHEMA,
|
|
223
|
+
"com.kardalum.crop": CROP_SETTINGS_SCHEMA,
|
|
224
|
+
"com.kardalum.thumbnail": THUMBNAIL_SETTINGS_SCHEMA,
|
|
225
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Keyed by editor id (`DataTypeConfig.editorId`), matching
|
|
2
|
+
* BUILT_IN_SERIALIZERS and BUILT_IN_DATA_TYPE_CONFIGS. */
|
|
3
|
+
export const BUILT_IN_VALUE_SCHEMAS = {
|
|
4
|
+
"com.kardalum.text": { type: "string" },
|
|
5
|
+
"com.kardalum.number": { type: "number" },
|
|
6
|
+
"com.kardalum.boolean": { type: "boolean" },
|
|
7
|
+
"com.kardalum.date": { type: "string", format: "date" },
|
|
8
|
+
// A media id, not a URL: the image field stores the id and the URL is
|
|
9
|
+
// resolved at read time (B2's one-source-of-truth rule).
|
|
10
|
+
"com.kardalum.image": { type: "string" },
|
|
11
|
+
// A TipTap/ProseMirror document. Deliberately not described further than
|
|
12
|
+
// "an object": the node set is the editor's, it grows with extensions,
|
|
13
|
+
// and a partial description would be a promise this cannot keep.
|
|
14
|
+
"com.kardalum.richtext": { type: "object" },
|
|
15
|
+
"com.kardalum.html": { type: "string" },
|
|
16
|
+
"com.kardalum.daterange": {
|
|
17
|
+
type: "object",
|
|
18
|
+
properties: { start: { type: ["string", "null"] }, end: { type: ["string", "null"] } },
|
|
19
|
+
additionalProperties: false,
|
|
20
|
+
},
|
|
21
|
+
// S232. The Content List field stores nothing at all: the table it
|
|
22
|
+
// renders reads the page's CHILDREN through GET /api/content/:id/list,
|
|
23
|
+
// so a consumer of the public API learns the honest answer here, that
|
|
24
|
+
// this field carries no value of its own.
|
|
25
|
+
"com.kardalum.contentlist": { type: "null" },
|
|
26
|
+
// S234c. A crop field stores the rectangle it last cut, as fractions of
|
|
27
|
+
// the source, or nothing at all before anyone has cut it. The members
|
|
28
|
+
// carry their own bounds; what this cannot say is that the rectangle
|
|
29
|
+
// lies inside the source (`x + w <= 1` and `y + h <= 1`), which is a
|
|
30
|
+
// relation between two of them. CropRectSchema in @kardalum/api-schemas
|
|
31
|
+
// is what enforces that, and stays the shape's single source of truth.
|
|
32
|
+
"com.kardalum.crop": {
|
|
33
|
+
type: ["object", "null"],
|
|
34
|
+
properties: {
|
|
35
|
+
x: { type: "number", minimum: 0, exclusiveMaximum: 1 },
|
|
36
|
+
y: { type: "number", minimum: 0, exclusiveMaximum: 1 },
|
|
37
|
+
w: { type: "number", exclusiveMinimum: 0, maximum: 1 },
|
|
38
|
+
h: { type: "number", exclusiveMinimum: 0, maximum: 1 },
|
|
39
|
+
},
|
|
40
|
+
required: ["x", "y", "w", "h"],
|
|
41
|
+
additionalProperties: false,
|
|
42
|
+
},
|
|
43
|
+
// A thumbnail is automatic: the browser cuts one whenever bytes arrive,
|
|
44
|
+
// and the rendition row records it. So this field, like the content list
|
|
45
|
+
// above, carries no value of its own.
|
|
46
|
+
"com.kardalum.thumbnail": { type: "null" },
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CONTENT_LIST_DEFAULT_SETTINGS } from "@kardalum/api-schemas";
|
|
3
|
+
import { Checkbox, Input, PropertyField, usePropertyFieldControl } from "@kardalum/ui";
|
|
4
|
+
import { CONTENT_LIST_SETTINGS_SCHEMA, CROP_DEFAULT_SETTINGS, CROP_SETTINGS_SCHEMA, FILE_UPLOAD_SETTINGS_SCHEMA, HTML_DEFAULT_SETTINGS, HTML_SETTINGS_SCHEMA, IMAGE_DEFAULT_SETTINGS, IMAGE_SETTINGS_SCHEMA, TEXT_DEFAULT_SETTINGS, TEXT_SETTINGS_SCHEMA, THUMBNAIL_DEFAULT_SETTINGS, THUMBNAIL_SETTINGS_SCHEMA, } from "./built-in-settings-schemas.js";
|
|
5
|
+
import { BUILT_IN_VALUE_SCHEMAS } from "./built-in-value-schemas.js";
|
|
6
|
+
import { BUILT_IN_SERIALIZERS, identitySerializer } from "./built-in-serializers.js";
|
|
7
|
+
import { BUILT_IN_DATATYPE_VALIDATORS } from "./datatype-validation.js";
|
|
8
|
+
import { definePlugin } from "./define-plugin.js";
|
|
9
|
+
import { usePluginSettings, usePluginSettingsValue, usePluginValue } from "./plugin-context.js";
|
|
10
|
+
import { registerDataType } from "./registry.js";
|
|
11
|
+
import { ContentListPreview } from "./views/content-list-preview.js";
|
|
12
|
+
import { ContentListSettingsView } from "./views/content-list-settings-view.js";
|
|
13
|
+
import { ContentListInputView, ContentListReadOnlyView } from "./views/content-list-view.js";
|
|
14
|
+
import { CropInputView, CropReadOnlyView, CropSettingsView, ThumbnailInputView, ThumbnailReadOnlyView, ThumbnailSettingsView, } from "./views/crop-view.js";
|
|
15
|
+
import { DateRangeInputView, DateRangeReadOnlyView } from "./views/date-range-view.js";
|
|
16
|
+
import { FileUploadInputView, FileUploadReadOnlyView, FileUploadSettingsView } from "./views/file-upload-view.js";
|
|
17
|
+
import { HtmlInputView, HtmlReadOnlyView, HtmlSettingsView } from "./views/html-view.js";
|
|
18
|
+
import { ImageInputView, ImageReadOnlyView, ImageSettingsView } from "./views/image-view.js";
|
|
19
|
+
import { RichTextInputView, RichTextReadOnlyView } from "./views/rich-text-view.js";
|
|
20
|
+
// Direct @kardalum/ui dependency is TEMPORARY (Session 35): built-ins are
|
|
21
|
+
// statically compiled into the same admin bundle as @kardalum/ui today, so
|
|
22
|
+
// this is harmless. Must become the SDK's own curated re-export of
|
|
23
|
+
// @kardalum/ui before plugin-sdk is ever published standalone (Module
|
|
24
|
+
// Federation, Month 4-5): @kardalum/ui is meant to stay private.
|
|
25
|
+
function NotImplementedView() {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
// Every built-in input view spreads usePropertyFieldControl(): the host
|
|
29
|
+
// renders these inside a PropertyField whose <label> has no child element
|
|
30
|
+
// to point at (the view is a component, not a DOM node), so without this
|
|
31
|
+
// the control has no accessible name at all — WCAG 4.1.2, and exactly
|
|
32
|
+
// what axe reports as `label` / `aria-input-field-name`.
|
|
33
|
+
function TextInputView() {
|
|
34
|
+
const { value, onChange } = usePluginValue();
|
|
35
|
+
const settings = usePluginSettings();
|
|
36
|
+
const field = usePropertyFieldControl();
|
|
37
|
+
return (_jsx(Input, { ...field, value: value ?? "", placeholder: settings.placeholder,
|
|
38
|
+
// Hard limit: the browser physically blocks keystrokes past this —
|
|
39
|
+
// a different, config-level concept from FieldValidation.maxLength
|
|
40
|
+
// (field-row.tsx), which is a soft, validated-on-blur field rule.
|
|
41
|
+
maxLength: settings.maxLength, onChange: (e) => onChange(e.target.value) }));
|
|
42
|
+
}
|
|
43
|
+
function TextReadOnlyView() {
|
|
44
|
+
const { value } = usePluginValue();
|
|
45
|
+
return _jsx("p", { children: value ?? "" });
|
|
46
|
+
}
|
|
47
|
+
// Rendered by the Data Types editor only (data-type-editor.tsx) — a
|
|
48
|
+
// settings-EDITING view, so it uses usePluginSettingsValue() (write path),
|
|
49
|
+
// not usePluginSettings() (read-only, used by the input/readOnly views
|
|
50
|
+
// above). Hardcoded English strings: this file has no access to
|
|
51
|
+
// admin-ui's react-i18next instance: plugin-sdk views' i18n is a known,
|
|
52
|
+
// deliberately deferred piece of SDK scope, not yet implemented,
|
|
53
|
+
// matching ImageInputView's existing "Remove"/"Loading…" precedent.
|
|
54
|
+
function TextSettingsView() {
|
|
55
|
+
const { value: settings, onChange } = usePluginSettingsValue();
|
|
56
|
+
return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(PropertyField, { label: "Placeholder text", htmlFor: "text-settings-placeholder", children: _jsx(Input, { id: "text-settings-placeholder", value: settings.placeholder ?? "", onChange: (e) => onChange({ ...settings, placeholder: e.target.value || undefined }) }) }), _jsx(PropertyField, { label: "Max length", htmlFor: "text-settings-max-length", helpText: "Blocks typing past this many characters. Leave blank for no limit.", children: _jsx(Input, { id: "text-settings-max-length", type: "number", min: 1, value: settings.maxLength ?? "", onChange: (e) => onChange({ ...settings, maxLength: e.target.value === "" ? undefined : Number(e.target.value) }) }) })] }));
|
|
57
|
+
}
|
|
58
|
+
function NumberInputView() {
|
|
59
|
+
const { value, onChange } = usePluginValue();
|
|
60
|
+
const field = usePropertyFieldControl();
|
|
61
|
+
return (_jsx(Input, { ...field, type: "number", value: value ?? "", onChange: (e) => onChange(e.target.value === "" ? null : Number(e.target.value)) }));
|
|
62
|
+
}
|
|
63
|
+
function NumberReadOnlyView() {
|
|
64
|
+
const { value } = usePluginValue();
|
|
65
|
+
return _jsx("p", { children: value ?? "" });
|
|
66
|
+
}
|
|
67
|
+
function BooleanInputView() {
|
|
68
|
+
const { value, onChange } = usePluginValue();
|
|
69
|
+
const field = usePropertyFieldControl();
|
|
70
|
+
return _jsx(Checkbox, { ...field, checked: !!value, onCheckedChange: (checked) => onChange(checked === true) });
|
|
71
|
+
}
|
|
72
|
+
function BooleanReadOnlyView() {
|
|
73
|
+
const { value } = usePluginValue();
|
|
74
|
+
return _jsx("p", { children: value ? "Yes" : "No" });
|
|
75
|
+
}
|
|
76
|
+
function DateInputView() {
|
|
77
|
+
const { value, onChange } = usePluginValue();
|
|
78
|
+
const field = usePropertyFieldControl();
|
|
79
|
+
return _jsx(Input, { ...field, type: "date", value: value ?? "", onChange: (e) => onChange(e.target.value) });
|
|
80
|
+
}
|
|
81
|
+
function DateReadOnlyView() {
|
|
82
|
+
const { value } = usePluginValue();
|
|
83
|
+
return _jsx("p", { children: value ?? "" });
|
|
84
|
+
}
|
|
85
|
+
const NOT_IMPLEMENTED_VIEWS = {
|
|
86
|
+
input: NotImplementedView,
|
|
87
|
+
readOnly: NotImplementedView,
|
|
88
|
+
settings: NotImplementedView,
|
|
89
|
+
};
|
|
90
|
+
const NO_SETTINGS = { type: "object", properties: {} };
|
|
91
|
+
function builtIn(id, name, icon, schema, views = NOT_IMPLEMENTED_VIEWS, options = {}) {
|
|
92
|
+
// Through definePlugin (Session 61) so built-ins take the exact
|
|
93
|
+
// validation path external plugins do — a regression in any built-in
|
|
94
|
+
// definition fails loudly at module load, not silently at render.
|
|
95
|
+
return definePlugin({
|
|
96
|
+
id: `com.kardalum.${id}`,
|
|
97
|
+
name,
|
|
98
|
+
icon,
|
|
99
|
+
version: "1.0.0",
|
|
100
|
+
type: "datatype",
|
|
101
|
+
schema,
|
|
102
|
+
settingsSchema: options.settingsSchema ?? NO_SETTINGS,
|
|
103
|
+
defaultSettings: options.defaultSettings ?? {},
|
|
104
|
+
views,
|
|
105
|
+
serialize: BUILT_IN_SERIALIZERS[`com.kardalum.${id}`] ?? identitySerializer,
|
|
106
|
+
deserialize: identitySerializer,
|
|
107
|
+
// Same idiom as serialize: looked up by id, so a built-in's hook rides
|
|
108
|
+
// the identical definePlugin path an external plugin's does.
|
|
109
|
+
validate: BUILT_IN_DATATYPE_VALIDATORS[`com.kardalum.${id}`]?.validate,
|
|
110
|
+
isEmpty: BUILT_IN_DATATYPE_VALIDATORS[`com.kardalum.${id}`]?.isEmpty,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
// Real views (Session 35) — settings stays NotImplementedView for four
|
|
114
|
+
// of six (number/boolean/date/richtext) since they have no configurable
|
|
115
|
+
// settings yet (empty settingsSchema). text and image gained real
|
|
116
|
+
// settings + settingsSchema in Session 69, proving the settings pipeline
|
|
117
|
+
// before Google Maps uses the exact same path.
|
|
118
|
+
// `preview` is aliased to the same `readOnly` view (Session 41) — used by
|
|
119
|
+
// the document type builder's per-field live preview while designing a
|
|
120
|
+
// field, deliberately not a `disabled`-attribute wrapper around `input`:
|
|
121
|
+
// the rich text view is TipTap/contenteditable, which a native `disabled`
|
|
122
|
+
// cascade doesn't stop from being edited, but readOnly views render inert
|
|
123
|
+
// markup regardless of datatype.
|
|
124
|
+
registerDataType(builtIn("text", "Text", "type", BUILT_IN_VALUE_SCHEMAS["com.kardalum.text"], {
|
|
125
|
+
input: TextInputView,
|
|
126
|
+
readOnly: TextReadOnlyView,
|
|
127
|
+
settings: TextSettingsView,
|
|
128
|
+
preview: TextReadOnlyView,
|
|
129
|
+
}, { settingsSchema: TEXT_SETTINGS_SCHEMA, defaultSettings: TEXT_DEFAULT_SETTINGS }));
|
|
130
|
+
registerDataType(builtIn("number", "Number", "hash", BUILT_IN_VALUE_SCHEMAS["com.kardalum.number"], {
|
|
131
|
+
input: NumberInputView,
|
|
132
|
+
readOnly: NumberReadOnlyView,
|
|
133
|
+
settings: NotImplementedView,
|
|
134
|
+
preview: NumberReadOnlyView,
|
|
135
|
+
}));
|
|
136
|
+
registerDataType(builtIn("boolean", "Boolean", "toggle-left", BUILT_IN_VALUE_SCHEMAS["com.kardalum.boolean"], {
|
|
137
|
+
input: BooleanInputView,
|
|
138
|
+
readOnly: BooleanReadOnlyView,
|
|
139
|
+
settings: NotImplementedView,
|
|
140
|
+
preview: BooleanReadOnlyView,
|
|
141
|
+
}));
|
|
142
|
+
registerDataType(builtIn("date", "Date", "calendar", BUILT_IN_VALUE_SCHEMAS["com.kardalum.date"], {
|
|
143
|
+
input: DateInputView,
|
|
144
|
+
readOnly: DateReadOnlyView,
|
|
145
|
+
settings: NotImplementedView,
|
|
146
|
+
preview: DateReadOnlyView,
|
|
147
|
+
}));
|
|
148
|
+
// Stores a media reference id — the Media Library item itself is
|
|
149
|
+
// fetched separately (GET /api/media/:id), not embedded in the field
|
|
150
|
+
// value. S234d gave the view a second way to fill that id: Choose opens
|
|
151
|
+
// the shared media picker over the library, beside the upload it has had
|
|
152
|
+
// since Session 42.
|
|
153
|
+
registerDataType(builtIn("image", "Image", "image", BUILT_IN_VALUE_SCHEMAS["com.kardalum.image"], {
|
|
154
|
+
input: ImageInputView,
|
|
155
|
+
readOnly: ImageReadOnlyView,
|
|
156
|
+
settings: ImageSettingsView,
|
|
157
|
+
preview: ImageReadOnlyView,
|
|
158
|
+
}, { settingsSchema: IMAGE_SETTINGS_SCHEMA, defaultSettings: IMAGE_DEFAULT_SETTINGS }));
|
|
159
|
+
// S234a: the file upload editor's field stores NO value of its own. The
|
|
160
|
+
// bytes, filename and size live on the media row, never in `data`, the
|
|
161
|
+
// same "no value" shape as com.kardalum.contentlist below (S232). Its
|
|
162
|
+
// schema is therefore `{ type: "null" }`, inlined here rather than added
|
|
163
|
+
// to built-in-value-schemas.ts (Task 4 of the media model plan doesn't
|
|
164
|
+
// touch that module: FileUploadSettingsSchema in @kardalum/api-schemas
|
|
165
|
+
// is already the single source of truth for its settings shape). Its
|
|
166
|
+
// settingsSchema is FILE_UPLOAD_SETTINGS_SCHEMA, the hand-kept mirror of
|
|
167
|
+
// that same Zod schema (Task 4c item 1) - not restated here a third time,
|
|
168
|
+
// so it cannot drift the way the original inlined object did. Its views
|
|
169
|
+
// read the current file from MediaFileProvider (file-upload-view.tsx)
|
|
170
|
+
// instead of usePluginValue(), and `preview` aliases to the same display
|
|
171
|
+
// as input/readOnly like every other built-in.
|
|
172
|
+
registerDataType(builtIn("fileupload", "File Upload", "upload", { type: "null" }, {
|
|
173
|
+
input: FileUploadInputView,
|
|
174
|
+
readOnly: FileUploadReadOnlyView,
|
|
175
|
+
settings: FileUploadSettingsView,
|
|
176
|
+
preview: FileUploadReadOnlyView,
|
|
177
|
+
}, {
|
|
178
|
+
settingsSchema: FILE_UPLOAD_SETTINGS_SCHEMA,
|
|
179
|
+
defaultSettings: { extensions: [] },
|
|
180
|
+
}));
|
|
181
|
+
// TipTap's native JSON document shape, provisional until the full
|
|
182
|
+
// content editor (Session 40/41) needs something more specific.
|
|
183
|
+
registerDataType(builtIn("richtext", "Rich Text", "file-text", BUILT_IN_VALUE_SCHEMAS["com.kardalum.richtext"], {
|
|
184
|
+
input: RichTextInputView,
|
|
185
|
+
readOnly: RichTextReadOnlyView,
|
|
186
|
+
settings: NotImplementedView,
|
|
187
|
+
preview: RichTextReadOnlyView,
|
|
188
|
+
}));
|
|
189
|
+
// S197 Task 8 (spec §7, D7): developer-authored raw HTML, distinct from
|
|
190
|
+
// the rich (TipTap) editor above — a plain string value edited in
|
|
191
|
+
// CodeMirror. `trusted` (default false) is the datatype's one setting;
|
|
192
|
+
// the render pipeline (apps/server/src/render/render-context.ts) is what
|
|
193
|
+
// actually enforces the posture this settings flag configures — this
|
|
194
|
+
// registration only carries the flag, it doesn't interpret it.
|
|
195
|
+
registerDataType(builtIn("html", "HTML", "code", BUILT_IN_VALUE_SCHEMAS["com.kardalum.html"], {
|
|
196
|
+
input: HtmlInputView,
|
|
197
|
+
readOnly: HtmlReadOnlyView,
|
|
198
|
+
settings: HtmlSettingsView,
|
|
199
|
+
preview: HtmlReadOnlyView,
|
|
200
|
+
}, { settingsSchema: HTML_SETTINGS_SCHEMA, defaultSettings: HTML_DEFAULT_SETTINGS }));
|
|
201
|
+
// S198 Task 3: the first composite built-in datatype — its value has two
|
|
202
|
+
// interdependent members ({ start, end }), which is exactly what forces
|
|
203
|
+
// the validate hook's shape to be honest: `path` names which sub-input is
|
|
204
|
+
// at fault, and `isEmpty` lets `required` mean "a range must be provided"
|
|
205
|
+
// without the webmaster knowing the value's internal shape (Task 1/2,
|
|
206
|
+
// datatype-validation.ts). No settings of its own, so `settings` follows
|
|
207
|
+
// the boolean/date/richtext precedent above (NotImplementedView); `preview`
|
|
208
|
+
// aliases to the read-only render like every other built-in.
|
|
209
|
+
//
|
|
210
|
+
// Its validate/isEmpty hooks are not written here: builtIn() looks them up
|
|
211
|
+
// by id in BUILT_IN_DATATYPE_VALIDATORS, the same way it looks up
|
|
212
|
+
// serialize, so a client-side consumer gets the exact contract the
|
|
213
|
+
// server's validator lookup uses from the one source of truth.
|
|
214
|
+
registerDataType(builtIn("daterange", "Date range", "calendar-range", BUILT_IN_VALUE_SCHEMAS["com.kardalum.daterange"], {
|
|
215
|
+
input: DateRangeInputView,
|
|
216
|
+
readOnly: DateRangeReadOnlyView,
|
|
217
|
+
settings: NotImplementedView,
|
|
218
|
+
preview: DateRangeReadOnlyView,
|
|
219
|
+
}));
|
|
220
|
+
// S232: the first built-in whose field stores NO value. It renders the
|
|
221
|
+
// children of the page being edited (GET /api/content/:id/list), so it
|
|
222
|
+
// reads a ContentHost rather than a plugin value, and `preview` is a
|
|
223
|
+
// separate static component instead of the usual alias to `readOnly`:
|
|
224
|
+
// the document type builder is designing a type, where no page and
|
|
225
|
+
// therefore no child list exists to fetch.
|
|
226
|
+
registerDataType(builtIn("contentlist", "Content List", "table", BUILT_IN_VALUE_SCHEMAS["com.kardalum.contentlist"], {
|
|
227
|
+
input: ContentListInputView,
|
|
228
|
+
readOnly: ContentListReadOnlyView,
|
|
229
|
+
settings: ContentListSettingsView,
|
|
230
|
+
preview: ContentListPreview,
|
|
231
|
+
}, { settingsSchema: CONTENT_LIST_SETTINGS_SCHEMA, defaultSettings: CONTENT_LIST_DEFAULT_SETTINGS }));
|
|
232
|
+
// S234c: the two rendition editors, which sit on a media document type
|
|
233
|
+
// rather than a page's. A crop stores the rectangle it last cut, as
|
|
234
|
+
// fractions of the source, so unlike the file upload above it has a real
|
|
235
|
+
// value schema and a real isEmpty. A thumbnail is automatic and stores
|
|
236
|
+
// nothing, so it takes the file upload's `{ type: "null" }` shape.
|
|
237
|
+
//
|
|
238
|
+
// Both carry REAL defaultSettings rather than the "settings stay `{}`
|
|
239
|
+
// until a webmaster edits them" convention, for the same reason the
|
|
240
|
+
// content list does: `ratio` and `longestEdge` are required members, so
|
|
241
|
+
// there is no such thing as an empty crop, and these are exactly the
|
|
242
|
+
// settings migration 0024 seeds into the two shipped rows. Their
|
|
243
|
+
// settingsSchemas are the hand-kept mirrors of the Zod schemas in
|
|
244
|
+
// @kardalum/api-schemas (built-in-settings-schemas.ts), which is what
|
|
245
|
+
// the server validates a settings save against.
|
|
246
|
+
registerDataType(builtIn("crop", "Crop", "crop", BUILT_IN_VALUE_SCHEMAS["com.kardalum.crop"], {
|
|
247
|
+
input: CropInputView,
|
|
248
|
+
readOnly: CropReadOnlyView,
|
|
249
|
+
settings: CropSettingsView,
|
|
250
|
+
preview: CropReadOnlyView,
|
|
251
|
+
}, { settingsSchema: CROP_SETTINGS_SCHEMA, defaultSettings: CROP_DEFAULT_SETTINGS }));
|
|
252
|
+
registerDataType(builtIn("thumbnail", "Thumbnail", "image-down", BUILT_IN_VALUE_SCHEMAS["com.kardalum.thumbnail"], {
|
|
253
|
+
input: ThumbnailInputView,
|
|
254
|
+
readOnly: ThumbnailReadOnlyView,
|
|
255
|
+
settings: ThumbnailSettingsView,
|
|
256
|
+
preview: ThumbnailReadOnlyView,
|
|
257
|
+
}, { settingsSchema: THUMBNAIL_SETTINGS_SCHEMA, defaultSettings: THUMBNAIL_DEFAULT_SETTINGS }));
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { PluginContributions, PluginManifest } from "./manifest.js";
|
|
2
|
+
/**
|
|
3
|
+
* What a plugin can do, computed from what it declares (S267, section 3,
|
|
4
|
+
* implemented by S268 Task 5).
|
|
5
|
+
*
|
|
6
|
+
* **A capability is derived, not declared.** The author writes
|
|
7
|
+
* `contributions` (concrete, carrying payloads), `assertions` (the short
|
|
8
|
+
* list of claims nothing can check) and `databaseCompatibility`. This
|
|
9
|
+
* module reads those and produces the list. One source of truth, three
|
|
10
|
+
* renderings: the install screen shows it as consent items, marketplace
|
|
11
|
+
* review reads it to decide whether a submission needs a person, and the
|
|
12
|
+
* generated reference page prints it. An author cannot claim a capability
|
|
13
|
+
* they do not have, and cannot quietly have one they did not claim.
|
|
14
|
+
*
|
|
15
|
+
* **Disclosure, not enforcement** (S267 section 7). Plugin backend code
|
|
16
|
+
* runs unsandboxed and in-process, so this list is what the author says
|
|
17
|
+
* and what review checks, never what the runtime confines. The mediated
|
|
18
|
+
* entries are genuinely enforced, because the host owns the decision. The
|
|
19
|
+
* promised ones are promises.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* `mediated`: the host bounds the outcome. It decides where the view
|
|
23
|
+
* renders, which gate the route sits behind, whether the action passes.
|
|
24
|
+
* Review of a mediated capability is automatic.
|
|
25
|
+
*
|
|
26
|
+
* `promised`: only the plugin's own code can honour it, so a person reads
|
|
27
|
+
* it against that code before the submission is approved.
|
|
28
|
+
*/
|
|
29
|
+
export type CapabilityMediation = "mediated" | "promised";
|
|
30
|
+
/**
|
|
31
|
+
* The part of the declaration that produced a capability which is safe to
|
|
32
|
+
* store and to render: never a live function, never a Zod schema.
|
|
33
|
+
*
|
|
34
|
+
* `details` is a list of plain identifying strings, not sentences, so each
|
|
35
|
+
* of the three readers can put its own heading in front of them and none
|
|
36
|
+
* has to re-derive them from the manifest. For an assertion the detail IS
|
|
37
|
+
* the author's reason, because a reason is the whole content of an
|
|
38
|
+
* assertion.
|
|
39
|
+
*/
|
|
40
|
+
export interface CapabilityPayload {
|
|
41
|
+
/** How many declarations produced this capability. 1 for a declaration
|
|
42
|
+
* that is not a list (themeTokens, an assertion, structured storage). */
|
|
43
|
+
count: number;
|
|
44
|
+
/** One line per declaration, in declaration order. Empty when the
|
|
45
|
+
* declaration carries no readable per-entry detail. */
|
|
46
|
+
details: string[];
|
|
47
|
+
}
|
|
48
|
+
export interface Capability {
|
|
49
|
+
/** Stable, dotted, and never reused for a different meaning. Persisted
|
|
50
|
+
* on a marketplace version row and rendered by three surfaces, so a
|
|
51
|
+
* renamed id is a data migration, not a cosmetic change. */
|
|
52
|
+
id: string;
|
|
53
|
+
payload: CapabilityPayload;
|
|
54
|
+
mediation: CapabilityMediation;
|
|
55
|
+
}
|
|
56
|
+
/** Whether this contribution kind sits behind a named permission action.
|
|
57
|
+
* Lives on CONTRIBUTION_RULES rather than in a separate list, because that
|
|
58
|
+
* record is compiler-total over the 19 contribution keys: a twentieth key
|
|
59
|
+
* cannot be added without classifying it here. */
|
|
60
|
+
export declare function isActionGated(key: keyof PluginContributions): boolean;
|
|
61
|
+
/** Every capability id this contract can produce, for the readers that
|
|
62
|
+
* need to be pinned against it (the marketplace's static mirror) and for
|
|
63
|
+
* the reference page S289 generates. */
|
|
64
|
+
export declare const CAPABILITY_IDS: readonly string[];
|
|
65
|
+
/**
|
|
66
|
+
* Compute a manifest's capability list.
|
|
67
|
+
*
|
|
68
|
+
* Accepts both a live `PluginManifest` and the redacted, JSON-safe summary
|
|
69
|
+
* kardalum plugin writes into a package's `manifest.json`, for the same
|
|
70
|
+
* reason `declaresClientBundle` does: the marketplace never executes
|
|
71
|
+
* plugin code, so the only manifest it can read is the redacted one, and
|
|
72
|
+
* the two sides of an install must not disagree about what a package
|
|
73
|
+
* declares.
|
|
74
|
+
*
|
|
75
|
+
* Defensive about its input rather than trusting it. It is handed parsed
|
|
76
|
+
* JSON from an artifact an author built, so a missing or wrongly-shaped
|
|
77
|
+
* field degrades to "declares nothing" for that field instead of throwing
|
|
78
|
+
* inside a review queue listing.
|
|
79
|
+
*/
|
|
80
|
+
export declare function deriveCapabilities(manifest: PluginManifest | Record<string, unknown> | null | undefined): Capability[];
|
|
81
|
+
/**
|
|
82
|
+
* Who is reading. The split is deliberate and predates this module: a
|
|
83
|
+
* shopper on a public listing is being told what the plugin does, while an
|
|
84
|
+
* operator at an install screen and a reviewer at a submission are being
|
|
85
|
+
* told what they are agreeing to. What is new is that there is one place
|
|
86
|
+
* the split is written down, instead of one hand-kept map per renderer.
|
|
87
|
+
*/
|
|
88
|
+
export type CapabilityAudience = "operator" | "shopper";
|
|
89
|
+
export type CapabilityLabels = Record<CapabilityAudience, string>;
|
|
90
|
+
export declare const CAPABILITY_LABELS: Record<string, CapabilityLabels>;
|
|
91
|
+
/**
|
|
92
|
+
* The heading a renderer puts in front of a capability's details.
|
|
93
|
+
*
|
|
94
|
+
* An id with no label prints as itself rather than being guessed at or
|
|
95
|
+
* humanised: the derivation is the only thing that mints ids, so an
|
|
96
|
+
* unlabelled one reaching a screen means this map has drifted from it, and
|
|
97
|
+
* showing the raw id says so out loud instead of inventing copy.
|
|
98
|
+
*/
|
|
99
|
+
export declare function capabilityLabel(id: string, audience: CapabilityAudience): string;
|