@phis/ui 0.7.8 → 0.8.1
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/components/cms/phi-cms-layout-renderer.js +15 -7
- package/components/cms/phi-cms-render-diagnostic-client.d.ts +3 -1
- package/components/cms/phi-cms-render-diagnostic-client.js +4 -3
- package/components/cms/phi-cms-render-diagnostic.d.ts +8 -2
- package/components/cms/phi-cms-render-diagnostic.js +12 -2
- package/components/cms/phi-cms-render-error-boundary.d.ts +2 -0
- package/components/cms/phi-cms-render-error-boundary.js +1 -1
- package/components/cms/phi-cms-root-layout.js +3 -1
- package/components/controls/phi-address-control.d.ts +23 -0
- package/components/controls/phi-address-control.js +43 -0
- package/components/controls/phi-color-control.d.ts +3 -1
- package/components/controls/phi-color-control.js +2 -2
- package/components/controls/phi-country-select-control.d.ts +22 -0
- package/components/controls/phi-country-select-control.js +16 -0
- package/components/controls/phi-dialog-control.d.ts +1 -1
- package/components/controls/phi-drawer-control-adapter.d.ts +1 -1
- package/components/controls/phi-drawer-control-adapter.js +5 -3
- package/components/controls/phi-drawer-control.d.ts +7 -5
- package/components/controls/phi-float-button-control.d.ts +8 -1
- package/components/controls/phi-float-button-control.js +19 -3
- package/components/controls/phi-form-control.js +52 -8
- package/components/controls/phi-media-picker-control.d.ts +9 -0
- package/components/controls/phi-media-picker-control.js +1 -1
- package/components/controls/phi-modal-control-adapter.d.ts +1 -1
- package/components/controls/phi-modal-control-adapter.js +14 -37
- package/components/controls/phi-modal-control.d.ts +5 -5
- package/components/controls/phi-options-provider.d.ts +1 -0
- package/components/controls/phi-options-provider.js +1 -0
- package/components/controls/phi-overlay-control-contract.d.ts +52 -17
- package/components/controls/phi-overlay-control-contract.js +55 -30
- package/components/controls/phi-popover-control.js +4 -1
- package/components/controls/phi-reveal-once-dialog-control.d.ts +21 -0
- package/components/controls/phi-reveal-once-dialog-control.js +52 -0
- package/components/controls/phi-reveal-once-dialog-labels.d.ts +10 -0
- package/components/controls/phi-reveal-once-dialog-labels.js +5 -0
- package/components/controls/phi-table-control.d.ts +7 -1
- package/components/controls/phi-table-control.js +23 -8
- package/components/forms/flags-field.d.ts +22 -0
- package/components/forms/flags-field.js +58 -0
- package/components/forms/form-descriptor-field-check.d.ts +18 -0
- package/components/forms/form-descriptor-field-check.js +41 -0
- package/components/forms/form-descriptor-runtime-client.js +11 -10
- package/components/forms/form-option-flags.d.ts +20 -0
- package/components/forms/form-option-flags.js +38 -0
- package/components/forms/form-provider-contract.d.ts +23 -0
- package/components/forms/form-provider-contract.js +36 -0
- package/components/forms/form-provider-registry.d.ts +5 -1
- package/components/forms/form-record-source.d.ts +38 -0
- package/components/forms/form-record-source.js +48 -0
- package/components/forms/shared-form-descriptors.d.ts +0 -34
- package/components/forms/shared-form-descriptors.js +0 -6
- package/components/forms/shared-form-ids.d.ts +1 -1
- package/components/forms/shared-form-ids.js +1 -1
- package/components/forms/shared-form-provider-registry.js +13 -0
- package/components/forms/structured-field-labels.d.ts +24 -0
- package/components/forms/structured-field-labels.js +43 -0
- package/components/forms/structured-form-field-controls.d.ts +12 -0
- package/components/forms/structured-form-field-controls.js +65 -0
- package/components/media/media-settings-labels.d.ts +1 -0
- package/components/media/media-settings-labels.js +2 -0
- package/components/media/phi-media-picker-binding.d.ts +41 -33
- package/components/media/phi-media-picker-binding.js +2 -1
- package/components/media/use-media-library-add-picker.d.ts +33 -32
- package/components/overlays/phi-overlay-container-client.js +13 -11
- package/components/regions/phi-cms-region-shell.js +2 -2
- package/components/regions/presets/content-entry-editor-page-tree.js +12 -3
- package/components/regions/presets/phi-settings-page-shell-tree.d.ts +13 -2
- package/components/regions/presets/phi-settings-page-shell-tree.js +4 -4
- package/components/root/phi-root-theme-resolver.js +3 -0
- package/components/shell/phi-antd-icon.d.ts +1 -8
- package/components/shell/phi-antd-icon.js +1 -227
- package/components/shell/phi-icon-names.d.ts +22 -0
- package/components/shell/phi-icon-names.js +267 -0
- package/components/shell/phi-icon.d.ts +4 -15
- package/components/shell/phi-icon.js +9 -50
- package/components/tables/client/phi-table-binding-params.d.ts +24 -0
- package/components/tables/client/phi-table-binding-params.js +39 -0
- package/components/tables/client/phi-table-binding.d.ts +1 -3
- package/components/tables/client/phi-table-binding.js +5 -9
- package/components/widgets/client/shared/phi-button-icons.d.ts +6 -4
- package/components/widgets/client/shared/phi-button-icons.js +8 -12
- package/components/widgets/client/shared/phi-collection-binding-params.d.ts +8 -0
- package/components/widgets/client/shared/phi-collection-binding-params.js +13 -0
- package/components/widgets/client/shared/phi-collection-provider.d.ts +11 -1
- package/components/widgets/client/shared/phi-collection-provider.js +5 -0
- package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
- package/components/widgets/client/shared/phi-command-buttons.d.ts +29 -2
- package/components/widgets/client/shared/phi-command-buttons.js +19 -5
- package/components/widgets/client/shared/phi-rendered-value.js +27 -3
- package/components/widgets/client/shared/phi-table-provider-refusal.d.ts +13 -0
- package/components/widgets/client/shared/phi-table-provider-refusal.js +13 -0
- package/components/widgets/config/background.d.ts +3 -2
- package/components/widgets/config/choice-shared.d.ts +10 -1
- package/components/widgets/config/choice-shared.js +8 -2
- package/components/widgets/label-sets/admin-locales.js +1 -1
- package/components/widgets/label-sets/admin-users.d.ts +3 -5
- package/components/widgets/label-sets/admin-users.js +6 -10
- package/components/widgets/label-sets/builder-modules.js +4 -0
- package/components/widgets/label-sets/effects.js +2 -4
- package/components/widgets/label-sets/profile.d.ts +13 -16
- package/components/widgets/label-sets/profile.js +24 -33
- package/components/widgets/label-sets/registration.d.ts +0 -1
- package/components/widgets/label-sets/registration.js +0 -2
- package/components/widgets/label-sets/revisions.js +2 -0
- package/components/widgets/label-sets/search-results.js +2 -4
- package/components/widgets/label-sets/signals.js +2 -0
- package/components/widgets/label-sets/table.js +9 -0
- package/components/widgets/label-types/builder-modules.d.ts +4 -0
- package/components/widgets/label-types/builder-modules.js +2 -0
- package/components/widgets/label-types/effects.d.ts +3 -2
- package/components/widgets/label-types/effects.js +1 -2
- package/components/widgets/label-types/revisions.d.ts +2 -0
- package/components/widgets/label-types/revisions.js +2 -1
- package/components/widgets/label-types/search-results.d.ts +2 -2
- package/components/widgets/label-types/search-results.js +1 -2
- package/components/widgets/label-types/signals.d.ts +2 -0
- package/components/widgets/label-types/signals.js +1 -0
- package/components/widgets/label-types/table.d.ts +3 -0
- package/components/widgets/label-types/table.js +2 -0
- package/components/widgets/server/builder-chrome.d.ts +4 -1
- package/components/widgets/server/builder-chrome.js +2 -2
- package/components/widgets/shared/markdown-body-client.d.ts +26 -0
- package/components/widgets/shared/markdown-body-client.js +31 -1
- package/components/widgets/shared/markdown-render.d.ts +10 -2
- package/components/widgets/shared/markdown-render.js +35 -13
- package/components/widgets/shared/widget-failure-audience.d.ts +7 -0
- package/components/widgets/shared/widget-failure-audience.js +21 -0
- package/components/widgets/shared/widget-failure-client.js +5 -2
- package/components/widgets/shared/widget-failure-notice-client.d.ts +6 -0
- package/components/widgets/shared/widget-failure-notice-client.js +10 -0
- package/components/widgets/shared/widget-failure-notice.d.ts +6 -0
- package/components/widgets/shared/widget-failure-notice.js +17 -0
- package/components/widgets/shared/widget-failure-staff.d.ts +3 -0
- package/components/widgets/shared/widget-failure-staff.js +18 -0
- package/components/widgets/shared/widget-failure.d.ts +9 -6
- package/components/widgets/shared/widget-failure.js +0 -9
- package/components/widgets/shared/widget-failure.server.d.ts +4 -2
- package/components/widgets/shared/widget-failure.server.js +8 -3
- package/constants/countries.d.ts +9 -0
- package/constants/countries.js +28 -0
- package/constants/customer-file.d.ts +34 -0
- package/constants/customer-file.js +35 -0
- package/constants/record-field-kinds.d.ts +15 -0
- package/constants/record-field-kinds.js +13 -0
- package/constants/runtime-module-ownership.js +15 -2
- package/constants/runtime-render-client-types.d.ts +5 -0
- package/constants/runtime-render-client-types.js +5 -0
- package/constants/site-address.d.ts +9 -0
- package/constants/site-address.js +10 -0
- package/constants/table-loading.d.ts +14 -0
- package/constants/table-loading.js +14 -0
- package/{plugins/runtime-modules/threads/controller/address.js → constants/threads-controller-address.js} +1 -1
- package/constants.d.ts +2 -0
- package/constants.js +4 -0
- package/gateway/form-handler-request.d.ts +22 -0
- package/gateway/form-handler-request.js +40 -0
- package/gateway/label-set.d.ts +15 -2
- package/gateway/label-set.js +60 -22
- package/gateway/site-cms-write-validation.js +19 -3
- package/gateway/site-form-route.js +11 -2
- package/helpers/address-field.d.ts +43 -0
- package/helpers/address-field.js +68 -0
- package/helpers/announced-action.d.ts +17 -0
- package/helpers/announced-action.js +29 -0
- package/helpers/cms-dialog.d.ts +5 -20
- package/helpers/cms-dialog.js +8 -13
- package/helpers/cms-page-catalog.d.ts +10 -0
- package/helpers/cms-page-catalog.js +19 -0
- package/helpers/cms-preset-nodes.d.ts +4 -4
- package/helpers/cms-preset-nodes.js +1 -1
- package/helpers/cms-region-keys.d.ts +1 -1
- package/helpers/country-names.d.ts +12 -0
- package/helpers/country-names.js +14 -0
- package/helpers/phi-metadata.d.ts +25 -1
- package/helpers/phi-metadata.js +53 -1
- package/helpers/phi-site-description.d.ts +11 -0
- package/helpers/phi-site-description.js +13 -0
- package/helpers/preset-form-check.d.ts +14 -0
- package/helpers/preset-form-check.js +12 -0
- package/helpers/preset-table-check.d.ts +38 -0
- package/helpers/preset-table-check.js +118 -0
- package/helpers/preset-text-source-check.d.ts +4 -1
- package/helpers/preset-text-source-check.js +6 -1
- package/helpers/preset-tree-contract-check.d.ts +3 -2
- package/helpers/preset-tree-contract-check.js +30 -5
- package/helpers/public-route-claims.d.ts +9 -1
- package/helpers/public-route-claims.js +23 -3
- package/helpers/record-fields.d.ts +1 -5
- package/helpers/record-fields.js +15 -6
- package/helpers/record-widget-binding.d.ts +10 -0
- package/helpers/record-widget-binding.js +35 -0
- package/helpers/record-widget.d.ts +1 -10
- package/helpers/record-widget.js +4 -33
- package/helpers/route-address-check.d.ts +22 -2
- package/helpers/route-address-check.js +29 -8
- package/helpers/site-address-row.d.ts +23 -0
- package/helpers/site-address-row.js +36 -0
- package/helpers/surface-style.d.ts +8 -1
- package/helpers/surface-style.js +12 -2
- package/helpers/table-widget-binding.d.ts +12 -0
- package/helpers/table-widget-binding.js +296 -0
- package/helpers/thread-inbox-row.d.ts +20 -0
- package/helpers/thread-inbox-row.js +26 -0
- package/helpers/translation-format.d.ts +26 -0
- package/helpers/translation-format.js +31 -0
- package/helpers/tree-widget-binding.d.ts +19 -0
- package/helpers/tree-widget-binding.js +72 -0
- package/helpers/typed-confirmation.d.ts +9 -0
- package/helpers/typed-confirmation.js +13 -0
- package/helpers/widget-binding-check.d.ts +22 -0
- package/helpers/widget-binding-check.js +91 -0
- package/module-labels.d.ts +1 -1
- package/module-labels.js +1 -1
- package/module-page-check.d.ts +3 -0
- package/module-page-check.js +3 -0
- package/module-records.d.ts +2 -2
- package/module-records.js +1 -0
- package/next/area-route.js +34 -1
- package/next/root-route.js +4 -4
- package/package.json +2 -2
- package/plugins/runtime-modules/accounting/customer-file-access.d.ts +11 -0
- package/plugins/runtime-modules/accounting/customer-file-access.js +12 -0
- package/plugins/runtime-modules/accounting/data-providers.js +1 -1
- package/plugins/runtime-modules/accounting/ids.d.ts +14 -0
- package/plugins/runtime-modules/accounting/ids.js +34 -0
- package/plugins/runtime-modules/accounting/presets.js +32 -5
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +78 -0
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +136 -0
- package/plugins/runtime-modules/accounting/trees/accounting-products-label-set.js +2 -2
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +29 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +450 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.js +4 -0
- package/plugins/runtime-modules/app/client-data-providers.d.ts +7 -0
- package/plugins/runtime-modules/app/client-data-providers.js +9 -0
- package/plugins/runtime-modules/app/data-providers.d.ts +43 -0
- package/plugins/runtime-modules/app/data-providers.js +45 -0
- package/plugins/runtime-modules/app/definition.d.ts +60 -1
- package/plugins/runtime-modules/app/definition.js +2 -0
- package/plugins/runtime-modules/app/forms.d.ts +33 -3
- package/plugins/runtime-modules/app/forms.js +166 -31
- package/plugins/runtime-modules/app/ids.d.ts +8 -0
- package/plugins/runtime-modules/app/ids.js +9 -0
- package/plugins/runtime-modules/app/module.d.ts +60 -1
- package/plugins/runtime-modules/app/services/addresses-collection.d.ts +59 -0
- package/plugins/runtime-modules/app/services/addresses-collection.js +105 -0
- package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +21 -0
- package/plugins/runtime-modules/app/trees/account-addresses-panel.js +143 -0
- package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +57 -0
- package/plugins/runtime-modules/app/trees/addresses-label-set.js +104 -0
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.d.ts +1 -2
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +28 -19
- package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +1 -2
- package/plugins/runtime-modules/app/trees/profile-label-set.js +5 -14
- package/plugins/runtime-modules/asset/presets.d.ts +4 -0
- package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +5 -0
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +4 -2
- package/plugins/runtime-modules/auth/trees/phi-auth-area-overlay-tree.server.js +4 -2
- package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +2 -2
- package/plugins/runtime-modules/auth/widgets/logout/client.d.ts +1 -1
- package/plugins/runtime-modules/auth/widgets/logout/client.js +2 -2
- package/plugins/runtime-modules/auth/widgets/security/client.d.ts +5 -1
- package/plugins/runtime-modules/auth/widgets/security/client.js +12 -10
- package/plugins/runtime-modules/avatar/overlay-tree.server.js +1 -1
- package/plugins/runtime-modules/blog/presets.d.ts +4 -0
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +16 -6
- package/plugins/runtime-modules/builder/clients/inspector-image-field.d.ts +2 -1
- package/plugins/runtime-modules/builder/clients/inspector-image-field.js +6 -3
- package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +3 -1
- package/plugins/runtime-modules/builder/clients/metadata-table-provider-stand-ins.d.ts +23 -0
- package/plugins/runtime-modules/builder/clients/metadata-table-provider-stand-ins.js +38 -0
- package/plugins/runtime-modules/builder/clients/mode-switch.d.ts +4 -1
- package/plugins/runtime-modules/builder/clients/mode-switch.js +2 -15
- package/plugins/runtime-modules/builder/clients/pages-workspace.js +2 -0
- package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +2 -1
- package/plugins/runtime-modules/builder/controller/draft-status-controller.js +28 -1
- package/plugins/runtime-modules/builder/controller/signal-wiring-controller.js +5 -1
- package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +5 -0
- package/plugins/runtime-modules/builder/page-presets.server.d.ts +7 -0
- package/plugins/runtime-modules/builder/page-presets.server.js +10 -1
- package/plugins/runtime-modules/builder/persistence.js +4 -0
- package/plugins/runtime-modules/builder/public-route-collisions.js +8 -3
- package/plugins/runtime-modules/builder/signal-wiring-options.js +9 -2
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +8 -1
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +47 -7
- package/plugins/runtime-modules/builder/widgets/chrome/config.d.ts +6 -4
- package/plugins/runtime-modules/builder/widgets/chrome/config.js +11 -1
- package/plugins/runtime-modules/builder/widgets/inspector-header/authoring.d.ts +2 -2
- package/plugins/runtime-modules/builder/widgets/inspector-header/plugin.d.ts +2 -2
- package/plugins/runtime-modules/builder/widgets/mode-switch/plugin.js +1 -1
- package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +2 -2
- package/plugins/runtime-modules/client-manifests/app.js +3 -0
- package/plugins/runtime-modules/client-manifests/builder.js +10 -0
- package/plugins/runtime-modules/client-manifests/common.js +6 -0
- package/plugins/runtime-modules/content-entry-routes.d.ts +4 -0
- package/plugins/runtime-modules/contracts.js +31 -1
- package/plugins/runtime-modules/core/definition.d.ts +23 -0
- package/plugins/runtime-modules/core/form-providers.d.ts +23 -0
- package/plugins/runtime-modules/core/messaging/thread-inbox-table.d.ts +0 -17
- package/plugins/runtime-modules/core/messaging/thread-inbox-table.js +2 -23
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +1 -2
- package/plugins/runtime-modules/core/widgets/card/config.js +0 -1
- package/plugins/runtime-modules/core/widgets/card/editor.js +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/client.js +5 -2
- package/plugins/runtime-modules/core/widgets/collection-view/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.d.ts +55 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.js +173 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.d.ts +48 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.js +67 -0
- package/plugins/runtime-modules/core/widgets/command-toolbar/client.js +3 -0
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +316 -1
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.js +4 -4
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/dimension/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/float-button/client.js +4 -1
- package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +326 -3
- package/plugins/runtime-modules/core/widgets/float-button/config.js +5 -2
- package/plugins/runtime-modules/core/widgets/form/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/form/config.js +14 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/header-navigation/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/length/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/plugin.js +20 -7
- package/plugins/runtime-modules/core/widgets/markdown/server.d.ts +6 -2
- package/plugins/runtime-modules/core/widgets/markdown/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/markdown/table-embeds.server.d.ts +12 -0
- package/plugins/runtime-modules/core/widgets/markdown/table-embeds.server.js +68 -0
- package/plugins/runtime-modules/core/widgets/number-input/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/record/client.js +2 -6
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +2 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +48 -51
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -3
- package/plugins/runtime-modules/core/widgets/table/config.js +9 -0
- package/plugins/runtime-modules/core/widgets/table/reader-query.d.ts +17 -0
- package/plugins/runtime-modules/core/widgets/table/reader-query.js +33 -0
- package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/thread-conversation/config.d.ts +6 -2
- package/plugins/runtime-modules/core/widgets/thread-conversation/config.js +6 -1
- package/plugins/runtime-modules/core/widgets/thread-widget-config.d.ts +10 -0
- package/plugins/runtime-modules/core/widgets/thread-widget-config.js +6 -0
- package/plugins/runtime-modules/core/widgets/tree/client.js +6 -6
- package/plugins/runtime-modules/dashboard/trees/dashboard-cards-page-tree.js +3 -1
- package/plugins/runtime-modules/descriptor-compiler.d.ts +19 -3
- package/plugins/runtime-modules/descriptor-compiler.js +44 -16
- package/plugins/runtime-modules/editor/presets.d.ts +4 -0
- package/plugins/runtime-modules/editor/trees/phi-default-editor-releases-page-tree.js +3 -1
- package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +5 -1
- package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +5 -1
- package/plugins/runtime-modules/localization/presets.d.ts +4 -0
- package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.d.ts +2 -0
- package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.js +2 -0
- package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +3 -1
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +9 -2
- package/plugins/runtime-modules/news/presets.d.ts +4 -0
- package/plugins/runtime-modules/observability/trees/phi-default-admin-logs-page-tree.js +6 -2
- package/plugins/runtime-modules/resolver.js +17 -0
- package/plugins/runtime-modules/revisions/controller/binding.d.ts +37 -0
- package/plugins/runtime-modules/revisions/controller/binding.js +75 -0
- package/plugins/runtime-modules/revisions/controller/client.d.ts +5 -0
- package/plugins/runtime-modules/revisions/controller/client.js +86 -60
- package/plugins/runtime-modules/revisions/controller/definition.d.ts +5 -0
- package/plugins/runtime-modules/revisions/controller/definition.js +10 -0
- package/plugins/runtime-modules/revisions/controller/draft-context-target.d.ts +25 -0
- package/plugins/runtime-modules/revisions/controller/draft-context-target.js +33 -0
- package/plugins/runtime-modules/revisions/forms.js +1 -1
- package/plugins/runtime-modules/revisions/page-ids.d.ts +1 -1
- package/plugins/runtime-modules/revisions/page-ids.js +4 -1
- package/plugins/runtime-modules/revisions/presets.d.ts +4 -0
- package/plugins/runtime-modules/revisions/services/options.js +14 -4
- package/plugins/runtime-modules/revisions/services/table.js +54 -25
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +79 -4
- package/plugins/runtime-modules/search/widgets/search-results/client.js +4 -2
- package/plugins/runtime-modules/theme/controller/runtime.js +14 -2
- package/plugins/runtime-modules/theme/presets.d.ts +4 -0
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +105 -7
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.d.ts +3 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +2 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +19 -7
- package/plugins/runtime-modules/threads/client-data-providers.js +10 -0
- package/plugins/runtime-modules/threads/controller/client.js +62 -2
- package/plugins/runtime-modules/threads/controller/definition.js +49 -1
- package/plugins/runtime-modules/threads/data-providers.d.ts +100 -2
- package/plugins/runtime-modules/threads/data-providers.js +96 -0
- package/plugins/runtime-modules/threads/definition.d.ts +100 -2
- package/plugins/runtime-modules/threads/definition.js +1 -1
- package/plugins/runtime-modules/threads/ids.d.ts +4 -0
- package/plugins/runtime-modules/threads/ids.js +5 -0
- package/plugins/runtime-modules/threads/services/customer-file-addresses.d.ts +30 -0
- package/plugins/runtime-modules/threads/services/customer-file-addresses.js +59 -0
- package/plugins/runtime-modules/threads/services/customer-file-read.d.ts +22 -0
- package/plugins/runtime-modules/threads/services/customer-file-read.js +101 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.d.ts +126 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.js +79 -0
- package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +5 -3
- package/plugins/runtime-modules/user-management/client-data-providers.js +5 -0
- package/plugins/runtime-modules/user-management/data-providers.d.ts +159 -0
- package/plugins/runtime-modules/user-management/data-providers.js +101 -3
- package/plugins/runtime-modules/user-management/definition.d.ts +159 -0
- package/plugins/runtime-modules/user-management/ids.d.ts +9 -0
- package/plugins/runtime-modules/user-management/ids.js +9 -0
- package/plugins/runtime-modules/user-management/presets.js +17 -1
- package/plugins/runtime-modules/user-management/services/users-access-table.d.ts +378 -0
- package/plugins/runtime-modules/user-management/services/users-access-table.js +132 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.d.ts +90 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +122 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.d.ts +20 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js +181 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +24 -18
- package/server-helpers/cms-page-record.d.ts +9 -1
- package/server-helpers/cms-page-record.js +11 -1
- package/server-helpers/cms-request.js +8 -5
- package/server-helpers/link-preview-image.d.ts +30 -0
- package/server-helpers/link-preview-image.js +57 -0
- package/server-helpers/runtime.js +0 -1
- package/server-helpers/search-text.js +3 -0
- package/server-helpers.d.ts +1 -1
- package/server-helpers.js +1 -1
- package/styles/controls.css +4 -2
- package/styles/layout.css +7 -0
- package/styles/shell.css +30 -6
- package/theme/phi-antd-token-resolver.d.ts +8 -0
- package/theme/phi-antd-token-resolver.js +10 -0
- package/theme/phi-theme-color.d.ts +19 -0
- package/theme/phi-theme-color.js +42 -0
- package/theme/phi-theme-composition.js +9 -0
- package/theme/phi-theme-gradients.js +4 -22
- package/theme/phi-theme-inverse-ground.d.ts +39 -0
- package/theme/phi-theme-inverse-ground.js +103 -0
- package/theme/phi-theme-palette-defaults.d.ts +16 -0
- package/theme/phi-theme-palette-defaults.js +103 -0
- package/theme/phi-theme-tokens.d.ts +2 -1
- package/theme/phi-theme-tokens.js +2 -0
- package/types/cms-module-descriptors.d.ts +14 -0
- package/types/cms-overlay.d.ts +13 -6
- package/types/cms-overlay.js +6 -22
- package/types/cms-plugins.d.ts +20 -3
- package/types/cms.d.ts +10 -0
- package/types/collection-provider.d.ts +27 -0
- package/types/collection-signal-values.d.ts +2 -0
- package/types/collection-signal-values.js +23 -0
- package/types/collection-view-widget.d.ts +9 -0
- package/types/core-widget-placements.d.ts +9 -3
- package/types/link-preview.d.ts +19 -0
- package/types/link-preview.js +19 -0
- package/types/record-provider.d.ts +22 -1
- package/types/signals.d.ts +2 -0
- package/types/signals.js +2 -0
- package/types/site-theme.d.ts +27 -0
- package/types/table-embed.d.ts +48 -0
- package/types/table-embed.js +1 -0
- package/types/table-widget.d.ts +29 -1
- package/types/table-widget.js +0 -282
- package/types/tree-widget.d.ts +0 -1
- package/types/tree-widget.js +0 -60
- package/types/widget-runtime.d.ts +3 -1
- package/types.d.ts +2 -1
- package/types.js +1 -1
- /package/{plugins/runtime-modules/threads/controller/address.d.ts → constants/threads-controller-address.d.ts} +0 -0
|
@@ -2,7 +2,7 @@ import "server-only";
|
|
|
2
2
|
import type { PhiBlockRuntime } from "../types";
|
|
3
3
|
import type { PhiCmsRoutePresetBinding } from "../types/cms-module-descriptors";
|
|
4
4
|
import type { PhiRuntimeModuleCatalog, PhiRuntimeModuleId } from "../types/cms-plugins";
|
|
5
|
-
import type { PhiPageRecordBinding } from "../types/record-provider";
|
|
5
|
+
import type { PhiPageRecordBinding, PhiRecordPicture } from "../types/record-provider";
|
|
6
6
|
/**
|
|
7
7
|
* The record a route's Page is about, read before anything is drawn (MODULES.md, "The fields of a record,
|
|
8
8
|
* and the record a Page is about").
|
|
@@ -17,6 +17,14 @@ export type PhiCmsPageRecord = {
|
|
|
17
17
|
binding: PhiPageRecordBinding;
|
|
18
18
|
title: string | null;
|
|
19
19
|
description: string | null;
|
|
20
|
+
/** What a link to the Page shows of the record, from the fields its Provider marks (`record.share`). */
|
|
21
|
+
preview: PhiCmsPageRecordPreview;
|
|
22
|
+
};
|
|
23
|
+
/** The record's own answer for a link preview; each `null` where the Provider marks no field or the record lacks it. */
|
|
24
|
+
export type PhiCmsPageRecordPreview = {
|
|
25
|
+
title: string | null;
|
|
26
|
+
description: string | null;
|
|
27
|
+
image: PhiRecordPicture | null;
|
|
20
28
|
};
|
|
21
29
|
export declare function resolvePhiCmsPageRecord({ binding, runtime, runtimeModuleCatalog, activeModuleIds }: {
|
|
22
30
|
binding: PhiCmsRoutePresetBinding;
|
|
@@ -48,5 +48,15 @@ export async function resolvePhiCmsPageRecord({ binding, runtime, runtimeModuleC
|
|
|
48
48
|
...(declaration.titleField ? { titleField: declaration.titleField } : {}),
|
|
49
49
|
...(declaration.descriptionField ? { descriptionField: declaration.descriptionField } : {}),
|
|
50
50
|
};
|
|
51
|
-
return {
|
|
51
|
+
return {
|
|
52
|
+
status: "ok",
|
|
53
|
+
binding: pageBinding,
|
|
54
|
+
title: text(declaration.titleField),
|
|
55
|
+
description: text(declaration.descriptionField),
|
|
56
|
+
preview: {
|
|
57
|
+
title: text(declared.share?.titleField),
|
|
58
|
+
description: text(declared.share?.descriptionField),
|
|
59
|
+
image: readPhiPageRecordField(fields, declared.share?.imageField, ["picture"])?.value ?? null,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
52
62
|
}
|
|
@@ -45,8 +45,8 @@ async function instantiatePhiRoutePresetPage({ binding, requestedPath, areaMask,
|
|
|
45
45
|
path: requestedPath,
|
|
46
46
|
runtime,
|
|
47
47
|
loadModuleMedia: createPhiModuleMediaLoader(runtime.site.key),
|
|
48
|
-
// The route's title
|
|
49
|
-
|
|
48
|
+
// The route's title and description are the owning Module's text, written in that Module's language.
|
|
49
|
+
translateRouteText: (source) => trForLocale(runtime.locale.current, source, 0, 0, "text", catalog.sourceLocaleByModuleId.get(binding.descriptor.ownerModuleId)),
|
|
50
50
|
}), { runtimeModuleCatalog, siteKey: runtime.site.key, locale: runtime.locale.current }),
|
|
51
51
|
};
|
|
52
52
|
}
|
|
@@ -209,11 +209,13 @@ function mapResolvedPageToRequestedContext(pagePayload, areaMask, path) {
|
|
|
209
209
|
}
|
|
210
210
|
/** The record's own title and description on the Page; `msgId: 0`, because they are no Site message. */
|
|
211
211
|
function applyPhiPageRecordMeta(pagePayload, record) {
|
|
212
|
-
if (!record.title && !record.description) {
|
|
213
|
-
return pagePayload;
|
|
214
|
-
}
|
|
215
212
|
const field = (value) => ({ msgId: 0, source: value, value });
|
|
216
213
|
const pageMeta = pagePayload.page.pageMeta;
|
|
214
|
+
const { preview } = record;
|
|
215
|
+
const hasPreview = preview.title !== null || preview.description !== null || preview.image !== null;
|
|
216
|
+
if (!record.title && !record.description && !hasPreview) {
|
|
217
|
+
return pagePayload;
|
|
218
|
+
}
|
|
217
219
|
return {
|
|
218
220
|
...pagePayload,
|
|
219
221
|
page: {
|
|
@@ -221,6 +223,7 @@ function applyPhiPageRecordMeta(pagePayload, record) {
|
|
|
221
223
|
pageMeta: {
|
|
222
224
|
title: record.title ? field(record.title) : pageMeta?.title ?? null,
|
|
223
225
|
description: record.description ? field(record.description) : pageMeta?.description ?? null,
|
|
226
|
+
...(hasPreview ? { preview } : {}),
|
|
224
227
|
},
|
|
225
228
|
},
|
|
226
229
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import type { PhiLinkPreviewImage } from "../helpers/phi-metadata";
|
|
3
|
+
import type { PhiShareImage } from "../types/link-preview";
|
|
4
|
+
/**
|
|
5
|
+
* The Asset a record picture's address delivers, or `null` where it is no Media address of this Site.
|
|
6
|
+
*
|
|
7
|
+
* A record names its picture by address (`PhiRecordPicture.src`), Site-relative or absolute; a preview
|
|
8
|
+
* picture has to be an Asset, because only an Asset has a share variant and a delivery policy to ask.
|
|
9
|
+
* An absolute address counts only on the Site's own public base.
|
|
10
|
+
*/
|
|
11
|
+
export declare function readPhiMediaDeliveryAssetId(src: string, publicBase: string | null): number | null;
|
|
12
|
+
/**
|
|
13
|
+
* The picture a link preview shows: the first candidate that is a publicly delivered image of the Site
|
|
14
|
+
* Space, as its share variant (1200 x 630, `PhiImageAssetVariantKey.Share`).
|
|
15
|
+
*
|
|
16
|
+
* The candidates come in the order the Page answers -- the record's picture, the Page's own setting, the
|
|
17
|
+
* Theme's -- and are asked about in one request, the reference projection every render resolves Assets
|
|
18
|
+
* through, which answers only what a visitor may be served: an Asset that is not public, not ready, of
|
|
19
|
+
* another Space or no image is not there, and the next candidate stands. None is no picture, and so is a
|
|
20
|
+
* Site without a public base, which cannot name an absolute address.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolvePhiLinkPreviewImage({ apiBaseUrl, internalToken, siteKey, publicBase, candidates, fallbackAlt, }: {
|
|
23
|
+
apiBaseUrl: string;
|
|
24
|
+
internalToken: string;
|
|
25
|
+
siteKey: string;
|
|
26
|
+
publicBase: string | null;
|
|
27
|
+
candidates: readonly (PhiShareImage | null)[];
|
|
28
|
+
/** What the picture says where neither the candidate nor the Asset says anything: the preview's title. */
|
|
29
|
+
fallbackAlt: string;
|
|
30
|
+
}): Promise<PhiLinkPreviewImage | null>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import { PhiImageAssetVariantKey, PhiMediaKind, buildPhiImageAssetVariantDeliveryUrl, resolvePhiImageAssetVariantSpec, } from "../constants/media";
|
|
3
|
+
import { resolveSiteInternalReferences } from "../gateway/internal-references";
|
|
4
|
+
/** A Media delivery address of the Site: `/api/site/media/<id>/content` or one of its variants. */
|
|
5
|
+
const PHI_MEDIA_DELIVERY_PATH = /^\/api\/site\/media\/(\d+)\/(?:content|variants\/\d+)(?:[?#].*)?$/u;
|
|
6
|
+
/**
|
|
7
|
+
* The Asset a record picture's address delivers, or `null` where it is no Media address of this Site.
|
|
8
|
+
*
|
|
9
|
+
* A record names its picture by address (`PhiRecordPicture.src`), Site-relative or absolute; a preview
|
|
10
|
+
* picture has to be an Asset, because only an Asset has a share variant and a delivery policy to ask.
|
|
11
|
+
* An absolute address counts only on the Site's own public base.
|
|
12
|
+
*/
|
|
13
|
+
export function readPhiMediaDeliveryAssetId(src, publicBase) {
|
|
14
|
+
const trimmed = src.trim();
|
|
15
|
+
const path = publicBase && trimmed.startsWith(`${publicBase}/`) ? trimmed.slice(publicBase.length) : trimmed;
|
|
16
|
+
const match = PHI_MEDIA_DELIVERY_PATH.exec(path);
|
|
17
|
+
const id = match ? Number(match[1]) : NaN;
|
|
18
|
+
return Number.isSafeInteger(id) && id > 0 ? id : null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The picture a link preview shows: the first candidate that is a publicly delivered image of the Site
|
|
22
|
+
* Space, as its share variant (1200 x 630, `PhiImageAssetVariantKey.Share`).
|
|
23
|
+
*
|
|
24
|
+
* The candidates come in the order the Page answers -- the record's picture, the Page's own setting, the
|
|
25
|
+
* Theme's -- and are asked about in one request, the reference projection every render resolves Assets
|
|
26
|
+
* through, which answers only what a visitor may be served: an Asset that is not public, not ready, of
|
|
27
|
+
* another Space or no image is not there, and the next candidate stands. None is no picture, and so is a
|
|
28
|
+
* Site without a public base, which cannot name an absolute address.
|
|
29
|
+
*/
|
|
30
|
+
export async function resolvePhiLinkPreviewImage({ apiBaseUrl, internalToken, siteKey, publicBase, candidates, fallbackAlt, }) {
|
|
31
|
+
const stated = candidates.filter((candidate) => candidate !== null);
|
|
32
|
+
const spec = resolvePhiImageAssetVariantSpec(PhiImageAssetVariantKey.Share);
|
|
33
|
+
if (!publicBase || stated.length === 0 || !spec)
|
|
34
|
+
return null;
|
|
35
|
+
const { assets } = await resolveSiteInternalReferences({
|
|
36
|
+
apiBaseUrl,
|
|
37
|
+
internalToken,
|
|
38
|
+
siteKey,
|
|
39
|
+
assetIds: stated.map((candidate) => candidate.assetId),
|
|
40
|
+
});
|
|
41
|
+
for (const candidate of stated) {
|
|
42
|
+
const asset = assets.get(candidate.assetId);
|
|
43
|
+
if (!asset || asset.kind !== PhiMediaKind.Image)
|
|
44
|
+
continue;
|
|
45
|
+
const path = buildPhiImageAssetVariantDeliveryUrl(asset.id, PhiImageAssetVariantKey.Share, asset.variantVersion, asset.deliveryRevision);
|
|
46
|
+
if (!path)
|
|
47
|
+
continue;
|
|
48
|
+
return {
|
|
49
|
+
url: `${publicBase}${path}`,
|
|
50
|
+
width: spec.width,
|
|
51
|
+
height: spec.height,
|
|
52
|
+
alt: candidate.alt?.trim() || asset.altText?.trim() || asset.title?.trim() || fallbackAlt,
|
|
53
|
+
type: spec.format === "jpeg" ? "image/jpeg" : "image/webp",
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
@@ -156,7 +156,6 @@ async function getPhiCmsRuntimeInfo({ apiBaseUrl, internalToken, siteKey, cookie
|
|
|
156
156
|
(payload.user?.authorizationRevision ?? 0) >= 0
|
|
157
157
|
? payload.user?.authorizationRevision
|
|
158
158
|
: 0,
|
|
159
|
-
newsletterOptIn: payload.user?.newsletterOptIn ?? null,
|
|
160
159
|
themeMode: viewerThemeMode,
|
|
161
160
|
userName: payload.user?.name ?? null,
|
|
162
161
|
userEmail: payload.user?.email ?? null,
|
package/server-helpers.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { tr, trGlobal, trForLocale, trGlobalForLocale, trBulk, trBulkForLocale, trGlobalBulk, trGlobalBulkForLocale, PHI_TR_CTX_WEB_UI_LABEL, } from "./server-helpers/translate";
|
|
2
2
|
export { phiRuntime } from "./server-helpers/phi-runtime";
|
|
3
|
-
export { definePhiLabelSet, definePhiMessageLabel, definePhiRuntimeModuleLabelSet, getPhiLabelSet, type PhiLabelSetDefinition, type PhiLabelSetEntry, type PhiLabelSetLabels, type PhiLabelSetTexts, } from "./gateway/label-set";
|
|
3
|
+
export { definePhiCountLabel, definePhiLabelSet, definePhiMessageLabel, definePhiRuntimeModuleLabelSet, getPhiLabelSet, type PhiLabelSetCountEntry, type PhiLabelSetDefinition, type PhiLabelSetEntry, type PhiLabelSetLabels, type PhiLabelSetTexts, } from "./gateway/label-set";
|
|
4
4
|
export type { PhiGlobalTranslatorOptions } from "./gateway/tr";
|
|
5
5
|
export { readPhiServerApiCredentials } from "./helpers/phis-server-credentials";
|
|
6
6
|
export type { PhiServerApiCredentials } from "./helpers/phis-server-credentials";
|
package/server-helpers.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { tr, trGlobal, trForLocale, trGlobalForLocale, trBulk, trBulkForLocale, trGlobalBulk, trGlobalBulkForLocale, PHI_TR_CTX_WEB_UI_LABEL, } from "./server-helpers/translate";
|
|
2
2
|
export { phiRuntime } from "./server-helpers/phi-runtime";
|
|
3
|
-
export { definePhiLabelSet, definePhiMessageLabel, definePhiRuntimeModuleLabelSet, getPhiLabelSet, } from "./gateway/label-set";
|
|
3
|
+
export { definePhiCountLabel, definePhiLabelSet, definePhiMessageLabel, definePhiRuntimeModuleLabelSet, getPhiLabelSet, } from "./gateway/label-set";
|
|
4
4
|
/*
|
|
5
5
|
* The Site's own address for this server, for code that runs outside a request.
|
|
6
6
|
*
|
package/styles/controls.css
CHANGED
|
@@ -594,9 +594,11 @@ h5.phi-typography, .phi-typography h5 {
|
|
|
594
594
|
* Not while the table is empty. With no rows Ant Design has measured nothing and leaves the header's
|
|
595
595
|
* `<colgroup>` without widths, so fixed layout took them from the header cells instead: every `content`
|
|
596
596
|
* column got its 1% -- a dozen pixels, its title cut to one letter -- and the `fill` column the rest.
|
|
597
|
-
* Without rows there is nothing to line up with, and `auto` gives each title its own width.
|
|
597
|
+
* Without rows there is nothing to line up with, and `auto` gives each title its own width. The same
|
|
598
|
+
* holds while the skeleton rows stand in for the rows (`--loading`): Ant Design measures no column of
|
|
599
|
+
* them either, and the header kept one title of a dozen.
|
|
598
600
|
*/
|
|
599
|
-
.phi-table-control.phi-table-control--sticky-header:not(.phi-table-control--empty) [class~="ant-table-sticky-holder"] > table {
|
|
601
|
+
.phi-table-control.phi-table-control--sticky-header:not(.phi-table-control--empty):not(.phi-table-control--loading) [class~="ant-table-sticky-holder"] > table {
|
|
600
602
|
table-layout: fixed !important;
|
|
601
603
|
}
|
|
602
604
|
|
package/styles/layout.css
CHANGED
|
@@ -353,11 +353,18 @@
|
|
|
353
353
|
min-width: 0;
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
+
/*
|
|
357
|
+
* A label breaks inside a word rather than run past its cell. The cell keeps to its tracks (`min-width:
|
|
358
|
+
* 0`), but the label's words are a flex item of their own, which is never narrower than its longest
|
|
359
|
+
* word: in the label column of a one-column dialog -- a third of 377px -- "Type the Area key to
|
|
360
|
+
* confirm" left the input a few pixels, and a longer word of a translation ran under the input.
|
|
361
|
+
*/
|
|
356
362
|
.phi-form-cell--label {
|
|
357
363
|
display: flex;
|
|
358
364
|
align-items: center;
|
|
359
365
|
min-height: var(--phi-form-label-slot-height-compact);
|
|
360
366
|
padding-inline-end: var(--phi-form-label-pad-compact);
|
|
367
|
+
overflow-wrap: anywhere;
|
|
361
368
|
}
|
|
362
369
|
|
|
363
370
|
.phi-form-cell--control {
|
package/styles/shell.css
CHANGED
|
@@ -352,13 +352,11 @@
|
|
|
352
352
|
|
|
353
353
|
/* The Overlay in a tone's mode (LAYOUTING.md "Surface tone"), for a box whose Background is the Theme's
|
|
354
354
|
(`PHI_BACKGROUND_THEME_STYLE`). The tone's class publishes the Overlay of the mode it asks for, so the
|
|
355
|
-
box -- and an untoned box inside it -- reads that mode's variables
|
|
356
|
-
mode, as the tone scope reads it, and turns with the mode switch. Inside the Root Layout only: a Modal
|
|
355
|
+
box -- and an untoned box inside it -- reads that mode's variables. Inside the Root Layout only: a Modal
|
|
357
356
|
or Drawer portalled to `<body>` has no Overlay published, and its box falls back to the container
|
|
358
357
|
ground of the tone's mode. The Root Layout's own values above stay what the Chrome Regions and panes
|
|
359
358
|
read; those are computed on the Root Layout and inherited, so a tone below cannot touch them. */
|
|
360
|
-
:where([data-phi-root-layout="true"]) :where(.phi-tone-light)
|
|
361
|
-
:where([data-phi-root-layout="true"][data-phi-theme-mode="dark"]) :where(.phi-tone-inverse) {
|
|
359
|
+
:where([data-phi-root-layout="true"]) :where(.phi-tone-light) {
|
|
362
360
|
--phi-shell-chrome-image: var(--phi-shell-chrome-image-light, none);
|
|
363
361
|
--phi-shell-chrome-size: var(--phi-shell-chrome-size-light, auto);
|
|
364
362
|
--phi-shell-chrome-position: var(--phi-shell-chrome-position-light, 0 0);
|
|
@@ -367,8 +365,7 @@
|
|
|
367
365
|
--phi-shell-chrome-filter: var(--phi-shell-chrome-filter-light, none);
|
|
368
366
|
}
|
|
369
367
|
|
|
370
|
-
:where([data-phi-root-layout="true"]) :where(.phi-tone-dark)
|
|
371
|
-
:where([data-phi-root-layout="true"]:not([data-phi-theme-mode="dark"])) :where(.phi-tone-inverse) {
|
|
368
|
+
:where([data-phi-root-layout="true"]) :where(.phi-tone-dark) {
|
|
372
369
|
--phi-shell-chrome-image: var(--phi-shell-chrome-image-dark, none);
|
|
373
370
|
--phi-shell-chrome-size: var(--phi-shell-chrome-size-dark, auto);
|
|
374
371
|
--phi-shell-chrome-position: var(--phi-shell-chrome-position-dark, 0 0);
|
|
@@ -377,6 +374,33 @@
|
|
|
377
374
|
--phi-shell-chrome-filter: var(--phi-shell-chrome-filter-dark, none);
|
|
378
375
|
}
|
|
379
376
|
|
|
377
|
+
/* `inverse` stands on the Theme's Inverse Ground (THEME.md "Ground"), not on the other mode's Chrome
|
|
378
|
+
colour: the Chrome is the frame's and may be glass, and a glass pane over the page's own ground put
|
|
379
|
+
the inverted words on a ground of the page's mode. The other mode's picture -- read against the page's
|
|
380
|
+
mode, as the tone scope reads it, so it turns with the mode switch -- still lies over the ground; the
|
|
381
|
+
pane's filter does not, since an opaque box has nothing behind it to frost. */
|
|
382
|
+
:where([data-phi-root-layout="true"][data-phi-theme-mode="dark"]) :where(.phi-tone-inverse) {
|
|
383
|
+
--phi-shell-chrome-image: var(--phi-shell-chrome-image-light, none);
|
|
384
|
+
--phi-shell-chrome-size: var(--phi-shell-chrome-size-light, auto);
|
|
385
|
+
--phi-shell-chrome-position: var(--phi-shell-chrome-position-light, 0 0);
|
|
386
|
+
--phi-shell-chrome-repeat: var(--phi-shell-chrome-repeat-light, repeat);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
:where([data-phi-root-layout="true"]:not([data-phi-theme-mode="dark"])) :where(.phi-tone-inverse) {
|
|
390
|
+
--phi-shell-chrome-image: var(--phi-shell-chrome-image-dark, none);
|
|
391
|
+
--phi-shell-chrome-size: var(--phi-shell-chrome-size-dark, auto);
|
|
392
|
+
--phi-shell-chrome-position: var(--phi-shell-chrome-position-dark, 0 0);
|
|
393
|
+
--phi-shell-chrome-repeat: var(--phi-shell-chrome-repeat-dark, repeat);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/* The ground itself holds everywhere, a portalled Overlay included: `--phi-inverse-ground` is a Theme
|
|
397
|
+
token, written under the tone's class in the other mode, so it is that mode's ground wherever the box
|
|
398
|
+
stands. */
|
|
399
|
+
:where(.phi-tone-inverse) {
|
|
400
|
+
--phi-shell-chrome-color: var(--phi-inverse-ground);
|
|
401
|
+
--phi-shell-chrome-filter: none;
|
|
402
|
+
}
|
|
403
|
+
|
|
380
404
|
/* A Chrome Region carries the marker only while it authored no ground of its own, so there is nothing
|
|
381
405
|
left to fall back through here: the shared colour is the ground. It needs no light and dark pair
|
|
382
406
|
either, because the pair above has already resolved the mode. This rule follows the two that set the
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { AliasToken } from "antd/es/theme/interface";
|
|
2
2
|
import type { PhiThemeMode } from "./phi-theme-presets";
|
|
3
3
|
export declare function createPhiAntdThemeCssVarKey(scope: string, identity: unknown): string;
|
|
4
|
+
/**
|
|
5
|
+
* Ant Design's default seed for a token key, or `undefined` where the key is no seed. What a seed is put
|
|
6
|
+
* in place of when nobody states it, read here so the deep import into Ant Design's theme stays in this
|
|
7
|
+
* file.
|
|
8
|
+
*/
|
|
9
|
+
export declare function readPhiAntdDefaultSeedToken(key: string): {
|
|
10
|
+
value: unknown;
|
|
11
|
+
} | undefined;
|
|
4
12
|
export declare function resolvePhiAntdAliasTokens(mode: PhiThemeMode, token: Record<string, unknown>): AliasToken & Record<string, unknown>;
|
|
@@ -53,6 +53,16 @@ function withPhiDarkHoverSteps(seed, derived) {
|
|
|
53
53
|
...(seed.colorInfo ? { colorInfoHover: generateDarkColorPalettes(seed.colorInfo)[5] } : {}),
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Ant Design's default seed for a token key, or `undefined` where the key is no seed. What a seed is put
|
|
58
|
+
* in place of when nobody states it, read here so the deep import into Ant Design's theme stays in this
|
|
59
|
+
* file.
|
|
60
|
+
*/
|
|
61
|
+
export function readPhiAntdDefaultSeedToken(key) {
|
|
62
|
+
return Object.prototype.hasOwnProperty.call(seedToken, key)
|
|
63
|
+
? { value: seedToken[key] }
|
|
64
|
+
: undefined;
|
|
65
|
+
}
|
|
56
66
|
export function resolvePhiAntdAliasTokens(mode, token) {
|
|
57
67
|
const mergedSeedToken = {
|
|
58
68
|
...seedToken,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A colour as a palette states it, read into numbers so two spellings of one colour compare equal.
|
|
3
|
+
*
|
|
4
|
+
* A palette is written by hand, by a picker and by a Module, and each spells a colour its own way:
|
|
5
|
+
* `#1677FF` and `#1677ff`, `#fff` and `#ffffff`, `rgb(22, 119, 255)`. Comparing the strings told the
|
|
6
|
+
* Theme workspace that a colour the author had not changed was theirs.
|
|
7
|
+
*/
|
|
8
|
+
export type PhiThemeRgba = {
|
|
9
|
+
r: number;
|
|
10
|
+
g: number;
|
|
11
|
+
b: number;
|
|
12
|
+
a: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function parsePhiThemeColor(value: string): PhiThemeRgba | null;
|
|
15
|
+
/**
|
|
16
|
+
* Whether two values name the same colour: the same channels to the unit and the same alpha to the step
|
|
17
|
+
* an eight-digit hex can say. What does not read as a colour compares as text.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isSamePhiThemeColor(left: unknown, right: unknown): boolean;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A colour as a palette states it, read into numbers so two spellings of one colour compare equal.
|
|
3
|
+
*
|
|
4
|
+
* A palette is written by hand, by a picker and by a Module, and each spells a colour its own way:
|
|
5
|
+
* `#1677FF` and `#1677ff`, `#fff` and `#ffffff`, `rgb(22, 119, 255)`. Comparing the strings told the
|
|
6
|
+
* Theme workspace that a colour the author had not changed was theirs.
|
|
7
|
+
*/
|
|
8
|
+
/* Enough of CSS colour for what a palette states: hex in its four lengths and `rgb()`/`rgba()`. */
|
|
9
|
+
export function parsePhiThemeColor(value) {
|
|
10
|
+
const text = value.trim().toLowerCase();
|
|
11
|
+
const hex = /^#([0-9a-f]{3,8})$/.exec(text)?.[1];
|
|
12
|
+
if (hex) {
|
|
13
|
+
const full = hex.length <= 4 ? [...hex].map((digit) => digit + digit).join("") : hex;
|
|
14
|
+
return {
|
|
15
|
+
r: Number.parseInt(full.slice(0, 2), 16),
|
|
16
|
+
g: Number.parseInt(full.slice(2, 4), 16),
|
|
17
|
+
b: Number.parseInt(full.slice(4, 6), 16),
|
|
18
|
+
a: full.length >= 8 ? Number.parseInt(full.slice(6, 8), 16) / 255 : 1,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const rgb = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+)(%?))?/.exec(text);
|
|
22
|
+
if (!rgb)
|
|
23
|
+
return null;
|
|
24
|
+
const alpha = rgb[4] == null ? 1 : Number(rgb[4]) / (rgb[5] ? 100 : 1);
|
|
25
|
+
return { r: Number(rgb[1]), g: Number(rgb[2]), b: Number(rgb[3]), a: Math.min(1, Math.max(0, alpha)) };
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Whether two values name the same colour: the same channels to the unit and the same alpha to the step
|
|
29
|
+
* an eight-digit hex can say. What does not read as a colour compares as text.
|
|
30
|
+
*/
|
|
31
|
+
export function isSamePhiThemeColor(left, right) {
|
|
32
|
+
if (typeof left !== "string" || typeof right !== "string")
|
|
33
|
+
return left === right;
|
|
34
|
+
const first = parsePhiThemeColor(left);
|
|
35
|
+
const second = parsePhiThemeColor(right);
|
|
36
|
+
if (!first || !second)
|
|
37
|
+
return left.trim().toLowerCase() === right.trim().toLowerCase();
|
|
38
|
+
return Math.round(first.r) === Math.round(second.r)
|
|
39
|
+
&& Math.round(first.g) === Math.round(second.g)
|
|
40
|
+
&& Math.round(first.b) === Math.round(second.b)
|
|
41
|
+
&& Math.abs(first.a - second.a) < 0.5 / 255;
|
|
42
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PHI_CORE_THEME_FONTS_BLOCKS, PHI_CORE_THEME_FONTS_BLOCK_KEY, PHI_CORE_THEME_GROUND_BLOCKS, PHI_CORE_THEME_GROUND_BLOCK_KEY, PHI_CORE_THEME_PALETTE_BLOCKS, PHI_CORE_THEME_PALETTE_BLOCK_KEY, PHI_CORE_THEME_SETS, PHI_CORE_THEME_STYLE_BLOCKS, PHI_CORE_THEME_STYLE_BLOCK_KEY, resolvePhiThemeBlockSelection, resolvePhiThemeSetSelection, } from "./phi-theme-blocks";
|
|
2
2
|
import { readPhiThemeSiteSignet } from "./phi-theme-signet";
|
|
3
|
+
import { readPhiThemeInverseGround } from "./phi-theme-inverse-ground";
|
|
3
4
|
export const PHI_CORE_THEME_BLOCK_CATALOG = {
|
|
4
5
|
palettes: PHI_CORE_THEME_PALETTE_BLOCKS,
|
|
5
6
|
styles: PHI_CORE_THEME_STYLE_BLOCKS,
|
|
@@ -128,10 +129,18 @@ export function resolvePhiThemeEffectiveRoot(authored, ground) {
|
|
|
128
129
|
dark: authored?.chrome?.dark ?? base.chrome?.dark ?? null,
|
|
129
130
|
...(shadow.header || shadow.sider || shadow.footer ? { shadow } : {}),
|
|
130
131
|
};
|
|
132
|
+
// Read strictly: a stored Inverse Ground of the wrong shape is an error, not a ground quietly dropped.
|
|
133
|
+
const authoredInverse = readPhiThemeInverseGround(authored?.inverse);
|
|
134
|
+
const baseInverse = readPhiThemeInverseGround(base.inverse);
|
|
135
|
+
const inverse = {
|
|
136
|
+
light: authoredInverse?.light ?? baseInverse?.light ?? null,
|
|
137
|
+
dark: authoredInverse?.dark ?? baseInverse?.dark ?? null,
|
|
138
|
+
};
|
|
131
139
|
return {
|
|
132
140
|
...base,
|
|
133
141
|
...(authored ?? {}),
|
|
134
142
|
background,
|
|
135
143
|
chrome,
|
|
144
|
+
inverse,
|
|
136
145
|
};
|
|
137
146
|
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* Theme workspace's preview writes the draft's, so a control that reads the property is in the right mode
|
|
14
14
|
* wherever it stands without asking which one that is.
|
|
15
15
|
*/
|
|
16
|
+
import { parsePhiThemeColor } from "./phi-theme-color";
|
|
16
17
|
export const PHI_THEME_GRADIENT_KEYS = ["gradient1", "gradient2", "gradient3"];
|
|
17
18
|
export const PHI_THEME_GRADIENT_TEXT_TONES = ["light", "dark"];
|
|
18
19
|
function isPhiThemeGradientKey(value) {
|
|
@@ -84,25 +85,6 @@ const PHI_PRIMARY_BUTTON_GRADIENT_TOKENS = {
|
|
|
84
85
|
/** A run a little lighter under the pointer, a little darker while it is pressed. */
|
|
85
86
|
export const PHI_GRADIENT_HOVER_FILTER = "brightness(1.18) saturate(1.15)";
|
|
86
87
|
const PHI_GRADIENT_ACTIVE_FILTER = "brightness(0.88)";
|
|
87
|
-
/* Enough of CSS colour for what a palette states: hex in its four lengths and `rgb()`/`rgba()`. */
|
|
88
|
-
function parseColor(value) {
|
|
89
|
-
const text = value.trim().toLowerCase();
|
|
90
|
-
const hex = /^#([0-9a-f]{3,8})$/.exec(text)?.[1];
|
|
91
|
-
if (hex) {
|
|
92
|
-
const full = hex.length <= 4 ? [...hex].map((digit) => digit + digit).join("") : hex;
|
|
93
|
-
return {
|
|
94
|
-
r: Number.parseInt(full.slice(0, 2), 16),
|
|
95
|
-
g: Number.parseInt(full.slice(2, 4), 16),
|
|
96
|
-
b: Number.parseInt(full.slice(4, 6), 16),
|
|
97
|
-
a: full.length >= 8 ? Number.parseInt(full.slice(6, 8), 16) / 255 : 1,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
const rgb = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+)(%?))?/.exec(text);
|
|
101
|
-
if (!rgb)
|
|
102
|
-
return null;
|
|
103
|
-
const alpha = rgb[4] == null ? 1 : Number(rgb[4]) / (rgb[5] ? 100 : 1);
|
|
104
|
-
return { r: Number(rgb[1]), g: Number(rgb[2]), b: Number(rgb[3]), a: Math.min(1, Math.max(0, alpha)) };
|
|
105
|
-
}
|
|
106
88
|
/** A translucent text colour as it lands on its ground: the near-black `0.88` text is not black. */
|
|
107
89
|
function composite(top, ground) {
|
|
108
90
|
const mix = (front, back) => front * top.a + back * (1 - top.a);
|
|
@@ -133,7 +115,7 @@ export function resolvePhiThemeGradientInks(token) {
|
|
|
133
115
|
const light = tokenColor(token, "colorTextLightSolid", PHI_GRADIENT_LIGHT_TEXT);
|
|
134
116
|
const candidates = [tokenColor(token, "colorText", PHI_GRADIENT_DARK_TEXT), tokenColor(token, "colorBgBase", PHI_GRADIENT_DARK_TEXT)];
|
|
135
117
|
const darkness = (colour) => {
|
|
136
|
-
const parsed =
|
|
118
|
+
const parsed = parsePhiThemeColor(colour);
|
|
137
119
|
return parsed ? relativeLuminance(composite(parsed, { r: 255, g: 255, b: 255 })) : Number.POSITIVE_INFINITY;
|
|
138
120
|
};
|
|
139
121
|
const dark = candidates.reduce((darkest, next) => (darkness(next) < darkness(darkest) ? next : darkest));
|
|
@@ -146,12 +128,12 @@ export function resolvePhiThemeGradientInks(token) {
|
|
|
146
128
|
* (`hsl()`, a variable): the Theme workspace then says nothing rather than something wrong.
|
|
147
129
|
*/
|
|
148
130
|
export function resolvePhiThemeGradientContrast(gradient, text) {
|
|
149
|
-
const words =
|
|
131
|
+
const words = parsePhiThemeColor(text);
|
|
150
132
|
if (!words)
|
|
151
133
|
return null;
|
|
152
134
|
let worst = null;
|
|
153
135
|
for (const [stopIndex, stop] of gradient.stops.entries()) {
|
|
154
|
-
const ground =
|
|
136
|
+
const ground = parsePhiThemeColor(stop.color);
|
|
155
137
|
if (!ground)
|
|
156
138
|
return null;
|
|
157
139
|
for (const hover of [false, true]) {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { PhiSiteThemeInverseGround } from "../types/site-theme";
|
|
2
|
+
import type { PhiThemeMode } from "./phi-theme-presets";
|
|
3
|
+
/**
|
|
4
|
+
* The Inverse Ground (THEME.md "Ground"): what a Surface toned `inverse` stands on.
|
|
5
|
+
*
|
|
6
|
+
* An inverse box is drawn in the other mode than the page's (LAYOUTING.md "Surface tone"). It used to
|
|
7
|
+
* stand on that mode's Chrome Overlay where it took the Theme's ground, and the Chrome is the frame's: a
|
|
8
|
+
* glass frame -- phis.dev's is 55 % white or ink -- gave the inverted words the page's own ground beneath
|
|
9
|
+
* a thin pane, light text on a light page. So the Theme states, per mode, one opaque colour an inverse box
|
|
10
|
+
* stands on, and a mode that states none stands on that mode's container ground (`colorBgContainer`), the
|
|
11
|
+
* ground an inverse box without a Background of its own always painted.
|
|
12
|
+
*
|
|
13
|
+
* It rides as a token of this package's own (`inverseGround`), so Ant Design writes it as
|
|
14
|
+
* `--phi-inverse-ground` per mode and per Surface tone like every other token: inside an inverse box the
|
|
15
|
+
* tone's class carries the other mode's tokens, and the variable there is that mode's ground.
|
|
16
|
+
*/
|
|
17
|
+
/** What an inverse box paints as its ground, as the variable the stylesheet and every resolver read. */
|
|
18
|
+
export declare const PHI_INVERSE_GROUND = "var(--phi-inverse-ground)";
|
|
19
|
+
/**
|
|
20
|
+
* Whether a CSS colour is a stated, opaque value: a hex colour or a colour function with no alpha below
|
|
21
|
+
* one. A name, a variable or anything the server cannot read as a colour is not: an unreadable value
|
|
22
|
+
* would make the box's ground fall away in the browser, which is the very thing this ground exists to
|
|
23
|
+
* prevent.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isPhiOpaqueCssColor(value: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The stored Inverse Ground, read strictly: absent is none stated; anything else must be a record of the
|
|
28
|
+
* two modes, each absent or an opaque colour. A wrong shape is an error, not a ground quietly dropped.
|
|
29
|
+
*/
|
|
30
|
+
export declare function readPhiThemeInverseGround(value: unknown): PhiSiteThemeInverseGround | null;
|
|
31
|
+
/**
|
|
32
|
+
* The ground an inverse box in `mode` stands on: the Theme's stated colour, else the mode's own container
|
|
33
|
+
* ground. `token` is the mode's resolved Ant Design tokens, which every Theme has.
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolvePhiThemeInverseGround(inverse: PhiSiteThemeInverseGround | null | undefined, mode: PhiThemeMode, token: Record<string, unknown>): string;
|
|
36
|
+
/** The token one mode writes (`--phi-inverse-ground`). */
|
|
37
|
+
export declare function buildPhiThemeInverseGroundTokens(inverse: PhiSiteThemeInverseGround | null | undefined, mode: PhiThemeMode, token: Record<string, unknown>): {
|
|
38
|
+
inverseGround: string;
|
|
39
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { isPhiRecord } from "../helpers/is-record";
|
|
2
|
+
/**
|
|
3
|
+
* The Inverse Ground (THEME.md "Ground"): what a Surface toned `inverse` stands on.
|
|
4
|
+
*
|
|
5
|
+
* An inverse box is drawn in the other mode than the page's (LAYOUTING.md "Surface tone"). It used to
|
|
6
|
+
* stand on that mode's Chrome Overlay where it took the Theme's ground, and the Chrome is the frame's: a
|
|
7
|
+
* glass frame -- phis.dev's is 55 % white or ink -- gave the inverted words the page's own ground beneath
|
|
8
|
+
* a thin pane, light text on a light page. So the Theme states, per mode, one opaque colour an inverse box
|
|
9
|
+
* stands on, and a mode that states none stands on that mode's container ground (`colorBgContainer`), the
|
|
10
|
+
* ground an inverse box without a Background of its own always painted.
|
|
11
|
+
*
|
|
12
|
+
* It rides as a token of this package's own (`inverseGround`), so Ant Design writes it as
|
|
13
|
+
* `--phi-inverse-ground` per mode and per Surface tone like every other token: inside an inverse box the
|
|
14
|
+
* tone's class carries the other mode's tokens, and the variable there is that mode's ground.
|
|
15
|
+
*/
|
|
16
|
+
/** What an inverse box paints as its ground, as the variable the stylesheet and every resolver read. */
|
|
17
|
+
export const PHI_INVERSE_GROUND = "var(--phi-inverse-ground)";
|
|
18
|
+
const PHI_THEME_INVERSE_GROUND_MODES = ["light", "dark"];
|
|
19
|
+
const PHI_CSS_HEX_COLOR = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/iu;
|
|
20
|
+
const PHI_CSS_COLOR_FUNCTION = /^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\(([^()]*)\)$/iu;
|
|
21
|
+
const PHI_CSS_ALPHA = /^(\d*\.?\d+)(%?)$/u;
|
|
22
|
+
function isPhiOpaqueAlpha(alpha) {
|
|
23
|
+
const match = PHI_CSS_ALPHA.exec(alpha.trim());
|
|
24
|
+
if (!match)
|
|
25
|
+
return false;
|
|
26
|
+
const value = Number.parseFloat(match[1]);
|
|
27
|
+
return match[2] === "%" ? value >= 100 : value >= 1;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Whether a CSS colour is a stated, opaque value: a hex colour or a colour function with no alpha below
|
|
31
|
+
* one. A name, a variable or anything the server cannot read as a colour is not: an unreadable value
|
|
32
|
+
* would make the box's ground fall away in the browser, which is the very thing this ground exists to
|
|
33
|
+
* prevent.
|
|
34
|
+
*/
|
|
35
|
+
export function isPhiOpaqueCssColor(value) {
|
|
36
|
+
const color = value.trim();
|
|
37
|
+
if (PHI_CSS_HEX_COLOR.test(color)) {
|
|
38
|
+
const digits = color.slice(1);
|
|
39
|
+
if (digits.length === 4)
|
|
40
|
+
return digits[3].toLowerCase() === "f";
|
|
41
|
+
if (digits.length === 8)
|
|
42
|
+
return digits.slice(6).toLowerCase() === "ff";
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
const call = PHI_CSS_COLOR_FUNCTION.exec(color);
|
|
46
|
+
if (!call)
|
|
47
|
+
return false;
|
|
48
|
+
const args = call[1];
|
|
49
|
+
const slash = args.split("/");
|
|
50
|
+
if (slash.length > 2)
|
|
51
|
+
return false;
|
|
52
|
+
if (slash.length === 2)
|
|
53
|
+
return isPhiOpaqueAlpha(slash[1]);
|
|
54
|
+
const commas = args.split(",");
|
|
55
|
+
if (commas.length === 4)
|
|
56
|
+
return isPhiOpaqueAlpha(commas[3]);
|
|
57
|
+
return commas.length === 1 || commas.length === 3;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The stored Inverse Ground, read strictly: absent is none stated; anything else must be a record of the
|
|
61
|
+
* two modes, each absent or an opaque colour. A wrong shape is an error, not a ground quietly dropped.
|
|
62
|
+
*/
|
|
63
|
+
export function readPhiThemeInverseGround(value) {
|
|
64
|
+
if (value === undefined || value === null) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
if (!isPhiRecord(value)) {
|
|
68
|
+
throw new Error(`The Inverse Ground must state its colours per mode, got ${JSON.stringify(value)}.`);
|
|
69
|
+
}
|
|
70
|
+
const unknownKeys = Object.keys(value).filter((key) => !PHI_THEME_INVERSE_GROUND_MODES.includes(key));
|
|
71
|
+
if (unknownKeys.length > 0) {
|
|
72
|
+
throw new Error(`The Inverse Ground has unknown modes: ${unknownKeys.join(", ")}.`);
|
|
73
|
+
}
|
|
74
|
+
const ground = {};
|
|
75
|
+
for (const mode of PHI_THEME_INVERSE_GROUND_MODES) {
|
|
76
|
+
const color = value[mode];
|
|
77
|
+
if (color === undefined || color === null)
|
|
78
|
+
continue;
|
|
79
|
+
if (typeof color !== "string" || !isPhiOpaqueCssColor(color)) {
|
|
80
|
+
throw new Error(`The Inverse Ground's ${mode} colour must be an opaque CSS colour, got ${JSON.stringify(color)}.`);
|
|
81
|
+
}
|
|
82
|
+
ground[mode] = color.trim();
|
|
83
|
+
}
|
|
84
|
+
return ground;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The ground an inverse box in `mode` stands on: the Theme's stated colour, else the mode's own container
|
|
88
|
+
* ground. `token` is the mode's resolved Ant Design tokens, which every Theme has.
|
|
89
|
+
*/
|
|
90
|
+
export function resolvePhiThemeInverseGround(inverse, mode, token) {
|
|
91
|
+
const stated = readPhiThemeInverseGround(inverse)?.[mode];
|
|
92
|
+
if (stated)
|
|
93
|
+
return stated;
|
|
94
|
+
const container = token.colorBgContainer;
|
|
95
|
+
if (typeof container !== "string" || !container.trim()) {
|
|
96
|
+
throw new Error(`The resolved ${mode} Theme has no colorBgContainer to stand an inverse box on.`);
|
|
97
|
+
}
|
|
98
|
+
return container;
|
|
99
|
+
}
|
|
100
|
+
/** The token one mode writes (`--phi-inverse-ground`). */
|
|
101
|
+
export function buildPhiThemeInverseGroundTokens(inverse, mode, token) {
|
|
102
|
+
return { inverseGround: resolvePhiThemeInverseGround(inverse, mode, token) };
|
|
103
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type PhiThemePalette, type PhiThemePresetPlugin } from "./phi-theme-presets";
|
|
2
|
+
/**
|
|
3
|
+
* A Site's palette without the colours that change nothing over the palette block it follows.
|
|
4
|
+
*
|
|
5
|
+
* A palette entry is what an author decided differently from the Theme, and the Theme workspace offers
|
|
6
|
+
* to hand it back ("Reset to Theme", "Reset override"). An entry with the very colour the Theme gives
|
|
7
|
+
* anyway is no decision: the workspace showed a reset for it all the same, and every Site that saved a
|
|
8
|
+
* Module's Theme had one under every seed, because the save takes the Module's palette over
|
|
9
|
+
* (`adoptPhiThemeModulePalette`). The workspace reads ownership off this, and the save stores this, ahead
|
|
10
|
+
* of the takeover, so a Module's palette is still copied in whole and a core palette is simply followed.
|
|
11
|
+
*
|
|
12
|
+
* Entries are taken out one by one, each against what is left, so two entries that only together equal
|
|
13
|
+
* the Theme are both dropped and one that matters keeps the other where it is needed. Custom colours and
|
|
14
|
+
* gradient slots are not looked at here. `baseTokens` are the non-colour tokens the render derives with.
|
|
15
|
+
*/
|
|
16
|
+
export declare function omitPhiThemePaletteDefaults(preset: PhiThemePresetPlugin, palette: PhiThemePalette | null | undefined, baseTokens?: Record<string, unknown>): PhiThemePalette;
|