@kardalum/plugin-sdk 0.19.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 +281 -0
- package/README.md +19 -0
- package/dist/admin-section-registry.d.ts +48 -1
- package/dist/admin-section-registry.js +90 -0
- package/dist/built-in-editor-ids.d.ts +1 -1
- package/dist/built-in-editor-ids.js +2 -20
- package/dist/built-in-settings-schemas.d.ts +10 -0
- package/dist/built-in-settings-schemas.js +86 -0
- package/dist/built-in-value-schemas.js +35 -0
- package/dist/built-ins.js +38 -7
- package/dist/capabilities.d.ts +11 -1
- package/dist/capabilities.js +101 -4
- package/dist/cli.d.ts +66 -0
- package/dist/cli.js +22 -0
- package/dist/consent-entry.d.ts +11 -0
- package/dist/consent-entry.js +18 -0
- package/dist/content-library.d.ts +102 -0
- package/dist/content-library.js +15 -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 +15 -0
- package/dist/content-picker/page-picker-sheet.js +105 -0
- package/dist/content-picker/page-picker.d.ts +18 -0
- package/dist/content-picker/page-picker.js +20 -0
- package/dist/content-picker/page-tree.d.ts +25 -0
- package/dist/content-picker/page-tree.js +132 -0
- package/dist/data-type-plugin.d.ts +7 -1
- package/dist/datatype-validation.d.ts +4 -9
- package/dist/datatype-validation.js +147 -1
- package/dist/datatypes-entry.d.ts +1 -0
- package/dist/datatypes-entry.js +2 -0
- 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 +53 -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 +7 -1
- package/dist/host-entry.js +14 -1
- package/dist/index.d.ts +67 -7
- package/dist/index.js +94 -6
- package/dist/mail.d.ts +34 -0
- package/dist/mail.js +1 -0
- package/dist/manifest-entry.d.ts +47 -4
- package/dist/manifest-entry.js +63 -2
- package/dist/manifest-schema.d.ts +993 -40
- package/dist/manifest-schema.js +516 -26
- package/dist/manifest.d.ts +1186 -62
- package/dist/manifest.js +8 -4
- package/dist/media/media-picker.js +31 -18
- package/dist/media/upload-error.d.ts +5 -1
- package/dist/media/upload-error.js +14 -2
- package/dist/media-library.d.ts +32 -0
- package/dist/media-library.js +15 -0
- package/dist/nested-field-host.d.ts +76 -0
- package/dist/nested-field-host.js +90 -0
- package/dist/notify.d.ts +12 -4
- package/dist/notify.js +1 -1
- package/dist/outbound.d.ts +47 -0
- package/dist/outbound.js +1 -0
- package/dist/plugin-context.d.ts +52 -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 +262 -9
- package/dist/plugin-screen-context.js +56 -0
- package/dist/providers.d.ts +313 -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/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 +36 -25
- 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 +45 -22
- 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/style-listbox.js +6 -4
- 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 +344 -0
- package/dist/sdk-strings.js +411 -0
- package/dist/sealing.d.ts +14 -0
- package/dist/sealing.js +1 -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/simple-storage-value-provider.js +24 -24
- package/dist/structured-storage-types.d.ts +429 -9
- 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 -0
- package/dist/text-entry.js +7 -0
- package/dist/tokens/system-dark.css +1 -0
- package/dist/tokens/tailwind-theme.css +7 -0
- package/dist/tokens/tokens.css +19 -3
- package/dist/tokens/tokens.json +13 -4
- 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/asset-view.js +4 -1
- package/dist/views/content-list-preview.js +3 -1
- package/dist/views/content-list-settings-view.js +11 -7
- package/dist/views/content-list-view.d.ts +5 -3
- package/dist/views/content-list-view.js +243 -40
- package/dist/views/content-picker-view.d.ts +3 -0
- package/dist/views/content-picker-view.js +143 -0
- package/dist/views/crop-view.d.ts +4 -6
- package/dist/views/crop-view.js +22 -13
- package/dist/views/date-range-view.js +4 -1
- package/dist/views/file-upload-view.d.ts +5 -7
- package/dist/views/file-upload-view.js +16 -7
- package/dist/views/group-view.d.ts +8 -0
- package/dist/views/group-view.js +123 -0
- package/dist/views/html-view.js +7 -6
- package/dist/views/image-view.js +37 -19
- package/dist/views/link-view.d.ts +3 -0
- package/dist/views/link-view.js +150 -0
- package/dist/views/options-list-view.d.ts +3 -0
- package/dist/views/options-list-view.js +104 -0
- package/dist/views/repeatable-list-view.d.ts +3 -0
- package/dist/views/repeatable-list-view.js +113 -0
- package/dist/views/rich-text-view.d.ts +2 -0
- package/dist/views/rich-text-view.js +208 -35
- package/dist/views/suggest-key.d.ts +17 -0
- package/dist/views/suggest-key.js +55 -0
- 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 +334 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.js +254 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.js +10 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +5 -0
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +11 -1
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +4 -2
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.js +38 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.d.ts +65 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.js +144 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +115 -3
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +58 -11
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +137 -2
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +178 -2
- 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-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/content-search.schema.d.ts +50 -0
- package/node_modules/@kardalum/api-schemas/dist/content-search.schema.js +42 -0
- package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.d.ts +37 -0
- package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.js +19 -0
- package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/content.schema.d.ts +3 -0
- package/node_modules/@kardalum/api-schemas/dist/content.schema.js +10 -0
- package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.js +86 -0
- package/node_modules/@kardalum/api-schemas/dist/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 +55 -13
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +22 -10
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +25 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/data-type-issue.d.ts +35 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-issue.js +60 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +257 -15
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +78 -5
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.d.ts +24 -6
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +90 -5
- package/node_modules/@kardalum/api-schemas/dist/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/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/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 +162 -48
- package/node_modules/@kardalum/api-schemas/dist/index.js +137 -30
- 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/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/legal-anchors.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/legal-anchors.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/licensing.schema.d.ts +63 -0
- package/node_modules/@kardalum/api-schemas/dist/licensing.schema.js +54 -0
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.d.ts +226 -0
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.js +409 -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 +490 -10
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +53 -3
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +15 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.d.ts +131 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.js +272 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.d.ts +84 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.js +138 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.d.ts +20 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.js +49 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.d.ts +211 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.js +424 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.d.ts +78 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.js +27 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.d.ts +70 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.js +43 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +38 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +13 -1
- package/node_modules/@kardalum/api-schemas/dist/media-move.schema.d.ts +75 -0
- package/node_modules/@kardalum/api-schemas/dist/media-move.schema.js +53 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.d.ts +2 -2
- package/node_modules/@kardalum/api-schemas/dist/media-reference.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference.js +55 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.d.ts +204 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.js +370 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.d.ts +60 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.js +333 -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/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/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-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-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 +44 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.js +84 -0
- 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-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 +44 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +44 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +16 -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 +34 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.js +102 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.d.ts +43 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.js +126 -0
- 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-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-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 +119 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.js +216 -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 +46 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +41 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +304 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +220 -6
- 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-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 +408 -14
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +307 -23
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +23 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +61 -3
- 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 +23 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +37 -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 +346 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.js +461 -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-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-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-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 +352 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.js +409 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.d.ts +347 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.js +976 -0
- 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-storage-api.schema.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +47 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-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-tasks.d.ts +45 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.js +197 -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/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-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 +307 -4
- package/node_modules/@kardalum/api-schemas/dist/render-editing.js +61 -0
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +7 -3
- 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 +71 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.js +540 -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 +394 -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 +201 -1
- 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 +97 -8
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +64 -1
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +136 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +53 -2
- 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 +386 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.js +618 -0
- 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/snapshot-api.schema.d.ts +3 -3
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.js +26 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.d.ts +70 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.js +188 -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/template.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.js +29 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +72 -1
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +36 -3
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +5 -1
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +4 -3
- package/node_modules/@kardalum/api-schemas/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 +2 -0
- package/node_modules/@kardalum/design-tokens/dist/build-css.js +15 -1
- package/node_modules/@kardalum/design-tokens/dist/system-dark.css +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +7 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +2 -1
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +19 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +18 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +13 -4
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +5 -1
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +38 -2
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +17 -2
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +17 -10
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +625 -35
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +25 -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/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/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/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.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.js +47 -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 +40 -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/icons.js +3 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +76 -6
- 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 +99 -0
- 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/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 +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.js +316 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +40 -4
- 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 +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 +150 -0
- 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.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.js +69 -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 +17 -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 +8 -2
- package/node_modules/@kardalum/plugin-package/dist/index.js +7 -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/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/switch.js +1 -1
- 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/components/tooltip.js +1 -2
- package/node_modules/@kardalum/ui/dist/components/truncated-text.d.ts +6 -1
- package/node_modules/@kardalum/ui/dist/components/truncated-text.js +5 -4
- package/node_modules/@kardalum/ui/dist/index.d.ts +2 -0
- package/node_modules/@kardalum/ui/dist/index.js +2 -0
- package/package.json +25 -3
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { HeldEmbedKind } from "./plugin-held-embeds.js";
|
|
2
|
+
/** The mark the core replaces with the provider's name. */
|
|
3
|
+
export declare const HELD_EMBED_PROVIDER_MARK = "{provider}";
|
|
4
|
+
/** The languages the words exist in; a page in any other language shows the English words. */
|
|
5
|
+
export declare const HELD_EMBED_WORDS_LANGUAGES: readonly ["en", "de", "ar"];
|
|
6
|
+
export type HeldEmbedWordsLanguage = (typeof HELD_EMBED_WORDS_LANGUAGES)[number];
|
|
7
|
+
/** The words of one placeholder: the notice, the button and the privacy link's text. */
|
|
8
|
+
export interface HeldEmbedWordSet {
|
|
9
|
+
notice: string;
|
|
10
|
+
show: string;
|
|
11
|
+
privacy: string;
|
|
12
|
+
}
|
|
13
|
+
type WordsVersion = Readonly<Record<HeldEmbedKind, Readonly<Record<HeldEmbedWordsLanguage, HeldEmbedWordSet>>>>;
|
|
14
|
+
/** The version the core writes today. */
|
|
15
|
+
export declare const HELD_EMBED_WORDS_VERSION = 1;
|
|
16
|
+
/** Every version ever written, by number. Never edit a version: add the next one. */
|
|
17
|
+
export declare const HELD_EMBED_WORDS: Readonly<Record<number, WordsVersion>>;
|
|
18
|
+
/** The current words for a kind in a render's culture, with the version and the language they are in. */
|
|
19
|
+
export declare function heldEmbedWords(kind: HeldEmbedKind, culture: string | null | undefined): HeldEmbedWordSet & {
|
|
20
|
+
version: number;
|
|
21
|
+
language: HeldEmbedWordsLanguage;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// M33 K42 (Google Maps 2.10 C1 item 7, 3.5 A): the words the core writes in a held content
|
|
2
|
+
// placeholder, shown to every visitor of a site that uses held content before anything is
|
|
3
|
+
// fetched from the other site. They are a notice with privacy effect, so they are versioned like
|
|
4
|
+
// a consent text: every version is kept, a rewording adds a version and never edits one, and the
|
|
5
|
+
// placeholder carries the version it shows (`data-kardalum-embed-words`). German is written first
|
|
6
|
+
// (the legal-drafting rule), then English and Arabic; all three are drafts the operator approves
|
|
7
|
+
// with the other strings before release. The lawyer's questions are in the month's review file,
|
|
8
|
+
// never here.
|
|
9
|
+
//
|
|
10
|
+
// `{provider}` stands for the declared provider's name in the page's language; the core writes it
|
|
11
|
+
// escaped, inside `<bdi>`, so a Latin name reads correctly in an Arabic sentence. The words hold
|
|
12
|
+
// no markup.
|
|
13
|
+
/** The mark the core replaces with the provider's name. */
|
|
14
|
+
export const HELD_EMBED_PROVIDER_MARK = "{provider}";
|
|
15
|
+
/** The languages the words exist in; a page in any other language shows the English words. */
|
|
16
|
+
export const HELD_EMBED_WORDS_LANGUAGES = ["en", "de", "ar"];
|
|
17
|
+
/** The version the core writes today. */
|
|
18
|
+
export const HELD_EMBED_WORDS_VERSION = 1;
|
|
19
|
+
/** Every version ever written, by number. Never edit a version: add the next one. */
|
|
20
|
+
export const HELD_EMBED_WORDS = {
|
|
21
|
+
1: {
|
|
22
|
+
map: {
|
|
23
|
+
de: {
|
|
24
|
+
notice: "Diese Karte stammt von {provider}. Wenn Sie sie anzeigen, erhält {provider} Ihre IP-Adresse und die Adresse dieser Website und kann Informationen auf Ihrem Gerät speichern oder auslesen.",
|
|
25
|
+
show: "Karte anzeigen",
|
|
26
|
+
privacy: "Datenschutzhinweise von {provider}",
|
|
27
|
+
},
|
|
28
|
+
en: {
|
|
29
|
+
notice: "This map comes from {provider}. If you show it, {provider} receives your IP address and the address of this website, and may store or read information on your device.",
|
|
30
|
+
show: "Show the map",
|
|
31
|
+
privacy: "Privacy notice of {provider}",
|
|
32
|
+
},
|
|
33
|
+
ar: {
|
|
34
|
+
notice: "تأتي هذه الخريطة من {provider}. إذا عرضتها، يتلقى {provider} عنوان IP الخاص بك وعنوان هذا الموقع، وقد يخزّن معلومات على جهازك أو يقرؤها.",
|
|
35
|
+
show: "عرض الخريطة",
|
|
36
|
+
privacy: "إشعار الخصوصية لدى {provider}",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
content: {
|
|
40
|
+
de: {
|
|
41
|
+
notice: "Dieser Inhalt stammt von {provider}. Wenn Sie ihn anzeigen, erhält {provider} Ihre IP-Adresse und die Adresse dieser Website und kann Informationen auf Ihrem Gerät speichern oder auslesen.",
|
|
42
|
+
show: "Inhalt anzeigen",
|
|
43
|
+
privacy: "Datenschutzhinweise von {provider}",
|
|
44
|
+
},
|
|
45
|
+
en: {
|
|
46
|
+
notice: "This content comes from {provider}. If you show it, {provider} receives your IP address and the address of this website, and may store or read information on your device.",
|
|
47
|
+
show: "Show the content",
|
|
48
|
+
privacy: "Privacy notice of {provider}",
|
|
49
|
+
},
|
|
50
|
+
ar: {
|
|
51
|
+
notice: "يأتي هذا المحتوى من {provider}. إذا عرضته، يتلقى {provider} عنوان IP الخاص بك وعنوان هذا الموقع، وقد يخزّن معلومات على جهازك أو يقرؤها.",
|
|
52
|
+
show: "عرض المحتوى",
|
|
53
|
+
privacy: "إشعار الخصوصية لدى {provider}",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
/** The language part of a culture ("de" of "de-AT"), lower case, when the words exist in it; else English. */
|
|
59
|
+
function wordsLanguageOf(culture) {
|
|
60
|
+
if (typeof culture !== "string")
|
|
61
|
+
return "en";
|
|
62
|
+
const dash = culture.indexOf("-");
|
|
63
|
+
const part = (dash === -1 ? culture : culture.slice(0, dash)).toLowerCase();
|
|
64
|
+
return HELD_EMBED_WORDS_LANGUAGES.includes(part) ? part : "en";
|
|
65
|
+
}
|
|
66
|
+
/** The current words for a kind in a render's culture, with the version and the language they are in. */
|
|
67
|
+
export function heldEmbedWords(kind, culture) {
|
|
68
|
+
const language = wordsLanguageOf(culture);
|
|
69
|
+
return { ...HELD_EMBED_WORDS[HELD_EMBED_WORDS_VERSION][kind][language], version: HELD_EMBED_WORDS_VERSION, language };
|
|
70
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare function isSpace(code: number): boolean;
|
|
2
|
+
export declare function isAsciiLetter(code: number): boolean;
|
|
3
|
+
export declare function isDecimalDigit(code: number): boolean;
|
|
4
|
+
export declare function isHexDigit(code: number): boolean;
|
|
5
|
+
export declare function isAsciiAlphanumeric(code: number): boolean;
|
|
6
|
+
/** Whether `<` at `index` starts a tag: only before an ASCII letter, `/`, `!` or `?`. */
|
|
7
|
+
export declare function startsTag(html: string, index: number, end: number): boolean;
|
|
8
|
+
/** The index just past the `>` that ends the tag opening at `start`, skipping a quoted
|
|
9
|
+
* attribute value (a quote right after `=`, spaces allowed between); `end` when the tag is
|
|
10
|
+
* never closed. */
|
|
11
|
+
export declare function tagEnd(html: string, start: number, end: number): number;
|
|
12
|
+
/** The lower-cased tag name read from `start` (just past `<` or `</`). */
|
|
13
|
+
export declare function tagNameAt(html: string, start: number, end: number): string;
|
|
14
|
+
/** Whether a tag named `name` (lower case) starts at `start` (just past `<` or `</`):
|
|
15
|
+
* the name, then a space, `/`, `>` or the end. */
|
|
16
|
+
export declare function namedTagAt(html: string, start: number, end: number, name: string): boolean;
|
|
17
|
+
/** Reads a character reference at `amp` (an `&`): its text and the index after it, or null
|
|
18
|
+
* when it is not one this reader decodes (the `&` is then text). */
|
|
19
|
+
export declare function referenceAt(html: string, amp: number, end: number): {
|
|
20
|
+
text: string;
|
|
21
|
+
next: number;
|
|
22
|
+
} | null;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// M35 P1: the HTML scanning steps `htmlToText` (rich-text-text.ts) and `rewriteStartTags`
|
|
2
|
+
// (html-start-tags.ts) share, moved here unchanged from rich-text-text.ts. Each moves the read
|
|
3
|
+
// position forward only and never reads past the `end` it is given. Not exported from index.ts:
|
|
4
|
+
// these are building blocks, not a public reader.
|
|
5
|
+
export function isSpace(code) {
|
|
6
|
+
return code === 0x20 || code === 0x09 || code === 0x0a || code === 0x0c || code === 0x0d;
|
|
7
|
+
}
|
|
8
|
+
/** The named references `htmlToText` decodes; any other stays as written. */
|
|
9
|
+
const NAMED_REFERENCES = new Map([
|
|
10
|
+
["amp", "&"],
|
|
11
|
+
["lt", "<"],
|
|
12
|
+
["gt", ">"],
|
|
13
|
+
["quot", '"'],
|
|
14
|
+
["apos", "'"],
|
|
15
|
+
["nbsp", " "],
|
|
16
|
+
]);
|
|
17
|
+
/** The longest name in the table above. */
|
|
18
|
+
const NAMED_REFERENCE_LENGTH_MAX = 4;
|
|
19
|
+
const DECIMAL_DIGITS_MAX = 7;
|
|
20
|
+
const HEX_DIGITS_MAX = 6;
|
|
21
|
+
export function isAsciiLetter(code) {
|
|
22
|
+
return (code >= 0x41 && code <= 0x5a) || (code >= 0x61 && code <= 0x7a);
|
|
23
|
+
}
|
|
24
|
+
export function isDecimalDigit(code) {
|
|
25
|
+
return code >= 0x30 && code <= 0x39;
|
|
26
|
+
}
|
|
27
|
+
export function isHexDigit(code) {
|
|
28
|
+
return isDecimalDigit(code) || (code >= 0x41 && code <= 0x46) || (code >= 0x61 && code <= 0x66);
|
|
29
|
+
}
|
|
30
|
+
export function isAsciiAlphanumeric(code) {
|
|
31
|
+
return isAsciiLetter(code) || isDecimalDigit(code);
|
|
32
|
+
}
|
|
33
|
+
/** Whether `<` at `index` starts a tag: only before an ASCII letter, `/`, `!` or `?`. */
|
|
34
|
+
export function startsTag(html, index, end) {
|
|
35
|
+
if (index + 1 >= end)
|
|
36
|
+
return false;
|
|
37
|
+
const next = html.charCodeAt(index + 1);
|
|
38
|
+
return isAsciiLetter(next) || next === 0x2f || next === 0x21 || next === 0x3f;
|
|
39
|
+
}
|
|
40
|
+
/** The index just past the `>` that ends the tag opening at `start`, skipping a quoted
|
|
41
|
+
* attribute value (a quote right after `=`, spaces allowed between); `end` when the tag is
|
|
42
|
+
* never closed. */
|
|
43
|
+
export function tagEnd(html, start, end) {
|
|
44
|
+
let quote = 0;
|
|
45
|
+
let afterEquals = false;
|
|
46
|
+
for (let index = start + 1; index < end; index++) {
|
|
47
|
+
const code = html.charCodeAt(index);
|
|
48
|
+
if (quote !== 0) {
|
|
49
|
+
if (code === quote)
|
|
50
|
+
quote = 0;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (code === 0x3e)
|
|
54
|
+
return index + 1;
|
|
55
|
+
if (afterEquals && (code === 0x22 || code === 0x27)) {
|
|
56
|
+
quote = code;
|
|
57
|
+
afterEquals = false;
|
|
58
|
+
}
|
|
59
|
+
else if (code === 0x3d) {
|
|
60
|
+
afterEquals = true;
|
|
61
|
+
}
|
|
62
|
+
else if (!isSpace(code)) {
|
|
63
|
+
afterEquals = false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return end;
|
|
67
|
+
}
|
|
68
|
+
/** The lower-cased tag name read from `start` (just past `<` or `</`). */
|
|
69
|
+
export function tagNameAt(html, start, end) {
|
|
70
|
+
let index = start;
|
|
71
|
+
while (index < end && (isAsciiAlphanumeric(html.charCodeAt(index)) || html.charCodeAt(index) === 0x2d))
|
|
72
|
+
index++;
|
|
73
|
+
return html.slice(start, index).toLowerCase();
|
|
74
|
+
}
|
|
75
|
+
/** Whether a tag named `name` (lower case) starts at `start` (just past `<` or `</`):
|
|
76
|
+
* the name, then a space, `/`, `>` or the end. */
|
|
77
|
+
export function namedTagAt(html, start, end, name) {
|
|
78
|
+
if (start + name.length > end)
|
|
79
|
+
return false;
|
|
80
|
+
for (let offset = 0; offset < name.length; offset++) {
|
|
81
|
+
const code = html.charCodeAt(start + offset);
|
|
82
|
+
const lower = code >= 0x41 && code <= 0x5a ? code + 0x20 : code;
|
|
83
|
+
if (lower !== name.charCodeAt(offset))
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
const after = start + name.length;
|
|
87
|
+
if (after === end)
|
|
88
|
+
return true;
|
|
89
|
+
const code = html.charCodeAt(after);
|
|
90
|
+
return isSpace(code) || code === 0x2f || code === 0x3e;
|
|
91
|
+
}
|
|
92
|
+
/** Reads a character reference at `amp` (an `&`): its text and the index after it, or null
|
|
93
|
+
* when it is not one this reader decodes (the `&` is then text). */
|
|
94
|
+
export function referenceAt(html, amp, end) {
|
|
95
|
+
let index = amp + 1;
|
|
96
|
+
if (index < end && html.charCodeAt(index) === 0x23) {
|
|
97
|
+
index += 1;
|
|
98
|
+
let hex = false;
|
|
99
|
+
if (index < end && (html.charCodeAt(index) === 0x78 || html.charCodeAt(index) === 0x58)) {
|
|
100
|
+
hex = true;
|
|
101
|
+
index += 1;
|
|
102
|
+
}
|
|
103
|
+
const digitsStart = index;
|
|
104
|
+
const limit = hex ? HEX_DIGITS_MAX : DECIMAL_DIGITS_MAX;
|
|
105
|
+
// Reads one digit past the limit at most, so a long run costs nothing extra.
|
|
106
|
+
while (index < end && index - digitsStart <= limit && (hex ? isHexDigit(html.charCodeAt(index)) : isDecimalDigit(html.charCodeAt(index))))
|
|
107
|
+
index++;
|
|
108
|
+
const digits = index - digitsStart;
|
|
109
|
+
if (digits === 0 || digits > limit || index >= end || html.charCodeAt(index) !== 0x3b)
|
|
110
|
+
return null;
|
|
111
|
+
const code = Number.parseInt(html.slice(digitsStart, index), hex ? 16 : 10);
|
|
112
|
+
const valid = code !== 0 && code <= 0x10ffff && !(code >= 0xd800 && code <= 0xdfff);
|
|
113
|
+
return { text: valid ? String.fromCodePoint(code) : "�", next: index + 1 };
|
|
114
|
+
}
|
|
115
|
+
const nameStart = index;
|
|
116
|
+
while (index < end && index - nameStart <= NAMED_REFERENCE_LENGTH_MAX && isAsciiAlphanumeric(html.charCodeAt(index)))
|
|
117
|
+
index++;
|
|
118
|
+
if (index >= end || html.charCodeAt(index) !== 0x3b)
|
|
119
|
+
return null;
|
|
120
|
+
const decoded = NAMED_REFERENCES.get(html.slice(nameStart, index));
|
|
121
|
+
return decoded === undefined ? null : { text: decoded, next: index + 1 };
|
|
122
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** How many characters of HTML one call reads (2 MiB); a longer input is returned unchanged. */
|
|
2
|
+
export declare const HTML_REWRITE_INPUT_MAX: number;
|
|
3
|
+
/** How many start tags one call reads; the rest of the input is copied unchanged. */
|
|
4
|
+
export declare const HTML_REWRITE_TAGS_MAX = 100000;
|
|
5
|
+
/** The most attributes a tag may hold to be handed over, and a change may give. */
|
|
6
|
+
export declare const HTML_TAG_ATTRIBUTES_MAX = 64;
|
|
7
|
+
/** The longest attribute name a tag is handed over with, and a change may give. */
|
|
8
|
+
export declare const HTML_ATTRIBUTE_NAME_MAX = 64;
|
|
9
|
+
/** One attribute: its name in lower case, and its value (null for a bare attribute) with the numeric
|
|
10
|
+
* character references and the six named ones `&`, `<`, `>`, `"`, `'` and
|
|
11
|
+
* ` ` decoded. Any other named reference (`é`, `:`) stays as written, so compare
|
|
12
|
+
* with care. Handed back as given (the same object), it is written exactly as it was found; a new
|
|
13
|
+
* or changed one is written from its value, escaped. A copy (`{ ...attribute }`) is a new one. */
|
|
14
|
+
export interface HtmlAttribute {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly value: string | null;
|
|
17
|
+
}
|
|
18
|
+
/** A start tag as handed over: its name in lower case, its attributes in order, and whether it ends with "/". */
|
|
19
|
+
export interface HtmlStartTag {
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly attributes: readonly HtmlAttribute[];
|
|
22
|
+
readonly selfClosing: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** The new attributes of a tag, or null (or undefined) to keep the tag exactly as written. */
|
|
25
|
+
export type HtmlStartTagChange = {
|
|
26
|
+
readonly attributes: readonly HtmlAttribute[];
|
|
27
|
+
} | null | undefined;
|
|
28
|
+
export interface RewriteStartTagsOptions {
|
|
29
|
+
/** Only start tags with one of these names (any case) are handed over; every tag when absent. */
|
|
30
|
+
names?: readonly string[];
|
|
31
|
+
/** Called once when the input is longer than HTML_REWRITE_INPUT_MAX or holds more than HTML_REWRITE_TAGS_MAX start tags. */
|
|
32
|
+
onCut?: () => void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The HTML with each start tag `visit` changes written back from its new attributes: one handed back
|
|
36
|
+
* as it was given is written as it was found, a new or changed one from its value, escaped; every
|
|
37
|
+
* other byte as it was. `visit` is handed each start tag (only those named in
|
|
38
|
+
* `options.names`, when given) outside comments, declarations and the text of script, style,
|
|
39
|
+
* textarea, title, noscript, iframe, noembed, noframes, xmp and plaintext elements; a tag with more
|
|
40
|
+
* than HTML_TAG_ATTRIBUTES_MAX attributes, an attribute name that cannot be written back or a tag name
|
|
41
|
+
* holding a character other than a letter, a digit or "-" is copied unvisited. Values are decoded as
|
|
42
|
+
* HtmlAttribute says (numeric references and six named ones). Reads at most HTML_REWRITE_INPUT_MAX characters (a
|
|
43
|
+
* longer input is returned unchanged) and HTML_REWRITE_TAGS_MAX start tags (the rest is copied), and
|
|
44
|
+
* calls `options.onCut` once when either cut. Answers the same string when nothing changed. Throws a
|
|
45
|
+
* TypeError for a change it cannot write safely; a throw from `visit` passes through.
|
|
46
|
+
* @experimental
|
|
47
|
+
*/
|
|
48
|
+
export declare function rewriteStartTags(html: string, visit: (tag: HtmlStartTag) => HtmlStartTagChange, options?: RewriteStartTagsOptions): string;
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import { isSpace, namedTagAt, referenceAt, startsTag, tagNameAt } from "./html-scan.js";
|
|
2
|
+
// M35 P1 (W3): one forward pass over HTML that hands each start tag to the caller and writes back only
|
|
3
|
+
// the tags the caller changes, re-emitted from their checked parts: an attribute the caller hands back
|
|
4
|
+
// as it was given is written from its own source text, byte for byte, and only a new or changed one is
|
|
5
|
+
// written from its value, escaped (so a reference the scan does not decode is never escaped twice).
|
|
6
|
+
// Everything else (text, comments, end tags, declarations, the text of script, style, textarea,
|
|
7
|
+
// title, noscript, iframe, noembed, noframes, xmp and plaintext elements, an unclosed tag at the end)
|
|
8
|
+
// is copied byte for byte. No regular expression and no
|
|
9
|
+
// DOM: every loop moves the read position forward, so the cost is linear in the input, which is
|
|
10
|
+
// capped, and the start tags read are counted. Experimental (EXPERIMENTAL_POINTS).
|
|
11
|
+
/** How many characters of HTML one call reads (2 MiB); a longer input is returned unchanged. */
|
|
12
|
+
export const HTML_REWRITE_INPUT_MAX = 2 * 1024 * 1024;
|
|
13
|
+
/** How many start tags one call reads; the rest of the input is copied unchanged. */
|
|
14
|
+
export const HTML_REWRITE_TAGS_MAX = 100_000;
|
|
15
|
+
/** The most attributes a tag may hold to be handed over, and a change may give. */
|
|
16
|
+
export const HTML_TAG_ATTRIBUTES_MAX = 64;
|
|
17
|
+
/** The longest attribute name a tag is handed over with, and a change may give. */
|
|
18
|
+
export const HTML_ATTRIBUTE_NAME_MAX = 64;
|
|
19
|
+
/** Elements whose text holds no tags: the scan skips to their end tag (a script's by scriptTextEnd).
|
|
20
|
+
* noscript is read as a browser with scripting on reads it, as text. */
|
|
21
|
+
const RAW_TEXT_ELEMENTS = new Set(["script", "style", "textarea", "title", "noscript", "iframe", "noembed", "noframes", "xmp"]);
|
|
22
|
+
/** The source text of each attribute handed over (`name`, `name=value` or `name="value"` as written),
|
|
23
|
+
* so one handed back unchanged is written exactly as it was found. Only attributes whose text ends
|
|
24
|
+
* where the scan read it (a bare name, a non-empty unquoted value, or a quoted one whose quote closes
|
|
25
|
+
* inside the tag) are kept; any other is written from its value. Keyed by the frozen object, so no
|
|
26
|
+
* caller can set one. */
|
|
27
|
+
const SOURCE_TEXT = new WeakMap();
|
|
28
|
+
/** Whether an attribute name can be written back unquoted and unchanged: 1 to HTML_ATTRIBUTE_NAME_MAX
|
|
29
|
+
* characters with no space, control character, quote, "<", ">", "/" or "=". */
|
|
30
|
+
function isWritableAttributeName(name) {
|
|
31
|
+
if (name.length === 0 || name.length > HTML_ATTRIBUTE_NAME_MAX)
|
|
32
|
+
return false;
|
|
33
|
+
for (let index = 0; index < name.length; index += 1) {
|
|
34
|
+
const code = name.charCodeAt(index);
|
|
35
|
+
if (code <= 0x20 || code === 0x7f || (code >= 0x80 && code <= 0x9f))
|
|
36
|
+
return false;
|
|
37
|
+
if (code === 0x22 || code === 0x27 || code === 0x3c || code === 0x3e || code === 0x2f || code === 0x3d)
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
// Where startTagEnd is in a tag, by the states of a browser's tokenizer it needs.
|
|
43
|
+
const IN_TAG_NAME = 0;
|
|
44
|
+
const BEFORE_NAME = 1;
|
|
45
|
+
const IN_NAME = 2;
|
|
46
|
+
const AFTER_NAME = 3;
|
|
47
|
+
const BEFORE_VALUE = 4;
|
|
48
|
+
const UNQUOTED_VALUE = 5;
|
|
49
|
+
/** The index just past the `>` that ends the tag opening at `start`, read as a browser's tokenizer
|
|
50
|
+
* reads it: a quote opens a value only right after "=" (spaces between), and a second "=" or a quote
|
|
51
|
+
* inside an unquoted value is part of it. -1 when the tag never ends. */
|
|
52
|
+
function startTagEnd(html, start, end) {
|
|
53
|
+
let state = IN_TAG_NAME;
|
|
54
|
+
for (let index = start + 1; index < end; index += 1) {
|
|
55
|
+
const code = html.charCodeAt(index);
|
|
56
|
+
if (code === 0x3e)
|
|
57
|
+
return index + 1;
|
|
58
|
+
const space = isSpace(code);
|
|
59
|
+
switch (state) {
|
|
60
|
+
case IN_TAG_NAME:
|
|
61
|
+
if (space || code === 0x2f)
|
|
62
|
+
state = BEFORE_NAME;
|
|
63
|
+
break;
|
|
64
|
+
case BEFORE_NAME:
|
|
65
|
+
// "=" here starts a name, as any character but a space or "/" does.
|
|
66
|
+
if (!space && code !== 0x2f)
|
|
67
|
+
state = IN_NAME;
|
|
68
|
+
break;
|
|
69
|
+
case IN_NAME:
|
|
70
|
+
case AFTER_NAME:
|
|
71
|
+
if (code === 0x3d)
|
|
72
|
+
state = BEFORE_VALUE;
|
|
73
|
+
else if (code === 0x2f)
|
|
74
|
+
state = BEFORE_NAME;
|
|
75
|
+
else if (space)
|
|
76
|
+
state = AFTER_NAME;
|
|
77
|
+
else
|
|
78
|
+
state = IN_NAME;
|
|
79
|
+
break;
|
|
80
|
+
case BEFORE_VALUE:
|
|
81
|
+
if (code === 0x22 || code === 0x27) {
|
|
82
|
+
const close = html.indexOf(code === 0x22 ? '"' : "'", index + 1);
|
|
83
|
+
if (close === -1 || close >= end)
|
|
84
|
+
return -1;
|
|
85
|
+
index = close;
|
|
86
|
+
state = BEFORE_NAME;
|
|
87
|
+
}
|
|
88
|
+
else if (!space) {
|
|
89
|
+
state = UNQUOTED_VALUE;
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
default:
|
|
93
|
+
if (space)
|
|
94
|
+
state = BEFORE_NAME;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return -1;
|
|
98
|
+
}
|
|
99
|
+
/** Where a script's text ends: the index of the `</script` that ends it, or `end`. It follows the
|
|
100
|
+
* script data states a browser reads (escaped after `<!--`, double escaped after a `<script`
|
|
101
|
+
* there, where a `</script` only goes back to escaped; `-->` ends either), one step a character. */
|
|
102
|
+
function scriptTextEnd(html, from, end) {
|
|
103
|
+
let escaped = false;
|
|
104
|
+
let doubled = false;
|
|
105
|
+
let index = from;
|
|
106
|
+
while (index < end) {
|
|
107
|
+
const code = html.charCodeAt(index);
|
|
108
|
+
if (code === 0x3c) {
|
|
109
|
+
const slash = index + 1 < end && html.charCodeAt(index + 1) === 0x2f;
|
|
110
|
+
if (slash && namedTagAt(html, index + 2, end, "script")) {
|
|
111
|
+
if (!doubled)
|
|
112
|
+
return index;
|
|
113
|
+
doubled = false;
|
|
114
|
+
index += 8;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (!escaped && html.startsWith("<!--", index)) {
|
|
118
|
+
escaped = true;
|
|
119
|
+
// Back to the first "-", so "<!-->" and "<!--->" end where they start.
|
|
120
|
+
index += 2;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (escaped && !doubled && namedTagAt(html, index + 1, end, "script")) {
|
|
124
|
+
doubled = true;
|
|
125
|
+
index += 7;
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else if (code === 0x2d && escaped && html.startsWith("-->", index)) {
|
|
130
|
+
escaped = false;
|
|
131
|
+
doubled = false;
|
|
132
|
+
index += 3;
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
index += 1;
|
|
136
|
+
}
|
|
137
|
+
return end;
|
|
138
|
+
}
|
|
139
|
+
/** Where the comment whose `<!--` is at `open` ends (just past it): at `<!-->`, `<!--->`, `-->`
|
|
140
|
+
* or `--!>`, as a browser ends it; `end` when it never does. Each "--" is looked at once. */
|
|
141
|
+
function commentEnd(html, open, end) {
|
|
142
|
+
if (html.charCodeAt(open + 4) === 0x3e)
|
|
143
|
+
return open + 5;
|
|
144
|
+
if (html.startsWith("->", open + 4))
|
|
145
|
+
return open + 6;
|
|
146
|
+
let from = open + 4;
|
|
147
|
+
while (from < end) {
|
|
148
|
+
const dashes = html.indexOf("--", from);
|
|
149
|
+
if (dashes === -1)
|
|
150
|
+
return end;
|
|
151
|
+
if (html.charCodeAt(dashes + 2) === 0x3e)
|
|
152
|
+
return dashes + 3;
|
|
153
|
+
if (html.startsWith("!>", dashes + 2))
|
|
154
|
+
return dashes + 4;
|
|
155
|
+
from = dashes + 1;
|
|
156
|
+
}
|
|
157
|
+
return end;
|
|
158
|
+
}
|
|
159
|
+
/** Where the text of raw text element `name` ends: the index of its `</name`, or `end`. */
|
|
160
|
+
function rawTextEnd(html, from, end, name) {
|
|
161
|
+
let index = from;
|
|
162
|
+
while (index < end) {
|
|
163
|
+
const open = html.indexOf("</", index);
|
|
164
|
+
if (open === -1 || open >= end)
|
|
165
|
+
return end;
|
|
166
|
+
if (namedTagAt(html, open + 2, end, name))
|
|
167
|
+
return open;
|
|
168
|
+
index = open + 2;
|
|
169
|
+
}
|
|
170
|
+
return end;
|
|
171
|
+
}
|
|
172
|
+
/** The text between `from` and `to` with its character references decoded. */
|
|
173
|
+
function decodedValue(html, from, to) {
|
|
174
|
+
let out = "";
|
|
175
|
+
let run = from;
|
|
176
|
+
let index = from;
|
|
177
|
+
while (index < to) {
|
|
178
|
+
if (html.charCodeAt(index) !== 0x26) {
|
|
179
|
+
index += 1;
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
const reference = referenceAt(html, index, to);
|
|
183
|
+
if (reference === null) {
|
|
184
|
+
index += 1;
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
out += html.slice(run, index) + reference.text;
|
|
188
|
+
run = reference.next;
|
|
189
|
+
index = reference.next;
|
|
190
|
+
}
|
|
191
|
+
return out + html.slice(run, to);
|
|
192
|
+
}
|
|
193
|
+
/** The attributes between `from` (just past the tag name) and `to` (the tag's `>`), and whether the tag
|
|
194
|
+
* ends with "/"; null when there are more than HTML_TAG_ATTRIBUTES_MAX or a name cannot be written back. */
|
|
195
|
+
function readAttributes(html, from, to) {
|
|
196
|
+
const attributes = [];
|
|
197
|
+
let selfClosing = false;
|
|
198
|
+
let index = from;
|
|
199
|
+
while (index < to) {
|
|
200
|
+
const code = html.charCodeAt(index);
|
|
201
|
+
if (isSpace(code)) {
|
|
202
|
+
index += 1;
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
if (code === 0x2f) {
|
|
206
|
+
selfClosing = true;
|
|
207
|
+
index += 1;
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
selfClosing = false;
|
|
211
|
+
const nameStart = index;
|
|
212
|
+
while (index < to) {
|
|
213
|
+
const c = html.charCodeAt(index);
|
|
214
|
+
if (isSpace(c) || c === 0x2f || c === 0x3d)
|
|
215
|
+
break;
|
|
216
|
+
index += 1;
|
|
217
|
+
}
|
|
218
|
+
// A name that starts with "=" takes that one character, as a browser reads it.
|
|
219
|
+
if (index === nameStart)
|
|
220
|
+
index += 1;
|
|
221
|
+
const name = html.slice(nameStart, index).toLowerCase();
|
|
222
|
+
if (!isWritableAttributeName(name) || attributes.length === HTML_TAG_ATTRIBUTES_MAX)
|
|
223
|
+
return null;
|
|
224
|
+
let after = index;
|
|
225
|
+
while (after < to && isSpace(html.charCodeAt(after)))
|
|
226
|
+
after += 1;
|
|
227
|
+
let value = null;
|
|
228
|
+
// The end of the attribute's source text, or -1 when it is not kept (a quote that never closes).
|
|
229
|
+
let sourceEnd = index;
|
|
230
|
+
if (after < to && html.charCodeAt(after) === 0x3d) {
|
|
231
|
+
let start = after + 1;
|
|
232
|
+
while (start < to && isSpace(html.charCodeAt(start)))
|
|
233
|
+
start += 1;
|
|
234
|
+
const quote = start < to ? html.charCodeAt(start) : 0;
|
|
235
|
+
if (quote === 0x22 || quote === 0x27) {
|
|
236
|
+
const close = html.indexOf(quote === 0x22 ? '"' : "'", start + 1);
|
|
237
|
+
const stop = close === -1 || close > to ? to : close;
|
|
238
|
+
value = decodedValue(html, start + 1, stop);
|
|
239
|
+
index = stop + 1;
|
|
240
|
+
sourceEnd = close === -1 || close > to ? -1 : close + 1;
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
let stop = start;
|
|
244
|
+
while (stop < to && !isSpace(html.charCodeAt(stop)))
|
|
245
|
+
stop += 1;
|
|
246
|
+
value = decodedValue(html, start, stop);
|
|
247
|
+
index = stop;
|
|
248
|
+
// An empty value is not kept: written as "name=" it would take the next attribute as its value.
|
|
249
|
+
sourceEnd = stop > start ? stop : -1;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
index = after;
|
|
254
|
+
}
|
|
255
|
+
const attribute = Object.freeze({ name, value });
|
|
256
|
+
if (sourceEnd !== -1)
|
|
257
|
+
SOURCE_TEXT.set(attribute, html.slice(nameStart, sourceEnd));
|
|
258
|
+
attributes.push(attribute);
|
|
259
|
+
}
|
|
260
|
+
return { attributes, selfClosing };
|
|
261
|
+
}
|
|
262
|
+
/** A value written inside double quotes, so it can never end its attribute or its tag. */
|
|
263
|
+
function escapedValue(value) {
|
|
264
|
+
return value.replaceAll("&", "&").replaceAll('"', """).replaceAll("<", "<").replaceAll(">", ">");
|
|
265
|
+
}
|
|
266
|
+
/** The attributes of a change, checked; a TypeError names what cannot be written, never a value. */
|
|
267
|
+
function checkedAttributes(change) {
|
|
268
|
+
const list = change.attributes;
|
|
269
|
+
if (!Array.isArray(list) || list.length > HTML_TAG_ATTRIBUTES_MAX) {
|
|
270
|
+
throw new TypeError(`rewriteStartTags: a change gives a list of at most ${HTML_TAG_ATTRIBUTES_MAX} attributes`);
|
|
271
|
+
}
|
|
272
|
+
return list.map((attribute) => {
|
|
273
|
+
// One handed over and given back as it was: frozen, so its name and value are the ones read.
|
|
274
|
+
if (typeof attribute === "object" && attribute !== null && SOURCE_TEXT.has(attribute))
|
|
275
|
+
return attribute;
|
|
276
|
+
const name = attribute?.name;
|
|
277
|
+
const value = attribute?.value;
|
|
278
|
+
if (typeof name !== "string" || !isWritableAttributeName(name)) {
|
|
279
|
+
throw new TypeError(`rewriteStartTags: an attribute name is 1 to ${HTML_ATTRIBUTE_NAME_MAX} characters with no space, quote, <, >, / or =`);
|
|
280
|
+
}
|
|
281
|
+
if (value !== null && typeof value !== "string")
|
|
282
|
+
throw new TypeError("rewriteStartTags: an attribute value is a string or null");
|
|
283
|
+
return { name: name.toLowerCase(), value };
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
function writeTag(name, attributes, selfClosing) {
|
|
287
|
+
let out = `<${name}`;
|
|
288
|
+
for (const attribute of attributes) {
|
|
289
|
+
const source = SOURCE_TEXT.get(attribute);
|
|
290
|
+
if (source !== undefined)
|
|
291
|
+
out += ` ${source}`;
|
|
292
|
+
else
|
|
293
|
+
out += attribute.value === null ? ` ${attribute.name}` : ` ${attribute.name}="${escapedValue(attribute.value)}"`;
|
|
294
|
+
}
|
|
295
|
+
return `${out}${selfClosing ? " /" : ""}>`;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* The HTML with each start tag `visit` changes written back from its new attributes: one handed back
|
|
299
|
+
* as it was given is written as it was found, a new or changed one from its value, escaped; every
|
|
300
|
+
* other byte as it was. `visit` is handed each start tag (only those named in
|
|
301
|
+
* `options.names`, when given) outside comments, declarations and the text of script, style,
|
|
302
|
+
* textarea, title, noscript, iframe, noembed, noframes, xmp and plaintext elements; a tag with more
|
|
303
|
+
* than HTML_TAG_ATTRIBUTES_MAX attributes, an attribute name that cannot be written back or a tag name
|
|
304
|
+
* holding a character other than a letter, a digit or "-" is copied unvisited. Values are decoded as
|
|
305
|
+
* HtmlAttribute says (numeric references and six named ones). Reads at most HTML_REWRITE_INPUT_MAX characters (a
|
|
306
|
+
* longer input is returned unchanged) and HTML_REWRITE_TAGS_MAX start tags (the rest is copied), and
|
|
307
|
+
* calls `options.onCut` once when either cut. Answers the same string when nothing changed. Throws a
|
|
308
|
+
* TypeError for a change it cannot write safely; a throw from `visit` passes through.
|
|
309
|
+
* @experimental
|
|
310
|
+
*/
|
|
311
|
+
export function rewriteStartTags(html, visit, options) {
|
|
312
|
+
if (typeof html !== "string")
|
|
313
|
+
return "";
|
|
314
|
+
if (html.length > HTML_REWRITE_INPUT_MAX) {
|
|
315
|
+
options?.onCut?.();
|
|
316
|
+
return html;
|
|
317
|
+
}
|
|
318
|
+
const names = options?.names === undefined ? null : new Set(options.names.map((name) => name.toLowerCase()));
|
|
319
|
+
const end = html.length;
|
|
320
|
+
const parts = [];
|
|
321
|
+
let copied = 0;
|
|
322
|
+
let index = 0;
|
|
323
|
+
let tags = 0;
|
|
324
|
+
while (index < end) {
|
|
325
|
+
const open = html.indexOf("<", index);
|
|
326
|
+
if (open === -1)
|
|
327
|
+
break;
|
|
328
|
+
if (!startsTag(html, open, end)) {
|
|
329
|
+
index = open + 1;
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
const next = html.charCodeAt(open + 1);
|
|
333
|
+
if (next === 0x21 && html.startsWith("--", open + 2)) {
|
|
334
|
+
index = commentEnd(html, open, end);
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
if (next === 0x21 || next === 0x3f) {
|
|
338
|
+
const close = html.indexOf(">", open + 2);
|
|
339
|
+
index = close === -1 ? end : close + 1;
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
342
|
+
const close = startTagEnd(html, open, end);
|
|
343
|
+
if (close === -1)
|
|
344
|
+
break;
|
|
345
|
+
if (next === 0x2f) {
|
|
346
|
+
index = close;
|
|
347
|
+
continue;
|
|
348
|
+
}
|
|
349
|
+
tags += 1;
|
|
350
|
+
if (tags > HTML_REWRITE_TAGS_MAX) {
|
|
351
|
+
options?.onCut?.();
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
const name = tagNameAt(html, open + 1, end);
|
|
355
|
+
// A browser reads a name to a space, "/" or ">": one that holds any other character (`<a.x>`) is
|
|
356
|
+
// not the element its first letters name, so it is copied unvisited and its text is read on.
|
|
357
|
+
const after = html.charCodeAt(open + 1 + name.length);
|
|
358
|
+
if (!isSpace(after) && after !== 0x2f && after !== 0x3e) {
|
|
359
|
+
index = close;
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
if (names === null || names.has(name)) {
|
|
363
|
+
const read = readAttributes(html, open + 1 + name.length, close - 1);
|
|
364
|
+
if (read !== null) {
|
|
365
|
+
const change = visit(Object.freeze({ name, attributes: Object.freeze(read.attributes), selfClosing: read.selfClosing }));
|
|
366
|
+
if (change !== null && change !== undefined) {
|
|
367
|
+
parts.push(html.slice(copied, open), writeTag(name, checkedAttributes(change), read.selfClosing));
|
|
368
|
+
copied = close;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
// Everything after a plaintext start tag is its text: a browser never ends it.
|
|
373
|
+
if (name === "plaintext")
|
|
374
|
+
break;
|
|
375
|
+
index = name === "script" ? scriptTextEnd(html, close, end) : RAW_TEXT_ELEMENTS.has(name) ? rawTextEnd(html, close, end, name) : close;
|
|
376
|
+
}
|
|
377
|
+
if (parts.length === 0)
|
|
378
|
+
return html;
|
|
379
|
+
parts.push(html.slice(copied));
|
|
380
|
+
return parts.join("");
|
|
381
|
+
}
|