@cntrl-site/components 1.0.100 → 1.0.102

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 (130) hide show
  1. package/README.md +25 -1
  2. package/dist/Burger-C6jI6C1c.js +661 -0
  3. package/dist/Burger-EMSn7TPB.mjs +1807 -0
  4. package/dist/ClickGallerie-D_O1XhAO.mjs +270 -0
  5. package/dist/ClickGallerie-M9xdGR1G.js +36 -0
  6. package/dist/Components/Burger/BurgerComponent.d.ts +0 -1
  7. package/dist/Components/ClickGallerie/ClickGallerieComponent.d.ts +0 -1
  8. package/dist/Components/FAQ/FAQComponent.d.ts +0 -1
  9. package/dist/Components/Form/FormComponent.d.ts +0 -1
  10. package/dist/Components/Grid/GridComponent.d.ts +0 -1
  11. package/dist/Components/Helix/HelixComponent.d.ts +0 -1
  12. package/dist/Components/Hive/HiveComponent.d.ts +0 -1
  13. package/dist/Components/LightboxJournal/LightboxJournalComponent.d.ts +0 -1
  14. package/dist/Components/LightboxStrip/LightboxStripComponent.d.ts +0 -1
  15. package/dist/Components/List/ListComponent.d.ts +0 -1
  16. package/dist/Components/Marquee/MarqueeComponent.d.ts +0 -1
  17. package/dist/Components/MarqueeText/MarqueeTextComponent.d.ts +0 -1
  18. package/dist/Components/Mercury/MercuryComponent.d.ts +0 -1
  19. package/dist/Components/OnelinerForm/OnelinerFormComponent.d.ts +0 -1
  20. package/dist/Components/Pretext/PretextComponent.d.ts +0 -1
  21. package/dist/Components/Scale/ScaleComponent.d.ts +0 -1
  22. package/dist/Components/SimpleButton/SimpleButtonComponent.d.ts +0 -1
  23. package/dist/Components/Slider20/Slider20Component.d.ts +0 -1
  24. package/dist/Components/TestimonialGrid/TestimonialGridComponent.d.ts +0 -1
  25. package/dist/Components/TestimonialSingle/TestimonialSingleComponent.d.ts +0 -1
  26. package/dist/Components/Waterfall/WaterfallComponent.d.ts +0 -1
  27. package/dist/ControlSlider-SiOt22l_.js +1 -0
  28. package/dist/ControlSlider-pZv7H6BU.mjs +334 -0
  29. package/dist/FAQ-C7823fyi.js +166 -0
  30. package/dist/FAQ-CZ39u4m8.mjs +588 -0
  31. package/dist/Form-BX5_41nb.mjs +472 -0
  32. package/dist/Form-Dn-6A1He.js +153 -0
  33. package/dist/Grid-CemGhf3F.js +374 -0
  34. package/dist/Grid-cfQsXW3b.mjs +1553 -0
  35. package/dist/Helix-2Vr-9WBa.js +43 -0
  36. package/dist/Helix-BmkAKT1G.mjs +315 -0
  37. package/dist/Hive-BC6zQBsv.js +321 -0
  38. package/dist/Hive-BGMWinrW.mjs +1425 -0
  39. package/dist/HiveLightboxTitles-DhEeFKWs.mjs +507 -0
  40. package/dist/HiveLightboxTitles-DlyptAaK.js +1 -0
  41. package/dist/ImageRevealSlider-BBWtFjUF.js +1 -0
  42. package/dist/ImageRevealSlider-BdFGyVEP.mjs +184 -0
  43. package/dist/Lightbox-CIss_nOG.js +1 -0
  44. package/dist/Lightbox-eP9qAZzL.mjs +665 -0
  45. package/dist/LightboxJournal-D59ex6wH.mjs +1613 -0
  46. package/dist/LightboxJournal-DAEZOPDi.js +523 -0
  47. package/dist/LightboxStrip-BDjI1jyH.js +386 -0
  48. package/dist/LightboxStrip-YspzBP8N.mjs +1574 -0
  49. package/dist/List-C32WImI3.js +377 -0
  50. package/dist/List-DW7fyJbf.mjs +1891 -0
  51. package/dist/Marquee-BYClHHws.mjs +551 -0
  52. package/dist/Marquee-vmHaTGIP.js +133 -0
  53. package/dist/MarqueeText-4Rip_sQX.mjs +515 -0
  54. package/dist/MarqueeText-E6OubMOG.js +132 -0
  55. package/dist/Mercury-BwF_XW2w.js +267 -0
  56. package/dist/Mercury-DuKJQ1Zo.mjs +1701 -0
  57. package/dist/OnelinerForm-BEu7_sho.mjs +434 -0
  58. package/dist/OnelinerForm-C2Y_XMCY.js +194 -0
  59. package/dist/Pretext-10CcyP1E.mjs +2762 -0
  60. package/dist/Pretext-DvQ3xsni.js +231 -0
  61. package/dist/PretextComponent-C3YFICy8.js +1 -0
  62. package/dist/PretextComponent-Ct0newmn.mjs +11624 -0
  63. package/dist/RichTextRenderer-B6WtTYlR.mjs +32 -0
  64. package/dist/RichTextRenderer-CIy6yI8U.js +1 -0
  65. package/dist/Scale-976sjO8e.js +111 -0
  66. package/dist/Scale-rLNT4KAk.mjs +345 -0
  67. package/dist/SimpleButton-C-o2W9bS.mjs +451 -0
  68. package/dist/SimpleButton-nGEcO2gB.js +243 -0
  69. package/dist/Slider20-C9o2REDl.js +272 -0
  70. package/dist/Slider20-Dm8BeCli.mjs +851 -0
  71. package/dist/SvgImage-B5mR9y6q.mjs +51 -0
  72. package/dist/SvgImage-DFlmxAoL.js +1 -0
  73. package/dist/TestimonialGrid-CPu4qQ6B.mjs +492 -0
  74. package/dist/TestimonialGrid-D4ieiz9e.js +90 -0
  75. package/dist/TestimonialSingle-CVu15ZtV.js +125 -0
  76. package/dist/TestimonialSingle-DLdnAVF7.mjs +391 -0
  77. package/dist/Waterfall-A0FjM2my.mjs +1400 -0
  78. package/dist/Waterfall-DnPDHbCL.js +287 -0
  79. package/dist/buildColorVars-CE2D5cQV.js +1 -0
  80. package/dist/buildColorVars-CLyWQm5K.mjs +21 -0
  81. package/dist/components-OE3ac1dr.js +1 -0
  82. package/dist/components-w-jHX-2U.mjs +2053 -0
  83. package/dist/components.css +1 -1
  84. package/dist/elements.d.ts +7 -0
  85. package/dist/elements.js +1 -0
  86. package/dist/elements.mjs +63 -0
  87. package/dist/elements.node.d.ts +6 -0
  88. package/dist/elements.node.js +1 -0
  89. package/dist/elements.node.mjs +21 -0
  90. package/dist/forking.d.ts +1 -0
  91. package/dist/formFieldValidation-DZl2KVaF.js +1 -0
  92. package/dist/formFieldValidation-DvihFrq5.mjs +21 -0
  93. package/dist/getColorAlpha-BVBY0N5x.mjs +39 -0
  94. package/dist/getColorAlpha-CoSseoCn.js +1 -0
  95. package/dist/getImageRect-BQhQXvT8.js +1 -0
  96. package/dist/getImageRect-CBMhFNHM.mjs +109 -0
  97. package/dist/index.d.ts +1 -0
  98. package/dist/index.js +1 -28866
  99. package/dist/index.mjs +16 -62477
  100. package/dist/loadSvgMaskUrl-DfF7ay6h.js +1 -0
  101. package/dist/loadSvgMaskUrl-xHgGYgPe.mjs +20 -0
  102. package/dist/panelAvailability-D179wwJx.mjs +27 -0
  103. package/dist/panelAvailability-DnOe0rQ4.js +1 -0
  104. package/dist/react-splide.esm-CabaEmHi.js +6 -0
  105. package/dist/react-splide.esm-DQqds4PL.mjs +1750 -0
  106. package/dist/readTestimonialTextMeasure-BIXpGFEt.mjs +13 -0
  107. package/dist/readTestimonialTextMeasure-CEPaB4Sy.js +1 -0
  108. package/dist/scalingValue-C9JH5L6O.mjs +6 -0
  109. package/dist/scalingValue-CSHYgTZl.js +1 -0
  110. package/dist/sources.d.ts +1 -0
  111. package/dist/sources.js +23753 -0
  112. package/dist/sources.mjs +23779 -0
  113. package/dist/textStylesToCss-05Mn6I_2.mjs +32 -0
  114. package/dist/textStylesToCss-CNN3zZTV.js +1 -0
  115. package/dist/types/Component.d.ts +0 -1
  116. package/dist/useLightboxScrollLock-Hf16Eq4g.js +1 -0
  117. package/dist/useLightboxScrollLock-VQ07s7EJ.mjs +18 -0
  118. package/dist/useLightboxSwipeDismiss-Br9uE5G0.js +1 -0
  119. package/dist/useLightboxSwipeDismiss-SGv6Ra33.mjs +95 -0
  120. package/dist/useScopedStyles-Bf6yohVQ.js +1 -0
  121. package/dist/useScopedStyles-DhBG3557.mjs +11 -0
  122. package/dist/utils-033j3qNL.js +1 -0
  123. package/dist/utils-FxC9rcxw.mjs +247 -0
  124. package/dist/utils.js +1 -1
  125. package/dist/utils.mjs +17 -11
  126. package/package.json +31 -2
  127. package/dist/index-2JTNRDR1.js +0 -1
  128. package/dist/index-DA8t6EZ4.mjs +0 -255
  129. package/dist/panelAvailability-CgSic84c.mjs +0 -126
  130. package/dist/panelAvailability-D8c7cdbu.js +0 -1
@@ -0,0 +1,32 @@
1
+ import { s as r } from "./scalingValue-C9JH5L6O.mjs";
2
+ const c = (t) => {
3
+ const n = t.trim();
4
+ return !n || n.startsWith('"') && n.endsWith('"') || n.startsWith("'") && n.endsWith("'") ? !1 : n.split(/\s+/g).filter(Boolean).some((e) => /^\d/.test(e));
5
+ }, f = (t) => t && t.split(",").map((o) => o.trim()).filter(Boolean).map((o) => c(o) ? `"${o.replace(/"/g, '\\"')}"` : o).join(", ");
6
+ function l(t) {
7
+ const { color: n, ...o } = t;
8
+ return o;
9
+ }
10
+ function g(t, n) {
11
+ var a, i, s;
12
+ const { fontSize: o, lineHeight: e } = t;
13
+ return {
14
+ fontFamily: f(t.fontSettings.fontFamily),
15
+ fontWeight: t.fontSettings.fontWeight,
16
+ fontStyle: t.fontSettings.fontStyle,
17
+ letterSpacing: r(t.letterSpacing, n),
18
+ wordSpacing: r(t.wordSpacing, n),
19
+ fontSize: r(o, n),
20
+ lineHeight: e !== void 0 ? r(e, n) : void 0,
21
+ textTransform: (a = t.textAppearance) == null ? void 0 : a.textTransform,
22
+ textDecoration: (i = t.textAppearance) == null ? void 0 : i.textDecoration,
23
+ fontVariant: (s = t.textAppearance) == null ? void 0 : s.fontVariant,
24
+ textAlign: t.textAlign,
25
+ color: t.color
26
+ };
27
+ }
28
+ export {
29
+ f as n,
30
+ l as o,
31
+ g as t
32
+ };
@@ -0,0 +1 @@
1
+ "use strict";const r=require("./scalingValue-CSHYgTZl.js"),l=t=>{const n=t.trim();return!n||n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'")?!1:n.split(/\s+/g).filter(Boolean).some(o=>/^\d/.test(o))},c=t=>t&&t.split(",").map(e=>e.trim()).filter(Boolean).map(e=>l(e)?`"${e.replace(/"/g,'\\"')}"`:e).join(", ");function u(t){const{color:n,...e}=t;return e}function f(t,n){var i,a,s;const{fontSize:e,lineHeight:o}=t;return{fontFamily:c(t.fontSettings.fontFamily),fontWeight:t.fontSettings.fontWeight,fontStyle:t.fontSettings.fontStyle,letterSpacing:r.scalingValue(t.letterSpacing,n),wordSpacing:r.scalingValue(t.wordSpacing,n),fontSize:r.scalingValue(e,n),lineHeight:o!==void 0?r.scalingValue(o,n):void 0,textTransform:(i=t.textAppearance)==null?void 0:i.textTransform,textDecoration:(a=t.textAppearance)==null?void 0:a.textDecoration,fontVariant:(s=t.textAppearance)==null?void 0:s.fontVariant,textAlign:t.textAlign,color:t.color}}exports.normalizeFontFamilyCssValue=c;exports.omitTextColors=u;exports.textStylesToCss=f;
@@ -22,7 +22,6 @@ export type Component = {
22
22
  type: 'image' | 'video';
23
23
  url: string;
24
24
  };
25
- sourceCode?: string;
26
25
  fontRelations?: Record<string, string>;
27
26
  assetsPaths?: {
28
27
  content: Path[];
@@ -0,0 +1 @@
1
+ "use strict";const u=require("react"),y="[data-lightbox-scrollable]",m=(o=!0)=>{u.useEffect(()=>{if(!o)return;const t=window.scrollY,d=document.body.style.overflow,s=document.body.style.position,c=document.body.style.top,i=document.body.style.width,r=document.documentElement.style.overflow;document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.top=`-${t}px`,document.body.style.width="100%",document.documentElement.style.overflow="hidden";const e=n=>{const l=n.target;l instanceof Element&&l.closest(y)||n.preventDefault()};return document.addEventListener("touchmove",e,{passive:!1}),()=>{document.removeEventListener("touchmove",e),document.body.style.overflow=d,document.body.style.position=s,document.body.style.top=c,document.body.style.width=i,document.documentElement.style.overflow=r,window.scrollTo({top:t,left:0,behavior:"instant"})}},[o])};exports.useLightboxScrollLock=m;
@@ -0,0 +1,18 @@
1
+ import { useEffect as y } from "react";
2
+ const m = "[data-lightbox-scrollable]", f = (o = !0) => {
3
+ y(() => {
4
+ if (!o) return;
5
+ const t = window.scrollY, d = document.body.style.overflow, s = document.body.style.position, c = document.body.style.top, i = document.body.style.width, r = document.documentElement.style.overflow;
6
+ document.body.style.overflow = "hidden", document.body.style.position = "fixed", document.body.style.top = `-${t}px`, document.body.style.width = "100%", document.documentElement.style.overflow = "hidden";
7
+ const e = (n) => {
8
+ const l = n.target;
9
+ l instanceof Element && l.closest(m) || n.preventDefault();
10
+ };
11
+ return document.addEventListener("touchmove", e, { passive: !1 }), () => {
12
+ document.removeEventListener("touchmove", e), document.body.style.overflow = d, document.body.style.position = s, document.body.style.top = c, document.body.style.width = i, document.documentElement.style.overflow = r, window.scrollTo({ top: t, left: 0, behavior: "instant" });
13
+ };
14
+ }, [o]);
15
+ };
16
+ export {
17
+ f as u
18
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react"),H=r=>r.display==="cover",T=r=>{const p=r.ratioValue??"1:1",s=r.reversed??!1,[a,o]=p.split(":").map(Number);return`${s?o:a} / ${s?a:o}`},Y=100,W=.2,R=8,X=({enabled:r,onClose:p,animMs:s=300,isBlockedTarget:a})=>{const[o,d]=e.useState(0),[c,h]=e.useState(!1),g=e.useRef(null),C=e.useRef(0);C.current=o;const u=e.useMemo(()=>typeof window>"u"?Y:Math.max(Y,window.innerHeight*W),[]),P=e.useCallback(t=>Math.max(0,1-t/(u*1.5)),[u]),b=e.useCallback(t=>Math.max(0,1-t/(u*.45)),[u]),x=e.useCallback(t=>{const n=typeof window<"u"?window.innerHeight:800,l=Math.max(.88,1-t/n*.12);return`translateY(${t}px) scale(${l})`},[]),i=e.useCallback(()=>{g.current=null},[]),I=e.useCallback(()=>{h(!0),d(0),window.setTimeout(()=>h(!1),s),i()},[s,i]),y=e.useCallback(()=>{const t=typeof window<"u"?window.innerHeight:800;h(!0),d(t),window.setTimeout(()=>{p(),i(),h(!1)},Math.min(s,200))},[s,p,i]),A=e.useCallback(t=>{!r||c||t.pointerType==="touch"&&(a!=null&&a(t.target)||(g.current={startX:t.clientX,startY:t.clientY,isLocked:null,pointerId:t.pointerId}))},[r,c,a]),O=e.useCallback(t=>{const n=g.current;if(!r||!n||t.pointerType!=="touch"||n.pointerId!==t.pointerId)return;const l=t.clientX-n.startX,f=t.clientY-n.startY;if(n.isLocked===null){if(Math.abs(l)<R&&Math.abs(f)<R)return;if(f>0&&f>Math.abs(l))n.isLocked=!0,t.currentTarget.setPointerCapture(t.pointerId);else{n.isLocked=!1,i();return}}if(!n.isLocked)return;t.preventDefault();const k=Math.max(0,f);C.current=k,d(k)},[r,i]),w=e.useCallback(t=>{const n=g.current;if(!r||!n||t.pointerType!=="touch"||n.pointerId!==t.pointerId)return;const l=n.isLocked===!0;if(t.currentTarget.hasPointerCapture(t.pointerId)&&t.currentTarget.releasePointerCapture(t.pointerId),!l){i();return}t.clientY-n.startY>=u?y():I()},[u,y,r,i,I]),L=e.useCallback(t=>{w(t)},[w]),M=e.useCallback(t=>{w(t)},[w]),m=o>0,D=c?`transform ${s}ms ease`:"none",S=c?`opacity ${s}ms ease`:"none",_=o>0||c;return{isSwipeDragging:m,backdropStyle:{opacity:P(o),transition:S},mediaAreaStyle:{transform:x(o),transition:D,touchAction:m?"none":void 0,willChange:m?"transform":void 0},overlayContentStyle:_?{opacity:b(o),transition:S}:void 0,swipeHandlers:r?{onPointerDown:A,onPointerMove:O,onPointerUp:L,onPointerCancel:M}:{},dismissAreaStyle:r?{touchAction:m?"none":"pan-x"}:void 0}};exports.getAspectRatio=T;exports.isImageRatioCover=H;exports.useLightboxSwipeDismiss=X;
@@ -0,0 +1,95 @@
1
+ import { useState as P, useRef as x, useMemo as k, useCallback as r } from "react";
2
+ const N = (n) => n.display === "cover", G = (n) => {
3
+ const d = n.ratioValue ?? "1:1", o = n.reversed ?? !1, [a, i] = d.split(":").map(Number);
4
+ return `${o ? i : a} / ${o ? a : i}`;
5
+ }, O = 100, E = 0.2, A = 8, V = ({
6
+ enabled: n,
7
+ onClose: d,
8
+ animMs: o = 300,
9
+ isBlockedTarget: a
10
+ }) => {
11
+ const [i, l] = P(0), [c, h] = P(!1), g = x(null), I = x(0);
12
+ I.current = i;
13
+ const u = k(() => typeof window > "u" ? O : Math.max(O, window.innerHeight * E), []), M = r((t) => Math.max(0, 1 - t / (u * 1.5)), [u]), L = r((t) => Math.max(0, 1 - t / (u * 0.45)), [u]), R = r((t) => {
14
+ const e = typeof window < "u" ? window.innerHeight : 800, f = Math.max(0.88, 1 - t / e * 0.12);
15
+ return `translateY(${t}px) scale(${f})`;
16
+ }, []), s = r(() => {
17
+ g.current = null;
18
+ }, []), y = r(() => {
19
+ h(!0), l(0), window.setTimeout(() => h(!1), o), s();
20
+ }, [o, s]), S = r(() => {
21
+ const t = typeof window < "u" ? window.innerHeight : 800;
22
+ h(!0), l(t), window.setTimeout(() => {
23
+ d(), s(), h(!1);
24
+ }, Math.min(o, 200));
25
+ }, [o, d, s]), _ = r((t) => {
26
+ !n || c || t.pointerType === "touch" && (a != null && a(t.target) || (g.current = {
27
+ startX: t.clientX,
28
+ startY: t.clientY,
29
+ isLocked: null,
30
+ pointerId: t.pointerId
31
+ }));
32
+ }, [n, c, a]), D = r((t) => {
33
+ const e = g.current;
34
+ if (!n || !e || t.pointerType !== "touch" || e.pointerId !== t.pointerId) return;
35
+ const f = t.clientX - e.startX, p = t.clientY - e.startY;
36
+ if (e.isLocked === null) {
37
+ if (Math.abs(f) < A && Math.abs(p) < A)
38
+ return;
39
+ if (p > 0 && p > Math.abs(f))
40
+ e.isLocked = !0, t.currentTarget.setPointerCapture(t.pointerId);
41
+ else {
42
+ e.isLocked = !1, s();
43
+ return;
44
+ }
45
+ }
46
+ if (!e.isLocked) return;
47
+ t.preventDefault();
48
+ const C = Math.max(0, p);
49
+ I.current = C, l(C);
50
+ }, [n, s]), m = r((t) => {
51
+ const e = g.current;
52
+ if (!n || !e || t.pointerType !== "touch" || e.pointerId !== t.pointerId) return;
53
+ const f = e.isLocked === !0;
54
+ if (t.currentTarget.hasPointerCapture(t.pointerId) && t.currentTarget.releasePointerCapture(t.pointerId), !f) {
55
+ s();
56
+ return;
57
+ }
58
+ t.clientY - e.startY >= u ? S() : y();
59
+ }, [u, S, n, s, y]), H = r((t) => {
60
+ m(t);
61
+ }, [m]), T = r((t) => {
62
+ m(t);
63
+ }, [m]), w = i > 0, W = c ? `transform ${o}ms ease` : "none", Y = c ? `opacity ${o}ms ease` : "none", X = i > 0 || c;
64
+ return {
65
+ isSwipeDragging: w,
66
+ backdropStyle: {
67
+ opacity: M(i),
68
+ transition: Y
69
+ },
70
+ mediaAreaStyle: {
71
+ transform: R(i),
72
+ transition: W,
73
+ touchAction: w ? "none" : void 0,
74
+ willChange: w ? "transform" : void 0
75
+ },
76
+ overlayContentStyle: X ? {
77
+ opacity: L(i),
78
+ transition: Y
79
+ } : void 0,
80
+ swipeHandlers: n ? {
81
+ onPointerDown: _,
82
+ onPointerMove: D,
83
+ onPointerUp: H,
84
+ onPointerCancel: T
85
+ } : {},
86
+ dismissAreaStyle: n ? {
87
+ touchAction: w ? "none" : "pan-x"
88
+ } : void 0
89
+ };
90
+ };
91
+ export {
92
+ G as g,
93
+ N as i,
94
+ V as u
95
+ };
@@ -0,0 +1 @@
1
+ "use strict";const s=require("react");function t(){const e=`cf-${s.useId().replace(/:/g,"")}`;return{prefix:e,cls:c=>`${e}-${c}`}}exports.useScopedStyles=t;
@@ -0,0 +1,11 @@
1
+ import { useId as o } from "react";
2
+ function t() {
3
+ const e = `cf-${o().replace(/:/g, "")}`;
4
+ return {
5
+ prefix: e,
6
+ cls: (c) => `${e}-${c}`
7
+ };
8
+ }
9
+ export {
10
+ t as u
11
+ };
@@ -0,0 +1 @@
1
+ "use strict";const y=require("./textStylesToCss-CNN3zZTV.js"),p=50,P=10,T="cntrl-lightbox-journal",u=T,h=`${T}-`,f=t=>`${T}-${t}`,g=t=>t===u||t.startsWith(h),_=t=>{if(!t)return null;const e=Number.parseInt(t,10);return Number.isFinite(e)&&e>=1?e:null},N=t=>{if(typeof window>"u")return null;const e=new URLSearchParams(window.location.search);if(t){const r=_(e.get(f(t)));if(r)return r}const n=_(e.get(u));if(n)return n;for(const[r]of e){if(!r.startsWith(h))continue;const i=r.slice(h.length);if(!/^\d+$/.test(i))continue;const o=Number.parseInt(i,10);if(Number.isFinite(o)&&o>=1)return o}return null},I=(t,e)=>{if(e<=0)return-1;const n=t-1;return n<0||n>=e?-1:n},R=(t,e,n=!0)=>{if(typeof window>"u")return;const r=new URL(window.location.href);[...r.searchParams.keys()].forEach(l=>{g(l)&&r.searchParams.delete(l)}),e?r.searchParams.set(f(e),String(t)):r.searchParams.set(u,String(t));const i=n?"replaceState":"pushState",o=`${r.pathname}${r.search}${r.hash}`;window.history[i](window.history.state,"",o)},U=t=>{if(typeof window>"u")return;const e=new URL(window.location.href),n=[...e.searchParams.keys()].filter(r=>t?r===f(t)||r===u:g(r));if(n.forEach(r=>e.searchParams.delete(r)),n.length>0){const r=`${e.pathname}${e.search}${e.hash}`;window.history.replaceState(window.history.state,"",r)}},m=t=>{if(typeof window>"u")return!1;const e=new URLSearchParams(window.location.search);return t?e.has(f(t)):[...e.keys()].some(n=>g(n))},x=(t,e)=>{if(m(e)){if(t){window.history.back();return}U(e)}},W=20,$=2,b=t=>`max(${t}, ${W}px)`,s=t=>((t==null?void 0:t.image)??[]).slice(0,$),E=t=>t.reduce((e,n)=>e+s(n).length,0),C=(t,e)=>{const n=t.slice(0,e).reduce((i,o)=>i+s(o).length,1),r=s(t[e]).length;return{start:n,end:n+r-1}},F=(t,e)=>{const n=E(t),{start:r,end:i}=C(t,e);return r===i?`${r} / ${n}`:`${r}-${i} / ${n}`},O=(t,e)=>e==="B"?t.flatMap((n,r)=>s(n).map(i=>({entry:n,entryIndex:r,images:[i]}))):t.map((n,r)=>({entry:n,entryIndex:r,images:s(n)})),D=(t,e,n,r)=>{var o;if(n==="B")return`${e+1} / ${t.length}`;const i=((o=t[e])==null?void 0:o.entryIndex)??0;return F(r,i)},K=t=>t?`${t.title1??""}|${t.title2??""}|${t.title3??""}`:"",X=(t,e,n)=>t==="B"?e.length>1:E(n)>1,M=.004,H=.004,B={title1Width:.13,title2Width:.13,title3Width:.14},Y=(t,e,n,r,i)=>{const o=[];return e.title1&&o.push({prefix:"title1",widthKey:"title1Width",className:`${t}-title1`,style:n,text:e.title1}),e.title2&&o.push({prefix:"title2",widthKey:"title2Width",marginLeftKey:"title2MarginLeft",className:`${t}-title2`,style:r,text:e.title2}),e.title3&&o.push({prefix:"title3",widthKey:"title3Width",marginLeftKey:"title3MarginLeft",className:`${t}-title3`,style:i,text:e.title3}),o},S=(t,e)=>{if(t<=0)return[];const n=e.slice(0,t),r=n.reduce((o,l)=>o+l,0);if(r<=1)return n;const{widths:i}=[...n].reverse().reduce(({overflow:o,widths:l},c)=>{if(o<=0||c<=0)return{overflow:o,widths:[c,...l]};const d=Math.min(o,c);return{overflow:o-d,widths:[c-d,...l]}},{overflow:r-1,widths:[]});return i},A=(t,e)=>S(t,e),v=(t,e)=>{const n=e.filter((r,i)=>i!==t).reduce((r,i)=>r+i,0);return Math.max(1-n,0)},G=(t,e)=>{const n=t.map(r=>e[r.widthKey]??0);return{resolved:S(t.length,n),effective:A(t.length,n)}},z=(t,e,n,r)=>t.slice(0,r).reduce((i,o,l)=>i+(o!=null&&o.marginLeftKey?n[o.marginLeftKey]??0:0)+(e[l]??0),0),j=(t,e,n,r)=>t.slice(0,r+1).reduce((i,o,l)=>i+(o!=null&&o.marginLeftKey?n[o.marginLeftKey]??0:0)+(e[l]??0),0),L=["title1","title2","title3","count"],a=(t,e)=>`${t}${e.charAt(0).toUpperCase()}${e.slice(1)}`,J={title1:"1",title2:"2",title3:"3",count:"Count"},w=t=>[a(t,"fontFamily"),a(t,"fontSettings"),{type:"row",items:[a(t,"fontSize"),a(t,"lineHeight"),a(t,"letterSpacing"),a(t,"wordSpacing")]},a(t,"textAlign"),a(t,"textAppearance")],k=()=>({type:"tab",id:"journalTextStyle",tabs:Object.fromEntries(L.map(t=>[J[t],w(t)]))}),V={title1:"title1Color",title2:"title2Color",title3:"title3Color",count:"countColor"},Z={title1:.02,title2:.02,title3:.02,count:.017},q=(t,e)=>{const n=r=>{const i=a(e,r);return t[i]};return{fontFamily:n("fontFamily")??"Arial",fontSettings:n("fontSettings")??{fontWeight:400,fontStyle:"normal"},fontSize:n("fontSize"),lineHeight:n("lineHeight"),letterSpacing:n("letterSpacing")??0,wordSpacing:n("wordSpacing")??0,textAlign:n("textAlign")??"left",textAppearance:n("textAppearance"),color:t[V[e]]}},Q=(t,e,n)=>{var i,o;const r={fontSettings:{fontFamily:e.fontFamily,fontWeight:((i=e.fontSettings)==null?void 0:i.fontWeight)??400,fontStyle:((o=e.fontSettings)==null?void 0:o.fontStyle)??"normal"},fontSize:e.fontSize??Z[t],lineHeight:e.lineHeight,letterSpacing:e.letterSpacing,wordSpacing:e.wordSpacing,textAlign:e.textAlign,textAppearance:e.textAppearance,color:e.color??"#ffffff"};return y.textStylesToCss(r,n)};exports.DEFAULT_JOURNAL_TITLE_WIDTHS=B;exports.JOURNAL_TEXT_STYLE_PREFIXES=L;exports.JOURNAL_TEXT_STYLE_TAB_LABELS=J;exports.STRIP_NAV_SWIPE_MIN_PX=p;exports.STRIP_NAV_TAP_MAX_PX=P;exports.TITLE_PADDING_HANDLE_WIDTH=H;exports.TITLE_RESIZE_HANDLE_WIDTH=M;exports.buildJournalSlides=O;exports.buildJournalTitleSlots=Y;exports.createJournalTextStylePanelTab=k;exports.createJournalTextStyleTabContentItems=w;exports.findJournalUrlSlideNumber=N;exports.formatSlideCounter=D;exports.getEffectiveJournalTitleWidths=A;exports.getEntryImages=s;exports.getEntryTitleKey=K;exports.getGapControlSize=b;exports.getJournalTextStyleSettingKey=a;exports.getJournalTitleBoundaryOffset=j;exports.getJournalTitleMaxWidth=v;exports.getJournalTitleOffsetBeforeSlot=z;exports.getRowScopedJournalTitleWidths=G;exports.hasJournalUrlParam=m;exports.journalTextFieldsToCss=Q;exports.removeJournalUrlParam=x;exports.resolveJournalTextFields=q;exports.resolveJournalTitleWidths=S;exports.setJournalUrlParam=R;exports.shouldShowCounter=X;exports.slideNumberToIndex=I;
@@ -0,0 +1,247 @@
1
+ import { t as A } from "./textStylesToCss-05Mn6I_2.mjs";
2
+ const W = 50, b = 10, g = "cntrl-lightbox-journal", u = g, f = `${g}-`, h = (t) => `${g}-${t}`, d = (t) => t === u || t.startsWith(f), S = (t) => {
3
+ if (!t) return null;
4
+ const e = Number.parseInt(t, 10);
5
+ return Number.isFinite(e) && e >= 1 ? e : null;
6
+ }, C = (t) => {
7
+ if (typeof window > "u") return null;
8
+ const e = new URLSearchParams(window.location.search);
9
+ if (t) {
10
+ const r = S(e.get(h(t)));
11
+ if (r) return r;
12
+ }
13
+ const n = S(e.get(u));
14
+ if (n) return n;
15
+ for (const [r] of e) {
16
+ if (!r.startsWith(f)) continue;
17
+ const a = r.slice(f.length);
18
+ if (!/^\d+$/.test(a)) continue;
19
+ const o = Number.parseInt(a, 10);
20
+ if (Number.isFinite(o) && o >= 1)
21
+ return o;
22
+ }
23
+ return null;
24
+ }, K = (t, e) => {
25
+ if (e <= 0) return -1;
26
+ const n = t - 1;
27
+ return n < 0 || n >= e ? -1 : n;
28
+ }, F = (t, e, n = !0) => {
29
+ if (typeof window > "u") return;
30
+ const r = new URL(window.location.href);
31
+ [...r.searchParams.keys()].forEach((s) => {
32
+ d(s) && r.searchParams.delete(s);
33
+ }), e ? r.searchParams.set(h(e), String(t)) : r.searchParams.set(u, String(t));
34
+ const a = n ? "replaceState" : "pushState", o = `${r.pathname}${r.search}${r.hash}`;
35
+ window.history[a](window.history.state, "", o);
36
+ }, w = (t) => {
37
+ if (typeof window > "u") return;
38
+ const e = new URL(window.location.href), n = [...e.searchParams.keys()].filter((r) => t ? r === h(t) || r === u : d(r));
39
+ if (n.forEach((r) => e.searchParams.delete(r)), n.length > 0) {
40
+ const r = `${e.pathname}${e.search}${e.hash}`;
41
+ window.history.replaceState(window.history.state, "", r);
42
+ }
43
+ }, p = (t) => {
44
+ if (typeof window > "u") return !1;
45
+ const e = new URLSearchParams(window.location.search);
46
+ return t ? e.has(h(t)) : [...e.keys()].some((n) => d(n));
47
+ }, M = (t, e) => {
48
+ if (p(e)) {
49
+ if (t) {
50
+ window.history.back();
51
+ return;
52
+ }
53
+ w(e);
54
+ }
55
+ }, E = 20, L = 2, O = (t) => `max(${t}, ${E}px)`, l = (t) => ((t == null ? void 0 : t.image) ?? []).slice(0, L), T = (t) => t.reduce((e, n) => e + l(n).length, 0), y = (t, e) => {
56
+ const n = t.slice(0, e).reduce(
57
+ (a, o) => a + l(o).length,
58
+ 1
59
+ ), r = l(t[e]).length;
60
+ return { start: n, end: n + r - 1 };
61
+ }, P = (t, e) => {
62
+ const n = T(t), { start: r, end: a } = y(t, e);
63
+ return r === a ? `${r} / ${n}` : `${r}-${a} / ${n}`;
64
+ }, X = (t, e) => e === "B" ? t.flatMap(
65
+ (n, r) => l(n).map((a) => ({
66
+ entry: n,
67
+ entryIndex: r,
68
+ images: [a]
69
+ }))
70
+ ) : t.map((n, r) => ({
71
+ entry: n,
72
+ entryIndex: r,
73
+ images: l(n)
74
+ })), D = (t, e, n, r) => {
75
+ var o;
76
+ if (n === "B")
77
+ return `${e + 1} / ${t.length}`;
78
+ const a = ((o = t[e]) == null ? void 0 : o.entryIndex) ?? 0;
79
+ return P(r, a);
80
+ }, H = (t) => t ? `${t.title1 ?? ""}|${t.title2 ?? ""}|${t.title3 ?? ""}` : "", Y = (t, e, n) => t === "B" ? e.length > 1 : T(n) > 1, B = 4e-3, v = 4e-3, z = {
81
+ title1Width: 0.13,
82
+ title2Width: 0.13,
83
+ title3Width: 0.14
84
+ }, G = (t, e, n, r, a) => {
85
+ const o = [];
86
+ return e.title1 && o.push({
87
+ prefix: "title1",
88
+ widthKey: "title1Width",
89
+ className: `${t}-title1`,
90
+ style: n,
91
+ text: e.title1
92
+ }), e.title2 && o.push({
93
+ prefix: "title2",
94
+ widthKey: "title2Width",
95
+ marginLeftKey: "title2MarginLeft",
96
+ className: `${t}-title2`,
97
+ style: r,
98
+ text: e.title2
99
+ }), e.title3 && o.push({
100
+ prefix: "title3",
101
+ widthKey: "title3Width",
102
+ marginLeftKey: "title3MarginLeft",
103
+ className: `${t}-title3`,
104
+ style: a,
105
+ text: e.title3
106
+ }), o;
107
+ }, _ = (t, e) => {
108
+ if (t <= 0)
109
+ return [];
110
+ const n = e.slice(0, t), r = n.reduce((o, s) => o + s, 0);
111
+ if (r <= 1)
112
+ return n;
113
+ const { widths: a } = [...n].reverse().reduce(
114
+ ({ overflow: o, widths: s }, c) => {
115
+ if (o <= 0 || c <= 0)
116
+ return { overflow: o, widths: [c, ...s] };
117
+ const m = Math.min(o, c);
118
+ return {
119
+ overflow: o - m,
120
+ widths: [c - m, ...s]
121
+ };
122
+ },
123
+ { overflow: r - 1, widths: [] }
124
+ );
125
+ return a;
126
+ }, R = (t, e) => _(t, e), j = (t, e) => {
127
+ const n = e.filter((r, a) => a !== t).reduce((r, a) => r + a, 0);
128
+ return Math.max(1 - n, 0);
129
+ }, k = (t, e) => {
130
+ const n = t.map((r) => e[r.widthKey] ?? 0);
131
+ return {
132
+ resolved: _(t.length, n),
133
+ effective: R(t.length, n)
134
+ };
135
+ }, V = (t, e, n, r) => t.slice(0, r).reduce(
136
+ (a, o, s) => a + (o != null && o.marginLeftKey ? n[o.marginLeftKey] ?? 0 : 0) + (e[s] ?? 0),
137
+ 0
138
+ ), Z = (t, e, n, r) => t.slice(0, r + 1).reduce(
139
+ (a, o, s) => a + (o != null && o.marginLeftKey ? n[o.marginLeftKey] ?? 0 : 0) + (e[s] ?? 0),
140
+ 0
141
+ ), J = ["title1", "title2", "title3", "count"], i = (t, e) => `${t}${e.charAt(0).toUpperCase()}${e.slice(1)}`, N = {
142
+ title1: "1",
143
+ title2: "2",
144
+ title3: "3",
145
+ count: "Count"
146
+ }, $ = (t) => [
147
+ i(t, "fontFamily"),
148
+ i(t, "fontSettings"),
149
+ {
150
+ type: "row",
151
+ items: [
152
+ i(t, "fontSize"),
153
+ i(t, "lineHeight"),
154
+ i(t, "letterSpacing"),
155
+ i(t, "wordSpacing")
156
+ ]
157
+ },
158
+ i(t, "textAlign"),
159
+ i(t, "textAppearance")
160
+ ], q = () => ({
161
+ type: "tab",
162
+ id: "journalTextStyle",
163
+ tabs: Object.fromEntries(
164
+ J.map((t) => [
165
+ N[t],
166
+ $(t)
167
+ ])
168
+ )
169
+ }), U = {
170
+ title1: "title1Color",
171
+ title2: "title2Color",
172
+ title3: "title3Color",
173
+ count: "countColor"
174
+ }, x = {
175
+ title1: 0.02,
176
+ title2: 0.02,
177
+ title3: 0.02,
178
+ count: 0.017
179
+ }, Q = (t, e) => {
180
+ const n = (r) => {
181
+ const a = i(e, r);
182
+ return t[a];
183
+ };
184
+ return {
185
+ fontFamily: n("fontFamily") ?? "Arial",
186
+ fontSettings: n("fontSettings") ?? {
187
+ fontWeight: 400,
188
+ fontStyle: "normal"
189
+ },
190
+ fontSize: n("fontSize"),
191
+ lineHeight: n("lineHeight"),
192
+ letterSpacing: n("letterSpacing") ?? 0,
193
+ wordSpacing: n("wordSpacing") ?? 0,
194
+ textAlign: n("textAlign") ?? "left",
195
+ textAppearance: n("textAppearance"),
196
+ color: t[U[e]]
197
+ };
198
+ }, tt = (t, e, n) => {
199
+ var a, o;
200
+ const r = {
201
+ fontSettings: {
202
+ fontFamily: e.fontFamily,
203
+ fontWeight: ((a = e.fontSettings) == null ? void 0 : a.fontWeight) ?? 400,
204
+ fontStyle: ((o = e.fontSettings) == null ? void 0 : o.fontStyle) ?? "normal"
205
+ },
206
+ fontSize: e.fontSize ?? x[t],
207
+ lineHeight: e.lineHeight,
208
+ letterSpacing: e.letterSpacing,
209
+ wordSpacing: e.wordSpacing,
210
+ textAlign: e.textAlign,
211
+ textAppearance: e.textAppearance,
212
+ color: e.color ?? "#ffffff"
213
+ };
214
+ return A(r, n);
215
+ };
216
+ export {
217
+ z as D,
218
+ J,
219
+ W as S,
220
+ v as T,
221
+ _ as a,
222
+ G as b,
223
+ k as c,
224
+ V as d,
225
+ j as e,
226
+ B as f,
227
+ R as g,
228
+ Z as h,
229
+ X as i,
230
+ tt as j,
231
+ H as k,
232
+ b as l,
233
+ Y as m,
234
+ O as n,
235
+ D as o,
236
+ l as p,
237
+ M as q,
238
+ Q as r,
239
+ F as s,
240
+ C as t,
241
+ K as u,
242
+ p as v,
243
+ i as w,
244
+ N as x,
245
+ $ as y,
246
+ q as z
247
+ };
package/dist/utils.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./panelAvailability-D8c7cdbu.js");exports.buildColorVars=a.buildColorVars;exports.getAvailableStatePanels=a.getAvailableStatePanels;exports.getColorAlpha=a.getColorAlpha;exports.getFormFieldValidationError=a.getFormFieldValidationError;exports.getUnavailableStates=a.getUnavailableStates;exports.isPanelAvailable=a.isPanelAvailable;exports.isValidEmailFormat=a.isValidEmailFormat;exports.isValidPhoneFormat=a.isValidPhoneFormat;exports.readTestimonialTextMeasure=a.readTestimonialTextMeasure;exports.scalingValue=a.scalingValue;exports.useScopedStyles=a.useScopedStyles;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./scalingValue-CSHYgTZl.js"),i=require("./buildColorVars-CE2D5cQV.js"),t=require("./getColorAlpha-CoSseoCn.js"),e=require("./formFieldValidation-DZl2KVaF.js"),r=require("./useScopedStyles-Bf6yohVQ.js"),o=require("./readTestimonialTextMeasure-CEPaB4Sy.js"),a=require("./panelAvailability-DnOe0rQ4.js");exports.scalingValue=l.scalingValue;exports.buildColorVars=i.buildColorVars;exports.getColorAlpha=t.getColorAlpha;exports.getFormFieldValidationError=e.getFormFieldValidationError;exports.isValidEmailFormat=e.isValidEmailFormat;exports.isValidPhoneFormat=e.isValidPhoneFormat;exports.useScopedStyles=r.useScopedStyles;exports.readTestimonialTextMeasure=o.readTestimonialTextMeasure;exports.getAvailableStatePanels=a.getAvailableStatePanels;exports.getUnavailableStates=a.getUnavailableStates;exports.isPanelAvailable=a.isPanelAvailable;
package/dist/utils.mjs CHANGED
@@ -1,14 +1,20 @@
1
- import { b as s, d as l, g as i, a as t, e as o, f as r, i as d, c as n, r as g, s as m, u as b } from "./panelAvailability-CgSic84c.mjs";
1
+ import { s as o } from "./scalingValue-C9JH5L6O.mjs";
2
+ import { b as s } from "./buildColorVars-CLyWQm5K.mjs";
3
+ import { g as t } from "./getColorAlpha-BVBY0N5x.mjs";
4
+ import { g as m, i as p, a as g } from "./formFieldValidation-DvihFrq5.mjs";
5
+ import { u as d } from "./useScopedStyles-DhBG3557.mjs";
6
+ import { r as n } from "./readTestimonialTextMeasure-BIXpGFEt.mjs";
7
+ import { g as u, a as V, i as F } from "./panelAvailability-D179wwJx.mjs";
2
8
  export {
3
9
  s as buildColorVars,
4
- l as getAvailableStatePanels,
5
- i as getColorAlpha,
6
- t as getFormFieldValidationError,
7
- o as getUnavailableStates,
8
- r as isPanelAvailable,
9
- d as isValidEmailFormat,
10
- n as isValidPhoneFormat,
11
- g as readTestimonialTextMeasure,
12
- m as scalingValue,
13
- b as useScopedStyles
10
+ u as getAvailableStatePanels,
11
+ t as getColorAlpha,
12
+ m as getFormFieldValidationError,
13
+ V as getUnavailableStates,
14
+ F as isPanelAvailable,
15
+ p as isValidEmailFormat,
16
+ g as isValidPhoneFormat,
17
+ n as readTestimonialTextMeasure,
18
+ o as scalingValue,
19
+ d as useScopedStyles
14
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/components",
3
- "version": "1.0.100",
3
+ "version": "1.0.102",
4
4
  "description": "Custom components for control editor and public websites.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -20,6 +20,20 @@
20
20
  "import": "./dist/utils.mjs",
21
21
  "require": "./dist/utils.js"
22
22
  },
23
+ "./sources": {
24
+ "types": "./dist/sources.d.ts",
25
+ "import": "./dist/sources.mjs",
26
+ "require": "./dist/sources.js"
27
+ },
28
+ "./elements": {
29
+ "types": "./dist/elements.d.ts",
30
+ "node": {
31
+ "import": "./dist/elements.node.mjs",
32
+ "require": "./dist/elements.node.js"
33
+ },
34
+ "import": "./dist/elements.mjs",
35
+ "require": "./dist/elements.js"
36
+ },
23
37
  "./style/components.css": {
24
38
  "default": "./dist/components.css"
25
39
  }
@@ -28,6 +42,12 @@
28
42
  "*": {
29
43
  "utils": [
30
44
  "./dist/Components/utils/index.d.ts"
45
+ ],
46
+ "sources": [
47
+ "./dist/sources.d.ts"
48
+ ],
49
+ "elements": [
50
+ "./dist/elements.d.ts"
31
51
  ]
32
52
  }
33
53
  },
@@ -37,6 +57,9 @@
37
57
  "prebuild": "rimraf ./dist",
38
58
  "build": "vite build",
39
59
  "build:watch": "vite build --watch",
60
+ "postbuild": "npm run check:sources && npm run check:elements",
61
+ "check:sources": "node scripts/check-sources.mjs",
62
+ "check:elements": "node scripts/check-elements.mjs",
40
63
  "prepublishOnly": "cross-env NODE_ENV=production npm run build"
41
64
  },
42
65
  "files": [
@@ -60,9 +83,15 @@
60
83
  "classnames": "^2.5.1"
61
84
  },
62
85
  "peerDependencies": {
86
+ "franc-min": "^5.0.0",
63
87
  "react": "^18.0.0",
64
88
  "react-dom": "^18.0.0"
65
89
  },
90
+ "peerDependenciesMeta": {
91
+ "franc-min": {
92
+ "optional": true
93
+ }
94
+ },
66
95
  "devDependencies": {
67
96
  "@antfu/eslint-config": "^3.16.0",
68
97
  "@splidejs/react-splide": "^0.7.12",
@@ -74,7 +103,7 @@
74
103
  "@types/react-dom": "^18.2.0",
75
104
  "@vitejs/plugin-react": "^4.3.4",
76
105
  "cross-env": "^10.1.0",
77
- "franc-min": "^6.2.0",
106
+ "franc-min": "^5.0.0",
78
107
  "hyphen": "^1.14.1",
79
108
  "react": "^18.2.0",
80
109
  "react-dom": "^18.2.0",