@designcrowd/library.brand-page 6.2.11-builder-v2-1 → 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-Dg2pOwbr.js → CreatedOnBrandCrowd-de-de-BtVKllNQ.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-BILs_hsB.js → CreatedOnBrandCrowd-en-us-CX5V0v8u.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-VpxQ0N5F.js → CreatedOnBrandCrowd-es-es-CbA02PCL.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-CFHWRHzi.js → CreatedOnBrandCrowd-fr-ca-BQAKruBF.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-CFHWRHzi.js → CreatedOnBrandCrowd-fr-fr-BQAKruBF.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-CZfs45s9.js → CreatedOnBrandCrowd-pt-br-Yk_yzB3s.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-CZfs45s9.js → CreatedOnBrandCrowd-pt-pt-Yk_yzB3s.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-DYMQ6sIF.js → CreatedOnDcom-de-de-DJZQbPSD.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-Dj5sdPid.js → CreatedOnDcom-en-us-BJvNAa4l.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-Cx9yNTro.js → CreatedOnDcom-es-es-CUwB1FRY.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-Bzr0SjGq.js → CreatedOnDcom-fr-ca-CK54U4oh.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-BgqKY35F.js → CreatedOnDcom-fr-fr-DuUNBGrM.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-CXK6qfvL.js → CreatedOnDcom-pt-br-BfODpFNV.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-B8SggNTQ.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/brand-page-context.model.d.ts +2 -0
- package/lib/src/brand-page/models/brand-page-context.model.js +7 -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 +34 -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 +44 -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/preview/Preview.mixin.d.ts +7 -0
- package/lib/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.d.ts +21 -0
- package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +25 -1
- package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +25 -1
- package/lib/src/brand-page-maker/components/seo-settings/UseExistingDomainModal.mixin.d.ts +21 -0
- 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 +25 -1
- package/lib/src/brand-page-maker/components/upgrade-to-premium-button/UpgradeToPremiumButton.mixin.d.ts +21 -0
- package/lib/src/brand-page-maker/composables/ai-chat/ai-builder-experiment.d.ts +10 -0
- package/lib/src/brand-page-maker/composables/ai-chat/ai-builder-experiment.js +11 -0
- 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 +14 -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/ai-thread/ai-website-builder-thread-store.d.ts +9 -2
- package/lib/src/brand-page-maker/stores/ai-thread/ai-website-builder-thread-store.js +20 -0
- package/lib/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.d.ts +21 -0
- 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 +7 -1
- package/lib/src/clients/ai-assistant-client.js +7 -15
- 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 +284 -188
- package/lib/src/css/library.brand-page-brandPage.min.css +284 -188
- package/lib/src/css/library.brand-page-designCom.min.css +284 -188
- package/lib/src/css/library.brand-page-preview.min.css +284 -188
- package/lib/src/index.d.ts +2 -1
- package/lib/src/index.mjs +195 -191
- package/lib/src/{lib-7gtW85nE.js → lib-kGRlD3_P.js} +39082 -36131
- 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 +22 -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 +26 -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/new-page-modal/NewPageModal.mixin.d.ts +1 -0
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +38 -5
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +91 -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 +32 -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 +23 -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 +176 -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 +58 -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/brand-page-context.model.ts +13 -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/composables/ai-chat/ai-builder-experiment.test.ts +82 -0
- package/src/brand-page-maker/composables/ai-chat/ai-builder-experiment.ts +19 -0
- package/src/brand-page-maker/composables/ai-chat/useAiMetadataBuilder.ts +2 -0
- package/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.ts +19 -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/ai-thread/ai-website-builder-thread-store.ts +30 -0
- 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 +13 -18
- 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/focused-content-item-settings/FocusedContentItemSettings.mixin.ts +0 -6
- 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/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/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/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 +74 -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/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/models/brand-page-context.model.test.ts +0 -38
- 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/clients/ai-assistant-client.test.ts +0 -135
- 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,112 @@
|
|
|
1
|
+
import type { JSONContent } from '@tiptap/vue-3';
|
|
2
|
+
import { isTiptapDocument, getRteJsonPlainText } from './rte-shape.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
|
+
* MIGRATION-22 SNAPSHOT DEPENDENCY: B1 uses this module's plain-text conversion and parser seam.
|
|
48
|
+
* Pin that v22 conversion before changing it after migration-22 releases.
|
|
49
|
+
*/
|
|
50
|
+
export declare const renderRteToHtml: (value: RichTextValue | null | undefined, options?: {
|
|
51
|
+
textDecorationClasses?: boolean;
|
|
52
|
+
}) => string;
|
|
53
|
+
/**
|
|
54
|
+
* Resolve an HtmlParser for the current runtime: the native `DOMParser` in the
|
|
55
|
+
* browser (and jsdom-based test envs), or a jsdom `DOMParser` INSTANCE on a
|
|
56
|
+
* pure-node server — created and returned directly, never assigned to a global,
|
|
57
|
+
* so it is immune to SSR execution-context differences. The jsdom specifier is
|
|
58
|
+
* assembled at runtime so no bundler follows it into a browser build. Memoised
|
|
59
|
+
* on the server (JSDOM construction is relatively expensive).
|
|
60
|
+
*/
|
|
61
|
+
export declare const resolveHtmlParser: () => Promise<HtmlParser>;
|
|
62
|
+
/**
|
|
63
|
+
* Normalise an RTE value to a Tiptap JSON document. HTML strings are parsed with
|
|
64
|
+
* `parser` (defaults to the browser's native DOMParser); JSON documents pass
|
|
65
|
+
* through unchanged. Returns undefined for empty/blank input so callers can omit
|
|
66
|
+
* empty fields. `schemaVersion` pins the parse schema — a migration passes its own
|
|
67
|
+
* version so its output can't drift when the live schema gains an extension;
|
|
68
|
+
* everything else omits it and parses with the latest.
|
|
69
|
+
*/
|
|
70
|
+
export declare const toRteJson: (value: RichTextValue | null | undefined, parser?: HtmlParser, schemaVersion?: number) => JSONContent | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Convert a PLAIN-TEXT field to a Tiptap JSON document. Plain-text fields persist
|
|
73
|
+
* newlines percent-encoded (`ESCAPED_NEWLINE_CHARACTER`, `%0A`); fed straight to the
|
|
74
|
+
* HTML parser those survive as a literal `"%0A"` run with the line structure lost, so
|
|
75
|
+
* we first turn them (and any raw `\n`) into `<br>` — the same shim the retired runtime
|
|
76
|
+
* rewrap applied via getRenderText before `setContent`. Guarded on `%0A` so a legacy
|
|
77
|
+
* RTE-HTML string (whose pretty-print `\n` must stay insignificant whitespace, stripped
|
|
78
|
+
* by `stripIndentationTextNodes`) is passed through untouched. JSON docs pass through.
|
|
79
|
+
*/
|
|
80
|
+
export declare const plainTextToRteJson: (value: RichTextValue | null | undefined, parser?: HtmlParser, schemaVersion?: number) => JSONContent | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* BP-5969 — build the Tiptap doc a factory stores for an RTE field: the RTE-JSON **source** that
|
|
83
|
+
* replaces the plain-string-then-convert seam. STRUCTURE only (paragraph + text + `textAlign`) —
|
|
84
|
+
* colour and role typography are baked afterwards by the init step (`applyTextContrast` +
|
|
85
|
+
* `authorContentRteFields`), since colour is contrast-derived and must not be duplicated per factory.
|
|
86
|
+
* Schema-built (never a hand-written literal), so it stays valid and matches migration output.
|
|
87
|
+
*
|
|
88
|
+
* Empty text → an empty paragraph (still a doc, never a string). A ProseMirror text node cannot be
|
|
89
|
+
* empty, so an empty field has no run: its colour then lives on the style object until the user types,
|
|
90
|
+
* when `buildInitialMarks` seeds the first run from it.
|
|
91
|
+
*/
|
|
92
|
+
export declare const rteDoc: (text: string, textAlign?: string, parser?: HtmlParser) => JSONContent;
|
|
93
|
+
/**
|
|
94
|
+
* BP-5969 — inject `newText` into a template RTE doc while KEEPING the template's embedded style.
|
|
95
|
+
* Personalisation supplies only plain text; writing it raw drops the doc and its style (colour +
|
|
96
|
+
* typography live in the run marks). This lifts the template's **style skeleton** — the FIRST text
|
|
97
|
+
* run's `textStyle` mark (colour + role-var refs + any literal override) and the first block's
|
|
98
|
+
* alignment — and reflows the new text through it: a single paragraph whose lines join with hard
|
|
99
|
+
* breaks (matching how plain text is authored), every run carrying that mark. Per-word variation (a
|
|
100
|
+
* coloured word, an inline link) collapses to the base style — an accepted, documented loss; a
|
|
101
|
+
* uniformly-styled field comes out identical.
|
|
102
|
+
*
|
|
103
|
+
* The library owns schema handling: `Node.fromJSON` validates the template and hydrates real marks,
|
|
104
|
+
* `schema.text` applies them. No hand-written JSON and no `DOMParser`, so it is isomorphic — it runs
|
|
105
|
+
* on the server draft path where an editor or an HTML parse could not. The linked role lives on the
|
|
106
|
+
* sibling style object (`textStyleType`), untouched here, so the reflowed block still repaints on a
|
|
107
|
+
* role edit.
|
|
108
|
+
*
|
|
109
|
+
* A template that cannot be parsed, or that has no styled run, degrades to unstyled reflow rather than
|
|
110
|
+
* throwing — one bad field must not abort a whole personalisation pass.
|
|
111
|
+
*/
|
|
112
|
+
export declare const reflowRteDoc: (templateDoc: JSONContent, newText: string) => JSONContent;
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { getSchema } from '@tiptap/core';
|
|
2
|
+
import { DOMParser as ProseMirrorDOMParser, Node as ProseMirrorNode, } from '@tiptap/pm/model';
|
|
3
|
+
import { renderToHTMLString } from '@tiptap/static-renderer/pm/html-string';
|
|
4
|
+
import { getRteExtensions, rteSchemaGeneration } from './rte-extensions.util';
|
|
5
|
+
import { isTiptapDocument, getRteJsonPlainText } from './rte-shape.util';
|
|
6
|
+
import { ESCAPED_NEWLINE_CHARACTER } from '@src/constants/ui';
|
|
7
|
+
export { isTiptapDocument, getRteJsonPlainText };
|
|
8
|
+
// One extension set shared by both directions (render + parse). Schema knowledge
|
|
9
|
+
// lives here, once — Tiptap/extension upgrades propagate to both automatically.
|
|
10
|
+
const RTE_EXTENSIONS = getRteExtensions();
|
|
11
|
+
const RTE_EXTENSIONS_WITH_DECORATION_CLASSES = getRteExtensions({
|
|
12
|
+
renderTextDecorationClasses: true,
|
|
13
|
+
});
|
|
14
|
+
// ProseMirror schema derived once from the shared extension set. This is the
|
|
15
|
+
// schema-driven heart of HTML→JSON (no drift); only the HTML→DOM step is injected.
|
|
16
|
+
const RTE_SCHEMA = getSchema(RTE_EXTENSIONS);
|
|
17
|
+
// One ProseMirror schema per schema GENERATION, built once each. `rteSchemaGeneration` collapses a
|
|
18
|
+
// requested version to its range, so every version in a range shares one built schema (5 and 20 both
|
|
19
|
+
// use the base; 22 and the latest share the newest). A migration passes its own model version so its
|
|
20
|
+
// HTML→JSON parse reproduces that range's schema and can't drift when the live schema gains an
|
|
21
|
+
// extension; runtime (renderer, factories) omits it and uses the latest. RTE_SCHEMA is the latest,
|
|
22
|
+
// so it seeds the newest generation and isn't rebuilt.
|
|
23
|
+
const schemaByGeneration = new Map([
|
|
24
|
+
[rteSchemaGeneration(undefined), RTE_SCHEMA],
|
|
25
|
+
]);
|
|
26
|
+
const rteSchemaForVersion = (schemaVersion) => {
|
|
27
|
+
const generation = rteSchemaGeneration(schemaVersion);
|
|
28
|
+
let schema = schemaByGeneration.get(generation);
|
|
29
|
+
if (!schema) {
|
|
30
|
+
schema = getSchema(getRteExtensions({ schemaVersion }));
|
|
31
|
+
schemaByGeneration.set(generation, schema);
|
|
32
|
+
}
|
|
33
|
+
return schema;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Render an RTE value to final HTML. Legacy HTML strings pass through untouched
|
|
37
|
+
* (they are already HTML); Tiptap JSON is serialised by @tiptap/static-renderer
|
|
38
|
+
* from the extension schema — no editor, no DOM — so it works on the server
|
|
39
|
+
* (SSR/publish), not just the browser.
|
|
40
|
+
*
|
|
41
|
+
* MIGRATION-22 SNAPSHOT DEPENDENCY: B1 uses this module's plain-text conversion and parser seam.
|
|
42
|
+
* Pin that v22 conversion before changing it after migration-22 releases.
|
|
43
|
+
*/
|
|
44
|
+
export const renderRteToHtml = (value, options = {}) => {
|
|
45
|
+
if (value == null || value === '')
|
|
46
|
+
return '';
|
|
47
|
+
if (typeof value === 'string')
|
|
48
|
+
return value;
|
|
49
|
+
try {
|
|
50
|
+
return renderToHTMLString({
|
|
51
|
+
content: value,
|
|
52
|
+
extensions: options.textDecorationClasses
|
|
53
|
+
? RTE_EXTENSIONS_WITH_DECORATION_CLASSES
|
|
54
|
+
: RTE_EXTENSIONS,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
// renderToHTMLString throws on a node/mark type this renderer's schema
|
|
59
|
+
// doesn't know. The realistic trigger is version skew — the library ships to
|
|
60
|
+
// multiple apps, so a maker on a newer schema can persist a node an older
|
|
61
|
+
// deployed renderer can't render. Degrade to visible text rather than let
|
|
62
|
+
// one field throw out of its (unguarded) computed and 500 the whole page.
|
|
63
|
+
console.error('renderRteToHtml: unrenderable doc, falling back to plain text', error);
|
|
64
|
+
return getRteJsonPlainText(value);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
// Tiptap's elementFromString strips whitespace-only text nodes (pretty-print
|
|
68
|
+
// indentation between tags) before parsing; replicate it so injected-parser
|
|
69
|
+
// output stays identical to the previous generateJSON-based conversion.
|
|
70
|
+
const stripIndentationTextNodes = (node) => {
|
|
71
|
+
const children = node.childNodes;
|
|
72
|
+
for (let i = children.length - 1; i >= 0; i -= 1) {
|
|
73
|
+
const child = children[i];
|
|
74
|
+
if (child.nodeType === 3 &&
|
|
75
|
+
child.nodeValue &&
|
|
76
|
+
/^(\n\s\s|\n)$/.test(child.nodeValue)) {
|
|
77
|
+
node.removeChild(child);
|
|
78
|
+
}
|
|
79
|
+
else if (child.nodeType === 1) {
|
|
80
|
+
stripIndentationTextNodes(child);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return node;
|
|
84
|
+
};
|
|
85
|
+
const htmlToRteJson = (html, parser, schemaVersion) => {
|
|
86
|
+
const body = parser.parseFromString(`<body>${html}</body>`, 'text/html').body;
|
|
87
|
+
const dom = stripIndentationTextNodes(body);
|
|
88
|
+
return ProseMirrorDOMParser.fromSchema(rteSchemaForVersion(schemaVersion))
|
|
89
|
+
.parse(dom)
|
|
90
|
+
.toJSON();
|
|
91
|
+
};
|
|
92
|
+
let serverParserPromise = null;
|
|
93
|
+
/**
|
|
94
|
+
* Resolve an HtmlParser for the current runtime: the native `DOMParser` in the
|
|
95
|
+
* browser (and jsdom-based test envs), or a jsdom `DOMParser` INSTANCE on a
|
|
96
|
+
* pure-node server — created and returned directly, never assigned to a global,
|
|
97
|
+
* so it is immune to SSR execution-context differences. The jsdom specifier is
|
|
98
|
+
* assembled at runtime so no bundler follows it into a browser build. Memoised
|
|
99
|
+
* on the server (JSDOM construction is relatively expensive).
|
|
100
|
+
*/
|
|
101
|
+
export const resolveHtmlParser = async () => {
|
|
102
|
+
if (typeof DOMParser !== 'undefined')
|
|
103
|
+
return new DOMParser();
|
|
104
|
+
if (!serverParserPromise) {
|
|
105
|
+
const jsdomModuleId = ['js', 'dom'].join('');
|
|
106
|
+
serverParserPromise = import(/* @vite-ignore */ jsdomModuleId)
|
|
107
|
+
.then((mod) => {
|
|
108
|
+
const { JSDOM } = mod;
|
|
109
|
+
const { DOMParser: JsdomDOMParser } = new JSDOM('').window;
|
|
110
|
+
return new JsdomDOMParser();
|
|
111
|
+
})
|
|
112
|
+
.catch((error) => {
|
|
113
|
+
// Don't cache the failure — let a later call retry the import.
|
|
114
|
+
serverParserPromise = null;
|
|
115
|
+
throw error;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return serverParserPromise;
|
|
119
|
+
};
|
|
120
|
+
const getDefaultParser = () => {
|
|
121
|
+
if (typeof DOMParser !== 'undefined')
|
|
122
|
+
return new DOMParser();
|
|
123
|
+
throw new Error('toRteJson: no global DOMParser in this environment. On the server, pass an ' +
|
|
124
|
+
'explicit parser as the second argument (see resolveHtmlParser).');
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Normalise an RTE value to a Tiptap JSON document. HTML strings are parsed with
|
|
128
|
+
* `parser` (defaults to the browser's native DOMParser); JSON documents pass
|
|
129
|
+
* through unchanged. Returns undefined for empty/blank input so callers can omit
|
|
130
|
+
* empty fields. `schemaVersion` pins the parse schema — a migration passes its own
|
|
131
|
+
* version so its output can't drift when the live schema gains an extension;
|
|
132
|
+
* everything else omits it and parses with the latest.
|
|
133
|
+
*/
|
|
134
|
+
export const toRteJson = (value, parser, schemaVersion) => {
|
|
135
|
+
if (value == null || value === '')
|
|
136
|
+
return undefined;
|
|
137
|
+
if (isTiptapDocument(value))
|
|
138
|
+
return value;
|
|
139
|
+
return htmlToRteJson(value, parser ?? getDefaultParser(), schemaVersion);
|
|
140
|
+
};
|
|
141
|
+
// Twin of getRenderText (brand-page/utils/text.util) — the plain-text renderer's
|
|
142
|
+
// newline shim, applied on the way INTO the parser instead of at display time.
|
|
143
|
+
const NEWLINE_TO_BR = new RegExp(`(${ESCAPED_NEWLINE_CHARACTER}|\\n)`, 'g');
|
|
144
|
+
/**
|
|
145
|
+
* Convert a PLAIN-TEXT field to a Tiptap JSON document. Plain-text fields persist
|
|
146
|
+
* newlines percent-encoded (`ESCAPED_NEWLINE_CHARACTER`, `%0A`); fed straight to the
|
|
147
|
+
* HTML parser those survive as a literal `"%0A"` run with the line structure lost, so
|
|
148
|
+
* we first turn them (and any raw `\n`) into `<br>` — the same shim the retired runtime
|
|
149
|
+
* rewrap applied via getRenderText before `setContent`. Guarded on `%0A` so a legacy
|
|
150
|
+
* RTE-HTML string (whose pretty-print `\n` must stay insignificant whitespace, stripped
|
|
151
|
+
* by `stripIndentationTextNodes`) is passed through untouched. JSON docs pass through.
|
|
152
|
+
*/
|
|
153
|
+
export const plainTextToRteJson = (value, parser, schemaVersion) => {
|
|
154
|
+
const prepared = typeof value === 'string' && value.includes(ESCAPED_NEWLINE_CHARACTER)
|
|
155
|
+
? value.replace(NEWLINE_TO_BR, '<br/>')
|
|
156
|
+
: value;
|
|
157
|
+
return toRteJson(prepared, parser, schemaVersion);
|
|
158
|
+
};
|
|
159
|
+
// The canonical empty document (a single empty paragraph), built from the schema — no DOM, SSR-safe.
|
|
160
|
+
const emptyRteDoc = () => RTE_SCHEMA.topNodeType.createAndFill().toJSON();
|
|
161
|
+
/**
|
|
162
|
+
* BP-5969 — build the Tiptap doc a factory stores for an RTE field: the RTE-JSON **source** that
|
|
163
|
+
* replaces the plain-string-then-convert seam. STRUCTURE only (paragraph + text + `textAlign`) —
|
|
164
|
+
* colour and role typography are baked afterwards by the init step (`applyTextContrast` +
|
|
165
|
+
* `authorContentRteFields`), since colour is contrast-derived and must not be duplicated per factory.
|
|
166
|
+
* Schema-built (never a hand-written literal), so it stays valid and matches migration output.
|
|
167
|
+
*
|
|
168
|
+
* Empty text → an empty paragraph (still a doc, never a string). A ProseMirror text node cannot be
|
|
169
|
+
* empty, so an empty field has no run: its colour then lives on the style object until the user types,
|
|
170
|
+
* when `buildInitialMarks` seeds the first run from it.
|
|
171
|
+
*/
|
|
172
|
+
export const rteDoc = (text, textAlign, parser) => {
|
|
173
|
+
const doc = typeof text === 'string' && text.length > 0
|
|
174
|
+
? (plainTextToRteJson(text, parser) ?? emptyRteDoc())
|
|
175
|
+
: emptyRteDoc();
|
|
176
|
+
if (textAlign) {
|
|
177
|
+
for (const block of doc.content ?? []) {
|
|
178
|
+
block.attrs = { ...(block.attrs ?? {}), textAlign };
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return doc;
|
|
182
|
+
};
|
|
183
|
+
// A plain-text field's line breaks: the escaped-newline token (`%0A`) or a real newline. Non-capturing
|
|
184
|
+
// so `split` yields only the lines. `plainTextToRteJson` turns the same breaks into `<br>`; the reflow
|
|
185
|
+
// makes each line its own paragraph instead.
|
|
186
|
+
const REFLOW_LINE_BREAK = new RegExp(`${ESCAPED_NEWLINE_CHARACTER}|\\r?\\n`);
|
|
187
|
+
// The mark carrying a run's colour + role-var typography (family/size/weight/…). It is the ONLY mark
|
|
188
|
+
// the reflow carries onto new text — per-word marks (link/highlight) can't meaningfully apply to
|
|
189
|
+
// different copy, so they are dropped.
|
|
190
|
+
const TEXT_STYLE_MARK_NAME = 'textStyle';
|
|
191
|
+
/**
|
|
192
|
+
* Build a schema-valid doc from plain text: ONE paragraph, its lines joined by `hardBreak`s, every run
|
|
193
|
+
* stamped with `styleMarks` and the block with `textAlign`. A hard break (not a paragraph per line)
|
|
194
|
+
* matches how `plainTextToRteJson` — and so the template's own authoring — turns `%0A` into a `<br>`,
|
|
195
|
+
* so the reflow introduces no inter-paragraph spacing the template never had. `schema.text` throws on
|
|
196
|
+
* an empty string, so an empty line contributes only its break; empty text yields an empty paragraph.
|
|
197
|
+
* The library owns validity — `schema.text` / `NodeType.create`, never a JSON literal — so no DOM parser.
|
|
198
|
+
*/
|
|
199
|
+
const buildStyledDoc = (text, styleMarks, textAlign) => {
|
|
200
|
+
const { paragraph, hardBreak } = RTE_SCHEMA.nodes;
|
|
201
|
+
const attrs = textAlign ? { textAlign } : null;
|
|
202
|
+
const inline = [];
|
|
203
|
+
text.split(REFLOW_LINE_BREAK).forEach((line, index) => {
|
|
204
|
+
if (index > 0)
|
|
205
|
+
inline.push(hardBreak.create());
|
|
206
|
+
if (line)
|
|
207
|
+
inline.push(RTE_SCHEMA.text(line, styleMarks));
|
|
208
|
+
});
|
|
209
|
+
return RTE_SCHEMA.topNodeType
|
|
210
|
+
.create(null, paragraph.create(attrs, inline))
|
|
211
|
+
.toJSON();
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* BP-5969 — inject `newText` into a template RTE doc while KEEPING the template's embedded style.
|
|
215
|
+
* Personalisation supplies only plain text; writing it raw drops the doc and its style (colour +
|
|
216
|
+
* typography live in the run marks). This lifts the template's **style skeleton** — the FIRST text
|
|
217
|
+
* run's `textStyle` mark (colour + role-var refs + any literal override) and the first block's
|
|
218
|
+
* alignment — and reflows the new text through it: a single paragraph whose lines join with hard
|
|
219
|
+
* breaks (matching how plain text is authored), every run carrying that mark. Per-word variation (a
|
|
220
|
+
* coloured word, an inline link) collapses to the base style — an accepted, documented loss; a
|
|
221
|
+
* uniformly-styled field comes out identical.
|
|
222
|
+
*
|
|
223
|
+
* The library owns schema handling: `Node.fromJSON` validates the template and hydrates real marks,
|
|
224
|
+
* `schema.text` applies them. No hand-written JSON and no `DOMParser`, so it is isomorphic — it runs
|
|
225
|
+
* on the server draft path where an editor or an HTML parse could not. The linked role lives on the
|
|
226
|
+
* sibling style object (`textStyleType`), untouched here, so the reflowed block still repaints on a
|
|
227
|
+
* role edit.
|
|
228
|
+
*
|
|
229
|
+
* A template that cannot be parsed, or that has no styled run, degrades to unstyled reflow rather than
|
|
230
|
+
* throwing — one bad field must not abort a whole personalisation pass.
|
|
231
|
+
*/
|
|
232
|
+
export const reflowRteDoc = (templateDoc, newText) => {
|
|
233
|
+
try {
|
|
234
|
+
const doc = ProseMirrorNode.fromJSON(RTE_SCHEMA, templateDoc);
|
|
235
|
+
// The FIRST text run is the base style. `descendants` has no early-abort (returning false skips a
|
|
236
|
+
// node's children but still visits siblings), so a flag stops us overwriting from later runs.
|
|
237
|
+
let styleMarks = [];
|
|
238
|
+
let found = false;
|
|
239
|
+
doc.descendants((node) => {
|
|
240
|
+
if (found)
|
|
241
|
+
return false;
|
|
242
|
+
if (node.isText) {
|
|
243
|
+
styleMarks = node.marks.filter((mark) => mark.type.name === TEXT_STYLE_MARK_NAME);
|
|
244
|
+
found = true;
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
return true;
|
|
248
|
+
});
|
|
249
|
+
return buildStyledDoc(newText, styleMarks, doc.firstChild?.attrs.textAlign);
|
|
250
|
+
}
|
|
251
|
+
catch (error) {
|
|
252
|
+
console.error('reflowRteDoc: unusable template doc, reflowing without style', error);
|
|
253
|
+
return buildStyledDoc(newText, []);
|
|
254
|
+
}
|
|
255
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { JSONContent } from '@tiptap/vue-3';
|
|
2
|
+
/** Canonical discriminator for the JSON RTE model. */
|
|
3
|
+
export declare const isTiptapDocument: (value: unknown) => value is JSONContent;
|
|
4
|
+
/** A legacy inline-HTML RTE string, rather than arbitrary text containing angle brackets. */
|
|
5
|
+
export declare const isRteHtmlString: (value: unknown) => value is string;
|
|
6
|
+
export declare const getRteJsonPlainText: (doc: JSONContent) => string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Canonical discriminator for the JSON RTE model. */
|
|
2
|
+
export const isTiptapDocument = (value) => typeof value === 'object' &&
|
|
3
|
+
value !== null &&
|
|
4
|
+
value.type === 'doc';
|
|
5
|
+
/** A legacy inline-HTML RTE string, rather than arbitrary text containing angle brackets. */
|
|
6
|
+
export const isRteHtmlString = (value) => typeof value === 'string' &&
|
|
7
|
+
value.length > 0 &&
|
|
8
|
+
/^<[A-Za-z][A-Za-z0-9-]*\b[^>]*>[\s\S]*<\/[A-Za-z][A-Za-z0-9-]*>$/.test(value.trim());
|
|
9
|
+
export const getRteJsonPlainText = (doc) => {
|
|
10
|
+
const parts = [];
|
|
11
|
+
const walk = (node) => {
|
|
12
|
+
if (typeof node.text === 'string')
|
|
13
|
+
parts.push(node.text);
|
|
14
|
+
node.content?.forEach(walk);
|
|
15
|
+
};
|
|
16
|
+
walk(doc);
|
|
17
|
+
return parts.join(' ').replace(/\s+/g, ' ').trim();
|
|
18
|
+
};
|
|
@@ -84,6 +84,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
84
84
|
isVariation: boolean;
|
|
85
85
|
isExcluded: boolean;
|
|
86
86
|
} | undefined;
|
|
87
|
+
bp_6136_v2_ai_builder?: {
|
|
88
|
+
key: string;
|
|
89
|
+
value: string;
|
|
90
|
+
isControl: boolean;
|
|
91
|
+
isVariation: boolean;
|
|
92
|
+
isExcluded: boolean;
|
|
93
|
+
} | undefined;
|
|
87
94
|
};
|
|
88
95
|
isSubsequentPublish: boolean;
|
|
89
96
|
isContextualUpgradeModalVisible: boolean;
|
|
@@ -159,6 +166,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
159
166
|
isVariation: boolean;
|
|
160
167
|
isExcluded: boolean;
|
|
161
168
|
} | undefined;
|
|
169
|
+
bp_6136_v2_ai_builder?: {
|
|
170
|
+
key: string;
|
|
171
|
+
value: string;
|
|
172
|
+
isControl: boolean;
|
|
173
|
+
isVariation: boolean;
|
|
174
|
+
isExcluded: boolean;
|
|
175
|
+
} | undefined;
|
|
162
176
|
};
|
|
163
177
|
isSubsequentPublish: boolean;
|
|
164
178
|
isContextualUpgradeModalVisible: boolean;
|
|
@@ -234,6 +248,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
234
248
|
isVariation: boolean;
|
|
235
249
|
isExcluded: boolean;
|
|
236
250
|
} | undefined;
|
|
251
|
+
bp_6136_v2_ai_builder?: {
|
|
252
|
+
key: string;
|
|
253
|
+
value: string;
|
|
254
|
+
isControl: boolean;
|
|
255
|
+
isVariation: boolean;
|
|
256
|
+
isExcluded: boolean;
|
|
257
|
+
} | undefined;
|
|
237
258
|
};
|
|
238
259
|
isSubsequentPublish: boolean;
|
|
239
260
|
isContextualUpgradeModalVisible: boolean;
|
|
@@ -360,7 +381,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
360
381
|
}[]>;
|
|
361
382
|
selectedTabName: import("vue").ComputedRef<string>;
|
|
362
383
|
isAdminMaker: import("vue").ComputedRef<boolean>;
|
|
363
|
-
contentSettingsMode: import("vue").ComputedRef<"images" | "
|
|
384
|
+
contentSettingsMode: import("vue").ComputedRef<"images" | "edit" | "add" | "focusedContentItem">;
|
|
364
385
|
contentSettingsSelectedItemId: import("vue").ComputedRef<string | null>;
|
|
365
386
|
sideBarStore: import("pinia").Store<"uiSideBar", import("../store").SideBarState, {}, {
|
|
366
387
|
setBrandPageSettingsTabVisibility(payload: {
|
|
@@ -370,6 +391,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
370
391
|
setSelectedSettingsSection(payload: {
|
|
371
392
|
sectionName?: string;
|
|
372
393
|
}): void;
|
|
394
|
+
openTextStyles(): void;
|
|
373
395
|
}>;
|
|
374
396
|
userStore: import("pinia").Store<"brandPageMakerUser", import("@brand-page-maker/stores").UserState, {}, {
|
|
375
397
|
setUserState(payload: {
|
|
@@ -13,6 +13,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
13
13
|
setSelectedSettingsSection(payload: {
|
|
14
14
|
sectionName?: string;
|
|
15
15
|
}): void;
|
|
16
|
+
openTextStyles(): void;
|
|
16
17
|
}>;
|
|
17
18
|
isDesignCom: import("vue").ComputedRef<boolean>;
|
|
18
19
|
eventTracker: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SetSelectedTabNamePayload, SideBarTab } from '../models';
|
|
2
|
+
export declare const TEXT_STYLES_SETTINGS_SECTION = "textStyles";
|
|
2
3
|
export interface SideBarState {
|
|
3
4
|
tabs: SideBarTab[];
|
|
4
5
|
selectedTabName: string;
|
|
@@ -13,4 +14,5 @@ export declare const useUiSideBarStore: import("pinia").StoreDefinition<"uiSideB
|
|
|
13
14
|
setSelectedSettingsSection(payload: {
|
|
14
15
|
sectionName?: string;
|
|
15
16
|
}): void;
|
|
17
|
+
openTextStyles(): void;
|
|
16
18
|
}>;
|
|
@@ -3,6 +3,8 @@ import { defineStore } from 'pinia';
|
|
|
3
3
|
import { DEFAULT_SIDE_BAR_TABS, SIDE_BAR_TAB_NAMES, } from '@brand-page-maker/constants';
|
|
4
4
|
import { PAGE_SETTINGS_SECTIONS, useUiPageSettingsStore, } from '../../page-settings/store';
|
|
5
5
|
import { useUiContentSettingsStore } from '../../content-settings/store';
|
|
6
|
+
// The Style tab's Text Styles panel, which "Edit Text Styles" in a role dropdown opens.
|
|
7
|
+
export const TEXT_STYLES_SETTINGS_SECTION = 'textStyles';
|
|
6
8
|
export const useUiSideBarStore = defineStore('uiSideBar', {
|
|
7
9
|
state: () => ({
|
|
8
10
|
tabs: DEFAULT_SIDE_BAR_TABS(),
|
|
@@ -51,5 +53,12 @@ export const useUiSideBarStore = defineStore('uiSideBar', {
|
|
|
51
53
|
setSelectedSettingsSection(payload) {
|
|
52
54
|
this.selectedSettingsSection = payload.sectionName;
|
|
53
55
|
},
|
|
56
|
+
// The section is set first: the Style tab mounts on the switch and scrolls to it.
|
|
57
|
+
openTextStyles() {
|
|
58
|
+
this.setSelectedSettingsSection({
|
|
59
|
+
sectionName: TEXT_STYLES_SETTINGS_SECTION,
|
|
60
|
+
});
|
|
61
|
+
this.setSelectedTabName({ tabName: SIDE_BAR_TAB_NAMES.STYLE_SETTINGS });
|
|
62
|
+
},
|
|
54
63
|
},
|
|
55
64
|
});
|