@kardalum/plugin-sdk 0.19.0 → 0.20.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 +211 -0
- package/README.md +19 -0
- package/dist/admin-section-registry.d.ts +16 -1
- package/dist/admin-section-registry.js +23 -0
- package/dist/built-in-editor-ids.d.ts +1 -1
- package/dist/built-in-editor-ids.js +2 -20
- package/dist/built-in-settings-schemas.d.ts +10 -0
- package/dist/built-in-settings-schemas.js +86 -0
- package/dist/built-in-value-schemas.js +35 -0
- package/dist/built-ins.js +38 -7
- package/dist/capabilities.d.ts +11 -1
- package/dist/capabilities.js +55 -3
- package/dist/cli.d.ts +66 -0
- package/dist/cli.js +22 -0
- package/dist/content-library.d.ts +85 -0
- package/dist/content-library.js +15 -0
- package/dist/content-picker/page-picker-sheet.d.ts +13 -0
- package/dist/content-picker/page-picker-sheet.js +105 -0
- package/dist/content-picker/page-tree.d.ts +25 -0
- package/dist/content-picker/page-tree.js +132 -0
- package/dist/data-type-plugin.d.ts +7 -1
- package/dist/datatype-validation.d.ts +4 -9
- package/dist/datatype-validation.js +139 -1
- package/dist/entitlement-entry.d.ts +1 -1
- package/dist/entitlement-entry.js +1 -1
- package/dist/entitlement-gate.d.ts +14 -0
- package/dist/entitlement-gate.js +64 -7
- package/dist/entitlement-plan.d.ts +6 -0
- package/dist/entitlement-plan.js +10 -0
- package/dist/entitlement-types.d.ts +36 -12
- package/dist/entitlement.d.ts +31 -4
- package/dist/entitlement.js +58 -17
- package/dist/hook-entry.d.ts +5 -0
- package/dist/hook-entry.js +30 -0
- package/dist/host-entry.d.ts +1 -1
- package/dist/host-entry.js +1 -1
- package/dist/index.d.ts +36 -4
- package/dist/index.js +50 -3
- package/dist/mail.d.ts +30 -0
- package/dist/mail.js +1 -0
- package/dist/manifest-entry.d.ts +29 -4
- package/dist/manifest-entry.js +39 -2
- package/dist/manifest-schema.d.ts +443 -29
- package/dist/manifest-schema.js +285 -23
- package/dist/manifest.d.ts +450 -51
- package/dist/manifest.js +1 -1
- package/dist/media/media-picker.js +31 -18
- package/dist/media/upload-error.d.ts +5 -1
- package/dist/media/upload-error.js +14 -2
- package/dist/media-library.d.ts +32 -0
- package/dist/media-library.js +15 -0
- package/dist/nested-field-host.d.ts +76 -0
- package/dist/nested-field-host.js +90 -0
- package/dist/notify.d.ts +12 -4
- package/dist/notify.js +1 -1
- package/dist/outbound.d.ts +47 -0
- package/dist/outbound.js +1 -0
- package/dist/plugin-context.d.ts +5 -0
- package/dist/plugin-screen-context.d.ts +112 -0
- package/dist/plugin-screen-context.js +26 -0
- package/dist/providers.d.ts +268 -0
- package/dist/providers.js +74 -0
- package/dist/read-all-pages.d.ts +5 -0
- package/dist/read-all-pages.js +3 -2
- package/dist/richtext/block-panel.js +11 -6
- package/dist/richtext/insert-menu.js +9 -6
- package/dist/richtext/style-listbox.js +6 -4
- package/dist/sdk-strings.d.ts +285 -0
- package/dist/sdk-strings.js +347 -0
- package/dist/sealing.d.ts +14 -0
- package/dist/sealing.js +1 -0
- package/dist/simple-storage-value-provider.js +24 -24
- package/dist/structured-storage-types.d.ts +309 -9
- package/dist/text-entry.d.ts +1 -0
- package/dist/text-entry.js +6 -0
- package/dist/tokens/tailwind-theme.css +5 -0
- package/dist/tokens/tokens.css +15 -3
- package/dist/tokens/tokens.json +8 -3
- package/dist/views/asset-view.js +4 -1
- package/dist/views/content-list-preview.js +3 -1
- package/dist/views/content-list-settings-view.js +11 -7
- package/dist/views/content-list-view.d.ts +5 -3
- package/dist/views/content-list-view.js +38 -34
- package/dist/views/content-picker-view.d.ts +3 -0
- package/dist/views/content-picker-view.js +143 -0
- package/dist/views/crop-view.d.ts +4 -6
- package/dist/views/crop-view.js +22 -13
- package/dist/views/date-range-view.js +4 -1
- package/dist/views/file-upload-view.d.ts +5 -7
- package/dist/views/file-upload-view.js +16 -7
- package/dist/views/group-view.d.ts +8 -0
- package/dist/views/group-view.js +123 -0
- package/dist/views/html-view.js +7 -6
- package/dist/views/image-view.js +37 -19
- package/dist/views/link-view.d.ts +3 -0
- package/dist/views/link-view.js +150 -0
- package/dist/views/options-list-view.d.ts +3 -0
- package/dist/views/options-list-view.js +104 -0
- package/dist/views/repeatable-list-view.d.ts +3 -0
- package/dist/views/repeatable-list-view.js +113 -0
- package/dist/views/rich-text-view.js +28 -13
- package/dist/views/suggest-key.d.ts +17 -0
- package/dist/views/suggest-key.js +55 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.d.ts +215 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.js +179 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.js +10 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +5 -0
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +7 -1
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +4 -2
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.js +27 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.d.ts +65 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.js +126 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +115 -3
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +58 -11
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +57 -2
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +137 -0
- package/node_modules/@kardalum/api-schemas/dist/content-path.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-path.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-search.schema.d.ts +50 -0
- package/node_modules/@kardalum/api-schemas/dist/content-search.schema.js +42 -0
- package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.d.ts +37 -0
- package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.js +19 -0
- package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/content.schema.d.ts +3 -0
- package/node_modules/@kardalum/api-schemas/dist/content.schema.js +10 -0
- package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.js +86 -0
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +10 -5
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +7 -4
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +25 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/data-type-issue.d.ts +35 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-issue.js +60 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +180 -15
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +41 -5
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.d.ts +24 -6
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +90 -5
- package/node_modules/@kardalum/api-schemas/dist/form-protection.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/form-protection.js +12 -0
- package/node_modules/@kardalum/api-schemas/dist/graphql-limits.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/graphql-limits.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/held-embed-words.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/held-embed-words.js +70 -0
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +117 -41
- package/node_modules/@kardalum/api-schemas/dist/index.js +89 -26
- package/node_modules/@kardalum/api-schemas/dist/install-sign-in-switched-off.schema.d.ts +9 -0
- package/node_modules/@kardalum/api-schemas/dist/install-sign-in-switched-off.schema.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/legal-anchors.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/legal-anchors.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/licensing.schema.d.ts +63 -0
- package/node_modules/@kardalum/api-schemas/dist/licensing.schema.js +54 -0
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.d.ts +224 -0
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.js +404 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-leaks.schema.d.ts +145 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-leaks.schema.js +154 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +312 -8
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +43 -3
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +15 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.d.ts +131 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.js +272 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.d.ts +84 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.js +138 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.d.ts +20 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.js +49 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.d.ts +211 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.js +424 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.d.ts +78 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.js +27 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.d.ts +70 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.js +43 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +22 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +13 -1
- package/node_modules/@kardalum/api-schemas/dist/media-move.schema.d.ts +75 -0
- package/node_modules/@kardalum/api-schemas/dist/media-move.schema.js +53 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.d.ts +2 -2
- package/node_modules/@kardalum/api-schemas/dist/media-reference.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference.js +55 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.d.ts +204 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.js +370 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.d.ts +53 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.js +284 -0
- package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +5 -5
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.d.ts +1 -2
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +1 -2
- package/node_modules/@kardalum/api-schemas/dist/notification-kinds.d.ts +145 -0
- package/node_modules/@kardalum/api-schemas/dist/notification-kinds.js +177 -0
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +258 -7
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +96 -5
- package/node_modules/@kardalum/api-schemas/dist/page-address.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/page-address.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/password-reset.schema.d.ts +34 -0
- package/node_modules/@kardalum/api-schemas/dist/password-reset.schema.js +60 -0
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +28 -3
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +55 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-caller.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-caller.js +16 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-cli-commands.d.ts +76 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-cli-commands.js +316 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.d.ts +42 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.js +74 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-data-type-configs.d.ts +31 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-data-type-configs.js +131 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +26 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +26 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +13 -5
- package/node_modules/@kardalum/api-schemas/dist/plugin-document-types.d.ts +228 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-document-types.js +41 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.js +55 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.d.ts +40 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.js +124 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-field-info.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-field-info.js +51 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-graphql-fields.d.ts +32 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-graphql-fields.js +102 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.d.ts +107 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.js +213 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-https-origin.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-https-origin.js +21 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +44 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +38 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +237 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +205 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +29 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +32 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +120 -14
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +335 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +242 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +16 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +34 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-ai.d.ts +40 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-ai.js +139 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +22 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +31 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-media-access.d.ts +25 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-media-access.js +43 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.d.ts +107 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.js +150 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-package-build.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-package-build.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.d.ts +310 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.js +430 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +2 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-sealed-values.d.ts +45 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-sealed-values.js +99 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-secrets.d.ts +68 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-secrets.js +114 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.d.ts +342 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.js +400 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.d.ts +180 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.js +612 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +47 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.d.ts +45 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.js +197 -0
- package/node_modules/@kardalum/api-schemas/dist/plural-rules.d.ts +9 -0
- package/node_modules/@kardalum/api-schemas/dist/plural-rules.js +41 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +100 -12
- package/node_modules/@kardalum/api-schemas/dist/refund-request.schema.d.ts +189 -0
- package/node_modules/@kardalum/api-schemas/dist/refund-request.schema.js +164 -0
- package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +4 -4
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +7 -3
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.d.ts +6 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.js +82 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-text.d.ts +66 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-text.js +497 -0
- package/node_modules/@kardalum/api-schemas/dist/sale-conditions.schema.d.ts +82 -0
- package/node_modules/@kardalum/api-schemas/dist/sale-conditions.schema.js +99 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +28 -0
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +91 -1
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +90 -8
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +59 -1
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +110 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +34 -2
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.d.ts +384 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.js +616 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +3 -3
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.js +26 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.d.ts +66 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.js +160 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.js +29 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +58 -1
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +34 -3
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +5 -1
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +4 -3
- package/node_modules/@kardalum/api-schemas/package.json +1 -0
- package/node_modules/@kardalum/design-tokens/dist/build-css.js +6 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +5 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +15 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +12 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +8 -3
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +21 -2
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +8 -2
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +17 -10
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +355 -22
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +2 -0
- package/node_modules/@kardalum/plugin-package/dist/cms-range.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/cms-range.js +353 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/ai-declarations.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/ai-declarations.js +26 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +3 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.js +34 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +2 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.js +27 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/graphql-fields.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/graphql-fields.js +22 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +47 -5
- package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.d.ts +27 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.js +95 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +9 -4
- package/node_modules/@kardalum/plugin-package/dist/delivery/plugin-settings.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/plugin-settings.js +68 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.js +298 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +25 -4
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +91 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.d.ts +6 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.js +140 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.js +36 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +21 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +10 -0
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +4 -2
- package/node_modules/@kardalum/plugin-package/dist/index.js +2 -1
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +75 -0
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +123 -0
- package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/tooltip.js +1 -2
- package/node_modules/@kardalum/ui/dist/components/truncated-text.d.ts +6 -1
- package/node_modules/@kardalum/ui/dist/components/truncated-text.js +5 -4
- package/package.json +12 -2
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { createContext, createElement, Fragment, useContext, useMemo } from "react";
|
|
2
|
+
// S366f spec D11: every word the SDK's built-in views show, in English, keyed
|
|
3
|
+
// `<view>.<name>`. The admin holds the same keys under the `sdk` subtree of its
|
|
4
|
+
// own locale files (a test there keeps its English deep-equal to this object)
|
|
5
|
+
// and renders SdkHostProvider once, so a built-in view mounted in the admin
|
|
6
|
+
// reads in the admin's language. Anywhere else (a plugin's own tests, the dev
|
|
7
|
+
// harness) there is no provider and the views answer from this object.
|
|
8
|
+
export const SDK_STRINGS_EN = {
|
|
9
|
+
"shared.unexpectedAnswer": "unexpected answer",
|
|
10
|
+
"shared.uploadFailed": "Upload failed ({{status}})",
|
|
11
|
+
"shared.mediaStoreSwitchedOff": "The media store was switched off while the file was saved. Upload it again.",
|
|
12
|
+
"text.placeholderLabel": "Placeholder text",
|
|
13
|
+
"text.maxLengthLabel": "Max length",
|
|
14
|
+
"text.maxLengthHelp": "Blocks typing past this many characters. Leave blank for no limit.",
|
|
15
|
+
"boolean.yes": "Yes",
|
|
16
|
+
"boolean.no": "No",
|
|
17
|
+
"dateRange.start": "Start",
|
|
18
|
+
"dateRange.end": "End",
|
|
19
|
+
"html.loading": "Loading code editor…",
|
|
20
|
+
"html.trustedLabel": "Trusted",
|
|
21
|
+
"html.trustedHelp": "Trusted HTML renders exactly as written: including scripts. Only enable for fields edited by people you'd let deploy code.",
|
|
22
|
+
"contentList.caption": "Children",
|
|
23
|
+
"contentList.pageOnly": "Shown on a page's editing screen.",
|
|
24
|
+
"contentList.propertyName": "Name",
|
|
25
|
+
"contentList.propertyId": "Id",
|
|
26
|
+
"contentList.propertyUrl": "URL",
|
|
27
|
+
"contentList.propertyStatus": "Status",
|
|
28
|
+
"contentList.propertyUpdatedAt": "Updated",
|
|
29
|
+
"contentList.propertyPublishedAt": "Published",
|
|
30
|
+
"contentList.statusDraft": "Draft",
|
|
31
|
+
"contentList.statusPublished": "Published",
|
|
32
|
+
"contentList.statusChanges": "Changes not published",
|
|
33
|
+
"contentList.loadError": "Could not load the children.",
|
|
34
|
+
"contentList.restrictedForYou": "Restricted for you",
|
|
35
|
+
"contentList.restricted": "Restricted",
|
|
36
|
+
"contentList.yes": "Yes",
|
|
37
|
+
"contentList.no": "No",
|
|
38
|
+
"contentList.valueRichText": "Rich text",
|
|
39
|
+
"contentList.valueImage": "Image",
|
|
40
|
+
"contentList.valueDateRange": "Date range",
|
|
41
|
+
"contentList.value": "Value",
|
|
42
|
+
"contentList.search": "Search by name",
|
|
43
|
+
"contentList.new": "New",
|
|
44
|
+
"contentList.retry": "Retry",
|
|
45
|
+
"contentList.loading": "Loading…",
|
|
46
|
+
"contentList.noMatches": "Nothing matches.",
|
|
47
|
+
"contentList.noChildren": "No children yet.",
|
|
48
|
+
"contentList.loadMore": "Load more",
|
|
49
|
+
"contentListSettings.fieldColumn": "{{alias}} ({{type}}: {{field}})",
|
|
50
|
+
"contentListSettings.label": "Label",
|
|
51
|
+
"contentListSettings.moveUp": "Move up",
|
|
52
|
+
"contentListSettings.moveUpNamed": "Move up {{column}}",
|
|
53
|
+
"contentListSettings.moveDown": "Move down",
|
|
54
|
+
"contentListSettings.moveDownNamed": "Move down {{column}}",
|
|
55
|
+
"contentListSettings.remove": "Remove",
|
|
56
|
+
"contentListSettings.removeNamed": "Remove {{column}}",
|
|
57
|
+
"contentListSettings.addColumn": "Add column",
|
|
58
|
+
"contentListSettings.chooseColumn": "Choose a column",
|
|
59
|
+
"contentListSettings.properties": "Properties",
|
|
60
|
+
"contentListSettings.fieldOption": "{{field}} ({{alias}})",
|
|
61
|
+
"contentListSettings.otherAlias": "Other alias",
|
|
62
|
+
"contentListSettings.add": "Add",
|
|
63
|
+
"crop.cannotCut": "This format cannot be cut.",
|
|
64
|
+
"crop.notCut": "Not cut yet.",
|
|
65
|
+
"crop.cutRegion": "Cut from a region {{width}} wide and {{height}} tall.",
|
|
66
|
+
"crop.ratio": "Ratio {{ratio}}",
|
|
67
|
+
"crop.noRatio": "No ratio set.",
|
|
68
|
+
"crop.savesAs": "Saves as the {{name}} rendition.",
|
|
69
|
+
"crop.maxWidth": "At most {{width}} px wide.",
|
|
70
|
+
"crop.ratioError": "A ratio looks like 3:4, with no leading zeros.",
|
|
71
|
+
"crop.maxWidthError": "A maximum width is a whole number of pixels, at least 1.",
|
|
72
|
+
"crop.ratioLabel": "Ratio",
|
|
73
|
+
"crop.required": "Required",
|
|
74
|
+
"crop.ratioHelp": "The shape the cropper locks to, width first, such as 3:4.",
|
|
75
|
+
"crop.maxWidthLabel": "Maximum width",
|
|
76
|
+
"crop.maxWidthHelp": "A ceiling in pixels. Leave blank for none: the cut then keeps the source region's own resolution, and it never enlarges.",
|
|
77
|
+
"thumbnail.cannotCut": "This format cannot be cut.",
|
|
78
|
+
"thumbnail.automatic": "Automatic",
|
|
79
|
+
"thumbnail.longestEdge": "Longest edge {{size}} px.",
|
|
80
|
+
"thumbnail.savesAs": "Saves as the {{name}} rendition.",
|
|
81
|
+
"thumbnail.longestEdgeError": "A longest edge is a whole number of pixels, at least 1.",
|
|
82
|
+
"thumbnail.longestEdgeLabel": "Longest edge",
|
|
83
|
+
"thumbnail.required": "Required",
|
|
84
|
+
"thumbnail.longestEdgeHelp": "The thumbnail's longer side in pixels. The shorter side follows the source's own shape.",
|
|
85
|
+
"fileUpload.size": "{{size}} bytes",
|
|
86
|
+
"fileUpload.accepts": "Accepts: {{extensions}}",
|
|
87
|
+
"fileUpload.acceptsAny": "Accepts any file type.",
|
|
88
|
+
"fileUpload.noFile": "No file yet.",
|
|
89
|
+
"fileUpload.extensionsLabel": "Accepted extensions",
|
|
90
|
+
"fileUpload.extensionsHelp": "Comma-separated extensions, no dot, e.g. jpg,png,pdf. Leave blank to accept any file.",
|
|
91
|
+
"fileUpload.maxSizeLabel": "Max file size (bytes)",
|
|
92
|
+
"fileUpload.maxSizeHelp": "e.g. 5000000 for ~5MB. Leave blank for no limit. Enforced on upload and on replace.",
|
|
93
|
+
"image.loadFailed": "Failed to load media ({{status}})",
|
|
94
|
+
"image.loading": "Loading…",
|
|
95
|
+
"image.cropOf": "{{crop}} of {{file}}",
|
|
96
|
+
"image.fullImage": "full image",
|
|
97
|
+
"image.tooLarge": "File is too large ({{size}} bytes): the configured limit is {{limit}} bytes.",
|
|
98
|
+
"image.choose": "Choose",
|
|
99
|
+
"image.upload": "Upload",
|
|
100
|
+
"image.uploading": "Uploading…",
|
|
101
|
+
"image.remove": "Remove",
|
|
102
|
+
"image.uploadAria": "Upload an image",
|
|
103
|
+
"image.asksFor": "This field asks for the {{shape}} rendition. An image without one is shown at full size.",
|
|
104
|
+
"image.documentTypesFailed": "Failed to load document types ({{detail}})",
|
|
105
|
+
"image.dataTypesFailed": "Failed to load data types ({{detail}})",
|
|
106
|
+
"image.loadingCrops": "Loading the crops your media types declare…",
|
|
107
|
+
"image.typesTruncated": "Only the first {{limit}} types could be read, so a crop declared beyond them is missing from this list.",
|
|
108
|
+
"image.acceptedTypesLabel": "Accepted file types",
|
|
109
|
+
"image.acceptedTypesHelp": "Comma-separated MIME types, e.g. image/png,image/jpeg. Leave blank to accept any image.",
|
|
110
|
+
"image.maxSizeLabel": "Max file size (bytes)",
|
|
111
|
+
"image.maxSizeHelp": "e.g. 5000000 for ~5MB. Leave blank for no limit.",
|
|
112
|
+
"image.cropLabel": "Crop",
|
|
113
|
+
"image.cropHelp": "The shape this field asks its picture for. A page gets that crop when the picture has one, and the full image when it does not.",
|
|
114
|
+
"image.noCrop": "No particular crop",
|
|
115
|
+
"image.undeclaredCrop": "{{shape}} (no media type declares this crop)",
|
|
116
|
+
"image.cropChoice": "{{caption}} {{shape}}",
|
|
117
|
+
"picker.root": "Root",
|
|
118
|
+
"picker.foldersFailed": "Failed to load media folders ({{detail}})",
|
|
119
|
+
"picker.foldersTruncated": "Only the first {{limit}} media folders could be read",
|
|
120
|
+
"picker.loadFailed": "Failed to load media ({{status}})",
|
|
121
|
+
"picker.title": "Choose an image",
|
|
122
|
+
"picker.description": "Showing images from your library.",
|
|
123
|
+
"picker.asksForCrop": "This field asks for a {{shape}} crop.",
|
|
124
|
+
"picker.location": "Folder location",
|
|
125
|
+
"picker.folders": "Folders",
|
|
126
|
+
"picker.loading": "Loading…",
|
|
127
|
+
"picker.nothingAccepted": "Nothing here is a kind this field accepts.",
|
|
128
|
+
"picker.emptyLibrary": "No images in the media library yet.",
|
|
129
|
+
"picker.emptyFolder": "No images in this folder yet.",
|
|
130
|
+
"picker.library": "Media library",
|
|
131
|
+
"picker.neverCut": "{{file}}: this format is never cut, so this field shows the full image.",
|
|
132
|
+
"picker.noCropYet": "{{file}}: no {{shape}} crop yet, so this field shows the full image.",
|
|
133
|
+
"picker.fullImage": "full image",
|
|
134
|
+
"picker.loadMore": "Load more",
|
|
135
|
+
"picker.altLabel": "Alt text",
|
|
136
|
+
"picker.altPlaceholder": "Describe this image for screen readers (optional)",
|
|
137
|
+
"picker.uploadPrompt": "Or {{action}}",
|
|
138
|
+
"picker.uploadInto": "upload into {{folder}}",
|
|
139
|
+
"picker.uploadingInto": "uploading into {{folder}}…",
|
|
140
|
+
"picker.uploadIntoAria": "Upload into {{folder}}",
|
|
141
|
+
"picker.cancel": "Cancel",
|
|
142
|
+
"picker.insert": "Insert",
|
|
143
|
+
"picker.close": "Close",
|
|
144
|
+
"richText.toolbar": "Formatting",
|
|
145
|
+
"richText.boldMark": "B",
|
|
146
|
+
"richText.bold": "Bold",
|
|
147
|
+
"richText.italicMark": "I",
|
|
148
|
+
"richText.italic": "Italic",
|
|
149
|
+
"richText.link": "Link",
|
|
150
|
+
"richText.linkUrl": "Link URL",
|
|
151
|
+
"richText.removeLink": "Remove link",
|
|
152
|
+
"richText.apply": "Apply",
|
|
153
|
+
"richText.h2Mark": "H2",
|
|
154
|
+
"richText.heading2": "Heading 2",
|
|
155
|
+
"richText.h3Mark": "H3",
|
|
156
|
+
"richText.heading3": "Heading 3",
|
|
157
|
+
"richText.quote": "Quote",
|
|
158
|
+
"richText.list": "List",
|
|
159
|
+
"richText.bulletedList": "Bulleted list",
|
|
160
|
+
"richText.style": "Style",
|
|
161
|
+
"richText.image": "Image",
|
|
162
|
+
"richText.block": "Block",
|
|
163
|
+
"richText.source": "Source",
|
|
164
|
+
"richText.toggleSource": "Toggle HTML source view",
|
|
165
|
+
"richText.editOnPage": "Edit on page",
|
|
166
|
+
"richText.sourceStale": "Content changed elsewhere. Leaving source view will overwrite it.",
|
|
167
|
+
"richText.sourceLabel": "HTML source",
|
|
168
|
+
"styleMenu.label": "Text styles",
|
|
169
|
+
"styleMenu.loading": "Loading…",
|
|
170
|
+
"styleMenu.none": "No theme styles declared",
|
|
171
|
+
"styleMenu.clear": "Clear style",
|
|
172
|
+
"blockMenu.label": "Blocks",
|
|
173
|
+
"blockMenu.loading": "Loading…",
|
|
174
|
+
"blockMenu.empty": "No blocks declared by your templates yet.",
|
|
175
|
+
"blockMenu.heading": "Blocks: from your templates",
|
|
176
|
+
"blockMenu.loadFailed": "Failed to load blocks ({{status}})",
|
|
177
|
+
"blockPanel.close": "Close",
|
|
178
|
+
"blockPanel.livePreview": "Live preview.",
|
|
179
|
+
"blockPanel.livePreviewBody": "This block is rendered by your own template on the server. What you see on the page is exactly what visitors will get.",
|
|
180
|
+
"blockPanel.removeBlock": "Remove block",
|
|
181
|
+
"blockPanel.done": "Done",
|
|
182
|
+
"blockPanel.change": "Change",
|
|
183
|
+
"blockPanel.noImage": "No image selected",
|
|
184
|
+
"blockPanel.partial": "partial: {{partial}}.liquid",
|
|
185
|
+
"blockPanel.fieldsUnavailable": "This block's fields couldn't be loaded. Its template declaration may be missing or the render service is unavailable.",
|
|
186
|
+
"blockPanel.previewLabel": "Preview: {{partial}}",
|
|
187
|
+
"blockPanel.previewLoading": "Loading preview…",
|
|
188
|
+
"blockPanel.previewFailed": "Failed to render preview ({{status}})",
|
|
189
|
+
"simpleStorage.loadFailed": "Failed to load plugin value ({{status}})",
|
|
190
|
+
"simpleStorage.saveFailed": "Failed to save plugin value ({{status}})",
|
|
191
|
+
"simpleStorage.roleCannotRead": "Could not save this field. Your role cannot view pages.",
|
|
192
|
+
"simpleStorage.roleCannotCreate": "Could not save this field. Your role cannot create pages.",
|
|
193
|
+
"simpleStorage.roleCannotUpdate": "Could not save this field. Your role cannot edit pages.",
|
|
194
|
+
"simpleStorage.roleCannotPublish": "Could not save this field. Your role cannot publish pages.",
|
|
195
|
+
"simpleStorage.roleCannotDelete": "Could not save this field. Your role cannot delete pages.",
|
|
196
|
+
"simpleStorage.restrictedRead": "Could not save this field. Viewing is restricted at {{place}} to: {{who}}.",
|
|
197
|
+
"simpleStorage.restrictedCreate": "Could not save this field. Creating pages is restricted at {{place}} to: {{who}}.",
|
|
198
|
+
"simpleStorage.restrictedUpdate": "Could not save this field. Editing is restricted at {{place}} to: {{who}}.",
|
|
199
|
+
"simpleStorage.restrictedPublish": "Could not save this field. Publishing is restricted at {{place}} to: {{who}}.",
|
|
200
|
+
"simpleStorage.restrictedDelete": "Could not save this field. Deleting is restricted at {{place}} to: {{who}}.",
|
|
201
|
+
"simpleStorage.pageYouCannotView": "a page you cannot view",
|
|
202
|
+
"simpleStorage.aUser": "a user",
|
|
203
|
+
"simpleStorage.adminsOnly": "admins only",
|
|
204
|
+
"simpleStorage.listSeparator": ", ",
|
|
205
|
+
};
|
|
206
|
+
/** Placeholder names an SDK string may not use. The admin hands a view's
|
|
207
|
+
* `vars` straight to i18next as its options, and i18next reads these names as
|
|
208
|
+
* instructions (which language, which namespace, a fallback text, an
|
|
209
|
+
* ordinal), not as values to put in a slot. `count` is the one exception
|
|
210
|
+
* with a rule: i18next picks a plural form by it, so it is allowed only in a
|
|
211
|
+
* plural form's key (`<name>_one`, `<name>_other`, ...), where choosing the
|
|
212
|
+
* form is what it is for. A test holds SDK_STRINGS_EN to this list. */
|
|
213
|
+
export const RESERVED_SDK_VARIABLES = [
|
|
214
|
+
"context",
|
|
215
|
+
"count",
|
|
216
|
+
"defaultValue",
|
|
217
|
+
"fallbackLng",
|
|
218
|
+
"interpolation",
|
|
219
|
+
"joinArrays",
|
|
220
|
+
"keySeparator",
|
|
221
|
+
"lng",
|
|
222
|
+
"lngs",
|
|
223
|
+
"ns",
|
|
224
|
+
"nsSeparator",
|
|
225
|
+
"ordinal",
|
|
226
|
+
"postProcess",
|
|
227
|
+
"replace",
|
|
228
|
+
"returnDetails",
|
|
229
|
+
"returnObjects",
|
|
230
|
+
];
|
|
231
|
+
/** `{{name}}` replaced from `vars` by one left-to-right scan (no pattern
|
|
232
|
+
* matching over the text). A name `vars` does not hold, and a `{{` that is
|
|
233
|
+
* never closed, stay as they are. */
|
|
234
|
+
export function interpolateSdkString(template, vars) {
|
|
235
|
+
if (!vars)
|
|
236
|
+
return template;
|
|
237
|
+
let out = "";
|
|
238
|
+
let at = 0;
|
|
239
|
+
while (at < template.length) {
|
|
240
|
+
const open = template.indexOf("{{", at);
|
|
241
|
+
if (open === -1)
|
|
242
|
+
break;
|
|
243
|
+
const close = template.indexOf("}}", open + 2);
|
|
244
|
+
if (close === -1)
|
|
245
|
+
break;
|
|
246
|
+
const name = template.slice(open + 2, close).trim();
|
|
247
|
+
out += template.slice(at, open);
|
|
248
|
+
out += Object.prototype.hasOwnProperty.call(vars, name) ? String(vars[name]) : template.slice(open, close + 2);
|
|
249
|
+
at = close + 2;
|
|
250
|
+
}
|
|
251
|
+
return out + template.slice(at);
|
|
252
|
+
}
|
|
253
|
+
function englishTranslate(key, vars) {
|
|
254
|
+
const template = SDK_STRINGS_EN[key] ?? key;
|
|
255
|
+
return interpolateSdkString(template, vars);
|
|
256
|
+
}
|
|
257
|
+
const SdkHostContext = createContext(null);
|
|
258
|
+
/** Rendered once by the host admin, above every view it mounts. */
|
|
259
|
+
export function SdkHostProvider({ t, dir, locale, lang, children }) {
|
|
260
|
+
const value = useMemo(() => ({ t, dir, locale, lang }), [t, dir, locale, lang]);
|
|
261
|
+
return createElement(SdkHostContext.Provider, { value }, children);
|
|
262
|
+
}
|
|
263
|
+
/** The admin's language for a view's chrome: undefined outside a host, or
|
|
264
|
+
* when the host did not set one. */
|
|
265
|
+
export function useAdminLanguage() {
|
|
266
|
+
return useContext(SdkHostContext)?.lang;
|
|
267
|
+
}
|
|
268
|
+
/** The attributes a view puts on its chrome root (S366f D10): the admin's
|
|
269
|
+
* direction always, and its language when the host gave one. A field's
|
|
270
|
+
* controls are the admin's words, so they read in the admin's order and
|
|
271
|
+
* voice even inside a field wrapped in the content's language. */
|
|
272
|
+
export function useAdminChromeProps() {
|
|
273
|
+
const dir = useAdminDirection();
|
|
274
|
+
const lang = useAdminLanguage();
|
|
275
|
+
return lang === undefined ? { dir } : { dir, lang };
|
|
276
|
+
}
|
|
277
|
+
const ContentLanguageContext = createContext(null);
|
|
278
|
+
/** Rendered by the host around one field, with the language its value is
|
|
279
|
+
* written in. A view's typing surface nested inside its chrome (a search box,
|
|
280
|
+
* the media picker's alt text) reads it back through useContentTypingProps(). */
|
|
281
|
+
export function SdkContentLanguageProvider({ lang, dir, children }) {
|
|
282
|
+
const value = useMemo(() => ({ lang, dir }), [lang, dir]);
|
|
283
|
+
return createElement(ContentLanguageContext.Provider, { value }, children);
|
|
284
|
+
}
|
|
285
|
+
/** The field's content language, or undefined outside a host that set one. */
|
|
286
|
+
export function useContentLanguage() {
|
|
287
|
+
return useContext(ContentLanguageContext) ?? undefined;
|
|
288
|
+
}
|
|
289
|
+
/** The attributes a typing surface inside a view's chrome takes: the
|
|
290
|
+
* content's `lang` and `dir`, or nothing (inherit) when no content language
|
|
291
|
+
* is known. */
|
|
292
|
+
export function useContentTypingProps() {
|
|
293
|
+
const content = useContentLanguage();
|
|
294
|
+
return content ? { lang: content.lang, dir: content.dir } : {};
|
|
295
|
+
}
|
|
296
|
+
/** The host's formatting locale: undefined outside a host, or when the host
|
|
297
|
+
* did not set one, which is what `Intl` and `toLocaleString` read as "the
|
|
298
|
+
* browser's own". */
|
|
299
|
+
export function useSdkLocale() {
|
|
300
|
+
return useContext(SdkHostContext)?.locale;
|
|
301
|
+
}
|
|
302
|
+
/** The words of the SDK's own views: the host's, or English outside one. */
|
|
303
|
+
export function useSdkString() {
|
|
304
|
+
return useContext(SdkHostContext)?.t ?? englishTranslate;
|
|
305
|
+
}
|
|
306
|
+
/** The admin's direction, for chrome around content (a toolbar, a picker's
|
|
307
|
+
* controls) and for a plugin's own Radix roots, which cannot see the admin's
|
|
308
|
+
* direction provider. Outside a host, the document's own direction. */
|
|
309
|
+
export function useAdminDirection() {
|
|
310
|
+
const host = useContext(SdkHostContext);
|
|
311
|
+
if (host)
|
|
312
|
+
return host.dir;
|
|
313
|
+
if (typeof document !== "undefined" && document.documentElement.dir === "rtl")
|
|
314
|
+
return "rtl";
|
|
315
|
+
return "ltr";
|
|
316
|
+
}
|
|
317
|
+
// A private-use pair marks where a node goes: no translation contains it, so
|
|
318
|
+
// the split below cannot be fooled by the sentence's own text.
|
|
319
|
+
const NODE_OPEN = "";
|
|
320
|
+
const NODE_CLOSE = "";
|
|
321
|
+
/** A sentence with React nodes in it (a name set in a code face, a button
|
|
322
|
+
* inside a sentence): the host translates the whole sentence, then the nodes
|
|
323
|
+
* are put back where the translation placed them. */
|
|
324
|
+
export function sdkStringWithNodes(s, key, nodes, vars = {}) {
|
|
325
|
+
const marked = { ...vars };
|
|
326
|
+
for (const name of Object.keys(nodes))
|
|
327
|
+
marked[name] = NODE_OPEN + name + NODE_CLOSE;
|
|
328
|
+
const text = s(key, marked);
|
|
329
|
+
const parts = [];
|
|
330
|
+
let at = 0;
|
|
331
|
+
while (at < text.length) {
|
|
332
|
+
const open = text.indexOf(NODE_OPEN, at);
|
|
333
|
+
if (open === -1)
|
|
334
|
+
break;
|
|
335
|
+
const close = text.indexOf(NODE_CLOSE, open + 1);
|
|
336
|
+
if (close === -1)
|
|
337
|
+
break;
|
|
338
|
+
const name = text.slice(open + 1, close);
|
|
339
|
+
if (text.slice(at, open))
|
|
340
|
+
parts.push(text.slice(at, open));
|
|
341
|
+
parts.push(createElement(Fragment, { key: `${name}-${open}` }, nodes[name] ?? null));
|
|
342
|
+
at = close + 1;
|
|
343
|
+
}
|
|
344
|
+
if (text.slice(at))
|
|
345
|
+
parts.push(text.slice(at));
|
|
346
|
+
return parts;
|
|
347
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PluginSealedValueKind, SealingRefusalReason } from "@kardalum/api-schemas";
|
|
2
|
+
export type { SealingRefusalReason };
|
|
3
|
+
/** One kind of `contributions.sealedValues`: `id` (the settings id rule), `label`, and
|
|
4
|
+
* `leavesServer: true` for a kind whose sealed text is handed to visitors. */
|
|
5
|
+
export type SealedValueContribution = PluginSealedValueKind;
|
|
6
|
+
export interface PluginSealing {
|
|
7
|
+
/** Seals `value` (1 to 4,096 UTF-8 bytes) of a declared `kind` for `recordKey` (1 to 200 printable
|
|
8
|
+
* ASCII characters). Throws `SealingRefusedError`: `unknownKind`, `invalid` or `inactive`. */
|
|
9
|
+
seal(kind: string, recordKey: string, value: string): Promise<string>;
|
|
10
|
+
/** The value a sealed text holds, or null when it does not open (another plugin, kind or record
|
|
11
|
+
* key, a changed server key, or text that was never sealed). Throws only `SealingRefusedError`
|
|
12
|
+
* for an undeclared kind, a bad record key or a plugin that is no longer active. */
|
|
13
|
+
open(kind: string, recordKey: string, sealed: string): Promise<string | null>;
|
|
14
|
+
}
|
package/dist/sealing.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,40 +1,39 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
import { PluginValueProvider, usePluginApi } from "./plugin-context.js";
|
|
4
|
+
import { useSdkString } from "./sdk-strings.js";
|
|
4
5
|
// S278b (D5): the node refusal a refused write answers (403): the refused
|
|
5
6
|
// action, and the entry that decided, labelled. Its page is named only when
|
|
6
7
|
// the server sent its name, which is only when the person may view it.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"content.
|
|
11
|
-
"content.
|
|
12
|
-
"content.
|
|
8
|
+
// M33 K35: every word is an SDK string, so inside the admin the refusal reads
|
|
9
|
+
// in the admin's language, from its locale files.
|
|
10
|
+
const ACTION_KEYS = {
|
|
11
|
+
"content.read": { roleCannot: "simpleStorage.roleCannotRead", restricted: "simpleStorage.restrictedRead" },
|
|
12
|
+
"content.create": { roleCannot: "simpleStorage.roleCannotCreate", restricted: "simpleStorage.restrictedCreate" },
|
|
13
|
+
"content.update": { roleCannot: "simpleStorage.roleCannotUpdate", restricted: "simpleStorage.restrictedUpdate" },
|
|
14
|
+
"content.publish": { roleCannot: "simpleStorage.roleCannotPublish", restricted: "simpleStorage.restrictedPublish" },
|
|
15
|
+
"content.delete": { roleCannot: "simpleStorage.roleCannotDelete", restricted: "simpleStorage.restrictedDelete" },
|
|
13
16
|
};
|
|
14
|
-
|
|
15
|
-
"content.read": "view",
|
|
16
|
-
"content.create": "create",
|
|
17
|
-
"content.update": "edit",
|
|
18
|
-
"content.publish": "publish",
|
|
19
|
-
"content.delete": "delete",
|
|
20
|
-
};
|
|
21
|
-
function refusalSentence(body) {
|
|
17
|
+
function refusalSentence(body, t) {
|
|
22
18
|
if (!body || typeof body !== "object")
|
|
23
19
|
return null;
|
|
24
20
|
const { action, access } = body;
|
|
25
|
-
if (typeof action !== "string" || !(action
|
|
21
|
+
if (typeof action !== "string" || !Object.prototype.hasOwnProperty.call(ACTION_KEYS, action) || !access || typeof access !== "object")
|
|
26
22
|
return null;
|
|
23
|
+
const keys = ACTION_KEYS[action];
|
|
27
24
|
const entry = access.decidedAt ?? null;
|
|
28
|
-
if (access.reason === "role-lacks-action" || entry === null)
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
const place = entry.name ?? entry.path?.split("/").filter(Boolean).pop() ?? "a page you cannot view";
|
|
25
|
+
if (access.reason === "role-lacks-action" || entry === null)
|
|
26
|
+
return t(keys.roleCannot);
|
|
27
|
+
const place = entry.name ?? entry.path?.split("/").filter(Boolean).pop() ?? t("simpleStorage.pageYouCannotView");
|
|
32
28
|
// A user the server does not name (no display name; the email is never
|
|
33
29
|
// sent) is "a user"; a role keeps its id when its label is missing.
|
|
34
30
|
const labels = (entry.grants ?? [])
|
|
35
|
-
.map((grant) => grant.label || (grant.subjectKind === "user" ? "
|
|
31
|
+
.map((grant) => grant.label || (grant.subjectKind === "user" ? t("simpleStorage.aUser") : grant.subjectId))
|
|
36
32
|
.filter(Boolean);
|
|
37
|
-
return
|
|
33
|
+
return t(keys.restricted, {
|
|
34
|
+
place,
|
|
35
|
+
who: labels.length > 0 ? labels.join(t("simpleStorage.listSeparator")) : t("simpleStorage.adminsOnly"),
|
|
36
|
+
});
|
|
38
37
|
}
|
|
39
38
|
// The only SDK code path that ever hits /api/plugins/:pluginId/storage/...
|
|
40
39
|
// (SimpleStorageAPI, Session 68): a plugin's view code (and usePluginValue()
|
|
@@ -51,6 +50,7 @@ function refusalSentence(body) {
|
|
|
51
50
|
// {value: null} is the normal "never set" state, not an error.
|
|
52
51
|
export function SimpleStorageValueProvider({ contentId, fieldId, pluginId, children, }) {
|
|
53
52
|
const fetchApi = usePluginApi();
|
|
53
|
+
const t = useSdkString();
|
|
54
54
|
const [value, setValue] = useState(null);
|
|
55
55
|
const [error, setError] = useState(null);
|
|
56
56
|
const path = `/api/plugins/${pluginId}/storage/${contentId}/${fieldId}`;
|
|
@@ -60,7 +60,7 @@ export function SimpleStorageValueProvider({ contentId, fieldId, pluginId, child
|
|
|
60
60
|
fetchApi(path)
|
|
61
61
|
.then(async (response) => {
|
|
62
62
|
if (!response.ok)
|
|
63
|
-
throw new Error(
|
|
63
|
+
throw new Error(t("simpleStorage.loadFailed", { status: response.status }));
|
|
64
64
|
const body = (await response.json());
|
|
65
65
|
if (!cancelled)
|
|
66
66
|
setValue(body.value);
|
|
@@ -83,8 +83,8 @@ export function SimpleStorageValueProvider({ contentId, fieldId, pluginId, child
|
|
|
83
83
|
.then(async (response) => {
|
|
84
84
|
if (!response.ok) {
|
|
85
85
|
// S278b (D5): a restriction's refusal says why, from its body.
|
|
86
|
-
const refusal = response.status === 403 ? refusalSentence(await response.json().catch(() => null)) : null;
|
|
87
|
-
throw new Error(refusal ??
|
|
86
|
+
const refusal = response.status === 403 ? refusalSentence(await response.json().catch(() => null), t) : null;
|
|
87
|
+
throw new Error(refusal ?? t("simpleStorage.saveFailed", { status: response.status }));
|
|
88
88
|
}
|
|
89
89
|
setError(null);
|
|
90
90
|
})
|