@pagehub/sdk 0.1.4 → 0.1.6
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/README.md +1 -1
- package/dist/chrome/viewport/Viewport/hooks/usePageLoadIndicator.d.ts +2 -2
- package/dist/chrome/viewport/design-system/hooks/useDesignSystem.d.ts +2 -2
- package/dist/chrome/viewport/design-system/hooks/usePaletteState.d.ts +2 -2
- package/dist/chunks/ActionEditorPanel-9v50QUwu.js +89 -0
- package/dist/chunks/ActionInput-CTt7sOs6.js +929 -0
- package/dist/chunks/ActionsAddPicker-BeTPUUor.js +51 -0
- package/dist/chunks/ActionsInput-D0h-zLYj.js +174 -0
- package/dist/chunks/AnchoredPopover-CckPTxXu.js +2676 -0
- package/dist/chunks/AnimationEditorPanel-CXNmsTqV.js +26 -0
- package/dist/chunks/AnimationsInput-Djyz0uXG.js +292 -0
- package/dist/chunks/AnimationsInputPopover-B2-oNebx.js +71 -0
- package/dist/chunks/AnimationsPanel-DungA9qb.js +25 -0
- package/dist/chunks/Audio.render-CsR69fZ9.js +22 -0
- package/dist/chunks/AudioMainTab-BljM2NMQ.js +70 -0
- package/dist/chunks/BackdropEditorPanel-CA2k-6SR.js +26 -0
- package/dist/chunks/BackgroundImageInputPopover-vB_217Ig.js +94 -0
- package/dist/chunks/BackgroundImagePanel-BvMhF9eU.js +100 -0
- package/dist/chunks/BackgroundMainTab-CI4c5DEF.js +10 -0
- package/dist/chunks/BundleRowPanel-BcYfyfGQ.js +33 -0
- package/dist/chunks/ButtonMainTab-Civy_DoA.js +43 -0
- package/dist/chunks/CSSEditorInput-C1ITwAh3.js +73 -0
- package/dist/chunks/ClassNameInput-Ce0fGQES.js +720 -0
- package/dist/chunks/CodeEditor-axBXmPH8.js +33370 -0
- package/dist/chunks/ColorInput-BSfMNt86.js +187 -0
- package/dist/chunks/ColorPanel-DOLrT-gS.js +562 -0
- package/dist/chunks/ComponentImportExportPanel-DVcnGhGx.js +161 -0
- package/dist/chunks/ComponentImportExportPopover-BY1_oxU8.js +26 -0
- package/dist/chunks/ConditionEditorPanel-DLbqYaSF.js +43 -0
- package/dist/chunks/ConditionsAddPicker-SsHJlc1E.js +54 -0
- package/dist/chunks/ConditionsInput-B_5Nge8o.js +474 -0
- package/dist/chunks/ContainerMainTab-kkktm1Ns.js +1107 -0
- package/dist/chunks/ContainerOverflowSectionPanel-ibKXf-1N.js +120 -0
- package/dist/chunks/ContainerOverflowSectionPopover-CRQ9EPsn.js +24 -0
- package/dist/chunks/ContainerPaddingOverlay-Cd3xOv-S.js +340 -0
- package/dist/chunks/ContainerScrollEffectSection-Dbztqdnr.js +123 -0
- package/dist/chunks/ContainerStateSection-DY_gjBJL.js +478 -0
- package/dist/chunks/ConversionFields-Bpfl-SGP.js +135 -0
- package/dist/chunks/CraftListEditor-_TIy1ogW.js +73 -0
- package/dist/chunks/CreateTokenDialog-DNWtWqJd.js +147 -0
- package/dist/chunks/Data.render-DTmaqSyz.js +10 -0
- package/dist/chunks/DataAttributesPanel-mYhisO_O.js +125 -0
- package/dist/chunks/DataMainTab-Batm515E.js +23 -0
- package/dist/chunks/DataSourceSectionSlot-BKoO6Vxn.js +10 -0
- package/dist/chunks/EditorEmptyLeafHintView-D3E3UN_0.js +78 -0
- package/dist/chunks/EffectRowInputPopover-CYhfjFwJ.js +323 -0
- package/dist/chunks/EffectsClassInput-Yujuchwy.js +315 -0
- package/dist/chunks/Embed.render-BgKpUV8n.js +17 -0
- package/dist/chunks/EmbedMainTab-d_-Bnkug.js +225 -0
- package/dist/chunks/FilterEditorPanel-CRa0IpLr.js +26 -0
- package/dist/chunks/FlexDirectionInput-C5gYjk5W.js +78 -0
- package/dist/chunks/FloatingPanel-DJP5Vhua.js +553 -0
- package/dist/chunks/FontFamilyInput-CVNnVylt.js +111 -0
- package/dist/chunks/Form.render-6GjcmL2u.js +54 -0
- package/dist/chunks/FormElement.render-DWrG-2ID.js +36 -0
- package/dist/chunks/FormElementMainTab-DSbF3F6e.js +470 -0
- package/dist/chunks/FormMainTab-SHny1HxF.js +240 -0
- package/dist/chunks/GradientInputPopover-1K6O9jBq.js +103 -0
- package/dist/chunks/GradientPanel-DSRQKkaB.js +194 -0
- package/dist/chunks/HTMLCodeInput-CCe4Bj5z.js +69 -0
- package/dist/chunks/HandlerEditorPanel-DiOXobsl.js +93 -0
- package/dist/chunks/HandlersAddPicker-DWTgjKgo.js +101 -0
- package/dist/chunks/HandlersInput-p49STTn8.js +132 -0
- package/dist/chunks/IconDialogInput-C-81_L2n.js +105 -0
- package/dist/chunks/IconInput-D2Gy7Hvf.js +182 -0
- package/dist/chunks/IconMainTab-CNrVjDWP.js +26 -0
- package/dist/chunks/IconPickerPanel-BjNOlCh6.js +670 -0
- package/dist/chunks/ImageMainTab-C4O7RjX0.js +66 -0
- package/dist/chunks/ImageSettingsPanel-dvOmGg3C.js +485 -0
- package/dist/chunks/LayoutPresetPanel-CNAVAcvw.js +81 -0
- package/dist/chunks/LayoutPresetSlot-BqMTdE33.js +16 -0
- package/dist/chunks/LinkMainTab-BfFZx0AU.js +13 -0
- package/dist/chunks/ListEditor-mD-CmRNE.js +178 -0
- package/dist/chunks/Map.render-DFkmncHz.js +82 -0
- package/dist/chunks/MapLeaflet-DOfmZ3Pk.js +6588 -0
- package/dist/chunks/MapMainTab-CxI7IS1_.js +165 -0
- package/dist/chunks/MapPoint.render-0OAfCZTp.js +16 -0
- package/dist/chunks/MapPointMainTab-CmLcaSR5.js +60 -0
- package/dist/chunks/MediaInput-DHs3D8TJ.js +672 -0
- package/dist/chunks/MediaManagerModal-Dc5PK3dn.js +240 -0
- package/dist/chunks/MiniPreviewTile-B4zxTj9Y.js +32 -0
- package/dist/chunks/ModifierChipList-CwsWklih.js +33 -0
- package/dist/chunks/ModifiersAddPicker-D-vSYw7O.js +74 -0
- package/dist/chunks/ModifiersPickerPanel-CTefidBx.js +243 -0
- package/dist/chunks/NodeAiContextInputPopover-D5bn5o_T.js +66 -0
- package/dist/chunks/NodeAiContextPanel-Bx4rcjiM.js +81 -0
- package/dist/chunks/NumberSettingsPanel-DASi_l6V.js +56 -0
- package/dist/chunks/PageSettingsModal-D6o450IR.js +2678 -0
- package/dist/chunks/PatternInputPopover-qMWBv_nl.js +100 -0
- package/dist/chunks/PatternPanel-D2fgWDd-.js +352 -0
- package/dist/chunks/PeekTargetButton-ClrJX7zh.js +26 -0
- package/dist/chunks/PermissionsSection-DwobrV40.js +82 -0
- package/dist/chunks/PresetAddChildList-D6a0xdt8.js +35 -0
- package/dist/chunks/PropertiesInput-9O39ngbb.js +125 -0
- package/dist/chunks/PropertiesPanel-DO0RlalO.js +76 -0
- package/dist/chunks/SaveModifierPanel-B6mjKyrT.js +130 -0
- package/dist/chunks/ScrollEffectEditorPanel-CllGUhui.js +26 -0
- package/dist/chunks/SearchInput-DRUztbM0.js +76 -0
- package/dist/chunks/SearchableMenuPopover-DZKVXiEl.js +1251 -0
- package/dist/chunks/SlotRenderer-CaLf_2_C.js +38 -0
- package/dist/chunks/StateBindingEditorPanel-DKdcG5py.js +101 -0
- package/dist/chunks/StateBindingsAddPicker-DxMNAWAD.js +91 -0
- package/dist/chunks/StateBindingsInput-iWiqvAVB.js +103 -0
- package/dist/chunks/TailwindInput-660FZtyK.js +24 -0
- package/dist/chunks/TextEditor-B2O7DlN8.js +22032 -0
- package/dist/chunks/TextMainTab-B5udsXsk.js +260 -0
- package/dist/chunks/TextStyleEditorPanel-GRNPGzUL.js +381 -0
- package/dist/chunks/TextStylePickerPanel-l108SmGQ.js +140 -0
- package/dist/chunks/TextareaSettingsPanel-C1rQuF1O.js +50 -0
- package/dist/chunks/TokenPicker-Q0LToF_p.js +291 -0
- package/dist/chunks/ToolbarDashedButton-DbUxGmDg.js +23 -0
- package/dist/chunks/TransformEditorPanel-BGwyznZ6.js +26 -0
- package/dist/chunks/TransitionEditorPanel-BSvk58Ow.js +26 -0
- package/dist/chunks/TypographyPresetInput-DqnGSgR2.js +296 -0
- package/dist/chunks/ValidationPanel-CmA9SfoF.js +56 -0
- package/dist/chunks/Video.render-Dg6xvis4.js +21 -0
- package/dist/chunks/VideoMainTab-v5UFhUm-.js +174 -0
- package/dist/chunks/YouTube.esm-EbHnLU1Z.js +744 -0
- package/dist/chunks/dialogAtoms-CeQ2G05l.js +59 -0
- package/dist/chunks/extends-hS2Bh-Yp.js +12 -0
- package/dist/chunks/formatStorage-C3o2s3dk.js +22 -0
- package/dist/chunks/googleFonts-Dj4AntNi.js +323 -0
- package/dist/chunks/helpers-Cll72tMn.js +18 -0
- package/dist/chunks/index-B-GJd039.js +2875 -0
- package/dist/chunks/index-C66dAl3Q.js +32177 -0
- package/dist/chunks/index.esm-mqFx3NOs.js +644 -0
- package/dist/chunks/popoverOpenRequestAtom-hBS_siXv.js +22 -0
- package/dist/chunks/propertyRegistry-CMhVNOgl.js +38 -0
- package/dist/chunks/resolveAnchorsViaCraft-Cixm6ZyJ.js +31 -0
- package/dist/chunks/toolboxUtils-DjTMslSn.js +370 -0
- package/dist/chunks/uiPrimitives-BtohldWg.js +15 -0
- package/dist/chunks/use-event-listener-DO3Sk7g0.js +15 -0
- package/dist/chunks/useElementPicker-DoNuXNMQ.js +41 -0
- package/dist/chunks/useLayoutPreset-wOMV5YnO.js +528 -0
- package/dist/chunks/useMediaManager-CmKDbFfw.js +4629 -0
- package/dist/chunks/usePopoverAutoOpen-CxIjt0ez.js +25 -0
- package/dist/chunks/usePopoverPosition-83Vti7Aw.js +15 -0
- package/dist/render/static/index.js +9 -0
- package/package.json +22 -13
- package/dist/pagehub-viewer.umd.cjs +0 -574
- package/dist/pagehub.umd.cjs +0 -1130
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
import { jsxs as B, jsx as H, Fragment as Rt } from "react/jsx-runtime";
|
|
2
|
+
import p, { useRef as A, useEffect as W, useCallback as et, useState as U, useMemo as St, useContext as ct, useLayoutEffect as zt } from "react";
|
|
3
|
+
import Dt from "react-dom";
|
|
4
|
+
import { db as ft, ct as Lt, t as Ht, a4 as Ft, bY as Nt } from "./index-C66dAl3Q.js";
|
|
5
|
+
const Wt = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])';
|
|
6
|
+
function At(t) {
|
|
7
|
+
const o = A(null), i = A(null);
|
|
8
|
+
return W(() => {
|
|
9
|
+
if (!t || !o.current) return;
|
|
10
|
+
i.current = document.activeElement;
|
|
11
|
+
const a = o.current, l = () => Array.from(a.querySelectorAll(Wt)).filter(
|
|
12
|
+
(r) => r.offsetParent !== null
|
|
13
|
+
), d = l();
|
|
14
|
+
d.length > 0 && requestAnimationFrame(() => {
|
|
15
|
+
var r;
|
|
16
|
+
return (r = d[0]) == null ? void 0 : r.focus();
|
|
17
|
+
});
|
|
18
|
+
const c = (r) => {
|
|
19
|
+
if (r.key !== "Tab") return;
|
|
20
|
+
const w = l();
|
|
21
|
+
if (w.length === 0) return;
|
|
22
|
+
const m = w[0], s = w[w.length - 1];
|
|
23
|
+
r.shiftKey ? document.activeElement === m && (s.focus(), r.preventDefault()) : document.activeElement === s && (m.focus(), r.preventDefault());
|
|
24
|
+
};
|
|
25
|
+
return a.addEventListener("keydown", c), () => {
|
|
26
|
+
var r;
|
|
27
|
+
a.removeEventListener("keydown", c), (r = i.current) == null || r.focus();
|
|
28
|
+
};
|
|
29
|
+
}, [t]), o;
|
|
30
|
+
}
|
|
31
|
+
let S = null;
|
|
32
|
+
function Xt() {
|
|
33
|
+
return S && document.body.contains(S) || (S = document.createElement("div"), S.setAttribute("aria-live", "polite"), S.setAttribute("aria-atomic", "true"), S.setAttribute("role", "status"), S.className = "sr-only", S.style.cssText = "position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0", document.body.appendChild(S)), S;
|
|
34
|
+
}
|
|
35
|
+
function Zt() {
|
|
36
|
+
return et((o, i = "polite") => {
|
|
37
|
+
const a = Xt();
|
|
38
|
+
a.setAttribute("aria-live", i), a.textContent = "", requestAnimationFrame(() => {
|
|
39
|
+
a.textContent = o;
|
|
40
|
+
});
|
|
41
|
+
}, []);
|
|
42
|
+
}
|
|
43
|
+
function Yt(t) {
|
|
44
|
+
const { threshold: o = 1 } = t, i = p.useRef(t.onStart), a = p.useRef(t.onMove), l = p.useRef(t.onEnd);
|
|
45
|
+
p.useEffect(() => {
|
|
46
|
+
i.current = t.onStart, a.current = t.onMove, l.current = t.onEnd;
|
|
47
|
+
});
|
|
48
|
+
const d = p.useRef(null), c = p.useRef(!1), r = p.useRef(null), w = p.useRef(null), m = p.useRef(null), s = p.useCallback(() => {
|
|
49
|
+
r.current && (window.removeEventListener("pointermove", r.current), r.current = null), w.current && (window.removeEventListener("pointerup", w.current), window.removeEventListener("pointercancel", w.current), w.current = null), m.current && (window.removeEventListener("blur", m.current), m.current = null);
|
|
50
|
+
}, []), v = p.useCallback(
|
|
51
|
+
(u) => {
|
|
52
|
+
var z;
|
|
53
|
+
if (!d.current) return;
|
|
54
|
+
s();
|
|
55
|
+
const y = c.current;
|
|
56
|
+
d.current = null, c.current = !1, (z = l.current) == null || z.call(l, u, y);
|
|
57
|
+
},
|
|
58
|
+
[s]
|
|
59
|
+
), x = p.useCallback(
|
|
60
|
+
(u) => {
|
|
61
|
+
var D;
|
|
62
|
+
if (u.button !== 0) return;
|
|
63
|
+
s();
|
|
64
|
+
const y = { clientX: u.clientX, clientY: u.clientY };
|
|
65
|
+
if (((D = i.current) == null ? void 0 : D.call(i, u, y)) === !1) return;
|
|
66
|
+
d.current = y, c.current = !1;
|
|
67
|
+
try {
|
|
68
|
+
u.currentTarget.setPointerCapture(u.pointerId);
|
|
69
|
+
} catch {
|
|
70
|
+
}
|
|
71
|
+
const P = (R) => {
|
|
72
|
+
var _;
|
|
73
|
+
if (!d.current) return;
|
|
74
|
+
if (R.buttons === 0) {
|
|
75
|
+
v(R);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const L = R.clientX - d.current.clientX, F = R.clientY - d.current.clientY;
|
|
79
|
+
!c.current && Math.hypot(L, F) >= o && (c.current = !0), (_ = a.current) == null || _.call(a, R, { dx: L, dy: F, clientX: R.clientX, clientY: R.clientY });
|
|
80
|
+
}, C = (R) => v(R), M = () => v(null);
|
|
81
|
+
r.current = P, w.current = C, m.current = M, window.addEventListener("pointermove", P), window.addEventListener("pointerup", C), window.addEventListener("pointercancel", C), window.addEventListener("blur", M);
|
|
82
|
+
},
|
|
83
|
+
[s, v, o]
|
|
84
|
+
);
|
|
85
|
+
return p.useEffect(() => () => {
|
|
86
|
+
var z;
|
|
87
|
+
const u = d.current !== null, y = c.current;
|
|
88
|
+
s(), d.current = null, c.current = !1, u && ((z = l.current) == null || z.call(l, null, y));
|
|
89
|
+
}, [s]), { onPointerDown: x };
|
|
90
|
+
}
|
|
91
|
+
const Ct = (t = {}) => {
|
|
92
|
+
const { initialPosition: o = { x: 40, y: 40 }, bounds: i } = t, [a, l] = U(o), [d, c] = U(!1), r = A({ x: 0, y: 0 }), w = A(null), { onPointerDown: m } = Yt({
|
|
93
|
+
onStart: (s) => {
|
|
94
|
+
if (s.target.closest("button")) return !1;
|
|
95
|
+
s.preventDefault(), r.current = { ...a }, c(!0), document.body.style.cursor = "grabbing", document.body.style.userSelect = "none";
|
|
96
|
+
},
|
|
97
|
+
onMove: (s, v) => {
|
|
98
|
+
let x = r.current.x + v.dx, u = r.current.y + v.dy;
|
|
99
|
+
if (i && (i.left !== void 0 && (x = Math.max(i.left, x)), i.top !== void 0 && (u = Math.max(i.top, u)), w.current)) {
|
|
100
|
+
const y = w.current.getBoundingClientRect();
|
|
101
|
+
i.right !== void 0 && (x = Math.min(window.innerWidth - y.width - i.right, x)), i.bottom !== void 0 && (u = Math.min(window.innerHeight - y.height - i.bottom, u));
|
|
102
|
+
}
|
|
103
|
+
l({ x, y: u });
|
|
104
|
+
},
|
|
105
|
+
onEnd: () => {
|
|
106
|
+
c(!1), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
return {
|
|
110
|
+
position: a,
|
|
111
|
+
isDragging: d,
|
|
112
|
+
windowRef: w,
|
|
113
|
+
handlePointerDown: m,
|
|
114
|
+
setPosition: l
|
|
115
|
+
};
|
|
116
|
+
}, _t = {
|
|
117
|
+
n: "ns-resize",
|
|
118
|
+
s: "ns-resize",
|
|
119
|
+
e: "ew-resize",
|
|
120
|
+
w: "ew-resize",
|
|
121
|
+
ne: "nesw-resize",
|
|
122
|
+
sw: "nesw-resize",
|
|
123
|
+
nw: "nwse-resize",
|
|
124
|
+
se: "nwse-resize"
|
|
125
|
+
}, ot = 8, b = 14;
|
|
126
|
+
function kt(t) {
|
|
127
|
+
const {
|
|
128
|
+
storageKey: o,
|
|
129
|
+
defaultWidth: i,
|
|
130
|
+
defaultHeight: a,
|
|
131
|
+
minWidth: l = 200,
|
|
132
|
+
minHeight: d = 200,
|
|
133
|
+
maxWidth: c = 9999,
|
|
134
|
+
maxHeight: r = 9999,
|
|
135
|
+
edges: w = ["e", "s", "se"],
|
|
136
|
+
persist: m = !0
|
|
137
|
+
} = t, s = (e, h) => ({
|
|
138
|
+
width: Math.max(Math.min(l, c), Math.min(c, Math.round(e))),
|
|
139
|
+
height: Math.max(Math.min(d, r), Math.min(r, Math.round(h)))
|
|
140
|
+
}), [v, x] = U(() => {
|
|
141
|
+
if (m)
|
|
142
|
+
try {
|
|
143
|
+
const e = ft.getJSON(
|
|
144
|
+
"resizable-" + o,
|
|
145
|
+
null
|
|
146
|
+
);
|
|
147
|
+
if (e && typeof e.width == "number" && typeof e.height == "number")
|
|
148
|
+
return s(e.width, e.height);
|
|
149
|
+
} catch {
|
|
150
|
+
}
|
|
151
|
+
return { width: i, height: a };
|
|
152
|
+
}), [u] = U(() => {
|
|
153
|
+
if (!m) return !1;
|
|
154
|
+
try {
|
|
155
|
+
const e = ft.getJSON(
|
|
156
|
+
"resizable-" + o,
|
|
157
|
+
null
|
|
158
|
+
);
|
|
159
|
+
return !!(e && typeof e.width == "number" && typeof e.height == "number");
|
|
160
|
+
} catch {
|
|
161
|
+
return !1;
|
|
162
|
+
}
|
|
163
|
+
}), y = et((e) => {
|
|
164
|
+
x((h) => h.width === e.width && h.height === e.height ? h : e);
|
|
165
|
+
}, []), [z, P] = U({ dx: 0, dy: 0 }), [C, M] = U(!1), D = A(v);
|
|
166
|
+
D.current = v;
|
|
167
|
+
const R = A(z);
|
|
168
|
+
R.current = z;
|
|
169
|
+
const L = A(null), F = et(
|
|
170
|
+
(e) => {
|
|
171
|
+
if (m)
|
|
172
|
+
try {
|
|
173
|
+
ft.set("resizable-" + o, e);
|
|
174
|
+
} catch {
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
[o, m]
|
|
178
|
+
);
|
|
179
|
+
W(() => {
|
|
180
|
+
x((e) => {
|
|
181
|
+
const h = s(e.width, e.height);
|
|
182
|
+
return h.width === e.width && h.height === e.height ? e : h;
|
|
183
|
+
});
|
|
184
|
+
}, [l, d, c, r]), W(() => {
|
|
185
|
+
const e = (E) => {
|
|
186
|
+
const f = L.current;
|
|
187
|
+
if (!f) return;
|
|
188
|
+
E.preventDefault();
|
|
189
|
+
const g = E.clientX - f.startX, k = E.clientY - f.startY;
|
|
190
|
+
let q = f.startWidth, V = f.startHeight, Z = 0, X = 0;
|
|
191
|
+
f.edge.includes("e") && (q = f.startWidth + g), f.edge.includes("w") && (q = f.startWidth - g, Z = g), f.edge.includes("s") && (V = f.startHeight + k), f.edge.includes("n") && (V = f.startHeight - k, X = k);
|
|
192
|
+
const I = s(q, V);
|
|
193
|
+
f.edge.includes("w") && (Z = f.startWidth - I.width), f.edge.includes("n") && (X = f.startHeight - I.height), D.current = I, R.current = { dx: Z, dy: X }, x(I), P({ dx: Z, dy: X });
|
|
194
|
+
}, h = () => {
|
|
195
|
+
L.current && (L.current = null, M(!1), F(D.current), P({ dx: 0, dy: 0 }), document.body.style.cursor = "", document.body.style.userSelect = "");
|
|
196
|
+
};
|
|
197
|
+
return document.addEventListener("pointermove", e), document.addEventListener("pointerup", h), () => {
|
|
198
|
+
document.removeEventListener("pointermove", e), document.removeEventListener("pointerup", h);
|
|
199
|
+
};
|
|
200
|
+
}, [l, d, c, r, F]);
|
|
201
|
+
const _ = et(
|
|
202
|
+
(e) => (h) => {
|
|
203
|
+
h.preventDefault(), h.stopPropagation(), L.current = {
|
|
204
|
+
edge: e,
|
|
205
|
+
startX: h.clientX,
|
|
206
|
+
startY: h.clientY,
|
|
207
|
+
startWidth: D.current.width,
|
|
208
|
+
startHeight: D.current.height
|
|
209
|
+
}, M(!0), document.body.style.cursor = _t[e], document.body.style.userSelect = "none";
|
|
210
|
+
},
|
|
211
|
+
[]
|
|
212
|
+
), ut = {
|
|
213
|
+
n: {
|
|
214
|
+
position: "absolute",
|
|
215
|
+
top: -4,
|
|
216
|
+
left: b,
|
|
217
|
+
right: b,
|
|
218
|
+
height: ot,
|
|
219
|
+
cursor: "ns-resize"
|
|
220
|
+
},
|
|
221
|
+
s: {
|
|
222
|
+
position: "absolute",
|
|
223
|
+
bottom: -4,
|
|
224
|
+
left: b,
|
|
225
|
+
right: b,
|
|
226
|
+
height: ot,
|
|
227
|
+
cursor: "ns-resize"
|
|
228
|
+
},
|
|
229
|
+
e: {
|
|
230
|
+
position: "absolute",
|
|
231
|
+
right: -4,
|
|
232
|
+
top: b,
|
|
233
|
+
bottom: b,
|
|
234
|
+
width: ot,
|
|
235
|
+
cursor: "ew-resize"
|
|
236
|
+
},
|
|
237
|
+
w: {
|
|
238
|
+
position: "absolute",
|
|
239
|
+
left: -4,
|
|
240
|
+
top: b,
|
|
241
|
+
bottom: b,
|
|
242
|
+
width: ot,
|
|
243
|
+
cursor: "ew-resize"
|
|
244
|
+
},
|
|
245
|
+
ne: {
|
|
246
|
+
position: "absolute",
|
|
247
|
+
top: -4,
|
|
248
|
+
right: -4,
|
|
249
|
+
width: b,
|
|
250
|
+
height: b,
|
|
251
|
+
cursor: "nesw-resize"
|
|
252
|
+
},
|
|
253
|
+
nw: {
|
|
254
|
+
position: "absolute",
|
|
255
|
+
top: -4,
|
|
256
|
+
left: -4,
|
|
257
|
+
width: b,
|
|
258
|
+
height: b,
|
|
259
|
+
cursor: "nwse-resize"
|
|
260
|
+
},
|
|
261
|
+
se: {
|
|
262
|
+
position: "absolute",
|
|
263
|
+
bottom: -4,
|
|
264
|
+
right: -4,
|
|
265
|
+
width: b,
|
|
266
|
+
height: b,
|
|
267
|
+
cursor: "nwse-resize"
|
|
268
|
+
},
|
|
269
|
+
sw: {
|
|
270
|
+
position: "absolute",
|
|
271
|
+
bottom: -4,
|
|
272
|
+
left: -4,
|
|
273
|
+
width: b,
|
|
274
|
+
height: b,
|
|
275
|
+
cursor: "nesw-resize"
|
|
276
|
+
}
|
|
277
|
+
}, K = Object.fromEntries(
|
|
278
|
+
w.map((e) => [e, { style: ut[e], onPointerDown: _(e) }])
|
|
279
|
+
);
|
|
280
|
+
return {
|
|
281
|
+
width: v.width,
|
|
282
|
+
height: v.height,
|
|
283
|
+
isResizing: C,
|
|
284
|
+
positionDelta: z,
|
|
285
|
+
handleProps: K,
|
|
286
|
+
setSize: y,
|
|
287
|
+
hasPersistedSize: u
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
const st = p.createContext(null);
|
|
291
|
+
function Gt() {
|
|
292
|
+
const t = ct(st);
|
|
293
|
+
return (t == null ? void 0 : t.zIndex) ?? null;
|
|
294
|
+
}
|
|
295
|
+
const Pt = p.createContext(null);
|
|
296
|
+
function Jt() {
|
|
297
|
+
return ct(Pt);
|
|
298
|
+
}
|
|
299
|
+
function qt() {
|
|
300
|
+
const t = ct(st);
|
|
301
|
+
return (t == null ? void 0 : t.registerPortal) ?? null;
|
|
302
|
+
}
|
|
303
|
+
function Kt(t) {
|
|
304
|
+
const o = qt();
|
|
305
|
+
W(() => {
|
|
306
|
+
const i = t.current;
|
|
307
|
+
if (!(!i || !o))
|
|
308
|
+
return o(i);
|
|
309
|
+
}, [o]);
|
|
310
|
+
}
|
|
311
|
+
function Vt({
|
|
312
|
+
isOpen: t,
|
|
313
|
+
onClose: o,
|
|
314
|
+
title: i,
|
|
315
|
+
icon: a,
|
|
316
|
+
backdrop: l = !1,
|
|
317
|
+
backdropCloseOnClick: d = !0,
|
|
318
|
+
backdropClassName: c,
|
|
319
|
+
storageKey: r,
|
|
320
|
+
defaultWidth: w,
|
|
321
|
+
defaultHeight: m,
|
|
322
|
+
minWidth: s = 300,
|
|
323
|
+
maxWidth: v = 1200,
|
|
324
|
+
minHeight: x = 300,
|
|
325
|
+
maxHeight: u = Math.round(typeof window < "u" ? window.innerHeight * 0.95 : 800),
|
|
326
|
+
edges: y = ["e", "s", "se"],
|
|
327
|
+
initialPosition: z,
|
|
328
|
+
dockToEdge: P,
|
|
329
|
+
closeButtonSide: C = "right",
|
|
330
|
+
zIndex: M = 999,
|
|
331
|
+
persistSize: D = !0,
|
|
332
|
+
scrollable: R = !1,
|
|
333
|
+
bodyClassName: L = "text-base-content flex flex-col gap-2 p-3 text-xs",
|
|
334
|
+
ignoreOutsideClicks: F,
|
|
335
|
+
autoSize: _ = !0,
|
|
336
|
+
headerless: ut = !1,
|
|
337
|
+
children: K
|
|
338
|
+
}) {
|
|
339
|
+
const e = w ?? 320, h = m ?? 360, [E, f] = p.useState(() => ({
|
|
340
|
+
width: typeof window < "u" ? window.innerWidth : 1200,
|
|
341
|
+
height: typeof window < "u" ? window.innerHeight : 800
|
|
342
|
+
})), g = 12, k = Math.max(180, Math.min(v, E.width - g * 2)), q = Math.max(180, Math.min(u, E.height - g * 2)), V = (() => {
|
|
343
|
+
if (z) return z;
|
|
344
|
+
const n = typeof window < "u" ? window.innerWidth : 1200;
|
|
345
|
+
return P === "right" ? { x: Math.max(8, n - e - 12), y: 40 } : P === "left" ? { x: 8, y: 40 } : {
|
|
346
|
+
x: Math.round(n / 2 - e / 2),
|
|
347
|
+
y: 40
|
|
348
|
+
};
|
|
349
|
+
})(), Z = At(t), X = A(/* @__PURE__ */ new Set()), I = et((n) => n ? (X.current.add(n), () => {
|
|
350
|
+
X.current.delete(n);
|
|
351
|
+
}) : () => {
|
|
352
|
+
}, []), at = A(null), Mt = St(
|
|
353
|
+
() => ({ registerPortal: I, zIndex: M, panelRef: at }),
|
|
354
|
+
[I, M]
|
|
355
|
+
), G = ct(st), lt = G == null ? void 0 : G.registerPortal, nt = G == null ? void 0 : G.panelRef;
|
|
356
|
+
Lt({ id: `floating-panel:${r}`, isOpen: t, onDismiss: o }), W(() => {
|
|
357
|
+
if (!t || !lt) return;
|
|
358
|
+
const n = at.current;
|
|
359
|
+
if (n)
|
|
360
|
+
return lt(n);
|
|
361
|
+
}, [t, lt]);
|
|
362
|
+
const { position: rt, isDragging: wt, windowRef: $, handlePointerDown: mt, setPosition: it } = Ct({
|
|
363
|
+
initialPosition: V,
|
|
364
|
+
bounds: {
|
|
365
|
+
top: g,
|
|
366
|
+
right: g,
|
|
367
|
+
bottom: g,
|
|
368
|
+
left: g
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
W(() => {
|
|
372
|
+
if (!t) return;
|
|
373
|
+
let n = !1;
|
|
374
|
+
const Q = requestAnimationFrame(() => {
|
|
375
|
+
n = !0;
|
|
376
|
+
}), J = (O) => {
|
|
377
|
+
if (!n) return;
|
|
378
|
+
const N = O.target;
|
|
379
|
+
if (!N) return;
|
|
380
|
+
const xt = $.current;
|
|
381
|
+
if (xt && xt.contains(N)) return;
|
|
382
|
+
for (const tt of X.current)
|
|
383
|
+
if (tt.contains(N)) return;
|
|
384
|
+
const vt = nt == null ? void 0 : nt.current;
|
|
385
|
+
if (!(vt && vt.contains(N))) {
|
|
386
|
+
if (F)
|
|
387
|
+
for (const tt of F) {
|
|
388
|
+
const yt = tt == null ? void 0 : tt.current;
|
|
389
|
+
if (yt && yt.contains(N)) return;
|
|
390
|
+
}
|
|
391
|
+
N.closest("[data-headlessui-portal], [data-rtt-tooltip]") || o();
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
return document.addEventListener("pointerdown", J, !0), () => {
|
|
395
|
+
cancelAnimationFrame(Q), document.removeEventListener("pointerdown", J, !0);
|
|
396
|
+
};
|
|
397
|
+
}, [t, o, $, F, nt]);
|
|
398
|
+
const Y = kt({
|
|
399
|
+
storageKey: r,
|
|
400
|
+
defaultWidth: e,
|
|
401
|
+
defaultHeight: h,
|
|
402
|
+
minWidth: s,
|
|
403
|
+
maxWidth: k,
|
|
404
|
+
minHeight: x,
|
|
405
|
+
maxHeight: q,
|
|
406
|
+
edges: y,
|
|
407
|
+
persist: D
|
|
408
|
+
}), [dt, Et] = U(Y.hasPersistedSize);
|
|
409
|
+
W(() => {
|
|
410
|
+
Y.isResizing && !dt && Et(!0);
|
|
411
|
+
}, [Y.isResizing, dt]);
|
|
412
|
+
const j = _ && !dt;
|
|
413
|
+
W(() => {
|
|
414
|
+
if (!t || !j) return;
|
|
415
|
+
const n = $.current;
|
|
416
|
+
if (!n || typeof ResizeObserver > "u") return;
|
|
417
|
+
const Q = new ResizeObserver((J) => {
|
|
418
|
+
var N;
|
|
419
|
+
const O = (N = J[0]) == null ? void 0 : N.contentRect;
|
|
420
|
+
O && Y.setSize({ width: O.width, height: O.height });
|
|
421
|
+
});
|
|
422
|
+
return Q.observe(n), () => Q.disconnect();
|
|
423
|
+
}, [t, j, Y.setSize, $]);
|
|
424
|
+
const T = j ? void 0 : Y.width, ht = j ? void 0 : Y.height, gt = Y.handleProps;
|
|
425
|
+
if (zt(() => {
|
|
426
|
+
if (!t || !P) return;
|
|
427
|
+
const n = typeof window < "u" ? window.innerWidth : 1200, J = P === "right" ? Math.max(8, n - (T ?? e) - 12) : 8;
|
|
428
|
+
it({ x: J, y: 40 });
|
|
429
|
+
}, [t, P, it, T, e, E.width]), zt(() => {
|
|
430
|
+
!t || P || j || it((n) => ({
|
|
431
|
+
x: Math.max(
|
|
432
|
+
g,
|
|
433
|
+
Math.min(n.x, Math.max(g, E.width - (T ?? 0) - g))
|
|
434
|
+
),
|
|
435
|
+
y: Math.max(
|
|
436
|
+
g,
|
|
437
|
+
Math.min(n.y, Math.max(g, E.height - (ht ?? 0) - g))
|
|
438
|
+
)
|
|
439
|
+
}));
|
|
440
|
+
}, [
|
|
441
|
+
j,
|
|
442
|
+
P,
|
|
443
|
+
ht,
|
|
444
|
+
t,
|
|
445
|
+
it,
|
|
446
|
+
E.height,
|
|
447
|
+
E.width,
|
|
448
|
+
T
|
|
449
|
+
]), W(() => {
|
|
450
|
+
if (!t) return;
|
|
451
|
+
const n = () => {
|
|
452
|
+
f({ width: window.innerWidth, height: window.innerHeight });
|
|
453
|
+
};
|
|
454
|
+
return window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
|
|
455
|
+
}, [t]), !t) return null;
|
|
456
|
+
const bt = /* @__PURE__ */ H(
|
|
457
|
+
"button",
|
|
458
|
+
{
|
|
459
|
+
onClick: o,
|
|
460
|
+
className: "text-accent-content hover:bg-accent-content/10 rounded p-0.5 transition-colors",
|
|
461
|
+
children: /* @__PURE__ */ H(Nt, { className: "size-3.5" })
|
|
462
|
+
}
|
|
463
|
+
), pt = /* @__PURE__ */ B("div", { className: "flex items-center gap-1.5", children: [
|
|
464
|
+
a,
|
|
465
|
+
/* @__PURE__ */ H("span", { className: "text-xs font-semibold", children: i })
|
|
466
|
+
] });
|
|
467
|
+
return Dt.createPortal(
|
|
468
|
+
/* @__PURE__ */ B(st.Provider, { value: Mt, children: [
|
|
469
|
+
l && /* @__PURE__ */ H(
|
|
470
|
+
"div",
|
|
471
|
+
{
|
|
472
|
+
className: Ht("pagehub-sdk-root ph-modal-backdrop", c),
|
|
473
|
+
style: { zIndex: M - 1 },
|
|
474
|
+
onClick: d ? o : void 0,
|
|
475
|
+
"aria-hidden": "true"
|
|
476
|
+
}
|
|
477
|
+
),
|
|
478
|
+
/* @__PURE__ */ B(
|
|
479
|
+
"div",
|
|
480
|
+
{
|
|
481
|
+
ref: (n) => {
|
|
482
|
+
$.current = n, Z.current = n, at.current = n;
|
|
483
|
+
},
|
|
484
|
+
role: "dialog",
|
|
485
|
+
"aria-modal": "true",
|
|
486
|
+
"aria-label": i,
|
|
487
|
+
className: "pagehub-sdk-root ph-modal-surface pointer-events-auto fixed overflow-hidden",
|
|
488
|
+
style: j ? {
|
|
489
|
+
top: rt.y,
|
|
490
|
+
left: rt.x,
|
|
491
|
+
minWidth: s,
|
|
492
|
+
maxWidth: k,
|
|
493
|
+
minHeight: x,
|
|
494
|
+
maxHeight: q,
|
|
495
|
+
zIndex: M
|
|
496
|
+
} : {
|
|
497
|
+
top: rt.y,
|
|
498
|
+
left: rt.x,
|
|
499
|
+
width: T,
|
|
500
|
+
height: ht,
|
|
501
|
+
minWidth: s,
|
|
502
|
+
maxWidth: k,
|
|
503
|
+
minHeight: x,
|
|
504
|
+
maxHeight: q,
|
|
505
|
+
zIndex: M
|
|
506
|
+
},
|
|
507
|
+
children: [
|
|
508
|
+
y.map((n) => gt[n] ? /* @__PURE__ */ H("div", { ...gt[n] }, n) : null),
|
|
509
|
+
/* @__PURE__ */ H(
|
|
510
|
+
Pt.Provider,
|
|
511
|
+
{
|
|
512
|
+
value: { onPointerDown: mt, isDragging: wt, onClose: o },
|
|
513
|
+
children: /* @__PURE__ */ B("div", { className: _ ? "flex max-h-full flex-col" : "flex h-full flex-col", children: [
|
|
514
|
+
!ut && /* @__PURE__ */ H(
|
|
515
|
+
"div",
|
|
516
|
+
{
|
|
517
|
+
role: "presentation",
|
|
518
|
+
"aria-hidden": "true",
|
|
519
|
+
onPointerDown: mt,
|
|
520
|
+
className: `text-base-content flex touch-none items-center justify-between px-3 py-1.5 ${wt ? "cursor-grabbing" : "cursor-grab"}`,
|
|
521
|
+
children: C === "left" ? /* @__PURE__ */ B(Rt, { children: [
|
|
522
|
+
/* @__PURE__ */ B("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
523
|
+
bt,
|
|
524
|
+
pt
|
|
525
|
+
] }),
|
|
526
|
+
/* @__PURE__ */ H("span", { className: "size-5", "aria-hidden": "true" })
|
|
527
|
+
] }) : /* @__PURE__ */ B(Rt, { children: [
|
|
528
|
+
pt,
|
|
529
|
+
bt
|
|
530
|
+
] })
|
|
531
|
+
}
|
|
532
|
+
),
|
|
533
|
+
R ? /* @__PURE__ */ H(Ft, { className: "flex-1", children: L == null ? K : /* @__PURE__ */ H("div", { className: L, children: K }) }) : K
|
|
534
|
+
] })
|
|
535
|
+
}
|
|
536
|
+
)
|
|
537
|
+
]
|
|
538
|
+
}
|
|
539
|
+
)
|
|
540
|
+
] }),
|
|
541
|
+
document.querySelector(".pagehub-sdk-root") || document.body
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
export {
|
|
545
|
+
Vt as F,
|
|
546
|
+
qt as a,
|
|
547
|
+
At as b,
|
|
548
|
+
Zt as c,
|
|
549
|
+
Yt as d,
|
|
550
|
+
Jt as e,
|
|
551
|
+
Kt as f,
|
|
552
|
+
Gt as u
|
|
553
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useEditor as k, useNode as B } from "@craftjs/core";
|
|
3
|
+
import { useRef as G } from "react";
|
|
4
|
+
import { d as R, u as A, V as W, E as j, g as q, dZ as L, C as M, d_ as y, aw as Z, d$ as _, e0 as z, e1 as H, c as J, e2 as O, e as Q } from "./index-C66dAl3Q.js";
|
|
5
|
+
import { F as T } from "./dialogAtoms-CeQ2G05l.js";
|
|
6
|
+
function U(s, c) {
|
|
7
|
+
if (!s) return "";
|
|
8
|
+
const n = _(s);
|
|
9
|
+
if (/^font-\(--/.test(n)) {
|
|
10
|
+
const a = z(n, c);
|
|
11
|
+
if (a && typeof a == "string" && !a.includes("var("))
|
|
12
|
+
return a.split(",")[0].trim().replace(/^['"]|['"]$/g, "");
|
|
13
|
+
}
|
|
14
|
+
return H(n) || s;
|
|
15
|
+
}
|
|
16
|
+
const X = ({
|
|
17
|
+
propKey: s,
|
|
18
|
+
label: c = "",
|
|
19
|
+
prefix: n = "",
|
|
20
|
+
index: u = null,
|
|
21
|
+
propItemKey: a = "",
|
|
22
|
+
propType: o = "class",
|
|
23
|
+
inline: Y = !0,
|
|
24
|
+
inputWidth: K = "",
|
|
25
|
+
labelWidth: P = ""
|
|
26
|
+
}) => {
|
|
27
|
+
const [D, d] = R(T), { actions: p, query: g } = k(), F = A(W), v = A(j).dark ?? !1, {
|
|
28
|
+
actions: { setProp: x },
|
|
29
|
+
nodeProps: S,
|
|
30
|
+
id: E
|
|
31
|
+
} = B((t) => {
|
|
32
|
+
var e;
|
|
33
|
+
return {
|
|
34
|
+
nodeProps: ((e = t.data) == null ? void 0 : e.props) || {},
|
|
35
|
+
id: t.id
|
|
36
|
+
};
|
|
37
|
+
}), I = { propKey: s, propType: o, index: u, propItemKey: a }, { value: N } = q(I, F, S, v), l = N || "", m = l ? U(l, g) : "", C = o === "class" ? Q(F) : void 0, f = (t, e = 0) => {
|
|
38
|
+
J(
|
|
39
|
+
{
|
|
40
|
+
propType: o,
|
|
41
|
+
propKey: s,
|
|
42
|
+
value: t,
|
|
43
|
+
setProp: x,
|
|
44
|
+
index: u,
|
|
45
|
+
propItemKey: a,
|
|
46
|
+
query: g,
|
|
47
|
+
actions: p,
|
|
48
|
+
nodeId: E,
|
|
49
|
+
...o === "class" && C != null ? { view: C, classDark: v } : {}
|
|
50
|
+
},
|
|
51
|
+
e
|
|
52
|
+
);
|
|
53
|
+
}, V = (t, e = 0) => {
|
|
54
|
+
if (typeof t == "string") {
|
|
55
|
+
f(t, e);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const w = Array.isArray(t) ? t[0] : t, $ = w ? O(String(w)) : "";
|
|
59
|
+
f($, e);
|
|
60
|
+
}, b = (t) => V(t, 2e3), h = (t) => V(t, 0), r = G(null);
|
|
61
|
+
return L(D, d, r, s), /* @__PURE__ */ i("div", { ref: r, children: /* @__PURE__ */ i(
|
|
62
|
+
M,
|
|
63
|
+
{
|
|
64
|
+
label: c,
|
|
65
|
+
propType: o,
|
|
66
|
+
propKey: s,
|
|
67
|
+
labelWidth: P,
|
|
68
|
+
onLabelClick: () => {
|
|
69
|
+
d({
|
|
70
|
+
enabled: !0,
|
|
71
|
+
value: [],
|
|
72
|
+
originalValue: l || "",
|
|
73
|
+
prefix: n,
|
|
74
|
+
propKey: s,
|
|
75
|
+
changed: b,
|
|
76
|
+
preview: h,
|
|
77
|
+
e: y(r.current)
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
trailing: l ? /* @__PURE__ */ i(Z, { onClick: () => f("", 2e3), tooltip: "Clear font family" }) : null,
|
|
81
|
+
children: /* @__PURE__ */ i(
|
|
82
|
+
"button",
|
|
83
|
+
{
|
|
84
|
+
type: "button",
|
|
85
|
+
title: m,
|
|
86
|
+
id: s ? `input-${s}` : void 0,
|
|
87
|
+
onClick: () => {
|
|
88
|
+
d({
|
|
89
|
+
enabled: !0,
|
|
90
|
+
value: [],
|
|
91
|
+
originalValue: l || "",
|
|
92
|
+
prefix: n,
|
|
93
|
+
propKey: s,
|
|
94
|
+
changed: b,
|
|
95
|
+
preview: h,
|
|
96
|
+
e: y(r.current)
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
style: {
|
|
100
|
+
fontFamily: m || void 0
|
|
101
|
+
},
|
|
102
|
+
className: "input-plain flex min-w-0 flex-1 items-center truncate text-left",
|
|
103
|
+
children: m || "Default"
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
) });
|
|
108
|
+
}, ot = () => /* @__PURE__ */ i(X, { propKey: "fontFamily", label: "Font Family" });
|
|
109
|
+
export {
|
|
110
|
+
ot as FontFamilyInput
|
|
111
|
+
};
|