@designcrowd/library.brand-page 6.2.11 → 6.2.12
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/lib/src/{CreatedOnBrandCrowd-de-de-DDcraD5S.js → CreatedOnBrandCrowd-de-de-BtVKllNQ.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-DtOeaisf.js → CreatedOnBrandCrowd-en-us-CX5V0v8u.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-BZpmJPew.js → CreatedOnBrandCrowd-es-es-CbA02PCL.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-CqRwC4e7.js → CreatedOnBrandCrowd-fr-ca-BQAKruBF.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-CqRwC4e7.js → CreatedOnBrandCrowd-fr-fr-BQAKruBF.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-DId9Dfjh.js → CreatedOnBrandCrowd-pt-br-Yk_yzB3s.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-DId9Dfjh.js → CreatedOnBrandCrowd-pt-pt-Yk_yzB3s.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-BTDfmOcm.js → CreatedOnDcom-de-de-DJZQbPSD.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-CeAu9Ayx.js → CreatedOnDcom-en-us-BJvNAa4l.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-WCv0K41H.js → CreatedOnDcom-es-es-CUwB1FRY.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-BlfevQDY.js → CreatedOnDcom-fr-ca-CK54U4oh.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-Cvt7MHPZ.js → CreatedOnDcom-fr-fr-DuUNBGrM.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-DipZuylv.js → CreatedOnDcom-pt-br-BfODpFNV.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-BCw4lcKN.js → CreatedOnDcom-pt-pt-Cf6u2GCg.js} +1 -1
- package/lib/src/brand-page/__fixtures__/production-text-style-resolver.fixture.d.ts +16 -0
- package/lib/src/brand-page/__fixtures__/production-text-style-resolver.fixture.js +35 -0
- package/lib/src/brand-page/components/contact-form/ContactForm.mixin.d.ts +3 -0
- package/lib/src/brand-page/components/contact-form/ContactForm.mixin.js +19 -13
- package/lib/src/brand-page/components/mailing-list/MailingList.mixin.d.ts +3 -1
- package/lib/src/brand-page/components/mailing-list/MailingList.mixin.js +17 -2
- package/lib/src/brand-page/components/navigation/button-carousel/ButtonCarouselNavigation.mixin.d.ts +11 -3
- package/lib/src/brand-page/components/navigation/button-carousel/ButtonCarouselNavigation.mixin.js +35 -1
- package/lib/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.mixin.d.ts +8 -2
- package/lib/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.mixin.js +27 -3
- package/lib/src/brand-page/components/page/Page.mixin.d.ts +5 -2
- package/lib/src/brand-page/components/page/Page.mixin.js +33 -27
- package/lib/src/brand-page/components/page-footer/PageFooter.mixin.d.ts +7 -2
- package/lib/src/brand-page/components/page-footer/PageFooter.mixin.js +21 -1
- package/lib/src/brand-page/components/payment/Payment.mixin.d.ts +5 -2
- package/lib/src/brand-page/components/payment/Payment.mixin.js +22 -2
- package/lib/src/brand-page/components/payment/support-me/SupportMe.mixin.d.ts +6 -2
- package/lib/src/brand-page/components/payment/support-me/SupportMe.mixin.js +32 -1
- package/lib/src/brand-page/components/social-links/SocialLinks.stories.js +0 -3
- package/lib/src/brand-page/components/testimonial-section/__fixtures__/data.js +0 -3
- package/lib/src/brand-page/components/text/Text.stories.js +0 -17
- package/lib/src/brand-page/constants/font.constants.d.ts +62 -0
- package/lib/src/brand-page/constants/font.constants.js +35 -0
- package/lib/src/brand-page/models/index.d.ts +23 -24
- package/lib/src/brand-page/models/index.js +20 -7
- package/lib/src/brand-page/models/navigation-styles.model.d.ts +1 -1
- package/lib/src/brand-page/models/navigation-styles.model.js +17 -8
- package/lib/src/brand-page/models/payment.model.d.ts +11 -6
- package/lib/src/brand-page/models/styles.model.d.ts +53 -7
- package/lib/src/brand-page/models/styles.model.js +115 -27
- package/lib/src/brand-page/utils/color-palette.util.d.ts +43 -23
- package/lib/src/brand-page/utils/color-palette.util.js +65 -27
- package/lib/src/brand-page/utils/color.util.d.ts +13 -9
- package/lib/src/brand-page/utils/color.util.js +56 -15
- package/lib/src/brand-page/utils/container-text-color.util.d.ts +46 -13
- package/lib/src/brand-page/utils/container-text-color.util.js +321 -41
- package/lib/src/brand-page/utils/index.d.ts +1 -0
- package/lib/src/brand-page/utils/index.js +1 -0
- package/lib/src/brand-page/utils/migration/migration-20.js +6 -2
- package/lib/src/brand-page/utils/migration/migration-21.js +34 -6
- package/lib/src/brand-page/utils/migration/migration-22.d.ts +99 -0
- package/lib/src/brand-page/utils/migration/migration-22.js +909 -0
- package/lib/src/brand-page/utils/migration.util.js +17 -0
- package/lib/src/brand-page/utils/model.util.d.ts +4 -0
- package/lib/src/brand-page/utils/model.util.js +4 -0
- package/lib/src/brand-page/utils/personalisation.util.js +9 -1
- package/lib/src/brand-page/utils/rte-role-lift.util.d.ts +72 -0
- package/lib/src/brand-page/utils/rte-role-lift.util.js +275 -0
- package/lib/src/brand-page/utils/style.util.d.ts +5 -1
- package/lib/src/brand-page/utils/style.util.js +34 -11
- package/lib/src/brand-page/utils/text-role-css.util.d.ts +19 -0
- package/lib/src/brand-page/utils/text-role-css.util.js +186 -0
- package/lib/src/brand-page/utils/text-role-reconnect.util.d.ts +90 -0
- package/lib/src/brand-page/utils/text-role-reconnect.util.js +434 -0
- package/lib/src/brand-page/utils/text-style.util.d.ts +53 -23
- package/lib/src/brand-page/utils/text-style.util.js +122 -22
- package/lib/src/brand-page/utils/view-model.util.d.ts +9 -1
- package/lib/src/brand-page/utils/view-model.util.js +124 -111
- package/lib/src/brand-page/view-models.d.ts +1 -0
- package/lib/src/brand-page-maker/components/action-bar/ActionBar.mixin.d.ts +4 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +13 -2
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.js +4 -4
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.d.ts +4 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js +0 -10
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/content-settings-items.fixture.js +0 -1
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +23 -138
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.js +0 -28
- package/lib/src/brand-page-maker/components/brandpage-settings/ReplaceImageSettingsForBrandPageSettings.mixin.d.ts +4 -1
- package/lib/src/brand-page-maker/components/navigation/Navigation.mixin.d.ts +1 -1
- package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +5 -2
- package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +4 -1
- package/lib/src/brand-page-maker/components/social-share/SocialShare.mixin.d.ts +4 -1
- package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +4 -1
- package/lib/src/brand-page-maker/composables/ai-chat/useAiMetadataBuilder.d.ts +1 -0
- package/lib/src/brand-page-maker/composables/ai-chat/useAiMetadataBuilder.js +1 -0
- package/lib/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.js +1 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/RoleTypographyFill.d.ts +16 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/RoleTypographyFill.js +61 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/RteClipboard.d.ts +11 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/RteClipboard.js +236 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/font.d.ts +2 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/font.js +25 -6
- package/lib/src/brand-page-maker/composables/rich-text-editor/formatting.d.ts +17 -4
- package/lib/src/brand-page-maker/composables/rich-text-editor/formatting.js +204 -17
- package/lib/src/brand-page-maker/composables/rich-text-editor/hyperlink.d.ts +1 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/hyperlink.js +29 -31
- package/lib/src/brand-page-maker/composables/rich-text-editor/keepMarksOnEmpty.d.ts +20 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/keepMarksOnEmpty.js +60 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/spacing.d.ts +2 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/spacing.js +22 -6
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.d.ts +10 -4
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +319 -275
- package/lib/src/brand-page-maker/constants/config-settings-constant.js +1 -5
- package/lib/src/brand-page-maker/convertors/text-css-style-options.convertor.js +6 -2
- package/lib/src/brand-page-maker/convertors/text-size-value.convertor.d.ts +1 -1
- package/lib/src/brand-page-maker/convertors/text-size-value.convertor.js +3 -1
- package/lib/src/brand-page-maker/default-getters/payment-text-and-border-color.default-getter.js +7 -14
- package/lib/src/brand-page-maker/default-getters/text-color.default-getter.js +6 -13
- package/lib/src/brand-page-maker/models/content-settings.d.ts +8 -0
- package/lib/src/brand-page-maker/models/content-settings.js +112 -81
- package/lib/src/brand-page-maker/stores/admin-logo-settings/admin-logo-settings-store-utils.d.ts +2 -2
- package/lib/src/brand-page-maker/stores/admin-logo-settings/admin-logo-settings-store-utils.js +5 -2
- package/lib/src/brand-page-maker/stores/admin-logo-settings/admin-logo-settings-store.js +4 -3
- package/lib/src/brand-page-maker/stores/ai-checkpoint/ai-checkpoint-store.d.ts +1257 -117
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.d.ts +6 -1
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +17 -9
- package/lib/src/brand-page-maker/stores/history/history-store.d.ts +59 -5
- package/lib/src/brand-page-maker/stores/history/history-store.js +22 -2
- package/lib/src/brand-page-maker/utils/apply-color-strategy.js +26 -8
- package/lib/src/brand-page-maker/utils/index.d.ts +2 -1
- package/lib/src/brand-page-maker/utils/index.js +2 -1
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.d.ts +117 -15
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.js +435 -281
- package/lib/src/brand-page-maker/utils/rte-authoring.util.d.ts +4 -0
- package/lib/src/brand-page-maker/utils/rte-authoring.util.js +101 -0
- package/lib/src/brand-page-maker/utils/rte-clipboard.util.d.ts +126 -0
- package/lib/src/brand-page-maker/utils/rte-clipboard.util.js +307 -0
- package/lib/src/brand-page-maker/utils/rte-sanitize.util.js +13 -3
- package/lib/src/{bundled-translations-zfiA5Tsw.js → bundled-translations-yGrvPE5i.js} +17 -17
- package/lib/src/{bundled-translations.de-DE-ChsdSyAP.js → bundled-translations.de-DE-L4Znf8Hs.js} +17 -17
- package/lib/src/{bundled-translations.es-ES-DflsWQK0.js → bundled-translations.es-ES-D6iticrK.js} +15 -15
- package/lib/src/{bundled-translations.fr-CA-fpDRuZ52.js → bundled-translations.fr-CA-BgAVE-9k.js} +25 -25
- package/lib/src/{bundled-translations.fr-FR-Bub73Zt-.js → bundled-translations.fr-FR-B8GbyqxQ.js} +17 -17
- package/lib/src/{bundled-translations.pt-BR-BlnWE9TB.js → bundled-translations.pt-BR-DjPU3Db7.js} +25 -25
- package/lib/src/{bundled-translations.pt-PT-DmzXlnaS.js → bundled-translations.pt-PT-BaepaDpr.js} +23 -23
- package/lib/src/bundles/bundled-translations.de-DE.json +21 -2
- package/lib/src/bundles/bundled-translations.es-ES.json +21 -2
- package/lib/src/bundles/bundled-translations.fr-CA.json +21 -2
- package/lib/src/bundles/bundled-translations.fr-FR.json +21 -2
- package/lib/src/bundles/bundled-translations.json +21 -2
- package/lib/src/bundles/bundled-translations.pt-BR.json +21 -2
- package/lib/src/bundles/bundled-translations.pt-PT.json +21 -2
- package/lib/src/clients/ai-assistant-client.d.ts +1 -0
- package/lib/src/composables/useTranslate.d.ts +1 -1
- package/lib/src/composables/useTranslate.js +1 -1
- package/lib/src/css/library.brand-page-brandCrowd.min.css +303 -207
- package/lib/src/css/library.brand-page-brandPage.min.css +303 -207
- package/lib/src/css/library.brand-page-designCom.min.css +303 -207
- package/lib/src/css/library.brand-page-preview.min.css +303 -207
- package/lib/src/index.d.ts +2 -1
- package/lib/src/index.mjs +195 -191
- package/lib/src/{lib-1AqtEmvQ.js → lib-kGRlD3_P.js} +36855 -33893
- package/lib/src/lib.js +2 -1
- package/lib/src/metadata-builder/builders/footer-builder.js +4 -5
- package/lib/src/metadata-builder/builders/global-role-propagation.d.ts +58 -0
- package/lib/src/metadata-builder/builders/global-role-propagation.js +246 -0
- package/lib/src/metadata-builder/builders/global-styles-builder.d.ts +1 -0
- package/lib/src/metadata-builder/builders/global-styles-builder.js +116 -45
- package/lib/src/metadata-builder/builders/header-builder.js +13 -4
- package/lib/src/metadata-builder/builders/section-builders/about-section-builder.js +3 -3
- package/lib/src/metadata-builder/builders/section-builders/banner-section-builder.js +3 -3
- package/lib/src/metadata-builder/builders/section-builders/booking-section-builder.js +3 -3
- package/lib/src/metadata-builder/builders/section-builders/contact-form-builder.js +4 -4
- package/lib/src/metadata-builder/builders/section-builders/images-section-builder.js +3 -3
- package/lib/src/metadata-builder/builders/section-builders/mailing-list-builder.js +2 -2
- package/lib/src/metadata-builder/builders/section-builders/mailing-list-section-builder.js +2 -2
- package/lib/src/metadata-builder/builders/section-builders/profile-section-builder.js +4 -4
- package/lib/src/metadata-builder/builders/section-builders/shapes-section-builder.js +3 -3
- package/lib/src/metadata-builder/builders/section-builders/social-links-builder.js +8 -2
- package/lib/src/metadata-builder/builders/section-builders/testimonial-section-builder.js +2 -2
- package/lib/src/metadata-builder/builders/section-builders/text-section-builder.js +60 -29
- package/lib/src/metadata-builder/builders/section-field-maps.js +1 -0
- package/lib/src/metadata-builder/builders/section-field-utils.d.ts +48 -19
- package/lib/src/metadata-builder/builders/section-field-utils.js +128 -52
- package/lib/src/metadata-builder/builders/section-rules/global-styles.rules.d.ts +4 -2
- package/lib/src/metadata-builder/builders/section-rules/global-styles.rules.js +28 -12
- package/lib/src/metadata-builder/builders/section-rules/social-links.rules.js +5 -1
- package/lib/src/metadata-builder/helpers/rte.helpers.d.ts +1 -1
- package/lib/src/metadata-builder/helpers/rte.helpers.js +97 -40
- package/lib/src/metadata-builder/metadata-executor.js +23 -1
- package/lib/src/metadata-builder/models.d.ts +2 -0
- package/lib/src/metadata-builder/parsers/ai-toolcall-parser.d.ts +18 -19
- package/lib/src/metadata-builder/parsers/section-tool-arguments.d.ts +18 -1
- package/lib/src/metadata-builder/sanitizers/rte-schema-check.js +1 -1
- package/lib/src/metadata-builder/sanitizers/sanitizer-rules.d.ts +0 -1
- package/lib/src/metadata-builder/sanitizers/sanitizer-rules.js +5 -8
- package/lib/src/metadata-builder/sanitizers/section-args-validator.d.ts +7 -16
- package/lib/src/metadata-builder/sanitizers/section-args-validator.js +95 -22
- package/lib/src/shared/color-palette/section-color-matches.js +9 -25
- package/lib/src/shared/color-strategies/color-strategies.d.ts +15 -0
- package/lib/src/shared/color-strategies/color-strategies.js +31 -0
- package/lib/src/shared/color-strategies/rte-color.d.ts +8 -0
- package/lib/src/shared/color-strategies/rte-color.js +16 -0
- package/lib/src/shared/color-strategies/rte-field-pairs.d.ts +23 -0
- package/lib/src/shared/color-strategies/rte-field-pairs.js +28 -0
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +9 -135
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.js +1 -27
- package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +12 -2
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.d.ts +7 -0
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +75 -6
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.js +18 -7
- package/lib/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.mixin.d.ts +6 -1
- package/lib/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.mixin.js +0 -7
- package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +1 -0
- package/lib/src/shared/content-settings/components/text-items-field/TextItemsField.mixin.js +8 -4
- package/lib/src/shared/content-settings/components/text-style-field/TextStyleField.mixin.d.ts +1255 -26
- package/lib/src/shared/content-settings/components/text-style-field/TextStyleField.mixin.js +203 -59
- package/lib/src/shared/content-settings/store/content-settings-store.d.ts +6 -0
- package/lib/src/shared/content-settings/store/content-settings-store.js +105 -8
- package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +5 -1
- package/lib/src/shared/navigation-style-settings/store/index.d.ts +7 -3
- package/lib/src/shared/navigation-style-settings/store/index.js +40 -15
- package/lib/src/shared/page-settings/components/delete-page-modal/DeletePageModal.mixin.d.ts +1 -1
- package/lib/src/shared/page-settings/components/new-page-modal/NewPageModal.mixin.d.ts +1 -0
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +17 -5
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +70 -13
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.js +10 -2
- package/lib/src/shared/page-settings/store/page-settings-store.d.ts +2 -1
- package/lib/src/shared/page-settings/store/page-settings-store.js +17 -0
- package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +4 -1
- package/lib/src/shared/rte-extensions/AutoLink.d.ts +17 -0
- package/lib/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/AutoLink.js +67 -51
- package/lib/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/MaxLength.js +4 -1
- package/lib/src/shared/rte-extensions/TextEffects.d.ts +28 -0
- package/lib/src/shared/rte-extensions/TextEffects.js +96 -0
- package/lib/src/shared/rte-extensions/ViewDomParser.d.ts +2 -0
- package/lib/src/shared/rte-extensions/ViewDomParser.js +21 -0
- package/lib/src/shared/rte-extensions.util.d.ts +25 -0
- package/lib/src/{brand-page-maker/composables/rich-text-editor/getRteExtensions.js → shared/rte-extensions.util.js} +62 -7
- package/lib/src/shared/rte-link.util.d.ts +1 -0
- package/lib/src/shared/rte-link.util.js +1 -0
- package/lib/src/shared/rte-render.util.d.ts +112 -0
- package/lib/src/shared/rte-render.util.js +255 -0
- package/lib/src/shared/rte-shape.util.d.ts +6 -0
- package/lib/src/shared/rte-shape.util.js +18 -0
- package/lib/src/shared/side-bar/components/SideBar.mixin.d.ts +2 -1
- package/lib/src/shared/side-bar/components/SideBarTabButton.mixin.d.ts +1 -0
- package/lib/src/shared/side-bar/store/side-bar-store.d.ts +2 -0
- package/lib/src/shared/side-bar/store/side-bar-store.js +9 -0
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +155 -15
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.js +7 -1
- package/lib/src/shared/style-settings/store/style-settings-store.d.ts +1 -9
- package/lib/src/shared/style-settings/store/style-settings-store.js +3 -33
- package/lib/src/shared/style-settings/text-style-size-order.d.ts +2 -0
- package/lib/src/shared/style-settings/text-style-size-order.js +13 -0
- package/lib/src/shared/text-role-typography.util.d.ts +64 -0
- package/lib/src/shared/text-role-typography.util.js +183 -0
- package/lib/src/utils/minify-brand-page-metadata.d.ts +16 -1
- package/lib/src/utils/minify-brand-page-metadata.js +31 -9
- package/package.json +1 -1
- package/src/brand-page/__fixtures__/migration-22-v21/edited-brandsite-sections.v21.json +982 -0
- package/src/brand-page/__fixtures__/migration-22-v21/new-brandcontact-every-section.v21.json +1231 -0
- package/src/brand-page/__fixtures__/migration-22-v21/new-brandpage-every-section.v21.json +1231 -0
- package/src/brand-page/__fixtures__/migration-22-v21/new-brandsite-every-section.v21.json +1243 -0
- package/src/brand-page/__fixtures__/migration-22-v21/real-brandcontact.v21.json +755 -0
- package/src/brand-page/__fixtures__/migration-22-v21/real-brandpage-general-link.v21.json +527 -0
- package/src/brand-page/__fixtures__/migration-22-v21/real-brandpage-links.v21.json +755 -0
- package/src/brand-page/__fixtures__/migration-22-v21/real-brandpage-social-links.v21.json +514 -0
- package/src/brand-page/__fixtures__/migration-22-v21/real-brandsite-about.v21.json +459 -0
- package/src/brand-page/__fixtures__/migration-22-v21/real-brandsite-footer.v21.json +469 -0
- package/src/brand-page/__fixtures__/migration-22-v21/real-brandsite-header-banner.v21.json +481 -0
- package/src/brand-page/__fixtures__/migration-22-v21/real-brandsite-sections.v21.json +800 -0
- package/src/brand-page/__fixtures__/production-text-style-resolver.fixture.ts +52 -0
- package/src/brand-page/components/about-section/AboutSection.vue.test.ts +0 -10
- package/src/brand-page/components/contact-form/ContactForm.mixin.test.ts +127 -0
- package/src/brand-page/components/contact-form/ContactForm.mixin.ts +31 -14
- package/src/brand-page/components/contact-form/ContactForm.vue +26 -12
- package/src/brand-page/components/contact-form/ContactForm.vue.test.ts +60 -0
- package/src/brand-page/components/mailing-list/MailingList.mixin.test.ts +92 -0
- package/src/brand-page/components/mailing-list/MailingList.mixin.ts +28 -3
- package/src/brand-page/components/mailing-list/MailingList.vue +9 -4
- package/src/brand-page/components/mailing-list/MailingList.vue.test.ts +63 -0
- package/src/brand-page/components/navigation/button-carousel/ButtonCarouselNavigation.mixin.ts +51 -1
- package/src/brand-page/components/navigation/button-carousel/ButtonCarouselNavigation.test.ts +114 -0
- package/src/brand-page/components/navigation/button-carousel/ButtonCarouselNavigation.vue +8 -2
- package/src/brand-page/components/navigation/navigation-carousel/NavigationCarousel.test.ts +182 -0
- package/src/brand-page/components/navigation/navigation-carousel/NavigationCarousel.vue +59 -12
- package/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.mixin.ts +40 -3
- package/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.vue +15 -7
- package/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.vue.test.ts +133 -3
- package/src/brand-page/components/page/Page.mixin.ts +41 -34
- package/src/brand-page/components/page/Page.vue +17 -6
- package/src/brand-page/components/page/Page.vue.test.ts +91 -1
- package/src/brand-page/components/page-footer/PageFooter.mixin.ts +32 -2
- package/src/brand-page/components/page-footer/PageFooter.test.ts +79 -0
- package/src/brand-page/components/page-footer/PageFooter.vue +12 -4
- package/src/brand-page/components/payment/Payment.mixin.ts +34 -2
- package/src/brand-page/components/payment/Payment.test.ts +188 -0
- package/src/brand-page/components/payment/Payment.vue +12 -5
- package/src/brand-page/components/payment/RequestPaymentStripe.vue +1 -0
- package/src/brand-page/components/payment/support-me/SupportMe.mixin.ts +49 -2
- package/src/brand-page/components/payment/support-me/SupportMe.test.ts +100 -0
- package/src/brand-page/components/payment/support-me/SupportMe.vue +7 -1
- package/src/brand-page/components/payment/support-me/SupportMe.vue.test.ts +66 -0
- package/src/brand-page/components/save-contact/SaveContactWidget.test.ts +100 -0
- package/src/brand-page/components/save-contact/SaveContactWidget.vue +6 -3
- package/src/brand-page/components/shop/PaymentModal.vue +2 -6
- package/src/brand-page/components/shop/PaymentShippingAddress.vue +6 -0
- package/src/brand-page/components/shop/Shop.vue +15 -2
- package/src/brand-page/components/shop/Shop.vue.test.ts +74 -2
- package/src/brand-page/components/social-links/SocialLinks.stories.ts +0 -3
- package/src/brand-page/components/social-links/SocialLinks.vue.test.ts +0 -3
- package/src/brand-page/components/testimonial-section/__fixtures__/data.ts +0 -3
- package/src/brand-page/components/text/Text.stories.ts +0 -17
- package/src/brand-page/components/text-wrapper/TextWrapper.parity.test.ts +136 -0
- package/src/brand-page/components/text-wrapper/TextWrapper.test.ts +358 -0
- package/src/brand-page/components/text-wrapper/TextWrapper.vue +82 -22
- package/src/brand-page/constants/font.constants.ts +37 -0
- package/src/brand-page/models/footer-icon-color.test.ts +22 -0
- package/src/brand-page/models/index.ts +50 -28
- package/src/brand-page/models/navigation-styles.model.test.ts +77 -1
- package/src/brand-page/models/navigation-styles.model.ts +26 -9
- package/src/brand-page/models/payment.model.ts +15 -6
- package/src/brand-page/models/styles.model.test.ts +104 -0
- package/src/brand-page/models/styles.model.ts +181 -47
- package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +619 -115
- package/src/brand-page/utils/__snapshots__/migration2.util.test.ts.snap +150 -9
- package/src/brand-page/utils/__snapshots__/model.util.test.ts.snap +300 -18
- package/src/brand-page/utils/color-palette.util.test.ts +126 -1
- package/src/brand-page/utils/color-palette.util.ts +92 -26
- package/src/brand-page/utils/color.util.test.ts +62 -29
- package/src/brand-page/utils/color.util.ts +77 -14
- package/src/brand-page/utils/container-text-color.util.test.ts +672 -26
- package/src/brand-page/utils/container-text-color.util.ts +472 -46
- package/src/brand-page/utils/index.ts +1 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/edited-brandsite-sections.v22.json +1191 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/new-brandcontact-every-section.v22.json +2026 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/new-brandpage-every-section.v22.json +2017 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/new-brandsite-every-section.v22.json +2031 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/real-brandcontact.v22.json +1145 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/real-brandpage-general-link.v22.json +645 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/real-brandpage-links.v22.json +1136 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/real-brandpage-social-links.v22.json +662 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/real-brandsite-about.v22.json +638 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/real-brandsite-footer.v22.json +610 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/real-brandsite-header-banner.v22.json +660 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/real-brandsite-sections.v22.json +1132 -0
- package/src/brand-page/utils/migration/migration-01.ts +293 -237
- package/src/brand-page/utils/migration/migration-02.ts +8 -1
- package/src/brand-page/utils/migration/migration-20.ts +6 -3
- package/src/brand-page/utils/migration/migration-20_5.test.ts +5 -2
- package/src/brand-page/utils/migration/migration-21.test.ts +34 -0
- package/src/brand-page/utils/migration/migration-21.ts +46 -10
- package/src/brand-page/utils/migration/migration-22.fixed-input.test.ts +43 -0
- package/src/brand-page/utils/migration/migration-22.test.ts +4103 -0
- package/src/brand-page/utils/migration/migration-22.text-font-family.test.ts +72 -0
- package/src/brand-page/utils/migration/migration-22.ts +1336 -0
- package/src/brand-page/utils/migration.util.test.ts +146 -32
- package/src/brand-page/utils/migration.util.ts +18 -0
- package/src/brand-page/utils/model.util.ts +4 -0
- package/src/brand-page/utils/personalisation.util.test.ts +148 -3
- package/src/brand-page/utils/personalisation.util.ts +9 -1
- package/src/brand-page/utils/rte-role-lift.util.ts +409 -0
- package/src/brand-page/utils/style.util.test.ts +35 -2
- package/src/brand-page/utils/style.util.ts +45 -11
- package/src/brand-page/utils/text-role-css.util.test.ts +525 -0
- package/src/brand-page/utils/text-role-css.util.ts +321 -0
- package/src/brand-page/utils/text-role-reconnect.util.test.ts +604 -0
- package/src/brand-page/utils/text-role-reconnect.util.ts +727 -0
- package/src/brand-page/utils/text-style.util.test.ts +305 -0
- package/src/brand-page/utils/text-style.util.ts +198 -24
- package/src/brand-page/utils/view-model.page-data.test.ts +232 -0
- package/src/brand-page/utils/view-model.util.test.ts +954 -133
- package/src/brand-page/utils/view-model.util.ts +187 -139
- package/src/brand-page/view-models.ts +4 -0
- package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.blank-site.test.ts +57 -0
- package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.ts +9 -5
- package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.ts +0 -10
- package/src/brand-page-maker/components/brand-page-maker/__fixtures__/content-settings-items.fixture.ts +0 -1
- package/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.ts +0 -44
- package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.vue +253 -200
- package/src/brand-page-maker/components/shop/AddOrEditProductContainer.vue +1 -0
- package/src/brand-page-maker/components/template-preview/TemplatePreview.vue +1 -0
- package/src/brand-page-maker/composables/ai-chat/useAiMetadataBuilder.ts +2 -0
- package/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.ts +1 -0
- package/src/brand-page-maker/composables/rich-text-editor/block-typography.test.ts +519 -0
- package/src/brand-page-maker/composables/rich-text-editor/extensions/FontFamily.test.ts +1 -1
- package/src/brand-page-maker/composables/rich-text-editor/extensions/MaxLength.test.ts +26 -1
- package/src/brand-page-maker/composables/rich-text-editor/extensions/RoleTypographyFill.test.ts +110 -0
- package/src/brand-page-maker/composables/rich-text-editor/extensions/RoleTypographyFill.ts +99 -0
- package/src/brand-page-maker/composables/rich-text-editor/extensions/RteClipboard.ts +397 -0
- package/src/brand-page-maker/composables/rich-text-editor/extensions/ViewDomParser.test.ts +139 -0
- package/src/brand-page-maker/composables/rich-text-editor/font.ts +36 -5
- package/src/brand-page-maker/composables/rich-text-editor/formatting.test.ts +375 -1
- package/src/brand-page-maker/composables/rich-text-editor/formatting.ts +301 -17
- package/src/brand-page-maker/composables/rich-text-editor/hyperlink.test.ts +82 -1
- package/src/brand-page-maker/composables/rich-text-editor/hyperlink.ts +28 -34
- package/src/brand-page-maker/composables/rich-text-editor/keepMarksOnEmpty.test.ts +80 -0
- package/src/brand-page-maker/composables/rich-text-editor/keepMarksOnEmpty.ts +75 -0
- package/src/brand-page-maker/composables/rich-text-editor/spacing.ts +31 -6
- package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.test.ts +2485 -0
- package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +435 -337
- package/src/brand-page-maker/constants/config-settings-constant.ts +0 -6
- package/src/brand-page-maker/convertors/text-css-style-options.convertor.test.ts +43 -0
- package/src/brand-page-maker/convertors/text-css-style-options.convertor.ts +6 -2
- package/src/brand-page-maker/convertors/text-size-value.convertor.test.ts +24 -0
- package/src/brand-page-maker/convertors/text-size-value.convertor.ts +17 -13
- package/src/brand-page-maker/default-getters/payment-text-and-border-color.default-getter.ts +7 -22
- package/src/brand-page-maker/default-getters/text-color.default-getter.ts +5 -21
- package/src/brand-page-maker/models/content-settings.test.ts +708 -0
- package/src/brand-page-maker/models/content-settings.ts +133 -82
- package/src/brand-page-maker/stores/admin-logo-settings/admin-logo-settings-store-utils.test.ts +63 -1
- package/src/brand-page-maker/stores/admin-logo-settings/admin-logo-settings-store-utils.ts +16 -3
- package/src/brand-page-maker/stores/admin-logo-settings/admin-logo-settings-store.test.ts +34 -0
- package/src/brand-page-maker/stores/admin-logo-settings/admin-logo-settings-store.ts +4 -2
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.test.ts +185 -1
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +22 -34
- package/src/brand-page-maker/stores/history/history-store.ts +35 -2
- package/src/brand-page-maker/utils/__snapshots__/apply-color-strategy.golden.test.ts.snap +528 -0
- package/src/brand-page-maker/utils/__snapshots__/rte-render-parity.test.ts.snap +12 -0
- package/src/brand-page-maker/utils/apply-color-strategy.golden.test.ts +2 -0
- package/src/brand-page-maker/utils/apply-color-strategy.test.ts +181 -3
- package/src/brand-page-maker/utils/apply-color-strategy.ts +36 -4
- package/src/brand-page-maker/utils/index.ts +2 -1
- package/src/brand-page-maker/utils/rich-text-editor.util.test.ts +447 -410
- package/src/brand-page-maker/utils/rich-text-editor.util.ts +610 -506
- package/src/brand-page-maker/utils/rte-authoring.util.test.ts +244 -0
- package/src/brand-page-maker/utils/rte-authoring.util.ts +175 -0
- package/src/brand-page-maker/utils/rte-clipboard.util.test.ts +558 -0
- package/src/brand-page-maker/utils/rte-clipboard.util.ts +473 -0
- package/src/brand-page-maker/utils/rte-features.test.ts +99 -3
- package/src/brand-page-maker/utils/rte-render-parity.test.ts +1 -1
- package/src/brand-page-maker/utils/rte-render.util.test.ts +230 -0
- package/src/brand-page-maker/utils/rte-sanitize-json.test.ts +1 -1
- package/src/brand-page-maker/utils/rte-sanitize.util.ts +14 -3
- package/src/brand-page-maker/utils/rte-schema-version.test.ts +102 -0
- package/src/bundles/bundled-translations.de-DE.json +21 -2
- package/src/bundles/bundled-translations.es-ES.json +21 -2
- package/src/bundles/bundled-translations.fr-CA.json +21 -2
- package/src/bundles/bundled-translations.fr-FR.json +21 -2
- package/src/bundles/bundled-translations.json +21 -2
- package/src/bundles/bundled-translations.pt-BR.json +21 -2
- package/src/bundles/bundled-translations.pt-PT.json +21 -2
- package/src/clients/ai-assistant-client.ts +1 -0
- package/src/composables/useTranslate.ts +2 -1
- package/src/lib.ts +2 -2
- package/src/metadata-builder/builders/footer-builder.test.ts +70 -45
- package/src/metadata-builder/builders/footer-builder.ts +4 -8
- package/src/metadata-builder/builders/global-role-propagation.test.ts +907 -0
- package/src/metadata-builder/builders/global-role-propagation.ts +430 -0
- package/src/metadata-builder/builders/global-styles-builder.test.ts +1020 -0
- package/src/metadata-builder/builders/global-styles-builder.ts +194 -48
- package/src/metadata-builder/builders/header-builder.test.ts +112 -40
- package/src/metadata-builder/builders/header-builder.ts +18 -8
- package/src/metadata-builder/builders/section-builders/about-section-builder.ts +5 -3
- package/src/metadata-builder/builders/section-builders/banner-section-builder.ts +5 -3
- package/src/metadata-builder/builders/section-builders/booking-section-builder.ts +5 -3
- package/src/metadata-builder/builders/section-builders/contact-form-builder.ts +7 -4
- package/src/metadata-builder/builders/section-builders/images-section-builder.ts +5 -3
- package/src/metadata-builder/builders/section-builders/mailing-list-builder.ts +3 -2
- package/src/metadata-builder/builders/section-builders/mailing-list-section-builder.ts +3 -2
- package/src/metadata-builder/builders/section-builders/profile-section-builder.ts +7 -7
- package/src/metadata-builder/builders/section-builders/shapes-section-builder.ts +5 -3
- package/src/metadata-builder/builders/section-builders/social-links-builder.test.ts +2 -2
- package/src/metadata-builder/builders/section-builders/social-links-builder.ts +21 -10
- package/src/metadata-builder/builders/section-builders/support-me-builder.test.ts +10 -0
- package/src/metadata-builder/builders/section-builders/testimonial-section-builder.ts +3 -2
- package/src/metadata-builder/builders/section-builders/text-section-builder.ts +111 -61
- package/src/metadata-builder/builders/section-field-maps.ts +1 -0
- package/src/metadata-builder/builders/section-field-utils.test.ts +545 -2
- package/src/metadata-builder/builders/section-field-utils.ts +202 -69
- package/src/metadata-builder/builders/section-rules/global-styles.rules.ts +38 -13
- package/src/metadata-builder/builders/section-rules/social-links.rules.ts +5 -0
- package/src/metadata-builder/helpers/rte.helpers.test.ts +101 -0
- package/src/metadata-builder/helpers/rte.helpers.ts +129 -43
- package/src/metadata-builder/metadata-executor.test.ts +167 -0
- package/src/metadata-builder/metadata-executor.ts +34 -1
- package/src/metadata-builder/models.ts +2 -0
- package/src/metadata-builder/parsers/ai-toolcall-parser.ts +23 -7
- package/src/metadata-builder/parsers/section-tool-arguments.ts +21 -1
- package/src/metadata-builder/sanitizers/__tests__/section-args-validator.test.ts +215 -0
- package/src/metadata-builder/sanitizers/rte-schema-check.ts +1 -1
- package/src/metadata-builder/sanitizers/sanitizer-rules.ts +4 -8
- package/src/metadata-builder/sanitizers/section-args-validator.ts +136 -53
- package/src/shared/color-palette/section-color-matches.test.ts +15 -11
- package/src/shared/color-palette/section-color-matches.ts +9 -28
- package/src/shared/color-strategies/color-strategies.ts +35 -0
- package/src/shared/color-strategies/rte-color.test.ts +1 -1
- package/src/shared/color-strategies/rte-color.ts +19 -0
- package/src/shared/color-strategies/rte-field-pairs.test.ts +26 -5
- package/src/shared/color-strategies/rte-field-pairs.ts +33 -0
- package/src/shared/content-settings/components/color-matches-panel/ColorMatchesPanel.test.ts +43 -66
- package/src/shared/content-settings/components/color-matches-panel/ColorMatchesPanel.vue +7 -1
- package/src/shared/content-settings/components/content-settings/ContentSettings.mixin.ts +1 -48
- package/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.ts +33 -7
- package/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.test.ts +128 -1
- package/src/shared/content-settings/components/draggable-item-list/DraggableItemList.vue +1 -0
- package/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.mixin.ts +0 -6
- package/src/shared/content-settings/components/logo-selection-field/LogoSelection.vue +3 -0
- package/src/shared/content-settings/components/logo-size-field/LogoSizeSlider.vue +3 -0
- package/src/shared/content-settings/components/logo-size-field/LogoSizeSliderField.vue +1 -0
- package/src/shared/content-settings/components/testimonial-items-field/TestimonialItemsField.vue +1 -0
- package/src/shared/content-settings/components/text-items-field/TextItemsField.mixin.test.ts +56 -3
- package/src/shared/content-settings/components/text-items-field/TextItemsField.mixin.ts +11 -4
- package/src/shared/content-settings/components/text-style-field/TextStyleField.mixin.test.ts +335 -25
- package/src/shared/content-settings/components/text-style-field/TextStyleField.mixin.ts +248 -70
- package/src/shared/content-settings/components/text-style-field/TextStyleField.vue +113 -25
- package/src/shared/content-settings/components/text-style-field/i18n/text-style-field.de-DE.json +17 -10
- package/src/shared/content-settings/components/text-style-field/i18n/text-style-field.es-ES.json +17 -10
- package/src/shared/content-settings/components/text-style-field/i18n/text-style-field.fr-CA.json +17 -10
- package/src/shared/content-settings/components/text-style-field/i18n/text-style-field.fr-FR.json +17 -10
- package/src/shared/content-settings/components/text-style-field/i18n/text-style-field.json +8 -1
- package/src/shared/content-settings/components/text-style-field/i18n/text-style-field.pt-BR.json +17 -10
- package/src/shared/content-settings/components/text-style-field/i18n/text-style-field.pt-PT.json +17 -10
- package/src/shared/content-settings/components/text-style-role-dropdown/TextStyleRoleDropdown.test.ts +141 -0
- package/src/shared/content-settings/components/text-style-role-dropdown/TextStyleRoleDropdown.vue +136 -0
- package/src/shared/content-settings/store/content-settings-store.test.ts +491 -6
- package/src/shared/content-settings/store/content-settings-store.ts +159 -17
- package/src/shared/logo-settings/components/EditLogoSettings.vue +1 -0
- package/src/shared/logo-settings/components/LogoVariations.vue +1 -0
- package/src/shared/navigation-style-settings/components/navigation-style-settings/NavigationStyleSettings.vue +1 -0
- package/src/shared/navigation-style-settings/store/index.test.ts +295 -0
- package/src/shared/navigation-style-settings/store/index.ts +65 -15
- package/src/shared/page-settings/components/header-settings-panel/HeaderSettingsPanel.vue +2 -0
- package/src/shared/page-settings/components/page-settings/PageElement.vue +1 -0
- package/src/shared/page-settings/components/page-settings-section-styles/HeaderButtonSettings.test.ts +44 -4
- package/src/shared/page-settings/components/page-settings-section-styles/HeaderButtonSettings.vue +13 -4
- package/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.navigation.test.ts +89 -0
- package/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.text-style.test.ts +91 -0
- package/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.ts +14 -2
- package/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.vue +2 -0
- package/src/shared/page-settings/store/page-settings-store.text-style.test.ts +84 -0
- package/src/shared/page-settings/store/page-settings-store.ts +30 -1
- package/src/shared/rte-extensions/AutoLink.test.ts +98 -0
- package/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/AutoLink.ts +87 -58
- package/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/MaxLength.ts +4 -1
- package/src/shared/rte-extensions/TextEffects.ts +151 -0
- package/src/shared/rte-extensions/ViewDomParser.ts +27 -0
- package/src/{brand-page-maker/composables/rich-text-editor/getRteExtensions.ts → shared/rte-extensions.util.ts} +66 -9
- package/src/shared/rte-link.util.ts +2 -0
- package/src/shared/rte-render.util.ts +385 -0
- package/src/shared/rte-shape.util.ts +29 -0
- package/src/shared/side-bar/store/side-bar-store.test.ts +27 -1
- package/src/shared/side-bar/store/side-bar-store.ts +11 -0
- package/src/shared/style-settings/components/StyleSettings.mixin.ts +7 -3
- package/src/shared/style-settings/components/StyleSettings.test.ts +116 -0
- package/src/shared/style-settings/components/StyleSettings.vue +75 -25
- package/src/shared/style-settings/components/i18n/style-settings.de-DE.json +32 -20
- package/src/shared/style-settings/components/i18n/style-settings.es-ES.json +32 -20
- package/src/shared/style-settings/components/i18n/style-settings.fr-CA.json +32 -20
- package/src/shared/style-settings/components/i18n/style-settings.fr-FR.json +32 -20
- package/src/shared/style-settings/components/i18n/style-settings.json +13 -3
- package/src/shared/style-settings/components/i18n/style-settings.pt-BR.json +32 -20
- package/src/shared/style-settings/components/i18n/style-settings.pt-PT.json +32 -20
- package/src/shared/style-settings/components/text-style-options-settings-with-state/TextStyleOptionsSettingsWithState.vue +14 -34
- package/src/shared/style-settings/store/style-settings-store.ts +3 -49
- package/src/shared/style-settings/text-style-size-order.test.ts +76 -0
- package/src/shared/style-settings/text-style-size-order.ts +28 -0
- package/src/shared/template-settings/components/TemplatesSettings.vue +4 -0
- package/src/shared/text-role-typography.util.ts +277 -0
- package/src/utils/minify-brand-page-metadata.test.ts +102 -7
- package/src/utils/minify-brand-page-metadata.ts +62 -8
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/AutoLink.d.ts +0 -2
- package/lib/src/brand-page-maker/composables/rich-text-editor/getRteExtensions.d.ts +0 -28
- package/lib/src/brand-page-maker/utils/rte-render.util.d.ts +0 -63
- package/lib/src/brand-page-maker/utils/rte-render.util.js +0 -106
- package/lib/src/brand-page-maker/utils/rte-shape.d.ts +0 -18
- package/lib/src/brand-page-maker/utils/rte-shape.js +0 -21
- package/lib/src/metadata-builder/builders/global-font-propagation.d.ts +0 -41
- package/lib/src/metadata-builder/builders/global-font-propagation.js +0 -146
- package/src/brand-page-maker/utils/rte-render.util.ts +0 -179
- package/src/brand-page-maker/utils/rte-shape.ts +0 -29
- package/src/metadata-builder/builders/global-font-propagation.test.ts +0 -401
- package/src/metadata-builder/builders/global-font-propagation.ts +0 -238
- package/src/shared/style-settings/components/StyleSettingsSection.vue +0 -8
- /package/lib/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/FontFamily.d.ts +0 -0
- /package/lib/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/FontFamily.js +0 -0
- /package/lib/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/LetterSpacing.d.ts +0 -0
- /package/lib/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/LetterSpacing.js +0 -0
- /package/lib/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/MaxLength.d.ts +0 -0
- /package/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/FontFamily.ts +0 -0
- /package/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/LetterSpacing.ts +0 -0
|
@@ -0,0 +1,525 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import {
|
|
3
|
+
buildTextRoleRootCss,
|
|
4
|
+
buildTextRoleRootCssText,
|
|
5
|
+
buildTextRoleScopedCss,
|
|
6
|
+
buildTextRoleScopedCssText,
|
|
7
|
+
textRoleClassName,
|
|
8
|
+
cssFontFamilyValue,
|
|
9
|
+
fillRteRunTypography,
|
|
10
|
+
roleTypographyStyle,
|
|
11
|
+
TEXT_ROLE_STYLE_ATTRIBUTE,
|
|
12
|
+
TEXT_ROLE_SCOPED_ATTRIBUTE,
|
|
13
|
+
} from './text-role-css.util';
|
|
14
|
+
import { TextStyles, CANONICAL_TEXT_STYLE_TYPES } from '../models/styles.model';
|
|
15
|
+
|
|
16
|
+
// Minimal Tiptap doc with one paragraph of runs; each run's marks are passed through.
|
|
17
|
+
const docWith = (
|
|
18
|
+
...runs: { text: string; marks?: { type: string; attrs?: object }[] }[]
|
|
19
|
+
) => ({
|
|
20
|
+
type: 'doc',
|
|
21
|
+
content: [
|
|
22
|
+
{
|
|
23
|
+
type: 'paragraph',
|
|
24
|
+
content: runs.map((r) => ({
|
|
25
|
+
type: 'text',
|
|
26
|
+
text: r.text,
|
|
27
|
+
marks: r.marks,
|
|
28
|
+
})),
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const firstRunMark = (doc: ReturnType<typeof docWith>) =>
|
|
34
|
+
(doc.content[0].content[0].marks ?? []).find(
|
|
35
|
+
(m) => m.type === 'textStyle',
|
|
36
|
+
) as { type: string; attrs: Record<string, string> } | undefined;
|
|
37
|
+
|
|
38
|
+
const defaultOptions = () => TextStyles.GetDefaultTextStyle().textStyleOptions;
|
|
39
|
+
|
|
40
|
+
describe('text-role-css.util', () => {
|
|
41
|
+
describe('buildTextRoleRootCss', () => {
|
|
42
|
+
it('emits one class rule per canonical role, typography only, at :root scope', () => {
|
|
43
|
+
const css = buildTextRoleRootCss(defaultOptions());
|
|
44
|
+
|
|
45
|
+
expect(css).toContain(`<style ${TEXT_ROLE_STYLE_ATTRIBUTE}>`);
|
|
46
|
+
// every canonical role gets a global (unscoped) class rule
|
|
47
|
+
CANONICAL_TEXT_STYLE_TYPES.forEach((type) => {
|
|
48
|
+
expect(css).toContain(`.${textRoleClassName(type)} {`);
|
|
49
|
+
});
|
|
50
|
+
// BP-5969: the class emits var DEFINITIONS ONLY — it applies nothing (application is per-run
|
|
51
|
+
// in RTE, or on the plain-text element). weight is now var-backed too (--role-font-weight), so a
|
|
52
|
+
// role weight edit repaints linked RTE via the cascade. Weight/style/decoration/letter-spacing
|
|
53
|
+
// fall back to their CSS-neutral default (normal/none) when the role omits them, so a linked
|
|
54
|
+
// run's `var(--role-<x>)` always resolves instead of inheriting.
|
|
55
|
+
expect(css).toContain(
|
|
56
|
+
`.bp-text-role-heading1 { --role-font-family: Lato; --role-font-size: 6.875em; --role-font-weight: bold; --role-font-style: normal; --role-line-height: 1.2; --role-letter-spacing: normal; --role-text-decoration: none; }`,
|
|
57
|
+
);
|
|
58
|
+
expect(css).toContain(
|
|
59
|
+
`.bp-text-role-button { --role-font-family: Lato; --role-font-size: 1em; --role-font-weight: normal; --role-font-style: normal; --role-line-height: 1.2; --role-letter-spacing: normal; --role-text-decoration: none; }`,
|
|
60
|
+
);
|
|
61
|
+
// the class must APPLY nothing — no `prop: value` / `prop: var(...)`, only `--role-*:` decls
|
|
62
|
+
expect(css).not.toMatch(/[^-]font-family:/);
|
|
63
|
+
expect(css).not.toMatch(/[^-]font-size:/);
|
|
64
|
+
expect(css).not.toMatch(/[^-]font-weight:/);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('provides the CSS text Page keeps in its native style node', () => {
|
|
68
|
+
const css = buildTextRoleRootCssText(defaultOptions());
|
|
69
|
+
|
|
70
|
+
expect(css).toContain('.bp-text-role-heading1 {');
|
|
71
|
+
expect(css).not.toContain('<style');
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('emits the CSS-neutral default for weight/style/decoration/spacing a role omits', () => {
|
|
75
|
+
const css = buildTextRoleRootCss(defaultOptions());
|
|
76
|
+
|
|
77
|
+
// The default roles set none of style/decoration/letter-spacing, so every rule must still
|
|
78
|
+
// define those vars at their neutral default — otherwise a linked run's `var(--role-<x>)`
|
|
79
|
+
// resolves to the inherited value, not the CSS default the role intends.
|
|
80
|
+
CANONICAL_TEXT_STYLE_TYPES.forEach((type) => {
|
|
81
|
+
const rule = css
|
|
82
|
+
.split('\n')
|
|
83
|
+
.find((line) => line.includes(`.${textRoleClassName(type)} {`));
|
|
84
|
+
|
|
85
|
+
expect(rule).toContain('--role-font-style: normal;');
|
|
86
|
+
expect(rule).toContain('--role-text-decoration: none;');
|
|
87
|
+
expect(rule).toContain('--role-letter-spacing: normal;');
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('keeps an explicit role value over the neutral default', () => {
|
|
92
|
+
const css = buildTextRoleRootCss(defaultOptions());
|
|
93
|
+
const heading1 = css
|
|
94
|
+
.split('\n')
|
|
95
|
+
.find((line) => line.includes('.bp-text-role-heading1 {'));
|
|
96
|
+
|
|
97
|
+
// heading1 sets weight bold explicitly — the neutral 'normal' must not clobber it.
|
|
98
|
+
expect(heading1).toContain('--role-font-weight: bold;');
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('emits role-aware RTE decoration classes instead of relying on inline precedence', () => {
|
|
102
|
+
const options = defaultOptions();
|
|
103
|
+
|
|
104
|
+
options.heading2.style.textDecoration = 'underline';
|
|
105
|
+
|
|
106
|
+
const css = buildTextRoleRootCss(options);
|
|
107
|
+
|
|
108
|
+
expect(css).toContain(
|
|
109
|
+
'.bp-text-role-heading2 .bp-rte-text-decoration-linethrough { text-decoration: underline line-through; }',
|
|
110
|
+
);
|
|
111
|
+
expect(css).toContain(
|
|
112
|
+
'.bp-text-role-heading2 .bp-rte-text-decoration-none { text-decoration: none; }',
|
|
113
|
+
);
|
|
114
|
+
expect(css).toContain(
|
|
115
|
+
'.bp-text-role-heading2 .bp-rte-text-decoration-inherit { text-decoration: underline; }',
|
|
116
|
+
);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('strips characters that could close the SSR style element from a role value, even if validation is bypassed (defence in depth, N5)', () => {
|
|
120
|
+
const options = defaultOptions();
|
|
121
|
+
const tampered = {
|
|
122
|
+
...options,
|
|
123
|
+
heading1: {
|
|
124
|
+
...options.heading1,
|
|
125
|
+
style: {
|
|
126
|
+
...options.heading1.style,
|
|
127
|
+
fontWeight: '700}</style><script>alert(1)</script>',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const css = buildTextRoleRootCss(tampered as typeof options);
|
|
133
|
+
const rule = css
|
|
134
|
+
.split('\n')
|
|
135
|
+
.find((line) => line.includes('.bp-text-role-heading1 {'));
|
|
136
|
+
|
|
137
|
+
expect(rule).not.toContain('<script>');
|
|
138
|
+
expect(rule).not.toContain('</style>');
|
|
139
|
+
expect(rule).not.toMatch(/[<>]/);
|
|
140
|
+
expect(rule).toMatch(/--role-font-weight: 700\w*;/);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('allows only family-name characters in SSR CSS declarations', () => {
|
|
144
|
+
const options = defaultOptions();
|
|
145
|
+
const tampered = {
|
|
146
|
+
...options,
|
|
147
|
+
heading1: {
|
|
148
|
+
...options.heading1,
|
|
149
|
+
style: {
|
|
150
|
+
...options.heading1.style,
|
|
151
|
+
fontFamily: 'A/* font\\name',
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const css = buildTextRoleRootCss(tampered as typeof options);
|
|
157
|
+
const rule = css
|
|
158
|
+
.split('\n')
|
|
159
|
+
.find((line) => line.includes('.bp-text-role-heading1 {'));
|
|
160
|
+
|
|
161
|
+
expect(rule).toContain('--role-font-family: A fontname;');
|
|
162
|
+
expect(rule).not.toMatch(/[/*"\\]/);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('never emits colour (colour flows through the existing cascade)', () => {
|
|
166
|
+
const css = buildTextRoleRootCss(defaultOptions());
|
|
167
|
+
|
|
168
|
+
expect(css).not.toMatch(/colou?r\s*:/i);
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
it('does not emit rules for the legacy roles', () => {
|
|
172
|
+
const css = buildTextRoleRootCss(defaultOptions());
|
|
173
|
+
|
|
174
|
+
['titles', 'headings', 'paragraphs', 'buttons'].forEach((legacy) => {
|
|
175
|
+
expect(css).not.toContain(`bp-text-role-${legacy} {`);
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
describe('buildTextRoleScopedCss', () => {
|
|
181
|
+
it('prefixes every rule with the page-scope selector', () => {
|
|
182
|
+
const css = buildTextRoleScopedCss(defaultOptions(), 'bp-page-scope-7');
|
|
183
|
+
|
|
184
|
+
expect(css).toContain(`<style ${TEXT_ROLE_SCOPED_ATTRIBUTE}>`);
|
|
185
|
+
expect(css).toContain(
|
|
186
|
+
`[data-page-scope="bp-page-scope-7"] .bp-text-role-heading1 {`,
|
|
187
|
+
);
|
|
188
|
+
expect(css).toContain(
|
|
189
|
+
'[data-page-scope="bp-page-scope-7"] .bp-text-role-heading1 .bp-rte-text-decoration-linethrough {',
|
|
190
|
+
);
|
|
191
|
+
expect(
|
|
192
|
+
buildTextRoleScopedCssText(defaultOptions(), 'bp-page-scope-7'),
|
|
193
|
+
).not.toContain('<style');
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it('returns empty string when no scope id is given', () => {
|
|
197
|
+
expect(buildTextRoleScopedCss(defaultOptions(), '')).toBe('');
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
describe('cssFontFamilyValue', () => {
|
|
202
|
+
it('leaves valid-identifier families unquoted (single and multi-word)', () => {
|
|
203
|
+
expect(cssFontFamilyValue('Lato')).toBe('Lato');
|
|
204
|
+
expect(cssFontFamilyValue('Playwrite AT')).toBe('Playwrite AT');
|
|
205
|
+
expect(cssFontFamilyValue('sans-serif')).toBe('sans-serif');
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it('quotes a family with a number token (invalid unquoted)', () => {
|
|
209
|
+
// `Exo 2` unquoted is `Exo` + number `2` → CSS drops the whole declaration → falls back.
|
|
210
|
+
expect(cssFontFamilyValue('Exo 2')).toBe('"Exo 2"');
|
|
211
|
+
expect(cssFontFamilyValue('M PLUS 1')).toBe('"M PLUS 1"');
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
it('passes through already-quoted values and var refs', () => {
|
|
215
|
+
expect(cssFontFamilyValue('"Exo 2"')).toBe('"Exo 2"');
|
|
216
|
+
expect(cssFontFamilyValue('var(--role-font-family)')).toBe(
|
|
217
|
+
'var(--role-font-family)',
|
|
218
|
+
);
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
it('quotes per-family in a comma-separated stack', () => {
|
|
222
|
+
expect(cssFontFamilyValue('Exo 2, Lato, sans-serif')).toBe(
|
|
223
|
+
'"Exo 2", Lato, sans-serif',
|
|
224
|
+
);
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
describe('fillRteRunTypography', () => {
|
|
229
|
+
const role = {
|
|
230
|
+
fontFamily: 'Lato',
|
|
231
|
+
fontSize: '5.25em',
|
|
232
|
+
lineHeight: '1.2',
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
it('fills a bare run with a role ref for every var-backed attr (the default is the role var)', () => {
|
|
236
|
+
const filled = fillRteRunTypography(
|
|
237
|
+
docWith({ text: 'x' }) as never,
|
|
238
|
+
role,
|
|
239
|
+
undefined,
|
|
240
|
+
) as ReturnType<typeof docWith>;
|
|
241
|
+
|
|
242
|
+
// Every attr defaults to its role var — including weight/style/decoration/letter-spacing the
|
|
243
|
+
// role leaves unset (their var is undefined → CSS default now, but a later role edit repaints).
|
|
244
|
+
expect(firstRunMark(filled)?.attrs).toEqual({
|
|
245
|
+
fontFamily: 'var(--role-font-family)',
|
|
246
|
+
fontSize: 'var(--role-font-size)',
|
|
247
|
+
lineHeight: 'var(--role-line-height)',
|
|
248
|
+
letterSpacing: 'var(--role-letter-spacing)',
|
|
249
|
+
fontWeight: 'var(--role-font-weight)',
|
|
250
|
+
fontStyle: 'var(--role-font-style)',
|
|
251
|
+
textDecoration: 'var(--role-text-decoration)',
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it('follows the role for weight/decoration when the block value is the inert neutral', () => {
|
|
256
|
+
// Block carries the default `font-weight: normal` / `text-decoration: none` (every style object
|
|
257
|
+
// does). These are NOT overrides, so the run references the role → a role edit reaches it.
|
|
258
|
+
const filled = fillRteRunTypography(
|
|
259
|
+
docWith({ text: 'x' }) as never,
|
|
260
|
+
role,
|
|
261
|
+
{
|
|
262
|
+
fontWeight: 'normal',
|
|
263
|
+
textDecoration: 'none',
|
|
264
|
+
},
|
|
265
|
+
) as ReturnType<typeof docWith>;
|
|
266
|
+
|
|
267
|
+
const attrs = firstRunMark(filled)?.attrs;
|
|
268
|
+
|
|
269
|
+
expect(attrs?.fontWeight).toBe('var(--role-font-weight)');
|
|
270
|
+
expect(attrs?.textDecoration).toBe('var(--role-text-decoration)');
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
it('pins a non-neutral block override for weight/decoration as a literal', () => {
|
|
274
|
+
const filled = fillRteRunTypography(
|
|
275
|
+
docWith({ text: 'x' }) as never,
|
|
276
|
+
role,
|
|
277
|
+
{
|
|
278
|
+
fontWeight: 'bold',
|
|
279
|
+
textDecoration: 'underline',
|
|
280
|
+
},
|
|
281
|
+
) as ReturnType<typeof docWith>;
|
|
282
|
+
|
|
283
|
+
const attrs = firstRunMark(filled)?.attrs;
|
|
284
|
+
|
|
285
|
+
expect(attrs?.fontWeight).toBe('bold'); // deliberate, differs from role + neutral → literal
|
|
286
|
+
expect(attrs?.textDecoration).toBe('underline');
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
it('drops a stale reset marker when it fills the decoration from the block', () => {
|
|
290
|
+
const filled = fillRteRunTypography(
|
|
291
|
+
docWith({
|
|
292
|
+
text: 'x',
|
|
293
|
+
marks: [
|
|
294
|
+
{
|
|
295
|
+
type: 'textStyle',
|
|
296
|
+
attrs: {
|
|
297
|
+
textDecoration: 'var(--role-text-decoration)',
|
|
298
|
+
textDecorationReset: true,
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
],
|
|
302
|
+
}) as never,
|
|
303
|
+
{ ...role, textDecoration: 'underline' },
|
|
304
|
+
{ textDecoration: 'line-through' },
|
|
305
|
+
) as ReturnType<typeof docWith>;
|
|
306
|
+
|
|
307
|
+
const attrs = firstRunMark(filled)?.attrs;
|
|
308
|
+
|
|
309
|
+
expect(attrs?.textDecoration).toBe('line-through');
|
|
310
|
+
expect(attrs).not.toHaveProperty('textDecorationReset');
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
it('bakes a block-level override as a literal, quoting a digit font-family', () => {
|
|
314
|
+
const filled = fillRteRunTypography(
|
|
315
|
+
docWith({ text: 'x' }) as never,
|
|
316
|
+
role,
|
|
317
|
+
{ fontFamily: 'Exo 2', fontSize: '1.5em', lineHeight: '1.2' },
|
|
318
|
+
) as ReturnType<typeof docWith>;
|
|
319
|
+
|
|
320
|
+
const attrs = firstRunMark(filled)?.attrs;
|
|
321
|
+
|
|
322
|
+
// block override differs from role → literal (font-family quoted so `Exo 2` stays valid)
|
|
323
|
+
expect(attrs?.fontFamily).toBe('"Exo 2"');
|
|
324
|
+
expect(attrs?.fontSize).toBe('1.5em');
|
|
325
|
+
// block value equals role → a re-linkable ref, so a role edit still flows
|
|
326
|
+
expect(attrs?.lineHeight).toBe('var(--role-line-height)');
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
it('keeps an existing per-run override (ref or literal) untouched', () => {
|
|
330
|
+
const filled = fillRteRunTypography(
|
|
331
|
+
docWith({
|
|
332
|
+
text: 'x',
|
|
333
|
+
marks: [
|
|
334
|
+
{ type: 'textStyle', attrs: { fontSize: '9em', color: 'red' } },
|
|
335
|
+
],
|
|
336
|
+
}) as never,
|
|
337
|
+
role,
|
|
338
|
+
{ fontSize: '1.5em' },
|
|
339
|
+
) as ReturnType<typeof docWith>;
|
|
340
|
+
|
|
341
|
+
const attrs = firstRunMark(filled)?.attrs;
|
|
342
|
+
|
|
343
|
+
expect(attrs?.fontSize).toBe('9em'); // per-run override wins over block + role
|
|
344
|
+
expect(attrs?.color).toBe('red'); // colour untouched
|
|
345
|
+
expect(attrs?.fontFamily).toBe('var(--role-font-family)'); // absent attr still filled
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
it('bakes literals (not refs) when no role is in scope', () => {
|
|
349
|
+
const filled = fillRteRunTypography(
|
|
350
|
+
docWith({ text: 'x' }) as never,
|
|
351
|
+
undefined,
|
|
352
|
+
{
|
|
353
|
+
fontFamily: 'Exo 2',
|
|
354
|
+
fontSize: '1.5em',
|
|
355
|
+
},
|
|
356
|
+
) as ReturnType<typeof docWith>;
|
|
357
|
+
|
|
358
|
+
expect(firstRunMark(filled)?.attrs).toEqual({
|
|
359
|
+
fontFamily: '"Exo 2"',
|
|
360
|
+
fontSize: '1.5em',
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
it('does not mutate the input doc', () => {
|
|
365
|
+
const doc = docWith({ text: 'x' });
|
|
366
|
+
const snapshot = JSON.stringify(doc);
|
|
367
|
+
|
|
368
|
+
fillRteRunTypography(doc as never, role, undefined);
|
|
369
|
+
expect(JSON.stringify(doc)).toBe(snapshot);
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
it('returns the original document when every run already has its filled attrs', () => {
|
|
373
|
+
const doc = docWith({
|
|
374
|
+
text: 'x',
|
|
375
|
+
marks: [
|
|
376
|
+
{
|
|
377
|
+
type: 'textStyle',
|
|
378
|
+
attrs: {
|
|
379
|
+
fontFamily: 'var(--role-font-family)',
|
|
380
|
+
fontSize: 'var(--role-font-size)',
|
|
381
|
+
lineHeight: 'var(--role-line-height)',
|
|
382
|
+
letterSpacing: 'var(--role-letter-spacing)',
|
|
383
|
+
fontWeight: 'var(--role-font-weight)',
|
|
384
|
+
fontStyle: 'var(--role-font-style)',
|
|
385
|
+
textDecoration: 'var(--role-text-decoration)',
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
],
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
expect(fillRteRunTypography(doc as never, role, undefined)).toBe(doc);
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
it('copies only the path containing a run it fills', () => {
|
|
395
|
+
const doc = {
|
|
396
|
+
type: 'doc',
|
|
397
|
+
content: [
|
|
398
|
+
{
|
|
399
|
+
type: 'paragraph',
|
|
400
|
+
content: [{ type: 'text', text: 'needs fill' }],
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
type: 'paragraph',
|
|
404
|
+
content: [
|
|
405
|
+
{
|
|
406
|
+
type: 'text',
|
|
407
|
+
text: 'already filled',
|
|
408
|
+
marks: [
|
|
409
|
+
{
|
|
410
|
+
type: 'textStyle',
|
|
411
|
+
attrs: {
|
|
412
|
+
fontFamily: 'var(--role-font-family)',
|
|
413
|
+
fontSize: 'var(--role-font-size)',
|
|
414
|
+
lineHeight: 'var(--role-line-height)',
|
|
415
|
+
letterSpacing: 'var(--role-letter-spacing)',
|
|
416
|
+
fontWeight: 'var(--role-font-weight)',
|
|
417
|
+
fontStyle: 'var(--role-font-style)',
|
|
418
|
+
textDecoration: 'var(--role-text-decoration)',
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
],
|
|
422
|
+
},
|
|
423
|
+
],
|
|
424
|
+
},
|
|
425
|
+
],
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
const filled = fillRteRunTypography(
|
|
429
|
+
doc as never,
|
|
430
|
+
role,
|
|
431
|
+
undefined,
|
|
432
|
+
) as typeof doc;
|
|
433
|
+
|
|
434
|
+
expect(filled).not.toBe(doc);
|
|
435
|
+
expect(filled.content[0]).not.toBe(doc.content[0]);
|
|
436
|
+
expect(filled.content[1]).toBe(doc.content[1]);
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
it('honours a stored off value under a role that sets it', () => {
|
|
440
|
+
// D3: HEAD compares the block value only against the CSS-neutral, so a role that sets
|
|
441
|
+
// bold sees the block's stored `normal` as equal-to-neutral (not an override) and still
|
|
442
|
+
// refs the role — losing the deliberate "not bold". The fix compares against what the
|
|
443
|
+
// role actually resolves to (its own value, else the neutral).
|
|
444
|
+
const boldRole = { ...role, fontWeight: 'bold' };
|
|
445
|
+
const filled = fillRteRunTypography(
|
|
446
|
+
docWith({ text: 'x' }) as never,
|
|
447
|
+
boldRole,
|
|
448
|
+
{ fontWeight: 'normal' },
|
|
449
|
+
) as ReturnType<typeof docWith>;
|
|
450
|
+
|
|
451
|
+
expect(firstRunMark(filled)?.attrs?.fontWeight).toBe('normal');
|
|
452
|
+
});
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
describe('roleTypographyStyle', () => {
|
|
456
|
+
const role = {
|
|
457
|
+
fontFamily: 'Lato',
|
|
458
|
+
fontSize: '5.25em',
|
|
459
|
+
fontWeight: 'bold',
|
|
460
|
+
lineHeight: '1.2',
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
it('refs every role-defined property the block does not override', () => {
|
|
464
|
+
expect(roleTypographyStyle({ fontSize: '2em' }, role)).toEqual({
|
|
465
|
+
fontFamily: 'var(--role-font-family)',
|
|
466
|
+
fontSize: '2em',
|
|
467
|
+
fontWeight: 'var(--role-font-weight)',
|
|
468
|
+
lineHeight: 'var(--role-line-height)',
|
|
469
|
+
});
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
it('refs a property whose own value equals the role', () => {
|
|
473
|
+
expect(roleTypographyStyle({ fontFamily: 'Lato' }, role).fontFamily).toBe(
|
|
474
|
+
'var(--role-font-family)',
|
|
475
|
+
);
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
it('drops an omitted property even when the role defines it', () => {
|
|
479
|
+
expect(
|
|
480
|
+
roleTypographyStyle({ fontSize: '2em' }, role, {
|
|
481
|
+
omit: ['fontSize'],
|
|
482
|
+
}),
|
|
483
|
+
).toEqual({
|
|
484
|
+
fontFamily: 'var(--role-font-family)',
|
|
485
|
+
fontWeight: 'var(--role-font-weight)',
|
|
486
|
+
lineHeight: 'var(--role-line-height)',
|
|
487
|
+
});
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
it('bakes own values literally with no role, quoting a digit font-family', () => {
|
|
491
|
+
expect(
|
|
492
|
+
roleTypographyStyle(
|
|
493
|
+
{ fontFamily: 'Exo 2', fontSize: '2em' },
|
|
494
|
+
undefined,
|
|
495
|
+
),
|
|
496
|
+
).toEqual({ fontFamily: '"Exo 2"', fontSize: '2em' });
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
it('quotes a digit font-family override against a role', () => {
|
|
500
|
+
expect(
|
|
501
|
+
roleTypographyStyle({ fontFamily: 'Exo 2' }, role).fontFamily,
|
|
502
|
+
).toBe('"Exo 2"');
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
// R5: the old `overrideTypographyStyle` always inlined a SET own value, unconditionally.
|
|
506
|
+
// When the role leaves a property unset, nothing else supplies it — so an own value equal
|
|
507
|
+
// to the CSS-neutral default must still bake as a literal, or an ancestor utility class
|
|
508
|
+
// (e.g. `tw-font-semibold` on a shop product name) could leak through where nothing pins it.
|
|
509
|
+
it('inlines an own value equal to the CSS-neutral default when the role leaves it unset', () => {
|
|
510
|
+
expect(
|
|
511
|
+
roleTypographyStyle(
|
|
512
|
+
{ fontStyle: 'normal', letterSpacing: 'normal' },
|
|
513
|
+
role,
|
|
514
|
+
),
|
|
515
|
+
).toEqual({
|
|
516
|
+
fontFamily: 'var(--role-font-family)',
|
|
517
|
+
fontSize: 'var(--role-font-size)',
|
|
518
|
+
fontWeight: 'var(--role-font-weight)',
|
|
519
|
+
lineHeight: 'var(--role-line-height)',
|
|
520
|
+
fontStyle: 'normal',
|
|
521
|
+
letterSpacing: 'normal',
|
|
522
|
+
});
|
|
523
|
+
});
|
|
524
|
+
});
|
|
525
|
+
});
|