@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,562 @@
|
|
|
1
|
+
import { jsxs as h, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { f as K, F as M } from "./FloatingPanel-DJP5Vhua.js";
|
|
3
|
+
import { useMemo as _, useRef as E, useState as N, useEffect as T, useCallback as A } from "react";
|
|
4
|
+
import { S as q } from "./AnchoredPopover-CckPTxXu.js";
|
|
5
|
+
import { dM as B, dO as O, P as z, aA as P, aB as W, dU as S, b as U, dV as V, dW as G, dp as J, a5 as X, G as Y, r as Z, a_ as Q, dX as ee, db as L, W as te } from "./index-C66dAl3Q.js";
|
|
6
|
+
import { ROOT_NODE as ne } from "@craftjs/utils";
|
|
7
|
+
import { useEditor as oe } from "@craftjs/core";
|
|
8
|
+
import { createPortal as re } from "react-dom";
|
|
9
|
+
import { C as ae } from "./CreateTokenDialog-DNWtWqJd.js";
|
|
10
|
+
const $ = () => typeof window < "u" && "EyeDropper" in window, se = () => {
|
|
11
|
+
throw new Error("Unsupported browser.");
|
|
12
|
+
}, le = (n) => {
|
|
13
|
+
const s = _(() => {
|
|
14
|
+
var a;
|
|
15
|
+
return (a = $() && new EyeDropper(n)) ? EyeDropper.prototype.open.bind(a) : se;
|
|
16
|
+
}, [n]), [i, e] = (() => {
|
|
17
|
+
const a = E(), [u, p] = N(!1);
|
|
18
|
+
T(() => (a.current = !0, p($()), () => {
|
|
19
|
+
a.current = !1;
|
|
20
|
+
}), []);
|
|
21
|
+
const b = A(() => u, [u]);
|
|
22
|
+
return [a, b];
|
|
23
|
+
})(), o = E(), l = A(() => {
|
|
24
|
+
o.current !== void 0 && o.current.abort();
|
|
25
|
+
}, [o]), c = A(async function(a) {
|
|
26
|
+
a === void 0 && (a = {}), l();
|
|
27
|
+
const { signal: u, ...p } = a, b = new AbortController();
|
|
28
|
+
o.current = b;
|
|
29
|
+
const m = u !== void 0 ? ((f) => {
|
|
30
|
+
if ("any" in AbortSignal) return AbortSignal.any(f);
|
|
31
|
+
const w = new AbortController(), v = () => {
|
|
32
|
+
w.abort();
|
|
33
|
+
for (const r of f) r.removeEventListener("abort", v);
|
|
34
|
+
};
|
|
35
|
+
for (const r of f) {
|
|
36
|
+
if (r.aborted) {
|
|
37
|
+
v();
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
r.addEventListener("abort", v);
|
|
41
|
+
}
|
|
42
|
+
return w.signal;
|
|
43
|
+
})([u, b.signal]) : b.signal;
|
|
44
|
+
try {
|
|
45
|
+
return await s({ ...p, signal: m });
|
|
46
|
+
} catch (f) {
|
|
47
|
+
throw i.current || (f.canceled = !0), f;
|
|
48
|
+
}
|
|
49
|
+
}, [o, i, l, s]);
|
|
50
|
+
return T(() => l, [l]), { open: c, close: l, isSupported: e };
|
|
51
|
+
}, ie = le, ce = [
|
|
52
|
+
"50",
|
|
53
|
+
"100",
|
|
54
|
+
"200",
|
|
55
|
+
"300",
|
|
56
|
+
"400",
|
|
57
|
+
"500",
|
|
58
|
+
"600",
|
|
59
|
+
"700",
|
|
60
|
+
"800",
|
|
61
|
+
"900",
|
|
62
|
+
"950"
|
|
63
|
+
], de = [
|
|
64
|
+
"slate",
|
|
65
|
+
"gray",
|
|
66
|
+
"zinc",
|
|
67
|
+
"neutral",
|
|
68
|
+
"stone",
|
|
69
|
+
"red",
|
|
70
|
+
"orange",
|
|
71
|
+
"amber",
|
|
72
|
+
"yellow",
|
|
73
|
+
"lime",
|
|
74
|
+
"green",
|
|
75
|
+
"emerald",
|
|
76
|
+
"teal",
|
|
77
|
+
"cyan",
|
|
78
|
+
"sky",
|
|
79
|
+
"blue",
|
|
80
|
+
"indigo",
|
|
81
|
+
"violet",
|
|
82
|
+
"purple",
|
|
83
|
+
"fuchsia",
|
|
84
|
+
"pink",
|
|
85
|
+
"rose"
|
|
86
|
+
].map((n) => ({ name: n, shades: ce })), ue = [
|
|
87
|
+
{ name: "White", value: "white", hex: "#ffffff" },
|
|
88
|
+
{ name: "Black", value: "black", hex: "#000000" },
|
|
89
|
+
{ name: "Transparent", value: "transparent", hex: "transparent" }
|
|
90
|
+
];
|
|
91
|
+
function pe(n, s) {
|
|
92
|
+
const { base: i } = B(`${n}-${s}`), e = i.split("-");
|
|
93
|
+
if (e.length < 2) {
|
|
94
|
+
const a = i.toLowerCase(), u = O[a];
|
|
95
|
+
return u && typeof u == "string" ? u : "#cccccc";
|
|
96
|
+
}
|
|
97
|
+
const o = e.pop(), l = e.join("-").toLowerCase(), c = O[l];
|
|
98
|
+
return c ? typeof c == "string" ? c : typeof c == "object" && c[o] ? c[o] : "#cccccc" : "#cccccc";
|
|
99
|
+
}
|
|
100
|
+
function be({
|
|
101
|
+
selectedColor: n,
|
|
102
|
+
onSelect: s,
|
|
103
|
+
onDoubleClick: i
|
|
104
|
+
}) {
|
|
105
|
+
return /* @__PURE__ */ h("div", { children: [
|
|
106
|
+
/* @__PURE__ */ t("span", { className: "text-base-content mb-1.5 block text-xs font-medium", children: "Special" }),
|
|
107
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-12 gap-1", children: ue.map((e) => /* @__PURE__ */ h(
|
|
108
|
+
"button",
|
|
109
|
+
{
|
|
110
|
+
onClick: () => s("class", e.value),
|
|
111
|
+
onDoubleClick: () => i("class", e.value),
|
|
112
|
+
className: "group relative aspect-square w-full rounded-lg border-2 transition-all hover:scale-110",
|
|
113
|
+
style: {
|
|
114
|
+
backgroundColor: e.hex,
|
|
115
|
+
borderColor: n === e.value ? "var(--primary)" : "var(--base-300)"
|
|
116
|
+
},
|
|
117
|
+
"data-tooltip-id": z,
|
|
118
|
+
"data-tooltip-content": e.name,
|
|
119
|
+
"data-tooltip-place": "top",
|
|
120
|
+
"data-tooltip-offset": 10,
|
|
121
|
+
children: [
|
|
122
|
+
e.value === "transparent" && /* @__PURE__ */ t(
|
|
123
|
+
"div",
|
|
124
|
+
{
|
|
125
|
+
className: "absolute inset-0 rounded-lg",
|
|
126
|
+
style: {
|
|
127
|
+
background: "linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc), linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc)",
|
|
128
|
+
backgroundSize: "8px 8px",
|
|
129
|
+
backgroundPosition: "0 0, 4px 4px"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
),
|
|
133
|
+
n === e.value && /* @__PURE__ */ t(P, { className: "text-base-content absolute inset-0 m-auto size-5 drop-shadow-lg" })
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
e.value
|
|
137
|
+
)) })
|
|
138
|
+
] });
|
|
139
|
+
}
|
|
140
|
+
function me({
|
|
141
|
+
recentColors: n,
|
|
142
|
+
selectedColor: s,
|
|
143
|
+
onClear: i,
|
|
144
|
+
onSelect: e,
|
|
145
|
+
onDoubleClick: o
|
|
146
|
+
}) {
|
|
147
|
+
return /* @__PURE__ */ h("div", { children: [
|
|
148
|
+
/* @__PURE__ */ h("div", { className: "mb-1.5 flex items-center justify-between", children: [
|
|
149
|
+
/* @__PURE__ */ t("span", { className: "text-base-content text-xs font-medium", children: "Recent" }),
|
|
150
|
+
/* @__PURE__ */ t("button", { onClick: i, className: "text-neutral-content hover:text-base-content text-xs", children: /* @__PURE__ */ t(W, { className: "size-3" }) })
|
|
151
|
+
] }),
|
|
152
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-12 gap-1", children: n.map((l, c) => /* @__PURE__ */ t(
|
|
153
|
+
"button",
|
|
154
|
+
{
|
|
155
|
+
onClick: () => e("hex", l),
|
|
156
|
+
onDoubleClick: () => o("hex", l),
|
|
157
|
+
className: "group relative aspect-square w-full rounded-lg border-2 transition-all hover:scale-110",
|
|
158
|
+
style: {
|
|
159
|
+
backgroundColor: l,
|
|
160
|
+
borderColor: s === l ? "var(--primary)" : "var(--base-300)"
|
|
161
|
+
},
|
|
162
|
+
children: s === l && /* @__PURE__ */ t(P, { className: "absolute inset-0 m-auto size-4 text-white drop-shadow-lg" })
|
|
163
|
+
},
|
|
164
|
+
c
|
|
165
|
+
)) })
|
|
166
|
+
] });
|
|
167
|
+
}
|
|
168
|
+
function fe({
|
|
169
|
+
selectedColor: n,
|
|
170
|
+
onSelect: s,
|
|
171
|
+
onDoubleClick: i
|
|
172
|
+
}) {
|
|
173
|
+
return /* @__PURE__ */ h("div", { children: [
|
|
174
|
+
/* @__PURE__ */ t("span", { className: "text-base-content mb-1.5 block text-xs font-medium", children: "Tailwind Colors" }),
|
|
175
|
+
/* @__PURE__ */ t("div", { className: "space-y-3", children: de.map((e) => /* @__PURE__ */ h("div", { children: [
|
|
176
|
+
/* @__PURE__ */ t("div", { className: "text-neutral-content mb-1 text-xs capitalize", children: e.name }),
|
|
177
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-12 gap-1", children: e.shades.map((o) => {
|
|
178
|
+
const l = `${e.name}-${o}`, c = pe(e.name, o), a = n === l;
|
|
179
|
+
return /* @__PURE__ */ t(
|
|
180
|
+
"button",
|
|
181
|
+
{
|
|
182
|
+
onClick: () => s("class", l),
|
|
183
|
+
onDoubleClick: () => i("class", l),
|
|
184
|
+
className: "group relative aspect-square w-full rounded-lg border transition-all hover:scale-110",
|
|
185
|
+
style: {
|
|
186
|
+
backgroundColor: c,
|
|
187
|
+
borderColor: a ? "var(--primary)" : "var(--base-300)",
|
|
188
|
+
borderWidth: a ? "2px" : "1px"
|
|
189
|
+
},
|
|
190
|
+
"data-tooltip-id": z,
|
|
191
|
+
"data-tooltip-content": `${e.name.charAt(0).toUpperCase() + e.name.slice(1)} ${o}`,
|
|
192
|
+
"data-tooltip-place": "top",
|
|
193
|
+
"data-tooltip-offset": 10,
|
|
194
|
+
children: a && /* @__PURE__ */ t(P, { className: "absolute inset-0 m-auto size-4 text-white drop-shadow-lg" })
|
|
195
|
+
},
|
|
196
|
+
o
|
|
197
|
+
);
|
|
198
|
+
}) })
|
|
199
|
+
] }, e.name)) })
|
|
200
|
+
] });
|
|
201
|
+
}
|
|
202
|
+
function j(n, s) {
|
|
203
|
+
var a;
|
|
204
|
+
let i = n.replace(/^(bg-|text-|border-|from-|to-|via-|ring-)/, "");
|
|
205
|
+
const { base: e, opacity: o } = B(i);
|
|
206
|
+
if (e.includes("#")) {
|
|
207
|
+
const u = ((a = e.match(/#[0-9A-Fa-f]{3,8}/i)) == null ? void 0 : a[0]) || e;
|
|
208
|
+
return o != null && o < 1 - 1e-6 ? S(u, o) : u;
|
|
209
|
+
}
|
|
210
|
+
if (e === "white")
|
|
211
|
+
return o != null && o < 1 - 1e-6 ? S("#ffffff", o) : "#ffffff";
|
|
212
|
+
if (e === "black")
|
|
213
|
+
return o != null && o < 1 - 1e-6 ? S("#000000", o) : "#000000";
|
|
214
|
+
if (e === "transparent")
|
|
215
|
+
return o != null && o < 1 - 1e-6 ? S("transparent", o) : "transparent";
|
|
216
|
+
if (/^[a-z]+$/i.test(e)) {
|
|
217
|
+
const u = e.toLowerCase(), p = O[u];
|
|
218
|
+
if (p && typeof p == "object" && Object.prototype.hasOwnProperty.call(p, "500")) {
|
|
219
|
+
let b = p[500];
|
|
220
|
+
return o != null && o < 1 - 1e-6 && (b = S(b, o)), b;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
let c = U(`text-${e}`, "text", s).backgroundColor;
|
|
224
|
+
return o != null && o < 1 - 1e-6 && (c = S(c, o)), c;
|
|
225
|
+
}
|
|
226
|
+
function he({ selectedColor: n, onSelect: s, anchorEl: i }) {
|
|
227
|
+
const { query: e, actions: o } = oe(), [l, c] = N("light"), [a, u] = N([]), [p, b] = N(""), [m, f] = N(null), w = l === "dark" ? "darkPalette" : "palette", v = () => {
|
|
228
|
+
var d;
|
|
229
|
+
try {
|
|
230
|
+
const x = e.node(ne).get(), g = Z(((d = x == null ? void 0 : x.data) == null ? void 0 : d.props) || {}), C = l === "dark" ? g.darkPalette : g.palette;
|
|
231
|
+
u(C || []);
|
|
232
|
+
} catch (x) {
|
|
233
|
+
Q.error("DesignSystemPalette: failed to load palette", x);
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
T(() => {
|
|
237
|
+
v();
|
|
238
|
+
}, [e, l]);
|
|
239
|
+
const r = _(() => {
|
|
240
|
+
const d = p.trim().toLowerCase();
|
|
241
|
+
return d ? a.filter((x) => x.name.toLowerCase().includes(d)) : a;
|
|
242
|
+
}, [a, p]), y = (d) => {
|
|
243
|
+
const g = (i ?? d.closest('[role="dialog"]') ?? d).getBoundingClientRect(), C = 256, k = 8, R = g.right + k;
|
|
244
|
+
return { left: R + C > window.innerWidth - 8 ? Math.max(8, g.left - C - k) : R, top: Math.max(8, g.top) };
|
|
245
|
+
}, D = (d) => {
|
|
246
|
+
f({ mode: "create", pos: y(d.currentTarget) });
|
|
247
|
+
}, F = (d, x) => {
|
|
248
|
+
d.stopPropagation(), f({ mode: "edit", pos: y(d.currentTarget), existing: x });
|
|
249
|
+
};
|
|
250
|
+
return /* @__PURE__ */ h("div", { children: [
|
|
251
|
+
/* @__PURE__ */ h("div", { className: "mb-1.5 flex items-center justify-between gap-2", children: [
|
|
252
|
+
/* @__PURE__ */ t("span", { className: "text-base-content text-xs font-medium", children: "Design System" }),
|
|
253
|
+
/* @__PURE__ */ h("div", { className: "border-base-300 bg-base-200 flex items-center rounded-md border p-0.5", children: [
|
|
254
|
+
/* @__PURE__ */ t(
|
|
255
|
+
"button",
|
|
256
|
+
{
|
|
257
|
+
type: "button",
|
|
258
|
+
onClick: () => c("light"),
|
|
259
|
+
"aria-pressed": l === "light",
|
|
260
|
+
"aria-label": "Light palette",
|
|
261
|
+
className: `flex size-5 items-center justify-center rounded transition-colors ${l === "light" ? "bg-base-100 text-base-content" : "text-neutral-content hover:text-base-content"}`,
|
|
262
|
+
children: /* @__PURE__ */ t(V, { className: "size-3.5", "aria-hidden": !0 })
|
|
263
|
+
}
|
|
264
|
+
),
|
|
265
|
+
/* @__PURE__ */ t(
|
|
266
|
+
"button",
|
|
267
|
+
{
|
|
268
|
+
type: "button",
|
|
269
|
+
onClick: () => c("dark"),
|
|
270
|
+
"aria-pressed": l === "dark",
|
|
271
|
+
"aria-label": "Dark palette",
|
|
272
|
+
className: `flex size-5 items-center justify-center rounded transition-colors ${l === "dark" ? "bg-base-100 text-base-content" : "text-neutral-content hover:text-base-content"}`,
|
|
273
|
+
children: /* @__PURE__ */ t(G, { className: "size-3.5", "aria-hidden": !0 })
|
|
274
|
+
}
|
|
275
|
+
)
|
|
276
|
+
] })
|
|
277
|
+
] }),
|
|
278
|
+
a.length > 4 && /* @__PURE__ */ h("div", { className: "border-base-300 bg-base-200 mb-1.5 flex items-center gap-1.5 rounded-md border px-2 py-1.5", children: [
|
|
279
|
+
/* @__PURE__ */ t(J, { className: "text-neutral-content size-3.5 shrink-0", "aria-hidden": !0 }),
|
|
280
|
+
/* @__PURE__ */ t(
|
|
281
|
+
"input",
|
|
282
|
+
{
|
|
283
|
+
type: "text",
|
|
284
|
+
value: p,
|
|
285
|
+
onChange: (d) => b(d.target.value),
|
|
286
|
+
placeholder: "Search...",
|
|
287
|
+
className: "text-base-content placeholder:text-neutral-content min-w-0 flex-1 bg-transparent text-xs outline-none"
|
|
288
|
+
}
|
|
289
|
+
)
|
|
290
|
+
] }),
|
|
291
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col", children: r.length === 0 ? /* @__PURE__ */ t("div", { className: "text-neutral-content px-2 py-3 text-center text-xs italic", children: a.length === 0 ? "No tokens yet" : `No matches for "${p}"` }) : r.map((d) => {
|
|
292
|
+
const x = j(d.color || "", a), g = `palette:${d.name}`, C = n === g || n.includes(d.name);
|
|
293
|
+
return /* @__PURE__ */ h(
|
|
294
|
+
"div",
|
|
295
|
+
{
|
|
296
|
+
role: "button",
|
|
297
|
+
tabIndex: 0,
|
|
298
|
+
onClick: () => s(g),
|
|
299
|
+
onKeyDown: (k) => {
|
|
300
|
+
(k.key === "Enter" || k.key === " ") && (k.preventDefault(), s(g));
|
|
301
|
+
},
|
|
302
|
+
className: `group flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors ${C ? "bg-base-200" : "hover:bg-base-200/60"}`,
|
|
303
|
+
children: [
|
|
304
|
+
/* @__PURE__ */ t(
|
|
305
|
+
"span",
|
|
306
|
+
{
|
|
307
|
+
className: "border-base-300 size-4 shrink-0 rounded-full border",
|
|
308
|
+
style: { backgroundColor: x },
|
|
309
|
+
"aria-hidden": !0
|
|
310
|
+
}
|
|
311
|
+
),
|
|
312
|
+
/* @__PURE__ */ t(
|
|
313
|
+
"span",
|
|
314
|
+
{
|
|
315
|
+
className: `min-w-0 flex-1 truncate text-xs ${C ? "font-medium" : ""} text-base-content`,
|
|
316
|
+
children: d.name
|
|
317
|
+
}
|
|
318
|
+
),
|
|
319
|
+
C && /* @__PURE__ */ t(P, { className: "text-base-content size-3.5 shrink-0", "aria-hidden": !0 }),
|
|
320
|
+
/* @__PURE__ */ h(
|
|
321
|
+
"button",
|
|
322
|
+
{
|
|
323
|
+
type: "button",
|
|
324
|
+
onClick: (k) => F(k, d),
|
|
325
|
+
className: "bg-base-300 text-base-content hover:bg-base-content hover:text-base-100 hidden shrink-0 items-center justify-center rounded px-1.5 py-0.5 text-[10px] font-medium transition-colors group-hover:flex",
|
|
326
|
+
"aria-label": `Edit ${d.name}`,
|
|
327
|
+
children: [
|
|
328
|
+
/* @__PURE__ */ t(X, { className: "mr-0.5 size-3", "aria-hidden": !0 }),
|
|
329
|
+
"Edit"
|
|
330
|
+
]
|
|
331
|
+
}
|
|
332
|
+
)
|
|
333
|
+
]
|
|
334
|
+
},
|
|
335
|
+
d.name
|
|
336
|
+
);
|
|
337
|
+
}) }),
|
|
338
|
+
/* @__PURE__ */ h(
|
|
339
|
+
"button",
|
|
340
|
+
{
|
|
341
|
+
type: "button",
|
|
342
|
+
onClick: D,
|
|
343
|
+
className: "border-base-300 text-neutral-content hover:border-base-content hover:text-base-content mt-1.5 flex h-8 w-full items-center justify-center gap-1.5 rounded-md border border-dashed text-xs transition-colors",
|
|
344
|
+
children: [
|
|
345
|
+
/* @__PURE__ */ t(Y, { className: "size-3.5" }),
|
|
346
|
+
"New Token"
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
),
|
|
350
|
+
m && /* @__PURE__ */ t(xe, { left: m.pos.left, top: m.pos.top, children: /* @__PURE__ */ t(
|
|
351
|
+
ae,
|
|
352
|
+
{
|
|
353
|
+
paletteKey: w,
|
|
354
|
+
...m.mode === "edit" ? {
|
|
355
|
+
existing: {
|
|
356
|
+
originalName: m.existing.name,
|
|
357
|
+
color: j(m.existing.color || "", a)
|
|
358
|
+
}
|
|
359
|
+
} : {},
|
|
360
|
+
onCreated: (d) => {
|
|
361
|
+
f(null), v(), s(`palette:${d}`);
|
|
362
|
+
},
|
|
363
|
+
onDeleted: () => {
|
|
364
|
+
f(null), v();
|
|
365
|
+
},
|
|
366
|
+
onClose: () => f(null)
|
|
367
|
+
}
|
|
368
|
+
) })
|
|
369
|
+
] });
|
|
370
|
+
}
|
|
371
|
+
function xe({
|
|
372
|
+
left: n,
|
|
373
|
+
top: s,
|
|
374
|
+
children: i
|
|
375
|
+
}) {
|
|
376
|
+
const e = E(null);
|
|
377
|
+
return K(e), re(
|
|
378
|
+
/* @__PURE__ */ t("div", { ref: e, className: "pagehub-sdk-root fixed", style: { left: n, top: s, zIndex: 1200 }, children: i }),
|
|
379
|
+
document.body
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
function ge() {
|
|
383
|
+
try {
|
|
384
|
+
const n = L.get("recent-colors");
|
|
385
|
+
return n ? JSON.parse(n) : [];
|
|
386
|
+
} catch {
|
|
387
|
+
return [];
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
function I(n, s) {
|
|
391
|
+
const i = [n, ...s.filter((e) => e !== n)].slice(0, 12);
|
|
392
|
+
return L.set("recent-colors", i), i;
|
|
393
|
+
}
|
|
394
|
+
function ve(n) {
|
|
395
|
+
if (!n) return "";
|
|
396
|
+
if (n.startsWith("palette:")) return n;
|
|
397
|
+
const s = n.replace(/^(bg|text|border|from|to|via|ring|divide|outline)-/, ""), i = s.match(/#[0-9A-Fa-f]{3,8}/);
|
|
398
|
+
if (i) return i[0];
|
|
399
|
+
const e = s.match(/\[var\(--([a-z0-9-]+)\)\]/i);
|
|
400
|
+
return e ? e[1] : s;
|
|
401
|
+
}
|
|
402
|
+
function H(n) {
|
|
403
|
+
const s = n.match(/#[0-9A-Fa-f]{6,8}/);
|
|
404
|
+
return s ? s[0] : "";
|
|
405
|
+
}
|
|
406
|
+
function ye({ value: n, onChange: s, onClear: i }) {
|
|
407
|
+
const { open: e, isSupported: o } = ie(), [l, c] = N(ge), [a, u] = N(() => H(n)), p = ve(n);
|
|
408
|
+
T(() => {
|
|
409
|
+
const r = H(n);
|
|
410
|
+
r && u(r);
|
|
411
|
+
}, [n]);
|
|
412
|
+
const b = (r) => {
|
|
413
|
+
s(r), r.type === "hex" && typeof r.value == "string" ? c((y) => I(r.value, y)) : r.type === "class" && typeof r.value == "string" && c((y) => I(r.value, y));
|
|
414
|
+
}, m = (r, y) => {
|
|
415
|
+
b({ type: r, value: y });
|
|
416
|
+
}, f = () => {
|
|
417
|
+
a && /^#[0-9A-Fa-f]{6}$/.test(a) && b({ type: "hex", value: a });
|
|
418
|
+
}, w = async () => {
|
|
419
|
+
try {
|
|
420
|
+
const r = await e();
|
|
421
|
+
r != null && r.sRGBHex && (u(r.sRGBHex), b({ type: "hex", value: r.sRGBHex }));
|
|
422
|
+
} catch {
|
|
423
|
+
}
|
|
424
|
+
}, v = () => {
|
|
425
|
+
c([]), L.remove("recent-colors");
|
|
426
|
+
};
|
|
427
|
+
return /* @__PURE__ */ h("div", { className: "flex flex-col gap-4", children: [
|
|
428
|
+
/* @__PURE__ */ t("div", { className: "overflow-hidden rounded-md", children: /* @__PURE__ */ t(
|
|
429
|
+
q,
|
|
430
|
+
{
|
|
431
|
+
width: "100%",
|
|
432
|
+
presetColors: [],
|
|
433
|
+
disableAlpha: !1,
|
|
434
|
+
styles: {
|
|
435
|
+
picker: {},
|
|
436
|
+
saturation: {
|
|
437
|
+
width: "100%",
|
|
438
|
+
height: "120px",
|
|
439
|
+
paddingBottom: "",
|
|
440
|
+
position: "relative",
|
|
441
|
+
overflow: "hidden"
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
color: a || "#3b82f6",
|
|
445
|
+
onChange: (r) => u(r.hex),
|
|
446
|
+
onChangeComplete: (r) => {
|
|
447
|
+
var D;
|
|
448
|
+
(((D = r.rgb) == null ? void 0 : D.a) ?? 1) < 1 - 1e-6 ? b({ type: "rgb", value: r.rgb }) : b({ type: "hex", value: r.hex });
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
) }),
|
|
452
|
+
/* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
|
|
453
|
+
/* @__PURE__ */ t(
|
|
454
|
+
"input",
|
|
455
|
+
{
|
|
456
|
+
type: "text",
|
|
457
|
+
value: a,
|
|
458
|
+
onChange: (r) => u(r.target.value),
|
|
459
|
+
onKeyDown: (r) => r.key === "Enter" && f(),
|
|
460
|
+
onBlur: f,
|
|
461
|
+
placeholder: "#000000",
|
|
462
|
+
className: "border-base-300 bg-base-200 text-base-content placeholder:text-neutral-content focus:border-ring focus:ring-ring h-8 flex-1 rounded-md border px-2 text-xs outline-none focus:ring-1"
|
|
463
|
+
}
|
|
464
|
+
),
|
|
465
|
+
o() && /* @__PURE__ */ t(
|
|
466
|
+
"button",
|
|
467
|
+
{
|
|
468
|
+
type: "button",
|
|
469
|
+
onClick: w,
|
|
470
|
+
className: "border-base-300 text-neutral-content hover:border-base-content hover:text-base-content flex size-8 shrink-0 items-center justify-center rounded-md border transition-colors",
|
|
471
|
+
"data-tooltip-id": z,
|
|
472
|
+
"data-tooltip-content": "Eyedropper",
|
|
473
|
+
"data-tooltip-place": "top",
|
|
474
|
+
"data-tooltip-offset": 10,
|
|
475
|
+
"aria-label": "Pick color from screen",
|
|
476
|
+
children: /* @__PURE__ */ t(ee, { className: "size-3.5" })
|
|
477
|
+
}
|
|
478
|
+
),
|
|
479
|
+
i && /* @__PURE__ */ t(
|
|
480
|
+
"button",
|
|
481
|
+
{
|
|
482
|
+
type: "button",
|
|
483
|
+
disabled: !n,
|
|
484
|
+
onClick: i,
|
|
485
|
+
className: "border-base-300 text-neutral-content hover:border-primary hover:text-base-content flex size-8 shrink-0 items-center justify-center rounded-md border transition-colors disabled:pointer-events-none disabled:opacity-40",
|
|
486
|
+
"data-tooltip-id": z,
|
|
487
|
+
"data-tooltip-content": "Clear color",
|
|
488
|
+
"data-tooltip-place": "top",
|
|
489
|
+
"data-tooltip-offset": 10,
|
|
490
|
+
"aria-label": "Clear color",
|
|
491
|
+
children: /* @__PURE__ */ t(W, { className: "size-3.5" })
|
|
492
|
+
}
|
|
493
|
+
)
|
|
494
|
+
] }),
|
|
495
|
+
/* @__PURE__ */ t(
|
|
496
|
+
he,
|
|
497
|
+
{
|
|
498
|
+
selectedColor: p,
|
|
499
|
+
onSelect: (r) => b({ type: "palette", value: r })
|
|
500
|
+
}
|
|
501
|
+
),
|
|
502
|
+
/* @__PURE__ */ t(
|
|
503
|
+
be,
|
|
504
|
+
{
|
|
505
|
+
selectedColor: p,
|
|
506
|
+
onSelect: m,
|
|
507
|
+
onDoubleClick: m
|
|
508
|
+
}
|
|
509
|
+
),
|
|
510
|
+
l.length > 0 && /* @__PURE__ */ t(
|
|
511
|
+
me,
|
|
512
|
+
{
|
|
513
|
+
recentColors: l,
|
|
514
|
+
selectedColor: p,
|
|
515
|
+
onClear: v,
|
|
516
|
+
onSelect: m,
|
|
517
|
+
onDoubleClick: m
|
|
518
|
+
}
|
|
519
|
+
),
|
|
520
|
+
/* @__PURE__ */ t(
|
|
521
|
+
fe,
|
|
522
|
+
{
|
|
523
|
+
selectedColor: p,
|
|
524
|
+
onSelect: m,
|
|
525
|
+
onDoubleClick: m
|
|
526
|
+
}
|
|
527
|
+
)
|
|
528
|
+
] });
|
|
529
|
+
}
|
|
530
|
+
function Ee({
|
|
531
|
+
initialPosition: n,
|
|
532
|
+
onClose: s,
|
|
533
|
+
defaultWidth: i,
|
|
534
|
+
defaultHeight: e,
|
|
535
|
+
value: o,
|
|
536
|
+
onChange: l,
|
|
537
|
+
onClear: c
|
|
538
|
+
}) {
|
|
539
|
+
return /* @__PURE__ */ t(
|
|
540
|
+
M,
|
|
541
|
+
{
|
|
542
|
+
isOpen: !0,
|
|
543
|
+
onClose: s,
|
|
544
|
+
title: "Color",
|
|
545
|
+
storageKey: "color-input",
|
|
546
|
+
autoSize: !1,
|
|
547
|
+
defaultWidth: i,
|
|
548
|
+
defaultHeight: e,
|
|
549
|
+
minWidth: 260,
|
|
550
|
+
maxWidth: 400,
|
|
551
|
+
minHeight: 420,
|
|
552
|
+
initialPosition: n,
|
|
553
|
+
persistSize: !1,
|
|
554
|
+
zIndex: te,
|
|
555
|
+
scrollable: !0,
|
|
556
|
+
children: /* @__PURE__ */ t(ye, { value: o, onChange: l, onClear: c })
|
|
557
|
+
}
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
export {
|
|
561
|
+
Ee as default
|
|
562
|
+
};
|