@maily-to/ui 2.0.0-beta.1

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/dist/index.mjs ADDED
@@ -0,0 +1,684 @@
1
+ import { t as __exportAll } from "./chunk-CfYAbeIz.mjs";
2
+ import { c } from "react/compiler-runtime";
3
+ import { Select } from "@base-ui/react/select";
4
+ import * as React from "react";
5
+ import { useId, useState } from "react";
6
+ import { jsx } from "react/jsx-runtime";
7
+ import { useIsoLayoutEffect } from "@base-ui/utils/useIsoLayoutEffect";
8
+ import { useRefWithInit } from "@base-ui/utils/useRefWithInit";
9
+ import { ColorPicker } from "cromia";
10
+ import { UnitField } from "unit-field";
11
+ import { DEFAULT_EDITOR_THEME, deepMerge } from "@maily-to/shared";
12
+ //#region src/utils/constants.ts
13
+ const IS_PRODUCTION = process.env.NODE_ENV === "production";
14
+ const MAILY_UI_NAMESPACE = "[Maily UI]";
15
+ //#endregion
16
+ //#region src/components/condition-builder/condition-builder-context.ts
17
+ const ConditionBuilderContext = React.createContext(null);
18
+ function useConditionBuilderContext() {
19
+ const $ = c(1);
20
+ if ($[0] !== "e76481f4c4a69254449f5d2e778ae7cc8a2a6f071bacb0620046e0945c59f16e") {
21
+ for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
22
+ $[0] = "e76481f4c4a69254449f5d2e778ae7cc8a2a6f071bacb0620046e0945c59f16e";
23
+ }
24
+ const context = React.useContext(ConditionBuilderContext);
25
+ if (!context) throw new Error(`${MAILY_UI_NAMESPACE}: ConditionBuilderContext is missing. ConditionBuilder parts must be placed within <ConditionBuilder.Root>.`);
26
+ return context;
27
+ }
28
+ //#endregion
29
+ //#region src/components/condition-builder/condition-builder-action.tsx
30
+ function ConditionBuilderAction(props) {
31
+ const $ = c(7);
32
+ if ($[0] !== "d08d32c6deb8aa1f1390c210068c58c5db068c2ac89003430f98be69a506271d") {
33
+ for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
34
+ $[0] = "d08d32c6deb8aa1f1390c210068c58c5db068c2ac89003430f98be69a506271d";
35
+ }
36
+ const { action, onActionChange } = useConditionBuilderContext();
37
+ let t0;
38
+ if ($[1] !== onActionChange) {
39
+ t0 = (value) => onActionChange(value ?? "");
40
+ $[1] = onActionChange;
41
+ $[2] = t0;
42
+ } else t0 = $[2];
43
+ let t1;
44
+ if ($[3] !== action || $[4] !== props || $[5] !== t0) {
45
+ t1 = /* @__PURE__ */ jsx(Select.Root, {
46
+ value: action,
47
+ onValueChange: t0,
48
+ ...props
49
+ });
50
+ $[3] = action;
51
+ $[4] = props;
52
+ $[5] = t0;
53
+ $[6] = t1;
54
+ } else t1 = $[6];
55
+ return t1;
56
+ }
57
+ //#endregion
58
+ //#region src/components/condition-builder/condition-builder-clear.tsx
59
+ function ConditionBuilderClear(props) {
60
+ const $ = c(10);
61
+ if ($[0] !== "1cac21208af192e735fc4eb5ff2846d8408ce73fb63e320bb1f11766dfeeeb15") {
62
+ for (let $i = 0; $i < 10; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
63
+ $[0] = "1cac21208af192e735fc4eb5ff2846d8408ce73fb63e320bb1f11766dfeeeb15";
64
+ }
65
+ let onClick;
66
+ let rest;
67
+ if ($[1] !== props) {
68
+ ({onClick, ...rest} = props);
69
+ $[1] = props;
70
+ $[2] = onClick;
71
+ $[3] = rest;
72
+ } else {
73
+ onClick = $[2];
74
+ rest = $[3];
75
+ }
76
+ const { onClear } = useConditionBuilderContext();
77
+ let t0;
78
+ if ($[4] !== onClear || $[5] !== onClick) {
79
+ t0 = (e) => {
80
+ onClear();
81
+ onClick?.(e);
82
+ };
83
+ $[4] = onClear;
84
+ $[5] = onClick;
85
+ $[6] = t0;
86
+ } else t0 = $[6];
87
+ let t1;
88
+ if ($[7] !== rest || $[8] !== t0) {
89
+ t1 = /* @__PURE__ */ jsx("button", {
90
+ type: "button",
91
+ onClick: t0,
92
+ ...rest
93
+ });
94
+ $[7] = rest;
95
+ $[8] = t0;
96
+ $[9] = t1;
97
+ } else t1 = $[9];
98
+ return t1;
99
+ }
100
+ //#endregion
101
+ //#region src/components/condition-builder/condition-builder-field.tsx
102
+ function ConditionBuilderField(props) {
103
+ const $ = c(7);
104
+ if ($[0] !== "65f61e434d3a0487f21c2514a2a46f7bbaec4481e0a4464427eb92d218e125e7") {
105
+ for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
106
+ $[0] = "65f61e434d3a0487f21c2514a2a46f7bbaec4481e0a4464427eb92d218e125e7";
107
+ }
108
+ const { field, onFieldChange } = useConditionBuilderContext();
109
+ let t0;
110
+ if ($[1] !== onFieldChange) {
111
+ t0 = (e) => {
112
+ onFieldChange(e.target.value);
113
+ };
114
+ $[1] = onFieldChange;
115
+ $[2] = t0;
116
+ } else t0 = $[2];
117
+ let t1;
118
+ if ($[3] !== field || $[4] !== props || $[5] !== t0) {
119
+ t1 = /* @__PURE__ */ jsx("input", {
120
+ type: "text",
121
+ value: field,
122
+ onChange: t0,
123
+ ...props
124
+ });
125
+ $[3] = field;
126
+ $[4] = props;
127
+ $[5] = t0;
128
+ $[6] = t1;
129
+ } else t1 = $[6];
130
+ return t1;
131
+ }
132
+ //#endregion
133
+ //#region src/components/condition-builder/condition-builder-operator.tsx
134
+ function ConditionBuilderOperator(props) {
135
+ const $ = c(7);
136
+ if ($[0] !== "15848c6c9f1237d887542146d4edef17bb30af01879a62b9f92afa55c2258423") {
137
+ for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
138
+ $[0] = "15848c6c9f1237d887542146d4edef17bb30af01879a62b9f92afa55c2258423";
139
+ }
140
+ const { operator, onOperatorChange } = useConditionBuilderContext();
141
+ let t0;
142
+ if ($[1] !== onOperatorChange) {
143
+ t0 = (value) => {
144
+ if (value !== null) onOperatorChange(value);
145
+ };
146
+ $[1] = onOperatorChange;
147
+ $[2] = t0;
148
+ } else t0 = $[2];
149
+ let t1;
150
+ if ($[3] !== operator || $[4] !== props || $[5] !== t0) {
151
+ t1 = /* @__PURE__ */ jsx(Select.Root, {
152
+ value: operator,
153
+ onValueChange: t0,
154
+ ...props
155
+ });
156
+ $[3] = operator;
157
+ $[4] = props;
158
+ $[5] = t0;
159
+ $[6] = t1;
160
+ } else t1 = $[6];
161
+ return t1;
162
+ }
163
+ //#endregion
164
+ //#region src/components/condition-builder/condition-builder-root.tsx
165
+ function ConditionBuilderRoot(props) {
166
+ const $ = c(29);
167
+ if ($[0] !== "649d0ac393f7051629f9e59097fe01b98ab390ea8389852e2f7b4463784a88a1") {
168
+ for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
169
+ $[0] = "649d0ac393f7051629f9e59097fe01b98ab390ea8389852e2f7b4463784a88a1";
170
+ }
171
+ let action;
172
+ let field;
173
+ let onActionChange;
174
+ let onClear;
175
+ let onFieldChange;
176
+ let onOperatorChange;
177
+ let onValueChange;
178
+ let operator;
179
+ let operatorNeedsValue;
180
+ let rest;
181
+ let value;
182
+ if ($[1] !== props) {
183
+ ({action, field, operator, value, onActionChange, onFieldChange, onOperatorChange, onValueChange, onClear, operatorNeedsValue, ...rest} = props);
184
+ $[1] = props;
185
+ $[2] = action;
186
+ $[3] = field;
187
+ $[4] = onActionChange;
188
+ $[5] = onClear;
189
+ $[6] = onFieldChange;
190
+ $[7] = onOperatorChange;
191
+ $[8] = onValueChange;
192
+ $[9] = operator;
193
+ $[10] = operatorNeedsValue;
194
+ $[11] = rest;
195
+ $[12] = value;
196
+ } else {
197
+ action = $[2];
198
+ field = $[3];
199
+ onActionChange = $[4];
200
+ onClear = $[5];
201
+ onFieldChange = $[6];
202
+ onOperatorChange = $[7];
203
+ onValueChange = $[8];
204
+ operator = $[9];
205
+ operatorNeedsValue = $[10];
206
+ rest = $[11];
207
+ value = $[12];
208
+ }
209
+ let t0;
210
+ if ($[13] !== action || $[14] !== field || $[15] !== onActionChange || $[16] !== onClear || $[17] !== onFieldChange || $[18] !== onOperatorChange || $[19] !== onValueChange || $[20] !== operator || $[21] !== operatorNeedsValue || $[22] !== value) {
211
+ t0 = {
212
+ action,
213
+ field,
214
+ operator,
215
+ value,
216
+ onActionChange,
217
+ onFieldChange,
218
+ onOperatorChange,
219
+ onValueChange,
220
+ onClear,
221
+ operatorNeedsValue
222
+ };
223
+ $[13] = action;
224
+ $[14] = field;
225
+ $[15] = onActionChange;
226
+ $[16] = onClear;
227
+ $[17] = onFieldChange;
228
+ $[18] = onOperatorChange;
229
+ $[19] = onValueChange;
230
+ $[20] = operator;
231
+ $[21] = operatorNeedsValue;
232
+ $[22] = value;
233
+ $[23] = t0;
234
+ } else t0 = $[23];
235
+ const contextValue = t0;
236
+ let t1;
237
+ if ($[24] !== rest) {
238
+ t1 = /* @__PURE__ */ jsx("div", { ...rest });
239
+ $[24] = rest;
240
+ $[25] = t1;
241
+ } else t1 = $[25];
242
+ let t2;
243
+ if ($[26] !== contextValue || $[27] !== t1) {
244
+ t2 = /* @__PURE__ */ jsx(ConditionBuilderContext.Provider, {
245
+ value: contextValue,
246
+ children: t1
247
+ });
248
+ $[26] = contextValue;
249
+ $[27] = t1;
250
+ $[28] = t2;
251
+ } else t2 = $[28];
252
+ return t2;
253
+ }
254
+ //#endregion
255
+ //#region src/components/condition-builder/condition-builder-value.tsx
256
+ function ConditionBuilderValue(props) {
257
+ const $ = c(7);
258
+ if ($[0] !== "1c5d05cf80ecce6330f24480958c46cee1972d2dfa0a2e4f81cbb686dc4a7c53") {
259
+ for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
260
+ $[0] = "1c5d05cf80ecce6330f24480958c46cee1972d2dfa0a2e4f81cbb686dc4a7c53";
261
+ }
262
+ const { value, onValueChange, operatorNeedsValue } = useConditionBuilderContext();
263
+ if (!operatorNeedsValue) return null;
264
+ let t0;
265
+ if ($[1] !== onValueChange) {
266
+ t0 = (e) => {
267
+ onValueChange(e.target.value);
268
+ };
269
+ $[1] = onValueChange;
270
+ $[2] = t0;
271
+ } else t0 = $[2];
272
+ let t1;
273
+ if ($[3] !== props || $[4] !== t0 || $[5] !== value) {
274
+ t1 = /* @__PURE__ */ jsx("input", {
275
+ type: "text",
276
+ value,
277
+ onChange: t0,
278
+ ...props
279
+ });
280
+ $[3] = props;
281
+ $[4] = t0;
282
+ $[5] = value;
283
+ $[6] = t1;
284
+ } else t1 = $[6];
285
+ return t1;
286
+ }
287
+ //#endregion
288
+ //#region src/components/condition-builder/condition-builder.tsx
289
+ var condition_builder_exports = /* @__PURE__ */ __exportAll({
290
+ ActionSelect: () => ConditionBuilderAction,
291
+ ClearButton: () => ConditionBuilderClear,
292
+ FieldInput: () => ConditionBuilderField,
293
+ OperatorSelect: () => ConditionBuilderOperator,
294
+ Root: () => ConditionBuilderRoot,
295
+ ValueInput: () => ConditionBuilderValue
296
+ });
297
+ //#endregion
298
+ //#region src/hooks/use-maily-id.ts
299
+ function useMailyId() {
300
+ const $ = c(1);
301
+ if ($[0] !== "e7fd377d7fd34be0a00159a2f30a6e7d07845a4be5f247194f973aa13ceb0754") {
302
+ for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
303
+ $[0] = "e7fd377d7fd34be0a00159a2f30a6e7d07845a4be5f247194f973aa13ceb0754";
304
+ }
305
+ return `mly:${useId()}`;
306
+ }
307
+ //#endregion
308
+ //#region src/hooks/use-merge-refs.ts
309
+ /**
310
+ * This is a copy of the useMergeRefs hook from floating-ui.
311
+ * @see https://floating-ui.com/docs/react-utils#usemergerefs
312
+ */
313
+ function useMergeRefs(refs) {
314
+ const cleanupRef = React.useRef(void 0);
315
+ const refEffect = React.useCallback((instance) => {
316
+ const cleanups = refs.map((ref) => {
317
+ if (ref == null) return;
318
+ if (typeof ref === "function") {
319
+ const refCallback = ref;
320
+ const refCleanup = refCallback(instance);
321
+ return typeof refCleanup === "function" ? refCleanup : () => {
322
+ refCallback(null);
323
+ };
324
+ }
325
+ ref.current = instance;
326
+ return () => {
327
+ ref.current = null;
328
+ };
329
+ });
330
+ return () => {
331
+ cleanups.forEach((refCleanup_0) => refCleanup_0?.());
332
+ };
333
+ }, refs);
334
+ return React.useMemo(() => {
335
+ if (refs.every((ref_0) => ref_0 == null)) return null;
336
+ return (value) => {
337
+ if (cleanupRef.current) {
338
+ cleanupRef.current();
339
+ cleanupRef.current = void 0;
340
+ }
341
+ if (value != null) cleanupRef.current = refEffect(value);
342
+ };
343
+ }, refs);
344
+ }
345
+ //#endregion
346
+ //#region src/hooks/use-value-as-ref.ts
347
+ /**
348
+ * Untracks the provided value by turning it into a ref to remove its reactivity.
349
+ *
350
+ * Used to access the passed value inside `React.useEffect` without causing the effect to re-run when the value changes.
351
+ */
352
+ function useValueAsRef(value) {
353
+ const latest = useRefWithInit(createLatestRef, value).current;
354
+ latest.next = value;
355
+ useIsoLayoutEffect(latest.effect);
356
+ return latest;
357
+ }
358
+ function createLatestRef(value) {
359
+ const latest = {
360
+ current: value,
361
+ next: value,
362
+ effect: () => {
363
+ latest.current = latest.next;
364
+ }
365
+ };
366
+ return latest;
367
+ }
368
+ //#endregion
369
+ //#region src/components/settings-field/settings-field-group.tsx
370
+ function SettingsFieldGroup(props) {
371
+ const $ = c(3);
372
+ if ($[0] !== "f96beb346c18d66db1b9baf6b0e37f2dbf899325731ea0fa32d4085bd0d732da") {
373
+ for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
374
+ $[0] = "f96beb346c18d66db1b9baf6b0e37f2dbf899325731ea0fa32d4085bd0d732da";
375
+ }
376
+ let t0;
377
+ if ($[1] !== props) {
378
+ t0 = /* @__PURE__ */ jsx("div", {
379
+ role: "group",
380
+ ...props
381
+ });
382
+ $[1] = props;
383
+ $[2] = t0;
384
+ } else t0 = $[2];
385
+ return t0;
386
+ }
387
+ //#endregion
388
+ //#region src/components/settings-field/settings-field-context.ts
389
+ const SettingsFieldContext = React.createContext(null);
390
+ function useSettingsFieldContext() {
391
+ const $ = c(1);
392
+ if ($[0] !== "c84888ed2e059806fa71c02f8df78e10d3bf08d4aff8faf09195ea9acca93d57") {
393
+ for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
394
+ $[0] = "c84888ed2e059806fa71c02f8df78e10d3bf08d4aff8faf09195ea9acca93d57";
395
+ }
396
+ const context = React.useContext(SettingsFieldContext);
397
+ if (!context) throw new Error(`${MAILY_UI_NAMESPACE}: SettingsFieldContext is missing. SettingsField parts must be placed within <SettingsField.Root>.`);
398
+ return context;
399
+ }
400
+ //#endregion
401
+ //#region src/components/settings-field/settings-field-label.tsx
402
+ function SettingsFieldLabel(props) {
403
+ const $ = c(4);
404
+ if ($[0] !== "48addfe6a95d4090f4a39453e7afdeeb9b6a7e37fb38efeb94d80ff9d4b55268") {
405
+ for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
406
+ $[0] = "48addfe6a95d4090f4a39453e7afdeeb9b6a7e37fb38efeb94d80ff9d4b55268";
407
+ }
408
+ const { id } = useSettingsFieldContext();
409
+ let t0;
410
+ if ($[1] !== id || $[2] !== props) {
411
+ t0 = /* @__PURE__ */ jsx("label", {
412
+ htmlFor: id,
413
+ ...props
414
+ });
415
+ $[1] = id;
416
+ $[2] = props;
417
+ $[3] = t0;
418
+ } else t0 = $[3];
419
+ return t0;
420
+ }
421
+ //#endregion
422
+ //#region src/components/settings-field/settings-field-root.tsx
423
+ function SettingsFieldRoot(props) {
424
+ const $ = c(8);
425
+ if ($[0] !== "e5a6123141e99863c76c6fad5e55fa860ed5c64951b70fb03c026a46051fb07a") {
426
+ for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
427
+ $[0] = "e5a6123141e99863c76c6fad5e55fa860ed5c64951b70fb03c026a46051fb07a";
428
+ }
429
+ const id = useMailyId();
430
+ let t0;
431
+ if ($[1] !== id) {
432
+ t0 = { id };
433
+ $[1] = id;
434
+ $[2] = t0;
435
+ } else t0 = $[2];
436
+ let t1;
437
+ if ($[3] !== props) {
438
+ t1 = /* @__PURE__ */ jsx("div", { ...props });
439
+ $[3] = props;
440
+ $[4] = t1;
441
+ } else t1 = $[4];
442
+ let t2;
443
+ if ($[5] !== t0 || $[6] !== t1) {
444
+ t2 = /* @__PURE__ */ jsx(SettingsFieldContext, {
445
+ value: t0,
446
+ children: t1
447
+ });
448
+ $[5] = t0;
449
+ $[6] = t1;
450
+ $[7] = t2;
451
+ } else t2 = $[7];
452
+ return t2;
453
+ }
454
+ //#endregion
455
+ //#region src/components/settings-field/settings-field.ts
456
+ var settings_field_exports = /* @__PURE__ */ __exportAll({
457
+ Group: () => SettingsFieldGroup,
458
+ Label: () => SettingsFieldLabel,
459
+ Root: () => SettingsFieldRoot
460
+ });
461
+ //#endregion
462
+ //#region src/components/theme-settings/theme-settings-context.ts
463
+ const ThemeSettingsContext = React.createContext(null);
464
+ function useThemeSettingsContext() {
465
+ const $ = c(1);
466
+ if ($[0] !== "eb1d74541f2031116105c69fff970eb42461a996a1574647a03a15305ea130c6") {
467
+ for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
468
+ $[0] = "eb1d74541f2031116105c69fff970eb42461a996a1574647a03a15305ea130c6";
469
+ }
470
+ const context = React.useContext(ThemeSettingsContext);
471
+ if (!context) throw new Error(`${MAILY_UI_NAMESPACE}: ThemeSettingsContext is missing. ThemeSettings parts must be placed within <ThemeSettings.Root>.`);
472
+ return context;
473
+ }
474
+ //#endregion
475
+ //#region src/components/theme-settings/theme-settings-root.tsx
476
+ function ThemeSettingsRoot(props) {
477
+ const $ = c(10);
478
+ if ($[0] !== "a184ea6f1dfc48722d8fdc9a8f09a5524a071912e4aa8ae645cda9b7e57ec275") {
479
+ for (let $i = 0; $i < 10; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
480
+ $[0] = "a184ea6f1dfc48722d8fdc9a8f09a5524a071912e4aa8ae645cda9b7e57ec275";
481
+ }
482
+ let ref;
483
+ let rest;
484
+ if ($[1] !== props) {
485
+ ({ref, ...rest} = props);
486
+ $[1] = props;
487
+ $[2] = ref;
488
+ $[3] = rest;
489
+ } else {
490
+ ref = $[2];
491
+ rest = $[3];
492
+ }
493
+ const internalRef = React.useRef(null);
494
+ let t0;
495
+ if ($[4] !== ref) {
496
+ t0 = [ref, internalRef];
497
+ $[4] = ref;
498
+ $[5] = t0;
499
+ } else t0 = $[5];
500
+ const mergedRef = useMergeRefs(t0);
501
+ let t1;
502
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
503
+ t1 = { container: internalRef };
504
+ $[6] = t1;
505
+ } else t1 = $[6];
506
+ let t2;
507
+ if ($[7] !== mergedRef || $[8] !== rest) {
508
+ t2 = /* @__PURE__ */ jsx(ThemeSettingsContext, {
509
+ value: t1,
510
+ children: /* @__PURE__ */ jsx("div", {
511
+ ref: mergedRef,
512
+ ...rest
513
+ })
514
+ });
515
+ $[7] = mergedRef;
516
+ $[8] = rest;
517
+ $[9] = t2;
518
+ } else t2 = $[9];
519
+ return t2;
520
+ }
521
+ //#endregion
522
+ //#region src/components/theme-settings/theme-settings.ts
523
+ var theme_settings_exports = /* @__PURE__ */ __exportAll({ Root: () => ThemeSettingsRoot });
524
+ //#endregion
525
+ //#region src/hooks/use-controllable-state.ts
526
+ function useControllableState(options) {
527
+ const $ = c(6);
528
+ if ($[0] !== "9bf1fd7f815733e7696973745a8e997c6a7ca8f6801b793ddbbf659dec25e82e") {
529
+ for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
530
+ $[0] = "9bf1fd7f815733e7696973745a8e997c6a7ca8f6801b793ddbbf659dec25e82e";
531
+ }
532
+ const { value: controlledValue, defaultValue, onChange } = options;
533
+ const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
534
+ const resolvedValue = controlledValue ?? uncontrolledValue;
535
+ let t0;
536
+ if ($[1] !== onChange) {
537
+ t0 = (next) => {
538
+ onChange?.(next);
539
+ setUncontrolledValue(next);
540
+ };
541
+ $[1] = onChange;
542
+ $[2] = t0;
543
+ } else t0 = $[2];
544
+ const setValue = t0;
545
+ let t1;
546
+ if ($[3] !== resolvedValue || $[4] !== setValue) {
547
+ t1 = [resolvedValue, setValue];
548
+ $[3] = resolvedValue;
549
+ $[4] = setValue;
550
+ $[5] = t1;
551
+ } else t1 = $[5];
552
+ return t1;
553
+ }
554
+ //#endregion
555
+ //#region src/components/theme-provider/theme-context.ts
556
+ const ThemeContext = React.createContext(null);
557
+ function useThemeContext() {
558
+ const $ = c(1);
559
+ if ($[0] !== "155eb7018b255df057ebd1e9085e5555bc8dfdc5f9388a942a2a74ca7af39d00") {
560
+ for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
561
+ $[0] = "155eb7018b255df057ebd1e9085e5555bc8dfdc5f9388a942a2a74ca7af39d00";
562
+ }
563
+ const context = React.useContext(ThemeContext);
564
+ if (!context) throw new Error(`${MAILY_UI_NAMESPACE}: ThemeContext is missing. Components must be placed within <ThemeProvider>.`);
565
+ return context;
566
+ }
567
+ //#endregion
568
+ //#region src/components/theme-provider/theme-provider.tsx
569
+ function ThemeProvider(props) {
570
+ const $ = c(11);
571
+ if ($[0] !== "4f864dcbb81a5f52bfb68ee984a4dafc7dc65a65b65f9581109b135fd829c1bf") {
572
+ for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
573
+ $[0] = "4f864dcbb81a5f52bfb68ee984a4dafc7dc65a65b65f9581109b135fd829c1bf";
574
+ }
575
+ const { theme: themeProp, defaultTheme, onThemeChange, children } = props;
576
+ const t0 = defaultTheme ?? DEFAULT_EDITOR_THEME;
577
+ let t1;
578
+ if ($[1] !== onThemeChange || $[2] !== t0 || $[3] !== themeProp) {
579
+ t1 = {
580
+ value: themeProp,
581
+ defaultValue: t0,
582
+ onChange: onThemeChange
583
+ };
584
+ $[1] = onThemeChange;
585
+ $[2] = t0;
586
+ $[3] = themeProp;
587
+ $[4] = t1;
588
+ } else t1 = $[4];
589
+ const [theme, setTheme] = useControllableState(t1);
590
+ let t2;
591
+ if ($[5] !== setTheme || $[6] !== theme) {
592
+ t2 = {
593
+ theme,
594
+ setTheme
595
+ };
596
+ $[5] = setTheme;
597
+ $[6] = theme;
598
+ $[7] = t2;
599
+ } else t2 = $[7];
600
+ let t3;
601
+ if ($[8] !== children || $[9] !== t2) {
602
+ t3 = /* @__PURE__ */ jsx(ThemeContext, {
603
+ value: t2,
604
+ children
605
+ });
606
+ $[8] = children;
607
+ $[9] = t2;
608
+ $[10] = t3;
609
+ } else t3 = $[10];
610
+ return t3;
611
+ }
612
+ //#endregion
613
+ //#region src/hooks/use-theme.ts
614
+ function useTheme() {
615
+ const $ = c(9);
616
+ if ($[0] !== "39e18c05e947e7b0928d17dadfbaca742c7fac0d68c52e61e21562ce30eb7bb7") {
617
+ for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
618
+ $[0] = "39e18c05e947e7b0928d17dadfbaca742c7fac0d68c52e61e21562ce30eb7bb7";
619
+ }
620
+ const { theme: rawTheme, setTheme } = useThemeContext();
621
+ let t0;
622
+ if ($[1] !== rawTheme) {
623
+ t0 = deepMerge(DEFAULT_EDITOR_THEME, rawTheme);
624
+ $[1] = rawTheme;
625
+ $[2] = t0;
626
+ } else t0 = $[2];
627
+ const theme = t0;
628
+ let t1;
629
+ if ($[3] !== rawTheme || $[4] !== setTheme) {
630
+ t1 = (updater) => {
631
+ if (typeof updater === "function") {
632
+ setTheme(updater(rawTheme));
633
+ return;
634
+ }
635
+ setTheme(deepMerge(rawTheme, updater));
636
+ };
637
+ $[3] = rawTheme;
638
+ $[4] = setTheme;
639
+ $[5] = t1;
640
+ } else t1 = $[5];
641
+ const updateTheme = t1;
642
+ let t2;
643
+ if ($[6] !== theme || $[7] !== updateTheme) {
644
+ t2 = {
645
+ theme,
646
+ updateTheme
647
+ };
648
+ $[6] = theme;
649
+ $[7] = updateTheme;
650
+ $[8] = t2;
651
+ } else t2 = $[8];
652
+ return t2;
653
+ }
654
+ //#endregion
655
+ //#region src/utils/composite.ts
656
+ const ARROW_UP = "ArrowUp";
657
+ const ARROW_DOWN = "ArrowDown";
658
+ const ARROW_LEFT = "ArrowLeft";
659
+ const ARROW_RIGHT = "ArrowRight";
660
+ const HOME = "Home";
661
+ const END = "End";
662
+ const PAGE_UP = "PageUp";
663
+ const PAGE_DOWN = "PageDown";
664
+ const SHIFT = "Shift";
665
+ const ENTER = "Enter";
666
+ const HORIZONTAL_KEYS = new Set([ARROW_LEFT, ARROW_RIGHT]);
667
+ const HORIZONTAL_KEYS_WITH_EXTRA_KEYS = new Set([
668
+ ARROW_LEFT,
669
+ ARROW_RIGHT,
670
+ HOME,
671
+ "End"
672
+ ]);
673
+ const COMPOSITE_KEYS = new Set([
674
+ ARROW_UP,
675
+ ARROW_DOWN,
676
+ ARROW_LEFT,
677
+ ARROW_RIGHT,
678
+ HOME,
679
+ "End"
680
+ ]);
681
+ //#endregion
682
+ export { ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP, COMPOSITE_KEYS, ColorPicker, condition_builder_exports as ConditionBuilder, END, ENTER, HOME, HORIZONTAL_KEYS, HORIZONTAL_KEYS_WITH_EXTRA_KEYS, IS_PRODUCTION, MAILY_UI_NAMESPACE, PAGE_DOWN, PAGE_UP, SHIFT, settings_field_exports as SettingsField, ThemeProvider, theme_settings_exports as ThemeSettings, UnitField, useMailyId, useMergeRefs, useSettingsFieldContext, useTheme, useThemeContext, useThemeSettingsContext, useValueAsRef };
683
+
684
+ //# sourceMappingURL=index.mjs.map