@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,528 @@
|
|
|
1
|
+
import { jsx as e, jsxs as h, Fragment as ae } from "react/jsx-runtime";
|
|
2
|
+
import { useEditor as G, useNode as M, Element as J } from "@craftjs/core";
|
|
3
|
+
import { useState as B, Suspense as le, lazy as ie, useRef as ne, useEffect as H } from "react";
|
|
4
|
+
import { w as de, z as Q, A as te, B as ce, D as me, C as ue, F as fe, G as pe, u as W, V as ge, E as he, M as ye, g as O, H as U, I as be, U as we, J as q, c as xe } from "./index-C66dAl3Q.js";
|
|
5
|
+
import { u as ve } from "./usePopoverPosition-83Vti7Aw.js";
|
|
6
|
+
import { A as X, c as Ne } from "./toolboxUtils-DjTMslSn.js";
|
|
7
|
+
const Ce = ie(() => import("./LayoutPresetPanel-CNAVAcvw.js")), Te = 320, De = /* @__PURE__ */ new Set(["Container", "Data", "Header", "Footer", "Form"]);
|
|
8
|
+
function Pe() {
|
|
9
|
+
const { match: o } = M((s) => {
|
|
10
|
+
var a, n;
|
|
11
|
+
return {
|
|
12
|
+
match: De.has(((a = s.data) == null ? void 0 : a.name) || ((n = s.data) == null ? void 0 : n.displayName) || "")
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
return o;
|
|
16
|
+
}
|
|
17
|
+
function Se(o) {
|
|
18
|
+
return o === "flex-row" ? /* @__PURE__ */ e(te, { className: "size-3.5 shrink-0", "aria-hidden": !0 }) : o === "flex-col" ? /* @__PURE__ */ e(ce, { className: "size-3.5 shrink-0", "aria-hidden": !0 }) : o === "grid" ? /* @__PURE__ */ e(Q, { className: "size-3.5 shrink-0", "aria-hidden": !0 }) : /* @__PURE__ */ e(me, { className: "size-3.5 shrink-0", "aria-hidden": !0 });
|
|
19
|
+
}
|
|
20
|
+
function Le(o) {
|
|
21
|
+
return o.split("-").filter(Boolean).map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" ");
|
|
22
|
+
}
|
|
23
|
+
function Ae(o) {
|
|
24
|
+
const s = String(o.currentPresetLayout || "").trim();
|
|
25
|
+
return s ? Le(s) : o.layoutMode === "block" ? "Block" : o.layoutMode === "flex-row" ? "Side by side" : o.layoutMode === "flex-col" ? "Stacked" : o.layoutMode === "grid" ? "Grid" : "Pick layout";
|
|
26
|
+
}
|
|
27
|
+
function He({ lp: o, sectionWrapper: s = !0 }) {
|
|
28
|
+
const a = Pe(), { actions: n, query: c } = G(), [u, p] = B(!1), { triggerRef: P, initialPos: w, setInitialPos: x, computePosition: v } = ve(Te), m = async (y) => {
|
|
29
|
+
y == null || y.stopPropagation();
|
|
30
|
+
const { Container: R } = await import("./index-C66dAl3Q.js").then((g) => g.fA);
|
|
31
|
+
X({
|
|
32
|
+
element: /* @__PURE__ */ e(
|
|
33
|
+
J,
|
|
34
|
+
{
|
|
35
|
+
canvas: !0,
|
|
36
|
+
is: R,
|
|
37
|
+
canDelete: !0,
|
|
38
|
+
className: "gap-section flex w-full flex-col",
|
|
39
|
+
custom: { displayName: "Container" }
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
actions: n,
|
|
43
|
+
query: c
|
|
44
|
+
});
|
|
45
|
+
}, C = () => {
|
|
46
|
+
x(v()), p(!0);
|
|
47
|
+
}, D = Ae(o), _ = Se(o.layoutMode), E = /* @__PURE__ */ h(ae, { children: [
|
|
48
|
+
/* @__PURE__ */ e(
|
|
49
|
+
ue,
|
|
50
|
+
{
|
|
51
|
+
mode: "popover",
|
|
52
|
+
ref: P,
|
|
53
|
+
label: "Layout",
|
|
54
|
+
open: u,
|
|
55
|
+
onTriggerClick: () => u ? p(!1) : C(),
|
|
56
|
+
onClear: () => {
|
|
57
|
+
u && p(!1), o.switchToMode("block");
|
|
58
|
+
},
|
|
59
|
+
triggerAriaLabel: "Pick layout",
|
|
60
|
+
clearAriaLabel: "Clear layout (Block)",
|
|
61
|
+
leading: _,
|
|
62
|
+
summary: D,
|
|
63
|
+
trailingExtras: a ? /* @__PURE__ */ e(
|
|
64
|
+
fe,
|
|
65
|
+
{
|
|
66
|
+
ariaLabel: "Add container",
|
|
67
|
+
tooltip: "Add container",
|
|
68
|
+
onClick: m,
|
|
69
|
+
children: /* @__PURE__ */ e(pe, { className: "size-3.5", "aria-hidden": !0 })
|
|
70
|
+
}
|
|
71
|
+
) : null
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
u && /* @__PURE__ */ e(le, { fallback: null, children: /* @__PURE__ */ e(
|
|
75
|
+
Ce,
|
|
76
|
+
{
|
|
77
|
+
initialPosition: w,
|
|
78
|
+
onClose: () => p(!1),
|
|
79
|
+
lp: o
|
|
80
|
+
}
|
|
81
|
+
) })
|
|
82
|
+
] });
|
|
83
|
+
return s ? /* @__PURE__ */ e(
|
|
84
|
+
de,
|
|
85
|
+
{
|
|
86
|
+
title: "Layout",
|
|
87
|
+
icon: /* @__PURE__ */ e(Q, {}),
|
|
88
|
+
propKey: "display",
|
|
89
|
+
defaultOpen: !0,
|
|
90
|
+
children: E
|
|
91
|
+
}
|
|
92
|
+
) : E;
|
|
93
|
+
}
|
|
94
|
+
const ke = /^(?:w-full|w-screen|w-auto|w-\d+(?:\.\d+)?(?:\/\d+)?|w-px|w-\[[^\]]+\]|flex-1|flex-auto|flex-none|flex-initial|flex-\[[^\]]+\]|min-w-0|min-w-full|basis-\d+(?:\/\d+)?|basis-\[[^\]]+\])$/, K = (o) => o.split(/\s+/).filter((s) => s && !ke.test(s)).join(" "), Ee = (o, s) => s ? "" : o === "flex-row" ? "flex-1 min-w-0" : o === "flex-col" ? "w-full" : "", Re = () => {
|
|
95
|
+
const { actions: o, query: s } = G(), { id: a } = M();
|
|
96
|
+
return { adjustContainerCount: async (c, u, p = {}) => {
|
|
97
|
+
var D, _, E, y, R;
|
|
98
|
+
const { Container: P } = await import("./index-C66dAl3Q.js").then((g) => g.fA), w = s.node(a).get(), x = ((D = w == null ? void 0 : w.data) == null ? void 0 : D.nodes) || [], v = x.length, m = Ee(u, !!p.asymmetric), C = Ne(o);
|
|
99
|
+
if (x.forEach((g) => {
|
|
100
|
+
var T, L;
|
|
101
|
+
const d = s.node(g).get();
|
|
102
|
+
if (!d) return;
|
|
103
|
+
const S = String(((L = (T = d.data) == null ? void 0 : T.props) == null ? void 0 : L.className) || ""), b = K(S), N = (m ? `${b} ${m}` : b).trim().replace(/\s+/g, " ");
|
|
104
|
+
N !== S && C.setProp(g, (I) => {
|
|
105
|
+
I.className = N;
|
|
106
|
+
});
|
|
107
|
+
}), v < c) {
|
|
108
|
+
const g = x[x.length - 1], d = g ? s.node(g).get() : null, b = ((E = (_ = d == null ? void 0 : d.data) == null ? void 0 : _.props) != null && E.className ? K(String(d.data.props.className)) : "flex flex-col gap-4") || "flex flex-col gap-4", N = ((R = (y = d == null ? void 0 : d.data) == null ? void 0 : y.custom) == null ? void 0 : R.displayName) || "Container", T = (m ? `${b} ${m}` : b).trim().replace(/\s+/g, " "), L = c - v;
|
|
109
|
+
for (let I = 0; I < L; I++)
|
|
110
|
+
X({
|
|
111
|
+
element: /* @__PURE__ */ e(
|
|
112
|
+
J,
|
|
113
|
+
{
|
|
114
|
+
canvas: !0,
|
|
115
|
+
is: P,
|
|
116
|
+
canDelete: !0,
|
|
117
|
+
className: T,
|
|
118
|
+
custom: { displayName: N, layoutChild: !0 }
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
actions: o,
|
|
122
|
+
query: s,
|
|
123
|
+
addTo: a
|
|
124
|
+
});
|
|
125
|
+
} else if (v > c) {
|
|
126
|
+
const g = x.filter((b) => {
|
|
127
|
+
var T, L;
|
|
128
|
+
const N = s.node(b).get();
|
|
129
|
+
return ((L = (T = N == null ? void 0 : N.data) == null ? void 0 : T.custom) == null ? void 0 : L.layoutChild) === !0;
|
|
130
|
+
}), d = v - c;
|
|
131
|
+
g.slice(-d).forEach((b) => {
|
|
132
|
+
C.delete(b);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
} };
|
|
136
|
+
};
|
|
137
|
+
function Ie({ config: o }) {
|
|
138
|
+
const { type: s, columns: a, rows: n = 1, widths: c, spans: u, heights: p, className: P = "", size: w = "md" } = o, x = {
|
|
139
|
+
sm: "h-4 w-full",
|
|
140
|
+
md: "h-6 w-full",
|
|
141
|
+
lg: "h-8 w-full"
|
|
142
|
+
};
|
|
143
|
+
return s === "flex" ? /* @__PURE__ */ e(
|
|
144
|
+
"div",
|
|
145
|
+
{
|
|
146
|
+
className: `${x[w]} border-base-300 overflow-hidden rounded-sm border p-px ${P}`,
|
|
147
|
+
children: /* @__PURE__ */ e("div", { className: "flex h-full gap-px", children: Array.from({ length: a }, (v, m) => {
|
|
148
|
+
const C = (c == null ? void 0 : c[m]) || "flex-1", D = c ? C.includes("1/2") ? "30" : "20" : "30";
|
|
149
|
+
return /* @__PURE__ */ e("div", { className: `${C} rounded-sm bg-primary/${D}` }, m);
|
|
150
|
+
}) })
|
|
151
|
+
}
|
|
152
|
+
) : s === "grid" ? /* @__PURE__ */ e(
|
|
153
|
+
"div",
|
|
154
|
+
{
|
|
155
|
+
className: `${x[w]} border-base-300 overflow-hidden rounded-sm border p-px ${P}`,
|
|
156
|
+
children: /* @__PURE__ */ e("div", { className: `grid h-full grid-cols-${a} grid-rows-${n} gap-px`, children: Array.from({ length: a * n }, (v, m) => {
|
|
157
|
+
const C = (u == null ? void 0 : u[m]) || "", D = (p == null ? void 0 : p[m]) || "";
|
|
158
|
+
return /* @__PURE__ */ e("div", { className: `${C} ${D} bg-primary/30 rounded-sm` }, m);
|
|
159
|
+
}) })
|
|
160
|
+
}
|
|
161
|
+
) : null;
|
|
162
|
+
}
|
|
163
|
+
const Z = (o) => /* @__PURE__ */ e(Ie, { config: o });
|
|
164
|
+
function Y(o) {
|
|
165
|
+
const s = o === "column", a = s ? "flex h-full gap-px" : "flex flex-col h-full gap-px", n = "flex-1 rounded-sm bg-primary/30", c = [
|
|
166
|
+
{
|
|
167
|
+
name: s ? "Single Column" : "Single Row",
|
|
168
|
+
icon: /* @__PURE__ */ e("div", { className: "border-base-300 h-6 w-full overflow-hidden rounded-sm border p-px", children: /* @__PURE__ */ e("div", { className: "bg-primary/30 h-full rounded-sm" }) }),
|
|
169
|
+
layout: "flex",
|
|
170
|
+
direction: o,
|
|
171
|
+
flexDirection: s ? "flex-row" : "flex-col",
|
|
172
|
+
columns: 1,
|
|
173
|
+
gap: "gap-4"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: s ? "Two Columns" : "Two Rows",
|
|
177
|
+
icon: /* @__PURE__ */ e("div", { className: "border-base-300 h-6 w-full overflow-hidden rounded-sm border p-px", children: /* @__PURE__ */ h("div", { className: a, children: [
|
|
178
|
+
/* @__PURE__ */ e("div", { className: n }),
|
|
179
|
+
/* @__PURE__ */ e("div", { className: n })
|
|
180
|
+
] }) }),
|
|
181
|
+
layout: "flex",
|
|
182
|
+
direction: o,
|
|
183
|
+
flexDirection: s ? "flex-row" : "flex-col",
|
|
184
|
+
columns: 2,
|
|
185
|
+
gap: "gap-4"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: s ? "Three Columns" : "Three Rows",
|
|
189
|
+
icon: /* @__PURE__ */ e("div", { className: "border-base-300 h-6 w-full overflow-hidden rounded-sm border p-px", children: /* @__PURE__ */ h("div", { className: a, children: [
|
|
190
|
+
/* @__PURE__ */ e("div", { className: n }),
|
|
191
|
+
/* @__PURE__ */ e("div", { className: n }),
|
|
192
|
+
/* @__PURE__ */ e("div", { className: n })
|
|
193
|
+
] }) }),
|
|
194
|
+
layout: "flex",
|
|
195
|
+
direction: o,
|
|
196
|
+
flexDirection: s ? "flex-row" : "flex-col",
|
|
197
|
+
columns: 3,
|
|
198
|
+
gap: "gap-4"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: s ? "Four Columns" : "Four Rows",
|
|
202
|
+
icon: /* @__PURE__ */ e("div", { className: "border-base-300 h-6 w-full overflow-hidden rounded-sm border p-px", children: /* @__PURE__ */ h("div", { className: a, children: [
|
|
203
|
+
/* @__PURE__ */ e("div", { className: n }),
|
|
204
|
+
/* @__PURE__ */ e("div", { className: n }),
|
|
205
|
+
/* @__PURE__ */ e("div", { className: n }),
|
|
206
|
+
/* @__PURE__ */ e("div", { className: n })
|
|
207
|
+
] }) }),
|
|
208
|
+
layout: "flex",
|
|
209
|
+
direction: o,
|
|
210
|
+
flexDirection: s ? "flex-row" : "flex-col",
|
|
211
|
+
columns: 4,
|
|
212
|
+
gap: "gap-4"
|
|
213
|
+
}
|
|
214
|
+
];
|
|
215
|
+
return s ? [
|
|
216
|
+
...c,
|
|
217
|
+
{
|
|
218
|
+
name: "Wide Left",
|
|
219
|
+
icon: /* @__PURE__ */ e("div", { className: "border-base-300 h-6 w-full overflow-hidden rounded-sm border p-px", children: /* @__PURE__ */ h("div", { className: "flex h-full gap-px", children: [
|
|
220
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 w-3/4 rounded-sm" }),
|
|
221
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/20 w-1/4 rounded-sm" })
|
|
222
|
+
] }) }),
|
|
223
|
+
layout: "flex",
|
|
224
|
+
direction: o,
|
|
225
|
+
flexDirection: "flex-row",
|
|
226
|
+
columns: 2,
|
|
227
|
+
gap: "gap-4",
|
|
228
|
+
asymmetric: !0,
|
|
229
|
+
widths: ["w-3/4", "w-1/4"]
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
name: "Wide Right",
|
|
233
|
+
icon: /* @__PURE__ */ e("div", { className: "border-base-300 h-6 w-full overflow-hidden rounded-sm border p-px", children: /* @__PURE__ */ h("div", { className: "flex h-full gap-px", children: [
|
|
234
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/20 w-1/4 rounded-sm" }),
|
|
235
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 w-3/4 rounded-sm" })
|
|
236
|
+
] }) }),
|
|
237
|
+
layout: "flex",
|
|
238
|
+
direction: o,
|
|
239
|
+
flexDirection: "flex-row",
|
|
240
|
+
columns: 2,
|
|
241
|
+
gap: "gap-4",
|
|
242
|
+
asymmetric: !0,
|
|
243
|
+
widths: ["w-1/4", "w-3/4"]
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: "Wide Middle",
|
|
247
|
+
icon: Z({ type: "flex", columns: 3, widths: ["w-1/4", "w-1/2", "w-1/4"] }),
|
|
248
|
+
layout: "flex",
|
|
249
|
+
direction: o,
|
|
250
|
+
flexDirection: "flex-row",
|
|
251
|
+
columns: 3,
|
|
252
|
+
gap: "gap-4",
|
|
253
|
+
asymmetric: !0,
|
|
254
|
+
widths: ["w-1/4", "w-1/2", "w-1/4"]
|
|
255
|
+
}
|
|
256
|
+
] : c;
|
|
257
|
+
}
|
|
258
|
+
const _e = [
|
|
259
|
+
{
|
|
260
|
+
name: "Single Column",
|
|
261
|
+
icon: /* @__PURE__ */ e("div", { className: "border-base-300 grid h-6 w-full overflow-hidden rounded-sm border p-px", children: /* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" }) }),
|
|
262
|
+
layout: "grid",
|
|
263
|
+
columns: 1,
|
|
264
|
+
gridTemplate: "grid-cols-1",
|
|
265
|
+
gap: "gap-4"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: "Two Columns",
|
|
269
|
+
icon: /* @__PURE__ */ h("div", { className: "border-base-300 grid h-6 w-full grid-cols-2 gap-px overflow-hidden rounded-sm border p-px", children: [
|
|
270
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" }),
|
|
271
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" })
|
|
272
|
+
] }),
|
|
273
|
+
layout: "grid",
|
|
274
|
+
columns: 2,
|
|
275
|
+
gridTemplate: "grid-cols-2",
|
|
276
|
+
gap: "gap-4"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
name: "2x2 Grid",
|
|
280
|
+
icon: /* @__PURE__ */ h("div", { className: "border-base-300 grid h-6 w-full grid-cols-2 grid-rows-2 gap-px overflow-hidden rounded-sm border p-px", children: [
|
|
281
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" }),
|
|
282
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" }),
|
|
283
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" }),
|
|
284
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" })
|
|
285
|
+
] }),
|
|
286
|
+
layout: "grid",
|
|
287
|
+
columns: 4,
|
|
288
|
+
gridTemplate: "grid-cols-2",
|
|
289
|
+
gridRows: "grid-rows-2",
|
|
290
|
+
gap: "gap-4"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
name: "Three Columns",
|
|
294
|
+
icon: /* @__PURE__ */ h("div", { className: "border-base-300 grid h-6 w-full grid-cols-3 gap-px overflow-hidden rounded-sm border p-px", children: [
|
|
295
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" }),
|
|
296
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" }),
|
|
297
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" })
|
|
298
|
+
] }),
|
|
299
|
+
layout: "grid",
|
|
300
|
+
columns: 3,
|
|
301
|
+
gridTemplate: "grid-cols-3",
|
|
302
|
+
gap: "gap-4"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
name: "3x2 Grid",
|
|
306
|
+
icon: /* @__PURE__ */ h("div", { className: "border-base-300 grid h-6 w-full grid-cols-3 grid-rows-2 gap-px overflow-hidden rounded-sm border p-px", children: [
|
|
307
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" }),
|
|
308
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" }),
|
|
309
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" }),
|
|
310
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" }),
|
|
311
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" }),
|
|
312
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" })
|
|
313
|
+
] }),
|
|
314
|
+
layout: "grid",
|
|
315
|
+
columns: 6,
|
|
316
|
+
gridTemplate: "grid-cols-3",
|
|
317
|
+
gridRows: "grid-rows-2",
|
|
318
|
+
gap: "gap-4"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
name: "Four Columns",
|
|
322
|
+
icon: /* @__PURE__ */ h("div", { className: "border-base-300 grid h-6 w-full grid-cols-4 gap-px overflow-hidden rounded-sm border p-px", children: [
|
|
323
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" }),
|
|
324
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" }),
|
|
325
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" }),
|
|
326
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" })
|
|
327
|
+
] }),
|
|
328
|
+
layout: "grid",
|
|
329
|
+
columns: 4,
|
|
330
|
+
gridTemplate: "grid-cols-4",
|
|
331
|
+
gap: "gap-4"
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
name: "Header + 2 Columns",
|
|
335
|
+
icon: Z({
|
|
336
|
+
type: "grid",
|
|
337
|
+
columns: 2,
|
|
338
|
+
rows: 4,
|
|
339
|
+
spans: ["col-span-2 row-span-2", "row-span-2", "row-span-2"]
|
|
340
|
+
}),
|
|
341
|
+
layout: "grid",
|
|
342
|
+
columns: 3,
|
|
343
|
+
gridTemplate: "grid-cols-2",
|
|
344
|
+
gridRows: "grid-rows-2",
|
|
345
|
+
gap: "gap-4"
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
name: "Wide Left",
|
|
349
|
+
icon: /* @__PURE__ */ e("div", { className: "border-base-300 h-6 w-full overflow-hidden rounded-sm border p-px", children: /* @__PURE__ */ h("div", { className: "border-base-300 grid h-full grid-cols-[3fr_1fr] gap-px overflow-hidden rounded-sm border p-px", children: [
|
|
350
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" }),
|
|
351
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/20 rounded-sm" })
|
|
352
|
+
] }) }),
|
|
353
|
+
layout: "grid",
|
|
354
|
+
columns: 2,
|
|
355
|
+
gridTemplate: "grid-cols-[2fr_1fr]",
|
|
356
|
+
gap: "gap-4"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
name: "Wide Right",
|
|
360
|
+
icon: /* @__PURE__ */ e("div", { className: "border-base-300 h-6 w-full overflow-hidden rounded-sm border p-px", children: /* @__PURE__ */ h("div", { className: "border-base-300 grid h-full grid-cols-[1fr_3fr] gap-px overflow-hidden rounded-sm border p-px", children: [
|
|
361
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/20 rounded-sm" }),
|
|
362
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" })
|
|
363
|
+
] }) }),
|
|
364
|
+
layout: "grid",
|
|
365
|
+
columns: 2,
|
|
366
|
+
gridTemplate: "grid-cols-[1fr_2fr]",
|
|
367
|
+
gap: "gap-4"
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
name: "Wide Middle",
|
|
371
|
+
icon: /* @__PURE__ */ e("div", { className: "border-base-300 h-6 w-full overflow-hidden rounded-sm border p-px", children: /* @__PURE__ */ h("div", { className: "border-base-300 grid h-full grid-cols-[1fr_2fr_1fr] gap-px overflow-hidden rounded-sm border p-px", children: [
|
|
372
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/20 rounded-sm" }),
|
|
373
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/30 rounded-sm" }),
|
|
374
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/20 rounded-sm" })
|
|
375
|
+
] }) }),
|
|
376
|
+
layout: "grid",
|
|
377
|
+
columns: 3,
|
|
378
|
+
gridTemplate: "grid-cols-[1fr_2fr_1fr]",
|
|
379
|
+
gap: "gap-4"
|
|
380
|
+
}
|
|
381
|
+
], Oe = [
|
|
382
|
+
{ value: "block", label: "Block" },
|
|
383
|
+
{ value: "inline-block", label: "Inline Block" },
|
|
384
|
+
{ value: "inline-flex", label: "Inline Flex" },
|
|
385
|
+
{ value: "inline-grid", label: "Inline Grid" },
|
|
386
|
+
{ value: "inline", label: "Inline" },
|
|
387
|
+
{ value: "hidden", label: "None" }
|
|
388
|
+
];
|
|
389
|
+
function Ue({ propKey: o, onLayoutChange: s, lockMode: a }) {
|
|
390
|
+
const { actions: n, query: c } = G(), u = W(ge), p = W(he), P = W(ye), w = p.dark ?? !1, {
|
|
391
|
+
actions: { setProp: x },
|
|
392
|
+
id: v,
|
|
393
|
+
currentLayoutMode: m,
|
|
394
|
+
currentLayoutColumns: C,
|
|
395
|
+
currentPresetLayout: D,
|
|
396
|
+
classNameStr: _
|
|
397
|
+
} = M((r) => {
|
|
398
|
+
var l, t, A, k, f, $, F;
|
|
399
|
+
return {
|
|
400
|
+
id: r.id,
|
|
401
|
+
currentLayoutMode: (t = (l = r.data) == null ? void 0 : l.props.root) == null ? void 0 : t.layoutMode,
|
|
402
|
+
currentLayoutColumns: (k = (A = r.data) == null ? void 0 : A.props.root) == null ? void 0 : k.layoutColumns,
|
|
403
|
+
currentPresetLayout: ($ = (f = r.data) == null ? void 0 : f.props.root) == null ? void 0 : $[o],
|
|
404
|
+
classNameStr: ((F = r.data) == null ? void 0 : F.props.className) || ""
|
|
405
|
+
};
|
|
406
|
+
}), E = { className: _ }, y = String(
|
|
407
|
+
O({ propKey: "display", propType: "class" }, u, E, w).value ?? ""
|
|
408
|
+
), R = String(
|
|
409
|
+
O(
|
|
410
|
+
{ propKey: "flexDirection", propType: "class" },
|
|
411
|
+
u,
|
|
412
|
+
E,
|
|
413
|
+
w
|
|
414
|
+
).value ?? ""
|
|
415
|
+
), g = () => a || (y.includes("grid") ? "grid" : y.includes("flex") ? R.includes("flex-col") ? "flex-col" : "flex-row" : y.includes("block") || y.includes("inline-block") ? "block" : m || "flex-col"), [d, S] = B(
|
|
416
|
+
() => a ?? g()
|
|
417
|
+
), [b, N] = B(!1), T = ne(null), { adjustContainerCount: L } = Re(), I = U(be), ee = U(we);
|
|
418
|
+
H(() => {
|
|
419
|
+
if (a) {
|
|
420
|
+
d !== a && S(a);
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
const r = g();
|
|
424
|
+
r !== d && S(r);
|
|
425
|
+
}, [m, y, R, a, d]), H(() => {
|
|
426
|
+
if (!b) return;
|
|
427
|
+
const r = (l) => {
|
|
428
|
+
T.current && !T.current.contains(l.target) && N(!1);
|
|
429
|
+
};
|
|
430
|
+
return document.addEventListener("mousedown", r), () => document.removeEventListener("mousedown", r);
|
|
431
|
+
}, [b]);
|
|
432
|
+
const i = (r, l, t, A = "class", k) => {
|
|
433
|
+
xe({
|
|
434
|
+
propKey: r,
|
|
435
|
+
value: l,
|
|
436
|
+
setProp: k ? (f) => n.setProp(k, f) : x,
|
|
437
|
+
propType: A,
|
|
438
|
+
view: t,
|
|
439
|
+
query: c,
|
|
440
|
+
actions: n,
|
|
441
|
+
nodeId: k || v,
|
|
442
|
+
classDark: w
|
|
443
|
+
});
|
|
444
|
+
}, z = (r) => {
|
|
445
|
+
const l = [
|
|
446
|
+
"flexDirection",
|
|
447
|
+
"flexWrap",
|
|
448
|
+
"justifyContent",
|
|
449
|
+
"alignItems",
|
|
450
|
+
"gridTemplateColumns",
|
|
451
|
+
"gridTemplateRows",
|
|
452
|
+
"gridGap"
|
|
453
|
+
];
|
|
454
|
+
r.forEach((t) => l.forEach((A) => i(A, "", t)));
|
|
455
|
+
}, V = (r, l) => {
|
|
456
|
+
l.forEach((t) => {
|
|
457
|
+
i("display", "flex", t), i("flexDirection", r === "row" ? "flex-row" : "flex-col", t);
|
|
458
|
+
});
|
|
459
|
+
}, re = (r, l = "grid-cols-2") => {
|
|
460
|
+
r.forEach((t) => {
|
|
461
|
+
i("display", "grid", t), i("gridCols", l, t);
|
|
462
|
+
});
|
|
463
|
+
}, oe = (r) => {
|
|
464
|
+
r.forEach((l) => i("display", "block", l));
|
|
465
|
+
}, se = a === "grid" || d === "grid" ? _e : Y(d === "flex-row" ? "column" : "row");
|
|
466
|
+
return {
|
|
467
|
+
// State
|
|
468
|
+
layoutMode: d,
|
|
469
|
+
showDisplayDropdown: b,
|
|
470
|
+
setShowDisplayDropdown: N,
|
|
471
|
+
dropdownRef: T,
|
|
472
|
+
currentDisplay: y,
|
|
473
|
+
// Presets
|
|
474
|
+
currentPresets: se,
|
|
475
|
+
currentLayoutMode: m,
|
|
476
|
+
currentLayoutColumns: C,
|
|
477
|
+
currentPresetLayout: D,
|
|
478
|
+
// Handlers
|
|
479
|
+
handlePresetSelect: (r) => {
|
|
480
|
+
var l, t, A, k;
|
|
481
|
+
if (r.layout === "flex" ? (i("display", "flex", "mobile"), r.flexDirection && i("flexDirection", r.flexDirection, "mobile"), r.flexWrap && i("flexWrap", r.flexWrap, "mobile")) : r.layout === "grid" && (["mobile", "desktop"].forEach((f) => {
|
|
482
|
+
i("flexDirection", "", f), i("flexWrap", "", f), i("justifyContent", "", f), i("alignItems", "", f);
|
|
483
|
+
}), i("display", "grid", "desktop"), r.gridTemplate && i("gridCols", r.gridTemplate, "desktop"), r.gridRows && i("gridRows", r.gridRows, "desktop"), i("display", "grid", "mobile"), i("gridCols", "grid-cols-1", "mobile")), r.gap && i("gap", r.gap, "mobile"), i(o, r.name.toLowerCase().replace(/\s+/g, "-"), "mobile", "root"), i("layoutMode", a ?? d, "mobile", "root"), r.columns && i("layoutColumns", String(r.columns), "mobile", "root"), r.columns) {
|
|
484
|
+
const f = r.layout === "flex" ? r.flexDirection === "flex-row" ? "flex-row" : "flex-col" : "grid";
|
|
485
|
+
I(!0);
|
|
486
|
+
try {
|
|
487
|
+
L(r.columns, f, {
|
|
488
|
+
asymmetric: !!r.asymmetric
|
|
489
|
+
});
|
|
490
|
+
} finally {
|
|
491
|
+
setTimeout(() => {
|
|
492
|
+
I(!1);
|
|
493
|
+
try {
|
|
494
|
+
ee(c.serialize());
|
|
495
|
+
} catch {
|
|
496
|
+
}
|
|
497
|
+
}, 150);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
if (r.layout === "grid" && r.name === "Header + 2 Columns") {
|
|
501
|
+
const f = ((t = (l = c.node(v).get()) == null ? void 0 : l.data) == null ? void 0 : t.nodes) || [];
|
|
502
|
+
f.length > 0 && i("gridColSpan", "col-span-2", "desktop", "class", f[0]);
|
|
503
|
+
}
|
|
504
|
+
r.layout === "flex" && r.asymmetric && r.widths && (((k = (A = c.node(v).get()) == null ? void 0 : A.data) == null ? void 0 : k.nodes) || []).forEach(($, F) => {
|
|
505
|
+
var j;
|
|
506
|
+
(j = r.widths) != null && j[F] && i("width", r.widths[F], "desktop", "class", $);
|
|
507
|
+
}), s == null || s(r);
|
|
508
|
+
},
|
|
509
|
+
handleDisplayVariant: (r) => {
|
|
510
|
+
const l = q(p, u, P);
|
|
511
|
+
l.forEach((t) => i("display", r, t)), (r === "block" || r === "inline" || r === "hidden") && (z(l), r === "block" && S("block")), N(!1);
|
|
512
|
+
},
|
|
513
|
+
switchToMode: (r) => {
|
|
514
|
+
if (a && r !== a) return;
|
|
515
|
+
const l = q(p, u, P);
|
|
516
|
+
S(r), z(l), r === "flex-row" ? V("row", l) : r === "flex-col" ? V("column", l) : r === "grid" ? l.forEach((t) => {
|
|
517
|
+
re([t], t === "desktop" ? "grid-cols-2" : "grid-cols-1");
|
|
518
|
+
}) : r === "block" && oe(l);
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
export {
|
|
523
|
+
Oe as D,
|
|
524
|
+
_e as G,
|
|
525
|
+
He as L,
|
|
526
|
+
Y as g,
|
|
527
|
+
Ue as u
|
|
528
|
+
};
|