@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.
Files changed (141) hide show
  1. package/README.md +1 -1
  2. package/dist/chrome/viewport/Viewport/hooks/usePageLoadIndicator.d.ts +2 -2
  3. package/dist/chrome/viewport/design-system/hooks/useDesignSystem.d.ts +2 -2
  4. package/dist/chrome/viewport/design-system/hooks/usePaletteState.d.ts +2 -2
  5. package/dist/chunks/ActionEditorPanel-9v50QUwu.js +89 -0
  6. package/dist/chunks/ActionInput-CTt7sOs6.js +929 -0
  7. package/dist/chunks/ActionsAddPicker-BeTPUUor.js +51 -0
  8. package/dist/chunks/ActionsInput-D0h-zLYj.js +174 -0
  9. package/dist/chunks/AnchoredPopover-CckPTxXu.js +2676 -0
  10. package/dist/chunks/AnimationEditorPanel-CXNmsTqV.js +26 -0
  11. package/dist/chunks/AnimationsInput-Djyz0uXG.js +292 -0
  12. package/dist/chunks/AnimationsInputPopover-B2-oNebx.js +71 -0
  13. package/dist/chunks/AnimationsPanel-DungA9qb.js +25 -0
  14. package/dist/chunks/Audio.render-CsR69fZ9.js +22 -0
  15. package/dist/chunks/AudioMainTab-BljM2NMQ.js +70 -0
  16. package/dist/chunks/BackdropEditorPanel-CA2k-6SR.js +26 -0
  17. package/dist/chunks/BackgroundImageInputPopover-vB_217Ig.js +94 -0
  18. package/dist/chunks/BackgroundImagePanel-BvMhF9eU.js +100 -0
  19. package/dist/chunks/BackgroundMainTab-CI4c5DEF.js +10 -0
  20. package/dist/chunks/BundleRowPanel-BcYfyfGQ.js +33 -0
  21. package/dist/chunks/ButtonMainTab-Civy_DoA.js +43 -0
  22. package/dist/chunks/CSSEditorInput-C1ITwAh3.js +73 -0
  23. package/dist/chunks/ClassNameInput-Ce0fGQES.js +720 -0
  24. package/dist/chunks/CodeEditor-axBXmPH8.js +33370 -0
  25. package/dist/chunks/ColorInput-BSfMNt86.js +187 -0
  26. package/dist/chunks/ColorPanel-DOLrT-gS.js +562 -0
  27. package/dist/chunks/ComponentImportExportPanel-DVcnGhGx.js +161 -0
  28. package/dist/chunks/ComponentImportExportPopover-BY1_oxU8.js +26 -0
  29. package/dist/chunks/ConditionEditorPanel-DLbqYaSF.js +43 -0
  30. package/dist/chunks/ConditionsAddPicker-SsHJlc1E.js +54 -0
  31. package/dist/chunks/ConditionsInput-B_5Nge8o.js +474 -0
  32. package/dist/chunks/ContainerMainTab-kkktm1Ns.js +1107 -0
  33. package/dist/chunks/ContainerOverflowSectionPanel-ibKXf-1N.js +120 -0
  34. package/dist/chunks/ContainerOverflowSectionPopover-CRQ9EPsn.js +24 -0
  35. package/dist/chunks/ContainerPaddingOverlay-Cd3xOv-S.js +340 -0
  36. package/dist/chunks/ContainerScrollEffectSection-Dbztqdnr.js +123 -0
  37. package/dist/chunks/ContainerStateSection-DY_gjBJL.js +478 -0
  38. package/dist/chunks/ConversionFields-Bpfl-SGP.js +135 -0
  39. package/dist/chunks/CraftListEditor-_TIy1ogW.js +73 -0
  40. package/dist/chunks/CreateTokenDialog-DNWtWqJd.js +147 -0
  41. package/dist/chunks/Data.render-DTmaqSyz.js +10 -0
  42. package/dist/chunks/DataAttributesPanel-mYhisO_O.js +125 -0
  43. package/dist/chunks/DataMainTab-Batm515E.js +23 -0
  44. package/dist/chunks/DataSourceSectionSlot-BKoO6Vxn.js +10 -0
  45. package/dist/chunks/EditorEmptyLeafHintView-D3E3UN_0.js +78 -0
  46. package/dist/chunks/EffectRowInputPopover-CYhfjFwJ.js +323 -0
  47. package/dist/chunks/EffectsClassInput-Yujuchwy.js +315 -0
  48. package/dist/chunks/Embed.render-BgKpUV8n.js +17 -0
  49. package/dist/chunks/EmbedMainTab-d_-Bnkug.js +225 -0
  50. package/dist/chunks/FilterEditorPanel-CRa0IpLr.js +26 -0
  51. package/dist/chunks/FlexDirectionInput-C5gYjk5W.js +78 -0
  52. package/dist/chunks/FloatingPanel-DJP5Vhua.js +553 -0
  53. package/dist/chunks/FontFamilyInput-CVNnVylt.js +111 -0
  54. package/dist/chunks/Form.render-6GjcmL2u.js +54 -0
  55. package/dist/chunks/FormElement.render-DWrG-2ID.js +36 -0
  56. package/dist/chunks/FormElementMainTab-DSbF3F6e.js +470 -0
  57. package/dist/chunks/FormMainTab-SHny1HxF.js +240 -0
  58. package/dist/chunks/GradientInputPopover-1K6O9jBq.js +103 -0
  59. package/dist/chunks/GradientPanel-DSRQKkaB.js +194 -0
  60. package/dist/chunks/HTMLCodeInput-CCe4Bj5z.js +69 -0
  61. package/dist/chunks/HandlerEditorPanel-DiOXobsl.js +93 -0
  62. package/dist/chunks/HandlersAddPicker-DWTgjKgo.js +101 -0
  63. package/dist/chunks/HandlersInput-p49STTn8.js +132 -0
  64. package/dist/chunks/IconDialogInput-C-81_L2n.js +105 -0
  65. package/dist/chunks/IconInput-D2Gy7Hvf.js +182 -0
  66. package/dist/chunks/IconMainTab-CNrVjDWP.js +26 -0
  67. package/dist/chunks/IconPickerPanel-BjNOlCh6.js +670 -0
  68. package/dist/chunks/ImageMainTab-C4O7RjX0.js +66 -0
  69. package/dist/chunks/ImageSettingsPanel-dvOmGg3C.js +485 -0
  70. package/dist/chunks/LayoutPresetPanel-CNAVAcvw.js +81 -0
  71. package/dist/chunks/LayoutPresetSlot-BqMTdE33.js +16 -0
  72. package/dist/chunks/LinkMainTab-BfFZx0AU.js +13 -0
  73. package/dist/chunks/ListEditor-mD-CmRNE.js +178 -0
  74. package/dist/chunks/Map.render-DFkmncHz.js +82 -0
  75. package/dist/chunks/MapLeaflet-DOfmZ3Pk.js +6588 -0
  76. package/dist/chunks/MapMainTab-CxI7IS1_.js +165 -0
  77. package/dist/chunks/MapPoint.render-0OAfCZTp.js +16 -0
  78. package/dist/chunks/MapPointMainTab-CmLcaSR5.js +60 -0
  79. package/dist/chunks/MediaInput-DHs3D8TJ.js +672 -0
  80. package/dist/chunks/MediaManagerModal-Dc5PK3dn.js +240 -0
  81. package/dist/chunks/MiniPreviewTile-B4zxTj9Y.js +32 -0
  82. package/dist/chunks/ModifierChipList-CwsWklih.js +33 -0
  83. package/dist/chunks/ModifiersAddPicker-D-vSYw7O.js +74 -0
  84. package/dist/chunks/ModifiersPickerPanel-CTefidBx.js +243 -0
  85. package/dist/chunks/NodeAiContextInputPopover-D5bn5o_T.js +66 -0
  86. package/dist/chunks/NodeAiContextPanel-Bx4rcjiM.js +81 -0
  87. package/dist/chunks/NumberSettingsPanel-DASi_l6V.js +56 -0
  88. package/dist/chunks/PageSettingsModal-D6o450IR.js +2678 -0
  89. package/dist/chunks/PatternInputPopover-qMWBv_nl.js +100 -0
  90. package/dist/chunks/PatternPanel-D2fgWDd-.js +352 -0
  91. package/dist/chunks/PeekTargetButton-ClrJX7zh.js +26 -0
  92. package/dist/chunks/PermissionsSection-DwobrV40.js +82 -0
  93. package/dist/chunks/PresetAddChildList-D6a0xdt8.js +35 -0
  94. package/dist/chunks/PropertiesInput-9O39ngbb.js +125 -0
  95. package/dist/chunks/PropertiesPanel-DO0RlalO.js +76 -0
  96. package/dist/chunks/SaveModifierPanel-B6mjKyrT.js +130 -0
  97. package/dist/chunks/ScrollEffectEditorPanel-CllGUhui.js +26 -0
  98. package/dist/chunks/SearchInput-DRUztbM0.js +76 -0
  99. package/dist/chunks/SearchableMenuPopover-DZKVXiEl.js +1251 -0
  100. package/dist/chunks/SlotRenderer-CaLf_2_C.js +38 -0
  101. package/dist/chunks/StateBindingEditorPanel-DKdcG5py.js +101 -0
  102. package/dist/chunks/StateBindingsAddPicker-DxMNAWAD.js +91 -0
  103. package/dist/chunks/StateBindingsInput-iWiqvAVB.js +103 -0
  104. package/dist/chunks/TailwindInput-660FZtyK.js +24 -0
  105. package/dist/chunks/TextEditor-B2O7DlN8.js +22032 -0
  106. package/dist/chunks/TextMainTab-B5udsXsk.js +260 -0
  107. package/dist/chunks/TextStyleEditorPanel-GRNPGzUL.js +381 -0
  108. package/dist/chunks/TextStylePickerPanel-l108SmGQ.js +140 -0
  109. package/dist/chunks/TextareaSettingsPanel-C1rQuF1O.js +50 -0
  110. package/dist/chunks/TokenPicker-Q0LToF_p.js +291 -0
  111. package/dist/chunks/ToolbarDashedButton-DbUxGmDg.js +23 -0
  112. package/dist/chunks/TransformEditorPanel-BGwyznZ6.js +26 -0
  113. package/dist/chunks/TransitionEditorPanel-BSvk58Ow.js +26 -0
  114. package/dist/chunks/TypographyPresetInput-DqnGSgR2.js +296 -0
  115. package/dist/chunks/ValidationPanel-CmA9SfoF.js +56 -0
  116. package/dist/chunks/Video.render-Dg6xvis4.js +21 -0
  117. package/dist/chunks/VideoMainTab-v5UFhUm-.js +174 -0
  118. package/dist/chunks/YouTube.esm-EbHnLU1Z.js +744 -0
  119. package/dist/chunks/dialogAtoms-CeQ2G05l.js +59 -0
  120. package/dist/chunks/extends-hS2Bh-Yp.js +12 -0
  121. package/dist/chunks/formatStorage-C3o2s3dk.js +22 -0
  122. package/dist/chunks/googleFonts-Dj4AntNi.js +323 -0
  123. package/dist/chunks/helpers-Cll72tMn.js +18 -0
  124. package/dist/chunks/index-B-GJd039.js +2875 -0
  125. package/dist/chunks/index-C66dAl3Q.js +32177 -0
  126. package/dist/chunks/index.esm-mqFx3NOs.js +644 -0
  127. package/dist/chunks/popoverOpenRequestAtom-hBS_siXv.js +22 -0
  128. package/dist/chunks/propertyRegistry-CMhVNOgl.js +38 -0
  129. package/dist/chunks/resolveAnchorsViaCraft-Cixm6ZyJ.js +31 -0
  130. package/dist/chunks/toolboxUtils-DjTMslSn.js +370 -0
  131. package/dist/chunks/uiPrimitives-BtohldWg.js +15 -0
  132. package/dist/chunks/use-event-listener-DO3Sk7g0.js +15 -0
  133. package/dist/chunks/useElementPicker-DoNuXNMQ.js +41 -0
  134. package/dist/chunks/useLayoutPreset-wOMV5YnO.js +528 -0
  135. package/dist/chunks/useMediaManager-CmKDbFfw.js +4629 -0
  136. package/dist/chunks/usePopoverAutoOpen-CxIjt0ez.js +25 -0
  137. package/dist/chunks/usePopoverPosition-83Vti7Aw.js +15 -0
  138. package/dist/render/static/index.js +9 -0
  139. package/package.json +22 -13
  140. package/dist/pagehub-viewer.umd.cjs +0 -574
  141. package/dist/pagehub.umd.cjs +0 -1130
@@ -0,0 +1,260 @@
1
+ import { jsx as a, jsxs as m } from "react/jsx-runtime";
2
+ import { useState as P, Suspense as S, lazy as y } from "react";
3
+ import { useEditor as b, useNode as u } from "@craftjs/core";
4
+ import { u as p, V as A, E as M, C as x, K as N, L as E, N as O, P as L, c as V, e as H, w as W, Q as h, T as k, R as F } from "./index-C66dAl3Q.js";
5
+ import { F as j } from "./FloatingPanel-DJP5Vhua.js";
6
+ import { r as q } from "./helpers-Cll72tMn.js";
7
+ import { S as z } from "./SlotRenderer-CaLf_2_C.js";
8
+ const f = [
9
+ "lorem",
10
+ "ipsum",
11
+ "dolor",
12
+ "sit",
13
+ "amet",
14
+ "consectetur",
15
+ "adipiscing",
16
+ "elit",
17
+ "sed",
18
+ "do",
19
+ "eiusmod",
20
+ "tempor",
21
+ "incididunt",
22
+ "ut",
23
+ "labore",
24
+ "et",
25
+ "dolore",
26
+ "magna",
27
+ "aliqua",
28
+ "enim",
29
+ "ad",
30
+ "minim",
31
+ "veniam",
32
+ "quis",
33
+ "nostrud",
34
+ "exercitation",
35
+ "ullamco",
36
+ "laboris",
37
+ "nisi",
38
+ "aliquip",
39
+ "ex",
40
+ "ea",
41
+ "commodo",
42
+ "consequat",
43
+ "duis",
44
+ "aute",
45
+ "irure",
46
+ "in",
47
+ "reprehenderit",
48
+ "voluptate",
49
+ "velit",
50
+ "esse",
51
+ "cillum",
52
+ "fugiat",
53
+ "nulla",
54
+ "pariatur",
55
+ "excepteur",
56
+ "sint",
57
+ "occaecat",
58
+ "cupidatat",
59
+ "non",
60
+ "proident",
61
+ "sunt",
62
+ "culpa",
63
+ "qui",
64
+ "officia",
65
+ "deserunt",
66
+ "mollit",
67
+ "anim",
68
+ "id",
69
+ "est",
70
+ "blandit",
71
+ "volutpat",
72
+ "maecenas",
73
+ "accumsan",
74
+ "lacus",
75
+ "vel",
76
+ "facilisis",
77
+ "volutpat",
78
+ "praesent",
79
+ "semper",
80
+ "feugiat",
81
+ "nibh",
82
+ "cras",
83
+ "adipiscing"
84
+ ], g = (e, t) => e + Math.floor(Math.random() * (t - e + 1)), I = () => f[Math.floor(Math.random() * f.length)], R = (e) => e.charAt(0).toUpperCase() + e.slice(1);
85
+ class K {
86
+ constructor(t = {}) {
87
+ this.spp = t.sentencesPerParagraph ?? { min: 3, max: 5 }, this.wps = t.wordsPerSentence ?? { min: 5, max: 12 };
88
+ }
89
+ generateWords(t) {
90
+ return Array.from({ length: t }, I).join(" ");
91
+ }
92
+ generateSentences(t) {
93
+ return Array.from({ length: t }, () => {
94
+ const n = g(this.wps.min, this.wps.max);
95
+ return R(this.generateWords(n)) + ".";
96
+ }).join(" ");
97
+ }
98
+ generateParagraphs(t) {
99
+ return Array.from({ length: t }, () => {
100
+ const n = g(this.spp.min, this.spp.max);
101
+ return this.generateSentences(n);
102
+ }).join(`
103
+
104
+ `);
105
+ }
106
+ }
107
+ function D(e) {
108
+ return e.charAt(0).toUpperCase() + e.slice(1);
109
+ }
110
+ const _ = ({ propKey: e, propType: t }) => {
111
+ const n = p(A), o = p(M).dark ?? !1, s = H(n), { actions: r, query: i } = b(), d = new K({
112
+ sentencesPerParagraph: {
113
+ max: 5,
114
+ min: 3
115
+ },
116
+ wordsPerSentence: {
117
+ max: 16,
118
+ min: 4
119
+ }
120
+ }), {
121
+ actions: { setProp: v },
122
+ propValues: J,
123
+ id: T
124
+ } = u((l) => {
125
+ var c;
126
+ return {
127
+ propValues: (c = l.data) == null ? void 0 : c.props,
128
+ id: l.id
129
+ };
130
+ }), C = (l) => {
131
+ V({
132
+ propKey: e,
133
+ value: l,
134
+ setProp: v,
135
+ view: t === "class" ? s : n,
136
+ propType: t,
137
+ query: i,
138
+ actions: r,
139
+ nodeId: T,
140
+ ...t === "class" ? { classDark: o } : {}
141
+ });
142
+ };
143
+ return /* @__PURE__ */ a(x, { label: "Sample", frame: "bare", children: /* @__PURE__ */ a("div", { className: "bg-neutral ml-auto flex w-fit shrink-0 items-center gap-1 rounded-md p-1", children: [
144
+ {
145
+ icon: N,
146
+ label: "Word",
147
+ generate: () => D(d.generateWords(1))
148
+ },
149
+ { icon: E, label: "Sentence", generate: () => d.generateSentences(1) },
150
+ { icon: O, label: "Paragraph", generate: () => d.generateParagraphs(1) }
151
+ ].map(({ icon: l, label: c, generate: w }) => /* @__PURE__ */ a(
152
+ "button",
153
+ {
154
+ type: "button",
155
+ "data-tooltip-id": L,
156
+ "data-tooltip-content": c,
157
+ "data-tooltip-place": "top",
158
+ className: "text-neutral-content hover:bg-base-100 hover:text-base-content flex h-6 items-center justify-center rounded px-2 transition-colors",
159
+ onClick: () => C(w()),
160
+ children: /* @__PURE__ */ a(l, { className: "size-3.5" })
161
+ },
162
+ c
163
+ )) }) });
164
+ }, B = y(
165
+ () => import("./CodeEditor-axBXmPH8.js").then((e) => e.a).then((e) => ({ default: e.CodeEditor }))
166
+ );
167
+ function G() {
168
+ const { query: e } = b(), {
169
+ actions: { setProp: t },
170
+ id: n,
171
+ text: o
172
+ } = u((r) => {
173
+ var i;
174
+ return {
175
+ text: typeof ((i = r.data.props) == null ? void 0 : i.text) == "string" ? r.data.props.text : ""
176
+ };
177
+ }), s = F(e);
178
+ return /* @__PURE__ */ a("div", { className: "bg-base-100 flex min-h-0 flex-1 flex-col p-4", children: /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 [&>div]:h-full", children: /* @__PURE__ */ a(S, { fallback: null, children: /* @__PURE__ */ a(
179
+ B,
180
+ {
181
+ value: o,
182
+ onChange: (r) => t((i) => i.text = r),
183
+ language: "html",
184
+ height: "100%",
185
+ lineNumbers: !1,
186
+ theme: "auto",
187
+ autoFormatOnMount: !0,
188
+ autoFormatMountKey: n,
189
+ toolbarDenseCode: !0,
190
+ htmlVariableCompletionOptions: s,
191
+ placeholder: "Enter HTML content"
192
+ }
193
+ ) }) }) });
194
+ }
195
+ const U = [
196
+ { value: "full", label: "Rich" },
197
+ { value: "inline", label: "Inline" }
198
+ ];
199
+ function Q() {
200
+ const {
201
+ actions: { setProp: e },
202
+ mode: t
203
+ } = u((n) => {
204
+ var o, s, r;
205
+ return {
206
+ mode: ((r = (s = (o = n.data) == null ? void 0 : o.props) == null ? void 0 : s.richText) == null ? void 0 : r.mode) || "full"
207
+ };
208
+ });
209
+ return /* @__PURE__ */ a(x, { label: "Format", frame: "bare", children: /* @__PURE__ */ a("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ a(
210
+ k,
211
+ {
212
+ dense: !0,
213
+ "aria-label": "Text format",
214
+ value: t,
215
+ onChange: (n) => e((o) => {
216
+ (!o.richText || typeof o.richText != "object") && (o.richText = {}), o.richText.mode = n;
217
+ }, 0),
218
+ options: U
219
+ }
220
+ ) }) });
221
+ }
222
+ const oe = () => {
223
+ const [e, t] = P(!1);
224
+ return q({
225
+ Content: /* @__PURE__ */ m(W, { collapsible: !1, children: [
226
+ /* @__PURE__ */ a(_, { propKey: "text", propType: "component" }),
227
+ /* @__PURE__ */ a(Q, {}),
228
+ /* @__PURE__ */ m("div", { className: "flex w-full gap-2 [&>*]:flex-1", children: [
229
+ /* @__PURE__ */ m("button", { type: "button", className: "ph-toolbar-dashed-btn", onClick: () => t(!0), children: [
230
+ /* @__PURE__ */ a(h, { size: 12, "aria-hidden": !0 }),
231
+ "Edit HTML"
232
+ ] }),
233
+ /* @__PURE__ */ a(z, { id: "settings/ai-button" })
234
+ ] }),
235
+ /* @__PURE__ */ a(
236
+ j,
237
+ {
238
+ isOpen: e,
239
+ onClose: () => t(!1),
240
+ title: "Edit HTML",
241
+ icon: /* @__PURE__ */ a(h, { className: "size-3.5" }),
242
+ storageKey: "textContentEditor",
243
+ autoSize: !1,
244
+ defaultWidth: 720,
245
+ defaultHeight: 520,
246
+ minWidth: 420,
247
+ maxWidth: 1100,
248
+ minHeight: 320,
249
+ maxHeight: 900,
250
+ backdrop: !0,
251
+ edges: ["e", "s", "se", "w", "sw", "n", "ne", "nw"],
252
+ children: e ? /* @__PURE__ */ a(G, {}) : null
253
+ }
254
+ )
255
+ ] })
256
+ });
257
+ };
258
+ export {
259
+ oe as TextMainTab
260
+ };
@@ -0,0 +1,381 @@
1
+ import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
+ import { useState as I, useRef as S, useMemo as z } from "react";
3
+ import { d as F, W as R, bV as _, T as W, aB as X, aO as B } from "./index-C66dAl3Q.js";
4
+ import { F as H } from "./FloatingPanel-DJP5Vhua.js";
5
+ import "@craftjs/utils";
6
+ import "@craftjs/core";
7
+ import { F as j, C as $ } from "./dialogAtoms-CeQ2G05l.js";
8
+ import { e as ce, p as de } from "./TypographyPresetInput-DqnGSgR2.js";
9
+ const G = [
10
+ ["0.625rem", "XS (10px)"],
11
+ ["0.75rem", "SM (12px)"],
12
+ ["0.875rem", "Base- (14px)"],
13
+ ["1rem", "Base (16px)"],
14
+ ["1.125rem", "LG (18px)"],
15
+ ["1.25rem", "XL (20px)"],
16
+ ["1.5rem", "2XL (24px)"],
17
+ ["1.875rem", "3XL (30px)"],
18
+ ["2.25rem", "4XL (36px)"],
19
+ ["3rem", "5XL (48px)"],
20
+ ["3.75rem", "6XL (60px)"],
21
+ ["4.5rem", "7XL (72px)"],
22
+ ["6rem", "8XL (96px)"],
23
+ ["8rem", "9XL (128px)"]
24
+ ], K = [
25
+ ["100", "Thin"],
26
+ ["200", "Extra Light"],
27
+ ["300", "Light"],
28
+ ["400", "Normal"],
29
+ ["500", "Medium"],
30
+ ["600", "Semibold"],
31
+ ["700", "Bold"],
32
+ ["800", "Extra Bold"],
33
+ ["900", "Black"]
34
+ ], M = [
35
+ ["1", "None"],
36
+ ["1.15", "Tight"],
37
+ ["1.2", "Snug"],
38
+ ["1.25", "Compact"],
39
+ ["1.375", "Normal-"],
40
+ ["1.5", "Normal"],
41
+ ["1.625", "Relaxed"],
42
+ ["1.75", "Loose"],
43
+ ["2", "Extra"]
44
+ ], V = [
45
+ ["-0.05em", "Tighter"],
46
+ ["-0.025em", "Tight"],
47
+ ["normal", "Normal"],
48
+ ["0.025em", "Wide"],
49
+ ["0.05em", "Wider"],
50
+ ["0.1em", "Widest"]
51
+ ], U = [
52
+ ["none", "None"],
53
+ ["uppercase", "UPPERCASE"],
54
+ ["lowercase", "lowercase"],
55
+ ["capitalize", "Capitalize"]
56
+ ], q = [
57
+ ["none", "None"],
58
+ ["underline", "Underline"],
59
+ ["line-through", "Strikethrough"],
60
+ ["overline", "Overline"]
61
+ ], J = [
62
+ { value: "left", label: "L", tooltip: "Left" },
63
+ { value: "center", label: "C", tooltip: "Center" },
64
+ { value: "right", label: "R", tooltip: "Right" },
65
+ { value: "justify", label: "J", tooltip: "Justify" }
66
+ ];
67
+ function x({ children: r }) {
68
+ return /* @__PURE__ */ o("label", { className: "text-neutral-content mb-1 block text-[11px] font-medium", children: r });
69
+ }
70
+ function p({
71
+ label: r,
72
+ value: l,
73
+ onChange: c,
74
+ options: b,
75
+ id: h
76
+ }) {
77
+ return /* @__PURE__ */ i("div", { children: [
78
+ /* @__PURE__ */ o(x, { children: r }),
79
+ /* @__PURE__ */ o(B, { value: l, onChange: c, placeholder: r, propKey: h, children: b.map(([f, g]) => /* @__PURE__ */ o("option", { value: f, children: g }, f)) })
80
+ ] });
81
+ }
82
+ function Z(r) {
83
+ return !!r && typeof r == "object" && typeof r.r == "number" && typeof r.g == "number" && typeof r.b == "number";
84
+ }
85
+ function Y(r) {
86
+ if (r == null) return null;
87
+ if (typeof r == "string") return r;
88
+ if (typeof r == "object") {
89
+ const l = r;
90
+ if (typeof l.value == "string") return l.value;
91
+ if (Z(l)) {
92
+ const c = typeof l.a == "number" ? l.a : 1;
93
+ return `rgba(${l.r}, ${l.g}, ${l.b}, ${c})`;
94
+ }
95
+ }
96
+ return String(r);
97
+ }
98
+ function ie({
99
+ mode: r,
100
+ initialDraft: l,
101
+ originalName: c,
102
+ existingNames: b,
103
+ initialPosition: h,
104
+ defaultWidth: f,
105
+ defaultHeight: g,
106
+ onClose: y,
107
+ onSave: L,
108
+ onDelete: v
109
+ }) {
110
+ const [e, O] = I(l), N = S(null), T = S(null), [, k] = F(j), [, w] = F($), a = (t, s) => {
111
+ O((n) => ({ ...n, [t]: s }));
112
+ }, u = e.name.trim(), d = z(() => {
113
+ if (!u) return "Name is required";
114
+ const t = u.toLowerCase();
115
+ return b.some((n) => n.toLowerCase() === t && n !== c) ? `A style named "${u}" already exists` : null;
116
+ }, [u, b, c]), C = !d, A = () => {
117
+ var s;
118
+ const t = ((s = N.current) == null ? void 0 : s.getBoundingClientRect()) || null;
119
+ k({
120
+ enabled: !0,
121
+ value: e.fontFamily ? [e.fontFamily] : [],
122
+ originalValue: e.fontFamily ? [e.fontFamily] : [],
123
+ changed: (n) => {
124
+ const m = Array.isArray(n) ? n[0] : n;
125
+ a("fontFamily", m || "");
126
+ },
127
+ preview: (n) => {
128
+ const m = Array.isArray(n) ? n[0] : n;
129
+ a("fontFamily", m || "");
130
+ },
131
+ e: t
132
+ });
133
+ }, E = () => {
134
+ var s;
135
+ const t = ((s = T.current) == null ? void 0 : s.getBoundingClientRect()) || null;
136
+ w({
137
+ enabled: !0,
138
+ value: e.color || "",
139
+ prefix: "",
140
+ changed: (n) => {
141
+ const m = Y(n);
142
+ m != null && a("color", m);
143
+ },
144
+ e: t,
145
+ mode: "picker",
146
+ propKey: "text-style-editor-color"
147
+ });
148
+ }, P = {
149
+ fontFamily: e.fontFamily || "inherit",
150
+ fontSize: e.fontSize || "1rem",
151
+ fontWeight: e.fontWeight || "400",
152
+ lineHeight: e.lineHeight || "1.5",
153
+ letterSpacing: e.letterSpacing || "normal",
154
+ textTransform: e.textTransform || "none",
155
+ color: e.color || void 0,
156
+ textDecoration: e.textDecoration && e.textDecoration !== "none" ? e.textDecoration : void 0,
157
+ textAlign: e.textAlign || "left"
158
+ }, D = r === "new" ? "New Text Style" : `Edit · ${c ?? e.name}`;
159
+ return /* @__PURE__ */ i(
160
+ H,
161
+ {
162
+ isOpen: !0,
163
+ onClose: y,
164
+ title: D,
165
+ storageKey: "text-style-editor",
166
+ autoSize: !1,
167
+ defaultWidth: f,
168
+ defaultHeight: g,
169
+ minWidth: 300,
170
+ maxWidth: 520,
171
+ minHeight: 420,
172
+ initialPosition: h,
173
+ persistSize: !1,
174
+ zIndex: R,
175
+ scrollable: !0,
176
+ bodyClassName: "text-base-content flex flex-col gap-3 p-3 text-xs",
177
+ children: [
178
+ /* @__PURE__ */ i("div", { children: [
179
+ /* @__PURE__ */ o(x, { children: "Name" }),
180
+ /* @__PURE__ */ o(
181
+ "input",
182
+ {
183
+ type: "text",
184
+ value: e.name,
185
+ onChange: (t) => a("name", t.target.value),
186
+ placeholder: "e.g. Heading 2",
187
+ "aria-invalid": !!d,
188
+ "aria-describedby": d ? "text-style-name-error" : void 0,
189
+ className: `input-plain border-base-300 bg-base-100 w-full rounded-md border px-2 py-1.5 text-xs outline-none ${d ? "border-error focus:border-error" : "focus:border-primary"}`
190
+ }
191
+ ),
192
+ d && /* @__PURE__ */ o(
193
+ "p",
194
+ {
195
+ id: "text-style-name-error",
196
+ role: "alert",
197
+ className: "text-error mt-1 text-[11px] leading-tight",
198
+ children: d
199
+ }
200
+ )
201
+ ] }),
202
+ /* @__PURE__ */ i("div", { children: [
203
+ /* @__PURE__ */ o(x, { children: "Font Family" }),
204
+ /* @__PURE__ */ i(
205
+ "button",
206
+ {
207
+ type: "button",
208
+ ref: N,
209
+ onClick: A,
210
+ className: "border-base-300 bg-base-100 text-base-content hover:bg-base-200 flex h-8 w-full items-center justify-between gap-2 rounded-md border px-2 text-left text-xs",
211
+ style: { fontFamily: e.fontFamily || void 0 },
212
+ children: [
213
+ /* @__PURE__ */ o("span", { className: "truncate", children: e.fontFamily || "Choose typeface…" }),
214
+ /* @__PURE__ */ o(_, { className: "text-neutral-content size-3 shrink-0", "aria-hidden": !0 })
215
+ ]
216
+ }
217
+ )
218
+ ] }),
219
+ /* @__PURE__ */ i("div", { className: "grid grid-cols-2 gap-2", children: [
220
+ /* @__PURE__ */ o(
221
+ p,
222
+ {
223
+ id: "text-style-size",
224
+ label: "Size",
225
+ value: e.fontSize,
226
+ onChange: (t) => a("fontSize", t),
227
+ options: G
228
+ }
229
+ ),
230
+ /* @__PURE__ */ o(
231
+ p,
232
+ {
233
+ id: "text-style-weight",
234
+ label: "Weight",
235
+ value: e.fontWeight,
236
+ onChange: (t) => a("fontWeight", t),
237
+ options: K
238
+ }
239
+ ),
240
+ /* @__PURE__ */ o(
241
+ p,
242
+ {
243
+ id: "text-style-line-height",
244
+ label: "Line Height",
245
+ value: e.lineHeight,
246
+ onChange: (t) => a("lineHeight", t),
247
+ options: M
248
+ }
249
+ ),
250
+ /* @__PURE__ */ o(
251
+ p,
252
+ {
253
+ id: "text-style-letter-spacing",
254
+ label: "Letter Spacing",
255
+ value: e.letterSpacing,
256
+ onChange: (t) => a("letterSpacing", t),
257
+ options: V
258
+ }
259
+ ),
260
+ /* @__PURE__ */ o(
261
+ p,
262
+ {
263
+ id: "text-style-transform",
264
+ label: "Transform",
265
+ value: e.textTransform,
266
+ onChange: (t) => a("textTransform", t),
267
+ options: U
268
+ }
269
+ ),
270
+ /* @__PURE__ */ o(
271
+ p,
272
+ {
273
+ id: "text-style-decoration",
274
+ label: "Decoration",
275
+ value: e.textDecoration,
276
+ onChange: (t) => a("textDecoration", t),
277
+ options: q
278
+ }
279
+ )
280
+ ] }),
281
+ /* @__PURE__ */ i("div", { children: [
282
+ /* @__PURE__ */ o(x, { children: "Text Align" }),
283
+ /* @__PURE__ */ o(
284
+ W,
285
+ {
286
+ value: e.textAlign,
287
+ onChange: (t) => a("textAlign", t),
288
+ options: J,
289
+ "aria-label": "Text alignment"
290
+ }
291
+ )
292
+ ] }),
293
+ /* @__PURE__ */ i("div", { children: [
294
+ /* @__PURE__ */ o(x, { children: "Color" }),
295
+ /* @__PURE__ */ i(
296
+ "button",
297
+ {
298
+ type: "button",
299
+ ref: T,
300
+ onClick: E,
301
+ className: "border-base-300 bg-base-100 text-base-content hover:bg-base-200 flex h-8 w-full items-center gap-2 rounded-md border px-2 text-left text-xs",
302
+ children: [
303
+ /* @__PURE__ */ o(
304
+ "span",
305
+ {
306
+ className: "border-base-300 size-4 shrink-0 rounded border",
307
+ style: { backgroundColor: e.color || "transparent" },
308
+ "aria-hidden": !0
309
+ }
310
+ ),
311
+ /* @__PURE__ */ o("span", { className: "min-w-0 flex-1 truncate", children: e.color || "Inherit" }),
312
+ e.color && /* @__PURE__ */ o(
313
+ "span",
314
+ {
315
+ role: "button",
316
+ tabIndex: 0,
317
+ onClick: (t) => {
318
+ t.stopPropagation(), a("color", "");
319
+ },
320
+ onKeyDown: (t) => {
321
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), t.stopPropagation(), a("color", ""));
322
+ },
323
+ className: "text-neutral-content hover:text-base-content shrink-0 px-1",
324
+ "aria-label": "Clear color",
325
+ children: "×"
326
+ }
327
+ )
328
+ ]
329
+ }
330
+ )
331
+ ] }),
332
+ /* @__PURE__ */ i("div", { className: "border-base-300/60 bg-base-200/40 rounded-md border p-3", children: [
333
+ /* @__PURE__ */ o("p", { className: "text-base-content/45 mb-1 text-[10px] font-semibold tracking-wider uppercase", children: "Preview" }),
334
+ /* @__PURE__ */ o("div", { style: P, className: "break-words", children: "The quick brown fox jumps over the lazy dog" })
335
+ ] }),
336
+ /* @__PURE__ */ i("div", { className: "border-base-300/60 mt-auto flex items-center justify-between gap-2 border-t pt-3", children: [
337
+ /* @__PURE__ */ o("div", { children: r === "edit" && v && /* @__PURE__ */ i(
338
+ "button",
339
+ {
340
+ type: "button",
341
+ onClick: v,
342
+ className: "text-error hover:bg-error/10 flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium transition-colors",
343
+ children: [
344
+ /* @__PURE__ */ o(X, { className: "size-3.5", "aria-hidden": !0 }),
345
+ "Delete"
346
+ ]
347
+ }
348
+ ) }),
349
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
350
+ /* @__PURE__ */ o(
351
+ "button",
352
+ {
353
+ type: "button",
354
+ onClick: y,
355
+ className: "text-base-content hover:bg-base-200 rounded-md px-3 py-1 text-xs font-medium transition-colors",
356
+ children: "Cancel"
357
+ }
358
+ ),
359
+ /* @__PURE__ */ o(
360
+ "button",
361
+ {
362
+ type: "button",
363
+ disabled: !C,
364
+ onClick: () => {
365
+ C && L({ ...e, name: u });
366
+ },
367
+ className: "bg-primary text-primary-content rounded-md px-3 py-1 text-xs font-semibold transition-opacity disabled:cursor-not-allowed disabled:opacity-40",
368
+ children: r === "new" ? "Save as new" : "Update"
369
+ }
370
+ )
371
+ ] })
372
+ ] })
373
+ ]
374
+ }
375
+ );
376
+ }
377
+ export {
378
+ ie as default,
379
+ ce as emptyDraft,
380
+ de as presetToDraft
381
+ };