@kardalum/plugin-sdk 0.20.0 → 0.21.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 +70 -0
- package/dist/admin-section-registry.d.ts +33 -1
- package/dist/admin-section-registry.js +67 -0
- package/dist/capabilities.js +46 -1
- package/dist/consent-entry.d.ts +11 -0
- package/dist/consent-entry.js +18 -0
- package/dist/content-library.d.ts +17 -0
- package/dist/content-list-extensions.d.ts +50 -0
- package/dist/content-list-extensions.js +11 -0
- package/dist/content-picker/page-picker-sheet.d.ts +2 -0
- package/dist/content-picker/page-picker-sheet.js +1 -1
- package/dist/content-picker/page-picker.d.ts +18 -0
- package/dist/content-picker/page-picker.js +20 -0
- package/dist/datatype-validation.js +10 -2
- package/dist/datatypes-entry.d.ts +1 -0
- package/dist/datatypes-entry.js +2 -0
- package/dist/entitlement-types.d.ts +18 -1
- package/dist/host-entry.d.ts +7 -1
- package/dist/host-entry.js +14 -1
- package/dist/index.d.ts +35 -7
- package/dist/index.js +46 -5
- package/dist/mail.d.ts +6 -2
- package/dist/manifest-entry.d.ts +22 -4
- package/dist/manifest-entry.js +25 -1
- package/dist/manifest-schema.d.ts +570 -31
- package/dist/manifest-schema.js +240 -12
- package/dist/manifest.d.ts +757 -32
- package/dist/manifest.js +8 -4
- package/dist/plugin-context.d.ts +47 -0
- package/dist/plugin-context.js +27 -0
- package/dist/plugin-permissions.d.ts +18 -0
- package/dist/plugin-permissions.js +25 -0
- package/dist/plugin-screen-context.d.ts +152 -11
- package/dist/plugin-screen-context.js +30 -0
- package/dist/providers.d.ts +47 -2
- package/dist/render-page.d.ts +15 -0
- package/dist/render-page.js +20 -0
- package/dist/richtext/block-panel.d.ts +12 -1
- package/dist/richtext/block-panel.js +27 -21
- package/dist/richtext/button-view.d.ts +11 -0
- package/dist/richtext/button-view.js +45 -0
- package/dist/richtext/content-guard.d.ts +4 -0
- package/dist/richtext/content-guard.js +27 -0
- package/dist/richtext/editor-handle.d.ts +34 -0
- package/dist/richtext/editor-handle.js +225 -0
- package/dist/richtext/extensions.d.ts +6 -0
- package/dist/richtext/extensions.js +16 -0
- package/dist/richtext/insert-menu.d.ts +6 -1
- package/dist/richtext/insert-menu.js +38 -18
- package/dist/richtext/item-attributes.d.ts +6 -0
- package/dist/richtext/item-attributes.js +19 -0
- package/dist/richtext/item-panel.d.ts +25 -0
- package/dist/richtext/item-panel.js +118 -0
- package/dist/richtext/item-view.d.ts +58 -0
- package/dist/richtext/item-view.js +172 -0
- package/dist/richtext/mark-form.d.ts +10 -0
- package/dist/richtext/mark-form.js +38 -0
- package/dist/richtext/paste-choice.d.ts +9 -0
- package/dist/richtext/paste-choice.js +13 -0
- package/dist/richtext/plugin-items.d.ts +72 -0
- package/dist/richtext/plugin-items.js +562 -0
- package/dist/richtext/plugin-mark-tooltips.d.ts +5 -0
- package/dist/richtext/plugin-mark-tooltips.js +44 -0
- package/dist/richtext/plugin-toolbar.d.ts +57 -0
- package/dist/richtext/plugin-toolbar.js +186 -0
- package/dist/richtext/rich-item-icons.d.ts +5 -0
- package/dist/richtext/rich-item-icons.js +42 -0
- package/dist/richtext/rich-items.d.ts +42 -0
- package/dist/richtext/rich-items.js +68 -0
- package/dist/richtext/rich-text-view-host.d.ts +24 -0
- package/dist/richtext/rich-text-view-host.js +11 -0
- package/dist/richtext/toolbar-button.d.ts +16 -0
- package/dist/richtext/toolbar-button.js +9 -0
- package/dist/richtext/url-paste.d.ts +20 -0
- package/dist/richtext/url-paste.js +82 -0
- package/dist/richtext-html-entry.d.ts +5 -0
- package/dist/richtext-html-entry.js +11 -0
- package/dist/sdk-strings.d.ts +59 -0
- package/dist/sdk-strings.js +64 -0
- package/dist/service-contract.d.ts +17 -0
- package/dist/service-contract.js +39 -0
- package/dist/services.d.ts +114 -0
- package/dist/services.js +1 -0
- package/dist/structured-storage-types.d.ts +124 -4
- package/dist/tailwind.js +10 -5
- package/dist/template-reads.d.ts +16 -0
- package/dist/template-reads.js +21 -0
- package/dist/testing-entry.d.ts +38 -0
- package/dist/testing-entry.js +173 -0
- package/dist/text-entry.d.ts +1 -1
- package/dist/text-entry.js +3 -2
- package/dist/tokens/system-dark.css +1 -0
- package/dist/tokens/tailwind-theme.css +2 -0
- package/dist/tokens/tokens.css +4 -0
- package/dist/tokens/tokens.json +5 -1
- package/dist/uploads.d.ts +43 -0
- package/dist/uploads.js +1 -0
- package/dist/user-library.d.ts +51 -0
- package/dist/user-library.js +15 -0
- package/dist/view-helpers.d.ts +18 -0
- package/dist/view-helpers.js +64 -0
- package/dist/views/content-list-view.js +207 -8
- package/dist/views/content-picker-view.js +1 -1
- package/dist/views/rich-text-view.d.ts +2 -0
- package/dist/views/rich-text-view.js +182 -24
- package/dist/views/unreadable-rich-text.d.ts +17 -0
- package/dist/views/unreadable-rich-text.js +40 -0
- package/dist/visitors.d.ts +81 -0
- package/dist/visitors.js +1 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-hosts.d.ts +21 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-hosts.js +39 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-redirects.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-app-redirects.js +31 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.d.ts +127 -8
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.js +82 -7
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +5 -1
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +2 -2
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.js +11 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.js +18 -0
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +80 -0
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +41 -2
- package/node_modules/@kardalum/api-schemas/dist/content-reads.schema.d.ts +213 -0
- package/node_modules/@kardalum/api-schemas/dist/content-reads.schema.js +234 -0
- package/node_modules/@kardalum/api-schemas/dist/contribution-issues.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/contribution-issues.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +50 -13
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +19 -10
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +77 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +37 -0
- package/node_modules/@kardalum/api-schemas/dist/experimental-points.d.ts +19 -0
- package/node_modules/@kardalum/api-schemas/dist/experimental-points.js +250 -0
- package/node_modules/@kardalum/api-schemas/dist/form-protection-callers.d.ts +29 -0
- package/node_modules/@kardalum/api-schemas/dist/form-protection-callers.js +31 -0
- package/node_modules/@kardalum/api-schemas/dist/html-scan.d.ts +22 -0
- package/node_modules/@kardalum/api-schemas/dist/html-scan.js +122 -0
- package/node_modules/@kardalum/api-schemas/dist/html-start-tags.d.ts +48 -0
- package/node_modules/@kardalum/api-schemas/dist/html-start-tags.js +381 -0
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +52 -14
- package/node_modules/@kardalum/api-schemas/dist/index.js +53 -9
- package/node_modules/@kardalum/api-schemas/dist/json-depth.d.ts +3 -0
- package/node_modules/@kardalum/api-schemas/dist/json-depth.js +20 -0
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.d.ts +4 -2
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.js +6 -1
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +178 -2
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +10 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.d.ts +3 -3
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +16 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.js +51 -2
- package/node_modules/@kardalum/api-schemas/dist/page-audience.schema.d.ts +87 -0
- package/node_modules/@kardalum/api-schemas/dist/page-audience.schema.js +44 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-admin-slots.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-admin-slots.js +61 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.d.ts +4 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.js +12 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-slots.d.ts +136 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-slots.js +254 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-checks.d.ts +22 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-checks.js +66 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-document.d.ts +130 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-document.js +173 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-fetch.d.ts +16 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-fetch.js +112 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-schema.d.ts +70 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-schema.js +380 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-types.d.ts +3 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-contract-types.js +68 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +18 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +18 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +5 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.d.ts +10 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.js +48 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.d.ts +5 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.js +6 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-events.d.ts +24 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-events.js +53 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-guards.d.ts +112 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-guards.js +118 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +67 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +15 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-kept-parts.d.ts +138 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-kept-parts.js +110 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +80 -15
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +67 -23
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +10 -3
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +33 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +2 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +7 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.d.ts +43 -7
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.js +36 -5
- package/node_modules/@kardalum/api-schemas/dist/plugin-rich-text.d.ts +638 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-rich-text.js +533 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-call.d.ts +36 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-call.js +32 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-connections.d.ts +193 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-connections.js +123 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-declarations.d.ts +209 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-service-declarations.js +372 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-services.d.ts +90 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-services.js +204 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.js +10 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.d.ts +171 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.js +406 -42
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-requests.d.ts +69 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-requests.js +149 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-styles.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-styles.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-uploads.d.ts +96 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-uploads.js +185 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-user-accounts.d.ts +213 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-user-accounts.js +131 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-view-kit.d.ts +54 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-view-kit.js +154 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-visitor-points.d.ts +37 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-visitor-points.js +124 -0
- package/node_modules/@kardalum/api-schemas/dist/render-cache.d.ts +126 -0
- package/node_modules/@kardalum/api-schemas/dist/render-cache.js +263 -0
- package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +303 -0
- package/node_modules/@kardalum/api-schemas/dist/render-editing.js +61 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-paste-hosts.d.ts +14 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-paste-hosts.js +108 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.d.ts +66 -1
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.js +465 -7
- package/node_modules/@kardalum/api-schemas/dist/rich-text-text.js +15 -118
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +110 -0
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.js +36 -0
- package/node_modules/@kardalum/api-schemas/dist/security-overview.schema.d.ts +64 -0
- package/node_modules/@kardalum/api-schemas/dist/security-overview.schema.js +38 -0
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +9 -2
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +7 -2
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +19 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in-steps.d.ts +724 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in-steps.js +408 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.d.ts +5 -3
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.js +3 -1
- package/node_modules/@kardalum/api-schemas/dist/site-consent.d.ts +77 -0
- package/node_modules/@kardalum/api-schemas/dist/site-consent.js +122 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.js +28 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +33 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +26 -1
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +14 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +2 -0
- package/node_modules/@kardalum/api-schemas/dist/visitor-accounts.d.ts +482 -0
- package/node_modules/@kardalum/api-schemas/dist/visitor-accounts.js +380 -0
- package/node_modules/@kardalum/api-schemas/dist/visitor-groups.d.ts +109 -0
- package/node_modules/@kardalum/api-schemas/dist/visitor-groups.js +62 -0
- package/node_modules/@kardalum/api-schemas/package.json +1 -0
- package/node_modules/@kardalum/design-tokens/dist/build-css.js +9 -1
- package/node_modules/@kardalum/design-tokens/dist/system-dark.css +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +4 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +6 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +5 -1
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +4 -0
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +9 -0
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +276 -19
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +23 -0
- package/node_modules/@kardalum/plugin-package/dist/contract-fingerprint.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/contract-fingerprint.js +39 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/admin-styles.d.ts +23 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/admin-styles.js +351 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.js +21 -8
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.js +23 -10
- package/node_modules/@kardalum/plugin-package/dist/delivery/icons.js +3 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +30 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.js +6 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +6 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +6 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.js +24 -6
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +15 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/rich-text.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/rich-text.js +173 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.js +14 -4
- package/node_modules/@kardalum/plugin-package/dist/delivery/services-events.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/services-events.js +35 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sign-in-steps.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sign-in-steps.js +71 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.js +44 -11
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +7 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/user-accounts.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/user-accounts.js +36 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/visitor-points.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/visitor-points.js +33 -0
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +4 -0
- package/node_modules/@kardalum/plugin-package/dist/index.js +5 -0
- package/node_modules/@kardalum/plugin-package/dist/public-suffix.d.ts +7 -0
- package/node_modules/@kardalum/plugin-package/dist/public-suffix.js +23 -0
- package/node_modules/@kardalum/plugin-package/dist/rich-text-summary.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/rich-text-summary.js +27 -0
- package/node_modules/@kardalum/plugin-package/dist/stylesheet-load-hook.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/stylesheet-load-hook.js +28 -0
- package/node_modules/@kardalum/plugin-package/package.json +4 -0
- package/node_modules/@kardalum/ui/dist/components/select.d.ts +6 -0
- package/node_modules/@kardalum/ui/dist/components/select.js +7 -0
- package/node_modules/@kardalum/ui/dist/components/textarea.d.ts +6 -0
- package/node_modules/@kardalum/ui/dist/components/textarea.js +7 -0
- package/node_modules/@kardalum/ui/dist/index.d.ts +2 -0
- package/node_modules/@kardalum/ui/dist/index.js +2 -0
- package/package.json +15 -3
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { EditorContent, useEditor } from "@tiptap/react";
|
|
4
4
|
import { NodeSelection } from "@tiptap/pm/state";
|
|
5
|
+
import { canonicalRichTextJson, itemNodeTypeOf } from "@kardalum/api-schemas";
|
|
5
6
|
import { Code2, Image as ImageIcon, Link as LinkIcon, List as ListIcon, Quote as QuoteIcon } from "lucide-react";
|
|
6
|
-
import { cn,
|
|
7
|
-
import {
|
|
7
|
+
import { cn, usePropertyFieldControl } from "@kardalum/ui";
|
|
8
|
+
import { ToolbarButton, ToolbarSeparator } from "../richtext/toolbar-button.js";
|
|
9
|
+
import { PluginToolbarGroup, usePluginToolbarEntries } from "../richtext/plugin-toolbar.js";
|
|
10
|
+
import { ItemPanel, newItemAttributes } from "../richtext/item-panel.js";
|
|
11
|
+
import { selectedPluginItem } from "../richtext/plugin-items.js";
|
|
12
|
+
import { MANAGE_API, usePluginApi, usePluginFieldContext, usePluginValue } from "../plugin-context.js";
|
|
8
13
|
import { buildRichtextExtensions } from "../richtext/extensions.js";
|
|
14
|
+
import { convertPastedAddress } from "../richtext/url-paste.js";
|
|
15
|
+
import { PasteChoiceMenu } from "../richtext/paste-choice.js";
|
|
9
16
|
import { MediaPicker } from "../media/media-picker.js";
|
|
10
17
|
import { BlockInsertMenu, defaultBlockParams } from "../richtext/insert-menu.js";
|
|
11
18
|
import { BlockPanel, BlockPreviewPopover } from "../richtext/block-panel.js";
|
|
12
19
|
import { StyleListbox } from "../richtext/style-listbox.js";
|
|
13
20
|
import { useInsideNestedField } from "../nested-field-host.js";
|
|
14
21
|
import { useAdminDirection, useAdminLanguage, useSdkString } from "../sdk-strings.js";
|
|
22
|
+
import { richTextOpens, richTextSchemaOf } from "../richtext/content-guard.js";
|
|
23
|
+
import { createRichItemDirectory, useRichItems } from "../richtext/rich-items.js";
|
|
24
|
+
import { renderRichItemIcon } from "../richtext/rich-item-icons.js";
|
|
25
|
+
import { UnreadableRichText } from "./unreadable-rich-text.js";
|
|
15
26
|
// The rich content editor (S197 spec §3): one TipTap editor definition
|
|
16
27
|
// (buildRichtextExtensions), mounted here with a fixed compact toolbar per
|
|
17
28
|
// the mockup's screen 3: the same commands the on-page bubble toolbar
|
|
@@ -133,13 +144,6 @@ function useToolbarRovingTabIndex(focusableKeys, dir) {
|
|
|
133
144
|
}
|
|
134
145
|
return { activeKey, setActiveKey, registerRef, handleKeyDown };
|
|
135
146
|
}
|
|
136
|
-
function ToolbarButton({ itemKey, label, ariaLabel, active, disabled, expanded, hasPopup, isRovingActive, registerRef, onFocus, onClick, }) {
|
|
137
|
-
const button = (_jsx("button", { ref: registerRef, type: "button", "data-testid": `rt-toolbar-${itemKey}`, "aria-label": ariaLabel, "aria-pressed": active, "aria-haspopup": hasPopup, "aria-expanded": hasPopup ? expanded : undefined, disabled: disabled, tabIndex: disabled ? -1 : isRovingActive ? 0 : -1, onFocus: onFocus, onClick: onClick, className: cn("inline-flex h-8 items-center gap-1 rounded-md px-2 text-xs font-medium text-text-secondary hover:bg-background-hover disabled:pointer-events-none disabled:opacity-50", "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600", active && "bg-primary-100 text-primary-800"), children: label }));
|
|
138
|
-
return ariaLabel ? _jsx(IconTooltip, { children: button }) : button;
|
|
139
|
-
}
|
|
140
|
-
function ToolbarSeparator() {
|
|
141
|
-
return _jsx("span", { "aria-hidden": "true", className: "mx-1 inline-block h-4 w-px bg-border-default" });
|
|
142
|
-
}
|
|
143
147
|
// Prompt-free link input (spec-listed toolbar command): a small popover
|
|
144
148
|
// form instead of window.prompt(), so the flow stays keyboard/a11y
|
|
145
149
|
// reachable and themeable, unlike a native prompt dialog.
|
|
@@ -173,7 +177,7 @@ function LinkPopover({ initialHref, hasLink, onApply, onRemove, onClose }) {
|
|
|
173
177
|
// ambient route context, and even ContentEditor itself renders this view
|
|
174
178
|
// with a fixed, prop-less signature).
|
|
175
179
|
const EDIT_ON_PAGE_EVENT = "kardalum:edit-on-page";
|
|
176
|
-
function RichTextToolbar({ editor, containerRef, sourceMode, onToggleSource }) {
|
|
180
|
+
function RichTextToolbar({ editor, containerRef, sourceMode, onToggleSource, items }) {
|
|
177
181
|
const { styles: textStyles, loading: textStylesLoading } = useTextStyles();
|
|
178
182
|
const [openPopover, setOpenPopover] = useState(null);
|
|
179
183
|
const [pickerOpen, setPickerOpen] = useState(false);
|
|
@@ -184,6 +188,10 @@ function RichTextToolbar({ editor, containerRef, sourceMode, onToggleSource }) {
|
|
|
184
188
|
// the editable surface below keeps the content's (S366f D10).
|
|
185
189
|
const dir = useAdminDirection();
|
|
186
190
|
const lang = useAdminLanguage();
|
|
191
|
+
// M35 C4a (design D5): the switched-on plugins' buttons, the first few on the toolbar and the rest under More.
|
|
192
|
+
const { shown: pluginShown, more: pluginMore } = usePluginToolbarEntries(items, lang ?? items.language);
|
|
193
|
+
// M35 C4b (design D16): the field's culture, which a button view's editor handle reads.
|
|
194
|
+
const fieldContext = usePluginFieldContext();
|
|
187
195
|
const activeStyleKey = editor.getAttributes("textStyleClass").styleKey ?? null;
|
|
188
196
|
const allItemKeys = [
|
|
189
197
|
"bold",
|
|
@@ -196,6 +204,8 @@ function RichTextToolbar({ editor, containerRef, sourceMode, onToggleSource }) {
|
|
|
196
204
|
"style",
|
|
197
205
|
"image",
|
|
198
206
|
"block",
|
|
207
|
+
...pluginShown.map((entry) => entry.key),
|
|
208
|
+
...(pluginMore.length > 0 ? ["more"] : []),
|
|
199
209
|
"source",
|
|
200
210
|
...(nested ? [] : ["editOnPage"]),
|
|
201
211
|
];
|
|
@@ -244,9 +254,83 @@ function RichTextToolbar({ editor, containerRef, sourceMode, onToggleSource }) {
|
|
|
244
254
|
attrs: { partial: listing.alias, params: defaultBlockParams(listing.params) },
|
|
245
255
|
})
|
|
246
256
|
.run();
|
|
247
|
-
}, onClose: closePopover }) }))] }), _jsx(ToolbarSeparator, {}), _jsx(ToolbarButton, { itemKey: "source", label: _jsxs(_Fragment, { children: [_jsx(Code2, { "aria-hidden": "true", className: "size-4" }), s("richText.source")] }), ariaLabel: s("richText.toggleSource"), active: sourceMode, isRovingActive: activeKey === "source", registerRef: registerRef("source"), onFocus: () => setActiveKey("source"), onClick: onToggleSource }), !nested && (_jsxs(_Fragment, { children: [_jsx(ToolbarSeparator, {}), _jsx(ToolbarButton, { itemKey: "editOnPage", label: _jsx("span", { className: "text-primary-700", children: `⤢ ${s("richText.editOnPage")}` }), disabled: sourceMode, isRovingActive: activeKey === "editOnPage", registerRef: registerRef("editOnPage"), onFocus: () => setActiveKey("editOnPage"), onClick: () => containerRef.current?.dispatchEvent(new CustomEvent(EDIT_ON_PAGE_EVENT, { bubbles: true })) })] }))] }));
|
|
257
|
+
}, onClose: closePopover, items: items, onInsertItem: (plugin, node) => editor.chain().focus().insertPluginItem(itemNodeTypeOf(node.shape), newItemAttributes(plugin, node)).run() }) }))] }), pluginShown.length + pluginMore.length > 0 && (_jsxs(_Fragment, { children: [_jsx(ToolbarSeparator, {}), _jsx(PluginToolbarGroup, { editor: editor, entries: { shown: pluginShown, more: pluginMore }, items: items, culture: fieldContext?.culture ?? null, sourceMode: sourceMode, activeKey: activeKey, setActiveKey: setActiveKey, registerRef: registerRef, language: lang ?? items.language })] })), _jsx(ToolbarSeparator, {}), _jsx(ToolbarButton, { itemKey: "source", label: _jsxs(_Fragment, { children: [_jsx(Code2, { "aria-hidden": "true", className: "size-4" }), s("richText.source")] }), ariaLabel: s("richText.toggleSource"), active: sourceMode, isRovingActive: activeKey === "source", registerRef: registerRef("source"), onFocus: () => setActiveKey("source"), onClick: onToggleSource }), !nested && (_jsxs(_Fragment, { children: [_jsx(ToolbarSeparator, {}), _jsx(ToolbarButton, { itemKey: "editOnPage", label: _jsx("span", { className: "text-primary-700", children: `⤢ ${s("richText.editOnPage")}` }), disabled: sourceMode, isRovingActive: activeKey === "editOnPage", registerRef: registerRef("editOnPage"), onFocus: () => setActiveKey("editOnPage"), onClick: () => containerRef.current?.dispatchEvent(new CustomEvent(EDIT_ON_PAGE_EVENT, { bubbles: true })) })] }))] }));
|
|
258
|
+
}
|
|
259
|
+
/** M35 C4b (35-C4a review (b)): `value` as `editor`'s schema reads it (attribute defaults filled in), ending in the empty
|
|
260
|
+
* paragraph StarterKit's TrailingNode appends after a last node that is not a paragraph. Null when the schema cannot
|
|
261
|
+
* read it. One read per value: the last answer is kept. */
|
|
262
|
+
const schemaReads = new WeakMap();
|
|
263
|
+
function schemaReadOf(editor, value) {
|
|
264
|
+
if (value === null || typeof value !== "object")
|
|
265
|
+
return null;
|
|
266
|
+
const kept = schemaReads.get(value);
|
|
267
|
+
if (kept && kept.editor === editor)
|
|
268
|
+
return kept.read;
|
|
269
|
+
let read = null;
|
|
270
|
+
try {
|
|
271
|
+
const doc = editor.schema.nodeFromJSON(value).toJSON();
|
|
272
|
+
const content = Array.isArray(doc.content) ? doc.content : [];
|
|
273
|
+
const last = content[content.length - 1];
|
|
274
|
+
read = last !== undefined && last.type !== "paragraph" ? { ...doc, content: [...content, { type: "paragraph" }] } : doc;
|
|
275
|
+
}
|
|
276
|
+
catch {
|
|
277
|
+
read = null;
|
|
278
|
+
}
|
|
279
|
+
schemaReads.set(value, { editor, read });
|
|
280
|
+
return read;
|
|
281
|
+
}
|
|
282
|
+
/** M35 C4a (design section 5): two values equal by value, whatever order a database kept their keys in. */
|
|
283
|
+
export function richTextValuesEqual(a, b) {
|
|
284
|
+
const left = canonicalRichTextJson(a ?? {});
|
|
285
|
+
const right = canonicalRichTextJson(b ?? {});
|
|
286
|
+
return left !== null && right !== null ? left === right : JSON.stringify(a ?? {}) === JSON.stringify(b ?? {});
|
|
287
|
+
}
|
|
288
|
+
/** One item directory a mount, fed by the listing and worded in the admin's language. */
|
|
289
|
+
function useItemDirectory() {
|
|
290
|
+
const s = useSdkString();
|
|
291
|
+
const language = useAdminLanguage();
|
|
292
|
+
// The sentences read the latest translator, so a language switch of the host is picked up at the next repaint.
|
|
293
|
+
const translate = useRef(s);
|
|
294
|
+
translate.current = s;
|
|
295
|
+
const directory = useRef(null);
|
|
296
|
+
directory.current ??= createRichItemDirectory({
|
|
297
|
+
language: language ?? "en",
|
|
298
|
+
// Each sentence is interpolated by the host's own translator (the admin's i18next, or the SDK's English table).
|
|
299
|
+
words: {
|
|
300
|
+
off: (plugin) => translate.current("richText.itemOff", { plugin }),
|
|
301
|
+
notInstalled: (id) => translate.current("richText.itemNotInstalled", { id }),
|
|
302
|
+
dropped: (plugin) => translate.current("richText.itemDropped", { plugin }),
|
|
303
|
+
get failed() {
|
|
304
|
+
return translate.current("richText.itemDetailsFailed");
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
renderIcon: renderRichItemIcon,
|
|
308
|
+
});
|
|
309
|
+
const listing = useRichItems();
|
|
310
|
+
useEffect(() => directory.current.set(listing), [listing]);
|
|
311
|
+
return directory.current;
|
|
248
312
|
}
|
|
249
313
|
function RichTextEditor({ editable }) {
|
|
314
|
+
const { value, onChange } = usePluginValue();
|
|
315
|
+
const items = useItemDirectory();
|
|
316
|
+
// M35 C4b (design D17): a pasted address two plugins' items list asks which; through a ref, so the extensions are
|
|
317
|
+
// made once a directory.
|
|
318
|
+
const [pasteChoice, setPasteChoice] = useState(null);
|
|
319
|
+
const onPasteChoiceRef = useRef(setPasteChoice);
|
|
320
|
+
onPasteChoiceRef.current = setPasteChoice;
|
|
321
|
+
const extensions = useMemo(() => buildRichtextExtensions({ items, onPasteChoice: (choice) => onPasteChoiceRef.current(choice) }), [items]);
|
|
322
|
+
const schema = useMemo(() => richTextSchemaOf(extensions), [extensions]);
|
|
323
|
+
// The value the mounted editor last emitted: the schema made it, so it opens, and checking it again (a whole
|
|
324
|
+
// nodeFromJSON and check) on every keystroke's re-render would make typing in a long document lag. Only a value
|
|
325
|
+
// that arrives from outside is checked.
|
|
326
|
+
const ownValue = useRef(undefined);
|
|
327
|
+
if (!(value !== null && value === ownValue.current) && !richTextOpens(schema, value)) {
|
|
328
|
+
// Design D7: TipTap would show an empty document and the next edit would store it, so the editor is not mounted.
|
|
329
|
+
return _jsx(UnreadableRichText, { value: value, editable: editable, onKeepText: (doc) => onChange(doc) });
|
|
330
|
+
}
|
|
331
|
+
return _jsx(MountedRichTextEditor, { editable: editable, extensions: extensions, schema: schema, items: items, ownValue: ownValue, pasteChoice: pasteChoice, setPasteChoice: setPasteChoice });
|
|
332
|
+
}
|
|
333
|
+
function MountedRichTextEditor({ editable, extensions, schema, items, ownValue, pasteChoice, setPasteChoice, }) {
|
|
250
334
|
const { value, onChange } = usePluginValue();
|
|
251
335
|
// Guards the sync effect below against reacting to the update it just
|
|
252
336
|
// caused itself. Without this, every keystroke would round-trip
|
|
@@ -261,7 +345,7 @@ function RichTextEditor({ editable }) {
|
|
|
261
345
|
const field = usePropertyFieldControl();
|
|
262
346
|
const s = useSdkString();
|
|
263
347
|
const editor = useEditor({
|
|
264
|
-
extensions
|
|
348
|
+
extensions,
|
|
265
349
|
content: value ?? "",
|
|
266
350
|
editable,
|
|
267
351
|
// @tiptap/react 3.31 no longer re-renders the owning component on every
|
|
@@ -293,12 +377,70 @@ function RichTextEditor({ editable }) {
|
|
|
293
377
|
// source (emitUpdate: false, see the effect below), so any doc that
|
|
294
378
|
// still equals the external value is TipTap's own construction-time
|
|
295
379
|
// normalization pass, not an edit.
|
|
296
|
-
if (
|
|
380
|
+
if (richTextValuesEqual(json, value))
|
|
381
|
+
return;
|
|
382
|
+
// M35 C4b (35-C4a review (b)): opening the panel writes nothing. Selecting a chip is the first transaction of a
|
|
383
|
+
// value that ends with an item, and StarterKit's TrailingNode answers it by appending an empty paragraph; an item
|
|
384
|
+
// a script wrote without id or text reads with the schema's defaults. Neither is an edit, so the value is compared
|
|
385
|
+
// as the editor's schema reads it, with the paragraph TrailingNode would add.
|
|
386
|
+
if (richTextValuesEqual(json, schemaReadOf(updated, value)))
|
|
297
387
|
return;
|
|
298
388
|
isInternalUpdate.current = true;
|
|
389
|
+
ownValue.current = json;
|
|
299
390
|
onChange(json);
|
|
300
391
|
},
|
|
301
392
|
});
|
|
393
|
+
// The selection no person chose (see `panelsOpen` below): the editor's first one, then whatever each setContent
|
|
394
|
+
// here leaves. Any transaction that sets the selection clears it.
|
|
395
|
+
const unchosenSelection = useRef(null);
|
|
396
|
+
const seenEditor = useRef(null);
|
|
397
|
+
if (editor && seenEditor.current !== editor) {
|
|
398
|
+
seenEditor.current = editor;
|
|
399
|
+
unchosenSelection.current = editor.state.selection;
|
|
400
|
+
}
|
|
401
|
+
useEffect(() => {
|
|
402
|
+
if (!editor)
|
|
403
|
+
return;
|
|
404
|
+
const onTransaction = ({ transaction }) => {
|
|
405
|
+
if (transaction.selectionSet)
|
|
406
|
+
unchosenSelection.current = null;
|
|
407
|
+
};
|
|
408
|
+
editor.on("transaction", onTransaction);
|
|
409
|
+
return () => {
|
|
410
|
+
editor.off("transaction", onTransaction);
|
|
411
|
+
};
|
|
412
|
+
}, [editor]);
|
|
413
|
+
// `keepChosen` (an outside value): when a person had chosen a node (an open item or block panel) and the new
|
|
414
|
+
// document still holds it (an item by its id, any other node by its type at the same place), it is selected again,
|
|
415
|
+
// so the panel does not close under them; otherwise the new selection is recorded as unchosen.
|
|
416
|
+
function setContentUnchosen(content, keepChosen = false) {
|
|
417
|
+
if (!editor)
|
|
418
|
+
return;
|
|
419
|
+
const before = editor.state.selection;
|
|
420
|
+
const chosen = keepChosen && unchosenSelection.current === null && before instanceof NodeSelection ? before : null;
|
|
421
|
+
editor.commands.setContent(content);
|
|
422
|
+
if (chosen) {
|
|
423
|
+
const id = chosen.node.attrs.id;
|
|
424
|
+
let found = -1;
|
|
425
|
+
if (typeof id === "string" && id.length > 0) {
|
|
426
|
+
editor.state.doc.descendants((node, pos) => {
|
|
427
|
+
if (found >= 0)
|
|
428
|
+
return false;
|
|
429
|
+
if (node.type.name === chosen.node.type.name && node.attrs.id === id)
|
|
430
|
+
found = pos;
|
|
431
|
+
return true;
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
else if (chosen.from < editor.state.doc.content.size && editor.state.doc.nodeAt(chosen.from)?.type.name === chosen.node.type.name) {
|
|
435
|
+
found = chosen.from;
|
|
436
|
+
}
|
|
437
|
+
if (found >= 0) {
|
|
438
|
+
editor.commands.setNodeSelection(found);
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
unchosenSelection.current = editor.state.selection;
|
|
443
|
+
}
|
|
302
444
|
// Item 3 (S197 QA-wave B): the HTML source view. `null` means "not in
|
|
303
445
|
// source mode"; the textarea's own in-progress edits live here, entirely
|
|
304
446
|
// separate from `value`/onChange, until the toggle-back below commits
|
|
@@ -351,7 +493,7 @@ function RichTextEditor({ editable }) {
|
|
|
351
493
|
// this buffer was dirty (sourceStale), this is the "informed overwrite"
|
|
352
494
|
// the notice warned about: the user's buffer wins, same as any other
|
|
353
495
|
// edit made after seeing the notice.
|
|
354
|
-
|
|
496
|
+
setContentUnchosen(sourceHtml);
|
|
355
497
|
sourceSeedRef.current = null;
|
|
356
498
|
setSourceHtml(null);
|
|
357
499
|
setSourceStale(false);
|
|
@@ -363,9 +505,7 @@ function RichTextEditor({ editable }) {
|
|
|
363
505
|
isInternalUpdate.current = false;
|
|
364
506
|
return;
|
|
365
507
|
}
|
|
366
|
-
|
|
367
|
-
const next = JSON.stringify(value ?? {});
|
|
368
|
-
if (current === next)
|
|
508
|
+
if (richTextValuesEqual(editor.getJSON(), value))
|
|
369
509
|
return;
|
|
370
510
|
// An external value change while the source textarea is open (review
|
|
371
511
|
// fix, S197 QA-wave B): without this branch, the live editor doc would
|
|
@@ -387,15 +527,20 @@ function RichTextEditor({ editable }) {
|
|
|
387
527
|
// No local edits yet: safe to re-seed from the fresh external doc,
|
|
388
528
|
// same as the non-source branch below but keeping the textarea's
|
|
389
529
|
// displayed HTML in sync too.
|
|
390
|
-
|
|
530
|
+
// M35 C4a (design D7): the parent re-renders into the read-only state with this value, so it is never set here.
|
|
531
|
+
if (!richTextOpens(schema, value))
|
|
532
|
+
return;
|
|
533
|
+
setContentUnchosen(value ?? "", true);
|
|
391
534
|
const reseeded = prettifyHtml(editor.getHTML());
|
|
392
535
|
sourceSeedRef.current = reseeded;
|
|
393
536
|
setSourceHtml(reseeded);
|
|
394
537
|
setSourceStale(false);
|
|
395
538
|
return;
|
|
396
539
|
}
|
|
397
|
-
|
|
398
|
-
|
|
540
|
+
if (!richTextOpens(schema, value))
|
|
541
|
+
return;
|
|
542
|
+
setContentUnchosen(value ?? "", true);
|
|
543
|
+
}, [value, editor, schema]);
|
|
399
544
|
useEffect(() => {
|
|
400
545
|
// emitUpdate: false, since setEditable's unconditional 'update' event is
|
|
401
546
|
// not an edit; silencing it at the source keeps onUpdate's arming
|
|
@@ -428,14 +573,27 @@ function RichTextEditor({ editable }) {
|
|
|
428
573
|
// kardalumBlock, see block-panel.tsx's doc comment for why that's the
|
|
429
574
|
// right signal rather than separate open/close state.
|
|
430
575
|
const selection = editor?.state.selection;
|
|
431
|
-
|
|
432
|
-
|
|
576
|
+
// M35 C4a: the selection TipTap starts with, or a setContent leaves, is nobody's choice. A value that begins with an
|
|
577
|
+
// item or a block starts with that node selected, which would open its panel the moment the page opens; so a panel
|
|
578
|
+
// opens only once a transaction has set the selection (a click on a chip, an arrow key), never for this one.
|
|
579
|
+
const panelsOpen = !(unchosenSelection.current !== null && selection !== undefined && selection.eq(unchosenSelection.current));
|
|
580
|
+
const blockSelection = panelsOpen && editor && selection instanceof NodeSelection && selection.node.type.name === "kardalumBlock" ? selection : null;
|
|
581
|
+
// M35 C4a (design D8): a selected plugin item opens the core's item panel the same way.
|
|
582
|
+
const itemSelection = panelsOpen && editor ? selectedPluginItem(editor) : null;
|
|
583
|
+
return (_jsxs("div", { ref: wrapperRef, className: cn(editable && "overflow-hidden rounded-md border border-border-default bg-background-elevated"), children: [_jsxs("div", { inert: editable && (Boolean(blockSelection) || Boolean(itemSelection)) ? true : undefined, children: [editable && editor && (_jsx(RichTextToolbar, { editor: editor, containerRef: wrapperRef, sourceMode: sourceMode, onToggleSource: handleToggleSource, items: items })), sourceMode ? (_jsxs(_Fragment, { children: [sourceStale && (_jsx("div", { role: "alert", "data-testid": "rt-source-stale-notice", className: "border-b border-warning-100 bg-warning-100 px-5 py-2 text-xs text-warning-800", children: s("richText.sourceStale") })), _jsx("textarea", { "data-testid": "rt-source-textarea", "aria-label": s("richText.sourceLabel"), value: sourceHtml, onChange: (event) => setSourceHtml(event.target.value), spellCheck: false, className: "block min-h-72 w-full resize-y border-0 bg-background-elevated px-5 py-4 font-mono text-xs text-text-primary focus-visible:outline-hidden" })] })) : (_jsx(EditorContent, { editor: editor, className: cn(CONTENT_CLASSES, editable &&
|
|
433
584
|
// min-h-72 (18rem) matches the mockup's .rtbody proportions (S197
|
|
434
585
|
// screen 3): the editor grows with content past that floor, it
|
|
435
586
|
// never shrinks below a real working height. px-5/py-4 are the
|
|
436
587
|
// token scale's closest steps to the mockup's literal 1.3rem/
|
|
437
588
|
// 1.1rem .rtbody padding (design-tokens has no 1.1/1.3rem step).
|
|
438
|
-
"min-h-72 px-5 py-4 focus-within:outline-hidden focus-within:ring-2 focus-within:ring-primary-600 focus-within:ring-offset-2 focus-within:ring-offset-background-base") }))] }), editable && editor && blockSelection && (_jsx(BlockPanel, { editor: editor, pos: blockSelection.from, partial: blockSelection.node.attrs.partial, params: blockSelection.node.attrs.params ?? {} })),
|
|
589
|
+
"min-h-72 px-5 py-4 focus-within:outline-hidden focus-within:ring-2 focus-within:ring-primary-600 focus-within:ring-offset-2 focus-within:ring-offset-background-base") }))] }), editable && editor && blockSelection && (_jsx(BlockPanel, { editor: editor, pos: blockSelection.from, partial: blockSelection.node.attrs.partial, params: blockSelection.node.attrs.params ?? {} })), editable && editor && pasteChoice && (_jsx("div", { className: "relative", children: _jsx("div", { className: "absolute start-0 top-0 z-10", children: _jsx(PasteChoiceMenu, { choice: pasteChoice, pluginNames: Object.fromEntries(items.plugins().map((entry) => [entry.plugin, entry.name])), onPick: (match) => {
|
|
590
|
+
convertPastedAddress(editor, pasteChoice, match);
|
|
591
|
+
setPasteChoice(null);
|
|
592
|
+
editor.commands.focus();
|
|
593
|
+
}, onClose: () => {
|
|
594
|
+
setPasteChoice(null);
|
|
595
|
+
editor.commands.focus();
|
|
596
|
+
} }) }) })), editable && editor && itemSelection && (_jsx(ItemPanel, { editor: editor, pos: itemSelection.pos, type: itemSelection.type, attrs: itemSelection.attrs, items: items }, itemSelection.pos)), previewRequest && (_jsx(BlockPreviewPopover, { partial: previewRequest.partial, params: previewRequest.params, anchorRect: previewRequest.anchorRect, onClose: () => setPreviewRequest(null) }))] }));
|
|
439
597
|
}
|
|
440
598
|
export function RichTextInputView() {
|
|
441
599
|
return _jsx(RichTextEditor, { editable: true });
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { JSONContent } from "@tiptap/react";
|
|
3
|
+
/** M35 C4a (design D7): the page's history opens on this event; ContentEditor listens for it on `document`. */
|
|
4
|
+
export declare const OPEN_HISTORY_EVENT = "kardalum:open-history";
|
|
5
|
+
/** The most plain text the read-only state shows, here and in the on-page editor's notice. */
|
|
6
|
+
export declare const UNREADABLE_TEXT_MAX = 100000;
|
|
7
|
+
/** Host-only (`@kardalum/plugin-sdk/host`): wraps the fields of a host that listens for OPEN_HISTORY_EVENT. */
|
|
8
|
+
export declare function RichTextHistoryProvider({ children }: {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
/** The plain text as paragraphs: one a line, an empty line an empty paragraph, never an empty text node. */
|
|
12
|
+
export declare function paragraphsFromText(text: string): JSONContent;
|
|
13
|
+
export declare function UnreadableRichText({ value, editable, onKeepText }: {
|
|
14
|
+
value: unknown;
|
|
15
|
+
editable: boolean;
|
|
16
|
+
onKeepText(doc: JSONContent): void;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useRef } from "react";
|
|
3
|
+
import { Button } from "@kardalum/ui";
|
|
4
|
+
import { richTextToText } from "@kardalum/api-schemas";
|
|
5
|
+
import { useAdminDirection, useSdkString } from "../sdk-strings.js";
|
|
6
|
+
import { useAdminFormat } from "../view-helpers.js";
|
|
7
|
+
/** M35 C4a (design D7): the page's history opens on this event; ContentEditor listens for it on `document`. */
|
|
8
|
+
export const OPEN_HISTORY_EVENT = "kardalum:open-history";
|
|
9
|
+
/** The most plain text the read-only state shows, here and in the on-page editor's notice. */
|
|
10
|
+
export const UNREADABLE_TEXT_MAX = 100_000;
|
|
11
|
+
/** Whether the host around the field opens a page's history on OPEN_HISTORY_EVENT. Only ContentEditor does, so
|
|
12
|
+
* "Open an earlier version" is offered there and nowhere else (a media item, a plugin settings screen). */
|
|
13
|
+
const RichTextHistoryContext = createContext(false);
|
|
14
|
+
/** Host-only (`@kardalum/plugin-sdk/host`): wraps the fields of a host that listens for OPEN_HISTORY_EVENT. */
|
|
15
|
+
export function RichTextHistoryProvider({ children }) {
|
|
16
|
+
return _jsx(RichTextHistoryContext.Provider, { value: true, children: children });
|
|
17
|
+
}
|
|
18
|
+
/** The plain text as paragraphs: one a line, an empty line an empty paragraph, never an empty text node. */
|
|
19
|
+
export function paragraphsFromText(text) {
|
|
20
|
+
const lines = text.split("\n");
|
|
21
|
+
const content = lines.map((line) => (line.length > 0 ? { type: "paragraph", content: [{ type: "text", text: line }] } : { type: "paragraph" }));
|
|
22
|
+
return { type: "doc", content: content.length > 0 ? content : [{ type: "paragraph" }] };
|
|
23
|
+
}
|
|
24
|
+
export function UnreadableRichText({ value, editable, onKeepText }) {
|
|
25
|
+
const s = useSdkString();
|
|
26
|
+
const dir = useAdminDirection();
|
|
27
|
+
// M35 wave 4 merge (C4a minor 8): the length in the notice is the constant, written for the admin's language.
|
|
28
|
+
const format = useAdminFormat();
|
|
29
|
+
const hasHistory = useContext(RichTextHistoryContext);
|
|
30
|
+
const here = useRef(null);
|
|
31
|
+
// Past UNREADABLE_TEXT_MAX the text is cut, and so is what Keep the text only puts in: the person is told.
|
|
32
|
+
let shortened = false;
|
|
33
|
+
const text = richTextToText(value, {
|
|
34
|
+
maxLength: UNREADABLE_TEXT_MAX,
|
|
35
|
+
onCut: () => {
|
|
36
|
+
shortened = true;
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
return (_jsxs("div", { ref: here, className: "flex flex-col gap-3 rounded-md border border-warning-100 bg-background-elevated p-4", children: [_jsx("p", { role: "status", dir: dir, className: "text-sm text-warning-800", children: s("richText.unreadable") }), _jsx("div", { dir: "auto", "data-testid": "rt-unreadable-text", className: "whitespace-pre-wrap text-sm text-text-primary", children: text }), shortened && (_jsx("p", { dir: dir, className: "text-xs text-text-secondary", children: s("richText.unreadableShortened", { max: format.number(UNREADABLE_TEXT_MAX) }) })), editable && (_jsxs("div", { dir: dir, className: "flex flex-col gap-2", children: [_jsxs("div", { className: "flex flex-wrap gap-2", children: [hasHistory && (_jsx(Button, { type: "button", variant: "secondary", onClick: () => here.current?.dispatchEvent(new CustomEvent(OPEN_HISTORY_EVENT, { bubbles: true })), children: s("richText.unreadableEarlierVersion") })), _jsx(Button, { type: "button", variant: "secondary", onClick: () => onKeepText(paragraphsFromText(text)), children: s("richText.unreadableKeepText") })] }), _jsx("p", { className: "text-xs text-text-secondary", children: s("richText.unreadableKeepTextHint") })] }))] }));
|
|
40
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { PluginLabel, TemplateData } from "@kardalum/api-schemas";
|
|
2
|
+
import type { PluginHookContext } from "./manifest.js";
|
|
3
|
+
/** @experimental M35 U2b: a signed-in visitor of the site, as the core hands it to this plugin. Frozen. */
|
|
4
|
+
export interface PluginVisitor {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly name: string | null;
|
|
7
|
+
/** The keys of the visitor's groups: the owner's ("members") and plugins' ("com.example.club/gold"). */
|
|
8
|
+
readonly groups: readonly string[];
|
|
9
|
+
/** Present only for a plugin that declares visitorIdentity: { email: true }. */
|
|
10
|
+
readonly email?: string;
|
|
11
|
+
}
|
|
12
|
+
/** @experimental M35 U2b: what a change to one of the plugin's own groups answers. Never a throw for these reasons. */
|
|
13
|
+
export type PluginVisitorGroupResult = {
|
|
14
|
+
ok: true;
|
|
15
|
+
} | {
|
|
16
|
+
ok: false;
|
|
17
|
+
reason: "unknownGroup" | "unknownVisitor" | "groupLimit" | "inactive" | "invalid";
|
|
18
|
+
};
|
|
19
|
+
/** @experimental M35 U2b */
|
|
20
|
+
export interface PluginVisitors {
|
|
21
|
+
/** An active, confirmed account by id; null for any other. The object it answers opens no members-only page in a published read. */
|
|
22
|
+
get(visitorId: string): Promise<PluginVisitor | null>;
|
|
23
|
+
/** Whether this visitor (null: an anonymous reader) may see the page, by its audience. Read from the account's current memberships. */
|
|
24
|
+
maySee(visitor: PluginVisitor | null, pageId: string): Promise<boolean>;
|
|
25
|
+
/** Present only for a plugin that declares visitorGroups: its own groups, by their declared id. */
|
|
26
|
+
groups?: {
|
|
27
|
+
add(visitorId: string, groupId: string, options?: {
|
|
28
|
+
until?: string;
|
|
29
|
+
}): Promise<PluginVisitorGroupResult>;
|
|
30
|
+
remove(visitorId: string, groupId: string): Promise<PluginVisitorGroupResult>;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** @experimental M35 U2b: `{}` hands the plugin the visitor's id, name and groups; `{ email: true }` the email as well. */
|
|
34
|
+
export interface PluginVisitorIdentityContribution {
|
|
35
|
+
email?: true;
|
|
36
|
+
}
|
|
37
|
+
/** @experimental M35 U2b: one group of the plugin's own; its key is `<plugin id>/<id>`. */
|
|
38
|
+
export interface PluginVisitorGroupContribution {
|
|
39
|
+
id: string;
|
|
40
|
+
label: PluginLabel;
|
|
41
|
+
}
|
|
42
|
+
/** @experimental M35 U2b: a section of the visitor's account page. */
|
|
43
|
+
export interface PluginVisitorAccountSectionContribution {
|
|
44
|
+
id: string;
|
|
45
|
+
label: PluginLabel;
|
|
46
|
+
/** The alias of one of this plugin's own `templates` of kind "partial"; it is rendered with `{ section }`. */
|
|
47
|
+
partial: string;
|
|
48
|
+
data(visitor: PluginVisitor, context: PluginHookContext): TemplateData | Promise<TemplateData>;
|
|
49
|
+
}
|
|
50
|
+
/** @experimental M35 U2b: the plugin's part of a visitor's data download and of an account's deletion. */
|
|
51
|
+
export interface PluginVisitorDataContribution {
|
|
52
|
+
export(visitorId: string, context: PluginHookContext): unknown | Promise<unknown>;
|
|
53
|
+
erase(visitorId: string, context: PluginHookContext): void | Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
/** @experimental M35 U2b: an account was made, its email confirmed, or it was deleted. Ids only. */
|
|
56
|
+
export interface VisitorHookPayload {
|
|
57
|
+
event: "visitor:afterRegister" | "visitor:afterConfirm" | "visitor:afterDelete";
|
|
58
|
+
visitorId: string;
|
|
59
|
+
siteId: string;
|
|
60
|
+
occurredAt: string;
|
|
61
|
+
}
|
|
62
|
+
/** @experimental M35 U2b: a visitor was given a session. */
|
|
63
|
+
export interface VisitorSignInHookPayload {
|
|
64
|
+
event: "visitor:afterSignIn";
|
|
65
|
+
visitorId: string;
|
|
66
|
+
siteId: string;
|
|
67
|
+
method: "password" | "provider" | "link";
|
|
68
|
+
provider: string | null;
|
|
69
|
+
occurredAt: string;
|
|
70
|
+
}
|
|
71
|
+
/** @experimental M35 U2b: a membership was added, removed or ended at its date. */
|
|
72
|
+
export interface VisitorGroupHookPayload {
|
|
73
|
+
event: "visitor:afterGroupChange";
|
|
74
|
+
visitorId: string;
|
|
75
|
+
siteId: string;
|
|
76
|
+
groupKey: string;
|
|
77
|
+
change: "added" | "removed" | "expired";
|
|
78
|
+
actorKind: "session" | "plugin" | "system";
|
|
79
|
+
actorId: string | null;
|
|
80
|
+
occurredAt: string;
|
|
81
|
+
}
|
package/dist/visitors.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The preset ids, in the order the dialog offers them. The third preset is named by what it makes,
|
|
3
|
+
* a client for an app's "Use your own OAuth client" setting, so the id (which the API answers and the
|
|
4
|
+
* generated reference lists) never spells a host's name; its name as shown is below.
|
|
5
|
+
*/
|
|
6
|
+
export declare const AI_APP_HOSTS: readonly ["gemini", "chatgpt", "own-client", "other"];
|
|
7
|
+
export type AiAppHost = (typeof AI_APP_HOSTS)[number];
|
|
8
|
+
/** The host's name as the admin shows it; "other" is named by the admin's own string. */
|
|
9
|
+
export declare const AI_APP_HOST_NAMES: Readonly<Record<Exclude<AiAppHost, "other">, string>>;
|
|
10
|
+
/** The apps the admin names where it points a person to the AI assistant page (the API keys intro). */
|
|
11
|
+
export declare const AI_APP_EXAMPLE_NAMES: readonly string[];
|
|
12
|
+
/**
|
|
13
|
+
* The return addresses a preset starts from. Empty means the person enters them: Gemini shows its
|
|
14
|
+
* own per-person addresses under "Server auth credentials", and another app shows its own.
|
|
15
|
+
* ChatGPT's stable address works once the site sends iss (RFC 9207).
|
|
16
|
+
*/
|
|
17
|
+
export declare const AI_APP_PRESET_REDIRECT_URIS: Readonly<Record<AiAppHost, readonly string[]>>;
|
|
18
|
+
/** ChatGPT sends no client secret (it registers as a public client), so its preset makes none. */
|
|
19
|
+
export declare const AI_APP_PUBLIC_HOSTS: ReadonlySet<AiAppHost>;
|
|
20
|
+
/** The Manual's section with each host's own steps. */
|
|
21
|
+
export declare const AI_APP_HOST_MANUAL_URLS: Readonly<Record<AiAppHost, string>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// 0.21 (AI apps connect): the hosts the "Add an AI app" dialog has a preset for, their names as
|
|
2
|
+
// shown and the return addresses each preset starts from. Every host's name lives in this one
|
|
3
|
+
// module, so the rest of the code, the tests and the admin read it from here and never spell it
|
|
4
|
+
// (the public export lets a listed file name the AI app; see docs/ops/export-word-exemptions.txt).
|
|
5
|
+
// Each value is as the host's own documentation gave it on 2026-11-22.
|
|
6
|
+
/**
|
|
7
|
+
* The preset ids, in the order the dialog offers them. The third preset is named by what it makes,
|
|
8
|
+
* a client for an app's "Use your own OAuth client" setting, so the id (which the API answers and the
|
|
9
|
+
* generated reference lists) never spells a host's name; its name as shown is below.
|
|
10
|
+
*/
|
|
11
|
+
export const AI_APP_HOSTS = ["gemini", "chatgpt", "own-client", "other"];
|
|
12
|
+
/** The host's name as the admin shows it; "other" is named by the admin's own string. */
|
|
13
|
+
export const AI_APP_HOST_NAMES = {
|
|
14
|
+
gemini: "Gemini",
|
|
15
|
+
chatgpt: "ChatGPT",
|
|
16
|
+
"own-client": "Claude",
|
|
17
|
+
};
|
|
18
|
+
/** The apps the admin names where it points a person to the AI assistant page (the API keys intro). */
|
|
19
|
+
export const AI_APP_EXAMPLE_NAMES = [AI_APP_HOST_NAMES.gemini, AI_APP_HOST_NAMES.chatgpt, AI_APP_HOST_NAMES["own-client"]];
|
|
20
|
+
/**
|
|
21
|
+
* The return addresses a preset starts from. Empty means the person enters them: Gemini shows its
|
|
22
|
+
* own per-person addresses under "Server auth credentials", and another app shows its own.
|
|
23
|
+
* ChatGPT's stable address works once the site sends iss (RFC 9207).
|
|
24
|
+
*/
|
|
25
|
+
export const AI_APP_PRESET_REDIRECT_URIS = {
|
|
26
|
+
gemini: [],
|
|
27
|
+
chatgpt: ["https://chatgpt.com/connector_platform_oauth_redirect"],
|
|
28
|
+
"own-client": ["https://claude.ai/api/mcp/auth_callback"],
|
|
29
|
+
other: [],
|
|
30
|
+
};
|
|
31
|
+
/** ChatGPT sends no client secret (it registers as a public client), so its preset makes none. */
|
|
32
|
+
export const AI_APP_PUBLIC_HOSTS = new Set(["chatgpt"]);
|
|
33
|
+
/** The Manual's section with each host's own steps. */
|
|
34
|
+
export const AI_APP_HOST_MANUAL_URLS = {
|
|
35
|
+
gemini: "https://dev.kardalum.com/docs/v1/manual/ai-assistant/add-an-ai-app/#gemini",
|
|
36
|
+
chatgpt: "https://dev.kardalum.com/docs/v1/manual/ai-assistant/add-an-ai-app/#chatgpt",
|
|
37
|
+
"own-client": "https://dev.kardalum.com/docs/v1/manual/ai-assistant/add-an-ai-app/#an-app-with-its-own-oauth-client",
|
|
38
|
+
other: "https://dev.kardalum.com/docs/v1/manual/ai-assistant/add-an-ai-app/#another-app",
|
|
39
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AI_REDIRECT_URI_MAX_CHARS } from "./ai-connections.schema.js";
|
|
2
|
+
// 0.21 (AI apps connect, plan 4.3): the Gemini preset's entry check, shared by the admin's dialog
|
|
3
|
+
// (a hint while the person pastes) and the server's add route (the refusal). It is never a matching
|
|
4
|
+
// rule: authorize matches the registered addresses exactly, because a Google relay prefix would let
|
|
5
|
+
// a code reach another person's Gemini. Read with the URL parser and linear checks only.
|
|
6
|
+
const GOOGLE_RELAY_HOSTS = new Set([
|
|
7
|
+
"oauth-redirect.googleusercontent.com",
|
|
8
|
+
"oauth-redirect-sandbox.googleusercontent.com",
|
|
9
|
+
"oauth-redirect-test.googleusercontent.com",
|
|
10
|
+
]);
|
|
11
|
+
/** https, a Google relay host, no user, port, query or fragment, and /r/<one segment> or /a/<one segment>. */
|
|
12
|
+
export function isGoogleRelayRedirect(text) {
|
|
13
|
+
if (text.length === 0 || text.length > AI_REDIRECT_URI_MAX_CHARS || text.includes("#"))
|
|
14
|
+
return false;
|
|
15
|
+
let url;
|
|
16
|
+
try {
|
|
17
|
+
url = new URL(text);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
if (url.protocol !== "https:" || url.username !== "" || url.password !== "" || url.port !== "" || url.search !== "")
|
|
23
|
+
return false;
|
|
24
|
+
if (!GOOGLE_RELAY_HOSTS.has(url.hostname))
|
|
25
|
+
return false;
|
|
26
|
+
const path = url.pathname;
|
|
27
|
+
if (!(path.startsWith("/r/") || path.startsWith("/a/")))
|
|
28
|
+
return false;
|
|
29
|
+
const segment = path.slice(3);
|
|
30
|
+
return segment.length > 0 && !segment.includes("/");
|
|
31
|
+
}
|