@kardalum/plugin-sdk 0.18.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 +253 -0
- package/README.md +20 -1
- package/dist/admin-section-registry.d.ts +16 -1
- package/dist/admin-section-registry.js +23 -0
- package/dist/assets/asset-picker.js +3 -3
- package/dist/built-in-editor-ids.d.ts +1 -1
- package/dist/built-in-editor-ids.js +2 -20
- package/dist/built-in-serializers.js +1 -1
- package/dist/built-in-settings-schemas.d.ts +10 -0
- package/dist/built-in-settings-schemas.js +90 -4
- package/dist/built-in-value-schemas.js +35 -0
- package/dist/built-ins.js +48 -17
- 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 +9 -3
- package/dist/datatype-validation.d.ts +6 -11
- package/dist/datatype-validation.js +141 -3
- package/dist/define-plugin.d.ts +4 -4
- package/dist/define-plugin.js +5 -5
- 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 +38 -4
- package/dist/index.js +54 -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 +292 -24
- package/dist/manifest.d.ts +450 -51
- package/dist/manifest.js +1 -1
- package/dist/media/media-picker.js +33 -20
- 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-context.js +3 -3
- 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/register-built-ins.js +6 -6
- package/dist/registry.js +1 -1
- package/dist/richtext/block-panel.js +12 -7
- package/dist/richtext/extensions.js +7 -7
- package/dist/richtext/insert-menu.js +12 -9
- package/dist/richtext/style-listbox.js +7 -5
- package/dist/richtext/text-style-class.js +1 -1
- 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 +27 -27
- package/dist/structured-storage-types.d.ts +309 -9
- package/dist/structured-storage-types.js +2 -2
- 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/ui-entry.js +3 -3
- package/dist/views/asset-view.js +6 -3
- 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 +9 -6
- 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-code-editor.js +2 -2
- package/dist/views/html-view.js +12 -11
- package/dist/views/image-view.js +40 -22
- 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 +32 -16
- 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-error.schema.js +1 -1
- 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/asset-api.schema.js +1 -1
- 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/auth.schema.js +1 -1
- 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 +116 -3
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +71 -18
- 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-trash-api.schema.js +3 -3
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +1 -1
- 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 +9 -1
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +4 -4
- 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 +267 -12
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +54 -8
- 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 +98 -13
- 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 +122 -43
- package/node_modules/@kardalum/api-schemas/dist/index.js +92 -27
- 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/listing-categories.schema.d.ts +46 -0
- package/node_modules/@kardalum/api-schemas/dist/listing-categories.schema.js +52 -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 +359 -8
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +85 -11
- 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 +22 -10
- 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 +9 -5
- 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-text.js +1 -0
- 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 +357 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +279 -0
- 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-registry-api.schema.js +1 -1
- 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 +50 -7
- 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/render-editing.js +4 -4
- package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.js +1 -1
- 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 +289 -0
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +205 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +121 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +51 -10
- 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/snapshot.schema.js +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-api.schema.js +1 -1
- 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/theme-api.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.js +1 -1
- 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 +35 -4
- 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.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/build-css.js +8 -2
- 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/tailwind-theme.js +3 -3
- package/node_modules/@kardalum/design-tokens/dist/theme-css.d.ts +2 -2
- package/node_modules/@kardalum/design-tokens/dist/theme-css.js +2 -2
- package/node_modules/@kardalum/design-tokens/dist/theme-types.d.ts +2 -2
- package/node_modules/@kardalum/design-tokens/dist/themes/dark.d.ts +3 -3
- package/node_modules/@kardalum/design-tokens/dist/themes/dark.js +3 -3
- package/node_modules/@kardalum/design-tokens/dist/themes/light.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/themes/light.js +1 -1
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +15 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +4 -4
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +17 -8
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +8 -3
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +2 -2
- package/node_modules/@kardalum/design-tokens/dist/types.js +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 +27 -5
- 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/envelope.d.ts +2 -2
- package/node_modules/@kardalum/plugin-package/dist/envelope.js +2 -2
- package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +3 -3
- package/node_modules/@kardalum/plugin-package/dist/extract.js +9 -9
- package/node_modules/@kardalum/plugin-package/dist/hash.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/hash.js +1 -1
- 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/plugin-package/dist/package-contract.d.ts +2 -2
- package/node_modules/@kardalum/plugin-package/dist/package-contract.js +5 -5
- package/node_modules/@kardalum/plugin-package/dist/types.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/alert-dialog.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/alert-dialog.js +8 -3
- package/node_modules/@kardalum/ui/dist/components/badge.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/button.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.js +49 -4
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.d.ts +5 -1
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +18 -5
- package/node_modules/@kardalum/ui/dist/components/empty-state.d.ts +4 -4
- package/node_modules/@kardalum/ui/dist/components/input.js +6 -1
- package/node_modules/@kardalum/ui/dist/components/property-field.js +3 -3
- package/node_modules/@kardalum/ui/dist/components/sheet.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/sheet.js +12 -7
- package/node_modules/@kardalum/ui/dist/components/skeleton.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/tab-strip.d.ts +3 -3
- package/node_modules/@kardalum/ui/dist/components/toast.js +4 -3
- package/node_modules/@kardalum/ui/dist/components/tooltip.d.ts +27 -0
- package/node_modules/@kardalum/ui/dist/components/tooltip.js +81 -0
- package/node_modules/@kardalum/ui/dist/components/truncated-text.d.ts +16 -0
- package/node_modules/@kardalum/ui/dist/components/truncated-text.js +95 -0
- package/node_modules/@kardalum/ui/dist/components/use-toast.js +2 -2
- package/node_modules/@kardalum/ui/dist/index.d.ts +3 -1
- package/node_modules/@kardalum/ui/dist/index.js +3 -1
- package/node_modules/@kardalum/ui/dist/lib/menu-host.d.ts +5 -0
- package/node_modules/@kardalum/ui/dist/lib/menu-host.js +17 -0
- package/node_modules/@kardalum/ui/package.json +8 -6
- package/package.json +18 -7
|
@@ -4,19 +4,21 @@ import { CONTENT_LIST_DEFAULT_SETTINGS, } from "@kardalum/api-schemas";
|
|
|
4
4
|
import { Badge, Button, Input } from "@kardalum/ui";
|
|
5
5
|
import { Lock } from "lucide-react";
|
|
6
6
|
import { MANAGE_API, useContentHost, usePluginApi, usePluginSettings, } from "../plugin-context.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
import { useAdminChromeProps, useContentTypingProps, useSdkLocale, useSdkString, } from "../sdk-strings.js";
|
|
8
|
+
/** Column headers for the six built-in row properties, as keys of the
|
|
9
|
+
* SDK's strings (S366f D11). */
|
|
10
|
+
export const CONTENT_LIST_PROPERTY_KEYS = {
|
|
11
|
+
name: "contentList.propertyName",
|
|
12
|
+
id: "contentList.propertyId",
|
|
13
|
+
url: "contentList.propertyUrl",
|
|
14
|
+
status: "contentList.propertyStatus",
|
|
15
|
+
updatedAt: "contentList.propertyUpdatedAt",
|
|
16
|
+
publishedAt: "contentList.propertyPublishedAt",
|
|
15
17
|
};
|
|
16
|
-
const
|
|
17
|
-
draft: "
|
|
18
|
-
published: "
|
|
19
|
-
changes: "
|
|
18
|
+
const STATUS_KEYS = {
|
|
19
|
+
draft: "contentList.statusDraft",
|
|
20
|
+
published: "contentList.statusPublished",
|
|
21
|
+
changes: "contentList.statusChanges",
|
|
20
22
|
};
|
|
21
23
|
const STATUS_VARIANTS = {
|
|
22
24
|
draft: "neutral",
|
|
@@ -25,19 +27,17 @@ const STATUS_VARIANTS = {
|
|
|
25
27
|
};
|
|
26
28
|
const PAGE_SIZE = 25;
|
|
27
29
|
const SEARCH_DEBOUNCE_MS = 300;
|
|
28
|
-
const LOAD_ERROR = "Could not load the children.";
|
|
29
30
|
// S278b (D1, D14): what a locked row says. A row the person may not read
|
|
30
31
|
// arrives with `fields: {}` (its name, url and status stay), so its field
|
|
31
|
-
// cells say so instead of rendering as empty.
|
|
32
|
-
const RESTRICTED_FOR_YOU = "Restricted for you";
|
|
33
|
-
const RESTRICTED_CELL = "Restricted";
|
|
32
|
+
// cells say so instead of rendering as empty (contentList.restricted).
|
|
34
33
|
/** D1: a restriction refused one of the row's actions. A refusal by the
|
|
35
34
|
* role is not the page's doing, so it lights no lock. */
|
|
36
35
|
function isRestrictedForYou(row) {
|
|
37
36
|
return Object.values(row.access?.denied ?? {}).some((denial) => denial?.reason === "not-granted");
|
|
38
37
|
}
|
|
39
38
|
function LockMark() {
|
|
40
|
-
|
|
39
|
+
const s = useSdkString();
|
|
40
|
+
return (_jsx("span", { role: "img", "aria-label": s("contentList.restrictedForYou"), className: "inline-flex shrink-0 text-text-tertiary", children: _jsx(Lock, { "aria-hidden": "true", className: "size-3" }) }));
|
|
41
41
|
}
|
|
42
42
|
// The row's own keyboard stop: the name is the only control in a row, so
|
|
43
43
|
// it carries the focus ring the row would otherwise need.
|
|
@@ -59,9 +59,9 @@ export function findFieldInTypes(fieldId, documentTypes) {
|
|
|
59
59
|
}
|
|
60
60
|
/** The header text for a column: an explicit label wins, then the field's
|
|
61
61
|
* own name where a document type declares it, then the raw alias. */
|
|
62
|
-
export function contentListColumnHeader(column, documentTypes) {
|
|
62
|
+
export function contentListColumnHeader(column, documentTypes, s) {
|
|
63
63
|
if (column.kind === "property")
|
|
64
|
-
return
|
|
64
|
+
return s(CONTENT_LIST_PROPERTY_KEYS[column.property]);
|
|
65
65
|
if (column.label)
|
|
66
66
|
return column.label;
|
|
67
67
|
return findFieldInTypes(column.fieldId, documentTypes)?.fieldName ?? column.fieldId;
|
|
@@ -73,7 +73,7 @@ export function contentListColumnHeader(column, documentTypes) {
|
|
|
73
73
|
export function resolveContentListColumns(settings) {
|
|
74
74
|
return settings.columns && settings.columns.length > 0 ? settings.columns : CONTENT_LIST_DEFAULT_SETTINGS.columns;
|
|
75
75
|
}
|
|
76
|
-
function renderFieldValue(value) {
|
|
76
|
+
function renderFieldValue(value, s) {
|
|
77
77
|
if (value === undefined || value === null)
|
|
78
78
|
return null;
|
|
79
79
|
if (typeof value === "string")
|
|
@@ -81,23 +81,23 @@ function renderFieldValue(value) {
|
|
|
81
81
|
if (typeof value === "number")
|
|
82
82
|
return _jsx("span", { dir: "auto", children: String(value) });
|
|
83
83
|
if (typeof value === "boolean")
|
|
84
|
-
return value ? "
|
|
84
|
+
return value ? s("contentList.yes") : s("contentList.no");
|
|
85
85
|
if (typeof value !== "object")
|
|
86
|
-
return "
|
|
86
|
+
return s("contentList.value");
|
|
87
87
|
const candidate = value;
|
|
88
88
|
// A TipTap/ProseMirror document. Deliberately named rather than
|
|
89
89
|
// flattened to text: a list cell is not where a body is read, and a
|
|
90
90
|
// partial flattening would misrepresent what the field holds.
|
|
91
91
|
if (candidate["type"] === "doc")
|
|
92
|
-
return "
|
|
92
|
+
return s("contentList.valueRichText");
|
|
93
93
|
if (candidate["type"] === undefined && (candidate["mediaId"] !== undefined || candidate["id"] !== undefined)) {
|
|
94
|
-
return "
|
|
94
|
+
return s("contentList.valueImage");
|
|
95
95
|
}
|
|
96
96
|
// The built-in date range's real member names (built-in-value-schemas.ts
|
|
97
97
|
// and date-range-view.tsx), not from/to.
|
|
98
98
|
if (candidate["start"] !== undefined || candidate["end"] !== undefined)
|
|
99
|
-
return "
|
|
100
|
-
return "
|
|
99
|
+
return s("contentList.valueDateRange");
|
|
100
|
+
return s("contentList.value");
|
|
101
101
|
}
|
|
102
102
|
// A stored timestamp can be malformed (a hand-edited row, an import), and
|
|
103
103
|
// a list cell is not the place to take the whole editing screen down over
|
|
@@ -115,6 +115,10 @@ function ContentListTable({ canCreate = false }) {
|
|
|
115
115
|
const fetchApi = usePluginApi();
|
|
116
116
|
const settings = usePluginSettings();
|
|
117
117
|
const searchId = useId();
|
|
118
|
+
const s = useSdkString();
|
|
119
|
+
const locale = useSdkLocale();
|
|
120
|
+
const chrome = useAdminChromeProps();
|
|
121
|
+
const typing = useContentTypingProps();
|
|
118
122
|
const columns = useMemo(() => resolveContentListColumns(settings), [settings]);
|
|
119
123
|
// Only the aliases the configured columns actually show, so the
|
|
120
124
|
// response stays bounded by the table rather than the whole document.
|
|
@@ -172,7 +176,7 @@ function ContentListTable({ canCreate = false }) {
|
|
|
172
176
|
catch {
|
|
173
177
|
if (id !== requestId.current)
|
|
174
178
|
return;
|
|
175
|
-
setError(
|
|
179
|
+
setError(s("contentList.loadError"));
|
|
176
180
|
setFailedCursor(cursor);
|
|
177
181
|
setNextCursor(null);
|
|
178
182
|
focusRowIndex.current = null;
|
|
@@ -181,7 +185,7 @@ function ContentListTable({ canCreate = false }) {
|
|
|
181
185
|
if (id === requestId.current)
|
|
182
186
|
setLoading(false);
|
|
183
187
|
}
|
|
184
|
-
}, [appliedSearch, fetchApi, fieldsParam, nodeId]);
|
|
188
|
+
}, [appliedSearch, fetchApi, fieldsParam, nodeId, s]);
|
|
185
189
|
// `load` changes identity whenever the filter does, which is what makes
|
|
186
190
|
// a changed search term restart from the first page: a cursor minted
|
|
187
191
|
// against the unfiltered list points into a different result set and is
|
|
@@ -201,12 +205,12 @@ function ContentListTable({ canCreate = false }) {
|
|
|
201
205
|
focusRowIndex.current = null;
|
|
202
206
|
bodyRef.current?.querySelectorAll("tr")[index]?.querySelector("button")?.focus();
|
|
203
207
|
}, [items]);
|
|
204
|
-
const dateFormat = useMemo(() => new Intl.DateTimeFormat(
|
|
208
|
+
const dateFormat = useMemo(() => new Intl.DateTimeFormat(locale, { dateStyle: "medium" }), [locale]);
|
|
205
209
|
// A host with no page (the Data Types editor, which hosts this
|
|
206
210
|
// context only for its document types) is the same state as no host at
|
|
207
211
|
// all as far as a table of children goes.
|
|
208
212
|
if (!host || page === null) {
|
|
209
|
-
return _jsx("p", { className: "text-sm text-text-secondary", children: "
|
|
213
|
+
return _jsx("p", { className: "text-sm text-text-secondary", children: s("contentList.pageOnly") });
|
|
210
214
|
}
|
|
211
215
|
// `page` is passed in rather than closed over: it is narrowed to a real
|
|
212
216
|
// page by the guard above, and TypeScript does not carry that narrowing
|
|
@@ -217,7 +221,7 @@ function ContentListTable({ canCreate = false }) {
|
|
|
217
221
|
// A server from before S276 sent no flags: its rows are all readable.
|
|
218
222
|
const readable = row.access?.read !== false;
|
|
219
223
|
if (column.kind === "field") {
|
|
220
|
-
return readable ? (renderFieldValue(row.fields[column.fieldId])) : (_jsx("span", { className: "text-text-tertiary", children:
|
|
224
|
+
return readable ? (renderFieldValue(row.fields[column.fieldId], s)) : (_jsx("span", { className: "text-text-tertiary", children: s("contentList.restricted") }));
|
|
221
225
|
}
|
|
222
226
|
switch (column.property) {
|
|
223
227
|
case "name":
|
|
@@ -227,7 +231,7 @@ function ContentListTable({ canCreate = false }) {
|
|
|
227
231
|
case "url":
|
|
228
232
|
return _jsx("span", { dir: "auto", children: row.url });
|
|
229
233
|
case "status":
|
|
230
|
-
return _jsx(Badge, { variant: STATUS_VARIANTS[row.status], children:
|
|
234
|
+
return _jsx(Badge, { variant: STATUS_VARIANTS[row.status], children: s(STATUS_KEYS[row.status]) });
|
|
231
235
|
case "updatedAt":
|
|
232
236
|
return formatDate(dateFormat, row.updatedAt);
|
|
233
237
|
case "publishedAt":
|
|
@@ -235,10 +239,10 @@ function ContentListTable({ canCreate = false }) {
|
|
|
235
239
|
}
|
|
236
240
|
}
|
|
237
241
|
const documentTypes = host.documentTypes;
|
|
238
|
-
return (_jsxs("div", { className: "flex flex-col gap-3", children: [_jsxs("div", { className: "flex flex-wrap items-end gap-3", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("label", { htmlFor: searchId, className: "text-xs font-medium text-text-secondary", children: "
|
|
242
|
+
return (_jsxs("div", { ...chrome, className: "flex flex-col gap-3", children: [_jsxs("div", { className: "flex flex-wrap items-end gap-3", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("label", { htmlFor: searchId, className: "text-xs font-medium text-text-secondary", children: s("contentList.search") }), _jsx(Input, { id: searchId, ...typing, value: search, onChange: (event) => setSearch(event.target.value) })] }), canCreate && (_jsx(Button, { type: "button", className: "ms-auto", onClick: () => page.createChild(page.nodeId), children: s("contentList.new") }))] }), error && (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("p", { role: "alert", className: "text-sm text-danger-600", children: error }), _jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => void load(failedCursor), children: s("contentList.retry") })] })), items.length > 0 && (_jsxs("table", { className: "w-full border-collapse text-sm text-text-primary", children: [_jsx("caption", { className: "sr-only", children: s("contentList.caption") }), _jsx("thead", { children: _jsx("tr", { children: columns.map((column) => (_jsx("th", { scope: "col", className: CONTENT_LIST_HEADER_CELL_CLASS, children: contentListColumnHeader(column, documentTypes, s) }, contentListColumnKey(column)))) }) }), _jsx("tbody", { ref: bodyRef, children: items.map((row) => (_jsx("tr", { children: columns.map((column) => (_jsx("td", { className: "border-b border-border-subtle px-2 py-2 align-top", children: renderCell(row, column, page) }, contentListColumnKey(column)))) }, row.id))) })] })), loading && (_jsx("p", { role: "status", className: "text-sm text-text-secondary", children: s("contentList.loading") })), !loading && !error && items.length === 0 && (_jsx("p", { role: "status", className: "text-sm text-text-secondary", children: appliedSearch ? s("contentList.noMatches") : s("contentList.noChildren") })), nextCursor !== null && (_jsx(Button, { type: "button", variant: "outline", size: "sm", className: "self-start", disabled: loading, onClick: () => {
|
|
239
243
|
focusRowIndex.current = items.length;
|
|
240
244
|
void load(nextCursor);
|
|
241
|
-
}, children: "
|
|
245
|
+
}, children: s("contentList.loadMore") }))] }));
|
|
242
246
|
}
|
|
243
247
|
export function ContentListInputView() {
|
|
244
248
|
return _jsx(ContentListTable, { canCreate: true });
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useId, useState } from "react";
|
|
3
|
+
import { CONTENT_PICKER_MAX_ITEMS, readContentPickerSettings, readPickedIds } from "@kardalum/api-schemas";
|
|
4
|
+
import { Button, Checkbox, IconTooltip, Input, PropertyField, TruncatedText, cn, usePropertyFieldControl } from "@kardalum/ui";
|
|
5
|
+
import { PagePickerSheet } from "../content-picker/page-picker-sheet.js";
|
|
6
|
+
import { summaryMark, usePageSummaries } from "../content-picker/page-tree.js";
|
|
7
|
+
import { MANAGE_API, usePluginApi, usePluginSettings, usePluginSettingsValue, usePluginValue } from "../plugin-context.js";
|
|
8
|
+
import { usePluginTranslate } from "../plugin-screen-context.js";
|
|
9
|
+
import { readAllPages } from "../read-all-pages.js";
|
|
10
|
+
import { useAdminChromeProps } from "../sdk-strings.js";
|
|
11
|
+
export function ContentPickerInputView() {
|
|
12
|
+
const { value, onChange } = usePluginValue();
|
|
13
|
+
const settings = readContentPickerSettings(usePluginSettings());
|
|
14
|
+
// M32 J (fix wave 2): an id that names no page type (one deleted since, or named by a restored
|
|
15
|
+
// data type) is ignored, as the server ignores it: the types that still exist are offered, and a
|
|
16
|
+
// list with none left offers every page type. Until the types are read, the list is used as stored.
|
|
17
|
+
const pageTypes = usePageTypes(settings.documentTypes.length > 0);
|
|
18
|
+
const offeredTypes = pageTypes.loaded
|
|
19
|
+
? settings.documentTypes.filter((id) => pageTypes.types.some((type) => type.id.toLowerCase() === id))
|
|
20
|
+
: settings.documentTypes;
|
|
21
|
+
const field = usePropertyFieldControl();
|
|
22
|
+
// M32 I2: the group is named and described by the field; the label's `for` (the control id)
|
|
23
|
+
// names the choose button, so a click on the label reaches it, and the button keeps its own
|
|
24
|
+
// name. M32 I5: aria-invalid sits on the button the label names (not a group attribute), and the
|
|
25
|
+
// button carries the error description too.
|
|
26
|
+
// The error description sits on the button only (not the group too), so it is read once.
|
|
27
|
+
const { id: controlId, "aria-invalid": invalid, "aria-describedby": describedBy, ...groupWiring } = field;
|
|
28
|
+
const t = usePluginTranslate();
|
|
29
|
+
const chrome = useAdminChromeProps();
|
|
30
|
+
const [open, setOpen] = useState(false);
|
|
31
|
+
// A list stored under a single setting still shows every entry; the validator asks to keep one.
|
|
32
|
+
const ids = readPickedIds(value);
|
|
33
|
+
const summaries = usePageSummaries(ids);
|
|
34
|
+
const limit = settings.multiple ? (settings.max ?? CONTENT_PICKER_MAX_ITEMS) : 1;
|
|
35
|
+
const remaining = Math.max(0, limit - ids.length);
|
|
36
|
+
const full = remaining === 0 && settings.multiple;
|
|
37
|
+
const store = (next) => {
|
|
38
|
+
if (settings.multiple)
|
|
39
|
+
onChange(next);
|
|
40
|
+
else
|
|
41
|
+
onChange(next[0] ?? null);
|
|
42
|
+
};
|
|
43
|
+
const move = (index, by) => {
|
|
44
|
+
const next = [...ids];
|
|
45
|
+
const [id] = next.splice(index, 1);
|
|
46
|
+
next.splice(index + by, 0, id);
|
|
47
|
+
store(next);
|
|
48
|
+
};
|
|
49
|
+
const openKey = !settings.multiple ? (ids.length === 0 ? "contentPicker.choose" : "contentPicker.change") : "contentPicker.add";
|
|
50
|
+
return (_jsxs("div", { ...chrome, ...groupWiring, role: "group", className: "flex flex-col gap-2", children: [ids.length === 0 && _jsx("p", { className: "text-sm text-text-tertiary", children: t("contentPicker.none") }), ids.length > 0 && (_jsx("ul", { className: "flex flex-col gap-2", children: ids.map((id, index) => {
|
|
51
|
+
const summary = summaries.byId.get(id);
|
|
52
|
+
const inFlight = summaries.status === "loading";
|
|
53
|
+
const mark = summary !== undefined ? summaryMark(summary) : inFlight ? null : summaries.status === "failed" ? "noAccess" : "missing";
|
|
54
|
+
// A page with no readable name shows its mark alone, never its id.
|
|
55
|
+
const markText = mark === null ? null : t(`contentPicker.${mark}`);
|
|
56
|
+
const name = summary?.name ?? markText ?? t("contentPicker.loading");
|
|
57
|
+
return (_jsxs("li", { className: "flex items-center gap-2 rounded-md border border-border-default px-3 py-2", children: [_jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [summary?.name != null && _jsx(TruncatedText, { className: "truncate text-sm text-text-primary", children: summary.name }), summary === undefined && inFlight && _jsx(TruncatedText, { className: "truncate text-sm text-text-tertiary", children: name }), summary?.path && _jsx(TruncatedText, { className: "truncate text-xs text-text-tertiary", children: summary.path }), markText !== null && (_jsx("span", { className: cn("text-xs", summary?.name != null ? "text-text-secondary" : "text-sm text-text-primary"), children: markText }))] }), settings.multiple && (_jsxs(_Fragment, { children: [_jsx(IconTooltip, { children: _jsx(Button, { type: "button", variant: "ghost", size: "sm", disabled: index === 0, "aria-label": t("contentPicker.moveUp", { name }), onClick: () => move(index, -1), children: _jsx("span", { "aria-hidden": "true", children: "\u2191" }) }) }), _jsx(IconTooltip, { children: _jsx(Button, { type: "button", variant: "ghost", size: "sm", disabled: index === ids.length - 1, "aria-label": t("contentPicker.moveDown", { name }), onClick: () => move(index, 1), children: _jsx("span", { "aria-hidden": "true", children: "\u2193" }) }) })] })), _jsx(IconTooltip, { children: _jsx(Button, { type: "button", variant: "ghost", size: "sm", "aria-label": t("contentPicker.removeNamed", { name }), onClick: () => store(ids.filter((entry) => entry !== id)), children: _jsx("span", { "aria-hidden": "true", children: "\u00D7" }) }) })] }, id));
|
|
58
|
+
}) })), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Button, { id: controlId, "aria-label": t(openKey), "aria-invalid": invalid, "aria-describedby": describedBy, type: "button", variant: "outline", size: "sm", disabled: full, onClick: () => setOpen(true), children: t(openKey) }), full && _jsx("span", { className: "text-xs text-text-secondary", children: t("contentPicker.atMax", { max: limit }) })] }), _jsx(PagePickerSheet, { open: open, onOpenChange: setOpen, startNode: settings.startNode, documentTypes: offeredTypes, multiple: settings.multiple, remaining: settings.multiple ? remaining : 1, chosen: ids, onChoose: (picked) => {
|
|
59
|
+
if (settings.multiple)
|
|
60
|
+
store([...ids, ...picked.filter((id) => !ids.includes(id))].slice(0, limit));
|
|
61
|
+
else
|
|
62
|
+
store([picked[0]]);
|
|
63
|
+
} })] }));
|
|
64
|
+
}
|
|
65
|
+
export function ContentPickerReadOnlyView() {
|
|
66
|
+
const { value } = usePluginValue();
|
|
67
|
+
const t = usePluginTranslate();
|
|
68
|
+
const chrome = useAdminChromeProps();
|
|
69
|
+
const ids = readPickedIds(value);
|
|
70
|
+
const summaries = usePageSummaries(ids);
|
|
71
|
+
const parts = ids.map((id) => {
|
|
72
|
+
const summary = summaries.byId.get(id);
|
|
73
|
+
const mark = summary !== undefined ? summaryMark(summary) : summaries.status === "loading" ? null : summaries.status === "failed" ? "noAccess" : "missing";
|
|
74
|
+
const markText = mark === null ? null : t(`contentPicker.${mark}`);
|
|
75
|
+
if (summary?.name == null)
|
|
76
|
+
return markText !== null ? `[${markText}]` : t("contentPicker.loading");
|
|
77
|
+
return markText === null ? summary.name : `${summary.name} [${markText}]`;
|
|
78
|
+
});
|
|
79
|
+
return (_jsx("span", { ...chrome, className: cn("text-sm", parts.length === 0 ? "text-text-tertiary" : "text-text-primary"), children: parts.length === 0 ? t("contentPicker.none") : parts.join(", ") }));
|
|
80
|
+
}
|
|
81
|
+
function usePageTypes(enabled = true) {
|
|
82
|
+
const fetchApi = usePluginApi();
|
|
83
|
+
const [state, setState] = useState({ types: [], failed: false, loaded: false });
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (!enabled)
|
|
86
|
+
return;
|
|
87
|
+
let cancelled = false;
|
|
88
|
+
readAllPages(fetchApi, `${MANAGE_API}/document-types`, "document types", { limit: 100 })
|
|
89
|
+
.then((result) => {
|
|
90
|
+
if (cancelled)
|
|
91
|
+
return;
|
|
92
|
+
const types = result.items.filter((type) => type.kind === "page").map((type) => ({ id: type.id, name: type.name }));
|
|
93
|
+
setState({ types, failed: false, loaded: true });
|
|
94
|
+
})
|
|
95
|
+
.catch(() => {
|
|
96
|
+
if (!cancelled)
|
|
97
|
+
setState({ types: [], failed: true, loaded: false });
|
|
98
|
+
});
|
|
99
|
+
return () => {
|
|
100
|
+
cancelled = true;
|
|
101
|
+
};
|
|
102
|
+
}, [fetchApi, enabled]);
|
|
103
|
+
return state;
|
|
104
|
+
}
|
|
105
|
+
export function ContentPickerSettingsView() {
|
|
106
|
+
const { value: stored, onChange } = usePluginSettingsValue();
|
|
107
|
+
const settings = readContentPickerSettings(stored);
|
|
108
|
+
const t = usePluginTranslate();
|
|
109
|
+
const groupName = useId();
|
|
110
|
+
const maxId = useId();
|
|
111
|
+
const [open, setOpen] = useState(false);
|
|
112
|
+
const startSummary = usePageSummaries(settings.startNode === null ? [] : [settings.startNode]);
|
|
113
|
+
const { types, failed } = usePageTypes();
|
|
114
|
+
const write = (patch) => onChange({ ...stored, ...patch });
|
|
115
|
+
// The start page by its name, or its mark when it is missing, trashed or unreadable, never its id.
|
|
116
|
+
// Only a read in flight is "loading".
|
|
117
|
+
const startName = (() => {
|
|
118
|
+
if (settings.startNode === null)
|
|
119
|
+
return null;
|
|
120
|
+
const summary = startSummary.byId.get(settings.startNode);
|
|
121
|
+
const inFlight = startSummary.status === "loading" || startSummary.status === "idle";
|
|
122
|
+
const mark = summary !== undefined ? summaryMark(summary) : inFlight ? null : startSummary.status === "failed" ? "noAccess" : "missing";
|
|
123
|
+
const markText = mark === null ? null : t(`contentPicker.${mark}`);
|
|
124
|
+
if (summary?.name == null)
|
|
125
|
+
return markText !== null ? `[${markText}]` : t("contentPicker.loading");
|
|
126
|
+
return markText === null ? summary.name : `${summary.name} [${markText}]`;
|
|
127
|
+
})();
|
|
128
|
+
return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(PropertyField, { label: t("contentPicker.startLabel"), helpText: t("contentPicker.startHint"), children: _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { className: "text-sm text-text-primary", children: startName ?? t("contentPicker.wholeTree") }), _jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => setOpen(true), children: t("contentPicker.chooseStart") }), settings.startNode !== null && (_jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => write({ startNode: null }), children: t("contentPicker.clearStart") }))] }) }), _jsx(PagePickerSheet, { open: open, onOpenChange: setOpen, startNode: null, documentTypes: [], multiple: false, remaining: 1, chosen: [], onChoose: (picked) => write({ startNode: picked[0] ?? null }) }), _jsxs("fieldset", { className: "flex flex-col gap-2", children: [_jsx("legend", { className: "text-sm font-medium text-text-primary", children: t("contentPicker.typesLabel") }), _jsx("p", { className: "text-xs text-text-tertiary", children: t("contentPicker.typesHint") }), failed && (_jsx("p", { role: "alert", className: "text-sm text-danger-600", children: t("contentPicker.typesLoadFailed") })), types.map((type) => {
|
|
129
|
+
const id = `${groupName}-${type.id}`;
|
|
130
|
+
return (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Checkbox, { id: id, checked: settings.documentTypes.includes(type.id), onCheckedChange: (checked) => write({
|
|
131
|
+
documentTypes: checked === true
|
|
132
|
+
? [...settings.documentTypes, type.id]
|
|
133
|
+
: settings.documentTypes.filter((entry) => entry !== type.id),
|
|
134
|
+
}) }), _jsx("label", { htmlFor: id, className: "text-sm text-text-primary", children: type.name })] }, type.id));
|
|
135
|
+
})] }), _jsxs("fieldset", { className: "flex flex-col gap-2", children: [_jsx("legend", { className: "text-sm font-medium text-text-primary", children: t("contentPicker.modeLabel") }), [false, true].map((mode) => (_jsxs("label", { className: "flex items-center gap-2 text-sm text-text-primary", children: [_jsx("input", { type: "radio", name: groupName, checked: settings.multiple === mode, onChange: () => write(mode ? { multiple: true } : { multiple: false, max: null }), className: "accent-primary-600" }), t(mode ? "contentPicker.modeMultiple" : "contentPicker.modeSingle")] }, String(mode))))] }), settings.multiple && (_jsx(PropertyField, { label: t("contentPicker.maxLabel"), htmlFor: maxId, helpText: t("contentPicker.maxHint"), children: _jsx(Input, { id: maxId, type: "number", min: 1, max: CONTENT_PICKER_MAX_ITEMS, value: settings.max ?? "", onChange: (event) => {
|
|
136
|
+
const text = event.target.value.trim();
|
|
137
|
+
if (text === "")
|
|
138
|
+
return write({ max: null });
|
|
139
|
+
const n = Math.trunc(Number(text));
|
|
140
|
+
if (Number.isFinite(n))
|
|
141
|
+
write({ max: Math.min(CONTENT_PICKER_MAX_ITEMS, Math.max(1, n)) });
|
|
142
|
+
} }) }))] }));
|
|
143
|
+
}
|
|
@@ -11,12 +11,10 @@ export interface MediaRenditionCut {
|
|
|
11
11
|
/** Opens the host's cropper. Nothing is cut or uploaded here. */
|
|
12
12
|
onCut: () => void;
|
|
13
13
|
/**
|
|
14
|
-
* The control's visible label, from the host
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* package cannot reach. Required, so this package never needs an English
|
|
19
|
-
* default for a string only the host can say.
|
|
14
|
+
* The control's visible label, from the host: the host already has to be
|
|
15
|
+
* involved for the control to exist, and it names the action in its own
|
|
16
|
+
* words. Required, so this package never needs a default for a string
|
|
17
|
+
* only the host can say.
|
|
20
18
|
*/
|
|
21
19
|
label: string;
|
|
22
20
|
/** A cut is in flight: the control does not respond. */
|
package/dist/views/crop-view.js
CHANGED
|
@@ -4,6 +4,7 @@ import { CROP_EDITOR_ID, CropSettingsSchema, THUMBNAIL_EDITOR_ID, ThumbnailSetti
|
|
|
4
4
|
import { Button, Input, PropertyField } from "@kardalum/ui";
|
|
5
5
|
import { usePluginSettings, usePluginSettingsValue, usePluginValue } from "../plugin-context.js";
|
|
6
6
|
import { isRenditionIneligible } from "../rendition-eligibility.js";
|
|
7
|
+
import { sdkStringWithNodes, useSdkString } from "../sdk-strings.js";
|
|
7
8
|
// S234c: the crop and thumbnail editors' field views. A media document
|
|
8
9
|
// type carries one field per rendition it wants, and this is the tile the
|
|
9
10
|
// admin renders for each of them.
|
|
@@ -59,6 +60,7 @@ function CropDisplay({ actionable }) {
|
|
|
59
60
|
const settings = usePluginSettings();
|
|
60
61
|
const { value } = usePluginValue();
|
|
61
62
|
const host = useMediaRendition();
|
|
63
|
+
const s = useSdkString();
|
|
62
64
|
// The builder's field preview mounts every view with an unset value
|
|
63
65
|
// (field-row.tsx's FieldPreview), so undefined and null are one state
|
|
64
66
|
// here: this field holds no rectangle.
|
|
@@ -71,14 +73,16 @@ function CropDisplay({ actionable }) {
|
|
|
71
73
|
// and one this view is not the place to catch.
|
|
72
74
|
const ratio = settings.ratio;
|
|
73
75
|
const status = uncuttable
|
|
74
|
-
? "
|
|
76
|
+
? s("crop.cannotCut")
|
|
75
77
|
: rect === null
|
|
76
|
-
? "
|
|
77
|
-
:
|
|
78
|
-
return (_jsxs("div", { className: "flex flex-col gap-1 text-sm text-text-primary", children: [ratio ? (
|
|
78
|
+
? s("crop.notCut")
|
|
79
|
+
: s("crop.cutRegion", { width: percent(rect.w), height: percent(rect.h) });
|
|
80
|
+
return (_jsxs("div", { className: "flex flex-col gap-1 text-sm text-text-primary", children: [ratio ? (_jsx("p", { className: "font-medium", children: sdkStringWithNodes(s, "crop.ratio", { ratio: _jsx("span", { className: "font-mono", children: ratio }) }) })) : (_jsx("p", { className: "font-medium", children: s("crop.noRatio") })), ratio ? (_jsx("p", { className: "text-xs text-text-secondary", children: sdkStringWithNodes(s, "crop.savesAs", {
|
|
81
|
+
name: (_jsx("span", { className: "font-mono", children: renditionName({
|
|
79
82
|
editorId: CROP_EDITOR_ID,
|
|
80
83
|
settings: { ratio, maxWidth: settings.maxWidth ?? null },
|
|
81
|
-
}) })
|
|
84
|
+
}) })),
|
|
85
|
+
}) })) : null, settings.maxWidth != null ? (_jsx("p", { className: "text-xs text-text-secondary", children: s("crop.maxWidth", { width: settings.maxWidth }) })) : null, _jsx("p", { className: "text-xs text-text-secondary", children: status }), cut ? (_jsx("div", { className: "mt-2 flex items-center gap-2", children: _jsx(Button, { type: "button", variant: "outline", size: "sm", disabled: cut.busy, onClick: cut.onCut, children: cut.label }) })) : null] }));
|
|
82
86
|
}
|
|
83
87
|
export function CropInputView() {
|
|
84
88
|
return _jsx(CropDisplay, { actionable: true });
|
|
@@ -91,11 +95,14 @@ export function CropReadOnlyView() {
|
|
|
91
95
|
function ThumbnailDisplay() {
|
|
92
96
|
const settings = usePluginSettings();
|
|
93
97
|
const host = useMediaRendition();
|
|
98
|
+
const s = useSdkString();
|
|
94
99
|
const longestEdge = settings.longestEdge;
|
|
95
100
|
if (host !== null && isRenditionIneligible(host.sourceMimeType)) {
|
|
96
|
-
return _jsx("p", { className: "text-xs text-text-secondary", children: "
|
|
101
|
+
return _jsx("p", { className: "text-xs text-text-secondary", children: s("thumbnail.cannotCut") });
|
|
97
102
|
}
|
|
98
|
-
return (_jsxs("div", { className: "flex flex-col gap-1 text-sm text-text-primary", children: [_jsx("p", { className: "font-medium", children: "
|
|
103
|
+
return (_jsxs("div", { className: "flex flex-col gap-1 text-sm text-text-primary", children: [_jsx("p", { className: "font-medium", children: s("thumbnail.automatic") }), longestEdge != null ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-xs text-text-secondary", children: s("thumbnail.longestEdge", { size: longestEdge }) }), _jsx("p", { className: "text-xs text-text-secondary", children: sdkStringWithNodes(s, "thumbnail.savesAs", {
|
|
104
|
+
name: (_jsx("span", { className: "font-mono", children: renditionName({ editorId: THUMBNAIL_EDITOR_ID, settings: { longestEdge } }) })),
|
|
105
|
+
}) })] })) : null] }));
|
|
99
106
|
}
|
|
100
107
|
export function ThumbnailInputView() {
|
|
101
108
|
return _jsx(ThumbnailDisplay, {});
|
|
@@ -115,6 +122,7 @@ export function ThumbnailReadOnlyView() {
|
|
|
115
122
|
// mirror of these same Zod schemas (built-in-settings-schemas.ts).
|
|
116
123
|
export function CropSettingsView() {
|
|
117
124
|
const { value: settings, onChange } = usePluginSettingsValue();
|
|
125
|
+
const s = useSdkString();
|
|
118
126
|
const [ratio, setRatio] = useState(settings.ratio ?? "");
|
|
119
127
|
const [maxWidth, setMaxWidth] = useState(settings.maxWidth == null ? "" : String(settings.maxWidth));
|
|
120
128
|
// The whole object, parsed by the schema that owns the shape, and
|
|
@@ -131,20 +139,21 @@ export function CropSettingsView() {
|
|
|
131
139
|
}
|
|
132
140
|
const ratioError = ratio === "" || CropSettingsSchema.shape.ratio.safeParse(ratio).success
|
|
133
141
|
? undefined
|
|
134
|
-
: "
|
|
142
|
+
: s("crop.ratioError");
|
|
135
143
|
const maxWidthError = maxWidth === "" || CropSettingsSchema.shape.maxWidth.safeParse(Number(maxWidth)).success
|
|
136
144
|
? undefined
|
|
137
|
-
: "
|
|
138
|
-
return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(PropertyField, { label: "
|
|
145
|
+
: s("crop.maxWidthError");
|
|
146
|
+
return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(PropertyField, { label: s("crop.ratioLabel"), htmlFor: "crop-settings-ratio", required: true, requiredText: s("crop.required"), helpText: s("crop.ratioHelp"), error: ratioError, children: _jsx(Input, { id: "crop-settings-ratio", value: ratio, onChange: (e) => {
|
|
139
147
|
setRatio(e.target.value);
|
|
140
148
|
commit(e.target.value, maxWidth);
|
|
141
|
-
} }) }), _jsx(PropertyField, { label: "
|
|
149
|
+
} }) }), _jsx(PropertyField, { label: s("crop.maxWidthLabel"), htmlFor: "crop-settings-max-width", helpText: s("crop.maxWidthHelp"), error: maxWidthError, children: _jsx(Input, { id: "crop-settings-max-width", type: "number", min: 1, value: maxWidth, onChange: (e) => {
|
|
142
150
|
setMaxWidth(e.target.value);
|
|
143
151
|
commit(ratio, e.target.value);
|
|
144
152
|
} }) })] }));
|
|
145
153
|
}
|
|
146
154
|
export function ThumbnailSettingsView() {
|
|
147
155
|
const { value: settings, onChange } = usePluginSettingsValue();
|
|
156
|
+
const s = useSdkString();
|
|
148
157
|
const [longestEdge, setLongestEdge] = useState(settings.longestEdge == null ? "" : String(settings.longestEdge));
|
|
149
158
|
function commit(next) {
|
|
150
159
|
const parsed = ThumbnailSettingsSchema.safeParse({ longestEdge: Number(next) });
|
|
@@ -153,8 +162,8 @@ export function ThumbnailSettingsView() {
|
|
|
153
162
|
}
|
|
154
163
|
const longestEdgeError = longestEdge === "" || ThumbnailSettingsSchema.safeParse({ longestEdge: Number(longestEdge) }).success
|
|
155
164
|
? undefined
|
|
156
|
-
: "
|
|
157
|
-
return (_jsx("div", { className: "flex flex-col gap-4", children: _jsx(PropertyField, { label: "
|
|
165
|
+
: s("thumbnail.longestEdgeError");
|
|
166
|
+
return (_jsx("div", { className: "flex flex-col gap-4", children: _jsx(PropertyField, { label: s("thumbnail.longestEdgeLabel"), htmlFor: "thumbnail-settings-longest-edge", required: true, requiredText: s("thumbnail.required"), helpText: s("thumbnail.longestEdgeHelp"), error: longestEdgeError, children: _jsx(Input, { id: "thumbnail-settings-longest-edge", type: "number", min: 1, value: longestEdge, onChange: (e) => {
|
|
158
167
|
setLongestEdge(e.target.value);
|
|
159
168
|
commit(e.target.value);
|
|
160
169
|
} }) }) }));
|
|
@@ -2,8 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useId } from "react";
|
|
3
3
|
import { Input, usePropertyFieldControl } from "@kardalum/ui";
|
|
4
4
|
import { usePluginValue } from "../plugin-context.js";
|
|
5
|
+
import { useAdminChromeProps, useSdkString } from "../sdk-strings.js";
|
|
5
6
|
const EMPTY_RANGE = { start: null, end: null };
|
|
6
|
-
// Two independently-labeled <input type="date"> controls, not one
|
|
7
|
+
// Two independently-labeled <input type="date"> controls, not one, unlike
|
|
7
8
|
// every other built-in view, this value has two members a person needs to
|
|
8
9
|
// tell apart by NAME ("Start" vs "End"), so each gets its own visible
|
|
9
10
|
// <label>. That's why this doesn't follow the single-control idiom the
|
|
@@ -17,16 +18,18 @@ const EMPTY_RANGE = { start: null, end: null };
|
|
|
17
18
|
// child is left unchanged ... the control deep inside it calls
|
|
18
19
|
// usePropertyFieldControl() itself"), each half still shares the outer
|
|
19
20
|
// field's help/error text (aria-describedby) and invalid state
|
|
20
|
-
// (aria-invalid)
|
|
21
|
-
//
|
|
21
|
+
// (aria-invalid), so one field has one error message underneath both inputs.
|
|
22
|
+
// It just doesn't take the field's id/aria-labelledby.
|
|
22
23
|
export function DateRangeInputView() {
|
|
23
24
|
const { value, onChange } = usePluginValue();
|
|
24
25
|
const field = usePropertyFieldControl();
|
|
26
|
+
const s = useSdkString();
|
|
27
|
+
const chrome = useAdminChromeProps();
|
|
25
28
|
const range = value ?? EMPTY_RANGE;
|
|
26
29
|
const reactId = useId();
|
|
27
30
|
const startId = `${field.id ?? reactId}-start`;
|
|
28
31
|
const endId = `${field.id ?? reactId}-end`;
|
|
29
|
-
// Clearing a date input hands back ""
|
|
32
|
+
// Clearing a date input hands back "", normalized to null so downstream
|
|
30
33
|
// (the validate hook, isEmpty, serialization) only ever sees the two
|
|
31
34
|
// states asDateRange() understands: a real ISO string or null, never an
|
|
32
35
|
// empty string standing in for "no value".
|
|
@@ -37,14 +40,14 @@ export function DateRangeInputView() {
|
|
|
37
40
|
"aria-describedby": field["aria-describedby"],
|
|
38
41
|
"aria-invalid": field["aria-invalid"],
|
|
39
42
|
};
|
|
40
|
-
return (_jsxs("div", { className: "flex flex-wrap items-end gap-3", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("label", { htmlFor: startId, className: "text-xs font-medium text-text-secondary", children: "
|
|
43
|
+
return (_jsxs("div", { ...chrome, className: "flex flex-wrap items-end gap-3", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("label", { htmlFor: startId, className: "text-xs font-medium text-text-secondary", children: s("dateRange.start") }), _jsx(Input, { id: startId, type: "date", value: range.start ?? "", onChange: (e) => update("start", e.target.value), ...shared })] }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("label", { htmlFor: endId, className: "text-xs font-medium text-text-secondary", children: s("dateRange.end") }), _jsx(Input, { id: endId, type: "date", value: range.end ?? "", onChange: (e) => update("end", e.target.value), ...shared })] })] }));
|
|
41
44
|
}
|
|
42
45
|
export function DateRangeReadOnlyView() {
|
|
43
46
|
const { value } = usePluginValue();
|
|
44
47
|
const range = value ?? EMPTY_RANGE;
|
|
45
48
|
// A half-filled or fully-empty range never reaches a saved, validated
|
|
46
49
|
// value (the hook above rejects both), but this view renders whatever
|
|
47
|
-
// it's handed
|
|
50
|
+
// it's handed (an in-progress preview, say) without crashing on it.
|
|
48
51
|
// An en dash, not an arrow: "→" is a fixed left-to-right glyph that
|
|
49
52
|
// still points right in an RTL locale, where the two dates read the
|
|
50
53
|
// other way round. A dash carries the same "from … to" sense in both.
|
|
@@ -11,12 +11,10 @@ export interface MediaFileReplace {
|
|
|
11
11
|
*/
|
|
12
12
|
onReplace: (file: File) => void;
|
|
13
13
|
/**
|
|
14
|
-
* The control's visible label, from the host
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* this package cannot reach. Required, so this package never needs an
|
|
19
|
-
* English default for a string only the host can say.
|
|
14
|
+
* The control's visible label, from the host: the host already has to be
|
|
15
|
+
* involved for the control to exist at all, and it names the action in
|
|
16
|
+
* its own words. Required, so this package never needs a default for a
|
|
17
|
+
* string only the host can say.
|
|
20
18
|
*/
|
|
21
19
|
label: string;
|
|
22
20
|
/** A replace is in flight: the control does not respond. */
|
|
@@ -30,7 +28,7 @@ export interface MediaFileProviderProps {
|
|
|
30
28
|
* control renders. One object rather than a handler, a label and a busy
|
|
31
29
|
* flag side by side, so `label` is required at the type level: a host
|
|
32
30
|
* that offers the control cannot forget to name it, and this package
|
|
33
|
-
* needs no
|
|
31
|
+
* needs no default for a string only the host can say.
|
|
34
32
|
*/
|
|
35
33
|
replace?: MediaFileReplace;
|
|
36
34
|
children: ReactNode;
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { createContext, useContext, useRef } from "react";
|
|
3
3
|
import { Button, Input, PropertyField } from "@kardalum/ui";
|
|
4
4
|
import { usePluginSettings, usePluginSettingsValue } from "../plugin-context.js";
|
|
5
|
+
import { useAdminChromeProps, useSdkLocale, useSdkString } from "../sdk-strings.js";
|
|
5
6
|
const MediaFileContext = createContext({ file: null, replace: null });
|
|
6
7
|
// The context value is rebuilt on every render rather than memoized: both
|
|
7
8
|
// halves of it are objects the host owns, and a host that passes fresh
|
|
@@ -21,11 +22,13 @@ export function useMediaFileReplace() {
|
|
|
21
22
|
// KB/MB conversion: exact and unambiguous, and this does not claim any
|
|
22
23
|
// locale-specific unit convention beyond the separators toLocaleString()
|
|
23
24
|
// already applies.
|
|
24
|
-
function formatSize(size) {
|
|
25
|
-
return
|
|
25
|
+
function formatSize(size, s, locale) {
|
|
26
|
+
return s("fileUpload.size", { size: size.toLocaleString(locale) });
|
|
26
27
|
}
|
|
27
|
-
function acceptedExtensionsText(extensions) {
|
|
28
|
-
return extensions && extensions.length > 0
|
|
28
|
+
function acceptedExtensionsText(extensions, s) {
|
|
29
|
+
return extensions && extensions.length > 0
|
|
30
|
+
? s("fileUpload.accepts", { extensions: extensions.join(", ") })
|
|
31
|
+
: s("fileUpload.acceptsAny");
|
|
29
32
|
}
|
|
30
33
|
// The picker, and only the picker. Piece A shipped this field with no
|
|
31
34
|
// Replace control on purpose, because versioned replacement did not exist
|
|
@@ -66,7 +69,12 @@ function FileUploadDisplay({ replaceable }) {
|
|
|
66
69
|
const settings = usePluginSettings();
|
|
67
70
|
const file = useMediaFile();
|
|
68
71
|
const replace = useMediaFileReplace();
|
|
69
|
-
|
|
72
|
+
const s = useSdkString();
|
|
73
|
+
const locale = useSdkLocale();
|
|
74
|
+
// The size line, the accepts line and Replace are the admin's words, so
|
|
75
|
+
// they take the admin's direction and language (S366f D10).
|
|
76
|
+
const chrome = useAdminChromeProps();
|
|
77
|
+
return (_jsxs("div", { ...chrome, className: "flex flex-col gap-1 text-sm text-text-primary", children: [file ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "font-medium", dir: "auto", children: file.filename }), _jsx("p", { className: "text-xs text-text-secondary", children: formatSize(file.size, s, locale) })] })) : (_jsx("p", { className: "text-text-secondary", children: s("fileUpload.noFile") })), _jsx("p", { className: "text-xs text-text-secondary", children: acceptedExtensionsText(settings.extensions, s) }), replaceable && replace && (_jsx(ReplaceControl, { replace: replace, extensions: settings.extensions }))] }));
|
|
70
78
|
}
|
|
71
79
|
export function FileUploadInputView() {
|
|
72
80
|
return _jsx(FileUploadDisplay, { replaceable: true });
|
|
@@ -94,11 +102,12 @@ export function FileUploadReadOnlyView() {
|
|
|
94
102
|
// optional and the server reads an absent one as "anything fits".
|
|
95
103
|
export function FileUploadSettingsView() {
|
|
96
104
|
const { value: settings, onChange } = usePluginSettingsValue();
|
|
97
|
-
|
|
105
|
+
const s = useSdkString();
|
|
106
|
+
return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(PropertyField, { label: s("fileUpload.extensionsLabel"), htmlFor: "file-upload-settings-extensions", helpText: s("fileUpload.extensionsHelp"), children: _jsx(Input, { id: "file-upload-settings-extensions", value: (settings.extensions ?? []).join(","), onChange: (e) => {
|
|
98
107
|
const extensions = e.target.value
|
|
99
108
|
.split(",")
|
|
100
109
|
.map((ext) => ext.trim().toLowerCase())
|
|
101
110
|
.filter((ext) => ext.length > 0);
|
|
102
111
|
onChange({ ...settings, extensions });
|
|
103
|
-
} }) }), _jsx(PropertyField, { label: "
|
|
112
|
+
} }) }), _jsx(PropertyField, { label: s("fileUpload.maxSizeLabel"), htmlFor: "file-upload-settings-max-size", helpText: s("fileUpload.maxSizeHelp"), children: _jsx(Input, { id: "file-upload-settings-max-size", type: "number", min: 1, value: settings.maxSizeBytes ?? "", onChange: (e) => onChange({ ...settings, maxSizeBytes: e.target.value === "" ? undefined : Number(e.target.value) }) }) })] }));
|
|
104
113
|
}
|