@mission-studio/puck 1.0.5 → 1.0.15

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.
@@ -108,54 +108,6 @@ declare function useTheme(): ThemeContextValue;
108
108
 
109
109
  declare const DEFAULT_THEME: PageTheme;
110
110
 
111
- type BorderRadiusPreset = {
112
- label: string;
113
- value: number;
114
- };
115
- declare const borderRadiusScale: BorderRadiusPreset[];
116
- declare const getClosestBorderRadiusValue: (value: number) => number;
117
- declare const getBorderRadiusCSS: (value: number) => string;
118
-
119
- type ColorPreset = {
120
- label: string;
121
- value: string;
122
- };
123
- declare const neutralColors: ColorPreset[];
124
- declare const allColorPresets: ColorPreset[];
125
-
126
- type ShadowPreset = {
127
- label: string;
128
- value: string;
129
- css: string;
130
- };
131
- declare const shadowPresets: ShadowPreset[];
132
- declare const getShadowCSS: (value: string) => string;
133
-
134
- type SpacingPreset = {
135
- label: string;
136
- value: number;
137
- };
138
- declare const spacingScale: SpacingPreset[];
139
- declare const getClosestSpacingValue: (value: number) => number;
140
-
141
- type FontFamilyPreset = {
142
- label: string;
143
- value: string;
144
- };
145
- type FontSizePreset = {
146
- label: string;
147
- value: string;
148
- css: string;
149
- };
150
- type FontWeightPreset = {
151
- label: string;
152
- value: number;
153
- };
154
- declare const fontFamilies: FontFamilyPreset[];
155
- declare const fontSizes: FontSizePreset[];
156
- declare const fontWeights: FontWeightPreset[];
157
- declare const getFontSizeCSS: (value: string) => string;
158
-
159
111
  type EntryContent = Record<string, string | number | boolean | null>;
160
112
  type Entry = {
161
113
  id: string;
@@ -180,4 +132,4 @@ type ResponsiveVisibility = {
180
132
  };
181
133
  declare function ResponsiveToggleField({ value, onChangeAction, disabled, label, }: CustomFieldProps<ResponsiveVisibility>): react_jsx_runtime.JSX.Element;
182
134
 
183
- export { getBorderRadiusCSS as A, type BorderRadiusPreset as B, type ColorValue as C, DEFAULT_THEME as D, type Entry as E, type FontFamilyPreset as F, getClosestBorderRadiusValue as G, getClosestSpacingValue as H, getFontSizeCSS as I, getShadowCSS as J, neutralColors as K, shadowPresets as L, spacingScale as M, useTheme as N, type PageTheme as P, type ResponsiveVisibility as R, type ShadowPreset as S, type ThemeableColorValue as T, type EntryBoundValue as a, type ThemeColorKey as b, type CustomFieldProps as c, type ColorPreset as d, type EntryContent as e, type FontSizePreset as f, type FontWeightPreset as g, ResponsiveToggleField as h, type SpacingPreset as i, type ThemeBorderKey as j, type ThemeBorders as k, type ThemeColors as l, ThemeProvider as m, type ThemeShadowKey as n, type ThemeShadows as o, type ThemeSpacing as p, type ThemeSpacingKey as q, type ThemeTypography as r, type ThemeableBorderRadiusValue as s, type ThemeableShadowValue as t, type ThemeableSpacingValue as u, allColorPresets as v, borderRadiusScale as w, fontFamilies as x, fontSizes as y, fontWeights as z };
135
+ export { type ColorValue as C, DEFAULT_THEME as D, type Entry as E, type PageTheme as P, type ResponsiveVisibility as R, type ThemeBorderKey as T, type ThemeBorders as a, type ThemeColorKey as b, type ThemeColors as c, ThemeProvider as d, type ThemeShadowKey as e, type ThemeShadows as f, type ThemeSpacing as g, type ThemeSpacingKey as h, type ThemeTypography as i, type ThemeableBorderRadiusValue as j, type ThemeableColorValue as k, type ThemeableShadowValue as l, type ThemeableSpacingValue as m, type EntryBoundValue as n, type CustomFieldProps as o, type EntryContent as p, ResponsiveToggleField as q, useTheme as u };
@@ -108,54 +108,6 @@ declare function useTheme(): ThemeContextValue;
108
108
 
109
109
  declare const DEFAULT_THEME: PageTheme;
110
110
 
111
- type BorderRadiusPreset = {
112
- label: string;
113
- value: number;
114
- };
115
- declare const borderRadiusScale: BorderRadiusPreset[];
116
- declare const getClosestBorderRadiusValue: (value: number) => number;
117
- declare const getBorderRadiusCSS: (value: number) => string;
118
-
119
- type ColorPreset = {
120
- label: string;
121
- value: string;
122
- };
123
- declare const neutralColors: ColorPreset[];
124
- declare const allColorPresets: ColorPreset[];
125
-
126
- type ShadowPreset = {
127
- label: string;
128
- value: string;
129
- css: string;
130
- };
131
- declare const shadowPresets: ShadowPreset[];
132
- declare const getShadowCSS: (value: string) => string;
133
-
134
- type SpacingPreset = {
135
- label: string;
136
- value: number;
137
- };
138
- declare const spacingScale: SpacingPreset[];
139
- declare const getClosestSpacingValue: (value: number) => number;
140
-
141
- type FontFamilyPreset = {
142
- label: string;
143
- value: string;
144
- };
145
- type FontSizePreset = {
146
- label: string;
147
- value: string;
148
- css: string;
149
- };
150
- type FontWeightPreset = {
151
- label: string;
152
- value: number;
153
- };
154
- declare const fontFamilies: FontFamilyPreset[];
155
- declare const fontSizes: FontSizePreset[];
156
- declare const fontWeights: FontWeightPreset[];
157
- declare const getFontSizeCSS: (value: string) => string;
158
-
159
111
  type EntryContent = Record<string, string | number | boolean | null>;
160
112
  type Entry = {
161
113
  id: string;
@@ -180,4 +132,4 @@ type ResponsiveVisibility = {
180
132
  };
181
133
  declare function ResponsiveToggleField({ value, onChangeAction, disabled, label, }: CustomFieldProps<ResponsiveVisibility>): react_jsx_runtime.JSX.Element;
182
134
 
183
- export { getBorderRadiusCSS as A, type BorderRadiusPreset as B, type ColorValue as C, DEFAULT_THEME as D, type Entry as E, type FontFamilyPreset as F, getClosestBorderRadiusValue as G, getClosestSpacingValue as H, getFontSizeCSS as I, getShadowCSS as J, neutralColors as K, shadowPresets as L, spacingScale as M, useTheme as N, type PageTheme as P, type ResponsiveVisibility as R, type ShadowPreset as S, type ThemeableColorValue as T, type EntryBoundValue as a, type ThemeColorKey as b, type CustomFieldProps as c, type ColorPreset as d, type EntryContent as e, type FontSizePreset as f, type FontWeightPreset as g, ResponsiveToggleField as h, type SpacingPreset as i, type ThemeBorderKey as j, type ThemeBorders as k, type ThemeColors as l, ThemeProvider as m, type ThemeShadowKey as n, type ThemeShadows as o, type ThemeSpacing as p, type ThemeSpacingKey as q, type ThemeTypography as r, type ThemeableBorderRadiusValue as s, type ThemeableShadowValue as t, type ThemeableSpacingValue as u, allColorPresets as v, borderRadiusScale as w, fontFamilies as x, fontSizes as y, fontWeights as z };
135
+ export { type ColorValue as C, DEFAULT_THEME as D, type Entry as E, type PageTheme as P, type ResponsiveVisibility as R, type ThemeBorderKey as T, type ThemeBorders as a, type ThemeColorKey as b, type ThemeColors as c, ThemeProvider as d, type ThemeShadowKey as e, type ThemeShadows as f, type ThemeSpacing as g, type ThemeSpacingKey as h, type ThemeTypography as i, type ThemeableBorderRadiusValue as j, type ThemeableColorValue as k, type ThemeableShadowValue as l, type ThemeableSpacingValue as m, type EntryBoundValue as n, type CustomFieldProps as o, type EntryContent as p, ResponsiveToggleField as q, useTheme as u };
@@ -0,0 +1,80 @@
1
+ // design-system/borders.ts
2
+ var borderRadiusScale = [
3
+ { label: "None", value: 0 },
4
+ { label: "XS", value: 2 },
5
+ { label: "SM", value: 4 },
6
+ { label: "MD", value: 6 },
7
+ { label: "LG", value: 8 },
8
+ { label: "XL", value: 12 },
9
+ { label: "2XL", value: 16 },
10
+ { label: "3XL", value: 24 }
11
+ ];
12
+ var getClosestBorderRadiusValue = (value) => {
13
+ return borderRadiusScale.reduce(
14
+ (prev, curr) => Math.abs(curr.value - value) < Math.abs(prev.value - value) ? curr : prev
15
+ ).value;
16
+ };
17
+ var getBorderRadiusCSS = (value) => {
18
+ return `${value}px`;
19
+ };
20
+
21
+ // design-system/spacing.ts
22
+ var spacingScale = [
23
+ { label: "None", value: 0 },
24
+ { label: "2XS", value: 4 },
25
+ { label: "XS", value: 8 },
26
+ { label: "SM", value: 12 },
27
+ { label: "MD", value: 16 },
28
+ { label: "LG", value: 24 },
29
+ { label: "XL", value: 32 },
30
+ { label: "2XL", value: 48 },
31
+ { label: "3XL", value: 64 },
32
+ { label: "4XL", value: 96 }
33
+ ];
34
+ var getClosestSpacingValue = (value) => {
35
+ return spacingScale.reduce(
36
+ (prev, curr) => Math.abs(curr.value - value) < Math.abs(prev.value - value) ? curr : prev
37
+ ).value;
38
+ };
39
+
40
+ // design-system/typography.ts
41
+ var fontFamilies = [
42
+ { label: "System", value: "system-ui, sans-serif" },
43
+ { label: "Sans", value: "ui-sans-serif, system-ui, sans-serif" },
44
+ { label: "Serif", value: "ui-serif, Georgia, serif" },
45
+ { label: "Mono", value: "ui-monospace, monospace" }
46
+ ];
47
+ var fontSizes = [
48
+ { label: "XS", value: "xs", css: "0.75rem" },
49
+ { label: "SM", value: "sm", css: "0.875rem" },
50
+ { label: "Base", value: "base", css: "1rem" },
51
+ { label: "LG", value: "lg", css: "1.125rem" },
52
+ { label: "XL", value: "xl", css: "1.25rem" },
53
+ { label: "2XL", value: "2xl", css: "1.5rem" },
54
+ { label: "3XL", value: "3xl", css: "1.875rem" },
55
+ { label: "4XL", value: "4xl", css: "2.25rem" },
56
+ { label: "5XL", value: "5xl", css: "3rem" }
57
+ ];
58
+ var fontWeights = [
59
+ { label: "Light", value: 300 },
60
+ { label: "Normal", value: 400 },
61
+ { label: "Medium", value: 500 },
62
+ { label: "Semibold", value: 600 },
63
+ { label: "Bold", value: 700 }
64
+ ];
65
+ var getFontSizeCSS = (value) => {
66
+ const preset = fontSizes.find((p) => p.value === value);
67
+ return preset?.css ?? "1rem";
68
+ };
69
+
70
+ export {
71
+ borderRadiusScale,
72
+ getClosestBorderRadiusValue,
73
+ getBorderRadiusCSS,
74
+ spacingScale,
75
+ getClosestSpacingValue,
76
+ fontFamilies,
77
+ fontSizes,
78
+ fontWeights,
79
+ getFontSizeCSS
80
+ };
@@ -4,8 +4,9 @@ import {
4
4
  hexToRgba,
5
5
  useEntries,
6
6
  useTheme
7
- } from "./chunk-TTKY3YGP.mjs";
7
+ } from "./chunk-XRKFMCSS.mjs";
8
8
  import {
9
+ useGtmEvent,
9
10
  useUtmParams
10
11
  } from "./chunk-QSWQDR6M.mjs";
11
12
 
@@ -162,7 +163,6 @@ function Paragraph({
162
163
  }
163
164
 
164
165
  // components/page/Button.tsx
165
- import { sendGTMEvent } from "@next/third-parties/google";
166
166
  import { jsx as jsx3 } from "react/jsx-runtime";
167
167
  var sizeStyles = {
168
168
  sm: { padding: "8px 16px", fontSize: "0.875rem" },
@@ -199,6 +199,7 @@ function Button({
199
199
  const { resolveColor: resolveColor2 } = useTheme();
200
200
  const { getEntryValue } = useEntries();
201
201
  const utm = useUtmParams();
202
+ const sendEvent = useGtmEvent();
202
203
  const resolvedText = (() => {
203
204
  if (!text) return "Button";
204
205
  if (typeof text === "string") return text;
@@ -212,15 +213,12 @@ function Button({
212
213
  })();
213
214
  const handleClick = () => {
214
215
  const sessionId = typeof window !== "undefined" ? sessionStorage.getItem("session_id") : null;
215
- sendGTMEvent({
216
- event: "button_click",
217
- value: {
218
- text: resolvedText,
219
- href: href || void 0,
220
- variant,
221
- session_id: sessionId,
222
- ...utm
223
- }
216
+ sendEvent("button_click", {
217
+ text: resolvedText,
218
+ href: href || void 0,
219
+ variant,
220
+ session_id: sessionId,
221
+ ...utm
224
222
  });
225
223
  };
226
224
  const resolvedColor = (() => {
@@ -435,7 +433,6 @@ function Image({
435
433
 
436
434
  // components/page/ImageCarousel.tsx
437
435
  import { useState } from "react";
438
- import { sendGTMEvent as sendGTMEvent2 } from "@next/third-parties/google";
439
436
  import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
440
437
  var aspectRatioMap2 = {
441
438
  "16:9": "16 / 9",
@@ -465,6 +462,7 @@ function ImageCarousel({
465
462
  const [currentIndex, setCurrentIndex] = useState(0);
466
463
  const { resolveColor: resolveColor2 } = useTheme();
467
464
  const utm = useUtmParams();
465
+ const sendEvent = useGtmEvent();
468
466
  const resolvedArrowColor = (() => {
469
467
  if (!arrowColor) return { color: "#FFFFFF", opacity: 100 };
470
468
  if (typeof arrowColor === "string")
@@ -487,39 +485,30 @@ function ImageCarousel({
487
485
  const goToPrevious = () => {
488
486
  const newIndex = currentIndex === 0 ? images.length - 1 : currentIndex - 1;
489
487
  setCurrentIndex(newIndex);
490
- sendGTMEvent2({
491
- event: "carousel_navigate",
492
- value: {
493
- direction: "previous",
494
- slideIndex: newIndex,
495
- totalSlides: images.length,
496
- ...utm
497
- }
488
+ sendEvent("carousel_navigate", {
489
+ direction: "previous",
490
+ slideIndex: newIndex,
491
+ totalSlides: images.length,
492
+ ...utm
498
493
  });
499
494
  };
500
495
  const goToNext = () => {
501
496
  const newIndex = currentIndex === images.length - 1 ? 0 : currentIndex + 1;
502
497
  setCurrentIndex(newIndex);
503
- sendGTMEvent2({
504
- event: "carousel_navigate",
505
- value: {
506
- direction: "next",
507
- slideIndex: newIndex,
508
- totalSlides: images.length,
509
- ...utm
510
- }
498
+ sendEvent("carousel_navigate", {
499
+ direction: "next",
500
+ slideIndex: newIndex,
501
+ totalSlides: images.length,
502
+ ...utm
511
503
  });
512
504
  };
513
505
  const goToSlide = (index) => {
514
506
  setCurrentIndex(index);
515
- sendGTMEvent2({
516
- event: "carousel_navigate",
517
- value: {
518
- direction: "direct",
519
- slideIndex: index,
520
- totalSlides: images.length,
521
- ...utm
522
- }
507
+ sendEvent("carousel_navigate", {
508
+ direction: "direct",
509
+ slideIndex: index,
510
+ totalSlides: images.length,
511
+ ...utm
523
512
  });
524
513
  };
525
514
  if (images.length === 0) {
@@ -1613,7 +1602,6 @@ function FeatureGrid({
1613
1602
 
1614
1603
  // components/page/Footer.tsx
1615
1604
  import { Facebook, Instagram, Twitter } from "lucide-react";
1616
- import { sendGTMEvent as sendGTMEvent3 } from "@next/third-parties/google";
1617
1605
  import { jsx as jsx18, jsxs as jsxs7 } from "react/jsx-runtime";
1618
1606
  function Footer({
1619
1607
  logo,
@@ -1627,6 +1615,7 @@ function Footer({
1627
1615
  }) {
1628
1616
  const DropZone = puck?.renderDropZone;
1629
1617
  const utm = useUtmParams();
1618
+ const sendEvent = useGtmEvent();
1630
1619
  const getSocialPlatform = (url) => {
1631
1620
  if (url.includes("facebook")) return "facebook";
1632
1621
  if (url.includes("instagram")) return "instagram";
@@ -1635,13 +1624,10 @@ function Footer({
1635
1624
  };
1636
1625
  const handleSocialClick = (url) => {
1637
1626
  const platform = getSocialPlatform(url);
1638
- sendGTMEvent3({
1639
- event: "social_click",
1640
- value: {
1641
- platform,
1642
- url,
1643
- ...utm
1644
- }
1627
+ sendEvent("social_click", {
1628
+ platform,
1629
+ url,
1630
+ ...utm
1645
1631
  });
1646
1632
  };
1647
1633
  const socialLinks = [
@@ -1679,9 +1665,7 @@ function Footer({
1679
1665
 
1680
1666
  // components/page/Topbar.tsx
1681
1667
  import { useState as useState2 } from "react";
1682
- import Link from "next/link";
1683
1668
  import { Menu, X } from "lucide-react";
1684
- import { sendGTMEvent as sendGTMEvent4 } from "@next/third-parties/google";
1685
1669
  import { jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
1686
1670
  function Topbar({
1687
1671
  logo,
@@ -1695,26 +1679,21 @@ function Topbar({
1695
1679
  const DropZone = puck?.renderDropZone;
1696
1680
  const [mobileMenuOpen, setMobileMenuOpen] = useState2(false);
1697
1681
  const utm = useUtmParams();
1682
+ const sendEvent = useGtmEvent();
1698
1683
  const handleNavClick = (item) => {
1699
- sendGTMEvent4({
1700
- event: "nav_click",
1701
- value: {
1702
- name: item.name,
1703
- url: item.url,
1704
- linkType: item.linkType || "internal",
1705
- ...utm
1706
- }
1684
+ sendEvent("nav_click", {
1685
+ name: item.name,
1686
+ url: item.url,
1687
+ linkType: item.linkType || "internal",
1688
+ ...utm
1707
1689
  });
1708
1690
  };
1709
1691
  const handleMobileMenuToggle = () => {
1710
1692
  const newState = !mobileMenuOpen;
1711
1693
  setMobileMenuOpen(newState);
1712
- sendGTMEvent4({
1713
- event: "mobile_menu_toggle",
1714
- value: {
1715
- open: newState,
1716
- ...utm
1717
- }
1694
+ sendEvent("mobile_menu_toggle", {
1695
+ open: newState,
1696
+ ...utm
1718
1697
  });
1719
1698
  };
1720
1699
  const renderLink = (item, index) => {
@@ -1746,7 +1725,7 @@ function Topbar({
1746
1725
  );
1747
1726
  }
1748
1727
  return /* @__PURE__ */ jsx19(
1749
- Link,
1728
+ "a",
1750
1729
  {
1751
1730
  href: item.url,
1752
1731
  className,
@@ -1769,18 +1748,15 @@ function Topbar({
1769
1748
  style: { maxWidth },
1770
1749
  children: [
1771
1750
  /* @__PURE__ */ jsx19(
1772
- Link,
1751
+ "a",
1773
1752
  {
1774
1753
  href: logoUrl,
1775
1754
  className: "flex-shrink-0",
1776
- onClick: () => sendGTMEvent4({
1777
- event: "nav_click",
1778
- value: {
1779
- name: "logo",
1780
- url: logoUrl,
1781
- linkType: "internal",
1782
- ...utm
1783
- }
1755
+ onClick: () => sendEvent("nav_click", {
1756
+ name: "logo",
1757
+ url: logoUrl,
1758
+ linkType: "internal",
1759
+ ...utm
1784
1760
  }),
1785
1761
  children: logo ? /* @__PURE__ */ jsx19("img", { src: logo, alt: "Logo", className: "h-8" }) : /* @__PURE__ */ jsx19("span", { className: "text-xl font-bold", children: "Logo" })
1786
1762
  }
@@ -1812,7 +1788,6 @@ function Topbar({
1812
1788
  // components/page/Popup.tsx
1813
1789
  import { useState as useState3 } from "react";
1814
1790
  import { icons as icons4, X as X2 } from "lucide-react";
1815
- import { sendGTMEvent as sendGTMEvent5 } from "@next/third-parties/google";
1816
1791
  import { Fragment as Fragment2, jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
1817
1792
  function Icon2({ name, ...props }) {
1818
1793
  const formatted = name.charAt(0).toUpperCase() + name.slice(1);
@@ -1843,23 +1818,18 @@ function Popup({
1843
1818
  }) {
1844
1819
  const [isOpen, setIsOpen] = useState3(false);
1845
1820
  const utm = useUtmParams();
1821
+ const sendEvent = useGtmEvent();
1846
1822
  const handleOpen = () => {
1847
1823
  setIsOpen(true);
1848
- sendGTMEvent5({
1849
- event: "popup_open",
1850
- value: {
1851
- ctaText,
1852
- type: textLink ? "link" : "button",
1853
- ...utm
1854
- }
1824
+ sendEvent("popup_open", {
1825
+ ctaText,
1826
+ type: textLink ? "link" : "button",
1827
+ ...utm
1855
1828
  });
1856
1829
  };
1857
1830
  const handleClose = () => {
1858
1831
  setIsOpen(false);
1859
- sendGTMEvent5({
1860
- event: "popup_close",
1861
- value: { ctaText, ...utm }
1862
- });
1832
+ sendEvent("popup_close", { ctaText, ...utm });
1863
1833
  };
1864
1834
  const trigger = textLink ? /* @__PURE__ */ jsx20(
1865
1835
  "button",