@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
|
@@ -47,4 +47,39 @@ export const BUILT_IN_VALUE_SCHEMAS = {
|
|
|
47
47
|
// S314p (D3). A path under public/, as Settings, Assets names the file; the address a template
|
|
48
48
|
// prints is worked out at render.
|
|
49
49
|
"com.kardalum.asset": { type: "string" },
|
|
50
|
+
// M32 C (D2, D10): one page id, or a list of distinct page ids (at most 50); null when empty.
|
|
51
|
+
"com.kardalum.contentpicker": {
|
|
52
|
+
anyOf: [
|
|
53
|
+
{ type: "string", format: "uuid" },
|
|
54
|
+
{ type: "array", items: { type: "string", format: "uuid" }, maxItems: 50, uniqueItems: true },
|
|
55
|
+
{ type: "null" },
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
// M32 C (D3): one option's value, or a list of distinct values; null when empty.
|
|
59
|
+
"com.kardalum.options": {
|
|
60
|
+
anyOf: [{ type: "string" }, { type: "array", items: { type: "string" }, uniqueItems: true }, { type: "null" }],
|
|
61
|
+
},
|
|
62
|
+
// M32 C (D4): a page on this site or an outside address, with a label and a new-tab flag.
|
|
63
|
+
"com.kardalum.link": {
|
|
64
|
+
anyOf: [
|
|
65
|
+
{
|
|
66
|
+
type: "object",
|
|
67
|
+
properties: { page: { type: "string", format: "uuid" }, label: { type: "string", maxLength: 200 }, newTab: { type: "boolean" } },
|
|
68
|
+
required: ["page"],
|
|
69
|
+
additionalProperties: false,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: "object",
|
|
73
|
+
properties: { url: { type: "string", maxLength: 2048 }, label: { type: "string", maxLength: 200 }, newTab: { type: "boolean" } },
|
|
74
|
+
required: ["url"],
|
|
75
|
+
additionalProperties: false,
|
|
76
|
+
},
|
|
77
|
+
{ type: "null" },
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
// M32 D (D1): a Group stores an object keyed by its sub-fields' aliases; a Repeatable list an array
|
|
81
|
+
// of at most 100 items. The per-field schema built from the data type tree replaces these on the
|
|
82
|
+
// delivery API.
|
|
83
|
+
"com.kardalum.group": { anyOf: [{ type: "object" }, { type: "null" }] },
|
|
84
|
+
"com.kardalum.list": { anyOf: [{ type: "array", maxItems: 100 }, { type: "null" }] },
|
|
50
85
|
};
|
package/dist/built-ins.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CONTENT_LIST_DEFAULT_SETTINGS } from "@kardalum/api-schemas";
|
|
3
3
|
import { Checkbox, Input, PropertyField, usePropertyFieldControl } from "@kardalum/ui";
|
|
4
|
-
import { ASSET_DEFAULT_SETTINGS, ASSET_SETTINGS_SCHEMA, CONTENT_LIST_SETTINGS_SCHEMA, CROP_DEFAULT_SETTINGS, CROP_SETTINGS_SCHEMA, FILE_UPLOAD_SETTINGS_SCHEMA, HTML_DEFAULT_SETTINGS, HTML_SETTINGS_SCHEMA, IMAGE_DEFAULT_SETTINGS, IMAGE_SETTINGS_SCHEMA, TEXT_DEFAULT_SETTINGS, TEXT_SETTINGS_SCHEMA, THUMBNAIL_DEFAULT_SETTINGS, THUMBNAIL_SETTINGS_SCHEMA, } from "./built-in-settings-schemas.js";
|
|
4
|
+
import { ASSET_DEFAULT_SETTINGS, ASSET_SETTINGS_SCHEMA, CONTENT_LIST_SETTINGS_SCHEMA, CONTENT_PICKER_DEFAULT_SETTINGS, CONTENT_PICKER_SETTINGS_SCHEMA, CROP_DEFAULT_SETTINGS, CROP_SETTINGS_SCHEMA, FILE_UPLOAD_SETTINGS_SCHEMA, HTML_DEFAULT_SETTINGS, HTML_SETTINGS_SCHEMA, IMAGE_DEFAULT_SETTINGS, IMAGE_SETTINGS_SCHEMA, LINK_DEFAULT_SETTINGS, LINK_SETTINGS_SCHEMA, OPTIONS_DEFAULT_SETTINGS, OPTIONS_SETTINGS_SCHEMA, GROUP_DEFAULT_SETTINGS, GROUP_SETTINGS_SCHEMA, REPEATABLE_LIST_DEFAULT_SETTINGS, REPEATABLE_LIST_SETTINGS_SCHEMA, TEXT_DEFAULT_SETTINGS, TEXT_SETTINGS_SCHEMA, THUMBNAIL_DEFAULT_SETTINGS, THUMBNAIL_SETTINGS_SCHEMA, } from "./built-in-settings-schemas.js";
|
|
5
5
|
import { BUILT_IN_VALUE_SCHEMAS } from "./built-in-value-schemas.js";
|
|
6
6
|
import { BUILT_IN_SERIALIZERS, identitySerializer } from "./built-in-serializers.js";
|
|
7
7
|
import { BUILT_IN_DATATYPE_VALIDATORS } from "./datatype-validation.js";
|
|
8
8
|
import { definePlugin } from "./define-plugin.js";
|
|
9
9
|
import { usePluginSettings, usePluginSettingsValue, usePluginValue } from "./plugin-context.js";
|
|
10
10
|
import { registerDataType } from "./registry.js";
|
|
11
|
+
import { useSdkString } from "./sdk-strings.js";
|
|
11
12
|
import { AssetInputView, AssetReadOnlyView, AssetSettingsView } from "./views/asset-view.js";
|
|
13
|
+
import { ContentPickerInputView, ContentPickerReadOnlyView, ContentPickerSettingsView } from "./views/content-picker-view.js";
|
|
14
|
+
import { GroupInputView, GroupReadOnlyView, GroupSettingsView } from "./views/group-view.js";
|
|
15
|
+
import { RepeatableListInputView, RepeatableListReadOnlyView, RepeatableListSettingsView } from "./views/repeatable-list-view.js";
|
|
16
|
+
import { LinkInputView, LinkReadOnlyView, LinkSettingsView } from "./views/link-view.js";
|
|
17
|
+
import { OptionsListInputView, OptionsListReadOnlyView, OptionsListSettingsView } from "./views/options-list-view.js";
|
|
12
18
|
import { ContentListPreview } from "./views/content-list-preview.js";
|
|
13
19
|
import { ContentListSettingsView } from "./views/content-list-settings-view.js";
|
|
14
20
|
import { ContentListInputView, ContentListReadOnlyView } from "./views/content-list-view.js";
|
|
@@ -48,13 +54,12 @@ function TextReadOnlyView() {
|
|
|
48
54
|
// Rendered by the Data Types editor only (data-type-editor.tsx), a
|
|
49
55
|
// settings-EDITING view, so it uses usePluginSettingsValue() (write path),
|
|
50
56
|
// not usePluginSettings() (read-only, used by the input/readOnly views
|
|
51
|
-
// above).
|
|
52
|
-
//
|
|
53
|
-
// deliberately deferred piece of SDK scope, not yet implemented,
|
|
54
|
-
// matching ImageInputView's existing "Remove"/"Loading…" precedent.
|
|
57
|
+
// above). Its words come from useSdkString() (S366f D11), the host's
|
|
58
|
+
// language inside the admin and English anywhere else.
|
|
55
59
|
function TextSettingsView() {
|
|
56
60
|
const { value: settings, onChange } = usePluginSettingsValue();
|
|
57
|
-
|
|
61
|
+
const s = useSdkString();
|
|
62
|
+
return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(PropertyField, { label: s("text.placeholderLabel"), htmlFor: "text-settings-placeholder", children: _jsx(Input, { id: "text-settings-placeholder", value: settings.placeholder ?? "", onChange: (e) => onChange({ ...settings, placeholder: e.target.value || undefined }) }) }), _jsx(PropertyField, { label: s("text.maxLengthLabel"), htmlFor: "text-settings-max-length", helpText: s("text.maxLengthHelp"), children: _jsx(Input, { id: "text-settings-max-length", type: "number", min: 1, value: settings.maxLength ?? "", onChange: (e) => onChange({ ...settings, maxLength: e.target.value === "" ? undefined : Number(e.target.value) }) }) })] }));
|
|
58
63
|
}
|
|
59
64
|
function NumberInputView() {
|
|
60
65
|
const { value, onChange } = usePluginValue();
|
|
@@ -72,7 +77,8 @@ function BooleanInputView() {
|
|
|
72
77
|
}
|
|
73
78
|
function BooleanReadOnlyView() {
|
|
74
79
|
const { value } = usePluginValue();
|
|
75
|
-
|
|
80
|
+
const s = useSdkString();
|
|
81
|
+
return _jsx("p", { children: value ? s("boolean.yes") : s("boolean.no") });
|
|
76
82
|
}
|
|
77
83
|
function DateInputView() {
|
|
78
84
|
const { value, onChange } = usePluginValue();
|
|
@@ -264,3 +270,28 @@ registerDataType(builtIn("asset", "Asset", "folder-open", BUILT_IN_VALUE_SCHEMAS
|
|
|
264
270
|
settings: AssetSettingsView,
|
|
265
271
|
preview: AssetReadOnlyView,
|
|
266
272
|
}, { settingsSchema: ASSET_SETTINGS_SCHEMA, defaultSettings: ASSET_DEFAULT_SETTINGS }));
|
|
273
|
+
// M32 C (D1): the Content Picker, Options List and Link editors. Views arrive in their own tasks;
|
|
274
|
+
// until then the placeholders render nothing.
|
|
275
|
+
registerDataType(builtIn("contentpicker", "Content Picker", "file-search", BUILT_IN_VALUE_SCHEMAS["com.kardalum.contentpicker"], { input: ContentPickerInputView, readOnly: ContentPickerReadOnlyView, settings: ContentPickerSettingsView, preview: ContentPickerReadOnlyView }, {
|
|
276
|
+
settingsSchema: CONTENT_PICKER_SETTINGS_SCHEMA,
|
|
277
|
+
defaultSettings: CONTENT_PICKER_DEFAULT_SETTINGS,
|
|
278
|
+
}));
|
|
279
|
+
registerDataType(builtIn("options", "Options List", "list", BUILT_IN_VALUE_SCHEMAS["com.kardalum.options"], { input: OptionsListInputView, readOnly: OptionsListReadOnlyView, settings: OptionsListSettingsView, preview: OptionsListReadOnlyView }, {
|
|
280
|
+
settingsSchema: OPTIONS_SETTINGS_SCHEMA,
|
|
281
|
+
defaultSettings: OPTIONS_DEFAULT_SETTINGS,
|
|
282
|
+
}));
|
|
283
|
+
registerDataType(builtIn("link", "Link", "link", BUILT_IN_VALUE_SCHEMAS["com.kardalum.link"], { input: LinkInputView, readOnly: LinkReadOnlyView, settings: LinkSettingsView, preview: LinkReadOnlyView }, {
|
|
284
|
+
settingsSchema: LINK_SETTINGS_SCHEMA,
|
|
285
|
+
defaultSettings: LINK_DEFAULT_SETTINGS,
|
|
286
|
+
}));
|
|
287
|
+
// M32 D (D1): the Group and Repeatable List editors.
|
|
288
|
+
const GROUP_VIEWS = { input: GroupInputView, readOnly: GroupReadOnlyView, settings: GroupSettingsView, preview: GroupReadOnlyView };
|
|
289
|
+
const LIST_VIEWS = { input: RepeatableListInputView, readOnly: RepeatableListReadOnlyView, settings: RepeatableListSettingsView, preview: RepeatableListReadOnlyView };
|
|
290
|
+
registerDataType(builtIn("group", "Group", "layers", BUILT_IN_VALUE_SCHEMAS["com.kardalum.group"], GROUP_VIEWS, {
|
|
291
|
+
settingsSchema: GROUP_SETTINGS_SCHEMA,
|
|
292
|
+
defaultSettings: GROUP_DEFAULT_SETTINGS,
|
|
293
|
+
}));
|
|
294
|
+
registerDataType(builtIn("list", "Repeatable List", "list-ordered", BUILT_IN_VALUE_SCHEMAS["com.kardalum.list"], LIST_VIEWS, {
|
|
295
|
+
settingsSchema: REPEATABLE_LIST_SETTINGS_SCHEMA,
|
|
296
|
+
defaultSettings: REPEATABLE_LIST_DEFAULT_SETTINGS,
|
|
297
|
+
}));
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import type { CapabilityNote } from "@kardalum/api-schemas";
|
|
2
|
+
export { CAPABILITY_IDS, deriveCapabilities, derivesCapability, isActionGated, type Capability, type CapabilityMediation, type CapabilityPayload, } from "@kardalum/plugin-package/reference";
|
|
2
3
|
/**
|
|
3
4
|
* S289 (S347): the one sentence every surface uses for what declaring a
|
|
4
5
|
* promised capability means for review. Every submission that passes
|
|
@@ -18,6 +19,15 @@ export declare const PROMISED_CAPABILITY_SENTENCE = "is a promised capability, s
|
|
|
18
19
|
export type CapabilityAudience = "operator" | "shopper";
|
|
19
20
|
export type CapabilityLabels = Record<CapabilityAudience, string>;
|
|
20
21
|
export declare const CAPABILITY_LABELS: Record<string, CapabilityLabels>;
|
|
22
|
+
/**
|
|
23
|
+
* M33 K2: the core's notes a capability's detail may carry beside the
|
|
24
|
+
* plugin's own words, in English. The admin's locales (`capabilityNotes`)
|
|
25
|
+
* and the marketplace's dictionaries hold the same words in every language
|
|
26
|
+
* they carry, the English held to this table by their label tests. A note's
|
|
27
|
+
* words may hold one `{{value}}`, where the detail's value is printed as
|
|
28
|
+
* written (formatCapabilityDetail in @kardalum/api-schemas).
|
|
29
|
+
*/
|
|
30
|
+
export declare const CAPABILITY_NOTE_WORDS: Record<CapabilityNote, string>;
|
|
21
31
|
/**
|
|
22
32
|
* The heading a renderer puts in front of a capability's details.
|
|
23
33
|
*
|
package/dist/capabilities.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// S289: the derivation moved to @kardalum/plugin-package/reference so the one
|
|
2
2
|
// reference builder can call it (the SDK depends on plugin-package, never the
|
|
3
3
|
// reverse). The SDK's public names are unchanged; the labels stay here.
|
|
4
|
-
export { CAPABILITY_IDS, deriveCapabilities, isActionGated, } from "@kardalum/plugin-package/reference";
|
|
4
|
+
export { CAPABILITY_IDS, deriveCapabilities, derivesCapability, isActionGated, } from "@kardalum/plugin-package/reference";
|
|
5
5
|
// A contribution or assertion added to the manifest and not classified in
|
|
6
6
|
// the derivation is a compile error here, as it was before the move.
|
|
7
7
|
const contributionKeysAreTotal = true;
|
|
@@ -35,14 +35,16 @@ export const CAPABILITY_LABELS = {
|
|
|
35
35
|
"admin.section": { operator: "Admin sections", shopper: "Adds admin screens" },
|
|
36
36
|
"admin.railEntry": { operator: "Admin rail entries", shopper: "Adds screens to built-in sections" },
|
|
37
37
|
"admin.dashboardWidget": { operator: "Dashboard widgets", shopper: "Adds dashboard widgets" },
|
|
38
|
+
"admin.editorPanel": { operator: "Editor panels", shopper: "Adds panels to the page editor" },
|
|
39
|
+
"admin.treeAction": { operator: "Tree actions", shopper: "Adds actions to the content tree" },
|
|
38
40
|
"admin.notifications": {
|
|
39
41
|
operator: "Notifications",
|
|
40
|
-
shopper: "Sends notifications
|
|
42
|
+
shopper: "Sends notifications of the kinds it lists, each to the people the kind names.",
|
|
41
43
|
},
|
|
42
44
|
"render.template": { operator: "Render templates", shopper: "Ships render templates" },
|
|
43
45
|
"render.asset": { operator: "Editable assets", shopper: "Ships editable assets" },
|
|
44
46
|
"theme.tokens": { operator: "Theme tokens", shopper: "Restyles the admin" },
|
|
45
|
-
"server.hook": { operator: "Lifecycle hooks", shopper: "Reacts to
|
|
47
|
+
"server.hook": { operator: "Lifecycle hooks", shopper: "Reacts to events on your site: the ones listed" },
|
|
46
48
|
"server.scheduledTask": { operator: "Scheduled tasks", shopper: "Runs work on a schedule" },
|
|
47
49
|
"media.processor": { operator: "Media processors", shopper: "Processes uploaded media" },
|
|
48
50
|
"api.serializer": { operator: "Response extensions", shopper: "Extends content API responses" },
|
|
@@ -51,11 +53,61 @@ export const CAPABILITY_LABELS = {
|
|
|
51
53
|
"api.route.public": { operator: "Public API routes", shopper: "Adds routes anyone can call" },
|
|
52
54
|
"service.exposed": { operator: "Services for other plugins", shopper: "Offers services to other plugins" },
|
|
53
55
|
"bundle.plugin": { operator: "Bundled plugins", shopper: "Installs other plugins with it" },
|
|
56
|
+
"content.access": { operator: "Content access", shopper: "Reads, creates or changes content of the types it names" },
|
|
57
|
+
// M32 F4c (D10)
|
|
58
|
+
"media.access": { operator: "Media access", shopper: "Reads every media file, private ones included, or adds media files" },
|
|
59
|
+
"site.route": { operator: "Site addresses", shopper: "Answers at addresses of your site" },
|
|
60
|
+
"site.fallback": { operator: "Unclaimed addresses", shopper: "Answers addresses no page answers, for example with a redirect" },
|
|
61
|
+
"render.templateFilter": { operator: "Template filters", shopper: "Adds template filters" },
|
|
62
|
+
"render.templateTag": { operator: "Template tags", shopper: "Adds template tags" },
|
|
63
|
+
"render.pageHead": { operator: "Page head", shopper: "Adds tags to the head of every page, scripts only from the places it names" },
|
|
64
|
+
// M32 F4 (D8, D10)
|
|
65
|
+
"provider.formProtection": { operator: "Form protection provider", shopper: "Can check your site's forms" },
|
|
66
|
+
"provider.search": { operator: "Search provider", shopper: "Receives every published page to answer site search" },
|
|
67
|
+
"provider.mediaStore": { operator: "Media store", shopper: "Can store every uploaded file" },
|
|
68
|
+
// M32 H (H2, H19)
|
|
69
|
+
"provider.mail": { operator: "Mail sender", shopper: "Sends every email the site sends, password reset links included" },
|
|
70
|
+
// M33 K11
|
|
71
|
+
"mail.direct": { operator: "Plugin emails", shopper: "Sends emails of the kinds it lists, each to one person, such as an order confirmation to a buyer, when you switch each kind on" },
|
|
72
|
+
"mail.formReplies": { operator: "Form replies", shopper: "Can send one reply email to the address a visitor types into a form, when you switch it on" },
|
|
73
|
+
// M32 F4b (D48)
|
|
74
|
+
"provider.signIn": { operator: "Sign-in provider", shopper: "Can let people sign in to the admin, and vouches for who they are" },
|
|
75
|
+
secrets: { operator: "Secrets", shopper: "Keeps secret values you enter, encrypted" },
|
|
76
|
+
// M33 K42
|
|
77
|
+
"render.heldEmbed": { operator: "Content from other sites", shopper: "Shows content from the sites it names on your pages, only after a visitor clicks to show it" },
|
|
78
|
+
// M33 K17
|
|
79
|
+
"secrets.sealedValues": { operator: "Sealed values", shopper: "Keeps secrets it makes, encrypted with your server's key" },
|
|
80
|
+
// M33 K16
|
|
81
|
+
"network.outbound": {
|
|
82
|
+
operator: "Outbound requests",
|
|
83
|
+
shopper: "Calls web addresses through the server's checked connection, which refuses this server and private networks unless whoever runs the server allows a range",
|
|
84
|
+
},
|
|
54
85
|
"bundle.template": { operator: "Bundled starter", shopper: "Comes with a frontend starter" },
|
|
55
86
|
"network.external": { operator: "External network", shopper: "Reaches the network" },
|
|
56
87
|
"network.vendorService": { operator: "Vendor service", shopper: "Serves its paid features from the author's server" },
|
|
57
88
|
"filesystem.access": { operator: "Filesystem access", shopper: "Reads or writes files" },
|
|
58
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* M33 K2: the core's notes a capability's detail may carry beside the
|
|
92
|
+
* plugin's own words, in English. The admin's locales (`capabilityNotes`)
|
|
93
|
+
* and the marketplace's dictionaries hold the same words in every language
|
|
94
|
+
* they carry, the English held to this table by their label tests. A note's
|
|
95
|
+
* words may hold one `{{value}}`, where the detail's value is printed as
|
|
96
|
+
* written (formatCapabilityDetail in @kardalum/api-schemas).
|
|
97
|
+
*/
|
|
98
|
+
export const CAPABILITY_NOTE_WORDS = {
|
|
99
|
+
rawBody: "reads the request exactly as sent",
|
|
100
|
+
identifiesPeople: "identifies people",
|
|
101
|
+
durable: "kept across restarts",
|
|
102
|
+
methods: "may use: {{value}}",
|
|
103
|
+
leavesServer: "handed to visitors as a sealed token, readable only by this server",
|
|
104
|
+
setsTitle: "may set the page title",
|
|
105
|
+
embedFrom: "from {{value}}",
|
|
106
|
+
embedKindMap: "a map",
|
|
107
|
+
embedKindContent: "content",
|
|
108
|
+
privacyNoticeAt: "privacy notice: {{value}}",
|
|
109
|
+
addsScript: "adds its own script to pages with a protected form",
|
|
110
|
+
};
|
|
59
111
|
/**
|
|
60
112
|
* The heading a renderer puts in front of a capability's details.
|
|
61
113
|
*
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/** M32 I3 (B13): what a command may do with standard input, without `@types/node`. */
|
|
2
|
+
export interface CliReadableStream {
|
|
3
|
+
readonly isTTY?: boolean;
|
|
4
|
+
read(size?: number): string | Uint8Array | null;
|
|
5
|
+
setEncoding(encoding: "ascii" | "utf8" | "utf-8" | "utf16le" | "utf-16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "binary" | "hex"): this;
|
|
6
|
+
pause(): this;
|
|
7
|
+
resume(): this;
|
|
8
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
|
9
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
|
10
|
+
off(event: string, listener: (...args: any[]) => void): this;
|
|
11
|
+
pipe(destination: any, options?: {
|
|
12
|
+
end?: boolean;
|
|
13
|
+
}): any;
|
|
14
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<string | Uint8Array>;
|
|
15
|
+
}
|
|
16
|
+
/** M32 I3 (B13): what a command may do with standard output or error, without `@types/node`. */
|
|
17
|
+
export interface CliWritableStream {
|
|
18
|
+
readonly isTTY?: boolean;
|
|
19
|
+
readonly columns?: number;
|
|
20
|
+
write(chunk: string | Uint8Array, callback?: (error?: Error | null) => void): boolean;
|
|
21
|
+
end(callback?: () => void): this;
|
|
22
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
|
23
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
|
24
|
+
off(event: string, listener: (...args: any[]) => void): this;
|
|
25
|
+
}
|
|
26
|
+
/** What a command receives. No environment copy, no profile record and no key. */
|
|
27
|
+
export interface PluginCliContext {
|
|
28
|
+
command: {
|
|
29
|
+
/** The plugin id's last segment (cut at 32): the first word of the command line. */
|
|
30
|
+
prefix: string;
|
|
31
|
+
/** The command's declared name: the second word. */
|
|
32
|
+
name: string;
|
|
33
|
+
packageName: string;
|
|
34
|
+
packageVersion: string;
|
|
35
|
+
};
|
|
36
|
+
/** The arguments after the command name, unchanged and frozen. */
|
|
37
|
+
argv: readonly string[];
|
|
38
|
+
cwd: string;
|
|
39
|
+
cliVersion: string;
|
|
40
|
+
stdin: CliReadableStream;
|
|
41
|
+
/** `stdout` and `stderr` are the raw streams: what is written to them is not redacted, unlike `out` and `err`. */
|
|
42
|
+
stdout: CliWritableStream;
|
|
43
|
+
stderr: CliWritableStream;
|
|
44
|
+
/** One line to stdout, through the CLI's redaction. */
|
|
45
|
+
out(line: string): void;
|
|
46
|
+
/** One line to stderr, through the CLI's redaction. */
|
|
47
|
+
err(line: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* The developer's own management client (`KardalumManageClient` from `@kardalum/client`), made
|
|
50
|
+
* on first call: a command that never calls this never resolves a profile or reads a credential.
|
|
51
|
+
* The profile is resolved as for every command (the `KARDALUM_URL` and `KARDALUM_API_KEY` pair,
|
|
52
|
+
* then `options.profile`, `KARDALUM_PROFILE`, the default). A production profile is refused
|
|
53
|
+
* unless the command names it in `options.profile`, so forward the user's own `--profile`.
|
|
54
|
+
* Typed `unknown` here so the SDK carries no dependency on the client; cast it to
|
|
55
|
+
* `KardalumManageClient`.
|
|
56
|
+
*/
|
|
57
|
+
client(options?: {
|
|
58
|
+
profile?: string;
|
|
59
|
+
}): Promise<unknown>;
|
|
60
|
+
}
|
|
61
|
+
/** A command answers nothing (exit 0) or an integer 0 to 255 (that exit code). */
|
|
62
|
+
export type PluginCliCommand = (context: PluginCliContext) => void | number | Promise<void | number>;
|
|
63
|
+
/** A commands module's `commands` export: a plain object, one function per declared name. */
|
|
64
|
+
export type PluginCliCommands = Record<string, PluginCliCommand>;
|
|
65
|
+
/** Returns `commands` unchanged; it only checks each command against `PluginCliCommand`. */
|
|
66
|
+
export declare function defineCliCommands<T extends PluginCliCommands>(commands: T): T;
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// The `@kardalum/plugin-sdk/cli` subpath (M32 F3b, D7): the types of the commands a plugin package adds
|
|
2
|
+
// to the `kardalum` CLI, and `defineCliCommands`, an identity helper that checks a commands object
|
|
3
|
+
// against them. Types only, plus that one function: nothing here imports React or a Node module at
|
|
4
|
+
// run time, so the commands module of a package can import it cheaply.
|
|
5
|
+
//
|
|
6
|
+
// A package declares its commands in its own package.json (`kardalum.cli`: `plugin`, `module` and
|
|
7
|
+
// `commands`, each with a `name` and a `summary`) and the module exports them as `commands`:
|
|
8
|
+
//
|
|
9
|
+
// import { defineCliCommands } from "@kardalum/plugin-sdk/cli";
|
|
10
|
+
// export const commands = defineCliCommands({
|
|
11
|
+
// audit: async (context) => {
|
|
12
|
+
// const client = await context.client();
|
|
13
|
+
// context.out("checked");
|
|
14
|
+
// },
|
|
15
|
+
// });
|
|
16
|
+
//
|
|
17
|
+
// The CLI runs `kardalum <prefix> <name> [arguments]`, where the prefix is the last segment of the
|
|
18
|
+
// plugin id. A command is code the developer installed: it runs with their rights.
|
|
19
|
+
/** Returns `commands` unchanged; it only checks each command against `PluginCliCommand`. */
|
|
20
|
+
export function defineCliCommands(commands) {
|
|
21
|
+
return commands;
|
|
22
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { FORM_REPLY_REASONS, ContentChildrenQuery, ContentChildrenResponse, ContentItemQuery, ContentItemResponse, ContentTrashBody, ContentTrashResult, CreateContentRequest, LatestVersionQuery, LatestVersionResponse, PublishContentRequest, PublishContentResponse, SaveContentRequest, SaveContentResponse, UnpublishContentRequest, UnpublishContentResponse, ProtectionTellWord } from "@kardalum/api-schemas";
|
|
2
|
+
/** A page of rows plus a way to walk every page. `all()` follows `nextCursor` for you. */
|
|
3
|
+
export interface PluginContentList<T> {
|
|
4
|
+
items: T[];
|
|
5
|
+
nextCursor: string | null;
|
|
6
|
+
all(): AsyncIterable<T>;
|
|
7
|
+
}
|
|
8
|
+
type ContentRow = ContentChildrenResponse["items"][number];
|
|
9
|
+
/**
|
|
10
|
+
* M32 F (D8): the content half of the management client, acting as this plugin within its
|
|
11
|
+
* `contributions.contentAccess`. A call outside the declaration throws ContentAccessRefusedError
|
|
12
|
+
* and sends nothing.
|
|
13
|
+
*/
|
|
14
|
+
export interface PluginContentLibrary {
|
|
15
|
+
getById(id: string, opts?: Partial<Pick<ContentItemQuery, "locale">>): Promise<ContentItemResponse>;
|
|
16
|
+
getLatestVersion(id: string, opts?: Partial<Pick<LatestVersionQuery, "locale">>): Promise<LatestVersionResponse>;
|
|
17
|
+
getChildren(id: string, opts?: Partial<Pick<ContentChildrenQuery, "cursor" | "limit">>): Promise<PluginContentList<ContentRow>>;
|
|
18
|
+
create(body: CreateContentRequest): Promise<ContentItemResponse>;
|
|
19
|
+
save(id: string, body: SaveContentRequest): Promise<SaveContentResponse>;
|
|
20
|
+
publish(id: string, body?: PublishContentRequest): Promise<PublishContentResponse>;
|
|
21
|
+
unpublish(id: string, body?: UnpublishContentRequest): Promise<UnpublishContentResponse>;
|
|
22
|
+
delete(id: string, opts?: Partial<Pick<NonNullable<ContentTrashBody>, "confirm">>): Promise<ContentTrashResult>;
|
|
23
|
+
/** M32 F3 (D19, D20): the id of a document type this plugin's contentAccess names, or null when no type, or
|
|
24
|
+
* more than one, has that name. A name the declaration does not hold throws ContentAccessRefusedError.
|
|
25
|
+
* The plugin's own type of that name answers first; otherwise the one site type of that name, found
|
|
26
|
+
* among the first 2,000 types. The name matches exactly (case and spaces count) and is 1 to 200 characters,
|
|
27
|
+
* the contentAccess name limit. */
|
|
28
|
+
documentTypeId(name: string): Promise<string | null>;
|
|
29
|
+
}
|
|
30
|
+
/** M32 F (D9): thrown by context.content when a call falls outside the plugin's contentAccess. Nothing was sent. */
|
|
31
|
+
export declare class ContentAccessRefusedError extends Error {
|
|
32
|
+
readonly code: "content_access";
|
|
33
|
+
constructor(message: string);
|
|
34
|
+
}
|
|
35
|
+
/** Structural, never instanceof: the plugin's bundle carries its own copy of this class. */
|
|
36
|
+
export declare function isContentAccessRefusedError(value: unknown): value is ContentAccessRefusedError;
|
|
37
|
+
/** M32 H (H20): why a form reply was not queued. */
|
|
38
|
+
export type FormReplyReason = (typeof FORM_REPLY_REASONS)[number];
|
|
39
|
+
export type FormReplyResult = {
|
|
40
|
+
queued: true;
|
|
41
|
+
} | {
|
|
42
|
+
queued: false;
|
|
43
|
+
reason: FormReplyReason;
|
|
44
|
+
};
|
|
45
|
+
/** M32 H (H19): sends one reply to the address a visitor typed into the form, when the site owner switched it on. */
|
|
46
|
+
export type FormReply = (input: {
|
|
47
|
+
field: string;
|
|
48
|
+
subject: string;
|
|
49
|
+
text: string;
|
|
50
|
+
}) => Promise<FormReplyResult>;
|
|
51
|
+
export type ProtectionResult = {
|
|
52
|
+
ok: true;
|
|
53
|
+
reply?: FormReply;
|
|
54
|
+
} | {
|
|
55
|
+
ok: false;
|
|
56
|
+
check: "rate";
|
|
57
|
+
retryAfterSeconds: number;
|
|
58
|
+
} | {
|
|
59
|
+
ok: false;
|
|
60
|
+
check: "hiddenField" | "tooFast" | "token";
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* M32 F4 (D14, D15): the chosen protection provider refused the send (`provider_refused`) or did
|
|
64
|
+
* not answer usably (`provider_unavailable`: a throw, a timeout or a malformed answer). The
|
|
65
|
+
* provider's own reason is logged, never handed on; answer it as the other silent refusals.
|
|
66
|
+
*/
|
|
67
|
+
| {
|
|
68
|
+
ok: false;
|
|
69
|
+
check: "provider";
|
|
70
|
+
reason: "provider_unavailable";
|
|
71
|
+
}
|
|
72
|
+
/** M33 K53: a refusal may carry `tell`, the one word the provider's `verify` answered from `PROTECTION_TELL_WORDS`
|
|
73
|
+
* (`"needsScript"`: the send came without the check's script; `"expired"`: the answer's challenge had run
|
|
74
|
+
* out; `"unavailable"`: the provider could not check). It is a plain word, never provider text; a caller
|
|
75
|
+
* that does not know it answers as it always did. A caller that tells its visitor answers `"expired"`,
|
|
76
|
+
* `"unavailable"` and `provider_unavailable` alike ("not sent, please send it again") and keeps every
|
|
77
|
+
* refusal without a word silent: a wrong or reused answer is never told. */
|
|
78
|
+
| {
|
|
79
|
+
ok: false;
|
|
80
|
+
check: "provider";
|
|
81
|
+
reason: "provider_refused";
|
|
82
|
+
tell?: ProtectionTellWord;
|
|
83
|
+
};
|
|
84
|
+
/** Defined once in `@kardalum/api-schemas`: the field names, a fresh token and the live minimum time. */
|
|
85
|
+
export type { ProtectionFields } from "@kardalum/api-schemas";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** M32 F (D9): thrown by context.content when a call falls outside the plugin's contentAccess. Nothing was sent. */
|
|
2
|
+
export class ContentAccessRefusedError extends Error {
|
|
3
|
+
code = "content_access";
|
|
4
|
+
constructor(message) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = "ContentAccessRefusedError";
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/** Structural, never instanceof: the plugin's bundle carries its own copy of this class. */
|
|
10
|
+
export function isContentAccessRefusedError(value) {
|
|
11
|
+
if (typeof value !== "object" || value === null)
|
|
12
|
+
return false;
|
|
13
|
+
const candidate = value;
|
|
14
|
+
return candidate.name === "ContentAccessRefusedError" && candidate.code === "content_access";
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface PagePickerSheetProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
onOpenChange: (open: boolean) => void;
|
|
4
|
+
startNode: string | null;
|
|
5
|
+
documentTypes: string[];
|
|
6
|
+
multiple: boolean;
|
|
7
|
+
/** How many more pages the field takes. */
|
|
8
|
+
remaining: number;
|
|
9
|
+
/** The pages the field holds already. */
|
|
10
|
+
chosen: string[];
|
|
11
|
+
onChoose: (ids: string[]) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function PagePickerSheet(props: PagePickerSheetProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useId, useState } from "react";
|
|
3
|
+
import { ChevronRight } from "lucide-react";
|
|
4
|
+
import { Button, Checkbox, cn, Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, TruncatedText, IconTooltip } from "@kardalum/ui";
|
|
5
|
+
import { useContentHost, usePluginApi } from "../plugin-context.js";
|
|
6
|
+
import { usePluginTranslate } from "../plugin-screen-context.js";
|
|
7
|
+
import { fetchNode, useLevel } from "./page-tree.js";
|
|
8
|
+
// Whole class names so the stylesheet scan finds them; the depth is capped at 8.
|
|
9
|
+
const INDENT = ["ps-0", "ps-4", "ps-8", "ps-12", "ps-16", "ps-20", "ps-24", "ps-28", "ps-32"];
|
|
10
|
+
const indentFor = (depth) => INDENT[Math.min(depth, 8)];
|
|
11
|
+
function lastSegment(path) {
|
|
12
|
+
return path.split("/").filter((part) => part !== "").pop() ?? path;
|
|
13
|
+
}
|
|
14
|
+
function PageRow({ row, depth, selection, startOpen = false }) {
|
|
15
|
+
const t = usePluginTranslate();
|
|
16
|
+
const [open, setOpen] = useState(startOpen);
|
|
17
|
+
const controlId = useId();
|
|
18
|
+
const allowed = selection.documentTypes.length === 0 || (row.documentTypeId !== null && selection.documentTypes.includes(row.documentTypeId));
|
|
19
|
+
const selectable = allowed && row.readable;
|
|
20
|
+
const alreadyChosen = selection.chosen.includes(row.id);
|
|
21
|
+
const picked = selection.selected.includes(row.id);
|
|
22
|
+
const full = selection.multiple && !picked && selection.selected.length >= selection.remaining;
|
|
23
|
+
const checked = alreadyChosen || picked;
|
|
24
|
+
return (_jsxs("li", { children: [_jsxs("div", { className: cn("flex items-center gap-2 py-1", indentFor(depth)), children: [row.expandable ? (_jsx(IconTooltip, { children: _jsx(Button, { type: "button", variant: "ghost", size: "sm", "aria-expanded": open, "aria-label": t(open ? "contentPicker.collapse" : "contentPicker.expand", { name: row.name }), onClick: () => setOpen(!open), children: _jsx(ChevronRight, { "aria-hidden": "true", className: cn("size-4 transition-transform", open ? "rotate-90" : "rtl:rotate-180") }) }) })) : (_jsx("span", { "aria-hidden": "true", className: "inline-block w-9 shrink-0" })), selectable &&
|
|
25
|
+
(selection.multiple ? (_jsx(Checkbox, { id: controlId, checked: checked, disabled: alreadyChosen || full, onCheckedChange: () => selection.toggle(row.id) })) : (_jsx("input", { id: controlId, type: "radio", name: selection.groupName, checked: checked, disabled: alreadyChosen, onChange: () => selection.toggle(row.id), className: "size-4 shrink-0 accent-primary-600" }))), selectable ? (_jsx("label", { htmlFor: controlId, className: "min-w-0 flex-1 cursor-pointer text-sm text-text-primary", children: _jsx(TruncatedText, { children: row.name }) })) : (_jsx(TruncatedText, { className: "min-w-0 flex-1 text-sm text-text-tertiary", children: row.name })), alreadyChosen && _jsx("span", { className: "shrink-0 text-xs text-text-tertiary", children: t("contentPicker.chosen") })] }), open && _jsx(Branch, { parentId: row.id, depth: depth + 1, selection: selection })] }));
|
|
26
|
+
}
|
|
27
|
+
function Branch({ parentId, depth, selection }) {
|
|
28
|
+
const t = usePluginTranslate();
|
|
29
|
+
const level = useLevel(parentId);
|
|
30
|
+
const rows = level.items.map((node) => ({
|
|
31
|
+
id: node.id,
|
|
32
|
+
name: node.name ?? lastSegment(node.path),
|
|
33
|
+
documentTypeId: node.documentTypeId,
|
|
34
|
+
readable: node.access.read,
|
|
35
|
+
expandable: node.childCount !== 0,
|
|
36
|
+
}));
|
|
37
|
+
return (_jsxs(_Fragment, { children: [level.status === "loading" && (_jsx("p", { role: "status", className: cn("py-1 text-sm text-text-tertiary", indentFor(depth)), children: t("contentPicker.loading") })), level.status === "failed" && (_jsx("p", { role: "alert", className: cn("py-1 text-sm text-danger-600", indentFor(depth)), children: t("contentPicker.loadFailed") })), rows.length > 0 && (_jsx("ul", { className: "flex flex-col", children: rows.map((row) => (_jsx(PageRow, { row: row, depth: depth, selection: selection }, row.id))) })), level.nextCursor !== null && level.status !== "failed" && (_jsx("div", { className: indentFor(depth), children: _jsx(Button, { type: "button", variant: "ghost", size: "sm", disabled: level.more, onClick: level.loadMore, children: t("contentPicker.loadMore") }) }))] }));
|
|
38
|
+
}
|
|
39
|
+
function StartBranch({ startNode, selection }) {
|
|
40
|
+
const t = usePluginTranslate();
|
|
41
|
+
const fetchApi = usePluginApi();
|
|
42
|
+
const culture = useContentHost()?.culture;
|
|
43
|
+
const [state, setState] = useState({
|
|
44
|
+
status: "loading",
|
|
45
|
+
summary: null,
|
|
46
|
+
});
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
let cancelled = false;
|
|
49
|
+
setState({ status: "loading", summary: null });
|
|
50
|
+
fetchNode(fetchApi, startNode, culture)
|
|
51
|
+
.then((summary) => {
|
|
52
|
+
if (!cancelled)
|
|
53
|
+
setState({ status: summary && summary.state === "live" ? "ready" : "failed", summary });
|
|
54
|
+
})
|
|
55
|
+
.catch(() => {
|
|
56
|
+
if (!cancelled)
|
|
57
|
+
setState({ status: "failed", summary: null });
|
|
58
|
+
});
|
|
59
|
+
return () => {
|
|
60
|
+
cancelled = true;
|
|
61
|
+
};
|
|
62
|
+
}, [fetchApi, startNode, culture]);
|
|
63
|
+
if (state.status === "loading") {
|
|
64
|
+
return (_jsx("p", { role: "status", className: "text-sm text-text-tertiary", children: t("contentPicker.loading") }));
|
|
65
|
+
}
|
|
66
|
+
if (state.status === "failed" || !state.summary) {
|
|
67
|
+
return (_jsx("p", { role: "alert", className: "text-sm text-danger-600", children: t("contentPicker.loadFailed") }));
|
|
68
|
+
}
|
|
69
|
+
const summary = state.summary;
|
|
70
|
+
const row = {
|
|
71
|
+
id: summary.id,
|
|
72
|
+
name: summary.name ?? lastSegment(summary.path ?? summary.id),
|
|
73
|
+
documentTypeId: summary.documentTypeId,
|
|
74
|
+
readable: summary.readable,
|
|
75
|
+
expandable: true,
|
|
76
|
+
};
|
|
77
|
+
return (_jsx("ul", { className: "flex flex-col", children: _jsx(PageRow, { row: row, depth: 0, selection: selection, startOpen: true }) }));
|
|
78
|
+
}
|
|
79
|
+
function SheetBody(props) {
|
|
80
|
+
const t = usePluginTranslate();
|
|
81
|
+
const [selected, setSelected] = useState([]);
|
|
82
|
+
const groupName = useId();
|
|
83
|
+
const selection = {
|
|
84
|
+
multiple: props.multiple,
|
|
85
|
+
remaining: props.remaining,
|
|
86
|
+
documentTypes: props.documentTypes,
|
|
87
|
+
chosen: props.chosen,
|
|
88
|
+
selected,
|
|
89
|
+
groupName,
|
|
90
|
+
toggle: (id) => setSelected((current) => {
|
|
91
|
+
if (!props.multiple)
|
|
92
|
+
return [id];
|
|
93
|
+
return current.includes(id) ? current.filter((entry) => entry !== id) : [...current, id];
|
|
94
|
+
}),
|
|
95
|
+
};
|
|
96
|
+
const atMax = props.multiple && selected.length >= props.remaining;
|
|
97
|
+
const title = t(props.multiple ? "contentPicker.sheetTitleMany" : "contentPicker.sheetTitle");
|
|
98
|
+
return (_jsxs(_Fragment, { children: [_jsxs(SheetHeader, { className: "flex-col items-start gap-1", children: [_jsx(SheetTitle, { children: title }), _jsx(SheetDescription, { children: t("contentPicker.sheetHint") })] }), _jsx("div", { role: "group", "aria-label": title, className: "min-h-0 flex-1 overflow-y-auto px-4 py-2", children: props.startNode !== null ? (_jsx(StartBranch, { startNode: props.startNode, selection: selection })) : (_jsx(Branch, { parentId: null, depth: 0, selection: selection })) }), atMax && (_jsx("p", { role: "status", className: "px-4 text-sm text-text-secondary", children: t("contentPicker.atMax", { max: props.remaining }) })), _jsxs(SheetFooter, { children: [_jsx(Button, { type: "button", variant: "outline", onClick: () => props.onOpenChange(false), children: t("contentPicker.cancel") }), _jsx(Button, { type: "button", disabled: selected.length === 0, onClick: () => {
|
|
99
|
+
props.onChoose(selected);
|
|
100
|
+
props.onOpenChange(false);
|
|
101
|
+
}, children: t("contentPicker.done") })] })] }));
|
|
102
|
+
}
|
|
103
|
+
export function PagePickerSheet(props) {
|
|
104
|
+
return (_jsx(Sheet, { open: props.open, onOpenChange: props.onOpenChange, children: _jsx(SheetContent, { children: _jsx(SheetBody, { ...props }) }) }));
|
|
105
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ContentChildrenResponse, ContentNodeWithName, ContentSummary } from "@kardalum/api-schemas";
|
|
2
|
+
import { type PluginFetch } from "../plugin-context.js";
|
|
3
|
+
export declare const LEVEL_PAGE_SIZE = 50;
|
|
4
|
+
export type SummaryMark = "missing" | "trashed" | "draft" | "noAccess";
|
|
5
|
+
export declare function summaryMark(summary: ContentSummary | undefined): SummaryMark | null;
|
|
6
|
+
/** One level of the tree: the roots (parentId null) or the children of a node. */
|
|
7
|
+
export declare function fetchLevel(fetchApi: PluginFetch, parentId: string | null, cursor?: string): Promise<ContentChildrenResponse>;
|
|
8
|
+
/** The start node's summary, or null when it is not there. */
|
|
9
|
+
export declare function fetchNode(fetchApi: PluginFetch, id: string, culture?: string): Promise<ContentSummary | null>;
|
|
10
|
+
export type LevelStatus = "loading" | "ready" | "failed";
|
|
11
|
+
export interface Level {
|
|
12
|
+
items: ContentNodeWithName[];
|
|
13
|
+
nextCursor: string | null;
|
|
14
|
+
status: LevelStatus;
|
|
15
|
+
/** True while a following page is being read. */
|
|
16
|
+
more: boolean;
|
|
17
|
+
loadMore: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function useLevel(parentId: string | null): Level;
|
|
20
|
+
export interface PageSummaries {
|
|
21
|
+
status: "idle" | "loading" | "ready" | "failed";
|
|
22
|
+
byId: Map<string, ContentSummary>;
|
|
23
|
+
}
|
|
24
|
+
/** One read per distinct id set; idle for an empty list. */
|
|
25
|
+
export declare function usePageSummaries(ids: string[]): PageSummaries;
|