@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,120 @@
|
|
|
1
|
+
import { jsxs as o, jsx as e, Fragment as n } from "react/jsx-runtime";
|
|
2
|
+
import { F as m } from "./FloatingPanel-DJP5Vhua.js";
|
|
3
|
+
import { useNode as u } from "@craftjs/core";
|
|
4
|
+
import { n as l, W as g } from "./index-C66dAl3Q.js";
|
|
5
|
+
function y() {
|
|
6
|
+
const { craftName: t, scrollEffect: r, dragScroll: i, autoHide: s } = u((a) => {
|
|
7
|
+
var d, h, f;
|
|
8
|
+
const c = ((d = a.data) == null ? void 0 : d.props) || {}, p = c.overflow || {};
|
|
9
|
+
return {
|
|
10
|
+
craftName: ((h = a.data) == null ? void 0 : h.name) || ((f = a.data) == null ? void 0 : f.displayName),
|
|
11
|
+
scrollEffect: c.scrollEffect,
|
|
12
|
+
dragScroll: p.dragScroll,
|
|
13
|
+
autoHide: p.autoHide
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
return t !== "Container" ? null : r === "horizontal-scroll" ? /* @__PURE__ */ o("p", { className: "text-neutral-content text-xs leading-relaxed", children: [
|
|
17
|
+
"CSS overflow options are disabled while",
|
|
18
|
+
" ",
|
|
19
|
+
/* @__PURE__ */ e("span", { className: "text-base-content font-medium", children: "Scroll Effect → Horizontal Scroll" }),
|
|
20
|
+
" ",
|
|
21
|
+
"(GSAP) is on. Use one or the other."
|
|
22
|
+
] }) : /* @__PURE__ */ o(n, { children: [
|
|
23
|
+
/* @__PURE__ */ e(
|
|
24
|
+
l,
|
|
25
|
+
{
|
|
26
|
+
propKey: "overflow.dragScroll",
|
|
27
|
+
propType: "component",
|
|
28
|
+
type: "toggle",
|
|
29
|
+
label: "Drag to scroll (published)",
|
|
30
|
+
labelWidth: "w-56",
|
|
31
|
+
on: !0
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
/* @__PURE__ */ e(
|
|
35
|
+
l,
|
|
36
|
+
{
|
|
37
|
+
propKey: "overflow.autoHide",
|
|
38
|
+
propType: "component",
|
|
39
|
+
type: "toggle",
|
|
40
|
+
label: "Auto-hide scrollbar",
|
|
41
|
+
labelWidth: "w-56",
|
|
42
|
+
on: !0
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
(i || s) && /* @__PURE__ */ o(n, { children: [
|
|
46
|
+
i && /* @__PURE__ */ o(n, { children: [
|
|
47
|
+
/* @__PURE__ */ o(
|
|
48
|
+
l,
|
|
49
|
+
{
|
|
50
|
+
propKey: "overflow.smoothing",
|
|
51
|
+
propType: "component",
|
|
52
|
+
type: "select",
|
|
53
|
+
label: "Drag feel",
|
|
54
|
+
labelWidth: "w-56",
|
|
55
|
+
valueCoalesce: 0,
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ e("option", { value: "0", children: "Direct (1:1 with pointer)" }),
|
|
58
|
+
/* @__PURE__ */ e("option", { value: "0.12", children: "Light ease" }),
|
|
59
|
+
/* @__PURE__ */ e("option", { value: "0.2", children: "Fluid" }),
|
|
60
|
+
/* @__PURE__ */ e("option", { value: "0.28", children: "Very fluid" })
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ e(
|
|
65
|
+
l,
|
|
66
|
+
{
|
|
67
|
+
propKey: "overflow.wheelHorizontal",
|
|
68
|
+
propType: "component",
|
|
69
|
+
type: "toggle",
|
|
70
|
+
label: "Vertical wheel scrolls horizontally",
|
|
71
|
+
labelWidth: "w-56",
|
|
72
|
+
on: !0
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
] }),
|
|
76
|
+
s && /* @__PURE__ */ e(
|
|
77
|
+
l,
|
|
78
|
+
{
|
|
79
|
+
propKey: "overflow.hideDelay",
|
|
80
|
+
propType: "component",
|
|
81
|
+
type: "number",
|
|
82
|
+
label: "Scrollbar hide delay (ms)",
|
|
83
|
+
labelWidth: "w-56",
|
|
84
|
+
valueCoalesce: 1e3
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
] }),
|
|
88
|
+
/* @__PURE__ */ o("p", { className: "text-neutral-content text-xs leading-relaxed", children: [
|
|
89
|
+
/* @__PURE__ */ e("span", { className: "text-base-content font-medium", children: "overflow-x-auto" }),
|
|
90
|
+
" is added automatically unless you set another",
|
|
91
|
+
" ",
|
|
92
|
+
/* @__PURE__ */ e("span", { className: "text-base-content font-medium", children: "overflow-x-*" }),
|
|
93
|
+
" in Classes. Use a horizontal row (e.g. flex) for your strip. Drag scroll runs on the live site only, not while editing the canvas. If motion feels like it snaps to cards, remove",
|
|
94
|
+
" ",
|
|
95
|
+
/* @__PURE__ */ e("span", { className: "text-base-content font-medium", children: "scroll-snap-*" }),
|
|
96
|
+
" from Classes on this container or its children."
|
|
97
|
+
] })
|
|
98
|
+
] });
|
|
99
|
+
}
|
|
100
|
+
function N({ initialPosition: t, onClose: r }) {
|
|
101
|
+
return /* @__PURE__ */ e(
|
|
102
|
+
m,
|
|
103
|
+
{
|
|
104
|
+
isOpen: !0,
|
|
105
|
+
onClose: r,
|
|
106
|
+
title: "Scroll Behavior",
|
|
107
|
+
storageKey: "container-overflow",
|
|
108
|
+
minWidth: 300,
|
|
109
|
+
maxWidth: 520,
|
|
110
|
+
minHeight: 320,
|
|
111
|
+
initialPosition: t,
|
|
112
|
+
zIndex: g,
|
|
113
|
+
scrollable: !0,
|
|
114
|
+
children: /* @__PURE__ */ e(y, {})
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
export {
|
|
119
|
+
N as default
|
|
120
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsxs as u, Fragment as m, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useNode as f } from "@craftjs/core";
|
|
3
|
+
import { useState as P, Suspense as d, lazy as v } from "react";
|
|
4
|
+
import { u as O } from "./usePopoverAutoOpen-CxIjt0ez.js";
|
|
5
|
+
import { u as I } from "./usePopoverPosition-83Vti7Aw.js";
|
|
6
|
+
const S = v(() => import("./ContainerOverflowSectionPanel-ibKXf-1N.js")), g = 360;
|
|
7
|
+
function j({ def: o }) {
|
|
8
|
+
const [t, n] = P(!1), { triggerRef: i, initialPos: s, setInitialPos: r, computePosition: a } = I(g), { id: l } = f((c) => ({ id: c.id })), p = () => {
|
|
9
|
+
r(a()), n(!0);
|
|
10
|
+
};
|
|
11
|
+
return O({ nodeId: l, defId: o == null ? void 0 : o.id, onOpen: p }), /* @__PURE__ */ u(m, { children: [
|
|
12
|
+
/* @__PURE__ */ e("span", { ref: i, "aria-hidden": !0, className: "block size-0" }),
|
|
13
|
+
t && /* @__PURE__ */ e(d, { fallback: null, children: /* @__PURE__ */ e(
|
|
14
|
+
S,
|
|
15
|
+
{
|
|
16
|
+
initialPosition: s,
|
|
17
|
+
onClose: () => n(!1)
|
|
18
|
+
}
|
|
19
|
+
) })
|
|
20
|
+
] });
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
j as default
|
|
24
|
+
};
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { jsx as D } from "react/jsx-runtime";
|
|
2
|
+
import { useNode as E, useEditor as it } from "@craftjs/core";
|
|
3
|
+
import { O as rt, y as _, t as P, u as H, V as dt, E as at, e as ct } from "./index-C66dAl3Q.js";
|
|
4
|
+
import { useState as N, useRef as F, useEffect as I, useCallback as lt } from "react";
|
|
5
|
+
import ut from "react-dom";
|
|
6
|
+
let pt = !1;
|
|
7
|
+
const q = /* @__PURE__ */ new Set();
|
|
8
|
+
function ft() {
|
|
9
|
+
return pt;
|
|
10
|
+
}
|
|
11
|
+
function mt(t) {
|
|
12
|
+
return q.add(t), () => {
|
|
13
|
+
q.delete(t);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const W = {
|
|
17
|
+
0: "0",
|
|
18
|
+
1: "px",
|
|
19
|
+
2: "0.5",
|
|
20
|
+
4: "1",
|
|
21
|
+
6: "1.5",
|
|
22
|
+
8: "2",
|
|
23
|
+
10: "2.5",
|
|
24
|
+
12: "3",
|
|
25
|
+
14: "3.5",
|
|
26
|
+
16: "4",
|
|
27
|
+
20: "5",
|
|
28
|
+
24: "6",
|
|
29
|
+
28: "7",
|
|
30
|
+
32: "8",
|
|
31
|
+
36: "9",
|
|
32
|
+
40: "10",
|
|
33
|
+
44: "11",
|
|
34
|
+
48: "12",
|
|
35
|
+
56: "14",
|
|
36
|
+
64: "16",
|
|
37
|
+
80: "20",
|
|
38
|
+
96: "24",
|
|
39
|
+
112: "28",
|
|
40
|
+
128: "32",
|
|
41
|
+
144: "36",
|
|
42
|
+
160: "40",
|
|
43
|
+
176: "44",
|
|
44
|
+
192: "48",
|
|
45
|
+
208: "52",
|
|
46
|
+
224: "56",
|
|
47
|
+
240: "60",
|
|
48
|
+
256: "64",
|
|
49
|
+
288: "72",
|
|
50
|
+
320: "80",
|
|
51
|
+
384: "96"
|
|
52
|
+
}, ht = Object.keys(W).map(Number);
|
|
53
|
+
function Y(t) {
|
|
54
|
+
const s = Math.max(0, t);
|
|
55
|
+
if (s > 404) return s;
|
|
56
|
+
let i = 0, n = s;
|
|
57
|
+
for (const c of ht) {
|
|
58
|
+
const r = Math.abs(s - c);
|
|
59
|
+
r < n && (n = r, i = c);
|
|
60
|
+
}
|
|
61
|
+
return i;
|
|
62
|
+
}
|
|
63
|
+
function gt(t, s) {
|
|
64
|
+
const i = W[s], n = `p${t[0]}`;
|
|
65
|
+
return i != null ? `${n}-${i}` : `${n}-[${s}px]`;
|
|
66
|
+
}
|
|
67
|
+
const K = [
|
|
68
|
+
{ cls: "w-1/4", ratio: 0.25 },
|
|
69
|
+
{ cls: "w-1/3", ratio: 1 / 3 },
|
|
70
|
+
{ cls: "w-1/2", ratio: 0.5 },
|
|
71
|
+
{ cls: "w-2/3", ratio: 2 / 3 },
|
|
72
|
+
{ cls: "w-3/4", ratio: 0.75 },
|
|
73
|
+
{ cls: "w-full", ratio: 1 }
|
|
74
|
+
];
|
|
75
|
+
function J(t, s) {
|
|
76
|
+
if (s <= 0) return { cls: `w-[${Math.round(t)}px]`, px: t };
|
|
77
|
+
const i = t / s;
|
|
78
|
+
let n = K[0], c = Math.abs(i - n.ratio);
|
|
79
|
+
for (const r of K) {
|
|
80
|
+
const h = Math.abs(i - r.ratio);
|
|
81
|
+
h < c && (c = h, n = r);
|
|
82
|
+
}
|
|
83
|
+
return { cls: n.cls, px: Math.round(n.ratio * s) };
|
|
84
|
+
}
|
|
85
|
+
function Q(t) {
|
|
86
|
+
const s = Y(t), i = W[s];
|
|
87
|
+
return i != null ? { cls: `h-${i}`, px: s } : { cls: `h-[${Math.round(t)}px]`, px: Math.round(t) };
|
|
88
|
+
}
|
|
89
|
+
const x = 8;
|
|
90
|
+
function bt(t, s, i) {
|
|
91
|
+
const n = t.getBoundingClientRect(), c = window.getComputedStyle(t), r = parseFloat(c.paddingTop) || 0, h = parseFloat(c.paddingRight) || 0, e = parseFloat(c.paddingBottom) || 0, v = parseFloat(c.paddingLeft) || 0;
|
|
92
|
+
if (i > n.bottom && i <= n.bottom + x && s >= n.left && s <= n.right)
|
|
93
|
+
return { side: "bottom", mode: "resize" };
|
|
94
|
+
if (s > n.right && s <= n.right + x && i >= n.top && i <= n.bottom)
|
|
95
|
+
return { side: "right", mode: "resize" };
|
|
96
|
+
if (s >= n.left && s <= n.right && i >= n.top && i <= n.bottom) {
|
|
97
|
+
const $ = i - n.top, R = n.bottom - i, w = s - n.left, C = n.right - s, f = 12, M = document.getElementById("viewport");
|
|
98
|
+
if (M == null || M.getBoundingClientRect().left, $ < f && r > 0) return { side: "top", mode: "padding" };
|
|
99
|
+
if (R < f && e > 0) return { side: "bottom", mode: "padding" };
|
|
100
|
+
if (w < f && v > 0) return { side: "left", mode: "padding" };
|
|
101
|
+
if (C < f && h > 0) return { side: "right", mode: "padding" };
|
|
102
|
+
if ($ < f && r === 0) return { side: "top", mode: "padding" };
|
|
103
|
+
if (R < f && e === 0) return { side: "bottom", mode: "padding" };
|
|
104
|
+
if (w < f && v === 0) return { side: "left", mode: "padding" };
|
|
105
|
+
if (C < f && h === 0) return { side: "right", mode: "padding" };
|
|
106
|
+
}
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
function yt({
|
|
110
|
+
targetElement: t,
|
|
111
|
+
isActive: s,
|
|
112
|
+
setProp: i,
|
|
113
|
+
classPrefixView: n,
|
|
114
|
+
classDark: c
|
|
115
|
+
}) {
|
|
116
|
+
const [r, h] = N(null), [e, v] = N(null), [$, R] = N(null), [w, C] = N(null), f = F(null), M = F(e);
|
|
117
|
+
M.current = e, f.current = $;
|
|
118
|
+
const T = F(null), B = F(null), [Z, X] = N(ft());
|
|
119
|
+
I(() => mt(X), []), I(() => {
|
|
120
|
+
if (!t || !s || e || Z) return;
|
|
121
|
+
const o = (l) => {
|
|
122
|
+
const d = bt(t, l.clientX, l.clientY), a = d ? `${d.side}:${d.mode}` : null;
|
|
123
|
+
if (a !== B.current) {
|
|
124
|
+
if (B.current = a, T.current && clearTimeout(T.current), !d) {
|
|
125
|
+
h(null);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
T.current = setTimeout(() => h(d), 400);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
return document.addEventListener("mousemove", o), () => {
|
|
132
|
+
document.removeEventListener("mousemove", o), T.current && clearTimeout(T.current), B.current = null;
|
|
133
|
+
};
|
|
134
|
+
}, [t, s, e, Z]);
|
|
135
|
+
const L = lt(() => {
|
|
136
|
+
if (!t) return null;
|
|
137
|
+
const o = t.getBoundingClientRect(), l = window.getComputedStyle(t), d = M.current || r;
|
|
138
|
+
if (!d) return null;
|
|
139
|
+
const a = parseFloat(l.paddingTop) || 0, g = parseFloat(l.paddingRight) || 0, m = parseFloat(l.paddingBottom) || 0, p = parseFloat(l.paddingLeft) || 0;
|
|
140
|
+
if (d.mode === "padding")
|
|
141
|
+
switch (d.side) {
|
|
142
|
+
case "top":
|
|
143
|
+
return { x: o.left, y: o.top, w: o.width, h: Math.max(a, 6) };
|
|
144
|
+
case "bottom":
|
|
145
|
+
return {
|
|
146
|
+
x: o.left,
|
|
147
|
+
y: o.bottom - Math.max(m, 6),
|
|
148
|
+
w: o.width,
|
|
149
|
+
h: Math.max(m, 6)
|
|
150
|
+
};
|
|
151
|
+
case "left":
|
|
152
|
+
return { x: o.left, y: o.top, w: Math.max(p, 6), h: o.height };
|
|
153
|
+
case "right":
|
|
154
|
+
return {
|
|
155
|
+
x: o.right - Math.max(g, 6),
|
|
156
|
+
y: o.top,
|
|
157
|
+
w: Math.max(g, 6),
|
|
158
|
+
h: o.height
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
else
|
|
162
|
+
switch (d.side) {
|
|
163
|
+
case "top":
|
|
164
|
+
return { x: o.left, y: o.top - x, w: o.width, h: x };
|
|
165
|
+
case "bottom":
|
|
166
|
+
return { x: o.left, y: o.bottom, w: o.width, h: x };
|
|
167
|
+
case "left":
|
|
168
|
+
return { x: o.left - x, y: o.top, w: x, h: o.height };
|
|
169
|
+
case "right":
|
|
170
|
+
return { x: o.right, y: o.top, w: x, h: o.height };
|
|
171
|
+
}
|
|
172
|
+
}, [t, r]);
|
|
173
|
+
I(() => {
|
|
174
|
+
if (!t || !s) {
|
|
175
|
+
C(null);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const o = () => {
|
|
179
|
+
M.current || C(L());
|
|
180
|
+
};
|
|
181
|
+
o();
|
|
182
|
+
const l = setInterval(o, 200);
|
|
183
|
+
return () => clearInterval(l);
|
|
184
|
+
}, [t, s, L]), I(() => {
|
|
185
|
+
if (!e || !t) return;
|
|
186
|
+
const o = e.side === "top" || e.side === "bottom", l = (a) => {
|
|
187
|
+
var p;
|
|
188
|
+
const m = (o ? a.clientY : a.clientX) - e.startPos;
|
|
189
|
+
if (e.mode === "padding") {
|
|
190
|
+
const b = e.side === "bottom" || e.side === "right" ? -1 : 1, u = Y(e.initial + m * b);
|
|
191
|
+
R(u);
|
|
192
|
+
const y = `padding${e.side.charAt(0).toUpperCase() + e.side.slice(1)}`;
|
|
193
|
+
t.style[y] = `${u}px`;
|
|
194
|
+
} else {
|
|
195
|
+
const b = e.side === "left" || e.side === "top" ? -1 : 1, u = Math.max(0, e.initial + m * b);
|
|
196
|
+
if (o) {
|
|
197
|
+
const y = Q(u);
|
|
198
|
+
R(y.px), t.style.height = `${y.px}px`;
|
|
199
|
+
} else {
|
|
200
|
+
const y = e.parentSize || ((p = t.parentElement) == null ? void 0 : p.offsetWidth) || 0, j = J(u, y);
|
|
201
|
+
R(j.px), t.style.width = `${j.px}px`;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
C(L());
|
|
205
|
+
}, d = () => {
|
|
206
|
+
var g;
|
|
207
|
+
const a = f.current;
|
|
208
|
+
if (e.mode === "padding") {
|
|
209
|
+
const m = `padding${e.side.charAt(0).toUpperCase() + e.side.slice(1)}`;
|
|
210
|
+
if (t.style[m] = "", a != null) {
|
|
211
|
+
const p = gt(e.side, a), b = _(n, c);
|
|
212
|
+
i((u) => {
|
|
213
|
+
u.className = P(u.className || "", b + p);
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
} else if (e.side === "top" || e.side === "bottom") {
|
|
217
|
+
if (t.style.height = "", a != null) {
|
|
218
|
+
const p = Q(a), b = _(n, c);
|
|
219
|
+
i((u) => {
|
|
220
|
+
u.className = P(u.className || "", b + p.cls);
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
} else if (t.style.width = "", a != null) {
|
|
224
|
+
const p = e.parentSize || ((g = t.parentElement) == null ? void 0 : g.offsetWidth) || 0, b = J(a, p), u = _(n, c);
|
|
225
|
+
i((y) => {
|
|
226
|
+
y.className = P(y.className || "", u + b.cls);
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
v(null), R(null), document.body.style.cursor = "", requestAnimationFrame(() => C(L()));
|
|
230
|
+
};
|
|
231
|
+
return document.addEventListener("mousemove", l), document.addEventListener("mouseup", d), () => {
|
|
232
|
+
document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", d);
|
|
233
|
+
};
|
|
234
|
+
}, [e, t, i, n, c, L]);
|
|
235
|
+
const S = typeof document < "u" ? document.getElementById("viewport") : null;
|
|
236
|
+
if (!S || !(e || r) || !w) return null;
|
|
237
|
+
const k = S.getBoundingClientRect(), V = parseFloat(getComputedStyle(S.parentElement || S).zoom) || 1, tt = -k.left, et = -k.top, ot = (e == null ? void 0 : e.mode) || (r == null ? void 0 : r.mode), G = (e == null ? void 0 : e.side) || (r == null ? void 0 : r.side), z = G === "top" || G === "bottom", U = z ? "ns-resize" : "ew-resize", O = ot === "padding", nt = O ? e ? "rgba(147, 196, 125, 0.5)" : "rgba(147, 196, 125, 0.3)" : e ? "rgba(59, 130, 246, 0.4)" : "rgba(59, 130, 246, 0.2)", st = O ? "#15803d" : "#1d4ed8";
|
|
238
|
+
let A = "";
|
|
239
|
+
if (e && $ != null)
|
|
240
|
+
A = `${Math.round($)}px`;
|
|
241
|
+
else if (r && t) {
|
|
242
|
+
const o = window.getComputedStyle(t);
|
|
243
|
+
if (O) {
|
|
244
|
+
const l = {
|
|
245
|
+
top: o.paddingTop,
|
|
246
|
+
bottom: o.paddingBottom,
|
|
247
|
+
left: o.paddingLeft,
|
|
248
|
+
right: o.paddingRight
|
|
249
|
+
};
|
|
250
|
+
A = `${Math.round(parseFloat(l[r.side]) || 0)}px`;
|
|
251
|
+
} else
|
|
252
|
+
A = z ? `${Math.round(t.offsetHeight)}px` : `${Math.round(t.offsetWidth)}px`;
|
|
253
|
+
}
|
|
254
|
+
return ut.createPortal(
|
|
255
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
256
|
+
/* @__PURE__ */ D(
|
|
257
|
+
"div",
|
|
258
|
+
{
|
|
259
|
+
"data-node-control": "true",
|
|
260
|
+
onMouseDown: (o) => {
|
|
261
|
+
var m;
|
|
262
|
+
if (!t || !r) return;
|
|
263
|
+
o.preventDefault(), o.stopPropagation();
|
|
264
|
+
const l = t.getBoundingClientRect(), d = window.getComputedStyle(t);
|
|
265
|
+
let a, g;
|
|
266
|
+
if (r.mode === "padding") {
|
|
267
|
+
const p = {
|
|
268
|
+
top: d.paddingTop,
|
|
269
|
+
bottom: d.paddingBottom,
|
|
270
|
+
left: d.paddingLeft,
|
|
271
|
+
right: d.paddingRight
|
|
272
|
+
};
|
|
273
|
+
a = parseFloat(p[r.side]) || 0;
|
|
274
|
+
} else
|
|
275
|
+
a = z ? l.height : l.width, z || (g = ((m = t.parentElement) == null ? void 0 : m.offsetWidth) || 0);
|
|
276
|
+
v({
|
|
277
|
+
side: r.side,
|
|
278
|
+
mode: r.mode,
|
|
279
|
+
startPos: z ? o.clientY : o.clientX,
|
|
280
|
+
initial: a,
|
|
281
|
+
parentSize: g
|
|
282
|
+
}), document.body.style.cursor = U;
|
|
283
|
+
},
|
|
284
|
+
style: {
|
|
285
|
+
position: "absolute",
|
|
286
|
+
left: (w.x + tt) / V + S.scrollLeft,
|
|
287
|
+
top: (w.y + et) / V + S.scrollTop,
|
|
288
|
+
width: w.w / V,
|
|
289
|
+
height: w.h / V,
|
|
290
|
+
backgroundColor: nt,
|
|
291
|
+
cursor: U,
|
|
292
|
+
zIndex: rt,
|
|
293
|
+
display: "flex",
|
|
294
|
+
alignItems: "center",
|
|
295
|
+
justifyContent: "center",
|
|
296
|
+
transition: e ? "none" : "all 0.15s ease"
|
|
297
|
+
},
|
|
298
|
+
children: /* @__PURE__ */ D(
|
|
299
|
+
"span",
|
|
300
|
+
{
|
|
301
|
+
style: {
|
|
302
|
+
fontSize: 11,
|
|
303
|
+
fontWeight: 600,
|
|
304
|
+
color: st,
|
|
305
|
+
backgroundColor: "rgba(255, 255, 255, 0.9)",
|
|
306
|
+
padding: "1px 5px",
|
|
307
|
+
borderRadius: 3,
|
|
308
|
+
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
309
|
+
pointerEvents: "none",
|
|
310
|
+
userSelect: "none",
|
|
311
|
+
whiteSpace: "nowrap"
|
|
312
|
+
},
|
|
313
|
+
children: A
|
|
314
|
+
}
|
|
315
|
+
)
|
|
316
|
+
}
|
|
317
|
+
),
|
|
318
|
+
S
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
function St() {
|
|
322
|
+
const { id: t, dom: s } = E((e) => ({ dom: e.dom })), { isSelected: i } = it((e, v) => ({
|
|
323
|
+
isSelected: v.getEvent("selected").contains(t)
|
|
324
|
+
})), {
|
|
325
|
+
actions: { setProp: n }
|
|
326
|
+
} = E(), c = H(dt), r = H(at).dark ?? !1, h = ct(c);
|
|
327
|
+
return !s || !i ? null : /* @__PURE__ */ D(
|
|
328
|
+
yt,
|
|
329
|
+
{
|
|
330
|
+
targetElement: s,
|
|
331
|
+
isActive: i,
|
|
332
|
+
setProp: n,
|
|
333
|
+
classPrefixView: h,
|
|
334
|
+
classDark: r
|
|
335
|
+
}
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
export {
|
|
339
|
+
St as ContainerPaddingOverlay
|
|
340
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsx as e, Fragment as r, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
import { useNode as m, useEditor as y } from "@craftjs/core";
|
|
3
|
+
import { T as S } from "./ToolbarDashedButton-DbUxGmDg.js";
|
|
4
|
+
import { n as t } from "./index-C66dAl3Q.js";
|
|
5
|
+
function C() {
|
|
6
|
+
const { id: i, craftName: f, containerType: a, scrollEffect: c } = m((l) => {
|
|
7
|
+
var h;
|
|
8
|
+
const n = ((h = l.data) == null ? void 0 : h.props) || {}, d = l.data;
|
|
9
|
+
return {
|
|
10
|
+
id: l.id,
|
|
11
|
+
craftName: d.name || d.displayName,
|
|
12
|
+
containerType: n.type,
|
|
13
|
+
scrollEffect: n.scrollEffect
|
|
14
|
+
};
|
|
15
|
+
}), { actions: s } = y();
|
|
16
|
+
if (f !== "Container") return null;
|
|
17
|
+
const p = a === "section", u = !p && !["header", "footer", "page", "component"].includes(a);
|
|
18
|
+
return /* @__PURE__ */ e(r, { children: p ? /* @__PURE__ */ o(r, { children: [
|
|
19
|
+
/* @__PURE__ */ o(
|
|
20
|
+
t,
|
|
21
|
+
{
|
|
22
|
+
propKey: "scrollEffect",
|
|
23
|
+
propType: "component",
|
|
24
|
+
type: "select",
|
|
25
|
+
label: "Effect",
|
|
26
|
+
onChange: (l) => {
|
|
27
|
+
l === "horizontal-scroll" && s.setProp(i, (n) => {
|
|
28
|
+
(n.scrollDirection == null || n.scrollDirection === "") && (n.scrollDirection = "ltr"), n.scrollSpeed == null && (n.scrollSpeed = 1.5);
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ e("option", { value: "", children: "None" }),
|
|
33
|
+
/* @__PURE__ */ e("option", { value: "horizontal-scroll", children: "Horizontal Scroll" }),
|
|
34
|
+
/* @__PURE__ */ e("option", { value: "scroll-timeline", children: "Scroll Timeline" })
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
c === "horizontal-scroll" && /* @__PURE__ */ o(r, { children: [
|
|
39
|
+
/* @__PURE__ */ o(
|
|
40
|
+
t,
|
|
41
|
+
{
|
|
42
|
+
propKey: "scrollDirection",
|
|
43
|
+
propType: "component",
|
|
44
|
+
type: "select",
|
|
45
|
+
label: "Direction",
|
|
46
|
+
valueCoalesce: "ltr",
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ e("option", { value: "ltr", children: "Left to Right" }),
|
|
49
|
+
/* @__PURE__ */ e("option", { value: "rtl", children: "Right to Left" })
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
/* @__PURE__ */ e(
|
|
54
|
+
t,
|
|
55
|
+
{
|
|
56
|
+
propKey: "scrollSnap",
|
|
57
|
+
propType: "component",
|
|
58
|
+
type: "toggle",
|
|
59
|
+
label: "Snap to panels",
|
|
60
|
+
on: !0
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ o(
|
|
64
|
+
t,
|
|
65
|
+
{
|
|
66
|
+
propKey: "scrollSpeed",
|
|
67
|
+
propType: "component",
|
|
68
|
+
type: "select",
|
|
69
|
+
label: "Speed",
|
|
70
|
+
valueCoalesce: 1.5,
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ e("option", { value: "1", children: "Fast" }),
|
|
73
|
+
/* @__PURE__ */ e("option", { value: "1.5", children: "Normal" }),
|
|
74
|
+
/* @__PURE__ */ e("option", { value: "2", children: "Slow" }),
|
|
75
|
+
/* @__PURE__ */ e("option", { value: "3", children: "Very Slow" })
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
] }),
|
|
80
|
+
c === "scroll-timeline" && /* @__PURE__ */ o(
|
|
81
|
+
t,
|
|
82
|
+
{
|
|
83
|
+
propKey: "scrollTimelineRunway",
|
|
84
|
+
propType: "component",
|
|
85
|
+
type: "select",
|
|
86
|
+
label: "Runway",
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ e("option", { value: "2", children: "Short" }),
|
|
89
|
+
/* @__PURE__ */ e("option", { value: "3", children: "Normal" }),
|
|
90
|
+
/* @__PURE__ */ e("option", { value: "5", children: "Long" }),
|
|
91
|
+
/* @__PURE__ */ e("option", { value: "8", children: "Epic" })
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
c && /* @__PURE__ */ o(t, { propKey: "scrollSmoothing", propType: "component", type: "select", label: "Smoothing", children: [
|
|
96
|
+
/* @__PURE__ */ e("option", { value: "0", children: "None (instant)" }),
|
|
97
|
+
/* @__PURE__ */ e("option", { value: "0.5", children: "Light" }),
|
|
98
|
+
/* @__PURE__ */ e("option", { value: "0.8", children: "Normal" }),
|
|
99
|
+
/* @__PURE__ */ e("option", { value: "1.5", children: "Heavy" })
|
|
100
|
+
] })
|
|
101
|
+
] }) : /* @__PURE__ */ e(r, { children: u ? /* @__PURE__ */ o(r, { children: [
|
|
102
|
+
/* @__PURE__ */ o("p", { className: "text-neutral-content text-xs leading-relaxed", children: [
|
|
103
|
+
"Scroll effects only run when this container is a",
|
|
104
|
+
" ",
|
|
105
|
+
/* @__PURE__ */ e("span", { className: "text-base-content font-medium", children: "section" }),
|
|
106
|
+
". Use the button, or set this container's type to Section in component settings."
|
|
107
|
+
] }),
|
|
108
|
+
/* @__PURE__ */ e(
|
|
109
|
+
S,
|
|
110
|
+
{
|
|
111
|
+
className: "mt-2",
|
|
112
|
+
icon: null,
|
|
113
|
+
onClick: () => s.setProp(i, (l) => {
|
|
114
|
+
l.type = "section";
|
|
115
|
+
}),
|
|
116
|
+
children: "Use section type"
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
] }) : /* @__PURE__ */ e("p", { className: "text-neutral-content text-xs leading-relaxed", children: "Scroll effects are not available for this container role (e.g. header, footer, or page). Use a section block inside this area if you need scroll effects." }) }) });
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
C as ContainerScrollEffectSection
|
|
123
|
+
};
|