@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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
+
import type { PanelProposeRefusal, PluginFieldInfo } from "@kardalum/api-schemas";
|
|
2
3
|
/**
|
|
3
4
|
* Translates one of the plugin's own strings (S290): a key from its
|
|
4
5
|
* locales/<language>.json, in the admin's language, falling back to the
|
|
@@ -6,6 +7,13 @@ import { type ReactNode } from "react";
|
|
|
6
7
|
* is replaced by `values.name`. The result is plain text: render it as a
|
|
7
8
|
* child. The host's own strings and other plugins' strings are never
|
|
8
9
|
* reachable through it.
|
|
10
|
+
*
|
|
11
|
+
* M33 K37: when `values.count` is a finite number, `t(key, { count })`
|
|
12
|
+
* reads the plural form the admin's language uses for that count:
|
|
13
|
+
* `key_<category>` (`zero`, `one`, `two`, `few`, `many` or `other`, by the
|
|
14
|
+
* language's CLDR rules), then that language's `key_other`, then English's
|
|
15
|
+
* form, then the key itself. `{{count}}` is printed in the admin's number
|
|
16
|
+
* style (`1,234` in English, `1.234` in German).
|
|
9
17
|
*/
|
|
10
18
|
export type PluginTranslate = (key: string, values?: Record<string, string | number>) => string;
|
|
11
19
|
/**
|
|
@@ -24,6 +32,10 @@ export type PluginTranslate = (key: string, values?: Record<string, string | num
|
|
|
24
32
|
* - `kind: "widget"`: a dashboard widget on the admin's Home page (S313b).
|
|
25
33
|
* `widgetId` is the widget's id; `sectionId` and `entryId` are null,
|
|
26
34
|
* because a widget belongs to no section.
|
|
35
|
+
* - `kind: "editorPanel"`: a panel beside an existing page's editor (M32 F3).
|
|
36
|
+
* `panelId` is the panel's id; `sectionId` and `entryId` are null.
|
|
37
|
+
* - `kind: "treeAction"`: a dialog opened from a content tree row's menu
|
|
38
|
+
* (M32 F3). `actionId` is the action's id; `sectionId` and `entryId` are null.
|
|
27
39
|
*/
|
|
28
40
|
export interface PluginScreenContext {
|
|
29
41
|
pluginId: string;
|
|
@@ -36,6 +48,16 @@ export interface PluginScreenContext {
|
|
|
36
48
|
sectionId: null;
|
|
37
49
|
entryId: null;
|
|
38
50
|
widgetId: string;
|
|
51
|
+
} | {
|
|
52
|
+
kind: "editorPanel";
|
|
53
|
+
sectionId: null;
|
|
54
|
+
entryId: null;
|
|
55
|
+
panelId: string;
|
|
56
|
+
} | {
|
|
57
|
+
kind: "treeAction";
|
|
58
|
+
sectionId: null;
|
|
59
|
+
entryId: null;
|
|
60
|
+
actionId: string;
|
|
39
61
|
};
|
|
40
62
|
/** The admin's active language, for formatting dates and numbers. A
|
|
41
63
|
* screen's words come from `t`. */
|
|
@@ -53,6 +75,15 @@ export interface PluginScreenContext {
|
|
|
53
75
|
* development, naming the plugin and the target.
|
|
54
76
|
*/
|
|
55
77
|
navigate: (entryId: string | null) => void;
|
|
78
|
+
/**
|
|
79
|
+
* M33 K6: the row a notification link opened this screen at (the link's `item`, from the
|
|
80
|
+
* screen's `?item=` query), or null. It is only ever 1 to 100 letters, digits, "-" and "_";
|
|
81
|
+
* anything else in the address reads null, so a screen may look the row up with it as it is.
|
|
82
|
+
* Null for a dashboard widget, an editor panel and a tree action, which no link opens. The
|
|
83
|
+
* admin always sets it; it is optional in the type only so that a context a plugin's own test
|
|
84
|
+
* builds by hand stays valid.
|
|
85
|
+
*/
|
|
86
|
+
item?: string | null;
|
|
56
87
|
}
|
|
57
88
|
/**
|
|
58
89
|
* Supplied by the host around any view that reads the plugin's own strings
|
|
@@ -79,3 +110,84 @@ export declare function usePluginScreen(): PluginScreenContext;
|
|
|
79
110
|
* a PluginTranslateProvider it is a host wiring bug, so it throws.
|
|
80
111
|
*/
|
|
81
112
|
export declare function usePluginTranslate(): PluginTranslate;
|
|
113
|
+
/** M32 F3: the page a panel or a tree action is shown for. */
|
|
114
|
+
export interface EditorPanelNode {
|
|
115
|
+
id: string;
|
|
116
|
+
path: string;
|
|
117
|
+
name: string;
|
|
118
|
+
parentId: string | null;
|
|
119
|
+
documentTypeId: string;
|
|
120
|
+
/** The document type's name; empty while the admin has not read the page's document type, and
|
|
121
|
+
* only unfiltered panels and actions show then. */
|
|
122
|
+
documentType: string;
|
|
123
|
+
}
|
|
124
|
+
/** M33 K28: the page an editor panel is shown for, with its address. A tree action's node has no address. */
|
|
125
|
+
export interface EditorPanelPage extends EditorPanelNode {
|
|
126
|
+
/** The page's address in the panel's language (the one the editor's save bar and preview link
|
|
127
|
+
* use), or null when the page has no address in that language. */
|
|
128
|
+
url: string | null;
|
|
129
|
+
}
|
|
130
|
+
/** M32 F3 (D2, D4): what an editor panel reads through usePluginEditorPanel(). `values` are the
|
|
131
|
+
* editor's current field values for `culture`, handed over after the editor has been still for 300 ms. */
|
|
132
|
+
export interface EditorPanelContext {
|
|
133
|
+
node: EditorPanelPage;
|
|
134
|
+
culture: string;
|
|
135
|
+
values: Readonly<Record<string, unknown>>;
|
|
136
|
+
/** M33 K28, K21: every field of the page's document type, in order, with what a Group or a list
|
|
137
|
+
* holds (`group`, `list`; frozen at every level), private ones included
|
|
138
|
+
* (the editor sees them; only a server-side page render drops private fields). Frozen. A field's
|
|
139
|
+
* `dataType` is `""` when it is not known yet (the editor is still loading the site's data types)
|
|
140
|
+
* or cannot be resolved in this admin; a panel matching on it should treat `""` as unknown. */
|
|
141
|
+
fields: ReadonlyArray<Readonly<PluginFieldInfo>>;
|
|
142
|
+
latestVersion: number;
|
|
143
|
+
publishedVersion: number | null;
|
|
144
|
+
/** Whether the signed-in user may change this page. */
|
|
145
|
+
canUpdate: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* M32 F4c (D11): proposes values for the page's fields, by field id. The editor checks each one
|
|
148
|
+
* (a field of this page, the panel's document types, `canUpdate`, not read-only, plain JSON of at
|
|
149
|
+
* most 256 KiB, the field's own rules) and puts the accepted values into the form as unsaved
|
|
150
|
+
* changes the person reviews, may undo, and saves themselves. Nothing is saved or published, and
|
|
151
|
+
* the page's name is never changed. At most 20 fields a call; the rest are refused. With
|
|
152
|
+
* `{ skipFocused: true }` the field the person is typing in is refused with `focused`.
|
|
153
|
+
*/
|
|
154
|
+
propose(changes: Readonly<Record<string, unknown>>, options?: PanelProposeOptions): ProposeResult;
|
|
155
|
+
}
|
|
156
|
+
/** M32 I3 (B4): with skipFocused, the field the person is in is refused with `focused`, so a panel never writes over typing. */
|
|
157
|
+
export interface PanelProposeOptions {
|
|
158
|
+
skipFocused?: boolean;
|
|
159
|
+
}
|
|
160
|
+
/** M32 F4c (D11): what `propose` did with each field: the ids put into the form, and those refused with why. */
|
|
161
|
+
export interface ProposeResult {
|
|
162
|
+
applied: string[];
|
|
163
|
+
refused: Array<{
|
|
164
|
+
fieldId: string;
|
|
165
|
+
reason: PanelProposeRefusal;
|
|
166
|
+
}>;
|
|
167
|
+
}
|
|
168
|
+
/** M32 F3 (D8, D10): what a tree action's view reads through usePluginTreeAction(). `close` shuts the
|
|
169
|
+
* dialog; `refresh: true` asks for one reload of the row's parent list, and `message` (at most 200
|
|
170
|
+
* characters) is shown as a notice. */
|
|
171
|
+
export interface TreeActionContext {
|
|
172
|
+
node: EditorPanelNode & {
|
|
173
|
+
childCount: number;
|
|
174
|
+
};
|
|
175
|
+
close(result?: {
|
|
176
|
+
refresh?: boolean;
|
|
177
|
+
message?: string;
|
|
178
|
+
}): void;
|
|
179
|
+
}
|
|
180
|
+
/** Supplied by the host around an editor panel's view, inside its PluginScreenProvider. */
|
|
181
|
+
export declare function EditorPanelProvider({ value, children }: {
|
|
182
|
+
value: EditorPanelContext;
|
|
183
|
+
children: ReactNode;
|
|
184
|
+
}): import("react").JSX.Element;
|
|
185
|
+
/** Supplied by the host around a tree action's view, inside its PluginScreenProvider. */
|
|
186
|
+
export declare function TreeActionProvider({ value, children }: {
|
|
187
|
+
value: TreeActionContext;
|
|
188
|
+
children: ReactNode;
|
|
189
|
+
}): import("react").JSX.Element;
|
|
190
|
+
/** The page an editor panel is shown for. Outside a host-rendered EditorPanelProvider it is a host wiring bug, so it throws. */
|
|
191
|
+
export declare function usePluginEditorPanel(): EditorPanelContext;
|
|
192
|
+
/** The tree row a tree action was opened from. Outside a host-rendered TreeActionProvider it throws. */
|
|
193
|
+
export declare function usePluginTreeAction(): TreeActionContext;
|
|
@@ -39,3 +39,29 @@ export function usePluginTranslate() {
|
|
|
39
39
|
}
|
|
40
40
|
return t;
|
|
41
41
|
}
|
|
42
|
+
const EditorPanelReactContext = createContext(null);
|
|
43
|
+
const TreeActionReactContext = createContext(null);
|
|
44
|
+
/** Supplied by the host around an editor panel's view, inside its PluginScreenProvider. */
|
|
45
|
+
export function EditorPanelProvider({ value, children }) {
|
|
46
|
+
return _jsx(EditorPanelReactContext.Provider, { value: value, children: children });
|
|
47
|
+
}
|
|
48
|
+
/** Supplied by the host around a tree action's view, inside its PluginScreenProvider. */
|
|
49
|
+
export function TreeActionProvider({ value, children }) {
|
|
50
|
+
return _jsx(TreeActionReactContext.Provider, { value: value, children: children });
|
|
51
|
+
}
|
|
52
|
+
/** The page an editor panel is shown for. Outside a host-rendered EditorPanelProvider it is a host wiring bug, so it throws. */
|
|
53
|
+
export function usePluginEditorPanel() {
|
|
54
|
+
const ctx = useContext(EditorPanelReactContext);
|
|
55
|
+
if (!ctx) {
|
|
56
|
+
throw new Error("usePluginEditorPanel must be called from a view rendered inside an EditorPanelProvider");
|
|
57
|
+
}
|
|
58
|
+
return ctx;
|
|
59
|
+
}
|
|
60
|
+
/** The tree row a tree action was opened from. Outside a host-rendered TreeActionProvider it throws. */
|
|
61
|
+
export function usePluginTreeAction() {
|
|
62
|
+
const ctx = useContext(TreeActionReactContext);
|
|
63
|
+
if (!ctx) {
|
|
64
|
+
throw new Error("usePluginTreeAction must be called from a view rendered inside a TreeActionProvider");
|
|
65
|
+
}
|
|
66
|
+
return ctx;
|
|
67
|
+
}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import type { MailPurpose, PluginLabel, PluginSettingValue, ProtectionTellWord, SignInClientAuth, SignInIcon, SignInProtocol } from "@kardalum/api-schemas";
|
|
2
|
+
import type { Entitlement } from "./entitlement-types.js";
|
|
3
|
+
import type { ScopedStructuredStorage } from "./structured-storage-types.js";
|
|
4
|
+
import type { PluginSealing } from "./sealing.js";
|
|
5
|
+
export type { SignInIcon } from "@kardalum/api-schemas";
|
|
6
|
+
/** D12: what `context.secrets` offers plugin server code. Only a declared name is readable. */
|
|
7
|
+
export interface PluginSecrets {
|
|
8
|
+
/** The stored value, or null when the person has not entered it (or it can no longer be decrypted). An undeclared name throws PluginSecretUndeclaredError. */
|
|
9
|
+
get(name: string): Promise<string | null>;
|
|
10
|
+
}
|
|
11
|
+
/** D12: thrown by `context.secrets.get` for a name the manifest does not declare. */
|
|
12
|
+
export declare class PluginSecretUndeclaredError extends Error {
|
|
13
|
+
constructor(message: string);
|
|
14
|
+
}
|
|
15
|
+
/** True for a PluginSecretUndeclaredError from ANY copy of this SDK: a plugin bundles its own copy, so `instanceof` would miss the host's class. */
|
|
16
|
+
export declare function isPluginSecretUndeclaredError(value: unknown): value is PluginSecretUndeclaredError;
|
|
17
|
+
/**
|
|
18
|
+
* M32 F4d (D7): what `context.settings` offers plugin server code: the values a person set for the
|
|
19
|
+
* plugin's declared settings fields, each its default until set. A secret field is read with
|
|
20
|
+
* `context.secrets.get`, never here.
|
|
21
|
+
*/
|
|
22
|
+
export interface PluginSettingsReader {
|
|
23
|
+
/** One field's value (or its default). An undeclared id or a secret field's id throws PluginSettingUndeclaredError; a failed read throws PluginSettingsUnavailableError. */
|
|
24
|
+
get(id: string): Promise<PluginSettingValue>;
|
|
25
|
+
/** Every declared non-secret field's value, as a frozen copy: changing it changes nothing stored. A failed read throws PluginSettingsUnavailableError. */
|
|
26
|
+
all(): Promise<Readonly<Record<string, PluginSettingValue>>>;
|
|
27
|
+
}
|
|
28
|
+
/** M32 F4d (D7): thrown by `context.settings.get` for an id the manifest does not declare, or a secret field's id. */
|
|
29
|
+
export declare class PluginSettingUndeclaredError extends Error {
|
|
30
|
+
readonly settingId: string;
|
|
31
|
+
constructor(message: string, settingId: string);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* M32 F4d (D7): thrown by `context.settings.get` and `all` when the host could not read the stored
|
|
35
|
+
* values. Never answered as the defaults: a plugin cannot tell a default from a value a person set.
|
|
36
|
+
*/
|
|
37
|
+
export declare class PluginSettingsUnavailableError extends Error {
|
|
38
|
+
constructor(message: string);
|
|
39
|
+
}
|
|
40
|
+
/** M33 K30: thrown by `context.simpleStorage` (and the host's other doors to a plugin's storage) for a
|
|
41
|
+
* plugin that is installed but switched off. */
|
|
42
|
+
export declare class PluginNotActiveError extends Error {
|
|
43
|
+
constructor(message: string);
|
|
44
|
+
}
|
|
45
|
+
/** True for a PluginNotActiveError from ANY copy of this SDK (a plugin bundles its own copy). */
|
|
46
|
+
export declare function isPluginNotActiveError(value: unknown): value is PluginNotActiveError;
|
|
47
|
+
/** M33 K30: thrown by a write (`context.simpleStorage.set`, a structured write) of a plugin whose
|
|
48
|
+
* licence term lapsed or was refunded: the plugin is read-only, and its reads still answer. */
|
|
49
|
+
export declare class PluginReadOnlyError extends Error {
|
|
50
|
+
constructor(message: string);
|
|
51
|
+
}
|
|
52
|
+
/** True for a PluginReadOnlyError from ANY copy of this SDK (a plugin bundles its own copy). */
|
|
53
|
+
export declare function isPluginReadOnlyError(value: unknown): value is PluginReadOnlyError;
|
|
54
|
+
/** M33 K30: thrown by `context.simpleStorage` on an admin or API key route when the person (or key)
|
|
55
|
+
* calling may not read the page (`get`) or edit it (`set`), as the HTTP storage door decides. */
|
|
56
|
+
export declare class PluginPageAccessError extends Error {
|
|
57
|
+
constructor(message: string);
|
|
58
|
+
}
|
|
59
|
+
/** True for a PluginPageAccessError from ANY copy of this SDK (a plugin bundles its own copy). */
|
|
60
|
+
export declare function isPluginPageAccessError(value: unknown): value is PluginPageAccessError;
|
|
61
|
+
/** True for a PluginSettingsUnavailableError from ANY copy of this SDK (a plugin bundles its own copy). */
|
|
62
|
+
export declare function isPluginSettingsUnavailableError(value: unknown): value is PluginSettingsUnavailableError;
|
|
63
|
+
/** True for a PluginSettingUndeclaredError from ANY copy of this SDK (a plugin bundles its own copy). */
|
|
64
|
+
export declare function isPluginSettingUndeclaredError(value: unknown): value is PluginSettingUndeclaredError;
|
|
65
|
+
/** D7: the context every provider function gets, built per call. */
|
|
66
|
+
export interface ProviderContext {
|
|
67
|
+
structuredStorage: ScopedStructuredStorage;
|
|
68
|
+
entitlement: Entitlement;
|
|
69
|
+
readOnly: boolean;
|
|
70
|
+
secrets: PluginSecrets;
|
|
71
|
+
/** M32 F4d (D7): the plugin's settings values. */
|
|
72
|
+
settings: PluginSettingsReader;
|
|
73
|
+
log: {
|
|
74
|
+
info(msg: string): void;
|
|
75
|
+
warn(msg: string): void;
|
|
76
|
+
};
|
|
77
|
+
/** M33 K17 (consolidation 3.2): seals values the plugin makes under a key of its own for each declared kind.
|
|
78
|
+
* Present only for a plugin that declares `sealedValues`. */
|
|
79
|
+
sealing?: PluginSealing;
|
|
80
|
+
}
|
|
81
|
+
/** D10: one secret the plugin keeps for a person to enter in the admin. */
|
|
82
|
+
export interface SecretDeclaration {
|
|
83
|
+
name: string;
|
|
84
|
+
label: PluginLabel;
|
|
85
|
+
description?: PluginLabel;
|
|
86
|
+
}
|
|
87
|
+
/** D15, D16: a form protection provider, run after the built-in checks of `context.protect`. */
|
|
88
|
+
export interface ProtectionProviderContribution {
|
|
89
|
+
id: string;
|
|
90
|
+
label: PluginLabel;
|
|
91
|
+
description?: PluginLabel;
|
|
92
|
+
/** The provider's form field prefix: `verify` gets the posted fields under it. */
|
|
93
|
+
fieldPrefix: string;
|
|
94
|
+
verify(input: {
|
|
95
|
+
fields: Record<string, string>;
|
|
96
|
+
ip: string;
|
|
97
|
+
formPlugin: string;
|
|
98
|
+
}, context: ProviderContext): Promise<{
|
|
99
|
+
ok: true;
|
|
100
|
+
} | {
|
|
101
|
+
ok: false;
|
|
102
|
+
reason: string;
|
|
103
|
+
tell?: ProtectionTellWord;
|
|
104
|
+
}>;
|
|
105
|
+
/** The widget the form shows: a class and `data-*` attributes for a `<div>`, never markup, and
|
|
106
|
+
* (M33 K50) a visible sentence for a visitor whose browser does not run the widget's script.
|
|
107
|
+
* Synchronous: a promise is a malformed answer. M33 K50: it gets the render's context; a widget
|
|
108
|
+
* written without the parameter keeps working. */
|
|
109
|
+
widget?(context: ProtectionWidgetContext): ProtectionWidgetAnswer;
|
|
110
|
+
/** M33 K51: a `.js` file in the plugin's own `public/` folder (`"captcha.js"`). `{% form_protection %}`
|
|
111
|
+
* writes it as `<script src defer>` once a render, right after the first widget, only on a page
|
|
112
|
+
* render and only when the widget wrote its `<div>`. */
|
|
113
|
+
widgetScript?: string;
|
|
114
|
+
}
|
|
115
|
+
/** M33 K50: what a protection provider's `widget` gets, built once a render before the call. */
|
|
116
|
+
export type ProtectionWidgetContext = Readonly<{
|
|
117
|
+
/** The render's language, or null when there is none. */
|
|
118
|
+
culture: string | null;
|
|
119
|
+
/** The plugin's non-secret settings values, read once before the call; `{}` when that read failed.
|
|
120
|
+
* A plain record: `widget` is synchronous and cannot wait for the settings reader. */
|
|
121
|
+
settingsValues: Readonly<Record<string, PluginSettingValue>>;
|
|
122
|
+
/** The address of the plugin's own `public/` folder at its installed version,
|
|
123
|
+
* `/plugin-assets/<id>/<version>/public/`, with the closing slash. */
|
|
124
|
+
assetBase: string;
|
|
125
|
+
/** The built-in check's live minimum time in seconds: a send before it is refused, so a script never sends earlier. */
|
|
126
|
+
minSeconds: number;
|
|
127
|
+
}>;
|
|
128
|
+
/** D16, M33 K50: a protection widget's answer. */
|
|
129
|
+
export interface ProtectionWidgetAnswer {
|
|
130
|
+
/** One CSS class name for the widget's `<div>`. */
|
|
131
|
+
class?: string;
|
|
132
|
+
/** At most 10 `data-*` attributes for the `<div>`. */
|
|
133
|
+
data?: Record<string, string>;
|
|
134
|
+
/** M33 K50: 1 to 300 characters, not blank, no control, direction or other hidden character, written
|
|
135
|
+
* escaped and visible as the `<div>`'s only child, `<p data-protection-fallback>`, on a page render. The widget's script removes it. An
|
|
136
|
+
* invalid one is left out and logged; the rest of the answer is kept. */
|
|
137
|
+
fallbackText?: string;
|
|
138
|
+
}
|
|
139
|
+
/** D19: a published page as a search provider receives it. */
|
|
140
|
+
export interface SearchDocument {
|
|
141
|
+
id: string;
|
|
142
|
+
path: string;
|
|
143
|
+
documentTypeId: string;
|
|
144
|
+
documentType: string;
|
|
145
|
+
name: string;
|
|
146
|
+
fields: Record<string, unknown>;
|
|
147
|
+
cultures: Record<string, unknown>;
|
|
148
|
+
publishedAt: string;
|
|
149
|
+
updatedAt: string;
|
|
150
|
+
}
|
|
151
|
+
/** D19: a search provider answers the delivery API's `?q=` search. */
|
|
152
|
+
export interface SearchProviderContribution {
|
|
153
|
+
id: string;
|
|
154
|
+
label: PluginLabel;
|
|
155
|
+
description?: PluginLabel;
|
|
156
|
+
index(documents: SearchDocument[], context: ProviderContext): Promise<void>;
|
|
157
|
+
remove(ids: string[], context: ProviderContext): Promise<void>;
|
|
158
|
+
query(input: {
|
|
159
|
+
text: string;
|
|
160
|
+
documentTypeId?: string;
|
|
161
|
+
under?: string;
|
|
162
|
+
cursor?: string;
|
|
163
|
+
limit: number;
|
|
164
|
+
}, context: ProviderContext): Promise<{
|
|
165
|
+
ids: string[];
|
|
166
|
+
nextCursor: string | null;
|
|
167
|
+
}>;
|
|
168
|
+
clear?(context: ProviderContext): Promise<void>;
|
|
169
|
+
}
|
|
170
|
+
/** D25: a media store keeps the uploaded files. */
|
|
171
|
+
export interface MediaStoreContribution {
|
|
172
|
+
id: string;
|
|
173
|
+
label: PluginLabel;
|
|
174
|
+
description?: PluginLabel;
|
|
175
|
+
put(key: string, data: Uint8Array, mimeType: string, context: ProviderContext): Promise<void>;
|
|
176
|
+
/** Null when the key is missing. */
|
|
177
|
+
open(key: string, context: ProviderContext): Promise<{
|
|
178
|
+
data: Uint8Array | AsyncIterable<Uint8Array>;
|
|
179
|
+
size?: number;
|
|
180
|
+
} | null>;
|
|
181
|
+
delete(key: string, context: ProviderContext): Promise<void>;
|
|
182
|
+
exists(key: string, context: ProviderContext): Promise<boolean>;
|
|
183
|
+
ready?(context: ProviderContext): Promise<void>;
|
|
184
|
+
/** M32 F4e (E1): the https address public files are served from, or null for none. */
|
|
185
|
+
publicBaseUrl?(context: ProviderContext): Promise<string | null>;
|
|
186
|
+
}
|
|
187
|
+
/** M32 H (H1): one email a mail sender is asked to deliver. `purpose` says what it is for; the text is plain. */
|
|
188
|
+
export interface OutgoingMail {
|
|
189
|
+
purpose: MailPurpose;
|
|
190
|
+
to: string;
|
|
191
|
+
from: {
|
|
192
|
+
address: string;
|
|
193
|
+
name: string;
|
|
194
|
+
};
|
|
195
|
+
subject: string;
|
|
196
|
+
text: string;
|
|
197
|
+
/** M33 K11: where replies go, a checked address; only a plugin's email (`pluginMail`) may carry one. */
|
|
198
|
+
replyTo?: string;
|
|
199
|
+
}
|
|
200
|
+
/** M32 H (H1): `permanent` is true when trying again cannot help (a refused address); false for a failure that may pass. */
|
|
201
|
+
export type MailSendResult = {
|
|
202
|
+
ok: true;
|
|
203
|
+
} | {
|
|
204
|
+
ok: false;
|
|
205
|
+
permanent: boolean;
|
|
206
|
+
};
|
|
207
|
+
/** M32 H (H1, H2): a mail sender, chosen instead of the built-in SMTP one. It sends every email the site sends. */
|
|
208
|
+
export interface MailSenderContribution {
|
|
209
|
+
id: string;
|
|
210
|
+
label: PluginLabel;
|
|
211
|
+
description?: PluginLabel;
|
|
212
|
+
send(mail: OutgoingMail, context: ProviderContext): Promise<MailSendResult>;
|
|
213
|
+
/** True when the sender can send now; absent means always ready. */
|
|
214
|
+
ready?(context: ProviderContext): Promise<boolean>;
|
|
215
|
+
}
|
|
216
|
+
/** M32 F4b (D33): who a person is, as an oauth2 provider's `profile` reads the userinfo answers. */
|
|
217
|
+
export interface SignInProfile {
|
|
218
|
+
/** The provider's stable id for the person, 1 to 255 characters. */
|
|
219
|
+
subject: string;
|
|
220
|
+
email?: string;
|
|
221
|
+
/** True only when the provider vouches the email belongs to the person. */
|
|
222
|
+
emailVerified: boolean;
|
|
223
|
+
name?: string;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* M32 F4b (D33, D48): a sign-in provider the admin's login page offers. The plugin describes the
|
|
227
|
+
* provider; the core runs the protocol (PKCE, state and nonce), so the plugin never receives an
|
|
228
|
+
* authorization code, a token, a cookie or the request. The rules are api-schemas'
|
|
229
|
+
* (`signInDeclarationProblems`), checked by `kardalum plugin validate` and the marketplace as
|
|
230
|
+
* `Providers and secrets`.
|
|
231
|
+
*/
|
|
232
|
+
export interface SignInProviderContribution {
|
|
233
|
+
id: string;
|
|
234
|
+
label: PluginLabel;
|
|
235
|
+
/** M33 K56: the line shown under the button on the login page, on its card and in the Connect dialog:
|
|
236
|
+
* at most 160 characters per language (`SIGN_IN_DESCRIPTION_MAX`), with no control or direction character. */
|
|
237
|
+
description?: PluginLabel;
|
|
238
|
+
/** The icon the login page draws beside the label; "key" when absent, and in place of `mark` when the picture cannot load. */
|
|
239
|
+
icon?: SignInIcon;
|
|
240
|
+
/** M33 K57: the file name of a PNG in the plugin's `public/` folder, drawn at the button's inline start: 5 to 64
|
|
241
|
+
* lower-case letters, digits and "-" ending in ".png", square, 16 to 128 pixels a side, at most 8,192 bytes. */
|
|
242
|
+
mark?: string;
|
|
243
|
+
/** M33 K58, oidc only: the name of the ID token claim (else userinfo's) that names the organisation's domain, such as
|
|
244
|
+
* Google's "hd". New accounts and connection by email then need that domain in the allowed list. */
|
|
245
|
+
hostedDomainClaim?: string;
|
|
246
|
+
protocol: SignInProtocol;
|
|
247
|
+
/** oidc: a fixed issuer address (a known service). Exactly one of `issuer` and `issuerSecret`. */
|
|
248
|
+
issuer?: string;
|
|
249
|
+
/** oidc: the name of a declared secret holding the issuer address (a company login). */
|
|
250
|
+
issuerSecret?: string;
|
|
251
|
+
/** oauth2: the authorization endpoint. */
|
|
252
|
+
authorizationUrl?: string;
|
|
253
|
+
/** oauth2: the token endpoint. */
|
|
254
|
+
tokenUrl?: string;
|
|
255
|
+
/** oauth2: 1 or 2 addresses the core reads with the access token, in order, for `profile`. */
|
|
256
|
+
userInfoUrls?: string[];
|
|
257
|
+
/** How the client secret is sent to the token endpoint; "basic" when absent. */
|
|
258
|
+
clientAuth?: SignInClientAuth;
|
|
259
|
+
scopes: string[];
|
|
260
|
+
/** The name of a declared secret holding the client id. */
|
|
261
|
+
clientIdSecret: string;
|
|
262
|
+
/** The name of a declared secret holding the client secret. */
|
|
263
|
+
clientSecretSecret: string;
|
|
264
|
+
/** oauth2 only: maps the userinfo answers the core read with the access token. Never receives a token. */
|
|
265
|
+
profile?(input: {
|
|
266
|
+
responses: unknown[];
|
|
267
|
+
}, context: ProviderContext): Promise<SignInProfile>;
|
|
268
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/** D12: thrown by `context.secrets.get` for a name the manifest does not declare. */
|
|
2
|
+
export class PluginSecretUndeclaredError extends Error {
|
|
3
|
+
constructor(message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = "PluginSecretUndeclaredError";
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/** True for a PluginSecretUndeclaredError from ANY copy of this SDK: a plugin bundles its own copy, so `instanceof` would miss the host's class. */
|
|
9
|
+
export function isPluginSecretUndeclaredError(value) {
|
|
10
|
+
return value instanceof Error && value.name === "PluginSecretUndeclaredError";
|
|
11
|
+
}
|
|
12
|
+
/** M32 F4d (D7): thrown by `context.settings.get` for an id the manifest does not declare, or a secret field's id. */
|
|
13
|
+
export class PluginSettingUndeclaredError extends Error {
|
|
14
|
+
settingId;
|
|
15
|
+
constructor(message, settingId) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.settingId = settingId;
|
|
18
|
+
this.name = "PluginSettingUndeclaredError";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* M32 F4d (D7): thrown by `context.settings.get` and `all` when the host could not read the stored
|
|
23
|
+
* values. Never answered as the defaults: a plugin cannot tell a default from a value a person set.
|
|
24
|
+
*/
|
|
25
|
+
export class PluginSettingsUnavailableError extends Error {
|
|
26
|
+
constructor(message) {
|
|
27
|
+
super(message);
|
|
28
|
+
this.name = "PluginSettingsUnavailableError";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** M33 K30: thrown by `context.simpleStorage` (and the host's other doors to a plugin's storage) for a
|
|
32
|
+
* plugin that is installed but switched off. */
|
|
33
|
+
export class PluginNotActiveError extends Error {
|
|
34
|
+
constructor(message) {
|
|
35
|
+
super(message);
|
|
36
|
+
this.name = "PluginNotActiveError";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** True for a PluginNotActiveError from ANY copy of this SDK (a plugin bundles its own copy). */
|
|
40
|
+
export function isPluginNotActiveError(value) {
|
|
41
|
+
return value instanceof Error && value.name === "PluginNotActiveError";
|
|
42
|
+
}
|
|
43
|
+
/** M33 K30: thrown by a write (`context.simpleStorage.set`, a structured write) of a plugin whose
|
|
44
|
+
* licence term lapsed or was refunded: the plugin is read-only, and its reads still answer. */
|
|
45
|
+
export class PluginReadOnlyError extends Error {
|
|
46
|
+
constructor(message) {
|
|
47
|
+
super(message);
|
|
48
|
+
this.name = "PluginReadOnlyError";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** True for a PluginReadOnlyError from ANY copy of this SDK (a plugin bundles its own copy). */
|
|
52
|
+
export function isPluginReadOnlyError(value) {
|
|
53
|
+
return value instanceof Error && value.name === "PluginReadOnlyError";
|
|
54
|
+
}
|
|
55
|
+
/** M33 K30: thrown by `context.simpleStorage` on an admin or API key route when the person (or key)
|
|
56
|
+
* calling may not read the page (`get`) or edit it (`set`), as the HTTP storage door decides. */
|
|
57
|
+
export class PluginPageAccessError extends Error {
|
|
58
|
+
constructor(message) {
|
|
59
|
+
super(message);
|
|
60
|
+
this.name = "PluginPageAccessError";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** True for a PluginPageAccessError from ANY copy of this SDK (a plugin bundles its own copy). */
|
|
64
|
+
export function isPluginPageAccessError(value) {
|
|
65
|
+
return value instanceof Error && value.name === "PluginPageAccessError";
|
|
66
|
+
}
|
|
67
|
+
/** True for a PluginSettingsUnavailableError from ANY copy of this SDK (a plugin bundles its own copy). */
|
|
68
|
+
export function isPluginSettingsUnavailableError(value) {
|
|
69
|
+
return value instanceof Error && value.name === "PluginSettingsUnavailableError";
|
|
70
|
+
}
|
|
71
|
+
/** True for a PluginSettingUndeclaredError from ANY copy of this SDK (a plugin bundles its own copy). */
|
|
72
|
+
export function isPluginSettingUndeclaredError(value) {
|
|
73
|
+
return value instanceof Error && value.name === "PluginSettingUndeclaredError";
|
|
74
|
+
}
|
package/dist/read-all-pages.d.ts
CHANGED
|
@@ -12,6 +12,11 @@ export interface ReadAllPagesOptions {
|
|
|
12
12
|
limit?: number;
|
|
13
13
|
/** The most pages read before the read stops incomplete (default 20). */
|
|
14
14
|
cap?: number;
|
|
15
|
+
/** The sentence a failed read throws, in the caller's words: `status` is the HTTP status, or null for an answer
|
|
16
|
+
* that was not a listing. Without it the sentence is English, "Failed to load <what> (<status>)". */
|
|
17
|
+
failure?: (detail: {
|
|
18
|
+
status: number | null;
|
|
19
|
+
}) => string;
|
|
15
20
|
}
|
|
16
21
|
/**
|
|
17
22
|
* Every page of a cursor-paginated listing, up to the cap. The listings a view reads this way are small, admin-only
|
package/dist/read-all-pages.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export async function readAllPages(fetchApi, path, what, options = {}) {
|
|
9
9
|
const { itemKey = "items", limit = 100, cap = 20 } = options;
|
|
10
|
+
const fail = (status) => new Error(options.failure ? options.failure({ status }) : `Failed to load ${what} (${status ?? "unexpected answer"})`);
|
|
10
11
|
const all = [];
|
|
11
12
|
let cursor = null;
|
|
12
13
|
for (let page = 0; page < cap; page += 1) {
|
|
@@ -16,11 +17,11 @@ export async function readAllPages(fetchApi, path, what, options = {}) {
|
|
|
16
17
|
params.set("cursor", cursor);
|
|
17
18
|
const response = await fetchApi(`${path}?${params.toString()}`);
|
|
18
19
|
if (!response.ok)
|
|
19
|
-
throw
|
|
20
|
+
throw fail(response.status);
|
|
20
21
|
const body = (await response.json());
|
|
21
22
|
const items = body[itemKey];
|
|
22
23
|
if (!Array.isArray(items))
|
|
23
|
-
throw
|
|
24
|
+
throw fail(null);
|
|
24
25
|
all.push(...items);
|
|
25
26
|
cursor = typeof body.nextCursor === "string" ? body.nextCursor : null;
|
|
26
27
|
if (cursor === null)
|
|
@@ -3,6 +3,7 @@ import { useEffect, useRef, useState } from "react";
|
|
|
3
3
|
import { Selection } from "@tiptap/pm/state";
|
|
4
4
|
import { Button, Dialog, DialogCloseButton, DialogContent, DialogFooter, DialogHeader, DialogTitle, Input, PropertyField, Switch, TruncatedText, } from "@kardalum/ui";
|
|
5
5
|
import { MANAGE_API, usePluginApi } from "../plugin-context.js";
|
|
6
|
+
import { useSdkString } from "../sdk-strings.js";
|
|
6
7
|
import { MediaPicker } from "../media/media-picker.js";
|
|
7
8
|
import { useBlockListings } from "./insert-menu.js";
|
|
8
9
|
function useMediaParamPreview(mediaId) {
|
|
@@ -41,6 +42,7 @@ function useMediaParamPreview(mediaId) {
|
|
|
41
42
|
// One field per declared param, keyed by its type (S197 Task 3 brief:
|
|
42
43
|
// text/textarea/number/boolean(switch)/image(MediaPicker)/choice(select)).
|
|
43
44
|
function BlockParamField({ spec, value, onChange, error }) {
|
|
45
|
+
const s = useSdkString();
|
|
44
46
|
const fieldId = `block-param-${spec.key}`;
|
|
45
47
|
const [pickerOpen, setPickerOpen] = useState(false);
|
|
46
48
|
const mediaId = spec.type === "image" ? (value ?? null) : null;
|
|
@@ -67,7 +69,7 @@ function BlockParamField({ spec, value, onChange, error }) {
|
|
|
67
69
|
case "choice":
|
|
68
70
|
return (_jsx(PropertyField, { label: spec.label, htmlFor: fieldId, error: error, children: _jsx("select", { id: fieldId, value: value ?? "", onChange: (event) => onChange(event.target.value), className: "h-10 w-full rounded-md border border-border-strong bg-background-elevated px-3 text-sm text-text-primary focus-visible:border-primary-600 focus-visible:outline-hidden focus-visible:ring-4 focus-visible:ring-primary-50", children: (spec.options ?? []).map((option) => (_jsx("option", { value: option, children: option }, option))) }) }));
|
|
69
71
|
case "image":
|
|
70
|
-
return (_jsxs(PropertyField, { label: spec.label, error: error, children: [_jsxs("div", { className: "flex items-center gap-3 rounded-md border border-border-default bg-background-subtle p-2", children: [preview ? (_jsx("img", { src: preview.downloadUrl, alt: "", className: "h-10 w-10 shrink-0 rounded-md object-cover" })) : (_jsx("div", { "aria-hidden": "true", className: "h-10 w-10 shrink-0 rounded-md bg-background-hover" })), _jsx(TruncatedText, { className: "flex-1 truncate text-sm text-text-secondary", children: preview?.filename ?? "
|
|
72
|
+
return (_jsxs(PropertyField, { label: spec.label, error: error, children: [_jsxs("div", { className: "flex items-center gap-3 rounded-md border border-border-default bg-background-subtle p-2", children: [preview ? (_jsx("img", { src: preview.downloadUrl, alt: "", className: "h-10 w-10 shrink-0 rounded-md object-cover" })) : (_jsx("div", { "aria-hidden": "true", className: "h-10 w-10 shrink-0 rounded-md bg-background-hover" })), _jsx(TruncatedText, { className: "flex-1 truncate text-sm text-text-secondary", children: preview?.filename ?? s("blockPanel.noImage") }), _jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => setPickerOpen(true), children: s("blockPanel.change") })] }), pickerOpen && (_jsx(MediaPicker
|
|
71
73
|
// A block param stores the media id and nothing else, so
|
|
72
74
|
// there is nowhere for alt text to go: asking for it here
|
|
73
75
|
// would be collecting something this field then discards.
|
|
@@ -90,7 +92,8 @@ function BlockParamField({ spec, value, onChange, error }) {
|
|
|
90
92
|
// The form-view/on-page distinction is only ever about the surrounding
|
|
91
93
|
// panel shell, never about how a param is edited.
|
|
92
94
|
export function BlockParamFields({ listing, listingsError, params, onChange, fieldErrors }) {
|
|
93
|
-
|
|
95
|
+
const s = useSdkString();
|
|
96
|
+
return (_jsxs(_Fragment, { children: [!listing && listingsError && _jsx("p", { className: "text-sm text-danger-600", children: listingsError }), !listing && !listingsError && (_jsx("p", { className: "text-sm text-text-secondary", children: s("blockPanel.fieldsUnavailable") })), listing?.params.map((spec) => (_jsx(BlockParamField, { spec: spec, value: params[spec.key], onChange: (next) => onChange(spec.key, next), error: fieldErrors?.[spec.key] }, spec.key)))] }));
|
|
94
97
|
}
|
|
95
98
|
// The mockup's right-hand settings panel (screen 1) for the form view: a
|
|
96
99
|
// modal over the editor (Dialog, per packages/ui: MediaPicker moved to
|
|
@@ -105,6 +108,7 @@ export function BlockParamFields({ listing, listingsError, params, onChange, fie
|
|
|
105
108
|
// panel visibility is just a read of editor state, not separate
|
|
106
109
|
// open/close state duplicated here.
|
|
107
110
|
export function BlockPanel({ editor, pos, partial, params }) {
|
|
111
|
+
const s = useSdkString();
|
|
108
112
|
const { listings, error: listingsError } = useBlockListings();
|
|
109
113
|
const listing = listings.find((entry) => entry.alias === partial) ?? null;
|
|
110
114
|
// "at the node's position" (S197 Task 3 brief): setNodeSelection(pos)
|
|
@@ -161,7 +165,7 @@ export function BlockPanel({ editor, pos, partial, params }) {
|
|
|
161
165
|
// editor, so this is a real guard, not defensive-for-its-own-sake.
|
|
162
166
|
if (!editor.isDestroyed)
|
|
163
167
|
editor.commands.focus();
|
|
164
|
-
}, className: "flex max-h-[80vh] max-w-sm flex-col gap-0 p-0", children: [_jsxs(DialogHeader, { className: "border-b border-border-default px-4 py-3", children: [_jsxs("div", { className: "flex flex-col gap-px", children: [_jsx(DialogTitle, { children: listing?.name ?? partial }),
|
|
168
|
+
}, className: "flex max-h-[80vh] max-w-sm flex-col gap-0 p-0", children: [_jsxs(DialogHeader, { className: "border-b border-border-default px-4 py-3", children: [_jsxs("div", { className: "flex flex-col gap-px", children: [_jsx(DialogTitle, { children: listing?.name ?? partial }), _jsx("span", { className: "font-mono text-xs text-text-tertiary", children: s("blockPanel.partial", { partial }) })] }), _jsx(DialogCloseButton, { "aria-label": s("blockPanel.close") })] }), _jsxs("div", { className: "flex flex-1 flex-col gap-4 overflow-y-auto p-4", children: [_jsx(BlockParamFields, { listing: listing, listingsError: listingsError, params: params, onChange: updateParam }), _jsxs("p", { className: "rounded-md border border-border-default bg-background-subtle p-2 text-xs text-text-secondary", children: [_jsx("b", { className: "font-semibold text-text-primary", children: s("blockPanel.livePreview") }), " ", s("blockPanel.livePreviewBody")] })] }), _jsxs(DialogFooter, { className: "mt-0 justify-start border-t border-border-default p-4", children: [_jsx(Button, { type: "button", variant: "ghost", className: "text-danger-600 hover:text-danger-700", onClick: handleRemove, children: s("blockPanel.removeBlock") }), _jsx(Button, { type: "button", className: "ms-auto", onClick: moveSelectionPastBlock, children: s("blockPanel.done") })] })] }) }));
|
|
165
169
|
}
|
|
166
170
|
// The chip's "preview ⤢" affordance (S197 mockup screen 3): fetches
|
|
167
171
|
// POST /api/manage/v1/render/block for the block's CURRENT params and shows the
|
|
@@ -171,6 +175,7 @@ export function BlockPanel({ editor, pos, partial, params }) {
|
|
|
171
175
|
// which is inherently a physical measurement: plain `top`/`left` here,
|
|
172
176
|
// not logical properties, matches how that rect is expressed.
|
|
173
177
|
export function BlockPreviewPopover({ partial, params, anchorRect, onClose }) {
|
|
178
|
+
const s = useSdkString();
|
|
174
179
|
const fetchApi = usePluginApi();
|
|
175
180
|
const [html, setHtml] = useState(null);
|
|
176
181
|
const [loading, setLoading] = useState(true);
|
|
@@ -187,7 +192,7 @@ export function BlockPreviewPopover({ partial, params, anchorRect, onClose }) {
|
|
|
187
192
|
})
|
|
188
193
|
.then(async (response) => {
|
|
189
194
|
if (!response.ok)
|
|
190
|
-
throw new Error(
|
|
195
|
+
throw new Error(s("blockPanel.previewFailed", { status: response.status }));
|
|
191
196
|
const body = (await response.json());
|
|
192
197
|
if (!cancelled)
|
|
193
198
|
setHtml(body.html);
|
|
@@ -206,7 +211,7 @@ export function BlockPreviewPopover({ partial, params, anchorRect, onClose }) {
|
|
|
206
211
|
// params is a fresh object per render (rich-text-view.tsx reads it off
|
|
207
212
|
// node attrs each time): comparing it by reference would refetch on
|
|
208
213
|
// every unrelated re-render, so key on its serialized form instead.
|
|
209
|
-
}, [partial, JSON.stringify(params), fetchApi]);
|
|
214
|
+
}, [partial, JSON.stringify(params), fetchApi, s]);
|
|
210
215
|
useEffect(() => {
|
|
211
216
|
function handlePointerDown(event) {
|
|
212
217
|
if (popoverRef.current && !popoverRef.current.contains(event.target))
|
|
@@ -227,5 +232,5 @@ export function BlockPreviewPopover({ partial, params, anchorRect, onClose }) {
|
|
|
227
232
|
if (event.key === "Escape")
|
|
228
233
|
onClose();
|
|
229
234
|
}
|
|
230
|
-
return (_jsxs("div", { ref: popoverRef, role: "dialog", "aria-label":
|
|
235
|
+
return (_jsxs("div", { ref: popoverRef, role: "dialog", "aria-label": s("blockPanel.previewLabel", { partial }), onKeyDown: handleKeyDownCapture, style: { position: "fixed", top: anchorRect.bottom + 4, left: anchorRect.left }, className: "z-20 w-72 rounded-md border border-border-default bg-background-elevated p-2 shadow-xl", children: [loading && _jsx("p", { className: "text-xs text-text-secondary", children: s("blockPanel.previewLoading") }), error && _jsx("p", { className: "text-xs text-danger-600", children: error }), !loading && !error && (_jsx("iframe", { title: s("blockPanel.previewLabel", { partial }), srcDoc: html ?? "", sandbox: "", className: "h-44 w-full rounded-sm border border-border-subtle bg-background-elevated" }))] }));
|
|
231
236
|
}
|