@pagehub/sdk 0.1.5 → 0.1.7
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/dist/theme.css +168 -0
- package/package.json +25 -14
- package/dist/pagehub-viewer.umd.cjs +0 -574
- package/dist/pagehub.umd.cjs +0 -1130
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as t, Fragment as s } from "react/jsx-runtime";
|
|
2
|
+
import { useSyncExternalStore as h, Fragment as m } from "react";
|
|
3
|
+
import { cs as g, a_ as a } from "./index-C66dAl3Q.js";
|
|
4
|
+
function b(f) {
|
|
5
|
+
const { id: o, ctx: c, fallback: i = null } = f, n = g();
|
|
6
|
+
h(
|
|
7
|
+
(r) => {
|
|
8
|
+
const e = n.slots.subscribe(r), d = n.context.subscribe(r);
|
|
9
|
+
return () => {
|
|
10
|
+
e(), d();
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
() => n.tick,
|
|
14
|
+
() => 0
|
|
15
|
+
);
|
|
16
|
+
const u = n.slots.getDef(o);
|
|
17
|
+
if (!u) return /* @__PURE__ */ t(s, { children: i });
|
|
18
|
+
const l = n.slots.resolve(o, c);
|
|
19
|
+
if (l.length === 0) return /* @__PURE__ */ t(s, { children: i });
|
|
20
|
+
if (u.cardinality === "single") {
|
|
21
|
+
const r = l[0];
|
|
22
|
+
try {
|
|
23
|
+
return /* @__PURE__ */ t(s, { children: r.render(c) });
|
|
24
|
+
} catch (e) {
|
|
25
|
+
return a.error(`[ph.SlotRenderer] render threw for "${o}":`, e), /* @__PURE__ */ t(s, { children: i });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return /* @__PURE__ */ t(s, { children: l.map((r, e) => {
|
|
29
|
+
try {
|
|
30
|
+
return /* @__PURE__ */ t(m, { children: r.render(c) }, e);
|
|
31
|
+
} catch (d) {
|
|
32
|
+
return a.error(`[ph.SlotRenderer] render threw for "${o}" (idx ${e}):`, d), null;
|
|
33
|
+
}
|
|
34
|
+
}) });
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
b as S
|
|
38
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { useEditor as S, useNode as C } from "@craftjs/core";
|
|
3
|
+
import { ROOT_NODE as F } from "@craftjs/utils";
|
|
4
|
+
import { useMemo as h } from "react";
|
|
5
|
+
import { W as G, aA as I } from "./index-C66dAl3Q.js";
|
|
6
|
+
import { F as P } from "./FloatingPanel-DJP5Vhua.js";
|
|
7
|
+
import { u as R } from "./useElementPicker-DoNuXNMQ.js";
|
|
8
|
+
import { b as W, d as _ } from "./ConditionsInput-B_5Nge8o.js";
|
|
9
|
+
function j() {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
function H({
|
|
13
|
+
binding: r,
|
|
14
|
+
onChange: a,
|
|
15
|
+
initialPosition: b,
|
|
16
|
+
onClose: g
|
|
17
|
+
}) {
|
|
18
|
+
var u;
|
|
19
|
+
const d = R("all"), v = Array.isArray(d) ? d : [], y = j(), { query: c } = S(), { availableModifiers: l, siteModifiers: N, nodeName: m } = C((e) => {
|
|
20
|
+
var t, i, n, x;
|
|
21
|
+
return {
|
|
22
|
+
nodeName: (t = e.data) == null ? void 0 : t.name,
|
|
23
|
+
availableModifiers: ((x = (n = (i = e.data.type) == null ? void 0 : i.craft) == null ? void 0 : n.toolbar) == null ? void 0 : x.modifiers) || [],
|
|
24
|
+
siteModifiers: []
|
|
25
|
+
};
|
|
26
|
+
}), f = h(() => {
|
|
27
|
+
var e, t;
|
|
28
|
+
try {
|
|
29
|
+
const i = c.node(F).get(), n = (t = (e = i == null ? void 0 : i.data) == null ? void 0 : e.props) == null ? void 0 : t.modifiers;
|
|
30
|
+
return !n || typeof n != "object" ? [] : n[m] || [];
|
|
31
|
+
} catch {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
}, [c, m, N]), p = h(
|
|
35
|
+
() => [...l, ...f],
|
|
36
|
+
[l, f]
|
|
37
|
+
), M = ((u = r.conditions) == null ? void 0 : u[0]) ?? {
|
|
38
|
+
conditions: [_("state")],
|
|
39
|
+
logic: "all"
|
|
40
|
+
}, A = (e) => {
|
|
41
|
+
a({ ...r, conditions: e.conditions.length > 0 ? [e] : [] });
|
|
42
|
+
}, E = () => {
|
|
43
|
+
a({ ...r, conditions: [] });
|
|
44
|
+
}, O = (e) => {
|
|
45
|
+
const t = new Set(r.modifiers || []);
|
|
46
|
+
t.has(e) ? t.delete(e) : t.add(e), a({ ...r, modifiers: Array.from(t) });
|
|
47
|
+
};
|
|
48
|
+
return /* @__PURE__ */ o(
|
|
49
|
+
P,
|
|
50
|
+
{
|
|
51
|
+
isOpen: !0,
|
|
52
|
+
onClose: g,
|
|
53
|
+
title: "State binding",
|
|
54
|
+
storageKey: "state-binding-editor",
|
|
55
|
+
minWidth: 320,
|
|
56
|
+
maxWidth: 480,
|
|
57
|
+
minHeight: 300,
|
|
58
|
+
initialPosition: b,
|
|
59
|
+
zIndex: G,
|
|
60
|
+
scrollable: !0,
|
|
61
|
+
children: /* @__PURE__ */ s("div", { className: "flex flex-col gap-3", children: [
|
|
62
|
+
/* @__PURE__ */ s("div", { children: [
|
|
63
|
+
/* @__PURE__ */ o("div", { className: "text-base-content mb-1 text-[11px] font-medium", children: "When" }),
|
|
64
|
+
/* @__PURE__ */ o(
|
|
65
|
+
W,
|
|
66
|
+
{
|
|
67
|
+
group: M,
|
|
68
|
+
groupIndex: 0,
|
|
69
|
+
onChange: A,
|
|
70
|
+
onRemove: E,
|
|
71
|
+
formElements: v,
|
|
72
|
+
connectorOptions: y
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
] }),
|
|
76
|
+
/* @__PURE__ */ s("div", { children: [
|
|
77
|
+
/* @__PURE__ */ o("div", { className: "text-base-content mb-1 text-[11px] font-medium", children: "Apply modifiers" }),
|
|
78
|
+
p.length === 0 ? /* @__PURE__ */ o("div", { className: "text-neutral-content text-[10px]", children: "No modifiers registered for this component. Save a modifier from the Modifiers section first." }) : /* @__PURE__ */ o("div", { className: "flex flex-wrap gap-1", children: p.map((e) => {
|
|
79
|
+
const t = (r.modifiers || []).includes(e.name);
|
|
80
|
+
return /* @__PURE__ */ s(
|
|
81
|
+
"button",
|
|
82
|
+
{
|
|
83
|
+
type: "button",
|
|
84
|
+
onClick: () => O(e.name),
|
|
85
|
+
className: `flex items-center gap-1 rounded-md border px-2 py-1 text-[10px] transition-colors ${t ? "bg-primary/10 border-primary text-primary" : "bg-base-100 border-base-300 text-neutral-content hover:border-base-content"}`,
|
|
86
|
+
children: [
|
|
87
|
+
t && /* @__PURE__ */ o(I, { className: "size-3", "aria-hidden": !0 }),
|
|
88
|
+
e.label || e.name
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
e.name
|
|
92
|
+
);
|
|
93
|
+
}) })
|
|
94
|
+
] })
|
|
95
|
+
] })
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
export {
|
|
100
|
+
H as default
|
|
101
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useNode as v } from "@craftjs/core";
|
|
3
|
+
import { useRef as A } from "react";
|
|
4
|
+
import { e9 as N, d as O, G as c } from "./index-C66dAl3Q.js";
|
|
5
|
+
import { S as P } from "./SearchableMenuPopover-DZKVXiEl.js";
|
|
6
|
+
import { g as B } from "./propertyRegistry-CMhVNOgl.js";
|
|
7
|
+
import { P as R, u as k, r as q } from "./popoverOpenRequestAtom-hBS_siXv.js";
|
|
8
|
+
import { d as D } from "./ConditionsInput-B_5Nge8o.js";
|
|
9
|
+
const T = "stateBindings", w = [
|
|
10
|
+
{
|
|
11
|
+
id: "visibility",
|
|
12
|
+
label: "Visibility key",
|
|
13
|
+
help: "Read show/hide from a state key",
|
|
14
|
+
data: "visibility"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: "computed",
|
|
18
|
+
label: "Computed binding",
|
|
19
|
+
help: "Derive a new state value",
|
|
20
|
+
data: "computed"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "binding",
|
|
24
|
+
label: "State binding",
|
|
25
|
+
help: "Apply modifiers when state matches",
|
|
26
|
+
data: "binding"
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
function F({ def: r }) {
|
|
30
|
+
var u;
|
|
31
|
+
const {
|
|
32
|
+
id: d,
|
|
33
|
+
nodeName: f,
|
|
34
|
+
actions: { setProp: a }
|
|
35
|
+
} = v((e) => {
|
|
36
|
+
var i, m;
|
|
37
|
+
return {
|
|
38
|
+
id: e.id,
|
|
39
|
+
nodeName: ((i = e.data) == null ? void 0 : i.name) || ((m = e.data) == null ? void 0 : m.displayName) || ""
|
|
40
|
+
};
|
|
41
|
+
}), t = N(), s = (u = B(r.section)) == null ? void 0 : u.title, [b, y] = O(R), l = A(null), p = f === "Container", o = () => {
|
|
42
|
+
a((e) => {
|
|
43
|
+
const i = Array.isArray(e.stateModifiers) ? [...e.stateModifiers] : [];
|
|
44
|
+
i.push({
|
|
45
|
+
conditions: [{ conditions: [D("state")], logic: "all" }],
|
|
46
|
+
modifiers: []
|
|
47
|
+
}), e.stateModifiers = i;
|
|
48
|
+
}), s && (t != null && t.setOpen) && t.setOpen(s, !0), q(b, y, d, T);
|
|
49
|
+
}, g = () => {
|
|
50
|
+
a((e) => {
|
|
51
|
+
typeof e.visibilityStateKey != "string" && (e.visibilityStateKey = "");
|
|
52
|
+
}), s && (t != null && t.setOpen) && t.setOpen(s, !0);
|
|
53
|
+
}, h = () => {
|
|
54
|
+
a((e) => {
|
|
55
|
+
const i = Array.isArray(e.computedStateBindings) ? [...e.computedStateBindings] : [];
|
|
56
|
+
i.push({ key: "", from: [], compute: { type: "all-truthy" } }), e.computedStateBindings = i;
|
|
57
|
+
}), s && (t != null && t.setOpen) && t.setOpen(s, !0);
|
|
58
|
+
}, S = (e) => {
|
|
59
|
+
e.data === "visibility" ? g() : e.data === "computed" ? h() : e.data === "binding" && o();
|
|
60
|
+
};
|
|
61
|
+
return k(d, r.id, () => {
|
|
62
|
+
p ? requestAnimationFrame(() => {
|
|
63
|
+
var e;
|
|
64
|
+
return (e = l.current) == null ? void 0 : e.open();
|
|
65
|
+
}) : o();
|
|
66
|
+
}), p ? /* @__PURE__ */ n(
|
|
67
|
+
P,
|
|
68
|
+
{
|
|
69
|
+
ref: l,
|
|
70
|
+
items: w,
|
|
71
|
+
onSelect: S,
|
|
72
|
+
trigger: /* @__PURE__ */ n(c, { className: "size-3.5", "aria-hidden": !0 }),
|
|
73
|
+
triggerAriaLabel: "Add state wiring",
|
|
74
|
+
searchPlaceholder: "Search…",
|
|
75
|
+
anchor: "bottom end",
|
|
76
|
+
panelWidthClass: "w-72"
|
|
77
|
+
}
|
|
78
|
+
) : /* @__PURE__ */ n(
|
|
79
|
+
"button",
|
|
80
|
+
{
|
|
81
|
+
type: "button",
|
|
82
|
+
onClick: o,
|
|
83
|
+
"aria-label": "Add state binding",
|
|
84
|
+
className: "text-neutral-content hover:text-base-content flex items-center justify-center rounded p-0.5",
|
|
85
|
+
children: /* @__PURE__ */ n(c, { className: "size-3.5", "aria-hidden": !0 })
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
F as default
|
|
91
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsxs as P, jsx as p, Fragment as A } from "react/jsx-runtime";
|
|
2
|
+
import { useNode as k } from "@craftjs/core";
|
|
3
|
+
import { useRef as v, useState as R, useEffect as x, Suspense as B, lazy as I } from "react";
|
|
4
|
+
import { u as N, eF as S, C as $, e4 as b } from "./index-C66dAl3Q.js";
|
|
5
|
+
import { u as q } from "./usePopoverPosition-83Vti7Aw.js";
|
|
6
|
+
import { P as C, p as E } from "./popoverOpenRequestAtom-hBS_siXv.js";
|
|
7
|
+
const T = I(() => import("./StateBindingEditorPanel-DKdcG5py.js")), _ = 380, D = "stateBindings";
|
|
8
|
+
function F(l) {
|
|
9
|
+
var o, r, u;
|
|
10
|
+
const t = (u = (r = (o = l.conditions) == null ? void 0 : o[0]) == null ? void 0 : r.conditions) == null ? void 0 : u[0], e = t ? t.operator && t.operator.startsWith("not") ? `${t.key || "?"} ≠ ${t.value || "?"}` : t.operator === "exists" ? `${t.key || "?"} exists` : t.operator === "not-exists" ? `${t.key || "?"} missing` : `${t.key || "?"} = ${t.value || "?"}` : "(no condition)", c = Array.isArray(l.modifiers) ? l.modifiers : [], i = c.length === 0 ? "(no modifiers)" : c.slice(0, 3).join(", ") + (c.length > 3 ? "…" : "");
|
|
11
|
+
return { left: e, right: i };
|
|
12
|
+
}
|
|
13
|
+
function L({
|
|
14
|
+
binding: l,
|
|
15
|
+
onChange: t,
|
|
16
|
+
onRemove: e,
|
|
17
|
+
autoOpen: c,
|
|
18
|
+
onAutoOpenConsumed: i
|
|
19
|
+
}) {
|
|
20
|
+
const [o, r] = R(!1), { triggerRef: u, initialPos: f, setInitialPos: m, computePosition: d } = q(_), g = () => {
|
|
21
|
+
m(d()), r(!0);
|
|
22
|
+
}, h = v(!1);
|
|
23
|
+
x(() => {
|
|
24
|
+
!c || h.current || (h.current = !0, requestAnimationFrame(() => {
|
|
25
|
+
m(d()), r(!0), i == null || i();
|
|
26
|
+
}));
|
|
27
|
+
}, [c]);
|
|
28
|
+
const { left: s, right: n } = F(l);
|
|
29
|
+
return /* @__PURE__ */ P(A, { children: [
|
|
30
|
+
/* @__PURE__ */ p(
|
|
31
|
+
$,
|
|
32
|
+
{
|
|
33
|
+
mode: "popover",
|
|
34
|
+
ref: u,
|
|
35
|
+
label: "When",
|
|
36
|
+
open: o,
|
|
37
|
+
onTriggerClick: () => o ? r(!1) : g(),
|
|
38
|
+
onClear: () => {
|
|
39
|
+
o && r(!1), e();
|
|
40
|
+
},
|
|
41
|
+
triggerAriaLabel: "Edit state binding",
|
|
42
|
+
clearAriaLabel: "Remove state binding",
|
|
43
|
+
leading: /* @__PURE__ */ p(b, { className: "size-3.5", "aria-hidden": !0 }),
|
|
44
|
+
summary: `${s} → ${n}`
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
o && /* @__PURE__ */ p(B, { fallback: null, children: /* @__PURE__ */ p(
|
|
48
|
+
T,
|
|
49
|
+
{
|
|
50
|
+
binding: l,
|
|
51
|
+
onChange: t,
|
|
52
|
+
initialPosition: f,
|
|
53
|
+
onClose: () => r(!1)
|
|
54
|
+
}
|
|
55
|
+
) })
|
|
56
|
+
] });
|
|
57
|
+
}
|
|
58
|
+
const M = () => {
|
|
59
|
+
const {
|
|
60
|
+
id: l,
|
|
61
|
+
actions: { setProp: t },
|
|
62
|
+
list: e
|
|
63
|
+
} = k((s) => {
|
|
64
|
+
var n, a;
|
|
65
|
+
return {
|
|
66
|
+
id: s.id,
|
|
67
|
+
list: ((a = (n = s.data) == null ? void 0 : n.props) == null ? void 0 : a.stateModifiers) || []
|
|
68
|
+
};
|
|
69
|
+
}), i = N(C).get(E(l, D)) || 0, o = (s) => {
|
|
70
|
+
t((n) => {
|
|
71
|
+
n.stateModifiers = s;
|
|
72
|
+
});
|
|
73
|
+
}, r = (s, n) => {
|
|
74
|
+
o(e.map((a, y) => y === s ? n : a));
|
|
75
|
+
}, u = (s) => {
|
|
76
|
+
o(e.filter((n, a) => a !== s));
|
|
77
|
+
}, f = v(e.length), [m, d] = R(null);
|
|
78
|
+
x(() => {
|
|
79
|
+
e.length > f.current && d(e.length - 1), f.current = e.length;
|
|
80
|
+
}, [e.length]);
|
|
81
|
+
const g = v(0);
|
|
82
|
+
x(() => {
|
|
83
|
+
i === 0 || i === g.current || (g.current = i, e.length > 0 && d(e.length - 1));
|
|
84
|
+
}, [i, e.length]);
|
|
85
|
+
const h = () => d(null);
|
|
86
|
+
return e.length === 0 ? /* @__PURE__ */ P("div", { className: "text-neutral-content flex items-center gap-2 px-1 py-1 text-[10px]", children: [
|
|
87
|
+
/* @__PURE__ */ p(S, { className: "size-3.5", "aria-hidden": !0 }),
|
|
88
|
+
"Bind modifiers to state — click + above to add a rule."
|
|
89
|
+
] }) : /* @__PURE__ */ p("div", { className: "flex flex-col gap-1", children: e.map((s, n) => /* @__PURE__ */ p(
|
|
90
|
+
L,
|
|
91
|
+
{
|
|
92
|
+
binding: s,
|
|
93
|
+
autoOpen: n === m,
|
|
94
|
+
onAutoOpenConsumed: h,
|
|
95
|
+
onChange: (a) => r(n, a),
|
|
96
|
+
onRemove: () => u(n)
|
|
97
|
+
},
|
|
98
|
+
n
|
|
99
|
+
)) });
|
|
100
|
+
};
|
|
101
|
+
export {
|
|
102
|
+
M as StateBindingsInput
|
|
103
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { n as a, o as s } from "./index-C66dAl3Q.js";
|
|
3
|
+
function u(t) {
|
|
4
|
+
const r = s[t];
|
|
5
|
+
return !Array.isArray(r) || r.length === 0 || !r.every((n) => typeof n == "string") ? null : r;
|
|
6
|
+
}
|
|
7
|
+
const y = ({ type: t = "select", propKey: r, min: n = 0, label: i, prop: l }) => {
|
|
8
|
+
const e = u(l);
|
|
9
|
+
return e ? /* @__PURE__ */ o(
|
|
10
|
+
a,
|
|
11
|
+
{
|
|
12
|
+
propKey: r,
|
|
13
|
+
type: t,
|
|
14
|
+
label: i,
|
|
15
|
+
max: e.length - 1,
|
|
16
|
+
min: n,
|
|
17
|
+
valueLabels: e,
|
|
18
|
+
inline: !0
|
|
19
|
+
}
|
|
20
|
+
) : null;
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
y as TailwindInput
|
|
24
|
+
};
|