pagepilot-visual-editor 1.0.27 → 1.0.28

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/blocks-internal/block-button/src/index.d.ts +10 -9
  3. package/dist/blocks-internal/block-button/src/styles.d.ts +5 -0
  4. package/dist/blocks-internal/block-button-group/src/index.d.ts +6 -0
  5. package/dist/blocks-internal/block-container/src/index.d.ts +5 -5
  6. package/dist/blocks-internal/block-heading/src/index.d.ts +30 -1
  7. package/dist/blocks-internal/block-image/src/index.d.ts +46 -11
  8. package/dist/blocks-internal/block-logo/src/index.d.ts +17 -11
  9. package/dist/blocks-internal/block-text/src/index.d.ts +25 -0
  10. package/dist/blocks-internal/block-video/src/index.d.ts +6 -0
  11. package/dist/blocks-internal/block-youtube-url/src/index.d.ts +6 -0
  12. package/dist/editor-sample/App/InspectorDrawer/LayersPanelStyles.d.ts +2 -2
  13. package/dist/editor-sample/App/shared/editor.styles.d.ts +3 -3
  14. package/dist/editor-sample/documents/blocks/ButtonGroup/ButtonGroupPropsSchema.d.ts +6 -0
  15. package/dist/editor-sample/documents/blocks/Container/ContainerPropsSchema.d.ts +1 -1
  16. package/dist/editor-sample/documents/blocks/Table/TableImportDialog.styles.d.ts +7 -7
  17. package/dist/editor-sample/documents/blocks/helpers/responsiveStyle.d.ts +3 -16
  18. package/dist/editor-sample/documents/editor/EditorContext.d.ts +2 -2
  19. package/dist/editor-sample/documents/editor/core.d.ts +123 -27
  20. package/dist/email-builder-core/Reader/resolveResponsiveBlock.d.ts +17 -0
  21. package/dist/email-builder-core/blocks/ButtonGroup/ButtonGroupPropsSchema.d.ts +6 -0
  22. package/dist/email-builder-core/blocks/Container/ContainerPropsSchema.d.ts +6 -4
  23. package/dist/email-builder-core/blocks/Container/ContainerReader.d.ts +1 -1
  24. package/dist/email-builder-core/blocks/EmailLayout/EmailLayoutReader.d.ts +1 -1
  25. package/dist/email-builder-core/blocks/MenuPicker/MenuPropsSchema.d.ts +12 -0
  26. package/dist/email-builder-core/blocks/MenuPicker/menuResponsiveCss.d.ts +1 -0
  27. package/dist/email-builder-core/blocks/Timer/TimerPropsSchema.d.ts +2 -0
  28. package/dist/email-builder-core/blocks/Timer/variants/CircularProgressView.d.ts +2 -1
  29. package/dist/email-builder-core/blocks/helpers/blockStyleHelpers.d.ts +37 -1
  30. package/dist/email-builder-core/renderers/animationCss.d.ts +5 -5
  31. package/dist/email-builder-core/renderers/pageScripts.d.ts +1 -11
  32. package/dist/email-builder-core/renderers/renderToStaticMarkup.d.ts +4 -2
  33. package/dist/email-builder-core/renderers/themeTokens.d.ts +130 -0
  34. package/dist/host-stubs/modules/settings/settingsSelectors.d.ts +5 -0
  35. package/dist/host-stubs/style/menu.styled.d.ts +5 -1
  36. package/dist/host-stubs/view/branding/brandDefaultFont.d.ts +3 -0
  37. package/dist/host-stubs/view/shared/editors/highlightCode.d.ts +1 -0
  38. package/dist/{index-BNqa-SV3.cjs → index-Br_dDd3Z.cjs} +359 -1226
  39. package/dist/{index-C4zNSWXe.js → index-Cp5AeqH5.js} +1 -1
  40. package/dist/{index-Dk7bp7l0.js → index-DcN8zC8_.js} +24173 -24385
  41. package/dist/{index-Cu-dtp0Q.cjs → index-SYmY8c1I.cjs} +1 -1
  42. package/dist/index.cjs +1 -1
  43. package/dist/index.js +1 -1
  44. package/dist/render-core/stubs/editorContext.d.ts +3 -1
  45. package/dist/render.cjs +259 -1126
  46. package/dist/render.js +6470 -6699
  47. package/dist/renderToStaticHtml.d.ts +9 -1
  48. package/dist/{xlsx-Cd1etxFW.js → xlsx-Bk2GErZO.js} +1 -1
  49. package/dist/{xlsx-C6JQXDb3.cjs → xlsx-vznvhtjT.cjs} +1 -1
  50. package/package.json +1 -1
@@ -1,8 +1,7 @@
1
1
  /**
2
- * Shared keyframes + trigger rules for the per-block animation (see the
3
- * `props.animation` field on Image, Container, Button, Logo, Avatar; the
4
- * `data-animate-*` attributes emitted from Reader/core.tsx; and the
5
- * `buildAnimationScript()` runtime in ./pageScripts.ts).
2
+ * Shared keyframes + trigger rules for the Image block's per-element
3
+ * animation (see ImagePropsSchema.props.animation, Reader/core.tsx's
4
+ * data-animate-* attributes, and public/scripts/pagePilotAnimation.js).
6
5
  *
7
6
  * `transform`/`opacity` only — no layout properties — so animating never
8
7
  * causes reflow or content shift. Speed/delay are applied inline by the
@@ -13,6 +12,7 @@ export declare const ANIMATION_TYPES: readonly ["fade-in", "slide-left", "slide-
13
12
  export type TAnimationType = (typeof ANIMATION_TYPES)[number];
14
13
  export declare const ANIMATION_SPEED_SECONDS: Record<'slow' | 'medium' | 'fast', number>;
15
14
  /** Just the @keyframes — reused by both the published page CSS below and the
16
- * editor canvas's one-off Preview button (see AnimationSection.tsx). */
15
+ * editor canvas's one-off Preview button (see ImageSidebarPanel.tsx), which
16
+ * doesn't load the full published stylesheet. */
17
17
  export declare const animationKeyframesCss: string;
18
18
  export declare const animationCss: string;
@@ -13,14 +13,4 @@ export declare const PAGINATION_SCRIPT_URL = "https://pagepilot.fabbuilder.com/s
13
13
  export declare const DEMO_SCALE_SCRIPT_URL = "https://pagepilot.fabbuilder.com/scripts/pagePilotDemoScale.js";
14
14
  export declare const TIMER_SCRIPT_URL = "https://pagepilot.fabbuilder.com/scripts/pagePilotTimer.js";
15
15
  export declare const ANIMATION_SCRIPT_URL = "https://pagepilot.fabbuilder.com/scripts/pagePilotAnimation.js";
16
- /**
17
- * The per-page runtime that reads the `data-animate-*` attributes emitted by
18
- * Reader/core.tsx and drives the CSS animation (see animationCss.ts). Ported
19
- * verbatim from ahd-fe's `public/scripts/pagePilotAnimation.js` and inlined
20
- * here because pagepilot-visual-editor is a standalone library — it ships
21
- * self-contained pages, not a hosted app with a public CDN.
22
- */
23
- export declare const buildAnimationScript: () => string;
24
- export declare const buildDemoScaleJs: () => string;
25
- export declare const buildTabsScript: () => string;
26
- export declare const buildCarouselScript: () => string;
16
+ export declare const buildGeneratedThemeMarkup: () => string;
@@ -35,8 +35,10 @@ type TOptions = {
35
35
  isBanner?: boolean;
36
36
  injectTabsScrollSyncScript?: boolean;
37
37
  injectCarouselScript?: boolean;
38
- injectAnimationScript?: boolean;
38
+ injectPaginationScript?: boolean;
39
39
  injectFontAssets?: boolean;
40
+ injectTimerScript?: boolean;
41
+ injectAnimationScript?: boolean;
40
42
  };
41
- export default function renderToStaticMarkup(document: TReaderDocument, { rootBlockId, seo, injectElementIds, minifyCss, lang, skipLink, accessibilityTools, includePageCSS, headHtml, bodyBottomHtml, isBanner, injectTabsScrollSyncScript, injectCarouselScript, injectAnimationScript, injectFontAssets, }: TOptions): string;
43
+ export default function renderToStaticMarkup(document: TReaderDocument, { rootBlockId, seo, injectElementIds, minifyCss, lang, skipLink, accessibilityTools, includePageCSS, headHtml, bodyBottomHtml, isBanner, injectTabsScrollSyncScript, injectCarouselScript, injectPaginationScript, injectFontAssets, injectTimerScript, injectAnimationScript, }: TOptions): string;
42
44
  export {};
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Theme tokens for the generated (published) HTML.
3
+ *
4
+ * ## Why this exists
5
+ *
6
+ * A published page is a BODY FRAGMENT injected into a host application we
7
+ * don't control (see ConfigureDialog's integration snippets — hosts do
8
+ * `container.insertAdjacentHTML(...)`). There is no `<head>` to put a
9
+ * stylesheet in and no guarantee any host CSS exists, so everything the page
10
+ * needs to render dark must ship inside the fragment itself.
11
+ *
12
+ * ## Why not `filter: invert()`
13
+ *
14
+ * The previous implementation inverted the whole subtree with
15
+ * `filter: invert(1) hue-rotate(180deg)`. That is not dark mode: it rotates
16
+ * every author-picked hue 180deg, so a brand blue publishes as orange. It also
17
+ * forced a fragile web of counter-inversions to keep photos from looking like
18
+ * negatives. This module replaces it with real per-color dark values.
19
+ *
20
+ * ## How it works
21
+ *
22
+ * Each distinct authored color is issued a token. The block renders
23
+ * `var(--ahd-c-N, <original>)` instead of the raw color, and the token is
24
+ * defined once in a `<style>` scoped to the fragment root:
25
+ *
26
+ * [data-ahd-theme] { --ahd-c-3: light-dark(#0a5fcc, #5aa2ff); }
27
+ *
28
+ * `light-dark()` resolves against the nearest `color-scheme`, which the
29
+ * fragment root sets from the author's Light/Dark/Auto choice. That means a
30
+ * host can flip an embedded page by changing one attribute — no re-fetch, no
31
+ * media-query re-evaluation.
32
+ *
33
+ * Two independent fallbacks keep an unsupported browser rendering exactly what
34
+ * it renders today:
35
+ * 1. The `var()` fallback carries the original color, so a browser that
36
+ * drops the custom property still paints the light value.
37
+ * 2. `emitTokenCss` writes a plain light-value declaration before the
38
+ * `light-dark()` one, so a browser that understands custom properties but
39
+ * not `light-dark()` uses the light value rather than an invalid
40
+ * declaration.
41
+ */
42
+ export type GeneratedTheme = 'light' | 'dark' | 'auto';
43
+ export declare const GENERATED_THEME_ATTR = "data-ahd-theme";
44
+ /**
45
+ * Published pages always follow the visitor's device setting.
46
+ *
47
+ * This is the only mode the renderer emits: there is no author-facing
48
+ * light/dark switch, because a published page has no opinion about the
49
+ * visitor's environment - the visitor's browser does. `light` and `dark`
50
+ * remain in the type because a HOST APP can override a rendered fragment at
51
+ * runtime by setting this attribute (see the snippet in ConfigureDialog).
52
+ */
53
+ export declare const GENERATED_THEME_AUTO: GeneratedTheme;
54
+ /**
55
+ * Derive a dark-mode counterpart for an authored light color.
56
+ *
57
+ * The rule is: PRESERVE HUE AND SATURATION, INVERT LIGHTNESS ONLY. That is the
58
+ * entire difference from the `hue-rotate` approach this replaces — a brand blue
59
+ * stays blue and simply becomes lighter so it reads against a dark surface.
60
+ *
61
+ * Two deliberate departures from a naive `l -> 1 - l`:
62
+ *
63
+ * - Near-neutral colors (very low saturation) are the page's surfaces and text.
64
+ * A straight flip sends #ffffff to #000000, which is harsher than good dark
65
+ * UI: pure black raises perceived contrast and causes halation against light
66
+ * text. They're mapped into a softer range instead (about #121212 to #ededed),
67
+ * matching the app's own dark palette (`src/theme/colors/dark.ts` uses
68
+ * #121212 for background).
69
+ *
70
+ * - Saturated colors get a compressed flip. A mid-lightness brand color
71
+ * (l ~ 0.5) should stay close to where it is rather than swing to the
72
+ * opposite extreme, so the result is pulled toward a legible band and floored
73
+ * so it never lands too dark to see on a dark surface.
74
+ *
75
+ * Alpha is carried through untouched.
76
+ *
77
+ * Returns `null` for anything that is not a single solid color — gradients,
78
+ * `transparent`, keywords, unparseable values. Those are left exactly as the
79
+ * author wrote them (see `token`).
80
+ */
81
+ export declare function deriveDarkColor(value: string): string | null;
82
+ export type TokenRegistry = {
83
+ /**
84
+ * Issue (or reuse) a token for `raw` and return the value a block should
85
+ * render.
86
+ *
87
+ * Returns `raw` unchanged when there is nothing to theme — null/undefined,
88
+ * `transparent`, `currentColor`, a gradient, or anything unparseable. Callers
89
+ * can therefore pipe every color through this without pre-checking, EXCEPT
90
+ * that a caller which BRANCHES on whether a value is a gradient must do that
91
+ * classification on the raw value first (see `isGradientColor` in
92
+ * blocks/helpers/blockStyleHelpers).
93
+ *
94
+ * GRADIENTS ARE NEVER THEMED. An author-picked gradient renders identically
95
+ * in light and dark mode — it is returned byte-for-byte unchanged, so the
96
+ * published CSS carries the author's exact value in both themes.
97
+ */
98
+ token(raw: string | null | undefined): string | undefined;
99
+ /** CSS defining every token issued so far. Empty when none, or theme light. */
100
+ css(theme: GeneratedTheme): string;
101
+ /** Number of distinct colors tokenized (for tests/diagnostics). */
102
+ size(): number;
103
+ };
104
+ export declare function createTokenRegistry(): TokenRegistry;
105
+ /**
106
+ * CSS for a fragment that issued no tokens (or chose light).
107
+ *
108
+ * Still worth emitting for `dark`/`auto`: `color-scheme` alone makes form
109
+ * controls, scrollbars and the canvas behind the fragment follow the theme.
110
+ */
111
+ export declare function baseThemeCss(theme: GeneratedTheme): string;
112
+ export declare const ThemeTokenProvider: import('react').Provider<TokenRegistry>;
113
+ /**
114
+ * Theme a single color value.
115
+ *
116
+ * Safe to call unconditionally: outside a publish render it returns `raw`
117
+ * unchanged. See `TokenRegistry.token` for what is and isn't themed — notably,
118
+ * gradients pass through byte-for-byte.
119
+ *
120
+ * A caller that BRANCHES on whether a color is a gradient must classify the
121
+ * RAW value first (via `isGradientColor`) and only then tokenize, or the
122
+ * branch will misfire on the returned `var(...)` string.
123
+ */
124
+ export declare function useColorToken(raw: string | null | undefined): string | undefined;
125
+ export declare function themeAuthorHtml(html: string, registry: TokenRegistry | null): string;
126
+ /**
127
+ * Hook form of `themeAuthorHtml`, for blocks that render author HTML.
128
+ * Outside a publish render this returns the input unchanged.
129
+ */
130
+ export declare function useThemedHtml(html: string): string;
@@ -0,0 +1,5 @@
1
+ declare const settingsSelectors: {
2
+ selectSettings: (_state: unknown) => any;
3
+ selectBranding: (_state: unknown) => any;
4
+ };
5
+ export default settingsSelectors;
@@ -1,5 +1,4 @@
1
1
  import { CSSProperties } from 'react';
2
- export declare const menuEditorEmptyState: CSSProperties;
3
2
  type BlockPadding = {
4
3
  top: number;
5
4
  right: number;
@@ -12,6 +11,7 @@ type BlockMargin = {
12
11
  bottom: number;
13
12
  left: number;
14
13
  } | null | undefined;
14
+ export declare const isGradientValue: (value: string | null | undefined) => boolean;
15
15
  export declare const menuNav: (backgroundColor: string, position: string, hasSlots?: boolean, blockPadding?: BlockPadding, blockMargin?: BlockMargin) => CSSProperties;
16
16
  export declare const menuSlot: (align: "start" | "center" | "end", isCenter?: boolean) => CSSProperties;
17
17
  export declare const menuList: (orientation: string, level: number, gap: string) => CSSProperties;
@@ -28,6 +28,9 @@ export type MenuItemStyleOverride = {
28
28
  export declare const menuLink: (showIcons: boolean, hasIcon: boolean, textColor: string, fontSize: string, fontWeight: string, padding: string, fontFamily?: string, itemOverride?: MenuItemStyleOverride) => CSSProperties;
29
29
  export declare const menuIcon: (iconSize: string) => CSSProperties;
30
30
  export declare const menuChildrenWrapper: (level: number) => CSSProperties;
31
+ export declare const menuSubmenuPanel: (background: string, radius: number, borderColor?: string | null, padding?: BlockPadding, minWidth?: number | null) => CSSProperties;
32
+ export declare const menuCaret: (size: number) => CSSProperties;
33
+ export declare const MENU_SUBMENU_CHEVRON_PATH = "M6 9l6 6 6-6";
31
34
  export declare const menuToggleInput: CSSProperties;
32
35
  export declare const menuBurgerLabel: (textColor: string) => CSSProperties;
33
36
  export declare const menuItemHrefFieldSx: {
@@ -85,4 +88,5 @@ export declare const addTabButtonSx: {
85
88
  };
86
89
  readonly transition: "color 0.15s, border-color 0.15s";
87
90
  };
91
+ export declare const menuEditorEmptyState: CSSProperties;
88
92
  export {};
@@ -0,0 +1,3 @@
1
+ export declare const DEFAULT_BRAND_FONT_KEY = "INTER";
2
+ export declare function resolveRootFontFamily(rootFontFamily?: string | null): string;
3
+ export declare function getBrandDefaultFontFamily(): string;
@@ -0,0 +1 @@
1
+ export declare function renderHighlightedCodeBlock(code: string, _language?: string): string;