@cntrl-site/components 1.0.111-alpha.0 → 1.0.111-alpha.2
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/dist/{Burger-C3yVbQcq.js → Burger-B4kXX9aY.js} +1 -1
- package/dist/{Burger-BkVgNMGU.mjs → Burger-DyORh_vF.mjs} +1 -1
- package/dist/{ChroniclesComponent-FFenN7yL.js → ChroniclesComponent-B6L-8Gn2.js} +1 -1
- package/dist/{ChroniclesComponent-cZLqN307.mjs → ChroniclesComponent-adaAqTy8.mjs} +12 -12
- package/dist/Components/PopupMenu/PopupMenu.d.ts +18 -5
- package/dist/Components/PopupMenu/PopupMenuComponent.d.ts +125 -134
- package/dist/Components/PopupMenu/popupMenuLayout.d.ts +70 -34
- package/dist/Components/helpers/SvgImage/loadSvgMaskUrl.d.ts +7 -0
- package/dist/{ControlSlider-DqKfaKMG.mjs → ControlSlider-3w-bHQEg.mjs} +1 -1
- package/dist/{ControlSlider-C8ckUIDm.js → ControlSlider-DB4nbVLT.js} +1 -1
- package/dist/{FAQ-BS-vO0l-.mjs → FAQ-BjLLn81l.mjs} +1 -1
- package/dist/{FAQ-Ct0YfqX1.js → FAQ-C5evIqbl.js} +1 -1
- package/dist/{Grid-CU1dsdoO.js → Grid-BXUT_Hn6.js} +1 -1
- package/dist/{Grid-qbqchSLi.mjs → Grid-Dn44dvgx.mjs} +1 -1
- package/dist/{Hive-CzabuuCc.js → Hive-34KvKNsa.js} +1 -1
- package/dist/{Hive-DyxYd5eg.mjs → Hive-7xHXyMM1.mjs} +1 -1
- package/dist/{HiveLightboxTitles-DhEeFKWs.mjs → HiveLightboxTitles-BCoL46-V.mjs} +1 -1
- package/dist/{HiveLightboxTitles-DlyptAaK.js → HiveLightboxTitles-DEeyQGcf.js} +1 -1
- package/dist/{Lightbox-DZckgBzK.js → Lightbox-Cb7lyaNt.js} +1 -1
- package/dist/{Lightbox-BY99NS14.mjs → Lightbox-DzPqgKP4.mjs} +1 -1
- package/dist/{LightboxJournal-DAEZOPDi.js → LightboxJournal-BFF5aKRz.js} +1 -1
- package/dist/{LightboxJournal-D59ex6wH.mjs → LightboxJournal-C_q7_s-B.mjs} +1 -1
- package/dist/{LightboxStrip-YspzBP8N.mjs → LightboxStrip-BrNj7ipX.mjs} +1 -1
- package/dist/{LightboxStrip-BDjI1jyH.js → LightboxStrip-CC2e0_9A.js} +1 -1
- package/dist/{Mercury-B-s2Kvuq.js → Mercury-BmhtFYOw.js} +1 -1
- package/dist/{Mercury-CCW0Es-s.mjs → Mercury-Q788wrYQ.mjs} +1 -1
- package/dist/{OnelinerForm-C2Y_XMCY.js → OnelinerForm-CUmY-bXL.js} +1 -1
- package/dist/{OnelinerForm-BEu7_sho.mjs → OnelinerForm-D8WIB9Qy.mjs} +1 -1
- package/dist/PopupMenu-BYZy1R1y.js +356 -0
- package/dist/PopupMenu-DXWVDnPf.mjs +972 -0
- package/dist/{SimpleButton-C-o2W9bS.mjs → SimpleButton-DTpzfmb6.mjs} +1 -1
- package/dist/{SimpleButton-nGEcO2gB.js → SimpleButton-DtaCYa3y.js} +1 -1
- package/dist/{Slider20-DUi6qwnd.mjs → Slider20-CKngROrc.mjs} +1 -1
- package/dist/{Slider20-BOmjDRf2.js → Slider20-q0iGgnE3.js} +1 -1
- package/dist/SvgImage-CwRq9-ec.mjs +56 -0
- package/dist/SvgImage-_QN8ngad.js +1 -0
- package/dist/{TestimonialSingle-DrnyReim.mjs → TestimonialSingle-Bax71Hyo.mjs} +1 -1
- package/dist/{TestimonialSingle-BORQom3u.js → TestimonialSingle-CpEUendN.js} +1 -1
- package/dist/{Waterfall-DII4-WV5.js → Waterfall-B9YWMhrg.js} +1 -1
- package/dist/{Waterfall-3kKioKh2.mjs → Waterfall-znaoynn5.mjs} +1 -1
- package/dist/{components-ByRCe3b5.js → components-Ce8GmbzS.js} +1 -1
- package/dist/{components-DbxkGNoB.mjs → components-QxlSJUUn.mjs} +176 -144
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +15 -15
- package/dist/elements.node.js +1 -1
- package/dist/elements.node.mjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +39 -34
- package/dist/loadSvgMaskUrl-B6kHUyof.js +1 -0
- package/dist/loadSvgMaskUrl-DUhCVvpl.mjs +39 -0
- package/dist/sources.js +1 -1
- package/dist/sources.mjs +1 -1
- package/dist/types/SchemaV1.d.ts +2 -1
- package/package.json +1 -1
- package/dist/PopupMenu-BVc8Y4Tt.mjs +0 -929
- package/dist/PopupMenu-Dty5qHl8.js +0 -348
- package/dist/SvgImage-B5mR9y6q.mjs +0 -51
- package/dist/SvgImage-DFlmxAoL.js +0 -1
- package/dist/loadSvgMaskUrl-DfF7ay6h.js +0 -1
- package/dist/loadSvgMaskUrl-xHgGYgPe.mjs +0 -20
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
"use strict";const x=require("react/jsx-runtime"),v=require("react"),At=require("./scalingValue-CSHYgTZl.js"),pe=require("./useScopedStyles-Bf6yohVQ.js"),de=require("./useLightboxScrollLock-Hf16Eq4g.js"),me=require("./textStylesToCss-CNN3zZTV.js"),ge=require("./RichTextRenderer-DEFXh5o6.js"),fe=require("./SvgImage-DFlmxAoL.js"),$t=560/1440,bt={columns:12,columnWidth:92/1440,gutter:20/1440,beat:8/1440};function Et(t,o=bt){const e=(n,r)=>typeof n=="number"&&Number.isFinite(n)?n:r;return{columns:Math.max(1,Math.round(e(t.gridColumns,o.columns))),columnWidth:Math.max(0,e(t.gridColumnWidth,o.columnWidth)),gutter:Math.max(0,e(t.gridGutter,o.gutter)),beat:Math.max(0,e(t.gridRowHeight,o.beat??0))}}function Ft(t){const{top:o,bottom:e}=tt(t.popupPadding);return Math.max(0,(t.popupHeight??$t)-o-e)}function tt(t){if(typeof t=="number")return{top:t,right:t,bottom:t,left:t};const o=e=>typeof e=="number"&&Number.isFinite(e)?Math.max(0,e):0;return{top:o(t==null?void 0:t.top),right:o(t==null?void 0:t.right),bottom:o(t==null?void 0:t.bottom),left:o(t==null?void 0:t.left)}}const Gt={span:{text:{min:1/4,max:5/12},image:{min:1/6,max:1/3},listA:{min:1/6,max:1/4},listB:{min:1/6,max:1/4}},breakChance:.25};function Ht(t,o,e,n,r=Gt){const l=xe(e),u=Math.max(1,Math.floor(o.columns)),s=[];let h=0,f=new Array(u).fill(!1);const i={};for(const j of t){const z=i[j]??(i[j]=be(r.span[j]??r.span.text,u,l));let _=jt(f,z);const m=f.some(Boolean);(_.length===0||m&&l()<r.breakChance)&&(h+=1,f=new Array(u).fill(!1),_=jt(f,z));const p=_[Math.floor(l()*_.length)];for(let C=Math.max(0,p-1);C<Math.min(u,p+z+1);C++)f[C]=!0;s.push({column:p,span:z,row:h})}const B=h+1;return{seed:e,grid:{...o,columns:u},placements:s.map(({column:j,span:z,row:_})=>({column:j,span:z,top:X(o,_*n/B,n)}))}}function $e(){return Math.floor(Math.random()*2147483647)}function X(t,o,e=1/0){const n=t.beat??0,r=Math.max(0,e),l=n>0?Math.round(o/n)*n:o,u=l<=r?l:n>0?Math.floor(r/n+1e-9)*n:r;return Math.round(Math.max(0,u)*1e6)/1e6}function xt(t){return t.beat&&t.beat>0?t.beat:8/1440}function et(t,o,e=1/0){const n=t.beat??0,r=xt(t),l=n>0?Math.round(o/n)*n:o,u=l<=e?l:n>0?Math.floor(e/n+1e-9)*n:e;return at(Math.max(r,u))}function Dt(t,o){const e=(n,r)=>Math.abs(n-r)<1e-9;return Math.floor(t.columns)===Math.floor(o.columns)&&e(t.columnWidth,o.columnWidth)&&e(t.gutter,o.gutter)&&e(t.beat??0,o.beat??0)}function Wt(t,o){const e={...o,columns:Math.max(1,Math.floor(o.columns))};if(Dt(t.grid,e))return t;const n=Math.max(1,Math.floor(t.grid.columns)),r=e.columns,l=s=>n===r?s:Math.round(s*r/n),u=t.placements.map(s=>{const h=Math.min(r,Math.max(1,l(s.span))),f=Math.min(Math.max(0,l(s.column)),r-h),i=X(e,s.top);return s.height===void 0?{column:f,span:h,top:i}:{column:f,span:h,top:i,height:et(e,s.height)}});return{...t,grid:e,placements:u}}function vt(t,o,e,n=0){const r=s=>n>0?Math.floor(s/n+1e-9)*n:s,l=e/4,u=o>e-t+1e-9&&e-t<l?r(e-Math.min(o,l)):t;return{top:at(Math.max(0,u)),maxHeight:at(Math.max(0,r(Math.max(e-Math.max(0,u),l))))}}function at(t){return Math.round(t*1e6)/1e6}function ft(t,o,e,n){return vt(t,o,e,n).top}function qt(t,o,e,n,r,l,u=0){const s=ft(t.top,o,r,u),h=ft(e.top,n,r,u);return t.column<e.column+e.span&&e.column<t.column+t.span&&s<h+n+l-1e-9&&h<s+o+l-1e-9}function Yt(t,o,e,n,r){const l=t.placements[o];return l?Ut(t,o,{...l,column:e,top:n},r):null}function Ot(t,o,e,n){if(!t.placements[o])return null;const{columns:r}=t.grid,l=Math.min(Math.max(0,e.column),r-1),u=Math.min(Math.max(1,e.span),r-l),s=X(t.grid,e.top,n?n.height-xt(t.grid):1/0),h=e.height===void 0?void 0:et(t.grid,e.height,n?n.height-s:1/0);return Ut(t,o,h===void 0?{column:l,span:u,top:s}:{column:l,span:u,top:s,height:h},n)}function Ut(t,o,e,n){const{columns:r,gutter:l,beat:u}=t.grid,s=Math.min(e.span,r);if(s<1||e.column<0||e.column+s>r)return null;const h=e.height??(n==null?void 0:n.heights[o])??0,f={column:e.column,span:s,top:X(t.grid,e.top,n?n.height-h:1/0),...e.height===void 0?{}:{height:e.height}};return n&&t.placements.some((i,B)=>B!==o&&qt(f,h,i,n.heights[B]??0,n.height,l,u))?null:{...t,edited:!0,placements:t.placements.map((i,B)=>B===o?f:i)}}function Xt(t,o){const{gutter:e,columns:n}=t.grid,r=t.grid.beat??0,l=o.height,u=t.placements.map((m,p)=>o.heights[p]??0),s=[...t.placements],h=(m,p)=>({...m,top:ft(m.top,p,l,r)}),f=s.map((m,p)=>h(m,u[p])),i=f.map((m,p)=>p).sort((m,p)=>f[m].top-f[p].top||m-p),B=[],j=(m,p)=>{let{top:C}=m;for(let T=!0;T;){T=!1;for(const N of B){const M=h(s[N],u[N]);if(!qt({...m,top:C},p,M,u[N],1/0,e))continue;const d=M.top+u[N]+e;C=at(r>0?Math.ceil(d/r-1e-9)*r:d),T=!0}}return C},z=(m,p)=>vt(m,p,l,r).top<m-1e-9;let _=!1;for(const m of i){const p=f[m];let C={column:p.column,top:j(p,u[m])};if(C.top!==p.top&&z(C.top,u[m])){const T=Math.min(p.span,n),N=Array.from({length:Math.max(0,n-T+1)},(d,L)=>L).sort((d,L)=>Math.abs(d-p.column)-Math.abs(L-p.column)||d-L);let M=null;for(const d of N){const L=j({...p,column:d},u[m]);!z(L,u[m])&&(!M||L<M.top-1e-9)&&(M={column:d,top:L})}M&&(C=M)}(C.column!==p.column||C.top!==p.top)&&(s[m]={...s[m],...C},_=!0),B.push(m)}return _?{...t,placements:s}:t}function be(t,o,e){const n=Math.max(1,Math.round(t.min*o)),r=Math.max(n,Math.round(t.max*o));return Math.min(o,n+Math.floor(e()*(r-n+1)))}function jt(t,o){const e=[];for(let n=0;n+o<=t.length;n++){let r=!0;for(let l=n;l<n+o;l++)if(t[l]){r=!1;break}r&&e.push(n)}return e}function xe(t){let o=t>>>0;return()=>{o=o+1831565813>>>0;let e=o;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}const U=300,ve=3e3,Vt=["burger","plus","image","text"],Me=24/1440,ye=["top","right","bottom","left","top-left","top-right","bottom-right","bottom-left"];function Lt(t,o){return{...o,heights:o.heights.map((e,n)=>{var r;return((r=t.placements[n])==null?void 0:r.height)??e})}}function we(t,o){return t.column===o.column&&t.span===o.span&&t.top===o.top&&t.height===o.height}function Nt(t,o){return o.handle?Ot(t,o.index,o.placement,o.measure):Yt(t,o.index,o.placement.column,o.placement.top,o.measure)}function ke(t){return`
|
|
2
|
-
/* there is no bar: the menu is only its trigger, placed left, centre or right across the navigation's width,
|
|
3
|
-
which lets the page take a pointer anywhere else across it */
|
|
4
|
-
.${t}-root {
|
|
5
|
-
position: relative;
|
|
6
|
-
width: 100%;
|
|
7
|
-
box-sizing: border-box;
|
|
8
|
-
pointer-events: none;
|
|
9
|
-
}
|
|
10
|
-
.${t}-bar {
|
|
11
|
-
display: grid;
|
|
12
|
-
grid-template-columns: 1fr auto 1fr;
|
|
13
|
-
align-items: start;
|
|
14
|
-
box-sizing: border-box;
|
|
15
|
-
}
|
|
16
|
-
/* as big as its icon or text and its padding */
|
|
17
|
-
.${t}-button {
|
|
18
|
-
all: unset;
|
|
19
|
-
box-sizing: border-box;
|
|
20
|
-
cursor: pointer;
|
|
21
|
-
white-space: nowrap;
|
|
22
|
-
pointer-events: auto;
|
|
23
|
-
color: var(--${t}-trigger-color);
|
|
24
|
-
background-color: var(--${t}-trigger-bg);
|
|
25
|
-
}
|
|
26
|
-
.${t}-button-icon {
|
|
27
|
-
display: flex;
|
|
28
|
-
align-items: center;
|
|
29
|
-
justify-content: center;
|
|
30
|
-
}
|
|
31
|
-
/* an icon trigger's lines, as thick as a twelfth of it and a pixel at least, drawn in the trigger's colour */
|
|
32
|
-
.${t}-icon {
|
|
33
|
-
position: relative;
|
|
34
|
-
display: block;
|
|
35
|
-
flex: none;
|
|
36
|
-
width: var(--${t}-icon-size);
|
|
37
|
-
height: var(--${t}-icon-size);
|
|
38
|
-
--${t}-icon-stroke: max(1px, calc(var(--${t}-icon-size) / 12));
|
|
39
|
-
transition: transform ${U}ms ease;
|
|
40
|
-
}
|
|
41
|
-
.${t}-icon-line {
|
|
42
|
-
position: absolute;
|
|
43
|
-
left: 0;
|
|
44
|
-
width: 100%;
|
|
45
|
-
height: var(--${t}-icon-stroke);
|
|
46
|
-
top: calc(50% - var(--${t}-icon-stroke) / 2);
|
|
47
|
-
background-color: currentColor;
|
|
48
|
-
transition: transform ${U}ms ease, opacity ${U}ms ease;
|
|
49
|
-
}
|
|
50
|
-
/* three lines, the outer two meeting in the middle and crossing as the popup opens, the middle one fading */
|
|
51
|
-
.${t}-icon-burger .${t}-icon-line:nth-child(1) { transform: translateY(calc(var(--${t}-icon-size) * -0.3)) rotate(0deg) scaleX(1); }
|
|
52
|
-
.${t}-icon-burger .${t}-icon-line:nth-child(3) { transform: translateY(calc(var(--${t}-icon-size) * 0.3)) rotate(0deg) scaleX(1); }
|
|
53
|
-
.${t}-button-open .${t}-icon-burger .${t}-icon-line:nth-child(1) { transform: translateY(0) rotate(45deg) scaleX(1); }
|
|
54
|
-
.${t}-button-open .${t}-icon-burger .${t}-icon-line:nth-child(2) { opacity: 0; transform: scaleX(0); }
|
|
55
|
-
.${t}-button-open .${t}-icon-burger .${t}-icon-line:nth-child(3) { transform: translateY(0) rotate(-45deg) scaleX(1); }
|
|
56
|
-
/* a plus, turned an eighth as the popup opens, into a cross */
|
|
57
|
-
.${t}-icon-plus .${t}-icon-line:nth-child(2) { transform: rotate(90deg); }
|
|
58
|
-
.${t}-button-open .${t}-icon-plus { transform: rotate(45deg); }
|
|
59
|
-
/* the user's image, fitted to the icon's size: an SVG tinted with the trigger's colour, anything else as it is */
|
|
60
|
-
.${t}-icon-picture {
|
|
61
|
-
display: block;
|
|
62
|
-
width: 100%;
|
|
63
|
-
height: 100%;
|
|
64
|
-
}
|
|
65
|
-
@media (prefers-reduced-motion: reduce) {
|
|
66
|
-
.${t}-icon,
|
|
67
|
-
.${t}-icon-line {
|
|
68
|
-
transition: none;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
.${t}-slot-left { justify-self: start; }
|
|
72
|
-
.${t}-slot-center { justify-self: center; }
|
|
73
|
-
.${t}-slot-right { justify-self: end; }
|
|
74
|
-
.${t}-button:focus-visible {
|
|
75
|
-
outline: 1px solid currentColor;
|
|
76
|
-
outline-offset: 2px;
|
|
77
|
-
}
|
|
78
|
-
.${t}-overlay {
|
|
79
|
-
position: fixed;
|
|
80
|
-
inset: auto;
|
|
81
|
-
top: var(--cntrl-article-top, 0);
|
|
82
|
-
left: var(--cntrl-article-left, 0);
|
|
83
|
-
width: var(--cntrl-article-width, 100vw);
|
|
84
|
-
height: var(--cntrl-viewport-height, 100vh);
|
|
85
|
-
z-index: 2;
|
|
86
|
-
pointer-events: none;
|
|
87
|
-
overflow: hidden;
|
|
88
|
-
}
|
|
89
|
-
.${t}-overlay-active {
|
|
90
|
-
pointer-events: auto;
|
|
91
|
-
}
|
|
92
|
-
.${t}-backdrop {
|
|
93
|
-
all: unset;
|
|
94
|
-
position: absolute;
|
|
95
|
-
inset: 0;
|
|
96
|
-
background-color: var(--${t}-overlay-color);
|
|
97
|
-
opacity: 0;
|
|
98
|
-
transition: opacity ${U}ms ease;
|
|
99
|
-
}
|
|
100
|
-
.${t}-card {
|
|
101
|
-
position: absolute;
|
|
102
|
-
box-sizing: border-box;
|
|
103
|
-
overflow: hidden;
|
|
104
|
-
background-color: var(--${t}-popup-bg);
|
|
105
|
-
opacity: 0;
|
|
106
|
-
transform: translateY(-8px);
|
|
107
|
-
transition: opacity ${U}ms ease, transform ${U}ms ease;
|
|
108
|
-
}
|
|
109
|
-
.${t}-overlay-active .${t}-backdrop,
|
|
110
|
-
.${t}-overlay-active .${t}-card {
|
|
111
|
-
opacity: 1;
|
|
112
|
-
transform: none;
|
|
113
|
-
}
|
|
114
|
-
/* one row as tall as the popup, which every block shares: its column from the grid, its height from a spacer
|
|
115
|
-
above it. Each slot is a container as tall as that row, even where a short window makes it shorter than set,
|
|
116
|
-
and its block is held to the room left below its top, in whole beats once measured (see drawPopupMenuBlock),
|
|
117
|
-
so that a block never reaches below the popup, nor is pushed up over one above it */
|
|
118
|
-
.${t}-grid {
|
|
119
|
-
position: relative;
|
|
120
|
-
display: grid;
|
|
121
|
-
grid-template-rows: minmax(0, 1fr);
|
|
122
|
-
height: 100%;
|
|
123
|
-
}
|
|
124
|
-
/* the grid the blocks snap to, drawn as the article's is while a block is moved or resized: a hairline at both
|
|
125
|
-
edges of every column, and one down every beat from the popup's top inside its padding */
|
|
126
|
-
.${t}-guides {
|
|
127
|
-
position: absolute;
|
|
128
|
-
inset: 0;
|
|
129
|
-
z-index: 2;
|
|
130
|
-
display: grid;
|
|
131
|
-
grid-template-rows: minmax(0, 1fr);
|
|
132
|
-
pointer-events: none;
|
|
133
|
-
opacity: 0;
|
|
134
|
-
transition: opacity 200ms ease;
|
|
135
|
-
--${t}-guide-color: var(--cntrl-grid-color, rgba(255, 92, 2, 0.45));
|
|
136
|
-
}
|
|
137
|
-
.${t}-guides-shown {
|
|
138
|
-
opacity: 1;
|
|
139
|
-
}
|
|
140
|
-
.${t}-guides-beats {
|
|
141
|
-
background-image: repeating-linear-gradient(
|
|
142
|
-
to bottom,
|
|
143
|
-
var(--${t}-guide-color) 0 1px,
|
|
144
|
-
transparent 1px var(--${t}-beat)
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
.${t}-guide {
|
|
148
|
-
grid-row: 1;
|
|
149
|
-
box-shadow: inset 1px 0 var(--${t}-guide-color), inset -1px 0 var(--${t}-guide-color);
|
|
150
|
-
}
|
|
151
|
-
/* the block and, on the canvas, the handles it is resized by, which sit on its edges outside any scroller */
|
|
152
|
-
.${t}-frame {
|
|
153
|
-
position: relative;
|
|
154
|
-
display: flex;
|
|
155
|
-
flex-direction: column;
|
|
156
|
-
flex: none;
|
|
157
|
-
min-width: 0;
|
|
158
|
-
min-height: 0;
|
|
159
|
-
}
|
|
160
|
-
.${t}-slot {
|
|
161
|
-
display: flex;
|
|
162
|
-
flex-direction: column;
|
|
163
|
-
grid-row: 1;
|
|
164
|
-
min-width: 0;
|
|
165
|
-
min-height: 0;
|
|
166
|
-
container-type: size;
|
|
167
|
-
pointer-events: none;
|
|
168
|
-
}
|
|
169
|
-
.${t}-spacer {
|
|
170
|
-
flex: 0 1 auto;
|
|
171
|
-
min-height: 0;
|
|
172
|
-
}
|
|
173
|
-
.${t}-block {
|
|
174
|
-
flex: none;
|
|
175
|
-
min-width: 0;
|
|
176
|
-
max-height: var(--${t}-room-left, 100cqh);
|
|
177
|
-
pointer-events: auto;
|
|
178
|
-
}
|
|
179
|
-
/* text longer than the room left scrolls within its block; only then, as a scroller would cut the trimmed
|
|
180
|
-
text's descenders */
|
|
181
|
-
.${t}-block-full {
|
|
182
|
-
overflow-y: auto;
|
|
183
|
-
}
|
|
184
|
-
/* the text's box runs from the first line's cap height to the last line's baseline, where the browser can
|
|
185
|
-
trim it: a title lines up with the top of an image beside it, and the block is no taller than its text */
|
|
186
|
-
.${t}-block.${t}-block-text,
|
|
187
|
-
.${t}-block.${t}-block-listA,
|
|
188
|
-
.${t}-block.${t}-block-listB {
|
|
189
|
-
text-box: trim-both cap alphabetic;
|
|
190
|
-
}
|
|
191
|
-
.${t}-block-title {
|
|
192
|
-
color: var(--${t}-title-color);
|
|
193
|
-
}
|
|
194
|
-
.${t}-block-text {
|
|
195
|
-
color: var(--${t}-text-color);
|
|
196
|
-
}
|
|
197
|
-
.${t}-block-text a {
|
|
198
|
-
color: inherit;
|
|
199
|
-
}
|
|
200
|
-
.${t}-block-listA .${t}-block-text {
|
|
201
|
-
color: var(--${t}-list-a-color, var(--${t}-text-color));
|
|
202
|
-
}
|
|
203
|
-
.${t}-block-listB .${t}-block-text {
|
|
204
|
-
color: var(--${t}-list-b-color, var(--${t}-text-color));
|
|
205
|
-
}
|
|
206
|
-
.${t}-block-listA .${t}-block-text a,
|
|
207
|
-
.${t}-block-listB .${t}-block-text a {
|
|
208
|
-
text-decoration: none;
|
|
209
|
-
}
|
|
210
|
-
.${t}-block-listA .${t}-block-text a:hover,
|
|
211
|
-
.${t}-block-listB .${t}-block-text a:hover {
|
|
212
|
-
text-decoration: underline;
|
|
213
|
-
}
|
|
214
|
-
.${t}-images {
|
|
215
|
-
display: grid;
|
|
216
|
-
}
|
|
217
|
-
/* every image takes the same cell, so the block is as tall as its tallest image and keeps still as they change */
|
|
218
|
-
.${t}-image {
|
|
219
|
-
display: block;
|
|
220
|
-
grid-area: 1 / 1;
|
|
221
|
-
width: 100%;
|
|
222
|
-
height: auto;
|
|
223
|
-
/* an image always fills its box, cut where it is taller than the room left */
|
|
224
|
-
max-height: var(--${t}-room-left, 100cqh);
|
|
225
|
-
object-fit: cover;
|
|
226
|
-
}
|
|
227
|
-
/* a block resized to a height: its images fill it, cut to it */
|
|
228
|
-
.${t}-block-sized .${t}-images {
|
|
229
|
-
height: 100%;
|
|
230
|
-
grid-template-rows: minmax(0, 100%);
|
|
231
|
-
}
|
|
232
|
-
.${t}-block-sized .${t}-image {
|
|
233
|
-
height: 100%;
|
|
234
|
-
}
|
|
235
|
-
.${t}-image {
|
|
236
|
-
transition: opacity 800ms ease-in-out;
|
|
237
|
-
}
|
|
238
|
-
.${t}-image-hidden {
|
|
239
|
-
opacity: 0;
|
|
240
|
-
}
|
|
241
|
-
@media (prefers-reduced-motion: reduce) {
|
|
242
|
-
.${t}-image {
|
|
243
|
-
transition: none;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
.${t}-grid-editable .${t}-block {
|
|
247
|
-
cursor: grab;
|
|
248
|
-
touch-action: none;
|
|
249
|
-
user-select: none;
|
|
250
|
-
}
|
|
251
|
-
.${t}-grid-editable .${t}-block * {
|
|
252
|
-
pointer-events: none;
|
|
253
|
-
}
|
|
254
|
-
.${t}-slot-dragged {
|
|
255
|
-
z-index: 1;
|
|
256
|
-
}
|
|
257
|
-
.${t}-grid-editable .${t}-block-dragged {
|
|
258
|
-
cursor: grabbing;
|
|
259
|
-
outline: 1px solid #FF5C02;
|
|
260
|
-
outline-offset: 2px;
|
|
261
|
-
}
|
|
262
|
-
.${t}-grid-editable .${t}-frame:hover > .${t}-block:not(.${t}-block-dragged) {
|
|
263
|
-
outline: 1px solid rgba(255, 92, 2, 0.4);
|
|
264
|
-
outline-offset: 2px;
|
|
265
|
-
}
|
|
266
|
-
.${t}-grid-editable .${t}-block-invalid {
|
|
267
|
-
opacity: 0.5;
|
|
268
|
-
outline-style: dashed;
|
|
269
|
-
}
|
|
270
|
-
/* edges are a bar that grows from the block's edge as the pointer comes to it, as a structured block's do;
|
|
271
|
-
corners a small square */
|
|
272
|
-
.${t}-handle {
|
|
273
|
-
position: absolute;
|
|
274
|
-
z-index: 3;
|
|
275
|
-
pointer-events: auto;
|
|
276
|
-
touch-action: none;
|
|
277
|
-
}
|
|
278
|
-
.${t}-handle::after {
|
|
279
|
-
content: '';
|
|
280
|
-
position: absolute;
|
|
281
|
-
box-sizing: border-box;
|
|
282
|
-
opacity: 0;
|
|
283
|
-
transition: opacity 150ms ease, transform 150ms ease;
|
|
284
|
-
}
|
|
285
|
-
.${t}-handle-left,
|
|
286
|
-
.${t}-handle-right {
|
|
287
|
-
top: 0;
|
|
288
|
-
bottom: 0;
|
|
289
|
-
width: 10px;
|
|
290
|
-
cursor: ew-resize;
|
|
291
|
-
}
|
|
292
|
-
.${t}-handle-left { left: -5px; }
|
|
293
|
-
.${t}-handle-right { right: -5px; }
|
|
294
|
-
.${t}-handle-top,
|
|
295
|
-
.${t}-handle-bottom {
|
|
296
|
-
left: 0;
|
|
297
|
-
right: 0;
|
|
298
|
-
height: 10px;
|
|
299
|
-
cursor: ns-resize;
|
|
300
|
-
}
|
|
301
|
-
.${t}-handle-top { top: -5px; }
|
|
302
|
-
.${t}-handle-bottom { bottom: -5px; }
|
|
303
|
-
.${t}-handle-left::after,
|
|
304
|
-
.${t}-handle-right::after {
|
|
305
|
-
top: 0;
|
|
306
|
-
bottom: 0;
|
|
307
|
-
left: 3px;
|
|
308
|
-
width: 4px;
|
|
309
|
-
background-color: #FF5C02;
|
|
310
|
-
transform: scaleX(0.25);
|
|
311
|
-
}
|
|
312
|
-
.${t}-handle-top::after,
|
|
313
|
-
.${t}-handle-bottom::after {
|
|
314
|
-
left: 0;
|
|
315
|
-
right: 0;
|
|
316
|
-
top: 3px;
|
|
317
|
-
height: 4px;
|
|
318
|
-
background-color: #FF5C02;
|
|
319
|
-
transform: scaleY(0.25);
|
|
320
|
-
}
|
|
321
|
-
.${t}-handle-top-left,
|
|
322
|
-
.${t}-handle-top-right,
|
|
323
|
-
.${t}-handle-bottom-right,
|
|
324
|
-
.${t}-handle-bottom-left {
|
|
325
|
-
width: 12px;
|
|
326
|
-
height: 12px;
|
|
327
|
-
}
|
|
328
|
-
.${t}-handle-top-left { top: -6px; left: -6px; cursor: nwse-resize; }
|
|
329
|
-
.${t}-handle-bottom-right { bottom: -6px; right: -6px; cursor: nwse-resize; }
|
|
330
|
-
.${t}-handle-top-right { top: -6px; right: -6px; cursor: nesw-resize; }
|
|
331
|
-
.${t}-handle-bottom-left { bottom: -6px; left: -6px; cursor: nesw-resize; }
|
|
332
|
-
.${t}-handle-top-left::after,
|
|
333
|
-
.${t}-handle-top-right::after,
|
|
334
|
-
.${t}-handle-bottom-right::after,
|
|
335
|
-
.${t}-handle-bottom-left::after {
|
|
336
|
-
inset: 3px;
|
|
337
|
-
background-color: #ffffff;
|
|
338
|
-
border: 1px solid #FF5C02;
|
|
339
|
-
}
|
|
340
|
-
.${t}-frame:hover > .${t}-handle::after {
|
|
341
|
-
opacity: 0.6;
|
|
342
|
-
}
|
|
343
|
-
.${t}-handle:hover::after,
|
|
344
|
-
.${t}-handle-active::after {
|
|
345
|
-
opacity: 1;
|
|
346
|
-
transform: none;
|
|
347
|
-
}
|
|
348
|
-
`}function P(t,o,e,n){const r=h=>t[`${o}${h}`]??(n?t[`${n}${h}`]:void 0),l=h=>{const f=r(h);return f===void 0?void 0:At.scalingValue(f,e)},u=r("FontSettings"),s=r("TextAppearance");return{fontFamily:me.normalizeFontFamilyCssValue(r("FontFamily")),fontWeight:u==null?void 0:u.fontWeight,fontStyle:u==null?void 0:u.fontStyle,fontSize:l("FontSize"),lineHeight:l("LineHeight"),letterSpacing:l("LetterSpacing"),wordSpacing:l("WordSpacing"),textTransform:s==null?void 0:s.textTransform,textDecoration:s==null?void 0:s.textDecoration,fontVariant:s==null?void 0:s.fontVariant}}function Zt(t){const o=t.type??"text";return o==="list"?"listA":o}function Ce(t,o,e,n){return t!=null&&t.grid&&Array.isArray(t.placements)&&t.placements.every(r=>typeof(r==null?void 0:r.top)=="number")?Wt(t,n):Ht(o.map(Zt),n,1,e)}function Se(t,o){const e=(n,r)=>Math.abs(n-r)<1e-4;return e(t.height,o.height)&&t.heights.length===o.heights.length&&t.heights.every((n,r)=>e(n,o.heights[r]))}function gt(t,o){const{columns:e}=t.grid,n=t.placements[o];if(!n)return{column:0,span:Math.min(e,Math.max(1,Math.round(e/4))),top:0};const r=Math.min(n.span,e),l={column:Math.min(n.column,e-r),span:r,top:n.top};return typeof n.height=="number"?{...l,height:n.height}:l}function Kt({settings:t,content:o=[],isEditor:e,isEditMode:n,isPreviewMode:r,layoutId:l,currentState:u,unavailableStates:s=[],onOpenChange:h,onUpdateSettings:f}){var Tt,_t;const{prefix:i}=pe.useScopedStyles(),B=v.useMemo(()=>ke(i),[i]),[j,z]=v.useState(!1),[_,m]=v.useState(!1),[p,C]=v.useState(!1),T=!!(e&&!r),N=T&&u==="open"&&!s.includes("open"),M=N||!T&&j;de.useLightboxScrollLock(M&&!T),v.useEffect(()=>{h==null||h(M)},[M,h]),v.useEffect(()=>{z(!1)},[l]),v.useEffect(()=>{if(M){m(!0);const c=requestAnimationFrame(()=>C(!0));return()=>cancelAnimationFrame(c)}C(!1);const a=window.setTimeout(()=>m(!1),U);return()=>window.clearTimeout(a)},[M]),v.useEffect(()=>{if(!M||T)return;const a=c=>{c.key==="Escape"&&z(!1)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[M,T]);const d=a=>At.scalingValue(a??0,e),L=Ft(t),ot=tt(t.popupPadding),Z=tt(t.popupInset),nt=(Tt=t.menuLayout)==null?void 0:Tt.grid,Jt=Et(t,nt!=null&&nt.columnWidth?nt:bt),{columns:Mt,columnWidth:yt,gutter:wt,beat:kt}=Jt,Ct=v.useMemo(()=>({columns:Mt,columnWidth:yt,gutter:wt,beat:kt}),[Mt,yt,wt,kt]),K=v.useMemo(()=>Ce(t.menuLayout,o,L,Ct),[t.menuLayout,o,L,Ct]),[lt,Qt]=v.useState(null),E=v.useMemo(()=>lt?Lt(K,lt):null,[K,lt]),y=v.useMemo(()=>E?Xt(K,E):K,[K,E]),{columns:F,gutter:st,columnWidth:ct}=y.grid,Pt=F*ct+(F-1)*st,ut=ct>0?{gridTemplateColumns:`repeat(${F}, minmax(0, ${d(ct)}))`,columnGap:d(st),width:`min(100%, ${d(Pt)})`,marginInline:"auto"}:{gridTemplateColumns:`repeat(${F}, minmax(0, 1fr))`,columnGap:d(st)},ht=t.triggerPosition??"right",St=t.triggerLabel||"Menu",rt=tt(t.triggerPadding),D=t.triggerType==="image"&&!t.triggerIcon?"burger":t.triggerType??"text",te=P(t,"trigger",e),ee=P(t,"title",e),oe={text:P(t,"text",e),listA:P(t,"listA",e,"text"),listB:P(t,"listB",e,"text")},W=((_t=t.stateOverrides)==null?void 0:_t.open)??{},It={[`--${i}-trigger-bg`]:t.barBackgroundColor,[`--${i}-trigger-color`]:(M?W.triggerColor:void 0)??t.triggerColor,[`--${i}-overlay-color`]:W.overlayColor??t.overlayColor,[`--${i}-popup-bg`]:W.popupBackgroundColor??t.popupBackgroundColor,[`--${i}-title-color`]:W.titleColor??t.titleColor,[`--${i}-text-color`]:W.textColor??t.textColor,[`--${i}-list-a-color`]:W.listAColor??t.listAColor,[`--${i}-list-b-color`]:W.listBColor??t.listBColor},pt=v.useRef(null),dt=v.useRef(null),J=v.useRef([]),[A,ne]=v.useState(null),mt=v.useRef(null),V=a=>{mt.current=a,ne(a)},G=!!(N&&n&&f),re=A?Nt(y,A):null;v.useEffect(()=>{G||V(null)},[G]),v.useLayoutEffect(()=>{const a=dt.current;if(!_||!a)return;const c=()=>{var $;const w=($=pt.current)==null?void 0:$.getBoundingClientRect().width;if(!w)return;const S={height:a.getBoundingClientRect().height/w,heights:o.map((k,R)=>{var I;return(((I=J.current[R])==null?void 0:I.getBoundingClientRect().height)??0)/w})};Qt(k=>k&&Se(k,S)?k:S)};c();const g=new ResizeObserver(c);return g.observe(a),J.current.slice(0,o.length).forEach(w=>w&&g.observe(w)),()=>g.disconnect()},[_,o]);const Rt=()=>{const a=dt.current,c=a.getBoundingClientRect(),g=a.offsetWidth?c.width/a.offsetWidth:1,w=(parseFloat(getComputedStyle(a).columnGap)||0)*g;return{area:c,gap:w,pitch:(c.width+w)/F}},ie=(a,c,g)=>{var I,q;if(!G||!y.placements[c]||a.button!==0)return;a.preventDefault(),a.stopPropagation(),a.currentTarget.setPointerCapture(a.pointerId);const{area:w,pitch:S}=Rt(),$=((I=J.current[c])==null?void 0:I.getBoundingClientRect())??a.currentTarget.getBoundingClientRect(),k=((q=pt.current)==null?void 0:q.getBoundingClientRect().width)||1,R=gt(y,c);V({index:c,pointerId:a.pointerId,handle:g,grabColumn:Math.min(Math.max(Math.floor((a.clientX-w.left)/S)-R.column,0),R.span-1),grabY:a.clientY-$.top,unit:k,start:R,placement:R,measure:Lt(y,{height:w.height/k,heights:o.map((Q,Y)=>{var b;return(((b=J.current[Y])==null?void 0:b.getBoundingClientRect().height)??0)/k})})})},ae=a=>{const c=mt.current;if(!c||a.pointerId!==c.pointerId)return;a.stopPropagation();const{area:g,gap:w,pitch:S}=Rt(),{start:$,measure:k,handle:R}=c,I=k.height;if(!R){V({...c,placement:{...$,column:Math.min(Math.max(Math.floor((a.clientX-g.left)/S)-c.grabColumn,0),F-$.span),top:X(y.grid,(a.clientY-c.grabY-g.top)/c.unit,I-k.heights[c.index])}});return}const q=a.clientX-g.left,Q=(a.clientY-g.top)/c.unit,Y=$.column+$.span;let{column:b,span:H,top:O}=$,it=$.height;if(R.includes("left")&&(b=Math.min(Math.max(Math.round(q/S),0),Y-1),H=Y-b),R.includes("right")&&(H=Math.min(Math.max(Math.round((q+w)/S),b+1),F)-b),R.includes("top")){const Bt=$.top+($.height??k.heights[c.index]??0);O=X(y.grid,Q,Bt-xt(y.grid)),it=et(y.grid,Bt-O,I-O)}R.includes("bottom")&&(it=et(y.grid,Q-O,I-O)),V({...c,placement:it===void 0?{column:b,span:H,top:O}:{column:b,span:H,top:O,height:it}})},le=a=>{const c=mt.current;if(!c||a.pointerId!==c.pointerId)return;a.stopPropagation();const g=Nt(y,c),w=g==null?void 0:g.placements[c.index];g&&w&&!we(w,gt(y,c.index))&&(f==null||f({...t,menuLayout:g})),V(null)},se=(a,c)=>{a.stopPropagation();const g=y.placements[c];if(!G||!g||g.height===void 0)return;const{height:w,...S}=g;f==null||f({...t,menuLayout:{...y,edited:!0,placements:y.placements.map(($,k)=>k===c?S:$)}})},zt=()=>z(!1),ce=a=>{!T&&a.target.closest("a")&&zt()},ue=(a,c)=>{const g=Zt(a),w=(a.images??[]).filter(b=>b==null?void 0:b.assetId),S=(A==null?void 0:A.index)===c,$=S?A.placement:gt(y,c),k=$.height!==void 0,R=$.height??(E==null?void 0:E.heights[c])??0,I=E?vt($.top,R,E.height,y.grid.beat):null,q=g!=="image"&&(k||I!==null&&R>=I.maxHeight-.001),Q=G&&(!A||S),Y=b=>({onPointerDown:H=>ie(H,c,b),onPointerMove:ae,onPointerUp:le,onPointerCancel:()=>V(null)});return x.jsxs("div",{className:`${i}-slot${S?` ${i}-slot-dragged`:""}`,style:{gridColumn:`${$.column+1} / span ${$.span}`,[`--${i}-room-left`]:I?d(I.maxHeight):`max(100cqh - ${d($.top)}, 25cqh)`},children:[x.jsx("div",{className:`${i}-spacer`,style:{flexBasis:d(I?I.top:$.top)}}),x.jsxs("div",{className:`${i}-frame`,children:[x.jsxs("div",{ref:b=>{J.current[c]=b},className:[`${i}-block ${i}-block-${g}`,k?`${i}-block-sized`:"",q?`${i}-block-full`:"",S?`${i}-block-dragged`:"",S&&!re?`${i}-block-invalid`:""].filter(Boolean).join(" "),style:k?{height:d($.height)}:void 0,...G?Y(null):{},children:[a.title&&g!=="image"?x.jsx("div",{className:`${i}-block-title`,style:{...ee,marginBottom:d(t.titleGap)},children:a.title}):null,g==="image"?x.jsx(Ie,{prefix:i,images:w,isRunning:M,radius:d(t.imageRadius)}):x.jsx("div",{className:`${i}-block-text`,style:oe[g],children:x.jsx(ge.RichTextRenderer,{content:Array.isArray(a.text)?a.text:[]})})]}),Q?ye.map(b=>x.jsx("div",{className:`${i}-handle ${i}-handle-${b}${S&&A.handle===b?` ${i}-handle-active`:""}`,"aria-hidden":!0,...Y(b),onDoubleClick:b.includes("top")||b.includes("bottom")?H=>se(H,c):void 0},b)):null]})]},c)},he=_?x.jsxs("div",{ref:pt,"data-selection":"none",className:`${i}-overlay ${p?`${i}-overlay-active`:""}`.trim(),style:It,"aria-hidden":!p,children:[x.jsx("button",{type:"button",className:`${i}-backdrop`,"aria-label":"Close menu",tabIndex:-1,onClick:T?void 0:zt}),x.jsx("div",{className:`${i}-card`,role:"dialog","aria-modal":"true","aria-label":t.triggerLabel||"Menu",onClick:ce,style:{height:d(t.popupHeight??$t),top:d(Z.top),left:d(Z.left),right:d(Z.right),maxHeight:`calc(100% - ${d(Z.top)} - ${d(Z.bottom)})`,padding:[ot.top,ot.right,ot.bottom,ot.left].map(a=>d(a)).join(" "),borderRadius:d(t.popupRadius)},children:x.jsxs("div",{ref:dt,className:`${i}-grid${G?` ${i}-grid-editable`:""}`,style:ut,children:[o.map(ue),G?x.jsx("div",{className:`${i}-guides${y.grid.beat?` ${i}-guides-beats`:""}${A?` ${i}-guides-shown`:""}`,style:{gridTemplateColumns:ut.gridTemplateColumns,columnGap:ut.columnGap,[`--${i}-beat`]:y.grid.beat?d(y.grid.beat):void 0},"aria-hidden":!0,children:Array.from({length:F},(a,c)=>x.jsx("div",{className:`${i}-guide`},c))}):null]})})]}):null;return x.jsxs("div",{className:`${i}-root`,style:It,"data-edit-mode":n?"":void 0,children:[x.jsx("style",{dangerouslySetInnerHTML:{__html:B}}),x.jsx("div",{className:`${i}-bar`,children:x.jsx("button",{type:"button",className:[`${i}-button ${i}-slot-${ht}`,D!=="text"?`${i}-button-icon`:"",M?`${i}-button-open`:""].filter(Boolean).join(" "),style:{...D==="text"?te:void 0,gridColumn:ht==="left"?1:ht==="center"?2:3,gridRow:1,padding:[rt.top,rt.right,rt.bottom,rt.left].map(a=>d(a)).join(" "),[`--${i}-icon-size`]:d(t.triggerIconSize??Me)},"aria-expanded":M,"aria-label":D==="text"?void 0:St,onClick:T?void 0:()=>z(a=>!a),children:D==="text"?St:x.jsx("span",{className:`${i}-icon ${i}-icon-${D}`,"aria-hidden":!0,children:D==="image"?x.jsx(fe.SvgImage,{url:t.triggerIcon,fill:`var(--${i}-trigger-color)`,hoverFill:`var(--${i}-trigger-color)`,className:`${i}-icon-picture`}):Array.from({length:D==="burger"?3:2},(a,c)=>x.jsx("span",{className:`${i}-icon-line`},c))})})}),he]})}function Ie({prefix:t,images:o,isRunning:e,radius:n}){const[r,l]=v.useState(0),u=o.length;return v.useEffect(()=>{if(!e||u<2){l(0);return}const s=window.setInterval(()=>l(h=>(h+1)%u),ve);return()=>window.clearInterval(s)},[e,u]),x.jsx("div",{className:`${t}-images`,children:o.map((s,h)=>x.jsx("img",{className:`${t}-image${h===r%u?"":` ${t}-image-hidden`}`,src:s.assetId,alt:s.name??"","aria-hidden":h!==r%u,style:{borderRadius:n}},h))})}const Re=Object.freeze(Object.defineProperty({__proto__:null,POPUP_MENU_TRIGGER_TYPES:Vt,PopupMenu:Kt},Symbol.toStringTag,{value:"Module"}));exports.DEFAULT_POPUP_MENU_GRID=bt;exports.DEFAULT_POPUP_MENU_HEIGHT=$t;exports.POPUP_MENU_TRIGGER_TYPES=Vt;exports.PopupMenu=Kt;exports.PopupMenu$1=Re;exports.defaultPopupMenuLayoutRules=Gt;exports.fitPopupMenuLayoutToGrid=Wt;exports.generatePopupMenuLayout=Ht;exports.getPopupMenuGrid=Et;exports.getPopupMenuHeight=Ft;exports.getPopupMenuSides=tt;exports.isSamePopupMenuGrid=Dt;exports.movePopupMenuBlock=Yt;exports.randomPopupMenuSeed=$e;exports.resizePopupMenuBlock=Ot;exports.settlePopupMenuLayout=Xt;exports.snapPopupMenuHeight=et;exports.snapPopupMenuTop=X;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
-
import { useState as l, useEffect as u } from "react";
|
|
3
|
-
import g from "classnames";
|
|
4
|
-
import { i as p, l as k } from "./loadSvgMaskUrl-xHgGYgPe.mjs";
|
|
5
|
-
const v = "SvgImage-module__svg___q3xE-", C = "SvgImage-module__img___VsTm-", c = {
|
|
6
|
-
svg: v,
|
|
7
|
-
img: C
|
|
8
|
-
}, w = (s) => {
|
|
9
|
-
const e = s.trim().toLowerCase();
|
|
10
|
-
return !!(e.startsWith("data:image/svg+xml") || e.includes("image/svg+xml") || e.includes(".svg") || e.startsWith("blob:"));
|
|
11
|
-
}, _ = (s) => `url("${s.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}")`, x = ({ url: s, fill: e = "#000000", hoverFill: f = "#CCCCCC", className: a = "", style: i }) => {
|
|
12
|
-
const [n, d] = l(() => typeof window > "u" ? !0 : CSS.supports("mask-image", 'url("")') || CSS.supports("-webkit-mask-image", 'url("")')), [o, r] = l(() => p(s) ? s : null);
|
|
13
|
-
return u(() => {
|
|
14
|
-
if (typeof window < "u" && window.CSS) {
|
|
15
|
-
const t = CSS.supports("mask-image", 'url("")') || CSS.supports("-webkit-mask-image", 'url("")');
|
|
16
|
-
d(t);
|
|
17
|
-
}
|
|
18
|
-
}, []), u(() => {
|
|
19
|
-
if (!w(s)) {
|
|
20
|
-
r(null);
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
if (p(s)) {
|
|
24
|
-
r(s);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
let t = !1;
|
|
28
|
-
return k(s).then((S) => {
|
|
29
|
-
t || r(S);
|
|
30
|
-
}).catch(() => {
|
|
31
|
-
t || r(null);
|
|
32
|
-
}), () => {
|
|
33
|
-
t = !0;
|
|
34
|
-
};
|
|
35
|
-
}, [s]), !o || !n ? /* @__PURE__ */ m("img", { src: s, alt: "", className: g(c.img, a), style: i }) : /* @__PURE__ */ m(
|
|
36
|
-
"span",
|
|
37
|
-
{
|
|
38
|
-
"data-supports-mask": n,
|
|
39
|
-
className: g(c.svg, a),
|
|
40
|
-
style: {
|
|
41
|
-
"--svg": _(o),
|
|
42
|
-
"--fill": e,
|
|
43
|
-
"--hover-fill": f,
|
|
44
|
-
...i ?? {}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
export {
|
|
50
|
-
x as S
|
|
51
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const g=require("react/jsx-runtime"),a=require("react"),c=require("classnames"),n=require("./loadSvgMaskUrl-DfF7ay6h.js"),d="SvgImage-module__svg___q3xE-",k="SvgImage-module__img___VsTm-",m={svg:d,img:k},v=e=>{const s=e.trim().toLowerCase();return!!(s.startsWith("data:image/svg+xml")||s.includes("image/svg+xml")||s.includes(".svg")||s.startsWith("blob:"))},C=e=>`url("${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}")`,w=({url:e,fill:s="#000000",hoverFill:f="#CCCCCC",className:i="",style:u})=>{const[l,p]=a.useState(()=>typeof window>"u"?!0:CSS.supports("mask-image",'url("")')||CSS.supports("-webkit-mask-image",'url("")')),[o,r]=a.useState(()=>n.isInlineMaskUrl(e)?e:null);return a.useEffect(()=>{if(typeof window<"u"&&window.CSS){const t=CSS.supports("mask-image",'url("")')||CSS.supports("-webkit-mask-image",'url("")');p(t)}},[]),a.useEffect(()=>{if(!v(e)){r(null);return}if(n.isInlineMaskUrl(e)){r(e);return}let t=!1;return n.loadSvgMaskUrl(e).then(S=>{t||r(S)}).catch(()=>{t||r(null)}),()=>{t=!0}},[e]),!o||!l?g.jsx("img",{src:e,alt:"",className:c(m.img,i),style:u}):g.jsx("span",{"data-supports-mask":l,className:c(m.svg,i),style:{"--svg":C(o),"--fill":s,"--hover-fill":f,...u??{}}})};exports.SvgImage=w;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const n=new Map;function s(t){return t.startsWith("data:")||t.startsWith("blob:")}function c(t){if(s(t))return Promise.resolve(t);const r=n.get(t);if(r)return r;const a=fetch(t,{mode:"cors",cache:"reload"}).then(e=>{if(!e.ok)throw new Error(String(e.status));return e.blob()}).then(e=>URL.createObjectURL(e)).catch(e=>{throw n.delete(t),e});return n.set(t,a),a}exports.isInlineMaskUrl=s;exports.loadSvgMaskUrl=c;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const n = /* @__PURE__ */ new Map();
|
|
2
|
-
function c(t) {
|
|
3
|
-
return t.startsWith("data:") || t.startsWith("blob:");
|
|
4
|
-
}
|
|
5
|
-
function o(t) {
|
|
6
|
-
if (c(t)) return Promise.resolve(t);
|
|
7
|
-
const r = n.get(t);
|
|
8
|
-
if (r) return r;
|
|
9
|
-
const a = fetch(t, { mode: "cors", cache: "reload" }).then((e) => {
|
|
10
|
-
if (!e.ok) throw new Error(String(e.status));
|
|
11
|
-
return e.blob();
|
|
12
|
-
}).then((e) => URL.createObjectURL(e)).catch((e) => {
|
|
13
|
-
throw n.delete(t), e;
|
|
14
|
-
});
|
|
15
|
-
return n.set(t, a), a;
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
c as i,
|
|
19
|
-
o as l
|
|
20
|
-
};
|