@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
|
@@ -10,7 +10,20 @@ import {
|
|
|
10
10
|
} from '../brand-page/models';
|
|
11
11
|
import { resolveModelColorReferences } from '../brand-page/utils/color-palette.util';
|
|
12
12
|
import type { Content, ContentType } from '../brand-page/models/content.model';
|
|
13
|
-
import type {
|
|
13
|
+
import type {
|
|
14
|
+
TextStyleDeclaration,
|
|
15
|
+
TextStyleOption,
|
|
16
|
+
TextStyles,
|
|
17
|
+
} from '../brand-page/models/styles.model';
|
|
18
|
+
import {
|
|
19
|
+
CANONICAL_TEXT_STYLE_TYPES,
|
|
20
|
+
LEGACY_TEXT_STYLE_TYPES,
|
|
21
|
+
type TextStyleType,
|
|
22
|
+
} from '../brand-page/models/styles.model';
|
|
23
|
+
import {
|
|
24
|
+
DEFAULT_FONT_FAMILY_KEY,
|
|
25
|
+
FONT_FAMILY_CONFIGS,
|
|
26
|
+
} from '../brand-page/constants';
|
|
14
27
|
import { hasRTEContent, isTiptapDocument } from '../brand-page-maker/utils';
|
|
15
28
|
import { useExternalRichTextEditor } from '../brand-page-maker/composables/rich-text-editor/useRichTextEditor';
|
|
16
29
|
import type { Editor, JSONContent } from '@tiptap/vue-3';
|
|
@@ -77,6 +90,16 @@ type MinifiedPage = {
|
|
|
77
90
|
contents: MinifiedContent[];
|
|
78
91
|
};
|
|
79
92
|
|
|
93
|
+
/**
|
|
94
|
+
* The canonical roles are the source of truth. The four legacy options and the retired root text
|
|
95
|
+
* colour remain in the outbound payload temporarily because the deployed AI pipeline still reads
|
|
96
|
+
* them for contrast repair. Remove this compatibility shape only after pipeline PR #664 ships.
|
|
97
|
+
*/
|
|
98
|
+
type MinifiedTextStyles = {
|
|
99
|
+
textStyleOptions: Partial<Record<TextStyleType, TextStyleOption>>;
|
|
100
|
+
style?: { color?: string };
|
|
101
|
+
};
|
|
102
|
+
|
|
80
103
|
export interface MinifiedBrandPageMetadata {
|
|
81
104
|
brandPageType: BrandPageType;
|
|
82
105
|
v: number;
|
|
@@ -85,7 +108,9 @@ export interface MinifiedBrandPageMetadata {
|
|
|
85
108
|
* a concrete value, so the lookup table only costs tokens and invites the LLM
|
|
86
109
|
* echoing a `palette-…` id back at us.
|
|
87
110
|
*/
|
|
88
|
-
styles: Omit<PageStyles, 'colors'
|
|
111
|
+
styles: Omit<PageStyles, 'colors' | 'textStyles'> & {
|
|
112
|
+
textStyles: MinifiedTextStyles;
|
|
113
|
+
};
|
|
89
114
|
pages: MinifiedPage[];
|
|
90
115
|
nav: NavModel;
|
|
91
116
|
footer?: {
|
|
@@ -601,11 +626,22 @@ const minifyHeaderBackgroundStyle = (
|
|
|
601
626
|
|
|
602
627
|
const minifyHeader = (
|
|
603
628
|
header: AbstractPageHeaderStyles | undefined | null,
|
|
629
|
+
textStyles: TextStyles | undefined,
|
|
604
630
|
logoAssetKey?: string,
|
|
605
631
|
): MinifiedHeader | undefined => {
|
|
606
632
|
if (!header) return undefined;
|
|
607
633
|
|
|
608
634
|
const nav = header.navigation;
|
|
635
|
+
const navStyle = nav?.defaultButtonStyle;
|
|
636
|
+
// A linked nav stores only what differs from its role, so its font may be the role's, else the
|
|
637
|
+
// page root's Lato.
|
|
638
|
+
const navFontFamily =
|
|
639
|
+
navStyle?.fontFamily ||
|
|
640
|
+
(navStyle?.textStyleType
|
|
641
|
+
? textStyles?.textStyleOptions?.[navStyle.textStyleType]?.style
|
|
642
|
+
?.fontFamily
|
|
643
|
+
: undefined) ||
|
|
644
|
+
FONT_FAMILY_CONFIGS[DEFAULT_FONT_FAMILY_KEY].name;
|
|
609
645
|
|
|
610
646
|
return {
|
|
611
647
|
displayStyle: header.displayStyle || undefined,
|
|
@@ -617,11 +653,8 @@ const minifyHeader = (
|
|
|
617
653
|
navigation: nav
|
|
618
654
|
? {
|
|
619
655
|
displayType: nav.displayType || undefined,
|
|
620
|
-
defaultButtonStyle:
|
|
621
|
-
? {
|
|
622
|
-
color: nav.defaultButtonStyle.color,
|
|
623
|
-
fontFamily: nav.defaultButtonStyle.fontFamily,
|
|
624
|
-
}
|
|
656
|
+
defaultButtonStyle: navStyle
|
|
657
|
+
? { color: navStyle.color, fontFamily: navFontFamily }
|
|
625
658
|
: undefined,
|
|
626
659
|
selectedButtonStyle: nav.selectedButtonStyle || undefined,
|
|
627
660
|
hamburgerMenuStyle: nav.hamburgerMenuStyle
|
|
@@ -632,6 +665,22 @@ const minifyHeader = (
|
|
|
632
665
|
};
|
|
633
666
|
};
|
|
634
667
|
|
|
668
|
+
/**
|
|
669
|
+
* A fresh copy, never the source model. The deployed pipeline still uses the legacy role/root-colour
|
|
670
|
+
* shape for contrast repair, so preserve it in the outbound payload until #664 is deployed.
|
|
671
|
+
*/
|
|
672
|
+
const minifyTextStyles = (
|
|
673
|
+
textStyles: TextStyles | undefined,
|
|
674
|
+
): MinifiedTextStyles => ({
|
|
675
|
+
textStyleOptions: Object.fromEntries(
|
|
676
|
+
[...CANONICAL_TEXT_STYLE_TYPES, ...LEGACY_TEXT_STYLE_TYPES]
|
|
677
|
+
.map((role) => [role, textStyles?.textStyleOptions?.[role]])
|
|
678
|
+
.filter(([, option]) => option !== undefined),
|
|
679
|
+
) as Partial<Record<TextStyleType, TextStyleOption>>,
|
|
680
|
+
style: (textStyles as unknown as { style?: { color?: string } } | undefined)
|
|
681
|
+
?.style,
|
|
682
|
+
});
|
|
683
|
+
|
|
635
684
|
const minifyPage = (
|
|
636
685
|
page: PageModel,
|
|
637
686
|
nav: NavModel,
|
|
@@ -661,7 +710,10 @@ export const minifyBrandPageMetadata = (
|
|
|
661
710
|
const result: MinifiedBrandPageMetadata = {
|
|
662
711
|
brandPageType: model.brandPageType || BRAND_PAGE_TYPES.default,
|
|
663
712
|
v: model.v,
|
|
664
|
-
styles:
|
|
713
|
+
styles: {
|
|
714
|
+
...stylesWithoutPalette,
|
|
715
|
+
textStyles: minifyTextStyles(stylesWithoutPalette.textStyles),
|
|
716
|
+
},
|
|
665
717
|
pages: model.pages.map((p) =>
|
|
666
718
|
minifyPage(p, model.nav, externalEditor, assets),
|
|
667
719
|
),
|
|
@@ -690,6 +742,7 @@ export const minifyBrandPageMetadata = (
|
|
|
690
742
|
},
|
|
691
743
|
pageHeaderDesktop: minifyHeader(
|
|
692
744
|
model.pageHeaderDesktop,
|
|
745
|
+
model.styles?.textStyles,
|
|
693
746
|
findAssetKey(
|
|
694
747
|
assets,
|
|
695
748
|
resolveLogoData(
|
|
@@ -700,6 +753,7 @@ export const minifyBrandPageMetadata = (
|
|
|
700
753
|
),
|
|
701
754
|
pageHeaderMobile: minifyHeader(
|
|
702
755
|
model.pageHeaderMobile,
|
|
756
|
+
model.styles?.textStyles,
|
|
703
757
|
findAssetKey(
|
|
704
758
|
assets,
|
|
705
759
|
resolveLogoData(
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { Extensions } from '@tiptap/vue-3';
|
|
2
|
-
/**
|
|
3
|
-
* Single source of truth for the Tiptap extension set (BP-5787).
|
|
4
|
-
*
|
|
5
|
-
* The live editor, the headless serialiser (useExternalRichTextEditor), and
|
|
6
|
-
* the upcoming render-from-JSON path must all use the SAME extensions, or
|
|
7
|
-
* rendered output drifts from what the user authored. This factory removes the
|
|
8
|
-
* previous duplication while preserving each consumer's exact configuration.
|
|
9
|
-
*
|
|
10
|
-
* Known, intentional differences are parameterised:
|
|
11
|
-
* - `restrictStarterKit` — the live editor disables list/hr/code nodes.
|
|
12
|
-
* - `editing` — only the live editor carries the Placeholder + MaxLength plugins
|
|
13
|
-
* (neither affects serialised output; they are editing-time only).
|
|
14
|
-
*
|
|
15
|
-
* Link target/rel are NOT parameterised: they are a pure function of the href
|
|
16
|
-
* applied in the Link mark's renderHTML (below), so every consumer — live
|
|
17
|
-
* editor, static renderer, schema check — emits identical link markup.
|
|
18
|
-
*/
|
|
19
|
-
export interface RteExtensionOptions {
|
|
20
|
-
/** Disable StarterKit nodes the editor doesn't use (lists, hr, code). */
|
|
21
|
-
restrictStarterKit?: boolean;
|
|
22
|
-
/** When present, add the live-editing-only plugins (Placeholder, MaxLength). */
|
|
23
|
-
editing?: {
|
|
24
|
-
placeholder?: string;
|
|
25
|
-
maxLength?: number;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
export declare const getRteExtensions: (options?: RteExtensionOptions) => Extensions;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import type { JSONContent } from '@tiptap/vue-3';
|
|
2
|
-
import { isTiptapDocument, getRteJsonPlainText } from './rich-text-editor.util';
|
|
3
|
-
export { isTiptapDocument, getRteJsonPlainText };
|
|
4
|
-
/**
|
|
5
|
-
* BP-5787 — the boundary plumbing for storing RTE as Tiptap JSON.
|
|
6
|
-
*
|
|
7
|
-
* An RTE field is either a legacy inline-HTML string (pre-migration, or a
|
|
8
|
-
* not-yet-migrated published site) or a Tiptap JSON document (post-migration).
|
|
9
|
-
* These helpers let every consumer treat the two uniformly:
|
|
10
|
-
*
|
|
11
|
-
* - isTiptapDocument — the canonical discriminator (object with type 'doc').
|
|
12
|
-
* - renderRteToHtml — render either form to final HTML for display.
|
|
13
|
-
* - toRteJson — normalise either form to JSON for storage.
|
|
14
|
-
*
|
|
15
|
-
* The schema-driven core of both directions is Tiptap/ProseMirror, fed by the
|
|
16
|
-
* single-source-of-truth extension set (getRteExtensions) — so the mapping lives
|
|
17
|
-
* in the extensions' schema, not a hand-maintained copy that drifts:
|
|
18
|
-
*
|
|
19
|
-
* - renderRteToHtml uses @tiptap/static-renderer (renderToHTMLString). It is
|
|
20
|
-
* DOM-less, so it runs on the server (SSR/publish/preview), not just the
|
|
21
|
-
* browser, and needs no Editor instance.
|
|
22
|
-
* - toRteJson turns an HTML string into a DOM node with an INJECTED parser and
|
|
23
|
-
* feeds it to ProseMirror's schema-driven DOMParser. The HTML→DOM step needs
|
|
24
|
-
* a DOM parser; rather than read the global `window.DOMParser` (as Tiptap's
|
|
25
|
-
* `generateJSON` does — unusable on a pure-node server and fragile across SSR
|
|
26
|
-
* execution contexts), the parser is supplied by the caller: the native
|
|
27
|
-
* `DOMParser` in the browser, a jsdom `DOMParser` *instance* on the server
|
|
28
|
-
* (see resolveHtmlParser). No global is ever mutated, so the conversion is
|
|
29
|
-
* fully isomorphic regardless of how the SSR host bundles/executes this code.
|
|
30
|
-
*/
|
|
31
|
-
export type RichTextValue = string | JSONContent;
|
|
32
|
-
/**
|
|
33
|
-
* A `DOMParser`-compatible object: turns an HTML string into a Document whose
|
|
34
|
-
* `body` is a DOM node ProseMirror can parse. The browser's native `DOMParser`
|
|
35
|
-
* and jsdom's `DOMParser` both satisfy this, so the DOM dependency is injected
|
|
36
|
-
* rather than read from a global.
|
|
37
|
-
*/
|
|
38
|
-
export interface HtmlParser {
|
|
39
|
-
parseFromString(html: string, type: 'text/html'): Document;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Render an RTE value to final HTML. Legacy HTML strings pass through untouched
|
|
43
|
-
* (they are already HTML); Tiptap JSON is serialised by @tiptap/static-renderer
|
|
44
|
-
* from the extension schema — no editor, no DOM — so it works on the server
|
|
45
|
-
* (SSR/publish), not just the browser.
|
|
46
|
-
*/
|
|
47
|
-
export declare const renderRteToHtml: (value: RichTextValue | null | undefined) => string;
|
|
48
|
-
/**
|
|
49
|
-
* Resolve an HtmlParser for the current runtime: the native `DOMParser` in the
|
|
50
|
-
* browser (and jsdom-based test envs), or a jsdom `DOMParser` INSTANCE on a
|
|
51
|
-
* pure-node server — created and returned directly, never assigned to a global,
|
|
52
|
-
* so it is immune to SSR execution-context differences. The jsdom specifier is
|
|
53
|
-
* assembled at runtime so no bundler follows it into a browser build. Memoised
|
|
54
|
-
* on the server (JSDOM construction is relatively expensive).
|
|
55
|
-
*/
|
|
56
|
-
export declare const resolveHtmlParser: () => Promise<HtmlParser>;
|
|
57
|
-
/**
|
|
58
|
-
* Normalise an RTE value to a Tiptap JSON document. HTML strings are parsed with
|
|
59
|
-
* `parser` (defaults to the browser's native DOMParser); JSON documents pass
|
|
60
|
-
* through unchanged. Returns undefined for empty/blank input so callers can omit
|
|
61
|
-
* empty fields.
|
|
62
|
-
*/
|
|
63
|
-
export declare const toRteJson: (value: RichTextValue | null | undefined, parser?: HtmlParser) => JSONContent | undefined;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { getSchema } from '@tiptap/core';
|
|
2
|
-
import { DOMParser as ProseMirrorDOMParser } from '@tiptap/pm/model';
|
|
3
|
-
import { renderToHTMLString } from '@tiptap/static-renderer/pm/html-string';
|
|
4
|
-
import { getRteExtensions } from '../composables/rich-text-editor/getRteExtensions';
|
|
5
|
-
import { isTiptapDocument, getRteJsonPlainText } from './rich-text-editor.util';
|
|
6
|
-
export { isTiptapDocument, getRteJsonPlainText };
|
|
7
|
-
// One extension set shared by both directions (render + parse). Schema knowledge
|
|
8
|
-
// lives here, once — Tiptap/extension upgrades propagate to both automatically.
|
|
9
|
-
const RTE_EXTENSIONS = getRteExtensions();
|
|
10
|
-
// ProseMirror schema derived once from the shared extension set. This is the
|
|
11
|
-
// schema-driven heart of HTML→JSON (no drift); only the HTML→DOM step is injected.
|
|
12
|
-
const RTE_SCHEMA = getSchema(RTE_EXTENSIONS);
|
|
13
|
-
/**
|
|
14
|
-
* Render an RTE value to final HTML. Legacy HTML strings pass through untouched
|
|
15
|
-
* (they are already HTML); Tiptap JSON is serialised by @tiptap/static-renderer
|
|
16
|
-
* from the extension schema — no editor, no DOM — so it works on the server
|
|
17
|
-
* (SSR/publish), not just the browser.
|
|
18
|
-
*/
|
|
19
|
-
export const renderRteToHtml = (value) => {
|
|
20
|
-
if (value == null || value === '')
|
|
21
|
-
return '';
|
|
22
|
-
if (typeof value === 'string')
|
|
23
|
-
return value;
|
|
24
|
-
try {
|
|
25
|
-
return renderToHTMLString({ content: value, extensions: RTE_EXTENSIONS });
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
// renderToHTMLString throws on a node/mark type this renderer's schema
|
|
29
|
-
// doesn't know. The realistic trigger is version skew — the library ships to
|
|
30
|
-
// multiple apps, so a maker on a newer schema can persist a node an older
|
|
31
|
-
// deployed renderer can't render. Degrade to visible text rather than let
|
|
32
|
-
// one field throw out of its (unguarded) computed and 500 the whole page.
|
|
33
|
-
console.error('renderRteToHtml: unrenderable doc, falling back to plain text', error);
|
|
34
|
-
return getRteJsonPlainText(value);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
// Tiptap's elementFromString strips whitespace-only text nodes (pretty-print
|
|
38
|
-
// indentation between tags) before parsing; replicate it so injected-parser
|
|
39
|
-
// output stays identical to the previous generateJSON-based conversion.
|
|
40
|
-
const stripIndentationTextNodes = (node) => {
|
|
41
|
-
const children = node.childNodes;
|
|
42
|
-
for (let i = children.length - 1; i >= 0; i -= 1) {
|
|
43
|
-
const child = children[i];
|
|
44
|
-
if (child.nodeType === 3 &&
|
|
45
|
-
child.nodeValue &&
|
|
46
|
-
/^(\n\s\s|\n)$/.test(child.nodeValue)) {
|
|
47
|
-
node.removeChild(child);
|
|
48
|
-
}
|
|
49
|
-
else if (child.nodeType === 1) {
|
|
50
|
-
stripIndentationTextNodes(child);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return node;
|
|
54
|
-
};
|
|
55
|
-
const htmlToRteJson = (html, parser) => {
|
|
56
|
-
const body = parser.parseFromString(`<body>${html}</body>`, 'text/html').body;
|
|
57
|
-
const dom = stripIndentationTextNodes(body);
|
|
58
|
-
return ProseMirrorDOMParser.fromSchema(RTE_SCHEMA).parse(dom).toJSON();
|
|
59
|
-
};
|
|
60
|
-
let serverParserPromise = null;
|
|
61
|
-
/**
|
|
62
|
-
* Resolve an HtmlParser for the current runtime: the native `DOMParser` in the
|
|
63
|
-
* browser (and jsdom-based test envs), or a jsdom `DOMParser` INSTANCE on a
|
|
64
|
-
* pure-node server — created and returned directly, never assigned to a global,
|
|
65
|
-
* so it is immune to SSR execution-context differences. The jsdom specifier is
|
|
66
|
-
* assembled at runtime so no bundler follows it into a browser build. Memoised
|
|
67
|
-
* on the server (JSDOM construction is relatively expensive).
|
|
68
|
-
*/
|
|
69
|
-
export const resolveHtmlParser = async () => {
|
|
70
|
-
if (typeof DOMParser !== 'undefined')
|
|
71
|
-
return new DOMParser();
|
|
72
|
-
if (!serverParserPromise) {
|
|
73
|
-
const jsdomModuleId = ['js', 'dom'].join('');
|
|
74
|
-
serverParserPromise = import(/* @vite-ignore */ jsdomModuleId)
|
|
75
|
-
.then((mod) => {
|
|
76
|
-
const { JSDOM } = mod;
|
|
77
|
-
const { DOMParser: JsdomDOMParser } = new JSDOM('').window;
|
|
78
|
-
return new JsdomDOMParser();
|
|
79
|
-
})
|
|
80
|
-
.catch((error) => {
|
|
81
|
-
// Don't cache the failure — let a later call retry the import.
|
|
82
|
-
serverParserPromise = null;
|
|
83
|
-
throw error;
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
return serverParserPromise;
|
|
87
|
-
};
|
|
88
|
-
const getDefaultParser = () => {
|
|
89
|
-
if (typeof DOMParser !== 'undefined')
|
|
90
|
-
return new DOMParser();
|
|
91
|
-
throw new Error('toRteJson: no global DOMParser in this environment. On the server, pass an ' +
|
|
92
|
-
'explicit parser as the second argument (see resolveHtmlParser).');
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* Normalise an RTE value to a Tiptap JSON document. HTML strings are parsed with
|
|
96
|
-
* `parser` (defaults to the browser's native DOMParser); JSON documents pass
|
|
97
|
-
* through unchanged. Returns undefined for empty/blank input so callers can omit
|
|
98
|
-
* empty fields.
|
|
99
|
-
*/
|
|
100
|
-
export const toRteJson = (value, parser) => {
|
|
101
|
-
if (value == null || value === '')
|
|
102
|
-
return undefined;
|
|
103
|
-
if (isTiptapDocument(value))
|
|
104
|
-
return value;
|
|
105
|
-
return htmlToRteJson(value, parser ?? getDefaultParser());
|
|
106
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { JSONContent } from '@tiptap/vue-3';
|
|
2
|
-
/**
|
|
3
|
-
* Is this value RTE content, and in which shape?
|
|
4
|
-
*
|
|
5
|
-
* Pure predicates with NO runtime imports, kept out of `rich-text-editor.util.ts`
|
|
6
|
-
* (which pulls `dompurify` and the render helpers) so a pure consumer — the Color
|
|
7
|
-
* Matches panel, which must tell a plain string from legacy RTE HTML — doesn't drag
|
|
8
|
-
* in the editor toolchain. That module re-exports both, so callers are unchanged.
|
|
9
|
-
*/
|
|
10
|
-
/** Canonical discriminator for the JSON RTE model: an object with `type: 'doc'`. */
|
|
11
|
-
export declare const isTiptapDocument: (value: unknown) => value is JSONContent;
|
|
12
|
-
/**
|
|
13
|
-
* A legacy inline-HTML RTE string: opens with a tag and closes with one. It does
|
|
14
|
-
* NOT match plain strings (`Price < 10`), CSS values, or text with merely embedded
|
|
15
|
-
* HTML, because genuine RTE always begins with a block tag. Legacy shape only —
|
|
16
|
-
* post-migration use isTiptapDocument, or hasRTEContent for either shape.
|
|
17
|
-
*/
|
|
18
|
-
export declare const isRteHtmlString: (value: unknown) => value is string;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Is this value RTE content, and in which shape?
|
|
3
|
-
*
|
|
4
|
-
* Pure predicates with NO runtime imports, kept out of `rich-text-editor.util.ts`
|
|
5
|
-
* (which pulls `dompurify` and the render helpers) so a pure consumer — the Color
|
|
6
|
-
* Matches panel, which must tell a plain string from legacy RTE HTML — doesn't drag
|
|
7
|
-
* in the editor toolchain. That module re-exports both, so callers are unchanged.
|
|
8
|
-
*/
|
|
9
|
-
/** Canonical discriminator for the JSON RTE model: an object with `type: 'doc'`. */
|
|
10
|
-
export const isTiptapDocument = (value) => typeof value === 'object' &&
|
|
11
|
-
value !== null &&
|
|
12
|
-
value.type === 'doc';
|
|
13
|
-
/**
|
|
14
|
-
* A legacy inline-HTML RTE string: opens with a tag and closes with one. It does
|
|
15
|
-
* NOT match plain strings (`Price < 10`), CSS values, or text with merely embedded
|
|
16
|
-
* HTML, because genuine RTE always begins with a block tag. Legacy shape only —
|
|
17
|
-
* post-migration use isTiptapDocument, or hasRTEContent for either shape.
|
|
18
|
-
*/
|
|
19
|
-
export const isRteHtmlString = (value) => typeof value === 'string' &&
|
|
20
|
-
value.length > 0 &&
|
|
21
|
-
/^<[A-Za-z][A-Za-z0-9-]*\b[^>]*>[\s\S]*<\/[A-Za-z][A-Za-z0-9-]*>$/.test(value.trim());
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { JSONContent } from '@tiptap/vue-3';
|
|
2
|
-
import type { BrandPageModel } from '../../brand-page/models';
|
|
3
|
-
import type { UpdateGlobalStylesArguments } from '../parsers/ai-toolcall-parser';
|
|
4
|
-
/**
|
|
5
|
-
* Propagation of AI global font-family changes into existing section content.
|
|
6
|
-
*
|
|
7
|
-
* A `tool_update_global_styles` call merges new per-category font families into
|
|
8
|
-
* `styles.textStyles.textStyleOptions` — but only content whose style is still
|
|
9
|
-
* bound to a preset (`textStyleType`) follows that change. Template-authored
|
|
10
|
-
* content carries detached `*Style` objects AND inline `font-family` marks in
|
|
11
|
-
* its RTE HTML, both of which override the preset at render time, so a global
|
|
12
|
-
* font change was invisible on most templates (BP-5780 ISSUE-01).
|
|
13
|
-
*
|
|
14
|
-
* This module walks every page's contents and, for each text field whose
|
|
15
|
-
* resolved category received a new family, aligns the detached style object and
|
|
16
|
-
* rewrites the RTE field's inline font-family marks. Preset-bound styles are NOT
|
|
17
|
-
* detached — they already follow the preset; only their RTE inline marks are
|
|
18
|
-
* rewritten (the marks would otherwise still win over the preset).
|
|
19
|
-
*
|
|
20
|
-
* RTE fields come in two shapes: legacy inline HTML strings (rewritten through
|
|
21
|
-
* the headless Tiptap editor) and the migrated Tiptap JSON document (rewritten
|
|
22
|
-
* in place — `textStyle` mark attrs). Missing the JSON shape left every mark on
|
|
23
|
-
* the old family while the `*Style` objects moved (BP-6079).
|
|
24
|
-
*/
|
|
25
|
-
export type GlobalFontCategory = 'titles' | 'headings' | 'paragraphs' | 'buttons';
|
|
26
|
-
/** Extract the per-category families this AI call actually changes. */
|
|
27
|
-
export declare const collectChangedFontFamilies: (textStyles: UpdateGlobalStylesArguments["textStyles"]) => Partial<Record<GlobalFontCategory, string>>;
|
|
28
|
-
export type ApplyFontToRTE = (text: string, fontFamily: string) => string;
|
|
29
|
-
/**
|
|
30
|
-
* Rewrite the `fontFamily` attr of every `textStyle` mark in a Tiptap document.
|
|
31
|
-
* Only marks that already carry a family are touched: a run without one inherits
|
|
32
|
-
* the (already updated) `*Style` / preset at render, so adding a mark would pin
|
|
33
|
-
* it needlessly.
|
|
34
|
-
*/
|
|
35
|
-
export declare const applyFontToTiptapDoc: (doc: JSONContent, fontFamily: string) => JSONContent;
|
|
36
|
-
/**
|
|
37
|
-
* Walk every page's contents and propagate the changed families.
|
|
38
|
-
* `applyFont` is injectable for tests; the default rewrites inline marks via
|
|
39
|
-
* the external Tiptap editor.
|
|
40
|
-
*/
|
|
41
|
-
export declare const propagateFontFamiliesToContents: (model: BrandPageModel, changed: Partial<Record<GlobalFontCategory, string>>, applyFont?: ApplyFontToRTE) => void;
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { hasRTEContent } from '../../brand-page-maker/utils';
|
|
2
|
-
import { useExternalRichTextEditor } from '../../brand-page-maker/composables/rich-text-editor/useRichTextEditor';
|
|
3
|
-
import { applyStyleToRTEText } from '../helpers/rte.helpers';
|
|
4
|
-
import { isTiptapDocument } from '../parsers/section-tool-arguments';
|
|
5
|
-
/**
|
|
6
|
-
* Default category per text field when its style is detached (no `textStyleType`).
|
|
7
|
-
* Mirrors the AI service's slot→category stamping (titles←h1, headings←h2-h4,
|
|
8
|
-
* paragraphs←body, buttons←button). `title` upgrades to `titles` on banner
|
|
9
|
-
* sections (the hero headline) via `resolveFieldCategory`.
|
|
10
|
-
*/
|
|
11
|
-
const FIELD_DEFAULT_CATEGORY = {
|
|
12
|
-
title: 'headings',
|
|
13
|
-
heading: 'headings',
|
|
14
|
-
name: 'headings',
|
|
15
|
-
description: 'paragraphs',
|
|
16
|
-
paragraph: 'paragraphs',
|
|
17
|
-
text: 'paragraphs',
|
|
18
|
-
testimonial: 'paragraphs',
|
|
19
|
-
position: 'paragraphs',
|
|
20
|
-
question: 'headings',
|
|
21
|
-
answer: 'paragraphs',
|
|
22
|
-
buttonText: 'buttons',
|
|
23
|
-
successMessage: 'paragraphs',
|
|
24
|
-
};
|
|
25
|
-
const CATEGORIES = [
|
|
26
|
-
'titles',
|
|
27
|
-
'headings',
|
|
28
|
-
'paragraphs',
|
|
29
|
-
'buttons',
|
|
30
|
-
];
|
|
31
|
-
const isPlainObject = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
32
|
-
/** Extract the per-category families this AI call actually changes. */
|
|
33
|
-
export const collectChangedFontFamilies = (textStyles) => {
|
|
34
|
-
const changed = {};
|
|
35
|
-
if (!textStyles)
|
|
36
|
-
return changed;
|
|
37
|
-
for (const category of CATEGORIES) {
|
|
38
|
-
const family = textStyles.textStyleOptions?.[category]?.style?.fontFamily;
|
|
39
|
-
if (typeof family === 'string' && family.trim()) {
|
|
40
|
-
changed[category] = family;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
// Base text family covers paragraphs when no explicit paragraphs entry came in.
|
|
44
|
-
if (!changed.paragraphs &&
|
|
45
|
-
typeof textStyles.textFontFamily === 'string' &&
|
|
46
|
-
textStyles.textFontFamily.trim()) {
|
|
47
|
-
changed.paragraphs = textStyles.textFontFamily;
|
|
48
|
-
}
|
|
49
|
-
return changed;
|
|
50
|
-
};
|
|
51
|
-
const resolveFieldCategory = (fieldName, style, content) => {
|
|
52
|
-
const preset = isPlainObject(style)
|
|
53
|
-
? style.textStyleType
|
|
54
|
-
: undefined;
|
|
55
|
-
if (preset && CATEGORIES.includes(preset))
|
|
56
|
-
return preset;
|
|
57
|
-
if (fieldName === 'title' && content.type === 'banner-section') {
|
|
58
|
-
return 'titles';
|
|
59
|
-
}
|
|
60
|
-
return FIELD_DEFAULT_CATEGORY[fieldName];
|
|
61
|
-
};
|
|
62
|
-
/** `testimonialsStyle` → `testimonial`, `titleStyle` → `title`. */
|
|
63
|
-
const styleKeyToFieldName = (styleKey) => {
|
|
64
|
-
const base = styleKey.slice(0, -'Style'.length);
|
|
65
|
-
return base.endsWith('s') && !(base in FIELD_DEFAULT_CATEGORY)
|
|
66
|
-
? base.slice(0, -1)
|
|
67
|
-
: base;
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Rewrite the `fontFamily` attr of every `textStyle` mark in a Tiptap document.
|
|
71
|
-
* Only marks that already carry a family are touched: a run without one inherits
|
|
72
|
-
* the (already updated) `*Style` / preset at render, so adding a mark would pin
|
|
73
|
-
* it needlessly.
|
|
74
|
-
*/
|
|
75
|
-
export const applyFontToTiptapDoc = (doc, fontFamily) => {
|
|
76
|
-
const visit = (node) => {
|
|
77
|
-
const marks = node.marks?.map((mark) => mark.type === 'textStyle' && mark.attrs?.fontFamily
|
|
78
|
-
? { ...mark, attrs: { ...mark.attrs, fontFamily } }
|
|
79
|
-
: mark);
|
|
80
|
-
const content = node.content?.map(visit);
|
|
81
|
-
return {
|
|
82
|
-
...node,
|
|
83
|
-
...(marks ? { marks } : {}),
|
|
84
|
-
...(content ? { content } : {}),
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
return visit(doc);
|
|
88
|
-
};
|
|
89
|
-
const walkRecord = (record, content, changed, applyFont) => {
|
|
90
|
-
for (const [key, value] of Object.entries(record)) {
|
|
91
|
-
if (key.endsWith('Style') && isPlainObject(value)) {
|
|
92
|
-
// Detached style objects carry their own fontFamily override — align it.
|
|
93
|
-
// Preset-bound styles keep following the preset (never detach here).
|
|
94
|
-
const category = resolveFieldCategory(styleKeyToFieldName(key), value, content);
|
|
95
|
-
const family = category ? changed[category] : undefined;
|
|
96
|
-
if (family && !value.textStyleType) {
|
|
97
|
-
value.fontFamily =
|
|
98
|
-
family;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
else if (key in FIELD_DEFAULT_CATEGORY && hasRTEContent(value)) {
|
|
102
|
-
// Inline RTE marks override every style layer at render — rewrite them.
|
|
103
|
-
const category = resolveFieldCategory(key, record[`${key}Style`], content);
|
|
104
|
-
const family = category ? changed[category] : undefined;
|
|
105
|
-
if (family) {
|
|
106
|
-
record[key] = isTiptapDocument(value)
|
|
107
|
-
? applyFontToTiptapDoc(value, family)
|
|
108
|
-
: applyFont(value, family);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
else if (Array.isArray(value)) {
|
|
112
|
-
for (const item of value) {
|
|
113
|
-
if (isPlainObject(item)) {
|
|
114
|
-
walkRecord(item, content, changed, applyFont);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Walk every page's contents and propagate the changed families.
|
|
122
|
-
* `applyFont` is injectable for tests; the default rewrites inline marks via
|
|
123
|
-
* the external Tiptap editor.
|
|
124
|
-
*/
|
|
125
|
-
export const propagateFontFamiliesToContents = (model, changed, applyFont) => {
|
|
126
|
-
if (!Object.keys(changed).length)
|
|
127
|
-
return;
|
|
128
|
-
let editor;
|
|
129
|
-
const apply = applyFont ??
|
|
130
|
-
((text, fontFamily) => {
|
|
131
|
-
editor = editor ?? useExternalRichTextEditor().externalEditor;
|
|
132
|
-
return applyStyleToRTEText(editor, text, {
|
|
133
|
-
fontFamily,
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
try {
|
|
137
|
-
for (const page of model.pages) {
|
|
138
|
-
for (const content of page.contents) {
|
|
139
|
-
walkRecord(content, content, changed, apply);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
finally {
|
|
144
|
-
editor?.destroy();
|
|
145
|
-
}
|
|
146
|
-
};
|