@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,929 @@
|
|
|
1
|
+
import { jsxs as o, Fragment as m, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { C as x, F as Y, bV as K, f8 as G, f9 as J, fa as z, c6 as H, aI as X, aw as Z, T as ee, G as te, aO as w } from "./index-C66dAl3Q.js";
|
|
3
|
+
import { forwardRef as ae, useMemo as ne, useState as O, useEffect as U, useRef as E } from "react";
|
|
4
|
+
import { A as le } from "./AnchoredPopover-CckPTxXu.js";
|
|
5
|
+
import { useEditor as re } from "@craftjs/core";
|
|
6
|
+
import { ROOT_NODE as se } from "@craftjs/utils";
|
|
7
|
+
import { u as R } from "./useElementPicker-DoNuXNMQ.js";
|
|
8
|
+
import { S as V } from "./SearchableMenuPopover-DZKVXiEl.js";
|
|
9
|
+
import { C as oe, d as ie, a as ce } from "./ConditionsInput-B_5Nge8o.js";
|
|
10
|
+
import { P as de } from "./PeekTargetButton-ClrJX7zh.js";
|
|
11
|
+
function pe({ action: a, patch: t }) {
|
|
12
|
+
return /* @__PURE__ */ o(m, { children: [
|
|
13
|
+
/* @__PURE__ */ e("p", { className: "text-neutral-content text-[10px] leading-snug", children: "Adds the current product to the shopping cart. Must be inside a data-bound Container." }),
|
|
14
|
+
/* @__PURE__ */ o(x, { children: [
|
|
15
|
+
/* @__PURE__ */ e("label", { className: "text-neutral-content shrink-0 px-1 text-xs", children: "Quantity" }),
|
|
16
|
+
/* @__PURE__ */ e(
|
|
17
|
+
"input",
|
|
18
|
+
{
|
|
19
|
+
type: "number",
|
|
20
|
+
min: 1,
|
|
21
|
+
max: 99,
|
|
22
|
+
value: a.quantity || 1,
|
|
23
|
+
onChange: (n) => t({ quantity: parseInt(n.target.value) || 1 }),
|
|
24
|
+
className: "h-full w-full bg-transparent px-1 text-xs outline-none"
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
] }),
|
|
28
|
+
/* @__PURE__ */ o(x, { children: [
|
|
29
|
+
/* @__PURE__ */ e("label", { className: "text-neutral-content shrink-0 px-1 text-xs", children: "Qty field" }),
|
|
30
|
+
/* @__PURE__ */ e(
|
|
31
|
+
"input",
|
|
32
|
+
{
|
|
33
|
+
type: "text",
|
|
34
|
+
defaultValue: a.quantityField || "",
|
|
35
|
+
onChange: (n) => t({ quantityField: n.target.value || void 0 }),
|
|
36
|
+
placeholder: "input name (overrides static)",
|
|
37
|
+
className: "h-full w-full bg-transparent px-1 text-xs outline-none"
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
] }),
|
|
41
|
+
/* @__PURE__ */ o(x, { children: [
|
|
42
|
+
/* @__PURE__ */ e("label", { className: "text-neutral-content shrink-0 px-1 text-xs", children: "Variant state" }),
|
|
43
|
+
/* @__PURE__ */ e(
|
|
44
|
+
"input",
|
|
45
|
+
{
|
|
46
|
+
type: "text",
|
|
47
|
+
defaultValue: a.variantMatchStateKey || "",
|
|
48
|
+
onChange: (n) => t({ variantMatchStateKey: n.target.value || void 0 }),
|
|
49
|
+
placeholder: "pdp:current:matching-variant",
|
|
50
|
+
className: "h-full w-full bg-transparent px-1 text-xs outline-none"
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] })
|
|
54
|
+
] });
|
|
55
|
+
}
|
|
56
|
+
function ue({
|
|
57
|
+
action: a,
|
|
58
|
+
patch: t
|
|
59
|
+
}) {
|
|
60
|
+
return /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(
|
|
61
|
+
"input",
|
|
62
|
+
{
|
|
63
|
+
type: "text",
|
|
64
|
+
defaultValue: a.text || "",
|
|
65
|
+
onChange: (n) => t({ text: n.target.value }),
|
|
66
|
+
placeholder: "Text to copy...",
|
|
67
|
+
className: "h-full w-full bg-transparent px-1 text-xs outline-none",
|
|
68
|
+
"aria-label": "Text to copy"
|
|
69
|
+
}
|
|
70
|
+
) });
|
|
71
|
+
}
|
|
72
|
+
function he({ action: a, patch: t }) {
|
|
73
|
+
return /* @__PURE__ */ o(m, { children: [
|
|
74
|
+
/* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(
|
|
75
|
+
"input",
|
|
76
|
+
{
|
|
77
|
+
type: "url",
|
|
78
|
+
defaultValue: a.url || "",
|
|
79
|
+
onChange: (n) => t({ url: n.target.value }),
|
|
80
|
+
placeholder: "https://example.com/file.pdf",
|
|
81
|
+
className: "h-full w-full bg-transparent px-1 text-xs outline-none",
|
|
82
|
+
"aria-label": "File URL"
|
|
83
|
+
}
|
|
84
|
+
) }),
|
|
85
|
+
/* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(
|
|
86
|
+
"input",
|
|
87
|
+
{
|
|
88
|
+
type: "text",
|
|
89
|
+
defaultValue: a.filename || "",
|
|
90
|
+
onChange: (n) => t({ filename: n.target.value }),
|
|
91
|
+
placeholder: "Filename (optional)",
|
|
92
|
+
className: "h-full w-full bg-transparent px-1 text-xs outline-none",
|
|
93
|
+
"aria-label": "Download filename"
|
|
94
|
+
}
|
|
95
|
+
) })
|
|
96
|
+
] });
|
|
97
|
+
}
|
|
98
|
+
const ge = ae(function({ onClick: t, open: n = !1, tooltip: l = "Open", className: c = "" }, r) {
|
|
99
|
+
return /* @__PURE__ */ e(
|
|
100
|
+
Y,
|
|
101
|
+
{
|
|
102
|
+
ref: r,
|
|
103
|
+
onClick: (d) => {
|
|
104
|
+
d.stopPropagation(), t == null || t(d);
|
|
105
|
+
},
|
|
106
|
+
"aria-expanded": n,
|
|
107
|
+
ariaLabel: l,
|
|
108
|
+
tooltip: l,
|
|
109
|
+
className: c,
|
|
110
|
+
children: /* @__PURE__ */ e(
|
|
111
|
+
K,
|
|
112
|
+
{
|
|
113
|
+
className: `size-3 transition-transform ${n ? "rotate-180" : ""}`,
|
|
114
|
+
"aria-hidden": !0
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
});
|
|
120
|
+
function me(a) {
|
|
121
|
+
const t = a ?? "";
|
|
122
|
+
if (!t) return { kind: "empty", href: "" };
|
|
123
|
+
if (t.startsWith("ref:")) {
|
|
124
|
+
const n = t.match(/^ref:([^/?#]+)(.*)$/);
|
|
125
|
+
return n ? { kind: "page", href: t, pageId: n[1], path: n[2] || "" } : { kind: "page", href: t, pageId: t.slice(4), path: "" };
|
|
126
|
+
}
|
|
127
|
+
if (t.startsWith("#")) return { kind: "anchor", href: t };
|
|
128
|
+
if (t.startsWith("mailto:")) {
|
|
129
|
+
const n = t.slice(7), l = n.indexOf("?");
|
|
130
|
+
if (l === -1) return { kind: "email", href: t, email: n };
|
|
131
|
+
const c = n.slice(0, l), r = new URLSearchParams(n.slice(l + 1));
|
|
132
|
+
return {
|
|
133
|
+
kind: "email",
|
|
134
|
+
href: t,
|
|
135
|
+
email: c,
|
|
136
|
+
subject: r.get("subject") || "",
|
|
137
|
+
body: r.get("body") || ""
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
return t.startsWith("tel:") ? { kind: "phone", href: t } : { kind: "url", href: t };
|
|
141
|
+
}
|
|
142
|
+
function xe(a, t, n) {
|
|
143
|
+
if (!a) return "";
|
|
144
|
+
const l = new URLSearchParams();
|
|
145
|
+
t && l.set("subject", t), n && l.set("body", n);
|
|
146
|
+
const c = l.toString();
|
|
147
|
+
return `mailto:${a}${c ? `?${c}` : ""}`;
|
|
148
|
+
}
|
|
149
|
+
function fe({ action: a, onChange: t, placeholder: n = "Page or URL..." }) {
|
|
150
|
+
const l = (a == null ? void 0 : a.href) ?? "", c = a == null ? void 0 : a.target, r = ne(() => me(l), [l]), [d, i] = O(l);
|
|
151
|
+
U(() => i(l), [l]);
|
|
152
|
+
const [f, h] = O(!1), C = E(null), k = E(null), { pages: y } = re((s) => {
|
|
153
|
+
var P, S, M, _;
|
|
154
|
+
const g = [], N = s.nodes[se];
|
|
155
|
+
if ((P = N == null ? void 0 : N.data) != null && P.nodes)
|
|
156
|
+
for (const j of N.data.nodes) {
|
|
157
|
+
const F = s.nodes[j];
|
|
158
|
+
((M = (S = F == null ? void 0 : F.data) == null ? void 0 : S.props) == null ? void 0 : M.type) === "page" && g.push({
|
|
159
|
+
id: j,
|
|
160
|
+
displayName: ((_ = F.data.custom) == null ? void 0 : _.displayName) || "Untitled Page"
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
return { pages: g };
|
|
164
|
+
}), v = R("all"), u = r.kind === "page" ? y.find((s) => s.id === r.pageId) : null, p = (s) => {
|
|
165
|
+
t({ type: "link", href: s, ...c ? { target: c } : {} });
|
|
166
|
+
}, b = (s) => {
|
|
167
|
+
t({ type: "link", href: l, ...s ? { target: s } : {} });
|
|
168
|
+
}, T = () => {
|
|
169
|
+
d !== l && p(d);
|
|
170
|
+
}, W = (s) => {
|
|
171
|
+
p(`ref:${s}${r.path ?? ""}`), h(!1);
|
|
172
|
+
}, q = (s) => {
|
|
173
|
+
p(`#${s}`), h(!1);
|
|
174
|
+
}, B = (s) => {
|
|
175
|
+
r.kind !== "page" || !r.pageId || p(`ref:${r.pageId}${s}`);
|
|
176
|
+
}, A = (s, g) => {
|
|
177
|
+
const N = s === "email" ? g : r.email ?? "", P = s === "subject" ? g : r.subject ?? "", S = s === "body" ? g : r.body ?? "";
|
|
178
|
+
p(xe(N, P, S));
|
|
179
|
+
}, I = r.kind === "email" ? G : r.kind === "phone" ? J : r.kind === "anchor" ? z : r.kind === "page" ? H : X, L = r.kind === "page", Q = L && u ? u.displayName : d;
|
|
180
|
+
return /* @__PURE__ */ o("div", { className: "link-input flex flex-col gap-2", children: [
|
|
181
|
+
/* @__PURE__ */ e(
|
|
182
|
+
x,
|
|
183
|
+
{
|
|
184
|
+
onClick: () => h((s) => !s),
|
|
185
|
+
trailing: /* @__PURE__ */ o(m, { children: [
|
|
186
|
+
l && /* @__PURE__ */ e(Z, { onClick: () => p(""), tooltip: "Clear link" }),
|
|
187
|
+
/* @__PURE__ */ e(
|
|
188
|
+
ge,
|
|
189
|
+
{
|
|
190
|
+
ref: C,
|
|
191
|
+
open: f,
|
|
192
|
+
onClick: () => h((s) => !s),
|
|
193
|
+
tooltip: "Pick page or anchor"
|
|
194
|
+
}
|
|
195
|
+
)
|
|
196
|
+
] }),
|
|
197
|
+
children: /* @__PURE__ */ o("div", { ref: k, className: "flex h-full min-w-0 flex-1 items-center gap-1.5", children: [
|
|
198
|
+
/* @__PURE__ */ e(I, { className: "text-neutral-content size-3.5 shrink-0", "aria-hidden": !0 }),
|
|
199
|
+
/* @__PURE__ */ e(
|
|
200
|
+
"input",
|
|
201
|
+
{
|
|
202
|
+
id: "ph-link-input",
|
|
203
|
+
type: "text",
|
|
204
|
+
value: L ? Q : d,
|
|
205
|
+
readOnly: L,
|
|
206
|
+
onChange: (s) => i(s.target.value),
|
|
207
|
+
onBlur: T,
|
|
208
|
+
onClick: (s) => s.stopPropagation(),
|
|
209
|
+
onFocus: () => h(!0),
|
|
210
|
+
onKeyDown: (s) => {
|
|
211
|
+
s.key === "Enter" ? (s.preventDefault(), T()) : s.key === "Escape" && i(l);
|
|
212
|
+
},
|
|
213
|
+
placeholder: n,
|
|
214
|
+
className: "h-full flex-1 bg-transparent px-1 text-xs outline-none",
|
|
215
|
+
"aria-label": "Link destination"
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
] })
|
|
219
|
+
}
|
|
220
|
+
),
|
|
221
|
+
/* @__PURE__ */ o(
|
|
222
|
+
le,
|
|
223
|
+
{
|
|
224
|
+
open: f,
|
|
225
|
+
onOpenChange: h,
|
|
226
|
+
anchor: k,
|
|
227
|
+
placement: "bottom-start",
|
|
228
|
+
matchAnchorWidth: { min: 240, max: 480 },
|
|
229
|
+
ignoreOutsideClicks: [k],
|
|
230
|
+
className: "pagehub-sdk-root ph-select-content max-h-64 overflow-y-auto",
|
|
231
|
+
children: [
|
|
232
|
+
y.length > 0 && /* @__PURE__ */ o(m, { children: [
|
|
233
|
+
/* @__PURE__ */ e("div", { className: "ph-select-group text-base-content px-2 pt-1 pb-1.5 font-bold", children: "Pages" }),
|
|
234
|
+
y.map((s) => {
|
|
235
|
+
const g = r.pageId === s.id;
|
|
236
|
+
return /* @__PURE__ */ o(
|
|
237
|
+
"button",
|
|
238
|
+
{
|
|
239
|
+
type: "button",
|
|
240
|
+
onClick: () => W(s.id),
|
|
241
|
+
"data-selected": g || void 0,
|
|
242
|
+
className: "ph-select-item data-selected:bg-primary data-selected:text-primary-content",
|
|
243
|
+
children: [
|
|
244
|
+
/* @__PURE__ */ e(H, { className: "size-3.5 shrink-0 opacity-70" }),
|
|
245
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: s.displayName })
|
|
246
|
+
]
|
|
247
|
+
},
|
|
248
|
+
s.id
|
|
249
|
+
);
|
|
250
|
+
})
|
|
251
|
+
] }),
|
|
252
|
+
v.length > 0 && /* @__PURE__ */ o(m, { children: [
|
|
253
|
+
/* @__PURE__ */ e(
|
|
254
|
+
"div",
|
|
255
|
+
{
|
|
256
|
+
className: `ph-select-group text-base-content px-2 pb-1.5 font-bold ${y.length > 0 ? "pt-2" : "pt-1"}`,
|
|
257
|
+
children: "Anchors"
|
|
258
|
+
}
|
|
259
|
+
),
|
|
260
|
+
v.map((s) => {
|
|
261
|
+
const g = r.kind === "anchor" && l === `#${s.anchor}`;
|
|
262
|
+
return /* @__PURE__ */ o(
|
|
263
|
+
"button",
|
|
264
|
+
{
|
|
265
|
+
type: "button",
|
|
266
|
+
onClick: () => q(s.anchor),
|
|
267
|
+
"data-selected": g || void 0,
|
|
268
|
+
className: "ph-select-item data-selected:bg-primary data-selected:text-primary-content",
|
|
269
|
+
children: [
|
|
270
|
+
/* @__PURE__ */ e(z, { className: "size-3.5 shrink-0 opacity-70" }),
|
|
271
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: s.label }),
|
|
272
|
+
/* @__PURE__ */ o("span", { className: "text-neutral-content ml-auto truncate font-mono text-[10px]", children: [
|
|
273
|
+
"#",
|
|
274
|
+
s.anchor
|
|
275
|
+
] })
|
|
276
|
+
]
|
|
277
|
+
},
|
|
278
|
+
s.nodeId
|
|
279
|
+
);
|
|
280
|
+
})
|
|
281
|
+
] }),
|
|
282
|
+
y.length === 0 && v.length === 0 && /* @__PURE__ */ e("div", { className: "text-neutral-content px-3 py-3 text-xs", children: "No pages or anchors found. Type a URL above." })
|
|
283
|
+
]
|
|
284
|
+
}
|
|
285
|
+
),
|
|
286
|
+
r.kind === "page" && /* @__PURE__ */ e(
|
|
287
|
+
"input",
|
|
288
|
+
{
|
|
289
|
+
type: "text",
|
|
290
|
+
value: r.path ?? "",
|
|
291
|
+
onChange: (s) => B(s.target.value),
|
|
292
|
+
placeholder: "Path (optional, e.g. /{{item.slug}})",
|
|
293
|
+
className: "input-plain w-full",
|
|
294
|
+
"aria-label": "Page path suffix"
|
|
295
|
+
}
|
|
296
|
+
),
|
|
297
|
+
r.kind === "email" && /* @__PURE__ */ o(m, { children: [
|
|
298
|
+
/* @__PURE__ */ e(
|
|
299
|
+
"input",
|
|
300
|
+
{
|
|
301
|
+
type: "email",
|
|
302
|
+
value: r.email ?? "",
|
|
303
|
+
onChange: (s) => A("email", s.target.value),
|
|
304
|
+
placeholder: "hello@example.com",
|
|
305
|
+
className: "input-plain w-full",
|
|
306
|
+
"aria-label": "Email address"
|
|
307
|
+
}
|
|
308
|
+
),
|
|
309
|
+
/* @__PURE__ */ e(
|
|
310
|
+
"input",
|
|
311
|
+
{
|
|
312
|
+
type: "text",
|
|
313
|
+
value: r.subject ?? "",
|
|
314
|
+
onChange: (s) => A("subject", s.target.value),
|
|
315
|
+
placeholder: "Subject (optional)",
|
|
316
|
+
className: "input-plain w-full",
|
|
317
|
+
"aria-label": "Email subject"
|
|
318
|
+
}
|
|
319
|
+
),
|
|
320
|
+
/* @__PURE__ */ e(
|
|
321
|
+
"input",
|
|
322
|
+
{
|
|
323
|
+
type: "text",
|
|
324
|
+
value: r.body ?? "",
|
|
325
|
+
onChange: (s) => A("body", s.target.value),
|
|
326
|
+
placeholder: "Body (optional)",
|
|
327
|
+
className: "input-plain w-full",
|
|
328
|
+
"aria-label": "Email body"
|
|
329
|
+
}
|
|
330
|
+
)
|
|
331
|
+
] }),
|
|
332
|
+
(r.kind === "url" || r.kind === "page") && /* @__PURE__ */ e(
|
|
333
|
+
ee,
|
|
334
|
+
{
|
|
335
|
+
"aria-label": "Link target",
|
|
336
|
+
value: c || "_self",
|
|
337
|
+
onChange: b,
|
|
338
|
+
options: [
|
|
339
|
+
{ value: "_self", label: "Same tab" },
|
|
340
|
+
{ value: "_blank", label: "New tab" }
|
|
341
|
+
]
|
|
342
|
+
}
|
|
343
|
+
)
|
|
344
|
+
] });
|
|
345
|
+
}
|
|
346
|
+
function be({
|
|
347
|
+
action: a,
|
|
348
|
+
replace: t
|
|
349
|
+
}) {
|
|
350
|
+
return /* @__PURE__ */ e(fe, { action: a, onChange: t });
|
|
351
|
+
}
|
|
352
|
+
function ye({
|
|
353
|
+
action: a,
|
|
354
|
+
patch: t
|
|
355
|
+
}) {
|
|
356
|
+
return /* @__PURE__ */ o("div", { className: "flex flex-col gap-2", children: [
|
|
357
|
+
/* @__PURE__ */ o("p", { className: "text-neutral-content text-[10px] leading-snug", children: [
|
|
358
|
+
"Writes ",
|
|
359
|
+
/* @__PURE__ */ e("code", { className: "text-[9px]", children: "key" }),
|
|
360
|
+
" → ",
|
|
361
|
+
/* @__PURE__ */ e("code", { className: "text-[9px]", children: "value" }),
|
|
362
|
+
" ",
|
|
363
|
+
"to ",
|
|
364
|
+
/* @__PURE__ */ e("code", { className: "text-[9px]", children: "window.localStorage" }),
|
|
365
|
+
" when the button is clicked. Pairs with a load-trigger Show / Hide action whose Local Storage condition watches the same key — once the key is set, the target stays hidden on subsequent visits."
|
|
366
|
+
] }),
|
|
367
|
+
/* @__PURE__ */ o("label", { className: "flex flex-col gap-1 text-[10px]", children: [
|
|
368
|
+
/* @__PURE__ */ e("span", { className: "text-neutral-content", children: "Key" }),
|
|
369
|
+
/* @__PURE__ */ e(
|
|
370
|
+
"input",
|
|
371
|
+
{
|
|
372
|
+
className: "bg-base-100 border-base-300 rounded-field border px-2 py-1 text-xs",
|
|
373
|
+
value: a.key || "",
|
|
374
|
+
onChange: (n) => t({ key: n.target.value }),
|
|
375
|
+
placeholder: "ph-cookie-consent"
|
|
376
|
+
}
|
|
377
|
+
)
|
|
378
|
+
] }),
|
|
379
|
+
/* @__PURE__ */ o("label", { className: "flex flex-col gap-1 text-[10px]", children: [
|
|
380
|
+
/* @__PURE__ */ e("span", { className: "text-neutral-content", children: "Value" }),
|
|
381
|
+
/* @__PURE__ */ e(
|
|
382
|
+
"input",
|
|
383
|
+
{
|
|
384
|
+
className: "bg-base-100 border-base-300 rounded-field border px-2 py-1 text-xs",
|
|
385
|
+
value: a.value || "",
|
|
386
|
+
onChange: (n) => t({ value: n.target.value }),
|
|
387
|
+
placeholder: "dismissed"
|
|
388
|
+
}
|
|
389
|
+
)
|
|
390
|
+
] })
|
|
391
|
+
] });
|
|
392
|
+
}
|
|
393
|
+
function ve({
|
|
394
|
+
action: a,
|
|
395
|
+
patch: t
|
|
396
|
+
}) {
|
|
397
|
+
return /* @__PURE__ */ o("div", { className: "flex flex-col gap-2", children: [
|
|
398
|
+
/* @__PURE__ */ o("p", { className: "text-neutral-content text-[10px] leading-snug", children: [
|
|
399
|
+
"Clears the ",
|
|
400
|
+
/* @__PURE__ */ e("code", { className: "text-[9px]", children: "key" }),
|
|
401
|
+
" from",
|
|
402
|
+
" ",
|
|
403
|
+
/* @__PURE__ */ e("code", { className: "text-[9px]", children: "window.localStorage" }),
|
|
404
|
+
' — useful for "show this banner again" links.'
|
|
405
|
+
] }),
|
|
406
|
+
/* @__PURE__ */ o("label", { className: "flex flex-col gap-1 text-[10px]", children: [
|
|
407
|
+
/* @__PURE__ */ e("span", { className: "text-neutral-content", children: "Key" }),
|
|
408
|
+
/* @__PURE__ */ e(
|
|
409
|
+
"input",
|
|
410
|
+
{
|
|
411
|
+
className: "bg-base-100 border-base-300 rounded-field border px-2 py-1 text-xs",
|
|
412
|
+
value: a.key || "",
|
|
413
|
+
onChange: (n) => t({ key: n.target.value }),
|
|
414
|
+
placeholder: "ph-cookie-consent"
|
|
415
|
+
}
|
|
416
|
+
)
|
|
417
|
+
] })
|
|
418
|
+
] });
|
|
419
|
+
}
|
|
420
|
+
const Ne = ce.map((a) => ({
|
|
421
|
+
id: a.value,
|
|
422
|
+
label: a.label,
|
|
423
|
+
data: a.value
|
|
424
|
+
}));
|
|
425
|
+
function ke({ value: a, onChange: t }) {
|
|
426
|
+
var v;
|
|
427
|
+
const n = Array.isArray(a) ? a : [], l = ((v = n[0]) == null ? void 0 : v.conditions) ?? [], c = n.slice(1), r = (u) => {
|
|
428
|
+
if (u.length === 0 && c.length === 0) {
|
|
429
|
+
t([]);
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
t([{ conditions: u, logic: "all" }, ...c]);
|
|
433
|
+
}, d = (u, p) => {
|
|
434
|
+
r(l.map((b, T) => T === u ? { ...b, ...p } : b));
|
|
435
|
+
}, i = (u) => {
|
|
436
|
+
r(l.filter((p, b) => b !== u));
|
|
437
|
+
}, f = E(l.length), [h, C] = O(null);
|
|
438
|
+
U(() => {
|
|
439
|
+
l.length > f.current && C(l.length - 1), f.current = l.length;
|
|
440
|
+
}, [l.length]);
|
|
441
|
+
const k = () => C(null), y = (u) => {
|
|
442
|
+
u.data && r([...l, ie(u.data)]);
|
|
443
|
+
};
|
|
444
|
+
return /* @__PURE__ */ o("div", { className: "flex flex-col gap-1", children: [
|
|
445
|
+
l.map((u, p) => /* @__PURE__ */ e(
|
|
446
|
+
oe,
|
|
447
|
+
{
|
|
448
|
+
cond: u,
|
|
449
|
+
autoOpen: p === h,
|
|
450
|
+
onAutoOpenConsumed: k,
|
|
451
|
+
onChange: (b) => d(p, b),
|
|
452
|
+
onRemove: () => i(p)
|
|
453
|
+
},
|
|
454
|
+
p
|
|
455
|
+
)),
|
|
456
|
+
/* @__PURE__ */ e(
|
|
457
|
+
V,
|
|
458
|
+
{
|
|
459
|
+
items: Ne,
|
|
460
|
+
onSelect: y,
|
|
461
|
+
triggerClassName: "text-neutral-content hover:bg-base-200 hover:text-base-content border-base-300 flex w-full items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-dashed px-2 py-1.5 text-[11px] transition-colors",
|
|
462
|
+
trigger: /* @__PURE__ */ o(m, { children: [
|
|
463
|
+
/* @__PURE__ */ e(te, { className: "size-3.5 shrink-0", "aria-hidden": !0 }),
|
|
464
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: l.length === 0 ? "Only fire if…" : "Add condition" })
|
|
465
|
+
] }),
|
|
466
|
+
triggerAriaLabel: "Add condition",
|
|
467
|
+
searchPlaceholder: "Search conditions…",
|
|
468
|
+
anchor: "bottom start",
|
|
469
|
+
panelWidthClass: "w-56"
|
|
470
|
+
}
|
|
471
|
+
)
|
|
472
|
+
] });
|
|
473
|
+
}
|
|
474
|
+
function $({
|
|
475
|
+
value: a,
|
|
476
|
+
filter: t,
|
|
477
|
+
label: n,
|
|
478
|
+
onChange: l
|
|
479
|
+
}) {
|
|
480
|
+
const r = R(t).map((i) => ({
|
|
481
|
+
id: i.anchor,
|
|
482
|
+
label: i.label,
|
|
483
|
+
hint: i.anchor,
|
|
484
|
+
keywords: [i.anchor, i.componentType],
|
|
485
|
+
data: i.anchor
|
|
486
|
+
})), d = n.toLowerCase();
|
|
487
|
+
return /* @__PURE__ */ e(
|
|
488
|
+
x,
|
|
489
|
+
{
|
|
490
|
+
trailing: /* @__PURE__ */ e(
|
|
491
|
+
V,
|
|
492
|
+
{
|
|
493
|
+
items: r,
|
|
494
|
+
onSelect: (i) => l(i.data ?? i.id),
|
|
495
|
+
trigger: /* @__PURE__ */ e(K, { className: "size-3.5", "aria-hidden": !0 }),
|
|
496
|
+
triggerAriaLabel: `Pick ${d} from page`,
|
|
497
|
+
triggerClassName: "text-neutral-content hover:text-base-content hover:bg-base-200 flex size-5 shrink-0 items-center justify-center rounded-md transition-colors",
|
|
498
|
+
searchPlaceholder: `Search ${d}…`,
|
|
499
|
+
emptyMessage: `No ${d}s on this page yet`,
|
|
500
|
+
anchor: "bottom end"
|
|
501
|
+
}
|
|
502
|
+
),
|
|
503
|
+
children: /* @__PURE__ */ e(
|
|
504
|
+
"input",
|
|
505
|
+
{
|
|
506
|
+
type: "text",
|
|
507
|
+
value: a || "",
|
|
508
|
+
onChange: (i) => l(i.target.value),
|
|
509
|
+
placeholder: `${n} id…`,
|
|
510
|
+
className: "h-full w-full bg-transparent px-1 text-xs outline-none",
|
|
511
|
+
"aria-label": n
|
|
512
|
+
}
|
|
513
|
+
)
|
|
514
|
+
}
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
function we({
|
|
518
|
+
action: a,
|
|
519
|
+
patch: t
|
|
520
|
+
}) {
|
|
521
|
+
const n = a.trigger === "load";
|
|
522
|
+
return /* @__PURE__ */ o(m, { children: [
|
|
523
|
+
/* @__PURE__ */ o("div", { className: "flex items-stretch gap-2", children: [
|
|
524
|
+
/* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ e(
|
|
525
|
+
$,
|
|
526
|
+
{
|
|
527
|
+
value: a.target,
|
|
528
|
+
filter: "all",
|
|
529
|
+
label: "Target",
|
|
530
|
+
onChange: (l) => t({ target: l })
|
|
531
|
+
}
|
|
532
|
+
) }),
|
|
533
|
+
/* @__PURE__ */ e(de, { target: a.target })
|
|
534
|
+
] }),
|
|
535
|
+
/* @__PURE__ */ o("div", { className: "flex gap-2", children: [
|
|
536
|
+
/* @__PURE__ */ o(
|
|
537
|
+
w,
|
|
538
|
+
{
|
|
539
|
+
value: a.direction || "toggle",
|
|
540
|
+
onChange: (l) => t({ direction: l }),
|
|
541
|
+
propKey: "actionDirection",
|
|
542
|
+
children: [
|
|
543
|
+
/* @__PURE__ */ e("option", { value: "toggle", children: "Toggle" }),
|
|
544
|
+
/* @__PURE__ */ e("option", { value: "show", children: "Show" }),
|
|
545
|
+
/* @__PURE__ */ e("option", { value: "hide", children: "Hide" }),
|
|
546
|
+
/* @__PURE__ */ e("option", { value: "tab", children: "Tab" })
|
|
547
|
+
]
|
|
548
|
+
}
|
|
549
|
+
),
|
|
550
|
+
/* @__PURE__ */ o(
|
|
551
|
+
w,
|
|
552
|
+
{
|
|
553
|
+
value: a.trigger || "click",
|
|
554
|
+
onChange: (l) => t({ trigger: l }),
|
|
555
|
+
propKey: "actionTrigger",
|
|
556
|
+
children: [
|
|
557
|
+
/* @__PURE__ */ e("option", { value: "click", children: "On Click" }),
|
|
558
|
+
/* @__PURE__ */ e("option", { value: "hover", children: "On Hover" }),
|
|
559
|
+
/* @__PURE__ */ e("option", { value: "load", children: "On Load" })
|
|
560
|
+
]
|
|
561
|
+
}
|
|
562
|
+
)
|
|
563
|
+
] }),
|
|
564
|
+
n && /* @__PURE__ */ e(
|
|
565
|
+
ke,
|
|
566
|
+
{
|
|
567
|
+
value: a.conditions,
|
|
568
|
+
onChange: (l) => t({ conditions: l })
|
|
569
|
+
}
|
|
570
|
+
)
|
|
571
|
+
] });
|
|
572
|
+
}
|
|
573
|
+
function D({
|
|
574
|
+
value: a,
|
|
575
|
+
selfId: t,
|
|
576
|
+
ensureSelfId: n,
|
|
577
|
+
onChange: l
|
|
578
|
+
}) {
|
|
579
|
+
const c = R("all"), r = "__ph_self__", d = [];
|
|
580
|
+
(n || t) && d.push({
|
|
581
|
+
id: r,
|
|
582
|
+
label: "This element (self)",
|
|
583
|
+
hint: t || "stamps an id when picked",
|
|
584
|
+
keywords: ["self", "this", t || ""],
|
|
585
|
+
data: r
|
|
586
|
+
});
|
|
587
|
+
for (const i of c)
|
|
588
|
+
t && i.anchor === t || d.push({
|
|
589
|
+
id: i.anchor,
|
|
590
|
+
label: i.label,
|
|
591
|
+
hint: i.anchor,
|
|
592
|
+
keywords: [i.anchor, i.componentType],
|
|
593
|
+
data: i.anchor
|
|
594
|
+
});
|
|
595
|
+
return /* @__PURE__ */ e(
|
|
596
|
+
x,
|
|
597
|
+
{
|
|
598
|
+
trailing: /* @__PURE__ */ e(
|
|
599
|
+
V,
|
|
600
|
+
{
|
|
601
|
+
items: d,
|
|
602
|
+
onSelect: (i) => {
|
|
603
|
+
const f = i.data ?? i.id;
|
|
604
|
+
if (f === r) {
|
|
605
|
+
const h = (n == null ? void 0 : n()) ?? t;
|
|
606
|
+
h && l(h);
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
l(f);
|
|
610
|
+
},
|
|
611
|
+
trigger: /* @__PURE__ */ e(K, { className: "size-3.5", "aria-hidden": !0 }),
|
|
612
|
+
triggerAriaLabel: "Pick state key from page",
|
|
613
|
+
triggerClassName: "text-neutral-content hover:text-base-content hover:bg-base-200 flex size-5 shrink-0 items-center justify-center rounded-md transition-colors",
|
|
614
|
+
searchPlaceholder: "Search elements…",
|
|
615
|
+
emptyMessage: "No element ids on this page yet",
|
|
616
|
+
anchor: "bottom end"
|
|
617
|
+
}
|
|
618
|
+
),
|
|
619
|
+
children: /* @__PURE__ */ e(
|
|
620
|
+
"input",
|
|
621
|
+
{
|
|
622
|
+
type: "text",
|
|
623
|
+
value: a || "",
|
|
624
|
+
onChange: (i) => l(i.target.value),
|
|
625
|
+
placeholder: "Element id or named state…",
|
|
626
|
+
className: "h-full w-full bg-transparent px-1 text-xs outline-none",
|
|
627
|
+
"aria-label": "State key"
|
|
628
|
+
}
|
|
629
|
+
)
|
|
630
|
+
}
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
function Ce({
|
|
634
|
+
action: a,
|
|
635
|
+
patch: t,
|
|
636
|
+
selfId: n,
|
|
637
|
+
ensureSelfId: l
|
|
638
|
+
}) {
|
|
639
|
+
return /* @__PURE__ */ o("div", { className: "flex flex-col gap-2", children: [
|
|
640
|
+
/* @__PURE__ */ o("p", { className: "text-neutral-content text-[10px] leading-snug", children: [
|
|
641
|
+
"Writes ",
|
|
642
|
+
/* @__PURE__ */ e("code", { className: "text-[9px]", children: "key" }),
|
|
643
|
+
" → ",
|
|
644
|
+
/* @__PURE__ */ e("code", { className: "text-[9px]", children: "value" }),
|
|
645
|
+
" ",
|
|
646
|
+
"to the central state registry. Pair with a State condition (visibility / className gating) elsewhere on the page to react."
|
|
647
|
+
] }),
|
|
648
|
+
l && /* @__PURE__ */ e(
|
|
649
|
+
"button",
|
|
650
|
+
{
|
|
651
|
+
type: "button",
|
|
652
|
+
onClick: () => {
|
|
653
|
+
const r = (l == null ? void 0 : l()) ?? n;
|
|
654
|
+
r && t({ key: r, value: r });
|
|
655
|
+
},
|
|
656
|
+
className: "text-primary hover:bg-base-200 self-start rounded-md px-2 py-1 text-[10px] font-medium transition-colors",
|
|
657
|
+
children: "Use this element for key + value"
|
|
658
|
+
}
|
|
659
|
+
),
|
|
660
|
+
/* @__PURE__ */ o("label", { className: "flex flex-col gap-1 text-[10px]", children: [
|
|
661
|
+
/* @__PURE__ */ e("span", { className: "text-neutral-content", children: "Key" }),
|
|
662
|
+
/* @__PURE__ */ e(
|
|
663
|
+
D,
|
|
664
|
+
{
|
|
665
|
+
value: a.key || "",
|
|
666
|
+
selfId: n,
|
|
667
|
+
ensureSelfId: l,
|
|
668
|
+
onChange: (r) => t({ key: r })
|
|
669
|
+
}
|
|
670
|
+
)
|
|
671
|
+
] }),
|
|
672
|
+
/* @__PURE__ */ o("label", { className: "flex flex-col gap-1 text-[10px]", children: [
|
|
673
|
+
/* @__PURE__ */ e("span", { className: "text-neutral-content", children: "Kind" }),
|
|
674
|
+
/* @__PURE__ */ o(
|
|
675
|
+
w,
|
|
676
|
+
{
|
|
677
|
+
value: a.kind || "value",
|
|
678
|
+
onChange: (r) => t({ kind: r }),
|
|
679
|
+
propKey: "setStateKind",
|
|
680
|
+
children: [
|
|
681
|
+
/* @__PURE__ */ e("option", { value: "value", children: "Value" }),
|
|
682
|
+
/* @__PURE__ */ e("option", { value: "visibility", children: "Visibility" }),
|
|
683
|
+
/* @__PURE__ */ e("option", { value: "selection", children: "Selection" }),
|
|
684
|
+
/* @__PURE__ */ e("option", { value: "flag", children: "Flag" })
|
|
685
|
+
]
|
|
686
|
+
}
|
|
687
|
+
)
|
|
688
|
+
] }),
|
|
689
|
+
/* @__PURE__ */ o("label", { className: "flex flex-col gap-1 text-[10px]", children: [
|
|
690
|
+
/* @__PURE__ */ e("span", { className: "text-neutral-content", children: "Value" }),
|
|
691
|
+
/* @__PURE__ */ e(
|
|
692
|
+
"input",
|
|
693
|
+
{
|
|
694
|
+
className: "bg-base-100 border-base-300 rounded-field border px-2 py-1 text-xs",
|
|
695
|
+
value: a.value || "",
|
|
696
|
+
onChange: (r) => t({ value: r.target.value }),
|
|
697
|
+
placeholder: '"shown" / "panel-1" / "{{item.id}}"'
|
|
698
|
+
}
|
|
699
|
+
)
|
|
700
|
+
] })
|
|
701
|
+
] });
|
|
702
|
+
}
|
|
703
|
+
function Te({
|
|
704
|
+
action: a,
|
|
705
|
+
patch: t,
|
|
706
|
+
selfId: n,
|
|
707
|
+
ensureSelfId: l
|
|
708
|
+
}) {
|
|
709
|
+
const c = Array.isArray(a.values) ? a.values : ["", ""];
|
|
710
|
+
return /* @__PURE__ */ o("div", { className: "flex flex-col gap-2", children: [
|
|
711
|
+
/* @__PURE__ */ o("p", { className: "text-neutral-content text-[10px] leading-snug", children: [
|
|
712
|
+
"Flips a state between two values on click. Defaults: visibility kind toggles",
|
|
713
|
+
" ",
|
|
714
|
+
/* @__PURE__ */ e("code", { className: "text-[9px]", children: "shown / hidden" }),
|
|
715
|
+
"; flag kind toggles",
|
|
716
|
+
" ",
|
|
717
|
+
/* @__PURE__ */ e("code", { className: "text-[9px]", children: "on / off" }),
|
|
718
|
+
". Override with explicit values."
|
|
719
|
+
] }),
|
|
720
|
+
/* @__PURE__ */ o("label", { className: "flex flex-col gap-1 text-[10px]", children: [
|
|
721
|
+
/* @__PURE__ */ e("span", { className: "text-neutral-content", children: "Key" }),
|
|
722
|
+
/* @__PURE__ */ e(
|
|
723
|
+
D,
|
|
724
|
+
{
|
|
725
|
+
value: a.key || "",
|
|
726
|
+
selfId: n,
|
|
727
|
+
ensureSelfId: l,
|
|
728
|
+
onChange: (r) => t({ key: r })
|
|
729
|
+
}
|
|
730
|
+
)
|
|
731
|
+
] }),
|
|
732
|
+
/* @__PURE__ */ o("label", { className: "flex flex-col gap-1 text-[10px]", children: [
|
|
733
|
+
/* @__PURE__ */ e("span", { className: "text-neutral-content", children: "Kind" }),
|
|
734
|
+
/* @__PURE__ */ o(
|
|
735
|
+
w,
|
|
736
|
+
{
|
|
737
|
+
value: a.kind || "flag",
|
|
738
|
+
onChange: (r) => t({ kind: r }),
|
|
739
|
+
propKey: "toggleStateKind",
|
|
740
|
+
children: [
|
|
741
|
+
/* @__PURE__ */ e("option", { value: "flag", children: "Flag" }),
|
|
742
|
+
/* @__PURE__ */ e("option", { value: "visibility", children: "Visibility" }),
|
|
743
|
+
/* @__PURE__ */ e("option", { value: "value", children: "Value" })
|
|
744
|
+
]
|
|
745
|
+
}
|
|
746
|
+
)
|
|
747
|
+
] }),
|
|
748
|
+
/* @__PURE__ */ o("div", { className: "flex gap-2", children: [
|
|
749
|
+
/* @__PURE__ */ o("label", { className: "flex flex-1 flex-col gap-1 text-[10px]", children: [
|
|
750
|
+
/* @__PURE__ */ e("span", { className: "text-neutral-content", children: "Value A" }),
|
|
751
|
+
/* @__PURE__ */ e(
|
|
752
|
+
"input",
|
|
753
|
+
{
|
|
754
|
+
className: "bg-base-100 border-base-300 rounded-field border px-2 py-1 text-xs",
|
|
755
|
+
value: c[0],
|
|
756
|
+
onChange: (r) => t({ values: [r.target.value, c[1]] }),
|
|
757
|
+
placeholder: "optional"
|
|
758
|
+
}
|
|
759
|
+
)
|
|
760
|
+
] }),
|
|
761
|
+
/* @__PURE__ */ o("label", { className: "flex flex-1 flex-col gap-1 text-[10px]", children: [
|
|
762
|
+
/* @__PURE__ */ e("span", { className: "text-neutral-content", children: "Value B" }),
|
|
763
|
+
/* @__PURE__ */ e(
|
|
764
|
+
"input",
|
|
765
|
+
{
|
|
766
|
+
className: "bg-base-100 border-base-300 rounded-field border px-2 py-1 text-xs",
|
|
767
|
+
value: c[1],
|
|
768
|
+
onChange: (r) => t({ values: [c[0], r.target.value] }),
|
|
769
|
+
placeholder: "optional"
|
|
770
|
+
}
|
|
771
|
+
)
|
|
772
|
+
] })
|
|
773
|
+
] })
|
|
774
|
+
] });
|
|
775
|
+
}
|
|
776
|
+
function Pe({
|
|
777
|
+
action: a,
|
|
778
|
+
patch: t,
|
|
779
|
+
selfId: n,
|
|
780
|
+
ensureSelfId: l
|
|
781
|
+
}) {
|
|
782
|
+
return /* @__PURE__ */ o("div", { className: "flex flex-col gap-2", children: [
|
|
783
|
+
/* @__PURE__ */ e("p", { className: "text-neutral-content text-[10px] leading-snug", children: 'Removes the state entry entirely. Useful for "reset to default" buttons.' }),
|
|
784
|
+
/* @__PURE__ */ o("label", { className: "flex flex-col gap-1 text-[10px]", children: [
|
|
785
|
+
/* @__PURE__ */ e("span", { className: "text-neutral-content", children: "Key" }),
|
|
786
|
+
/* @__PURE__ */ e(
|
|
787
|
+
D,
|
|
788
|
+
{
|
|
789
|
+
value: a.key || "",
|
|
790
|
+
selfId: n,
|
|
791
|
+
ensureSelfId: l,
|
|
792
|
+
onChange: (c) => t({ key: c })
|
|
793
|
+
}
|
|
794
|
+
)
|
|
795
|
+
] })
|
|
796
|
+
] });
|
|
797
|
+
}
|
|
798
|
+
function Se({
|
|
799
|
+
action: a,
|
|
800
|
+
patch: t
|
|
801
|
+
}) {
|
|
802
|
+
return /* @__PURE__ */ o(m, { children: [
|
|
803
|
+
/* @__PURE__ */ o("p", { className: "text-neutral-content text-[10px] leading-snug", children: [
|
|
804
|
+
"Toggles the site light/dark preference (stored in",
|
|
805
|
+
" ",
|
|
806
|
+
/* @__PURE__ */ e("code", { className: "text-[9px]", children: "ph-theme" }),
|
|
807
|
+
", same as the editor chrome)."
|
|
808
|
+
] }),
|
|
809
|
+
/* @__PURE__ */ e(
|
|
810
|
+
$,
|
|
811
|
+
{
|
|
812
|
+
value: a.dismissTarget || "",
|
|
813
|
+
filter: "all",
|
|
814
|
+
label: "Dismiss target (optional)",
|
|
815
|
+
onChange: (n) => t({ dismissTarget: n || void 0 })
|
|
816
|
+
}
|
|
817
|
+
),
|
|
818
|
+
a.dismissTarget ? /* @__PURE__ */ o(
|
|
819
|
+
w,
|
|
820
|
+
{
|
|
821
|
+
value: a.dismissMethod || "style",
|
|
822
|
+
onChange: (n) => t({ dismissMethod: n }),
|
|
823
|
+
propKey: "toggleThemeDismissMethod",
|
|
824
|
+
children: [
|
|
825
|
+
/* @__PURE__ */ e("option", { value: "style", children: "Hide: style (display:none)" }),
|
|
826
|
+
/* @__PURE__ */ e("option", { value: "class", children: "Hide: .hidden class" })
|
|
827
|
+
]
|
|
828
|
+
}
|
|
829
|
+
) : null
|
|
830
|
+
] });
|
|
831
|
+
}
|
|
832
|
+
const Me = {
|
|
833
|
+
link: { type: "link", href: "" },
|
|
834
|
+
"open-modal": { type: "open-modal", anchor: "" },
|
|
835
|
+
"show-hide": { type: "show-hide", target: "", direction: "toggle", trigger: "click" },
|
|
836
|
+
"copy-to-clipboard": { type: "copy-to-clipboard", text: "" },
|
|
837
|
+
"download-file": { type: "download-file", url: "" },
|
|
838
|
+
"toggle-theme": { type: "toggle-theme" },
|
|
839
|
+
"add-to-cart": { type: "add-to-cart" },
|
|
840
|
+
"toggle-cart": { type: "toggle-cart" },
|
|
841
|
+
"cart-checkout": { type: "cart-checkout" },
|
|
842
|
+
"manage-subscription": { type: "manage-subscription" },
|
|
843
|
+
"agent-send": { type: "agent-send", field: "agentMessage" },
|
|
844
|
+
"set-local-storage": { type: "set-local-storage", key: "", value: "" },
|
|
845
|
+
"remove-local-storage": { type: "remove-local-storage", key: "" },
|
|
846
|
+
"set-state": { type: "set-state", key: "", value: "" },
|
|
847
|
+
"toggle-state": { type: "toggle-state", key: "" },
|
|
848
|
+
"clear-state": { type: "clear-state", key: "" },
|
|
849
|
+
"increment-state": { type: "increment-state", key: "", step: 1 },
|
|
850
|
+
"decrement-state": { type: "decrement-state", key: "", step: 1 }
|
|
851
|
+
};
|
|
852
|
+
function _e({
|
|
853
|
+
action: a,
|
|
854
|
+
patch: t,
|
|
855
|
+
replace: n,
|
|
856
|
+
selfId: l,
|
|
857
|
+
ensureSelfId: c
|
|
858
|
+
}) {
|
|
859
|
+
switch (a.type) {
|
|
860
|
+
case "link":
|
|
861
|
+
return /* @__PURE__ */ e(be, { action: a, replace: n });
|
|
862
|
+
case "open-modal":
|
|
863
|
+
return /* @__PURE__ */ e(
|
|
864
|
+
$,
|
|
865
|
+
{
|
|
866
|
+
value: a.anchor,
|
|
867
|
+
filter: "modal",
|
|
868
|
+
label: "Modal",
|
|
869
|
+
onChange: (r) => t({ anchor: r })
|
|
870
|
+
}
|
|
871
|
+
);
|
|
872
|
+
case "show-hide":
|
|
873
|
+
return /* @__PURE__ */ e(we, { action: a, patch: t });
|
|
874
|
+
case "copy-to-clipboard":
|
|
875
|
+
return /* @__PURE__ */ e(ue, { action: a, patch: t });
|
|
876
|
+
case "download-file":
|
|
877
|
+
return /* @__PURE__ */ e(he, { action: a, patch: t });
|
|
878
|
+
case "toggle-theme":
|
|
879
|
+
return /* @__PURE__ */ e(Se, { action: a, patch: t });
|
|
880
|
+
case "add-to-cart":
|
|
881
|
+
return /* @__PURE__ */ e(pe, { action: a, patch: t });
|
|
882
|
+
case "toggle-cart":
|
|
883
|
+
return /* @__PURE__ */ e("p", { className: "text-neutral-content text-[10px] leading-snug", children: "Opens or closes the shopping cart drawer." });
|
|
884
|
+
case "cart-checkout":
|
|
885
|
+
return /* @__PURE__ */ e("p", { className: "text-neutral-content text-[10px] leading-snug", children: "Redirects to Stripe Checkout with the current cart contents." });
|
|
886
|
+
case "manage-subscription":
|
|
887
|
+
return /* @__PURE__ */ e("p", { className: "text-neutral-content text-[10px] leading-snug", children: "Redirects logged-in customers to the Stripe customer portal to manage subscriptions." });
|
|
888
|
+
case "set-local-storage":
|
|
889
|
+
return /* @__PURE__ */ e(ye, { action: a, patch: t });
|
|
890
|
+
case "remove-local-storage":
|
|
891
|
+
return /* @__PURE__ */ e(ve, { action: a, patch: t });
|
|
892
|
+
case "set-state":
|
|
893
|
+
return /* @__PURE__ */ e(
|
|
894
|
+
Ce,
|
|
895
|
+
{
|
|
896
|
+
action: a,
|
|
897
|
+
patch: t,
|
|
898
|
+
selfId: l,
|
|
899
|
+
ensureSelfId: c
|
|
900
|
+
}
|
|
901
|
+
);
|
|
902
|
+
case "toggle-state":
|
|
903
|
+
return /* @__PURE__ */ e(
|
|
904
|
+
Te,
|
|
905
|
+
{
|
|
906
|
+
action: a,
|
|
907
|
+
patch: t,
|
|
908
|
+
selfId: l,
|
|
909
|
+
ensureSelfId: c
|
|
910
|
+
}
|
|
911
|
+
);
|
|
912
|
+
case "clear-state":
|
|
913
|
+
return /* @__PURE__ */ e(
|
|
914
|
+
Pe,
|
|
915
|
+
{
|
|
916
|
+
action: a,
|
|
917
|
+
patch: t,
|
|
918
|
+
selfId: l,
|
|
919
|
+
ensureSelfId: c
|
|
920
|
+
}
|
|
921
|
+
);
|
|
922
|
+
default:
|
|
923
|
+
return null;
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
export {
|
|
927
|
+
Me as A,
|
|
928
|
+
_e as a
|
|
929
|
+
};
|