@ohhwells/bridge 0.1.2 → 0.1.4

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.cjs ADDED
@@ -0,0 +1,4769 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ OhhwellsBridge: () => OhhwellsBridge,
34
+ Toggle: () => Toggle,
35
+ ToggleGroup: () => ToggleGroup,
36
+ ToggleGroupItem: () => ToggleGroupItem,
37
+ toggleVariants: () => toggleVariants
38
+ });
39
+ module.exports = __toCommonJS(index_exports);
40
+
41
+ // src/OhhwellsBridge.tsx
42
+ var import_react = __toESM(require("react"), 1);
43
+
44
+ // src/ui/toggle-group.tsx
45
+ var React = __toESM(require("react"), 1);
46
+
47
+ // node_modules/clsx/dist/clsx.mjs
48
+ function r(e) {
49
+ var t, f, n = "";
50
+ if ("string" == typeof e || "number" == typeof e) n += e;
51
+ else if ("object" == typeof e) if (Array.isArray(e)) {
52
+ var o = e.length;
53
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
54
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
55
+ return n;
56
+ }
57
+ function clsx() {
58
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
59
+ return n;
60
+ }
61
+
62
+ // node_modules/tailwind-merge/dist/bundle-mjs.mjs
63
+ var concatArrays = (array1, array2) => {
64
+ const combinedArray = new Array(array1.length + array2.length);
65
+ for (let i = 0; i < array1.length; i++) {
66
+ combinedArray[i] = array1[i];
67
+ }
68
+ for (let i = 0; i < array2.length; i++) {
69
+ combinedArray[array1.length + i] = array2[i];
70
+ }
71
+ return combinedArray;
72
+ };
73
+ var createClassValidatorObject = (classGroupId, validator) => ({
74
+ classGroupId,
75
+ validator
76
+ });
77
+ var createClassPartObject = (nextPart = /* @__PURE__ */ new Map(), validators = null, classGroupId) => ({
78
+ nextPart,
79
+ validators,
80
+ classGroupId
81
+ });
82
+ var CLASS_PART_SEPARATOR = "-";
83
+ var EMPTY_CONFLICTS = [];
84
+ var ARBITRARY_PROPERTY_PREFIX = "arbitrary..";
85
+ var createClassGroupUtils = (config) => {
86
+ const classMap = createClassMap(config);
87
+ const {
88
+ conflictingClassGroups,
89
+ conflictingClassGroupModifiers
90
+ } = config;
91
+ const getClassGroupId = (className) => {
92
+ if (className.startsWith("[") && className.endsWith("]")) {
93
+ return getGroupIdForArbitraryProperty(className);
94
+ }
95
+ const classParts = className.split(CLASS_PART_SEPARATOR);
96
+ const startIndex = classParts[0] === "" && classParts.length > 1 ? 1 : 0;
97
+ return getGroupRecursive(classParts, startIndex, classMap);
98
+ };
99
+ const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
100
+ if (hasPostfixModifier) {
101
+ const modifierConflicts = conflictingClassGroupModifiers[classGroupId];
102
+ const baseConflicts = conflictingClassGroups[classGroupId];
103
+ if (modifierConflicts) {
104
+ if (baseConflicts) {
105
+ return concatArrays(baseConflicts, modifierConflicts);
106
+ }
107
+ return modifierConflicts;
108
+ }
109
+ return baseConflicts || EMPTY_CONFLICTS;
110
+ }
111
+ return conflictingClassGroups[classGroupId] || EMPTY_CONFLICTS;
112
+ };
113
+ return {
114
+ getClassGroupId,
115
+ getConflictingClassGroupIds
116
+ };
117
+ };
118
+ var getGroupRecursive = (classParts, startIndex, classPartObject) => {
119
+ const classPathsLength = classParts.length - startIndex;
120
+ if (classPathsLength === 0) {
121
+ return classPartObject.classGroupId;
122
+ }
123
+ const currentClassPart = classParts[startIndex];
124
+ const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
125
+ if (nextClassPartObject) {
126
+ const result = getGroupRecursive(classParts, startIndex + 1, nextClassPartObject);
127
+ if (result) return result;
128
+ }
129
+ const validators = classPartObject.validators;
130
+ if (validators === null) {
131
+ return void 0;
132
+ }
133
+ const classRest = startIndex === 0 ? classParts.join(CLASS_PART_SEPARATOR) : classParts.slice(startIndex).join(CLASS_PART_SEPARATOR);
134
+ const validatorsLength = validators.length;
135
+ for (let i = 0; i < validatorsLength; i++) {
136
+ const validatorObj = validators[i];
137
+ if (validatorObj.validator(classRest)) {
138
+ return validatorObj.classGroupId;
139
+ }
140
+ }
141
+ return void 0;
142
+ };
143
+ var getGroupIdForArbitraryProperty = (className) => className.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
144
+ const content = className.slice(1, -1);
145
+ const colonIndex = content.indexOf(":");
146
+ const property = content.slice(0, colonIndex);
147
+ return property ? ARBITRARY_PROPERTY_PREFIX + property : void 0;
148
+ })();
149
+ var createClassMap = (config) => {
150
+ const {
151
+ theme,
152
+ classGroups
153
+ } = config;
154
+ return processClassGroups(classGroups, theme);
155
+ };
156
+ var processClassGroups = (classGroups, theme) => {
157
+ const classMap = createClassPartObject();
158
+ for (const classGroupId in classGroups) {
159
+ const group = classGroups[classGroupId];
160
+ processClassesRecursively(group, classMap, classGroupId, theme);
161
+ }
162
+ return classMap;
163
+ };
164
+ var processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
165
+ const len = classGroup.length;
166
+ for (let i = 0; i < len; i++) {
167
+ const classDefinition = classGroup[i];
168
+ processClassDefinition(classDefinition, classPartObject, classGroupId, theme);
169
+ }
170
+ };
171
+ var processClassDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
172
+ if (typeof classDefinition === "string") {
173
+ processStringDefinition(classDefinition, classPartObject, classGroupId);
174
+ return;
175
+ }
176
+ if (typeof classDefinition === "function") {
177
+ processFunctionDefinition(classDefinition, classPartObject, classGroupId, theme);
178
+ return;
179
+ }
180
+ processObjectDefinition(classDefinition, classPartObject, classGroupId, theme);
181
+ };
182
+ var processStringDefinition = (classDefinition, classPartObject, classGroupId) => {
183
+ const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
184
+ classPartObjectToEdit.classGroupId = classGroupId;
185
+ };
186
+ var processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
187
+ if (isThemeGetter(classDefinition)) {
188
+ processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
189
+ return;
190
+ }
191
+ if (classPartObject.validators === null) {
192
+ classPartObject.validators = [];
193
+ }
194
+ classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
195
+ };
196
+ var processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
197
+ const entries = Object.entries(classDefinition);
198
+ const len = entries.length;
199
+ for (let i = 0; i < len; i++) {
200
+ const [key, value] = entries[i];
201
+ processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
202
+ }
203
+ };
204
+ var getPart = (classPartObject, path) => {
205
+ let current = classPartObject;
206
+ const parts = path.split(CLASS_PART_SEPARATOR);
207
+ const len = parts.length;
208
+ for (let i = 0; i < len; i++) {
209
+ const part = parts[i];
210
+ let next = current.nextPart.get(part);
211
+ if (!next) {
212
+ next = createClassPartObject();
213
+ current.nextPart.set(part, next);
214
+ }
215
+ current = next;
216
+ }
217
+ return current;
218
+ };
219
+ var isThemeGetter = (func) => "isThemeGetter" in func && func.isThemeGetter === true;
220
+ var createLruCache = (maxCacheSize) => {
221
+ if (maxCacheSize < 1) {
222
+ return {
223
+ get: () => void 0,
224
+ set: () => {
225
+ }
226
+ };
227
+ }
228
+ let cacheSize = 0;
229
+ let cache = /* @__PURE__ */ Object.create(null);
230
+ let previousCache = /* @__PURE__ */ Object.create(null);
231
+ const update = (key, value) => {
232
+ cache[key] = value;
233
+ cacheSize++;
234
+ if (cacheSize > maxCacheSize) {
235
+ cacheSize = 0;
236
+ previousCache = cache;
237
+ cache = /* @__PURE__ */ Object.create(null);
238
+ }
239
+ };
240
+ return {
241
+ get(key) {
242
+ let value = cache[key];
243
+ if (value !== void 0) {
244
+ return value;
245
+ }
246
+ if ((value = previousCache[key]) !== void 0) {
247
+ update(key, value);
248
+ return value;
249
+ }
250
+ },
251
+ set(key, value) {
252
+ if (key in cache) {
253
+ cache[key] = value;
254
+ } else {
255
+ update(key, value);
256
+ }
257
+ }
258
+ };
259
+ };
260
+ var IMPORTANT_MODIFIER = "!";
261
+ var MODIFIER_SEPARATOR = ":";
262
+ var EMPTY_MODIFIERS = [];
263
+ var createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
264
+ modifiers,
265
+ hasImportantModifier,
266
+ baseClassName,
267
+ maybePostfixModifierPosition,
268
+ isExternal
269
+ });
270
+ var createParseClassName = (config) => {
271
+ const {
272
+ prefix,
273
+ experimentalParseClassName
274
+ } = config;
275
+ let parseClassName = (className) => {
276
+ const modifiers = [];
277
+ let bracketDepth = 0;
278
+ let parenDepth = 0;
279
+ let modifierStart = 0;
280
+ let postfixModifierPosition;
281
+ const len = className.length;
282
+ for (let index = 0; index < len; index++) {
283
+ const currentCharacter = className[index];
284
+ if (bracketDepth === 0 && parenDepth === 0) {
285
+ if (currentCharacter === MODIFIER_SEPARATOR) {
286
+ modifiers.push(className.slice(modifierStart, index));
287
+ modifierStart = index + 1;
288
+ continue;
289
+ }
290
+ if (currentCharacter === "/") {
291
+ postfixModifierPosition = index;
292
+ continue;
293
+ }
294
+ }
295
+ if (currentCharacter === "[") bracketDepth++;
296
+ else if (currentCharacter === "]") bracketDepth--;
297
+ else if (currentCharacter === "(") parenDepth++;
298
+ else if (currentCharacter === ")") parenDepth--;
299
+ }
300
+ const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.slice(modifierStart);
301
+ let baseClassName = baseClassNameWithImportantModifier;
302
+ let hasImportantModifier = false;
303
+ if (baseClassNameWithImportantModifier.endsWith(IMPORTANT_MODIFIER)) {
304
+ baseClassName = baseClassNameWithImportantModifier.slice(0, -1);
305
+ hasImportantModifier = true;
306
+ } else if (
307
+ /**
308
+ * In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
309
+ * @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
310
+ */
311
+ baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)
312
+ ) {
313
+ baseClassName = baseClassNameWithImportantModifier.slice(1);
314
+ hasImportantModifier = true;
315
+ }
316
+ const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : void 0;
317
+ return createResultObject(modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition);
318
+ };
319
+ if (prefix) {
320
+ const fullPrefix = prefix + MODIFIER_SEPARATOR;
321
+ const parseClassNameOriginal = parseClassName;
322
+ parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.slice(fullPrefix.length)) : createResultObject(EMPTY_MODIFIERS, false, className, void 0, true);
323
+ }
324
+ if (experimentalParseClassName) {
325
+ const parseClassNameOriginal = parseClassName;
326
+ parseClassName = (className) => experimentalParseClassName({
327
+ className,
328
+ parseClassName: parseClassNameOriginal
329
+ });
330
+ }
331
+ return parseClassName;
332
+ };
333
+ var createSortModifiers = (config) => {
334
+ const modifierWeights = /* @__PURE__ */ new Map();
335
+ config.orderSensitiveModifiers.forEach((mod, index) => {
336
+ modifierWeights.set(mod, 1e6 + index);
337
+ });
338
+ return (modifiers) => {
339
+ const result = [];
340
+ let currentSegment = [];
341
+ for (let i = 0; i < modifiers.length; i++) {
342
+ const modifier = modifiers[i];
343
+ const isArbitrary = modifier[0] === "[";
344
+ const isOrderSensitive = modifierWeights.has(modifier);
345
+ if (isArbitrary || isOrderSensitive) {
346
+ if (currentSegment.length > 0) {
347
+ currentSegment.sort();
348
+ result.push(...currentSegment);
349
+ currentSegment = [];
350
+ }
351
+ result.push(modifier);
352
+ } else {
353
+ currentSegment.push(modifier);
354
+ }
355
+ }
356
+ if (currentSegment.length > 0) {
357
+ currentSegment.sort();
358
+ result.push(...currentSegment);
359
+ }
360
+ return result;
361
+ };
362
+ };
363
+ var createConfigUtils = (config) => ({
364
+ cache: createLruCache(config.cacheSize),
365
+ parseClassName: createParseClassName(config),
366
+ sortModifiers: createSortModifiers(config),
367
+ postfixLookupClassGroupIds: createPostfixLookupClassGroupIds(config),
368
+ ...createClassGroupUtils(config)
369
+ });
370
+ var createPostfixLookupClassGroupIds = (config) => {
371
+ const lookup = /* @__PURE__ */ Object.create(null);
372
+ const classGroupIds = config.postfixLookupClassGroups;
373
+ if (classGroupIds) {
374
+ for (let i = 0; i < classGroupIds.length; i++) {
375
+ lookup[classGroupIds[i]] = true;
376
+ }
377
+ }
378
+ return lookup;
379
+ };
380
+ var SPLIT_CLASSES_REGEX = /\s+/;
381
+ var mergeClassList = (classList, configUtils) => {
382
+ const {
383
+ parseClassName,
384
+ getClassGroupId,
385
+ getConflictingClassGroupIds,
386
+ sortModifiers,
387
+ postfixLookupClassGroupIds
388
+ } = configUtils;
389
+ const classGroupsInConflict = [];
390
+ const classNames = classList.trim().split(SPLIT_CLASSES_REGEX);
391
+ let result = "";
392
+ for (let index = classNames.length - 1; index >= 0; index -= 1) {
393
+ const originalClassName = classNames[index];
394
+ const {
395
+ isExternal,
396
+ modifiers,
397
+ hasImportantModifier,
398
+ baseClassName,
399
+ maybePostfixModifierPosition
400
+ } = parseClassName(originalClassName);
401
+ if (isExternal) {
402
+ result = originalClassName + (result.length > 0 ? " " + result : result);
403
+ continue;
404
+ }
405
+ let hasPostfixModifier = !!maybePostfixModifierPosition;
406
+ let classGroupId;
407
+ if (hasPostfixModifier) {
408
+ const baseClassNameWithoutPostfix = baseClassName.substring(0, maybePostfixModifierPosition);
409
+ classGroupId = getClassGroupId(baseClassNameWithoutPostfix);
410
+ const classGroupIdWithPostfix = classGroupId && postfixLookupClassGroupIds[classGroupId] ? getClassGroupId(baseClassName) : void 0;
411
+ if (classGroupIdWithPostfix && classGroupIdWithPostfix !== classGroupId) {
412
+ classGroupId = classGroupIdWithPostfix;
413
+ hasPostfixModifier = false;
414
+ }
415
+ } else {
416
+ classGroupId = getClassGroupId(baseClassName);
417
+ }
418
+ if (!classGroupId) {
419
+ if (!hasPostfixModifier) {
420
+ result = originalClassName + (result.length > 0 ? " " + result : result);
421
+ continue;
422
+ }
423
+ classGroupId = getClassGroupId(baseClassName);
424
+ if (!classGroupId) {
425
+ result = originalClassName + (result.length > 0 ? " " + result : result);
426
+ continue;
427
+ }
428
+ hasPostfixModifier = false;
429
+ }
430
+ const variantModifier = modifiers.length === 0 ? "" : modifiers.length === 1 ? modifiers[0] : sortModifiers(modifiers).join(":");
431
+ const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
432
+ const classId = modifierId + classGroupId;
433
+ if (classGroupsInConflict.indexOf(classId) > -1) {
434
+ continue;
435
+ }
436
+ classGroupsInConflict.push(classId);
437
+ const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);
438
+ for (let i = 0; i < conflictGroups.length; ++i) {
439
+ const group = conflictGroups[i];
440
+ classGroupsInConflict.push(modifierId + group);
441
+ }
442
+ result = originalClassName + (result.length > 0 ? " " + result : result);
443
+ }
444
+ return result;
445
+ };
446
+ var twJoin = (...classLists) => {
447
+ let index = 0;
448
+ let argument;
449
+ let resolvedValue;
450
+ let string = "";
451
+ while (index < classLists.length) {
452
+ if (argument = classLists[index++]) {
453
+ if (resolvedValue = toValue(argument)) {
454
+ string && (string += " ");
455
+ string += resolvedValue;
456
+ }
457
+ }
458
+ }
459
+ return string;
460
+ };
461
+ var toValue = (mix) => {
462
+ if (typeof mix === "string") {
463
+ return mix;
464
+ }
465
+ let resolvedValue;
466
+ let string = "";
467
+ for (let k = 0; k < mix.length; k++) {
468
+ if (mix[k]) {
469
+ if (resolvedValue = toValue(mix[k])) {
470
+ string && (string += " ");
471
+ string += resolvedValue;
472
+ }
473
+ }
474
+ }
475
+ return string;
476
+ };
477
+ var createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
478
+ let configUtils;
479
+ let cacheGet;
480
+ let cacheSet;
481
+ let functionToCall;
482
+ const initTailwindMerge = (classList) => {
483
+ const config = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
484
+ configUtils = createConfigUtils(config);
485
+ cacheGet = configUtils.cache.get;
486
+ cacheSet = configUtils.cache.set;
487
+ functionToCall = tailwindMerge;
488
+ return tailwindMerge(classList);
489
+ };
490
+ const tailwindMerge = (classList) => {
491
+ const cachedResult = cacheGet(classList);
492
+ if (cachedResult) {
493
+ return cachedResult;
494
+ }
495
+ const result = mergeClassList(classList, configUtils);
496
+ cacheSet(classList, result);
497
+ return result;
498
+ };
499
+ functionToCall = initTailwindMerge;
500
+ return (...args) => functionToCall(twJoin(...args));
501
+ };
502
+ var fallbackThemeArr = [];
503
+ var fromTheme = (key) => {
504
+ const themeGetter = (theme) => theme[key] || fallbackThemeArr;
505
+ themeGetter.isThemeGetter = true;
506
+ return themeGetter;
507
+ };
508
+ var arbitraryValueRegex = /^\[(?:(\w[\w-]*):)?(.+)\]$/i;
509
+ var arbitraryVariableRegex = /^\((?:(\w[\w-]*):)?(.+)\)$/i;
510
+ var fractionRegex = /^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/;
511
+ var tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
512
+ var lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
513
+ var colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/;
514
+ var shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
515
+ var imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
516
+ var isFraction = (value) => fractionRegex.test(value);
517
+ var isNumber = (value) => !!value && !Number.isNaN(Number(value));
518
+ var isInteger = (value) => !!value && Number.isInteger(Number(value));
519
+ var isPercent = (value) => value.endsWith("%") && isNumber(value.slice(0, -1));
520
+ var isTshirtSize = (value) => tshirtUnitRegex.test(value);
521
+ var isAny = () => true;
522
+ var isLengthOnly = (value) => (
523
+ // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
524
+ // For example, `hsl(0 0% 0%)` would be classified as a length without this check.
525
+ // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
526
+ lengthUnitRegex.test(value) && !colorFunctionRegex.test(value)
527
+ );
528
+ var isNever = () => false;
529
+ var isShadow = (value) => shadowRegex.test(value);
530
+ var isImage = (value) => imageRegex.test(value);
531
+ var isAnyNonArbitrary = (value) => !isArbitraryValue(value) && !isArbitraryVariable(value);
532
+ var isNamedContainerQuery = (value) => value.startsWith("@container") && (value[10] === "/" && value[11] !== void 0 || value[11] === "s" && value[16] !== void 0 && value.startsWith("-size/", 10) || value[11] === "n" && value[18] !== void 0 && value.startsWith("-normal/", 10));
533
+ var isArbitrarySize = (value) => getIsArbitraryValue(value, isLabelSize, isNever);
534
+ var isArbitraryValue = (value) => arbitraryValueRegex.test(value);
535
+ var isArbitraryLength = (value) => getIsArbitraryValue(value, isLabelLength, isLengthOnly);
536
+ var isArbitraryNumber = (value) => getIsArbitraryValue(value, isLabelNumber, isNumber);
537
+ var isArbitraryWeight = (value) => getIsArbitraryValue(value, isLabelWeight, isAny);
538
+ var isArbitraryFamilyName = (value) => getIsArbitraryValue(value, isLabelFamilyName, isNever);
539
+ var isArbitraryPosition = (value) => getIsArbitraryValue(value, isLabelPosition, isNever);
540
+ var isArbitraryImage = (value) => getIsArbitraryValue(value, isLabelImage, isImage);
541
+ var isArbitraryShadow = (value) => getIsArbitraryValue(value, isLabelShadow, isShadow);
542
+ var isArbitraryVariable = (value) => arbitraryVariableRegex.test(value);
543
+ var isArbitraryVariableLength = (value) => getIsArbitraryVariable(value, isLabelLength);
544
+ var isArbitraryVariableFamilyName = (value) => getIsArbitraryVariable(value, isLabelFamilyName);
545
+ var isArbitraryVariablePosition = (value) => getIsArbitraryVariable(value, isLabelPosition);
546
+ var isArbitraryVariableSize = (value) => getIsArbitraryVariable(value, isLabelSize);
547
+ var isArbitraryVariableImage = (value) => getIsArbitraryVariable(value, isLabelImage);
548
+ var isArbitraryVariableShadow = (value) => getIsArbitraryVariable(value, isLabelShadow, true);
549
+ var isArbitraryVariableWeight = (value) => getIsArbitraryVariable(value, isLabelWeight, true);
550
+ var getIsArbitraryValue = (value, testLabel, testValue) => {
551
+ const result = arbitraryValueRegex.exec(value);
552
+ if (result) {
553
+ if (result[1]) {
554
+ return testLabel(result[1]);
555
+ }
556
+ return testValue(result[2]);
557
+ }
558
+ return false;
559
+ };
560
+ var getIsArbitraryVariable = (value, testLabel, shouldMatchNoLabel = false) => {
561
+ const result = arbitraryVariableRegex.exec(value);
562
+ if (result) {
563
+ if (result[1]) {
564
+ return testLabel(result[1]);
565
+ }
566
+ return shouldMatchNoLabel;
567
+ }
568
+ return false;
569
+ };
570
+ var isLabelPosition = (label) => label === "position" || label === "percentage";
571
+ var isLabelImage = (label) => label === "image" || label === "url";
572
+ var isLabelSize = (label) => label === "length" || label === "size" || label === "bg-size";
573
+ var isLabelLength = (label) => label === "length";
574
+ var isLabelNumber = (label) => label === "number";
575
+ var isLabelFamilyName = (label) => label === "family-name";
576
+ var isLabelWeight = (label) => label === "number" || label === "weight";
577
+ var isLabelShadow = (label) => label === "shadow";
578
+ var getDefaultConfig = () => {
579
+ const themeColor = fromTheme("color");
580
+ const themeFont = fromTheme("font");
581
+ const themeText = fromTheme("text");
582
+ const themeFontWeight = fromTheme("font-weight");
583
+ const themeTracking = fromTheme("tracking");
584
+ const themeLeading = fromTheme("leading");
585
+ const themeBreakpoint = fromTheme("breakpoint");
586
+ const themeContainer = fromTheme("container");
587
+ const themeSpacing = fromTheme("spacing");
588
+ const themeRadius = fromTheme("radius");
589
+ const themeShadow = fromTheme("shadow");
590
+ const themeInsetShadow = fromTheme("inset-shadow");
591
+ const themeTextShadow = fromTheme("text-shadow");
592
+ const themeDropShadow = fromTheme("drop-shadow");
593
+ const themeBlur = fromTheme("blur");
594
+ const themePerspective = fromTheme("perspective");
595
+ const themeAspect = fromTheme("aspect");
596
+ const themeEase = fromTheme("ease");
597
+ const themeAnimate = fromTheme("animate");
598
+ const scaleBreak = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"];
599
+ const scalePosition = () => [
600
+ "center",
601
+ "top",
602
+ "bottom",
603
+ "left",
604
+ "right",
605
+ "top-left",
606
+ // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
607
+ "left-top",
608
+ "top-right",
609
+ // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
610
+ "right-top",
611
+ "bottom-right",
612
+ // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
613
+ "right-bottom",
614
+ "bottom-left",
615
+ // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
616
+ "left-bottom"
617
+ ];
618
+ const scalePositionWithArbitrary = () => [...scalePosition(), isArbitraryVariable, isArbitraryValue];
619
+ const scaleOverflow = () => ["auto", "hidden", "clip", "visible", "scroll"];
620
+ const scaleOverscroll = () => ["auto", "contain", "none"];
621
+ const scaleUnambiguousSpacing = () => [isArbitraryVariable, isArbitraryValue, themeSpacing];
622
+ const scaleInset = () => [isFraction, "full", "auto", ...scaleUnambiguousSpacing()];
623
+ const scaleGridTemplateColsRows = () => [isInteger, "none", "subgrid", isArbitraryVariable, isArbitraryValue];
624
+ const scaleGridColRowStartAndEnd = () => ["auto", {
625
+ span: ["full", isInteger, isArbitraryVariable, isArbitraryValue]
626
+ }, isInteger, isArbitraryVariable, isArbitraryValue];
627
+ const scaleGridColRowStartOrEnd = () => [isInteger, "auto", isArbitraryVariable, isArbitraryValue];
628
+ const scaleGridAutoColsRows = () => ["auto", "min", "max", "fr", isArbitraryVariable, isArbitraryValue];
629
+ const scaleAlignPrimaryAxis = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"];
630
+ const scaleAlignSecondaryAxis = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"];
631
+ const scaleMargin = () => ["auto", ...scaleUnambiguousSpacing()];
632
+ const scaleSizing = () => [isFraction, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...scaleUnambiguousSpacing()];
633
+ const scaleSizingInline = () => [isFraction, "screen", "full", "dvw", "lvw", "svw", "min", "max", "fit", ...scaleUnambiguousSpacing()];
634
+ const scaleSizingBlock = () => [isFraction, "screen", "full", "lh", "dvh", "lvh", "svh", "min", "max", "fit", ...scaleUnambiguousSpacing()];
635
+ const scaleColor = () => [themeColor, isArbitraryVariable, isArbitraryValue];
636
+ const scaleBgPosition = () => [...scalePosition(), isArbitraryVariablePosition, isArbitraryPosition, {
637
+ position: [isArbitraryVariable, isArbitraryValue]
638
+ }];
639
+ const scaleBgRepeat = () => ["no-repeat", {
640
+ repeat: ["", "x", "y", "space", "round"]
641
+ }];
642
+ const scaleBgSize = () => ["auto", "cover", "contain", isArbitraryVariableSize, isArbitrarySize, {
643
+ size: [isArbitraryVariable, isArbitraryValue]
644
+ }];
645
+ const scaleGradientStopPosition = () => [isPercent, isArbitraryVariableLength, isArbitraryLength];
646
+ const scaleRadius = () => [
647
+ // Deprecated since Tailwind CSS v4.0.0
648
+ "",
649
+ "none",
650
+ "full",
651
+ themeRadius,
652
+ isArbitraryVariable,
653
+ isArbitraryValue
654
+ ];
655
+ const scaleBorderWidth = () => ["", isNumber, isArbitraryVariableLength, isArbitraryLength];
656
+ const scaleLineStyle = () => ["solid", "dashed", "dotted", "double"];
657
+ const scaleBlendMode = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"];
658
+ const scaleMaskImagePosition = () => [isNumber, isPercent, isArbitraryVariablePosition, isArbitraryPosition];
659
+ const scaleBlur = () => [
660
+ // Deprecated since Tailwind CSS v4.0.0
661
+ "",
662
+ "none",
663
+ themeBlur,
664
+ isArbitraryVariable,
665
+ isArbitraryValue
666
+ ];
667
+ const scaleRotate = () => ["none", isNumber, isArbitraryVariable, isArbitraryValue];
668
+ const scaleScale = () => ["none", isNumber, isArbitraryVariable, isArbitraryValue];
669
+ const scaleSkew = () => [isNumber, isArbitraryVariable, isArbitraryValue];
670
+ const scaleTranslate = () => [isFraction, "full", ...scaleUnambiguousSpacing()];
671
+ return {
672
+ cacheSize: 500,
673
+ theme: {
674
+ animate: ["spin", "ping", "pulse", "bounce"],
675
+ aspect: ["video"],
676
+ blur: [isTshirtSize],
677
+ breakpoint: [isTshirtSize],
678
+ color: [isAny],
679
+ container: [isTshirtSize],
680
+ "drop-shadow": [isTshirtSize],
681
+ ease: ["in", "out", "in-out"],
682
+ font: [isAnyNonArbitrary],
683
+ "font-weight": ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black"],
684
+ "inset-shadow": [isTshirtSize],
685
+ leading: ["none", "tight", "snug", "normal", "relaxed", "loose"],
686
+ perspective: ["dramatic", "near", "normal", "midrange", "distant", "none"],
687
+ radius: [isTshirtSize],
688
+ shadow: [isTshirtSize],
689
+ spacing: ["px", isNumber],
690
+ text: [isTshirtSize],
691
+ "text-shadow": [isTshirtSize],
692
+ tracking: ["tighter", "tight", "normal", "wide", "wider", "widest"]
693
+ },
694
+ classGroups: {
695
+ // --------------
696
+ // --- Layout ---
697
+ // --------------
698
+ /**
699
+ * Aspect Ratio
700
+ * @see https://tailwindcss.com/docs/aspect-ratio
701
+ */
702
+ aspect: [{
703
+ aspect: ["auto", "square", isFraction, isArbitraryValue, isArbitraryVariable, themeAspect]
704
+ }],
705
+ /**
706
+ * Container
707
+ * @see https://tailwindcss.com/docs/container
708
+ * @deprecated since Tailwind CSS v4.0.0
709
+ */
710
+ container: ["container"],
711
+ /**
712
+ * Container Type
713
+ * @see https://tailwindcss.com/docs/responsive-design#container-queries
714
+ */
715
+ "container-type": [{
716
+ "@container": ["", "normal", "size", isArbitraryVariable, isArbitraryValue]
717
+ }],
718
+ /**
719
+ * Container Name
720
+ * @see https://tailwindcss.com/docs/responsive-design#named-containers
721
+ */
722
+ "container-named": [isNamedContainerQuery],
723
+ /**
724
+ * Columns
725
+ * @see https://tailwindcss.com/docs/columns
726
+ */
727
+ columns: [{
728
+ columns: [isNumber, isArbitraryValue, isArbitraryVariable, themeContainer]
729
+ }],
730
+ /**
731
+ * Break After
732
+ * @see https://tailwindcss.com/docs/break-after
733
+ */
734
+ "break-after": [{
735
+ "break-after": scaleBreak()
736
+ }],
737
+ /**
738
+ * Break Before
739
+ * @see https://tailwindcss.com/docs/break-before
740
+ */
741
+ "break-before": [{
742
+ "break-before": scaleBreak()
743
+ }],
744
+ /**
745
+ * Break Inside
746
+ * @see https://tailwindcss.com/docs/break-inside
747
+ */
748
+ "break-inside": [{
749
+ "break-inside": ["auto", "avoid", "avoid-page", "avoid-column"]
750
+ }],
751
+ /**
752
+ * Box Decoration Break
753
+ * @see https://tailwindcss.com/docs/box-decoration-break
754
+ */
755
+ "box-decoration": [{
756
+ "box-decoration": ["slice", "clone"]
757
+ }],
758
+ /**
759
+ * Box Sizing
760
+ * @see https://tailwindcss.com/docs/box-sizing
761
+ */
762
+ box: [{
763
+ box: ["border", "content"]
764
+ }],
765
+ /**
766
+ * Display
767
+ * @see https://tailwindcss.com/docs/display
768
+ */
769
+ display: ["block", "inline-block", "inline", "flex", "inline-flex", "table", "inline-table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row-group", "table-row", "flow-root", "grid", "inline-grid", "contents", "list-item", "hidden"],
770
+ /**
771
+ * Screen Reader Only
772
+ * @see https://tailwindcss.com/docs/display#screen-reader-only
773
+ */
774
+ sr: ["sr-only", "not-sr-only"],
775
+ /**
776
+ * Floats
777
+ * @see https://tailwindcss.com/docs/float
778
+ */
779
+ float: [{
780
+ float: ["right", "left", "none", "start", "end"]
781
+ }],
782
+ /**
783
+ * Clear
784
+ * @see https://tailwindcss.com/docs/clear
785
+ */
786
+ clear: [{
787
+ clear: ["left", "right", "both", "none", "start", "end"]
788
+ }],
789
+ /**
790
+ * Isolation
791
+ * @see https://tailwindcss.com/docs/isolation
792
+ */
793
+ isolation: ["isolate", "isolation-auto"],
794
+ /**
795
+ * Object Fit
796
+ * @see https://tailwindcss.com/docs/object-fit
797
+ */
798
+ "object-fit": [{
799
+ object: ["contain", "cover", "fill", "none", "scale-down"]
800
+ }],
801
+ /**
802
+ * Object Position
803
+ * @see https://tailwindcss.com/docs/object-position
804
+ */
805
+ "object-position": [{
806
+ object: scalePositionWithArbitrary()
807
+ }],
808
+ /**
809
+ * Overflow
810
+ * @see https://tailwindcss.com/docs/overflow
811
+ */
812
+ overflow: [{
813
+ overflow: scaleOverflow()
814
+ }],
815
+ /**
816
+ * Overflow X
817
+ * @see https://tailwindcss.com/docs/overflow
818
+ */
819
+ "overflow-x": [{
820
+ "overflow-x": scaleOverflow()
821
+ }],
822
+ /**
823
+ * Overflow Y
824
+ * @see https://tailwindcss.com/docs/overflow
825
+ */
826
+ "overflow-y": [{
827
+ "overflow-y": scaleOverflow()
828
+ }],
829
+ /**
830
+ * Overscroll Behavior
831
+ * @see https://tailwindcss.com/docs/overscroll-behavior
832
+ */
833
+ overscroll: [{
834
+ overscroll: scaleOverscroll()
835
+ }],
836
+ /**
837
+ * Overscroll Behavior X
838
+ * @see https://tailwindcss.com/docs/overscroll-behavior
839
+ */
840
+ "overscroll-x": [{
841
+ "overscroll-x": scaleOverscroll()
842
+ }],
843
+ /**
844
+ * Overscroll Behavior Y
845
+ * @see https://tailwindcss.com/docs/overscroll-behavior
846
+ */
847
+ "overscroll-y": [{
848
+ "overscroll-y": scaleOverscroll()
849
+ }],
850
+ /**
851
+ * Position
852
+ * @see https://tailwindcss.com/docs/position
853
+ */
854
+ position: ["static", "fixed", "absolute", "relative", "sticky"],
855
+ /**
856
+ * Inset
857
+ * @see https://tailwindcss.com/docs/top-right-bottom-left
858
+ */
859
+ inset: [{
860
+ inset: scaleInset()
861
+ }],
862
+ /**
863
+ * Inset Inline
864
+ * @see https://tailwindcss.com/docs/top-right-bottom-left
865
+ */
866
+ "inset-x": [{
867
+ "inset-x": scaleInset()
868
+ }],
869
+ /**
870
+ * Inset Block
871
+ * @see https://tailwindcss.com/docs/top-right-bottom-left
872
+ */
873
+ "inset-y": [{
874
+ "inset-y": scaleInset()
875
+ }],
876
+ /**
877
+ * Inset Inline Start
878
+ * @see https://tailwindcss.com/docs/top-right-bottom-left
879
+ * @todo class group will be renamed to `inset-s` in next major release
880
+ */
881
+ start: [{
882
+ "inset-s": scaleInset(),
883
+ /**
884
+ * @deprecated since Tailwind CSS v4.2.0 in favor of `inset-s-*` utilities.
885
+ * @see https://github.com/tailwindlabs/tailwindcss/pull/19613
886
+ */
887
+ start: scaleInset()
888
+ }],
889
+ /**
890
+ * Inset Inline End
891
+ * @see https://tailwindcss.com/docs/top-right-bottom-left
892
+ * @todo class group will be renamed to `inset-e` in next major release
893
+ */
894
+ end: [{
895
+ "inset-e": scaleInset(),
896
+ /**
897
+ * @deprecated since Tailwind CSS v4.2.0 in favor of `inset-e-*` utilities.
898
+ * @see https://github.com/tailwindlabs/tailwindcss/pull/19613
899
+ */
900
+ end: scaleInset()
901
+ }],
902
+ /**
903
+ * Inset Block Start
904
+ * @see https://tailwindcss.com/docs/top-right-bottom-left
905
+ */
906
+ "inset-bs": [{
907
+ "inset-bs": scaleInset()
908
+ }],
909
+ /**
910
+ * Inset Block End
911
+ * @see https://tailwindcss.com/docs/top-right-bottom-left
912
+ */
913
+ "inset-be": [{
914
+ "inset-be": scaleInset()
915
+ }],
916
+ /**
917
+ * Top
918
+ * @see https://tailwindcss.com/docs/top-right-bottom-left
919
+ */
920
+ top: [{
921
+ top: scaleInset()
922
+ }],
923
+ /**
924
+ * Right
925
+ * @see https://tailwindcss.com/docs/top-right-bottom-left
926
+ */
927
+ right: [{
928
+ right: scaleInset()
929
+ }],
930
+ /**
931
+ * Bottom
932
+ * @see https://tailwindcss.com/docs/top-right-bottom-left
933
+ */
934
+ bottom: [{
935
+ bottom: scaleInset()
936
+ }],
937
+ /**
938
+ * Left
939
+ * @see https://tailwindcss.com/docs/top-right-bottom-left
940
+ */
941
+ left: [{
942
+ left: scaleInset()
943
+ }],
944
+ /**
945
+ * Visibility
946
+ * @see https://tailwindcss.com/docs/visibility
947
+ */
948
+ visibility: ["visible", "invisible", "collapse"],
949
+ /**
950
+ * Z-Index
951
+ * @see https://tailwindcss.com/docs/z-index
952
+ */
953
+ z: [{
954
+ z: [isInteger, "auto", isArbitraryVariable, isArbitraryValue]
955
+ }],
956
+ // ------------------------
957
+ // --- Flexbox and Grid ---
958
+ // ------------------------
959
+ /**
960
+ * Flex Basis
961
+ * @see https://tailwindcss.com/docs/flex-basis
962
+ */
963
+ basis: [{
964
+ basis: [isFraction, "full", "auto", themeContainer, ...scaleUnambiguousSpacing()]
965
+ }],
966
+ /**
967
+ * Flex Direction
968
+ * @see https://tailwindcss.com/docs/flex-direction
969
+ */
970
+ "flex-direction": [{
971
+ flex: ["row", "row-reverse", "col", "col-reverse"]
972
+ }],
973
+ /**
974
+ * Flex Wrap
975
+ * @see https://tailwindcss.com/docs/flex-wrap
976
+ */
977
+ "flex-wrap": [{
978
+ flex: ["nowrap", "wrap", "wrap-reverse"]
979
+ }],
980
+ /**
981
+ * Flex
982
+ * @see https://tailwindcss.com/docs/flex
983
+ */
984
+ flex: [{
985
+ flex: [isNumber, isFraction, "auto", "initial", "none", isArbitraryValue]
986
+ }],
987
+ /**
988
+ * Flex Grow
989
+ * @see https://tailwindcss.com/docs/flex-grow
990
+ */
991
+ grow: [{
992
+ grow: ["", isNumber, isArbitraryVariable, isArbitraryValue]
993
+ }],
994
+ /**
995
+ * Flex Shrink
996
+ * @see https://tailwindcss.com/docs/flex-shrink
997
+ */
998
+ shrink: [{
999
+ shrink: ["", isNumber, isArbitraryVariable, isArbitraryValue]
1000
+ }],
1001
+ /**
1002
+ * Order
1003
+ * @see https://tailwindcss.com/docs/order
1004
+ */
1005
+ order: [{
1006
+ order: [isInteger, "first", "last", "none", isArbitraryVariable, isArbitraryValue]
1007
+ }],
1008
+ /**
1009
+ * Grid Template Columns
1010
+ * @see https://tailwindcss.com/docs/grid-template-columns
1011
+ */
1012
+ "grid-cols": [{
1013
+ "grid-cols": scaleGridTemplateColsRows()
1014
+ }],
1015
+ /**
1016
+ * Grid Column Start / End
1017
+ * @see https://tailwindcss.com/docs/grid-column
1018
+ */
1019
+ "col-start-end": [{
1020
+ col: scaleGridColRowStartAndEnd()
1021
+ }],
1022
+ /**
1023
+ * Grid Column Start
1024
+ * @see https://tailwindcss.com/docs/grid-column
1025
+ */
1026
+ "col-start": [{
1027
+ "col-start": scaleGridColRowStartOrEnd()
1028
+ }],
1029
+ /**
1030
+ * Grid Column End
1031
+ * @see https://tailwindcss.com/docs/grid-column
1032
+ */
1033
+ "col-end": [{
1034
+ "col-end": scaleGridColRowStartOrEnd()
1035
+ }],
1036
+ /**
1037
+ * Grid Template Rows
1038
+ * @see https://tailwindcss.com/docs/grid-template-rows
1039
+ */
1040
+ "grid-rows": [{
1041
+ "grid-rows": scaleGridTemplateColsRows()
1042
+ }],
1043
+ /**
1044
+ * Grid Row Start / End
1045
+ * @see https://tailwindcss.com/docs/grid-row
1046
+ */
1047
+ "row-start-end": [{
1048
+ row: scaleGridColRowStartAndEnd()
1049
+ }],
1050
+ /**
1051
+ * Grid Row Start
1052
+ * @see https://tailwindcss.com/docs/grid-row
1053
+ */
1054
+ "row-start": [{
1055
+ "row-start": scaleGridColRowStartOrEnd()
1056
+ }],
1057
+ /**
1058
+ * Grid Row End
1059
+ * @see https://tailwindcss.com/docs/grid-row
1060
+ */
1061
+ "row-end": [{
1062
+ "row-end": scaleGridColRowStartOrEnd()
1063
+ }],
1064
+ /**
1065
+ * Grid Auto Flow
1066
+ * @see https://tailwindcss.com/docs/grid-auto-flow
1067
+ */
1068
+ "grid-flow": [{
1069
+ "grid-flow": ["row", "col", "dense", "row-dense", "col-dense"]
1070
+ }],
1071
+ /**
1072
+ * Grid Auto Columns
1073
+ * @see https://tailwindcss.com/docs/grid-auto-columns
1074
+ */
1075
+ "auto-cols": [{
1076
+ "auto-cols": scaleGridAutoColsRows()
1077
+ }],
1078
+ /**
1079
+ * Grid Auto Rows
1080
+ * @see https://tailwindcss.com/docs/grid-auto-rows
1081
+ */
1082
+ "auto-rows": [{
1083
+ "auto-rows": scaleGridAutoColsRows()
1084
+ }],
1085
+ /**
1086
+ * Gap
1087
+ * @see https://tailwindcss.com/docs/gap
1088
+ */
1089
+ gap: [{
1090
+ gap: scaleUnambiguousSpacing()
1091
+ }],
1092
+ /**
1093
+ * Gap X
1094
+ * @see https://tailwindcss.com/docs/gap
1095
+ */
1096
+ "gap-x": [{
1097
+ "gap-x": scaleUnambiguousSpacing()
1098
+ }],
1099
+ /**
1100
+ * Gap Y
1101
+ * @see https://tailwindcss.com/docs/gap
1102
+ */
1103
+ "gap-y": [{
1104
+ "gap-y": scaleUnambiguousSpacing()
1105
+ }],
1106
+ /**
1107
+ * Justify Content
1108
+ * @see https://tailwindcss.com/docs/justify-content
1109
+ */
1110
+ "justify-content": [{
1111
+ justify: [...scaleAlignPrimaryAxis(), "normal"]
1112
+ }],
1113
+ /**
1114
+ * Justify Items
1115
+ * @see https://tailwindcss.com/docs/justify-items
1116
+ */
1117
+ "justify-items": [{
1118
+ "justify-items": [...scaleAlignSecondaryAxis(), "normal"]
1119
+ }],
1120
+ /**
1121
+ * Justify Self
1122
+ * @see https://tailwindcss.com/docs/justify-self
1123
+ */
1124
+ "justify-self": [{
1125
+ "justify-self": ["auto", ...scaleAlignSecondaryAxis()]
1126
+ }],
1127
+ /**
1128
+ * Align Content
1129
+ * @see https://tailwindcss.com/docs/align-content
1130
+ */
1131
+ "align-content": [{
1132
+ content: ["normal", ...scaleAlignPrimaryAxis()]
1133
+ }],
1134
+ /**
1135
+ * Align Items
1136
+ * @see https://tailwindcss.com/docs/align-items
1137
+ */
1138
+ "align-items": [{
1139
+ items: [...scaleAlignSecondaryAxis(), {
1140
+ baseline: ["", "last"]
1141
+ }]
1142
+ }],
1143
+ /**
1144
+ * Align Self
1145
+ * @see https://tailwindcss.com/docs/align-self
1146
+ */
1147
+ "align-self": [{
1148
+ self: ["auto", ...scaleAlignSecondaryAxis(), {
1149
+ baseline: ["", "last"]
1150
+ }]
1151
+ }],
1152
+ /**
1153
+ * Place Content
1154
+ * @see https://tailwindcss.com/docs/place-content
1155
+ */
1156
+ "place-content": [{
1157
+ "place-content": scaleAlignPrimaryAxis()
1158
+ }],
1159
+ /**
1160
+ * Place Items
1161
+ * @see https://tailwindcss.com/docs/place-items
1162
+ */
1163
+ "place-items": [{
1164
+ "place-items": [...scaleAlignSecondaryAxis(), "baseline"]
1165
+ }],
1166
+ /**
1167
+ * Place Self
1168
+ * @see https://tailwindcss.com/docs/place-self
1169
+ */
1170
+ "place-self": [{
1171
+ "place-self": ["auto", ...scaleAlignSecondaryAxis()]
1172
+ }],
1173
+ // Spacing
1174
+ /**
1175
+ * Padding
1176
+ * @see https://tailwindcss.com/docs/padding
1177
+ */
1178
+ p: [{
1179
+ p: scaleUnambiguousSpacing()
1180
+ }],
1181
+ /**
1182
+ * Padding Inline
1183
+ * @see https://tailwindcss.com/docs/padding
1184
+ */
1185
+ px: [{
1186
+ px: scaleUnambiguousSpacing()
1187
+ }],
1188
+ /**
1189
+ * Padding Block
1190
+ * @see https://tailwindcss.com/docs/padding
1191
+ */
1192
+ py: [{
1193
+ py: scaleUnambiguousSpacing()
1194
+ }],
1195
+ /**
1196
+ * Padding Inline Start
1197
+ * @see https://tailwindcss.com/docs/padding
1198
+ */
1199
+ ps: [{
1200
+ ps: scaleUnambiguousSpacing()
1201
+ }],
1202
+ /**
1203
+ * Padding Inline End
1204
+ * @see https://tailwindcss.com/docs/padding
1205
+ */
1206
+ pe: [{
1207
+ pe: scaleUnambiguousSpacing()
1208
+ }],
1209
+ /**
1210
+ * Padding Block Start
1211
+ * @see https://tailwindcss.com/docs/padding
1212
+ */
1213
+ pbs: [{
1214
+ pbs: scaleUnambiguousSpacing()
1215
+ }],
1216
+ /**
1217
+ * Padding Block End
1218
+ * @see https://tailwindcss.com/docs/padding
1219
+ */
1220
+ pbe: [{
1221
+ pbe: scaleUnambiguousSpacing()
1222
+ }],
1223
+ /**
1224
+ * Padding Top
1225
+ * @see https://tailwindcss.com/docs/padding
1226
+ */
1227
+ pt: [{
1228
+ pt: scaleUnambiguousSpacing()
1229
+ }],
1230
+ /**
1231
+ * Padding Right
1232
+ * @see https://tailwindcss.com/docs/padding
1233
+ */
1234
+ pr: [{
1235
+ pr: scaleUnambiguousSpacing()
1236
+ }],
1237
+ /**
1238
+ * Padding Bottom
1239
+ * @see https://tailwindcss.com/docs/padding
1240
+ */
1241
+ pb: [{
1242
+ pb: scaleUnambiguousSpacing()
1243
+ }],
1244
+ /**
1245
+ * Padding Left
1246
+ * @see https://tailwindcss.com/docs/padding
1247
+ */
1248
+ pl: [{
1249
+ pl: scaleUnambiguousSpacing()
1250
+ }],
1251
+ /**
1252
+ * Margin
1253
+ * @see https://tailwindcss.com/docs/margin
1254
+ */
1255
+ m: [{
1256
+ m: scaleMargin()
1257
+ }],
1258
+ /**
1259
+ * Margin Inline
1260
+ * @see https://tailwindcss.com/docs/margin
1261
+ */
1262
+ mx: [{
1263
+ mx: scaleMargin()
1264
+ }],
1265
+ /**
1266
+ * Margin Block
1267
+ * @see https://tailwindcss.com/docs/margin
1268
+ */
1269
+ my: [{
1270
+ my: scaleMargin()
1271
+ }],
1272
+ /**
1273
+ * Margin Inline Start
1274
+ * @see https://tailwindcss.com/docs/margin
1275
+ */
1276
+ ms: [{
1277
+ ms: scaleMargin()
1278
+ }],
1279
+ /**
1280
+ * Margin Inline End
1281
+ * @see https://tailwindcss.com/docs/margin
1282
+ */
1283
+ me: [{
1284
+ me: scaleMargin()
1285
+ }],
1286
+ /**
1287
+ * Margin Block Start
1288
+ * @see https://tailwindcss.com/docs/margin
1289
+ */
1290
+ mbs: [{
1291
+ mbs: scaleMargin()
1292
+ }],
1293
+ /**
1294
+ * Margin Block End
1295
+ * @see https://tailwindcss.com/docs/margin
1296
+ */
1297
+ mbe: [{
1298
+ mbe: scaleMargin()
1299
+ }],
1300
+ /**
1301
+ * Margin Top
1302
+ * @see https://tailwindcss.com/docs/margin
1303
+ */
1304
+ mt: [{
1305
+ mt: scaleMargin()
1306
+ }],
1307
+ /**
1308
+ * Margin Right
1309
+ * @see https://tailwindcss.com/docs/margin
1310
+ */
1311
+ mr: [{
1312
+ mr: scaleMargin()
1313
+ }],
1314
+ /**
1315
+ * Margin Bottom
1316
+ * @see https://tailwindcss.com/docs/margin
1317
+ */
1318
+ mb: [{
1319
+ mb: scaleMargin()
1320
+ }],
1321
+ /**
1322
+ * Margin Left
1323
+ * @see https://tailwindcss.com/docs/margin
1324
+ */
1325
+ ml: [{
1326
+ ml: scaleMargin()
1327
+ }],
1328
+ /**
1329
+ * Space Between X
1330
+ * @see https://tailwindcss.com/docs/margin#adding-space-between-children
1331
+ */
1332
+ "space-x": [{
1333
+ "space-x": scaleUnambiguousSpacing()
1334
+ }],
1335
+ /**
1336
+ * Space Between X Reverse
1337
+ * @see https://tailwindcss.com/docs/margin#adding-space-between-children
1338
+ */
1339
+ "space-x-reverse": ["space-x-reverse"],
1340
+ /**
1341
+ * Space Between Y
1342
+ * @see https://tailwindcss.com/docs/margin#adding-space-between-children
1343
+ */
1344
+ "space-y": [{
1345
+ "space-y": scaleUnambiguousSpacing()
1346
+ }],
1347
+ /**
1348
+ * Space Between Y Reverse
1349
+ * @see https://tailwindcss.com/docs/margin#adding-space-between-children
1350
+ */
1351
+ "space-y-reverse": ["space-y-reverse"],
1352
+ // --------------
1353
+ // --- Sizing ---
1354
+ // --------------
1355
+ /**
1356
+ * Size
1357
+ * @see https://tailwindcss.com/docs/width#setting-both-width-and-height
1358
+ */
1359
+ size: [{
1360
+ size: scaleSizing()
1361
+ }],
1362
+ /**
1363
+ * Inline Size
1364
+ * @see https://tailwindcss.com/docs/width
1365
+ */
1366
+ "inline-size": [{
1367
+ inline: ["auto", ...scaleSizingInline()]
1368
+ }],
1369
+ /**
1370
+ * Min-Inline Size
1371
+ * @see https://tailwindcss.com/docs/min-width
1372
+ */
1373
+ "min-inline-size": [{
1374
+ "min-inline": ["auto", ...scaleSizingInline()]
1375
+ }],
1376
+ /**
1377
+ * Max-Inline Size
1378
+ * @see https://tailwindcss.com/docs/max-width
1379
+ */
1380
+ "max-inline-size": [{
1381
+ "max-inline": ["none", ...scaleSizingInline()]
1382
+ }],
1383
+ /**
1384
+ * Block Size
1385
+ * @see https://tailwindcss.com/docs/height
1386
+ */
1387
+ "block-size": [{
1388
+ block: ["auto", ...scaleSizingBlock()]
1389
+ }],
1390
+ /**
1391
+ * Min-Block Size
1392
+ * @see https://tailwindcss.com/docs/min-height
1393
+ */
1394
+ "min-block-size": [{
1395
+ "min-block": ["auto", ...scaleSizingBlock()]
1396
+ }],
1397
+ /**
1398
+ * Max-Block Size
1399
+ * @see https://tailwindcss.com/docs/max-height
1400
+ */
1401
+ "max-block-size": [{
1402
+ "max-block": ["none", ...scaleSizingBlock()]
1403
+ }],
1404
+ /**
1405
+ * Width
1406
+ * @see https://tailwindcss.com/docs/width
1407
+ */
1408
+ w: [{
1409
+ w: [themeContainer, "screen", ...scaleSizing()]
1410
+ }],
1411
+ /**
1412
+ * Min-Width
1413
+ * @see https://tailwindcss.com/docs/min-width
1414
+ */
1415
+ "min-w": [{
1416
+ "min-w": [
1417
+ themeContainer,
1418
+ "screen",
1419
+ /** Deprecated. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
1420
+ "none",
1421
+ ...scaleSizing()
1422
+ ]
1423
+ }],
1424
+ /**
1425
+ * Max-Width
1426
+ * @see https://tailwindcss.com/docs/max-width
1427
+ */
1428
+ "max-w": [{
1429
+ "max-w": [
1430
+ themeContainer,
1431
+ "screen",
1432
+ "none",
1433
+ /** Deprecated since Tailwind CSS v4.0.0. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
1434
+ "prose",
1435
+ /** Deprecated since Tailwind CSS v4.0.0. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
1436
+ {
1437
+ screen: [themeBreakpoint]
1438
+ },
1439
+ ...scaleSizing()
1440
+ ]
1441
+ }],
1442
+ /**
1443
+ * Height
1444
+ * @see https://tailwindcss.com/docs/height
1445
+ */
1446
+ h: [{
1447
+ h: ["screen", "lh", ...scaleSizing()]
1448
+ }],
1449
+ /**
1450
+ * Min-Height
1451
+ * @see https://tailwindcss.com/docs/min-height
1452
+ */
1453
+ "min-h": [{
1454
+ "min-h": ["screen", "lh", "none", ...scaleSizing()]
1455
+ }],
1456
+ /**
1457
+ * Max-Height
1458
+ * @see https://tailwindcss.com/docs/max-height
1459
+ */
1460
+ "max-h": [{
1461
+ "max-h": ["screen", "lh", ...scaleSizing()]
1462
+ }],
1463
+ // ------------------
1464
+ // --- Typography ---
1465
+ // ------------------
1466
+ /**
1467
+ * Font Size
1468
+ * @see https://tailwindcss.com/docs/font-size
1469
+ */
1470
+ "font-size": [{
1471
+ text: ["base", themeText, isArbitraryVariableLength, isArbitraryLength]
1472
+ }],
1473
+ /**
1474
+ * Font Smoothing
1475
+ * @see https://tailwindcss.com/docs/font-smoothing
1476
+ */
1477
+ "font-smoothing": ["antialiased", "subpixel-antialiased"],
1478
+ /**
1479
+ * Font Style
1480
+ * @see https://tailwindcss.com/docs/font-style
1481
+ */
1482
+ "font-style": ["italic", "not-italic"],
1483
+ /**
1484
+ * Font Weight
1485
+ * @see https://tailwindcss.com/docs/font-weight
1486
+ */
1487
+ "font-weight": [{
1488
+ font: [themeFontWeight, isArbitraryVariableWeight, isArbitraryWeight]
1489
+ }],
1490
+ /**
1491
+ * Font Stretch
1492
+ * @see https://tailwindcss.com/docs/font-stretch
1493
+ */
1494
+ "font-stretch": [{
1495
+ "font-stretch": ["ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "normal", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded", isPercent, isArbitraryValue]
1496
+ }],
1497
+ /**
1498
+ * Font Family
1499
+ * @see https://tailwindcss.com/docs/font-family
1500
+ */
1501
+ "font-family": [{
1502
+ font: [isArbitraryVariableFamilyName, isArbitraryFamilyName, themeFont]
1503
+ }],
1504
+ /**
1505
+ * Font Feature Settings
1506
+ * @see https://tailwindcss.com/docs/font-feature-settings
1507
+ */
1508
+ "font-features": [{
1509
+ "font-features": [isArbitraryValue]
1510
+ }],
1511
+ /**
1512
+ * Font Variant Numeric
1513
+ * @see https://tailwindcss.com/docs/font-variant-numeric
1514
+ */
1515
+ "fvn-normal": ["normal-nums"],
1516
+ /**
1517
+ * Font Variant Numeric
1518
+ * @see https://tailwindcss.com/docs/font-variant-numeric
1519
+ */
1520
+ "fvn-ordinal": ["ordinal"],
1521
+ /**
1522
+ * Font Variant Numeric
1523
+ * @see https://tailwindcss.com/docs/font-variant-numeric
1524
+ */
1525
+ "fvn-slashed-zero": ["slashed-zero"],
1526
+ /**
1527
+ * Font Variant Numeric
1528
+ * @see https://tailwindcss.com/docs/font-variant-numeric
1529
+ */
1530
+ "fvn-figure": ["lining-nums", "oldstyle-nums"],
1531
+ /**
1532
+ * Font Variant Numeric
1533
+ * @see https://tailwindcss.com/docs/font-variant-numeric
1534
+ */
1535
+ "fvn-spacing": ["proportional-nums", "tabular-nums"],
1536
+ /**
1537
+ * Font Variant Numeric
1538
+ * @see https://tailwindcss.com/docs/font-variant-numeric
1539
+ */
1540
+ "fvn-fraction": ["diagonal-fractions", "stacked-fractions"],
1541
+ /**
1542
+ * Letter Spacing
1543
+ * @see https://tailwindcss.com/docs/letter-spacing
1544
+ */
1545
+ tracking: [{
1546
+ tracking: [themeTracking, isArbitraryVariable, isArbitraryValue]
1547
+ }],
1548
+ /**
1549
+ * Line Clamp
1550
+ * @see https://tailwindcss.com/docs/line-clamp
1551
+ */
1552
+ "line-clamp": [{
1553
+ "line-clamp": [isNumber, "none", isArbitraryVariable, isArbitraryNumber]
1554
+ }],
1555
+ /**
1556
+ * Line Height
1557
+ * @see https://tailwindcss.com/docs/line-height
1558
+ */
1559
+ leading: [{
1560
+ leading: [
1561
+ /** Deprecated since Tailwind CSS v4.0.0. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
1562
+ themeLeading,
1563
+ ...scaleUnambiguousSpacing()
1564
+ ]
1565
+ }],
1566
+ /**
1567
+ * List Style Image
1568
+ * @see https://tailwindcss.com/docs/list-style-image
1569
+ */
1570
+ "list-image": [{
1571
+ "list-image": ["none", isArbitraryVariable, isArbitraryValue]
1572
+ }],
1573
+ /**
1574
+ * List Style Position
1575
+ * @see https://tailwindcss.com/docs/list-style-position
1576
+ */
1577
+ "list-style-position": [{
1578
+ list: ["inside", "outside"]
1579
+ }],
1580
+ /**
1581
+ * List Style Type
1582
+ * @see https://tailwindcss.com/docs/list-style-type
1583
+ */
1584
+ "list-style-type": [{
1585
+ list: ["disc", "decimal", "none", isArbitraryVariable, isArbitraryValue]
1586
+ }],
1587
+ /**
1588
+ * Text Alignment
1589
+ * @see https://tailwindcss.com/docs/text-align
1590
+ */
1591
+ "text-alignment": [{
1592
+ text: ["left", "center", "right", "justify", "start", "end"]
1593
+ }],
1594
+ /**
1595
+ * Placeholder Color
1596
+ * @deprecated since Tailwind CSS v3.0.0
1597
+ * @see https://v3.tailwindcss.com/docs/placeholder-color
1598
+ */
1599
+ "placeholder-color": [{
1600
+ placeholder: scaleColor()
1601
+ }],
1602
+ /**
1603
+ * Text Color
1604
+ * @see https://tailwindcss.com/docs/text-color
1605
+ */
1606
+ "text-color": [{
1607
+ text: scaleColor()
1608
+ }],
1609
+ /**
1610
+ * Text Decoration
1611
+ * @see https://tailwindcss.com/docs/text-decoration
1612
+ */
1613
+ "text-decoration": ["underline", "overline", "line-through", "no-underline"],
1614
+ /**
1615
+ * Text Decoration Style
1616
+ * @see https://tailwindcss.com/docs/text-decoration-style
1617
+ */
1618
+ "text-decoration-style": [{
1619
+ decoration: [...scaleLineStyle(), "wavy"]
1620
+ }],
1621
+ /**
1622
+ * Text Decoration Thickness
1623
+ * @see https://tailwindcss.com/docs/text-decoration-thickness
1624
+ */
1625
+ "text-decoration-thickness": [{
1626
+ decoration: [isNumber, "from-font", "auto", isArbitraryVariable, isArbitraryLength]
1627
+ }],
1628
+ /**
1629
+ * Text Decoration Color
1630
+ * @see https://tailwindcss.com/docs/text-decoration-color
1631
+ */
1632
+ "text-decoration-color": [{
1633
+ decoration: scaleColor()
1634
+ }],
1635
+ /**
1636
+ * Text Underline Offset
1637
+ * @see https://tailwindcss.com/docs/text-underline-offset
1638
+ */
1639
+ "underline-offset": [{
1640
+ "underline-offset": [isNumber, "auto", isArbitraryVariable, isArbitraryValue]
1641
+ }],
1642
+ /**
1643
+ * Text Transform
1644
+ * @see https://tailwindcss.com/docs/text-transform
1645
+ */
1646
+ "text-transform": ["uppercase", "lowercase", "capitalize", "normal-case"],
1647
+ /**
1648
+ * Text Overflow
1649
+ * @see https://tailwindcss.com/docs/text-overflow
1650
+ */
1651
+ "text-overflow": ["truncate", "text-ellipsis", "text-clip"],
1652
+ /**
1653
+ * Text Wrap
1654
+ * @see https://tailwindcss.com/docs/text-wrap
1655
+ */
1656
+ "text-wrap": [{
1657
+ text: ["wrap", "nowrap", "balance", "pretty"]
1658
+ }],
1659
+ /**
1660
+ * Text Indent
1661
+ * @see https://tailwindcss.com/docs/text-indent
1662
+ */
1663
+ indent: [{
1664
+ indent: scaleUnambiguousSpacing()
1665
+ }],
1666
+ /**
1667
+ * Tab Size
1668
+ * @see https://tailwindcss.com/docs/tab-size
1669
+ */
1670
+ "tab-size": [{
1671
+ tab: [isInteger, isArbitraryVariable, isArbitraryValue]
1672
+ }],
1673
+ /**
1674
+ * Vertical Alignment
1675
+ * @see https://tailwindcss.com/docs/vertical-align
1676
+ */
1677
+ "vertical-align": [{
1678
+ align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", isArbitraryVariable, isArbitraryValue]
1679
+ }],
1680
+ /**
1681
+ * Whitespace
1682
+ * @see https://tailwindcss.com/docs/whitespace
1683
+ */
1684
+ whitespace: [{
1685
+ whitespace: ["normal", "nowrap", "pre", "pre-line", "pre-wrap", "break-spaces"]
1686
+ }],
1687
+ /**
1688
+ * Word Break
1689
+ * @see https://tailwindcss.com/docs/word-break
1690
+ */
1691
+ break: [{
1692
+ break: ["normal", "words", "all", "keep"]
1693
+ }],
1694
+ /**
1695
+ * Overflow Wrap
1696
+ * @see https://tailwindcss.com/docs/overflow-wrap
1697
+ */
1698
+ wrap: [{
1699
+ wrap: ["break-word", "anywhere", "normal"]
1700
+ }],
1701
+ /**
1702
+ * Hyphens
1703
+ * @see https://tailwindcss.com/docs/hyphens
1704
+ */
1705
+ hyphens: [{
1706
+ hyphens: ["none", "manual", "auto"]
1707
+ }],
1708
+ /**
1709
+ * Content
1710
+ * @see https://tailwindcss.com/docs/content
1711
+ */
1712
+ content: [{
1713
+ content: ["none", isArbitraryVariable, isArbitraryValue]
1714
+ }],
1715
+ // -------------------
1716
+ // --- Backgrounds ---
1717
+ // -------------------
1718
+ /**
1719
+ * Background Attachment
1720
+ * @see https://tailwindcss.com/docs/background-attachment
1721
+ */
1722
+ "bg-attachment": [{
1723
+ bg: ["fixed", "local", "scroll"]
1724
+ }],
1725
+ /**
1726
+ * Background Clip
1727
+ * @see https://tailwindcss.com/docs/background-clip
1728
+ */
1729
+ "bg-clip": [{
1730
+ "bg-clip": ["border", "padding", "content", "text"]
1731
+ }],
1732
+ /**
1733
+ * Background Origin
1734
+ * @see https://tailwindcss.com/docs/background-origin
1735
+ */
1736
+ "bg-origin": [{
1737
+ "bg-origin": ["border", "padding", "content"]
1738
+ }],
1739
+ /**
1740
+ * Background Position
1741
+ * @see https://tailwindcss.com/docs/background-position
1742
+ */
1743
+ "bg-position": [{
1744
+ bg: scaleBgPosition()
1745
+ }],
1746
+ /**
1747
+ * Background Repeat
1748
+ * @see https://tailwindcss.com/docs/background-repeat
1749
+ */
1750
+ "bg-repeat": [{
1751
+ bg: scaleBgRepeat()
1752
+ }],
1753
+ /**
1754
+ * Background Size
1755
+ * @see https://tailwindcss.com/docs/background-size
1756
+ */
1757
+ "bg-size": [{
1758
+ bg: scaleBgSize()
1759
+ }],
1760
+ /**
1761
+ * Background Image
1762
+ * @see https://tailwindcss.com/docs/background-image
1763
+ */
1764
+ "bg-image": [{
1765
+ bg: ["none", {
1766
+ linear: [{
1767
+ to: ["t", "tr", "r", "br", "b", "bl", "l", "tl"]
1768
+ }, isInteger, isArbitraryVariable, isArbitraryValue],
1769
+ radial: ["", isArbitraryVariable, isArbitraryValue],
1770
+ conic: [isInteger, isArbitraryVariable, isArbitraryValue]
1771
+ }, isArbitraryVariableImage, isArbitraryImage]
1772
+ }],
1773
+ /**
1774
+ * Background Color
1775
+ * @see https://tailwindcss.com/docs/background-color
1776
+ */
1777
+ "bg-color": [{
1778
+ bg: scaleColor()
1779
+ }],
1780
+ /**
1781
+ * Gradient Color Stops From Position
1782
+ * @see https://tailwindcss.com/docs/gradient-color-stops
1783
+ */
1784
+ "gradient-from-pos": [{
1785
+ from: scaleGradientStopPosition()
1786
+ }],
1787
+ /**
1788
+ * Gradient Color Stops Via Position
1789
+ * @see https://tailwindcss.com/docs/gradient-color-stops
1790
+ */
1791
+ "gradient-via-pos": [{
1792
+ via: scaleGradientStopPosition()
1793
+ }],
1794
+ /**
1795
+ * Gradient Color Stops To Position
1796
+ * @see https://tailwindcss.com/docs/gradient-color-stops
1797
+ */
1798
+ "gradient-to-pos": [{
1799
+ to: scaleGradientStopPosition()
1800
+ }],
1801
+ /**
1802
+ * Gradient Color Stops From
1803
+ * @see https://tailwindcss.com/docs/gradient-color-stops
1804
+ */
1805
+ "gradient-from": [{
1806
+ from: scaleColor()
1807
+ }],
1808
+ /**
1809
+ * Gradient Color Stops Via
1810
+ * @see https://tailwindcss.com/docs/gradient-color-stops
1811
+ */
1812
+ "gradient-via": [{
1813
+ via: scaleColor()
1814
+ }],
1815
+ /**
1816
+ * Gradient Color Stops To
1817
+ * @see https://tailwindcss.com/docs/gradient-color-stops
1818
+ */
1819
+ "gradient-to": [{
1820
+ to: scaleColor()
1821
+ }],
1822
+ // ---------------
1823
+ // --- Borders ---
1824
+ // ---------------
1825
+ /**
1826
+ * Border Radius
1827
+ * @see https://tailwindcss.com/docs/border-radius
1828
+ */
1829
+ rounded: [{
1830
+ rounded: scaleRadius()
1831
+ }],
1832
+ /**
1833
+ * Border Radius Start
1834
+ * @see https://tailwindcss.com/docs/border-radius
1835
+ */
1836
+ "rounded-s": [{
1837
+ "rounded-s": scaleRadius()
1838
+ }],
1839
+ /**
1840
+ * Border Radius End
1841
+ * @see https://tailwindcss.com/docs/border-radius
1842
+ */
1843
+ "rounded-e": [{
1844
+ "rounded-e": scaleRadius()
1845
+ }],
1846
+ /**
1847
+ * Border Radius Top
1848
+ * @see https://tailwindcss.com/docs/border-radius
1849
+ */
1850
+ "rounded-t": [{
1851
+ "rounded-t": scaleRadius()
1852
+ }],
1853
+ /**
1854
+ * Border Radius Right
1855
+ * @see https://tailwindcss.com/docs/border-radius
1856
+ */
1857
+ "rounded-r": [{
1858
+ "rounded-r": scaleRadius()
1859
+ }],
1860
+ /**
1861
+ * Border Radius Bottom
1862
+ * @see https://tailwindcss.com/docs/border-radius
1863
+ */
1864
+ "rounded-b": [{
1865
+ "rounded-b": scaleRadius()
1866
+ }],
1867
+ /**
1868
+ * Border Radius Left
1869
+ * @see https://tailwindcss.com/docs/border-radius
1870
+ */
1871
+ "rounded-l": [{
1872
+ "rounded-l": scaleRadius()
1873
+ }],
1874
+ /**
1875
+ * Border Radius Start Start
1876
+ * @see https://tailwindcss.com/docs/border-radius
1877
+ */
1878
+ "rounded-ss": [{
1879
+ "rounded-ss": scaleRadius()
1880
+ }],
1881
+ /**
1882
+ * Border Radius Start End
1883
+ * @see https://tailwindcss.com/docs/border-radius
1884
+ */
1885
+ "rounded-se": [{
1886
+ "rounded-se": scaleRadius()
1887
+ }],
1888
+ /**
1889
+ * Border Radius End End
1890
+ * @see https://tailwindcss.com/docs/border-radius
1891
+ */
1892
+ "rounded-ee": [{
1893
+ "rounded-ee": scaleRadius()
1894
+ }],
1895
+ /**
1896
+ * Border Radius End Start
1897
+ * @see https://tailwindcss.com/docs/border-radius
1898
+ */
1899
+ "rounded-es": [{
1900
+ "rounded-es": scaleRadius()
1901
+ }],
1902
+ /**
1903
+ * Border Radius Top Left
1904
+ * @see https://tailwindcss.com/docs/border-radius
1905
+ */
1906
+ "rounded-tl": [{
1907
+ "rounded-tl": scaleRadius()
1908
+ }],
1909
+ /**
1910
+ * Border Radius Top Right
1911
+ * @see https://tailwindcss.com/docs/border-radius
1912
+ */
1913
+ "rounded-tr": [{
1914
+ "rounded-tr": scaleRadius()
1915
+ }],
1916
+ /**
1917
+ * Border Radius Bottom Right
1918
+ * @see https://tailwindcss.com/docs/border-radius
1919
+ */
1920
+ "rounded-br": [{
1921
+ "rounded-br": scaleRadius()
1922
+ }],
1923
+ /**
1924
+ * Border Radius Bottom Left
1925
+ * @see https://tailwindcss.com/docs/border-radius
1926
+ */
1927
+ "rounded-bl": [{
1928
+ "rounded-bl": scaleRadius()
1929
+ }],
1930
+ /**
1931
+ * Border Width
1932
+ * @see https://tailwindcss.com/docs/border-width
1933
+ */
1934
+ "border-w": [{
1935
+ border: scaleBorderWidth()
1936
+ }],
1937
+ /**
1938
+ * Border Width Inline
1939
+ * @see https://tailwindcss.com/docs/border-width
1940
+ */
1941
+ "border-w-x": [{
1942
+ "border-x": scaleBorderWidth()
1943
+ }],
1944
+ /**
1945
+ * Border Width Block
1946
+ * @see https://tailwindcss.com/docs/border-width
1947
+ */
1948
+ "border-w-y": [{
1949
+ "border-y": scaleBorderWidth()
1950
+ }],
1951
+ /**
1952
+ * Border Width Inline Start
1953
+ * @see https://tailwindcss.com/docs/border-width
1954
+ */
1955
+ "border-w-s": [{
1956
+ "border-s": scaleBorderWidth()
1957
+ }],
1958
+ /**
1959
+ * Border Width Inline End
1960
+ * @see https://tailwindcss.com/docs/border-width
1961
+ */
1962
+ "border-w-e": [{
1963
+ "border-e": scaleBorderWidth()
1964
+ }],
1965
+ /**
1966
+ * Border Width Block Start
1967
+ * @see https://tailwindcss.com/docs/border-width
1968
+ */
1969
+ "border-w-bs": [{
1970
+ "border-bs": scaleBorderWidth()
1971
+ }],
1972
+ /**
1973
+ * Border Width Block End
1974
+ * @see https://tailwindcss.com/docs/border-width
1975
+ */
1976
+ "border-w-be": [{
1977
+ "border-be": scaleBorderWidth()
1978
+ }],
1979
+ /**
1980
+ * Border Width Top
1981
+ * @see https://tailwindcss.com/docs/border-width
1982
+ */
1983
+ "border-w-t": [{
1984
+ "border-t": scaleBorderWidth()
1985
+ }],
1986
+ /**
1987
+ * Border Width Right
1988
+ * @see https://tailwindcss.com/docs/border-width
1989
+ */
1990
+ "border-w-r": [{
1991
+ "border-r": scaleBorderWidth()
1992
+ }],
1993
+ /**
1994
+ * Border Width Bottom
1995
+ * @see https://tailwindcss.com/docs/border-width
1996
+ */
1997
+ "border-w-b": [{
1998
+ "border-b": scaleBorderWidth()
1999
+ }],
2000
+ /**
2001
+ * Border Width Left
2002
+ * @see https://tailwindcss.com/docs/border-width
2003
+ */
2004
+ "border-w-l": [{
2005
+ "border-l": scaleBorderWidth()
2006
+ }],
2007
+ /**
2008
+ * Divide Width X
2009
+ * @see https://tailwindcss.com/docs/border-width#between-children
2010
+ */
2011
+ "divide-x": [{
2012
+ "divide-x": scaleBorderWidth()
2013
+ }],
2014
+ /**
2015
+ * Divide Width X Reverse
2016
+ * @see https://tailwindcss.com/docs/border-width#between-children
2017
+ */
2018
+ "divide-x-reverse": ["divide-x-reverse"],
2019
+ /**
2020
+ * Divide Width Y
2021
+ * @see https://tailwindcss.com/docs/border-width#between-children
2022
+ */
2023
+ "divide-y": [{
2024
+ "divide-y": scaleBorderWidth()
2025
+ }],
2026
+ /**
2027
+ * Divide Width Y Reverse
2028
+ * @see https://tailwindcss.com/docs/border-width#between-children
2029
+ */
2030
+ "divide-y-reverse": ["divide-y-reverse"],
2031
+ /**
2032
+ * Border Style
2033
+ * @see https://tailwindcss.com/docs/border-style
2034
+ */
2035
+ "border-style": [{
2036
+ border: [...scaleLineStyle(), "hidden", "none"]
2037
+ }],
2038
+ /**
2039
+ * Divide Style
2040
+ * @see https://tailwindcss.com/docs/border-style#setting-the-divider-style
2041
+ */
2042
+ "divide-style": [{
2043
+ divide: [...scaleLineStyle(), "hidden", "none"]
2044
+ }],
2045
+ /**
2046
+ * Border Color
2047
+ * @see https://tailwindcss.com/docs/border-color
2048
+ */
2049
+ "border-color": [{
2050
+ border: scaleColor()
2051
+ }],
2052
+ /**
2053
+ * Border Color Inline
2054
+ * @see https://tailwindcss.com/docs/border-color
2055
+ */
2056
+ "border-color-x": [{
2057
+ "border-x": scaleColor()
2058
+ }],
2059
+ /**
2060
+ * Border Color Block
2061
+ * @see https://tailwindcss.com/docs/border-color
2062
+ */
2063
+ "border-color-y": [{
2064
+ "border-y": scaleColor()
2065
+ }],
2066
+ /**
2067
+ * Border Color Inline Start
2068
+ * @see https://tailwindcss.com/docs/border-color
2069
+ */
2070
+ "border-color-s": [{
2071
+ "border-s": scaleColor()
2072
+ }],
2073
+ /**
2074
+ * Border Color Inline End
2075
+ * @see https://tailwindcss.com/docs/border-color
2076
+ */
2077
+ "border-color-e": [{
2078
+ "border-e": scaleColor()
2079
+ }],
2080
+ /**
2081
+ * Border Color Block Start
2082
+ * @see https://tailwindcss.com/docs/border-color
2083
+ */
2084
+ "border-color-bs": [{
2085
+ "border-bs": scaleColor()
2086
+ }],
2087
+ /**
2088
+ * Border Color Block End
2089
+ * @see https://tailwindcss.com/docs/border-color
2090
+ */
2091
+ "border-color-be": [{
2092
+ "border-be": scaleColor()
2093
+ }],
2094
+ /**
2095
+ * Border Color Top
2096
+ * @see https://tailwindcss.com/docs/border-color
2097
+ */
2098
+ "border-color-t": [{
2099
+ "border-t": scaleColor()
2100
+ }],
2101
+ /**
2102
+ * Border Color Right
2103
+ * @see https://tailwindcss.com/docs/border-color
2104
+ */
2105
+ "border-color-r": [{
2106
+ "border-r": scaleColor()
2107
+ }],
2108
+ /**
2109
+ * Border Color Bottom
2110
+ * @see https://tailwindcss.com/docs/border-color
2111
+ */
2112
+ "border-color-b": [{
2113
+ "border-b": scaleColor()
2114
+ }],
2115
+ /**
2116
+ * Border Color Left
2117
+ * @see https://tailwindcss.com/docs/border-color
2118
+ */
2119
+ "border-color-l": [{
2120
+ "border-l": scaleColor()
2121
+ }],
2122
+ /**
2123
+ * Divide Color
2124
+ * @see https://tailwindcss.com/docs/divide-color
2125
+ */
2126
+ "divide-color": [{
2127
+ divide: scaleColor()
2128
+ }],
2129
+ /**
2130
+ * Outline Style
2131
+ * @see https://tailwindcss.com/docs/outline-style
2132
+ */
2133
+ "outline-style": [{
2134
+ outline: [...scaleLineStyle(), "none", "hidden"]
2135
+ }],
2136
+ /**
2137
+ * Outline Offset
2138
+ * @see https://tailwindcss.com/docs/outline-offset
2139
+ */
2140
+ "outline-offset": [{
2141
+ "outline-offset": [isNumber, isArbitraryVariable, isArbitraryValue]
2142
+ }],
2143
+ /**
2144
+ * Outline Width
2145
+ * @see https://tailwindcss.com/docs/outline-width
2146
+ */
2147
+ "outline-w": [{
2148
+ outline: ["", isNumber, isArbitraryVariableLength, isArbitraryLength]
2149
+ }],
2150
+ /**
2151
+ * Outline Color
2152
+ * @see https://tailwindcss.com/docs/outline-color
2153
+ */
2154
+ "outline-color": [{
2155
+ outline: scaleColor()
2156
+ }],
2157
+ // ---------------
2158
+ // --- Effects ---
2159
+ // ---------------
2160
+ /**
2161
+ * Box Shadow
2162
+ * @see https://tailwindcss.com/docs/box-shadow
2163
+ */
2164
+ shadow: [{
2165
+ shadow: [
2166
+ // Deprecated since Tailwind CSS v4.0.0
2167
+ "",
2168
+ "none",
2169
+ themeShadow,
2170
+ isArbitraryVariableShadow,
2171
+ isArbitraryShadow
2172
+ ]
2173
+ }],
2174
+ /**
2175
+ * Box Shadow Color
2176
+ * @see https://tailwindcss.com/docs/box-shadow#setting-the-shadow-color
2177
+ */
2178
+ "shadow-color": [{
2179
+ shadow: scaleColor()
2180
+ }],
2181
+ /**
2182
+ * Inset Box Shadow
2183
+ * @see https://tailwindcss.com/docs/box-shadow#adding-an-inset-shadow
2184
+ */
2185
+ "inset-shadow": [{
2186
+ "inset-shadow": ["none", themeInsetShadow, isArbitraryVariableShadow, isArbitraryShadow]
2187
+ }],
2188
+ /**
2189
+ * Inset Box Shadow Color
2190
+ * @see https://tailwindcss.com/docs/box-shadow#setting-the-inset-shadow-color
2191
+ */
2192
+ "inset-shadow-color": [{
2193
+ "inset-shadow": scaleColor()
2194
+ }],
2195
+ /**
2196
+ * Ring Width
2197
+ * @see https://tailwindcss.com/docs/box-shadow#adding-a-ring
2198
+ */
2199
+ "ring-w": [{
2200
+ ring: scaleBorderWidth()
2201
+ }],
2202
+ /**
2203
+ * Ring Width Inset
2204
+ * @see https://v3.tailwindcss.com/docs/ring-width#inset-rings
2205
+ * @deprecated since Tailwind CSS v4.0.0
2206
+ * @see https://github.com/tailwindlabs/tailwindcss/blob/v4.0.0/packages/tailwindcss/src/utilities.ts#L4158
2207
+ */
2208
+ "ring-w-inset": ["ring-inset"],
2209
+ /**
2210
+ * Ring Color
2211
+ * @see https://tailwindcss.com/docs/box-shadow#setting-the-ring-color
2212
+ */
2213
+ "ring-color": [{
2214
+ ring: scaleColor()
2215
+ }],
2216
+ /**
2217
+ * Ring Offset Width
2218
+ * @see https://v3.tailwindcss.com/docs/ring-offset-width
2219
+ * @deprecated since Tailwind CSS v4.0.0
2220
+ * @see https://github.com/tailwindlabs/tailwindcss/blob/v4.0.0/packages/tailwindcss/src/utilities.ts#L4158
2221
+ */
2222
+ "ring-offset-w": [{
2223
+ "ring-offset": [isNumber, isArbitraryLength]
2224
+ }],
2225
+ /**
2226
+ * Ring Offset Color
2227
+ * @see https://v3.tailwindcss.com/docs/ring-offset-color
2228
+ * @deprecated since Tailwind CSS v4.0.0
2229
+ * @see https://github.com/tailwindlabs/tailwindcss/blob/v4.0.0/packages/tailwindcss/src/utilities.ts#L4158
2230
+ */
2231
+ "ring-offset-color": [{
2232
+ "ring-offset": scaleColor()
2233
+ }],
2234
+ /**
2235
+ * Inset Ring Width
2236
+ * @see https://tailwindcss.com/docs/box-shadow#adding-an-inset-ring
2237
+ */
2238
+ "inset-ring-w": [{
2239
+ "inset-ring": scaleBorderWidth()
2240
+ }],
2241
+ /**
2242
+ * Inset Ring Color
2243
+ * @see https://tailwindcss.com/docs/box-shadow#setting-the-inset-ring-color
2244
+ */
2245
+ "inset-ring-color": [{
2246
+ "inset-ring": scaleColor()
2247
+ }],
2248
+ /**
2249
+ * Text Shadow
2250
+ * @see https://tailwindcss.com/docs/text-shadow
2251
+ */
2252
+ "text-shadow": [{
2253
+ "text-shadow": ["none", themeTextShadow, isArbitraryVariableShadow, isArbitraryShadow]
2254
+ }],
2255
+ /**
2256
+ * Text Shadow Color
2257
+ * @see https://tailwindcss.com/docs/text-shadow#setting-the-shadow-color
2258
+ */
2259
+ "text-shadow-color": [{
2260
+ "text-shadow": scaleColor()
2261
+ }],
2262
+ /**
2263
+ * Opacity
2264
+ * @see https://tailwindcss.com/docs/opacity
2265
+ */
2266
+ opacity: [{
2267
+ opacity: [isNumber, isArbitraryVariable, isArbitraryValue]
2268
+ }],
2269
+ /**
2270
+ * Mix Blend Mode
2271
+ * @see https://tailwindcss.com/docs/mix-blend-mode
2272
+ */
2273
+ "mix-blend": [{
2274
+ "mix-blend": [...scaleBlendMode(), "plus-darker", "plus-lighter"]
2275
+ }],
2276
+ /**
2277
+ * Background Blend Mode
2278
+ * @see https://tailwindcss.com/docs/background-blend-mode
2279
+ */
2280
+ "bg-blend": [{
2281
+ "bg-blend": scaleBlendMode()
2282
+ }],
2283
+ /**
2284
+ * Mask Clip
2285
+ * @see https://tailwindcss.com/docs/mask-clip
2286
+ */
2287
+ "mask-clip": [{
2288
+ "mask-clip": ["border", "padding", "content", "fill", "stroke", "view"]
2289
+ }, "mask-no-clip"],
2290
+ /**
2291
+ * Mask Composite
2292
+ * @see https://tailwindcss.com/docs/mask-composite
2293
+ */
2294
+ "mask-composite": [{
2295
+ mask: ["add", "subtract", "intersect", "exclude"]
2296
+ }],
2297
+ /**
2298
+ * Mask Image
2299
+ * @see https://tailwindcss.com/docs/mask-image
2300
+ */
2301
+ "mask-image-linear-pos": [{
2302
+ "mask-linear": [isNumber]
2303
+ }],
2304
+ "mask-image-linear-from-pos": [{
2305
+ "mask-linear-from": scaleMaskImagePosition()
2306
+ }],
2307
+ "mask-image-linear-to-pos": [{
2308
+ "mask-linear-to": scaleMaskImagePosition()
2309
+ }],
2310
+ "mask-image-linear-from-color": [{
2311
+ "mask-linear-from": scaleColor()
2312
+ }],
2313
+ "mask-image-linear-to-color": [{
2314
+ "mask-linear-to": scaleColor()
2315
+ }],
2316
+ "mask-image-t-from-pos": [{
2317
+ "mask-t-from": scaleMaskImagePosition()
2318
+ }],
2319
+ "mask-image-t-to-pos": [{
2320
+ "mask-t-to": scaleMaskImagePosition()
2321
+ }],
2322
+ "mask-image-t-from-color": [{
2323
+ "mask-t-from": scaleColor()
2324
+ }],
2325
+ "mask-image-t-to-color": [{
2326
+ "mask-t-to": scaleColor()
2327
+ }],
2328
+ "mask-image-r-from-pos": [{
2329
+ "mask-r-from": scaleMaskImagePosition()
2330
+ }],
2331
+ "mask-image-r-to-pos": [{
2332
+ "mask-r-to": scaleMaskImagePosition()
2333
+ }],
2334
+ "mask-image-r-from-color": [{
2335
+ "mask-r-from": scaleColor()
2336
+ }],
2337
+ "mask-image-r-to-color": [{
2338
+ "mask-r-to": scaleColor()
2339
+ }],
2340
+ "mask-image-b-from-pos": [{
2341
+ "mask-b-from": scaleMaskImagePosition()
2342
+ }],
2343
+ "mask-image-b-to-pos": [{
2344
+ "mask-b-to": scaleMaskImagePosition()
2345
+ }],
2346
+ "mask-image-b-from-color": [{
2347
+ "mask-b-from": scaleColor()
2348
+ }],
2349
+ "mask-image-b-to-color": [{
2350
+ "mask-b-to": scaleColor()
2351
+ }],
2352
+ "mask-image-l-from-pos": [{
2353
+ "mask-l-from": scaleMaskImagePosition()
2354
+ }],
2355
+ "mask-image-l-to-pos": [{
2356
+ "mask-l-to": scaleMaskImagePosition()
2357
+ }],
2358
+ "mask-image-l-from-color": [{
2359
+ "mask-l-from": scaleColor()
2360
+ }],
2361
+ "mask-image-l-to-color": [{
2362
+ "mask-l-to": scaleColor()
2363
+ }],
2364
+ "mask-image-x-from-pos": [{
2365
+ "mask-x-from": scaleMaskImagePosition()
2366
+ }],
2367
+ "mask-image-x-to-pos": [{
2368
+ "mask-x-to": scaleMaskImagePosition()
2369
+ }],
2370
+ "mask-image-x-from-color": [{
2371
+ "mask-x-from": scaleColor()
2372
+ }],
2373
+ "mask-image-x-to-color": [{
2374
+ "mask-x-to": scaleColor()
2375
+ }],
2376
+ "mask-image-y-from-pos": [{
2377
+ "mask-y-from": scaleMaskImagePosition()
2378
+ }],
2379
+ "mask-image-y-to-pos": [{
2380
+ "mask-y-to": scaleMaskImagePosition()
2381
+ }],
2382
+ "mask-image-y-from-color": [{
2383
+ "mask-y-from": scaleColor()
2384
+ }],
2385
+ "mask-image-y-to-color": [{
2386
+ "mask-y-to": scaleColor()
2387
+ }],
2388
+ "mask-image-radial": [{
2389
+ "mask-radial": [isArbitraryVariable, isArbitraryValue]
2390
+ }],
2391
+ "mask-image-radial-from-pos": [{
2392
+ "mask-radial-from": scaleMaskImagePosition()
2393
+ }],
2394
+ "mask-image-radial-to-pos": [{
2395
+ "mask-radial-to": scaleMaskImagePosition()
2396
+ }],
2397
+ "mask-image-radial-from-color": [{
2398
+ "mask-radial-from": scaleColor()
2399
+ }],
2400
+ "mask-image-radial-to-color": [{
2401
+ "mask-radial-to": scaleColor()
2402
+ }],
2403
+ "mask-image-radial-shape": [{
2404
+ "mask-radial": ["circle", "ellipse"]
2405
+ }],
2406
+ "mask-image-radial-size": [{
2407
+ "mask-radial": [{
2408
+ closest: ["side", "corner"],
2409
+ farthest: ["side", "corner"]
2410
+ }]
2411
+ }],
2412
+ "mask-image-radial-pos": [{
2413
+ "mask-radial-at": scalePosition()
2414
+ }],
2415
+ "mask-image-conic-pos": [{
2416
+ "mask-conic": [isNumber]
2417
+ }],
2418
+ "mask-image-conic-from-pos": [{
2419
+ "mask-conic-from": scaleMaskImagePosition()
2420
+ }],
2421
+ "mask-image-conic-to-pos": [{
2422
+ "mask-conic-to": scaleMaskImagePosition()
2423
+ }],
2424
+ "mask-image-conic-from-color": [{
2425
+ "mask-conic-from": scaleColor()
2426
+ }],
2427
+ "mask-image-conic-to-color": [{
2428
+ "mask-conic-to": scaleColor()
2429
+ }],
2430
+ /**
2431
+ * Mask Mode
2432
+ * @see https://tailwindcss.com/docs/mask-mode
2433
+ */
2434
+ "mask-mode": [{
2435
+ mask: ["alpha", "luminance", "match"]
2436
+ }],
2437
+ /**
2438
+ * Mask Origin
2439
+ * @see https://tailwindcss.com/docs/mask-origin
2440
+ */
2441
+ "mask-origin": [{
2442
+ "mask-origin": ["border", "padding", "content", "fill", "stroke", "view"]
2443
+ }],
2444
+ /**
2445
+ * Mask Position
2446
+ * @see https://tailwindcss.com/docs/mask-position
2447
+ */
2448
+ "mask-position": [{
2449
+ mask: scaleBgPosition()
2450
+ }],
2451
+ /**
2452
+ * Mask Repeat
2453
+ * @see https://tailwindcss.com/docs/mask-repeat
2454
+ */
2455
+ "mask-repeat": [{
2456
+ mask: scaleBgRepeat()
2457
+ }],
2458
+ /**
2459
+ * Mask Size
2460
+ * @see https://tailwindcss.com/docs/mask-size
2461
+ */
2462
+ "mask-size": [{
2463
+ mask: scaleBgSize()
2464
+ }],
2465
+ /**
2466
+ * Mask Type
2467
+ * @see https://tailwindcss.com/docs/mask-type
2468
+ */
2469
+ "mask-type": [{
2470
+ "mask-type": ["alpha", "luminance"]
2471
+ }],
2472
+ /**
2473
+ * Mask Image
2474
+ * @see https://tailwindcss.com/docs/mask-image
2475
+ */
2476
+ "mask-image": [{
2477
+ mask: ["none", isArbitraryVariable, isArbitraryValue]
2478
+ }],
2479
+ // ---------------
2480
+ // --- Filters ---
2481
+ // ---------------
2482
+ /**
2483
+ * Filter
2484
+ * @see https://tailwindcss.com/docs/filter
2485
+ */
2486
+ filter: [{
2487
+ filter: [
2488
+ // Deprecated since Tailwind CSS v3.0.0
2489
+ "",
2490
+ "none",
2491
+ isArbitraryVariable,
2492
+ isArbitraryValue
2493
+ ]
2494
+ }],
2495
+ /**
2496
+ * Blur
2497
+ * @see https://tailwindcss.com/docs/blur
2498
+ */
2499
+ blur: [{
2500
+ blur: scaleBlur()
2501
+ }],
2502
+ /**
2503
+ * Brightness
2504
+ * @see https://tailwindcss.com/docs/brightness
2505
+ */
2506
+ brightness: [{
2507
+ brightness: [isNumber, isArbitraryVariable, isArbitraryValue]
2508
+ }],
2509
+ /**
2510
+ * Contrast
2511
+ * @see https://tailwindcss.com/docs/contrast
2512
+ */
2513
+ contrast: [{
2514
+ contrast: [isNumber, isArbitraryVariable, isArbitraryValue]
2515
+ }],
2516
+ /**
2517
+ * Drop Shadow
2518
+ * @see https://tailwindcss.com/docs/drop-shadow
2519
+ */
2520
+ "drop-shadow": [{
2521
+ "drop-shadow": [
2522
+ // Deprecated since Tailwind CSS v4.0.0
2523
+ "",
2524
+ "none",
2525
+ themeDropShadow,
2526
+ isArbitraryVariableShadow,
2527
+ isArbitraryShadow
2528
+ ]
2529
+ }],
2530
+ /**
2531
+ * Drop Shadow Color
2532
+ * @see https://tailwindcss.com/docs/filter-drop-shadow#setting-the-shadow-color
2533
+ */
2534
+ "drop-shadow-color": [{
2535
+ "drop-shadow": scaleColor()
2536
+ }],
2537
+ /**
2538
+ * Grayscale
2539
+ * @see https://tailwindcss.com/docs/grayscale
2540
+ */
2541
+ grayscale: [{
2542
+ grayscale: ["", isNumber, isArbitraryVariable, isArbitraryValue]
2543
+ }],
2544
+ /**
2545
+ * Hue Rotate
2546
+ * @see https://tailwindcss.com/docs/hue-rotate
2547
+ */
2548
+ "hue-rotate": [{
2549
+ "hue-rotate": [isNumber, isArbitraryVariable, isArbitraryValue]
2550
+ }],
2551
+ /**
2552
+ * Invert
2553
+ * @see https://tailwindcss.com/docs/invert
2554
+ */
2555
+ invert: [{
2556
+ invert: ["", isNumber, isArbitraryVariable, isArbitraryValue]
2557
+ }],
2558
+ /**
2559
+ * Saturate
2560
+ * @see https://tailwindcss.com/docs/saturate
2561
+ */
2562
+ saturate: [{
2563
+ saturate: [isNumber, isArbitraryVariable, isArbitraryValue]
2564
+ }],
2565
+ /**
2566
+ * Sepia
2567
+ * @see https://tailwindcss.com/docs/sepia
2568
+ */
2569
+ sepia: [{
2570
+ sepia: ["", isNumber, isArbitraryVariable, isArbitraryValue]
2571
+ }],
2572
+ /**
2573
+ * Backdrop Filter
2574
+ * @see https://tailwindcss.com/docs/backdrop-filter
2575
+ */
2576
+ "backdrop-filter": [{
2577
+ "backdrop-filter": [
2578
+ // Deprecated since Tailwind CSS v3.0.0
2579
+ "",
2580
+ "none",
2581
+ isArbitraryVariable,
2582
+ isArbitraryValue
2583
+ ]
2584
+ }],
2585
+ /**
2586
+ * Backdrop Blur
2587
+ * @see https://tailwindcss.com/docs/backdrop-blur
2588
+ */
2589
+ "backdrop-blur": [{
2590
+ "backdrop-blur": scaleBlur()
2591
+ }],
2592
+ /**
2593
+ * Backdrop Brightness
2594
+ * @see https://tailwindcss.com/docs/backdrop-brightness
2595
+ */
2596
+ "backdrop-brightness": [{
2597
+ "backdrop-brightness": [isNumber, isArbitraryVariable, isArbitraryValue]
2598
+ }],
2599
+ /**
2600
+ * Backdrop Contrast
2601
+ * @see https://tailwindcss.com/docs/backdrop-contrast
2602
+ */
2603
+ "backdrop-contrast": [{
2604
+ "backdrop-contrast": [isNumber, isArbitraryVariable, isArbitraryValue]
2605
+ }],
2606
+ /**
2607
+ * Backdrop Grayscale
2608
+ * @see https://tailwindcss.com/docs/backdrop-grayscale
2609
+ */
2610
+ "backdrop-grayscale": [{
2611
+ "backdrop-grayscale": ["", isNumber, isArbitraryVariable, isArbitraryValue]
2612
+ }],
2613
+ /**
2614
+ * Backdrop Hue Rotate
2615
+ * @see https://tailwindcss.com/docs/backdrop-hue-rotate
2616
+ */
2617
+ "backdrop-hue-rotate": [{
2618
+ "backdrop-hue-rotate": [isNumber, isArbitraryVariable, isArbitraryValue]
2619
+ }],
2620
+ /**
2621
+ * Backdrop Invert
2622
+ * @see https://tailwindcss.com/docs/backdrop-invert
2623
+ */
2624
+ "backdrop-invert": [{
2625
+ "backdrop-invert": ["", isNumber, isArbitraryVariable, isArbitraryValue]
2626
+ }],
2627
+ /**
2628
+ * Backdrop Opacity
2629
+ * @see https://tailwindcss.com/docs/backdrop-opacity
2630
+ */
2631
+ "backdrop-opacity": [{
2632
+ "backdrop-opacity": [isNumber, isArbitraryVariable, isArbitraryValue]
2633
+ }],
2634
+ /**
2635
+ * Backdrop Saturate
2636
+ * @see https://tailwindcss.com/docs/backdrop-saturate
2637
+ */
2638
+ "backdrop-saturate": [{
2639
+ "backdrop-saturate": [isNumber, isArbitraryVariable, isArbitraryValue]
2640
+ }],
2641
+ /**
2642
+ * Backdrop Sepia
2643
+ * @see https://tailwindcss.com/docs/backdrop-sepia
2644
+ */
2645
+ "backdrop-sepia": [{
2646
+ "backdrop-sepia": ["", isNumber, isArbitraryVariable, isArbitraryValue]
2647
+ }],
2648
+ // --------------
2649
+ // --- Tables ---
2650
+ // --------------
2651
+ /**
2652
+ * Border Collapse
2653
+ * @see https://tailwindcss.com/docs/border-collapse
2654
+ */
2655
+ "border-collapse": [{
2656
+ border: ["collapse", "separate"]
2657
+ }],
2658
+ /**
2659
+ * Border Spacing
2660
+ * @see https://tailwindcss.com/docs/border-spacing
2661
+ */
2662
+ "border-spacing": [{
2663
+ "border-spacing": scaleUnambiguousSpacing()
2664
+ }],
2665
+ /**
2666
+ * Border Spacing X
2667
+ * @see https://tailwindcss.com/docs/border-spacing
2668
+ */
2669
+ "border-spacing-x": [{
2670
+ "border-spacing-x": scaleUnambiguousSpacing()
2671
+ }],
2672
+ /**
2673
+ * Border Spacing Y
2674
+ * @see https://tailwindcss.com/docs/border-spacing
2675
+ */
2676
+ "border-spacing-y": [{
2677
+ "border-spacing-y": scaleUnambiguousSpacing()
2678
+ }],
2679
+ /**
2680
+ * Table Layout
2681
+ * @see https://tailwindcss.com/docs/table-layout
2682
+ */
2683
+ "table-layout": [{
2684
+ table: ["auto", "fixed"]
2685
+ }],
2686
+ /**
2687
+ * Caption Side
2688
+ * @see https://tailwindcss.com/docs/caption-side
2689
+ */
2690
+ caption: [{
2691
+ caption: ["top", "bottom"]
2692
+ }],
2693
+ // ---------------------------------
2694
+ // --- Transitions and Animation ---
2695
+ // ---------------------------------
2696
+ /**
2697
+ * Transition Property
2698
+ * @see https://tailwindcss.com/docs/transition-property
2699
+ */
2700
+ transition: [{
2701
+ transition: ["", "all", "colors", "opacity", "shadow", "transform", "none", isArbitraryVariable, isArbitraryValue]
2702
+ }],
2703
+ /**
2704
+ * Transition Behavior
2705
+ * @see https://tailwindcss.com/docs/transition-behavior
2706
+ */
2707
+ "transition-behavior": [{
2708
+ transition: ["normal", "discrete"]
2709
+ }],
2710
+ /**
2711
+ * Transition Duration
2712
+ * @see https://tailwindcss.com/docs/transition-duration
2713
+ */
2714
+ duration: [{
2715
+ duration: [isNumber, "initial", isArbitraryVariable, isArbitraryValue]
2716
+ }],
2717
+ /**
2718
+ * Transition Timing Function
2719
+ * @see https://tailwindcss.com/docs/transition-timing-function
2720
+ */
2721
+ ease: [{
2722
+ ease: ["linear", "initial", themeEase, isArbitraryVariable, isArbitraryValue]
2723
+ }],
2724
+ /**
2725
+ * Transition Delay
2726
+ * @see https://tailwindcss.com/docs/transition-delay
2727
+ */
2728
+ delay: [{
2729
+ delay: [isNumber, isArbitraryVariable, isArbitraryValue]
2730
+ }],
2731
+ /**
2732
+ * Animation
2733
+ * @see https://tailwindcss.com/docs/animation
2734
+ */
2735
+ animate: [{
2736
+ animate: ["none", themeAnimate, isArbitraryVariable, isArbitraryValue]
2737
+ }],
2738
+ // ------------------
2739
+ // --- Transforms ---
2740
+ // ------------------
2741
+ /**
2742
+ * Backface Visibility
2743
+ * @see https://tailwindcss.com/docs/backface-visibility
2744
+ */
2745
+ backface: [{
2746
+ backface: ["hidden", "visible"]
2747
+ }],
2748
+ /**
2749
+ * Perspective
2750
+ * @see https://tailwindcss.com/docs/perspective
2751
+ */
2752
+ perspective: [{
2753
+ perspective: [themePerspective, isArbitraryVariable, isArbitraryValue]
2754
+ }],
2755
+ /**
2756
+ * Perspective Origin
2757
+ * @see https://tailwindcss.com/docs/perspective-origin
2758
+ */
2759
+ "perspective-origin": [{
2760
+ "perspective-origin": scalePositionWithArbitrary()
2761
+ }],
2762
+ /**
2763
+ * Rotate
2764
+ * @see https://tailwindcss.com/docs/rotate
2765
+ */
2766
+ rotate: [{
2767
+ rotate: scaleRotate()
2768
+ }],
2769
+ /**
2770
+ * Rotate X
2771
+ * @see https://tailwindcss.com/docs/rotate
2772
+ */
2773
+ "rotate-x": [{
2774
+ "rotate-x": scaleRotate()
2775
+ }],
2776
+ /**
2777
+ * Rotate Y
2778
+ * @see https://tailwindcss.com/docs/rotate
2779
+ */
2780
+ "rotate-y": [{
2781
+ "rotate-y": scaleRotate()
2782
+ }],
2783
+ /**
2784
+ * Rotate Z
2785
+ * @see https://tailwindcss.com/docs/rotate
2786
+ */
2787
+ "rotate-z": [{
2788
+ "rotate-z": scaleRotate()
2789
+ }],
2790
+ /**
2791
+ * Scale
2792
+ * @see https://tailwindcss.com/docs/scale
2793
+ */
2794
+ scale: [{
2795
+ scale: scaleScale()
2796
+ }],
2797
+ /**
2798
+ * Scale X
2799
+ * @see https://tailwindcss.com/docs/scale
2800
+ */
2801
+ "scale-x": [{
2802
+ "scale-x": scaleScale()
2803
+ }],
2804
+ /**
2805
+ * Scale Y
2806
+ * @see https://tailwindcss.com/docs/scale
2807
+ */
2808
+ "scale-y": [{
2809
+ "scale-y": scaleScale()
2810
+ }],
2811
+ /**
2812
+ * Scale Z
2813
+ * @see https://tailwindcss.com/docs/scale
2814
+ */
2815
+ "scale-z": [{
2816
+ "scale-z": scaleScale()
2817
+ }],
2818
+ /**
2819
+ * Scale 3D
2820
+ * @see https://tailwindcss.com/docs/scale
2821
+ */
2822
+ "scale-3d": ["scale-3d"],
2823
+ /**
2824
+ * Skew
2825
+ * @see https://tailwindcss.com/docs/skew
2826
+ */
2827
+ skew: [{
2828
+ skew: scaleSkew()
2829
+ }],
2830
+ /**
2831
+ * Skew X
2832
+ * @see https://tailwindcss.com/docs/skew
2833
+ */
2834
+ "skew-x": [{
2835
+ "skew-x": scaleSkew()
2836
+ }],
2837
+ /**
2838
+ * Skew Y
2839
+ * @see https://tailwindcss.com/docs/skew
2840
+ */
2841
+ "skew-y": [{
2842
+ "skew-y": scaleSkew()
2843
+ }],
2844
+ /**
2845
+ * Transform
2846
+ * @see https://tailwindcss.com/docs/transform
2847
+ */
2848
+ transform: [{
2849
+ transform: [isArbitraryVariable, isArbitraryValue, "", "none", "gpu", "cpu"]
2850
+ }],
2851
+ /**
2852
+ * Transform Origin
2853
+ * @see https://tailwindcss.com/docs/transform-origin
2854
+ */
2855
+ "transform-origin": [{
2856
+ origin: scalePositionWithArbitrary()
2857
+ }],
2858
+ /**
2859
+ * Transform Style
2860
+ * @see https://tailwindcss.com/docs/transform-style
2861
+ */
2862
+ "transform-style": [{
2863
+ transform: ["3d", "flat"]
2864
+ }],
2865
+ /**
2866
+ * Translate
2867
+ * @see https://tailwindcss.com/docs/translate
2868
+ */
2869
+ translate: [{
2870
+ translate: scaleTranslate()
2871
+ }],
2872
+ /**
2873
+ * Translate X
2874
+ * @see https://tailwindcss.com/docs/translate
2875
+ */
2876
+ "translate-x": [{
2877
+ "translate-x": scaleTranslate()
2878
+ }],
2879
+ /**
2880
+ * Translate Y
2881
+ * @see https://tailwindcss.com/docs/translate
2882
+ */
2883
+ "translate-y": [{
2884
+ "translate-y": scaleTranslate()
2885
+ }],
2886
+ /**
2887
+ * Translate Z
2888
+ * @see https://tailwindcss.com/docs/translate
2889
+ */
2890
+ "translate-z": [{
2891
+ "translate-z": scaleTranslate()
2892
+ }],
2893
+ /**
2894
+ * Translate None
2895
+ * @see https://tailwindcss.com/docs/translate
2896
+ */
2897
+ "translate-none": ["translate-none"],
2898
+ /**
2899
+ * Zoom
2900
+ * @see https://tailwindcss.com/docs/zoom
2901
+ */
2902
+ zoom: [{
2903
+ zoom: [isInteger, isArbitraryVariable, isArbitraryValue]
2904
+ }],
2905
+ // ---------------------
2906
+ // --- Interactivity ---
2907
+ // ---------------------
2908
+ /**
2909
+ * Accent Color
2910
+ * @see https://tailwindcss.com/docs/accent-color
2911
+ */
2912
+ accent: [{
2913
+ accent: scaleColor()
2914
+ }],
2915
+ /**
2916
+ * Appearance
2917
+ * @see https://tailwindcss.com/docs/appearance
2918
+ */
2919
+ appearance: [{
2920
+ appearance: ["none", "auto"]
2921
+ }],
2922
+ /**
2923
+ * Caret Color
2924
+ * @see https://tailwindcss.com/docs/just-in-time-mode#caret-color-utilities
2925
+ */
2926
+ "caret-color": [{
2927
+ caret: scaleColor()
2928
+ }],
2929
+ /**
2930
+ * Color Scheme
2931
+ * @see https://tailwindcss.com/docs/color-scheme
2932
+ */
2933
+ "color-scheme": [{
2934
+ scheme: ["normal", "dark", "light", "light-dark", "only-dark", "only-light"]
2935
+ }],
2936
+ /**
2937
+ * Cursor
2938
+ * @see https://tailwindcss.com/docs/cursor
2939
+ */
2940
+ cursor: [{
2941
+ cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out", isArbitraryVariable, isArbitraryValue]
2942
+ }],
2943
+ /**
2944
+ * Field Sizing
2945
+ * @see https://tailwindcss.com/docs/field-sizing
2946
+ */
2947
+ "field-sizing": [{
2948
+ "field-sizing": ["fixed", "content"]
2949
+ }],
2950
+ /**
2951
+ * Pointer Events
2952
+ * @see https://tailwindcss.com/docs/pointer-events
2953
+ */
2954
+ "pointer-events": [{
2955
+ "pointer-events": ["auto", "none"]
2956
+ }],
2957
+ /**
2958
+ * Resize
2959
+ * @see https://tailwindcss.com/docs/resize
2960
+ */
2961
+ resize: [{
2962
+ resize: ["none", "", "y", "x"]
2963
+ }],
2964
+ /**
2965
+ * Scroll Behavior
2966
+ * @see https://tailwindcss.com/docs/scroll-behavior
2967
+ */
2968
+ "scroll-behavior": [{
2969
+ scroll: ["auto", "smooth"]
2970
+ }],
2971
+ /**
2972
+ * Scrollbar Thumb Color
2973
+ * @see https://tailwindcss.com/docs/scrollbar-color
2974
+ */
2975
+ "scrollbar-thumb-color": [{
2976
+ "scrollbar-thumb": scaleColor()
2977
+ }],
2978
+ /**
2979
+ * Scrollbar Track Color
2980
+ * @see https://tailwindcss.com/docs/scrollbar-color
2981
+ */
2982
+ "scrollbar-track-color": [{
2983
+ "scrollbar-track": scaleColor()
2984
+ }],
2985
+ /**
2986
+ * Scrollbar Gutter
2987
+ * @see https://tailwindcss.com/docs/scrollbar-gutter
2988
+ */
2989
+ "scrollbar-gutter": [{
2990
+ "scrollbar-gutter": ["auto", "stable", "both"]
2991
+ }],
2992
+ /**
2993
+ * Scrollbar Width
2994
+ * @see https://tailwindcss.com/docs/scrollbar-width
2995
+ */
2996
+ "scrollbar-w": [{
2997
+ scrollbar: ["auto", "thin", "none"]
2998
+ }],
2999
+ /**
3000
+ * Scroll Margin
3001
+ * @see https://tailwindcss.com/docs/scroll-margin
3002
+ */
3003
+ "scroll-m": [{
3004
+ "scroll-m": scaleUnambiguousSpacing()
3005
+ }],
3006
+ /**
3007
+ * Scroll Margin Inline
3008
+ * @see https://tailwindcss.com/docs/scroll-margin
3009
+ */
3010
+ "scroll-mx": [{
3011
+ "scroll-mx": scaleUnambiguousSpacing()
3012
+ }],
3013
+ /**
3014
+ * Scroll Margin Block
3015
+ * @see https://tailwindcss.com/docs/scroll-margin
3016
+ */
3017
+ "scroll-my": [{
3018
+ "scroll-my": scaleUnambiguousSpacing()
3019
+ }],
3020
+ /**
3021
+ * Scroll Margin Inline Start
3022
+ * @see https://tailwindcss.com/docs/scroll-margin
3023
+ */
3024
+ "scroll-ms": [{
3025
+ "scroll-ms": scaleUnambiguousSpacing()
3026
+ }],
3027
+ /**
3028
+ * Scroll Margin Inline End
3029
+ * @see https://tailwindcss.com/docs/scroll-margin
3030
+ */
3031
+ "scroll-me": [{
3032
+ "scroll-me": scaleUnambiguousSpacing()
3033
+ }],
3034
+ /**
3035
+ * Scroll Margin Block Start
3036
+ * @see https://tailwindcss.com/docs/scroll-margin
3037
+ */
3038
+ "scroll-mbs": [{
3039
+ "scroll-mbs": scaleUnambiguousSpacing()
3040
+ }],
3041
+ /**
3042
+ * Scroll Margin Block End
3043
+ * @see https://tailwindcss.com/docs/scroll-margin
3044
+ */
3045
+ "scroll-mbe": [{
3046
+ "scroll-mbe": scaleUnambiguousSpacing()
3047
+ }],
3048
+ /**
3049
+ * Scroll Margin Top
3050
+ * @see https://tailwindcss.com/docs/scroll-margin
3051
+ */
3052
+ "scroll-mt": [{
3053
+ "scroll-mt": scaleUnambiguousSpacing()
3054
+ }],
3055
+ /**
3056
+ * Scroll Margin Right
3057
+ * @see https://tailwindcss.com/docs/scroll-margin
3058
+ */
3059
+ "scroll-mr": [{
3060
+ "scroll-mr": scaleUnambiguousSpacing()
3061
+ }],
3062
+ /**
3063
+ * Scroll Margin Bottom
3064
+ * @see https://tailwindcss.com/docs/scroll-margin
3065
+ */
3066
+ "scroll-mb": [{
3067
+ "scroll-mb": scaleUnambiguousSpacing()
3068
+ }],
3069
+ /**
3070
+ * Scroll Margin Left
3071
+ * @see https://tailwindcss.com/docs/scroll-margin
3072
+ */
3073
+ "scroll-ml": [{
3074
+ "scroll-ml": scaleUnambiguousSpacing()
3075
+ }],
3076
+ /**
3077
+ * Scroll Padding
3078
+ * @see https://tailwindcss.com/docs/scroll-padding
3079
+ */
3080
+ "scroll-p": [{
3081
+ "scroll-p": scaleUnambiguousSpacing()
3082
+ }],
3083
+ /**
3084
+ * Scroll Padding Inline
3085
+ * @see https://tailwindcss.com/docs/scroll-padding
3086
+ */
3087
+ "scroll-px": [{
3088
+ "scroll-px": scaleUnambiguousSpacing()
3089
+ }],
3090
+ /**
3091
+ * Scroll Padding Block
3092
+ * @see https://tailwindcss.com/docs/scroll-padding
3093
+ */
3094
+ "scroll-py": [{
3095
+ "scroll-py": scaleUnambiguousSpacing()
3096
+ }],
3097
+ /**
3098
+ * Scroll Padding Inline Start
3099
+ * @see https://tailwindcss.com/docs/scroll-padding
3100
+ */
3101
+ "scroll-ps": [{
3102
+ "scroll-ps": scaleUnambiguousSpacing()
3103
+ }],
3104
+ /**
3105
+ * Scroll Padding Inline End
3106
+ * @see https://tailwindcss.com/docs/scroll-padding
3107
+ */
3108
+ "scroll-pe": [{
3109
+ "scroll-pe": scaleUnambiguousSpacing()
3110
+ }],
3111
+ /**
3112
+ * Scroll Padding Block Start
3113
+ * @see https://tailwindcss.com/docs/scroll-padding
3114
+ */
3115
+ "scroll-pbs": [{
3116
+ "scroll-pbs": scaleUnambiguousSpacing()
3117
+ }],
3118
+ /**
3119
+ * Scroll Padding Block End
3120
+ * @see https://tailwindcss.com/docs/scroll-padding
3121
+ */
3122
+ "scroll-pbe": [{
3123
+ "scroll-pbe": scaleUnambiguousSpacing()
3124
+ }],
3125
+ /**
3126
+ * Scroll Padding Top
3127
+ * @see https://tailwindcss.com/docs/scroll-padding
3128
+ */
3129
+ "scroll-pt": [{
3130
+ "scroll-pt": scaleUnambiguousSpacing()
3131
+ }],
3132
+ /**
3133
+ * Scroll Padding Right
3134
+ * @see https://tailwindcss.com/docs/scroll-padding
3135
+ */
3136
+ "scroll-pr": [{
3137
+ "scroll-pr": scaleUnambiguousSpacing()
3138
+ }],
3139
+ /**
3140
+ * Scroll Padding Bottom
3141
+ * @see https://tailwindcss.com/docs/scroll-padding
3142
+ */
3143
+ "scroll-pb": [{
3144
+ "scroll-pb": scaleUnambiguousSpacing()
3145
+ }],
3146
+ /**
3147
+ * Scroll Padding Left
3148
+ * @see https://tailwindcss.com/docs/scroll-padding
3149
+ */
3150
+ "scroll-pl": [{
3151
+ "scroll-pl": scaleUnambiguousSpacing()
3152
+ }],
3153
+ /**
3154
+ * Scroll Snap Align
3155
+ * @see https://tailwindcss.com/docs/scroll-snap-align
3156
+ */
3157
+ "snap-align": [{
3158
+ snap: ["start", "end", "center", "align-none"]
3159
+ }],
3160
+ /**
3161
+ * Scroll Snap Stop
3162
+ * @see https://tailwindcss.com/docs/scroll-snap-stop
3163
+ */
3164
+ "snap-stop": [{
3165
+ snap: ["normal", "always"]
3166
+ }],
3167
+ /**
3168
+ * Scroll Snap Type
3169
+ * @see https://tailwindcss.com/docs/scroll-snap-type
3170
+ */
3171
+ "snap-type": [{
3172
+ snap: ["none", "x", "y", "both"]
3173
+ }],
3174
+ /**
3175
+ * Scroll Snap Type Strictness
3176
+ * @see https://tailwindcss.com/docs/scroll-snap-type
3177
+ */
3178
+ "snap-strictness": [{
3179
+ snap: ["mandatory", "proximity"]
3180
+ }],
3181
+ /**
3182
+ * Touch Action
3183
+ * @see https://tailwindcss.com/docs/touch-action
3184
+ */
3185
+ touch: [{
3186
+ touch: ["auto", "none", "manipulation"]
3187
+ }],
3188
+ /**
3189
+ * Touch Action X
3190
+ * @see https://tailwindcss.com/docs/touch-action
3191
+ */
3192
+ "touch-x": [{
3193
+ "touch-pan": ["x", "left", "right"]
3194
+ }],
3195
+ /**
3196
+ * Touch Action Y
3197
+ * @see https://tailwindcss.com/docs/touch-action
3198
+ */
3199
+ "touch-y": [{
3200
+ "touch-pan": ["y", "up", "down"]
3201
+ }],
3202
+ /**
3203
+ * Touch Action Pinch Zoom
3204
+ * @see https://tailwindcss.com/docs/touch-action
3205
+ */
3206
+ "touch-pz": ["touch-pinch-zoom"],
3207
+ /**
3208
+ * User Select
3209
+ * @see https://tailwindcss.com/docs/user-select
3210
+ */
3211
+ select: [{
3212
+ select: ["none", "text", "all", "auto"]
3213
+ }],
3214
+ /**
3215
+ * Will Change
3216
+ * @see https://tailwindcss.com/docs/will-change
3217
+ */
3218
+ "will-change": [{
3219
+ "will-change": ["auto", "scroll", "contents", "transform", isArbitraryVariable, isArbitraryValue]
3220
+ }],
3221
+ // -----------
3222
+ // --- SVG ---
3223
+ // -----------
3224
+ /**
3225
+ * Fill
3226
+ * @see https://tailwindcss.com/docs/fill
3227
+ */
3228
+ fill: [{
3229
+ fill: ["none", ...scaleColor()]
3230
+ }],
3231
+ /**
3232
+ * Stroke Width
3233
+ * @see https://tailwindcss.com/docs/stroke-width
3234
+ */
3235
+ "stroke-w": [{
3236
+ stroke: [isNumber, isArbitraryVariableLength, isArbitraryLength, isArbitraryNumber]
3237
+ }],
3238
+ /**
3239
+ * Stroke
3240
+ * @see https://tailwindcss.com/docs/stroke
3241
+ */
3242
+ stroke: [{
3243
+ stroke: ["none", ...scaleColor()]
3244
+ }],
3245
+ // ---------------------
3246
+ // --- Accessibility ---
3247
+ // ---------------------
3248
+ /**
3249
+ * Forced Color Adjust
3250
+ * @see https://tailwindcss.com/docs/forced-color-adjust
3251
+ */
3252
+ "forced-color-adjust": [{
3253
+ "forced-color-adjust": ["auto", "none"]
3254
+ }]
3255
+ },
3256
+ conflictingClassGroups: {
3257
+ "container-named": ["container-type"],
3258
+ overflow: ["overflow-x", "overflow-y"],
3259
+ overscroll: ["overscroll-x", "overscroll-y"],
3260
+ inset: ["inset-x", "inset-y", "inset-bs", "inset-be", "start", "end", "top", "right", "bottom", "left"],
3261
+ "inset-x": ["right", "left"],
3262
+ "inset-y": ["top", "bottom"],
3263
+ flex: ["basis", "grow", "shrink"],
3264
+ gap: ["gap-x", "gap-y"],
3265
+ p: ["px", "py", "ps", "pe", "pbs", "pbe", "pt", "pr", "pb", "pl"],
3266
+ px: ["pr", "pl"],
3267
+ py: ["pt", "pb"],
3268
+ m: ["mx", "my", "ms", "me", "mbs", "mbe", "mt", "mr", "mb", "ml"],
3269
+ mx: ["mr", "ml"],
3270
+ my: ["mt", "mb"],
3271
+ size: ["w", "h"],
3272
+ "font-size": ["leading"],
3273
+ "fvn-normal": ["fvn-ordinal", "fvn-slashed-zero", "fvn-figure", "fvn-spacing", "fvn-fraction"],
3274
+ "fvn-ordinal": ["fvn-normal"],
3275
+ "fvn-slashed-zero": ["fvn-normal"],
3276
+ "fvn-figure": ["fvn-normal"],
3277
+ "fvn-spacing": ["fvn-normal"],
3278
+ "fvn-fraction": ["fvn-normal"],
3279
+ "line-clamp": ["display", "overflow"],
3280
+ rounded: ["rounded-s", "rounded-e", "rounded-t", "rounded-r", "rounded-b", "rounded-l", "rounded-ss", "rounded-se", "rounded-ee", "rounded-es", "rounded-tl", "rounded-tr", "rounded-br", "rounded-bl"],
3281
+ "rounded-s": ["rounded-ss", "rounded-es"],
3282
+ "rounded-e": ["rounded-se", "rounded-ee"],
3283
+ "rounded-t": ["rounded-tl", "rounded-tr"],
3284
+ "rounded-r": ["rounded-tr", "rounded-br"],
3285
+ "rounded-b": ["rounded-br", "rounded-bl"],
3286
+ "rounded-l": ["rounded-tl", "rounded-bl"],
3287
+ "border-spacing": ["border-spacing-x", "border-spacing-y"],
3288
+ "border-w": ["border-w-x", "border-w-y", "border-w-s", "border-w-e", "border-w-bs", "border-w-be", "border-w-t", "border-w-r", "border-w-b", "border-w-l"],
3289
+ "border-w-x": ["border-w-r", "border-w-l"],
3290
+ "border-w-y": ["border-w-t", "border-w-b"],
3291
+ "border-color": ["border-color-x", "border-color-y", "border-color-s", "border-color-e", "border-color-bs", "border-color-be", "border-color-t", "border-color-r", "border-color-b", "border-color-l"],
3292
+ "border-color-x": ["border-color-r", "border-color-l"],
3293
+ "border-color-y": ["border-color-t", "border-color-b"],
3294
+ translate: ["translate-x", "translate-y", "translate-none"],
3295
+ "translate-none": ["translate", "translate-x", "translate-y", "translate-z"],
3296
+ "scroll-m": ["scroll-mx", "scroll-my", "scroll-ms", "scroll-me", "scroll-mbs", "scroll-mbe", "scroll-mt", "scroll-mr", "scroll-mb", "scroll-ml"],
3297
+ "scroll-mx": ["scroll-mr", "scroll-ml"],
3298
+ "scroll-my": ["scroll-mt", "scroll-mb"],
3299
+ "scroll-p": ["scroll-px", "scroll-py", "scroll-ps", "scroll-pe", "scroll-pbs", "scroll-pbe", "scroll-pt", "scroll-pr", "scroll-pb", "scroll-pl"],
3300
+ "scroll-px": ["scroll-pr", "scroll-pl"],
3301
+ "scroll-py": ["scroll-pt", "scroll-pb"],
3302
+ touch: ["touch-x", "touch-y", "touch-pz"],
3303
+ "touch-x": ["touch"],
3304
+ "touch-y": ["touch"],
3305
+ "touch-pz": ["touch"]
3306
+ },
3307
+ conflictingClassGroupModifiers: {
3308
+ "font-size": ["leading"]
3309
+ },
3310
+ postfixLookupClassGroups: ["container-type"],
3311
+ orderSensitiveModifiers: ["*", "**", "after", "backdrop", "before", "details-content", "file", "first-letter", "first-line", "marker", "placeholder", "selection"]
3312
+ };
3313
+ };
3314
+ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
3315
+
3316
+ // src/lib/utils.ts
3317
+ function cn(...inputs) {
3318
+ return twMerge(clsx(inputs));
3319
+ }
3320
+
3321
+ // node_modules/class-variance-authority/dist/index.mjs
3322
+ var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
3323
+ var cx = clsx;
3324
+ var cva = (base, config) => (props) => {
3325
+ var _config_compoundVariants;
3326
+ if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
3327
+ const { variants, defaultVariants } = config;
3328
+ const getVariantClassNames = Object.keys(variants).map((variant) => {
3329
+ const variantProp = props === null || props === void 0 ? void 0 : props[variant];
3330
+ const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
3331
+ if (variantProp === null) return null;
3332
+ const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
3333
+ return variants[variant][variantKey];
3334
+ });
3335
+ const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => {
3336
+ let [key, value] = param;
3337
+ if (value === void 0) {
3338
+ return acc;
3339
+ }
3340
+ acc[key] = value;
3341
+ return acc;
3342
+ }, {});
3343
+ const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param) => {
3344
+ let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
3345
+ return Object.entries(compoundVariantOptions).every((param2) => {
3346
+ let [key, value] = param2;
3347
+ return Array.isArray(value) ? value.includes({
3348
+ ...defaultVariants,
3349
+ ...propsWithoutUndefined
3350
+ }[key]) : {
3351
+ ...defaultVariants,
3352
+ ...propsWithoutUndefined
3353
+ }[key] === value;
3354
+ }) ? [
3355
+ ...acc,
3356
+ cvClass,
3357
+ cvClassName
3358
+ ] : acc;
3359
+ }, []);
3360
+ return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
3361
+ };
3362
+
3363
+ // src/ui/toggle.tsx
3364
+ var import_radix_ui = require("radix-ui");
3365
+ var import_jsx_runtime = require("react/jsx-runtime");
3366
+ var toggleVariants = cva(
3367
+ "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
3368
+ {
3369
+ variants: {
3370
+ variant: {
3371
+ default: "bg-transparent border-0",
3372
+ outline: "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"
3373
+ },
3374
+ size: {
3375
+ default: "px-2 py-1",
3376
+ sm: "h-8 min-w-8 px-1.5",
3377
+ lg: "h-10 min-w-10 px-2.5"
3378
+ }
3379
+ },
3380
+ defaultVariants: {
3381
+ variant: "default",
3382
+ size: "default"
3383
+ }
3384
+ }
3385
+ );
3386
+ function Toggle({
3387
+ className,
3388
+ variant,
3389
+ size,
3390
+ ...props
3391
+ }) {
3392
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
3393
+ import_radix_ui.Toggle.Root,
3394
+ {
3395
+ "data-slot": "toggle",
3396
+ className: cn(toggleVariants({ variant, size, className })),
3397
+ ...props
3398
+ }
3399
+ );
3400
+ }
3401
+
3402
+ // src/ui/toggle-group.tsx
3403
+ var import_jsx_runtime2 = require("react/jsx-runtime");
3404
+ var ToggleGroupContext = React.createContext({
3405
+ value: "",
3406
+ onValueChange: () => {
3407
+ }
3408
+ });
3409
+ function ToggleGroup({
3410
+ className,
3411
+ value,
3412
+ onValueChange,
3413
+ children,
3414
+ ...props
3415
+ }) {
3416
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
3417
+ "div",
3418
+ {
3419
+ role: "group",
3420
+ className: cn("flex items-center gap-1 p-1 bg-muted rounded-md", className),
3421
+ ...props,
3422
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ToggleGroupContext.Provider, { value: { value, onValueChange }, children })
3423
+ }
3424
+ );
3425
+ }
3426
+ function ToggleGroupItem({
3427
+ className,
3428
+ value,
3429
+ children,
3430
+ ...props
3431
+ }) {
3432
+ const { value: groupValue, onValueChange } = React.useContext(ToggleGroupContext);
3433
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
3434
+ Toggle,
3435
+ {
3436
+ pressed: groupValue === value,
3437
+ onPressedChange: () => onValueChange(value),
3438
+ className: cn(
3439
+ "text-foreground cursor-pointer hover:bg-transparent hover:text-foreground",
3440
+ "data-[state=on]:bg-background data-[state=on]:shadow-sm",
3441
+ "data-[state=off]:opacity-50 data-[state=off]:hover:opacity-75",
3442
+ className
3443
+ ),
3444
+ ...props,
3445
+ children
3446
+ }
3447
+ );
3448
+ }
3449
+
3450
+ // src/OhhwellsBridge.tsx
3451
+ var import_react_dom = require("react-dom");
3452
+ var import_navigation = require("next/navigation");
3453
+
3454
+ // src/lib/session-search.ts
3455
+ var STORAGE_KEY = "ohw-preserved-search";
3456
+ function readPreservedSearch() {
3457
+ if (typeof window === "undefined") return "";
3458
+ const fromUrl = window.location.search;
3459
+ if (fromUrl && fromUrl !== "?") {
3460
+ sessionStorage.setItem(STORAGE_KEY, fromUrl);
3461
+ return fromUrl;
3462
+ }
3463
+ return sessionStorage.getItem(STORAGE_KEY) ?? "";
3464
+ }
3465
+ function isEditSessionActive() {
3466
+ const search = readPreservedSearch();
3467
+ if (!search || search === "?") return false;
3468
+ const q = search.startsWith("?") ? search.slice(1) : search;
3469
+ return new URLSearchParams(q).get("mode") === "edit";
3470
+ }
3471
+
3472
+ // src/OhhwellsBridge.tsx
3473
+ var import_jsx_runtime3 = require("react/jsx-runtime");
3474
+ var PRIMARY = "#0885FE";
3475
+ var IMAGE_FADE_MS = 300;
3476
+ function runOpacityFade(el, onDone) {
3477
+ const anim = el.animate([{ opacity: 0 }, { opacity: 1 }], {
3478
+ duration: IMAGE_FADE_MS,
3479
+ easing: "ease",
3480
+ fill: "forwards"
3481
+ });
3482
+ let finished = false;
3483
+ const finish = () => {
3484
+ if (finished) return;
3485
+ finished = true;
3486
+ anim.cancel();
3487
+ el.style.opacity = "";
3488
+ onDone();
3489
+ };
3490
+ anim.finished.then(finish).catch(finish);
3491
+ window.setTimeout(finish, IMAGE_FADE_MS + 100);
3492
+ }
3493
+ function fadeInImageElement(img, onReady) {
3494
+ onReady();
3495
+ img.style.opacity = "0";
3496
+ runOpacityFade(img, () => {
3497
+ img.style.opacity = "";
3498
+ });
3499
+ }
3500
+ function fadeInBgImage(el, url, onReady) {
3501
+ const prevPos = el.style.position;
3502
+ if (!prevPos || prevPos === "static") el.style.position = "relative";
3503
+ const layer = document.createElement("div");
3504
+ layer.setAttribute("data-ohw-bg-fade-layer", "");
3505
+ Object.assign(layer.style, {
3506
+ position: "absolute",
3507
+ inset: "0",
3508
+ zIndex: "0",
3509
+ backgroundImage: `url('${url}')`,
3510
+ backgroundSize: "cover",
3511
+ backgroundPosition: "center",
3512
+ backgroundRepeat: "no-repeat",
3513
+ opacity: "0",
3514
+ pointerEvents: "none"
3515
+ });
3516
+ el.prepend(layer);
3517
+ onReady();
3518
+ runOpacityFade(layer, () => {
3519
+ el.style.backgroundImage = `url('${url}')`;
3520
+ layer.remove();
3521
+ if (!prevPos || prevPos === "static") el.style.position = prevPos;
3522
+ });
3523
+ }
3524
+ function collectEditableNodes() {
3525
+ return Array.from(document.querySelectorAll("[data-ohw-editable]")).map((el) => {
3526
+ if (el.dataset.ohwEditable === "image") {
3527
+ const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
3528
+ return { key: el.dataset.ohwKey ?? "", type: "image", text: img?.src ?? "" };
3529
+ }
3530
+ if (el.dataset.ohwEditable === "bg-image") {
3531
+ const raw = el.style.backgroundImage;
3532
+ const url = raw.replace(/^url\(['"]?/, "").replace(/['"]?\)$/, "");
3533
+ return { key: el.dataset.ohwKey ?? "", type: "bg-image", text: url };
3534
+ }
3535
+ return {
3536
+ key: el.dataset.ohwKey ?? "",
3537
+ type: el.dataset.ohwEditable ?? "text",
3538
+ text: el.dataset.ohwEditable === "plain" ? el.innerText ?? "" : el.innerHTML
3539
+ };
3540
+ });
3541
+ }
3542
+ var FORCE_PSEUDO_STATES = [
3543
+ { pseudo: ":hover", state: "hover" },
3544
+ { pseudo: ":focus", state: "focus" },
3545
+ { pseudo: ":focus-visible", state: "focus-visible" },
3546
+ { pseudo: ":active", state: "active" }
3547
+ ];
3548
+ function buildHoverSuppressor(rule) {
3549
+ const props = [];
3550
+ for (let i = 0; i < rule.style.length; i++) props.push(rule.style.item(i));
3551
+ if (props.length === 0) return null;
3552
+ const suppressorSelectors = [];
3553
+ for (const sel of rule.selectorText.split(",").map((s) => s.trim())) {
3554
+ if (!sel.includes(":hover")) continue;
3555
+ const idx = sel.indexOf(":hover");
3556
+ suppressorSelectors.push(
3557
+ sel.slice(0, idx) + '[data-ohw-editable-state]:not([data-ohw-active-state="hover"])' + sel.slice(idx)
3558
+ );
3559
+ }
3560
+ if (suppressorSelectors.length === 0) return null;
3561
+ const firstSel = rule.selectorText.split(",")[0].trim();
3562
+ const hoverIdx = firstSel.indexOf(":hover");
3563
+ const descendantPart = firstSel.slice(hoverIdx + ":hover".length).trim();
3564
+ let targetEl = null;
3565
+ try {
3566
+ targetEl = descendantPart ? document.querySelector(`[data-ohw-editable-state] ${descendantPart}`) : document.querySelector("[data-ohw-editable-state]");
3567
+ } catch {
3568
+ return null;
3569
+ }
3570
+ if (!targetEl) return null;
3571
+ const cs = getComputedStyle(targetEl);
3572
+ const decls = props.map((p) => `${p}: ${cs.getPropertyValue(p)} !important`).join("; ");
3573
+ return `${suppressorSelectors.join(", ")} { ${decls} }`;
3574
+ }
3575
+ function applyStateViews(container, state) {
3576
+ container.querySelectorAll("[data-ohw-state-view]").forEach((view) => {
3577
+ view.style.display = view.getAttribute("data-ohw-state-view") === state ? "block" : "none";
3578
+ });
3579
+ }
3580
+ function resetStateViews() {
3581
+ document.querySelectorAll("[data-ohw-state-view]").forEach((el) => {
3582
+ el.style.display = "";
3583
+ });
3584
+ }
3585
+ function collectStateRules() {
3586
+ const lines = [];
3587
+ function processRules(rules) {
3588
+ for (const rule of Array.from(rules)) {
3589
+ if (rule instanceof CSSStyleRule) {
3590
+ let text = rule.cssText;
3591
+ let matched = false;
3592
+ for (const { pseudo, state } of FORCE_PSEUDO_STATES) {
3593
+ if (text.includes(pseudo)) {
3594
+ text = text.replace(new RegExp(pseudo.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "(?![\\w-])", "g"), `[data-ohw-active-state="${state}"]`);
3595
+ if (pseudo === ":hover") {
3596
+ const suppressor = buildHoverSuppressor(rule);
3597
+ if (suppressor) lines.push(suppressor);
3598
+ }
3599
+ matched = true;
3600
+ }
3601
+ }
3602
+ if (matched) lines.push(text);
3603
+ } else if ("cssRules" in rule) {
3604
+ processRules(rule.cssRules);
3605
+ }
3606
+ }
3607
+ }
3608
+ for (const sheet of Array.from(document.styleSheets)) {
3609
+ try {
3610
+ processRules(sheet.cssRules);
3611
+ } catch {
3612
+ }
3613
+ }
3614
+ return lines.join("\n");
3615
+ }
3616
+ var SAFE_TAGS = /* @__PURE__ */ new Set([
3617
+ "B",
3618
+ "I",
3619
+ "U",
3620
+ "S",
3621
+ "STRIKE",
3622
+ "STRONG",
3623
+ "EM",
3624
+ "BR",
3625
+ "P",
3626
+ "DIV",
3627
+ "SPAN",
3628
+ "OL",
3629
+ "UL",
3630
+ "LI"
3631
+ ]);
3632
+ function sanitizeHtml(html) {
3633
+ const doc = new DOMParser().parseFromString(`<body>${html}</body>`, "text/html");
3634
+ function walk(parent) {
3635
+ for (const child of Array.from(parent.childNodes)) {
3636
+ if (child.nodeType !== Node.ELEMENT_NODE) continue;
3637
+ const el = child;
3638
+ if (!SAFE_TAGS.has(el.tagName)) {
3639
+ parent.replaceChild(document.createTextNode(el.textContent ?? ""), el);
3640
+ } else {
3641
+ const textAlign = el.style?.textAlign || el.getAttribute("align") || "";
3642
+ for (const attr of Array.from(el.attributes)) el.removeAttribute(attr.name);
3643
+ if (textAlign) el.style.textAlign = textAlign;
3644
+ walk(el);
3645
+ }
3646
+ }
3647
+ }
3648
+ walk(doc.body);
3649
+ return doc.body.innerHTML;
3650
+ }
3651
+ var ICONS = {
3652
+ bold: '<path d="M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"/><path d="M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"/>',
3653
+ italic: '<line x1="19" y1="4" x2="10" y2="4"/><line x1="14" y1="20" x2="5" y2="20"/><line x1="15" y1="4" x2="9" y2="20"/>',
3654
+ underline: '<path d="M6 4v6a6 6 0 0 0 12 0V4"/><line x1="4" y1="20" x2="20" y2="20"/>',
3655
+ strikeThrough: '<path d="M16 4H9a3 3 0 0 0-2.83 4"/><path d="M14 12a4 4 0 0 1 0 8H6"/><line x1="4" y1="12" x2="20" y2="12"/>',
3656
+ justifyLeft: '<line x1="21" y1="6" x2="3" y2="6"/><line x1="15" y1="12" x2="3" y2="12"/><line x1="17" y1="18" x2="3" y2="18"/>',
3657
+ justifyCenter: '<line x1="21" y1="6" x2="3" y2="6"/><line x1="17" y1="12" x2="7" y2="12"/><line x1="19" y1="18" x2="5" y2="18"/>',
3658
+ justifyRight: '<line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="12" x2="9" y2="12"/><line x1="21" y1="18" x2="7" y2="18"/>',
3659
+ insertUnorderedList: '<line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/>',
3660
+ insertOrderedList: '<line x1="10" y1="6" x2="21" y2="6"/><line x1="10" y1="12" x2="21" y2="12"/><line x1="10" y1="18" x2="21" y2="18"/><path d="M4 6h1v4"/><path d="M4 10h2"/><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"/>'
3661
+ };
3662
+ var TOOLBAR_GROUPS = [
3663
+ [
3664
+ { cmd: "bold", title: "Bold" },
3665
+ { cmd: "italic", title: "Italic" },
3666
+ { cmd: "underline", title: "Underline" },
3667
+ { cmd: "strikeThrough", title: "Strikethrough" }
3668
+ ],
3669
+ [
3670
+ { cmd: "justifyLeft", title: "Align Left" },
3671
+ { cmd: "justifyCenter", title: "Align Center" },
3672
+ { cmd: "justifyRight", title: "Align Right" }
3673
+ ],
3674
+ [
3675
+ { cmd: "insertUnorderedList", title: "Bullet List" },
3676
+ { cmd: "insertOrderedList", title: "Numbered List" }
3677
+ ]
3678
+ ];
3679
+ function GlowFrame({ rect, elRef }) {
3680
+ const GAP = 6;
3681
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3682
+ "div",
3683
+ {
3684
+ ref: elRef,
3685
+ style: {
3686
+ position: "fixed",
3687
+ top: rect.top - GAP,
3688
+ left: rect.left - GAP,
3689
+ width: rect.width + GAP * 2,
3690
+ height: rect.height + GAP * 2,
3691
+ border: "2px solid #0885FE",
3692
+ borderRadius: 8,
3693
+ boxShadow: "0 0 0 4px rgba(8, 133, 254, 0.12)",
3694
+ pointerEvents: "none",
3695
+ zIndex: 2147483646
3696
+ }
3697
+ }
3698
+ );
3699
+ }
3700
+ function calcToolbarPos(rect, parentScroll) {
3701
+ const GAP = 8;
3702
+ const APPROX_H = 36;
3703
+ const APPROX_W = 330;
3704
+ const canvasTopInIframe = parentScroll != null ? parentScroll.headerH - parentScroll.iframeOffsetTop : 0;
3705
+ const visibleTop = rect.top - canvasTopInIframe;
3706
+ const visibleBottom = rect.bottom - canvasTopInIframe;
3707
+ const isTall = rect.height > APPROX_H + GAP;
3708
+ let top;
3709
+ let transform;
3710
+ if (visibleTop > 0 || !isTall) {
3711
+ top = rect.top - GAP;
3712
+ transform = "translateX(-50%) translateY(-100%)";
3713
+ } else if (visibleBottom > APPROX_H + GAP) {
3714
+ top = canvasTopInIframe + GAP;
3715
+ transform = "translateX(-50%)";
3716
+ } else {
3717
+ top = rect.bottom + GAP;
3718
+ transform = "translateX(-50%)";
3719
+ }
3720
+ const rawLeft = rect.left + rect.width / 2;
3721
+ const left = Math.max(GAP + APPROX_W / 2, Math.min(rawLeft, window.innerWidth - GAP - APPROX_W / 2));
3722
+ return { top, left, transform };
3723
+ }
3724
+ function FloatingToolbar({
3725
+ rect,
3726
+ parentScroll,
3727
+ elRef,
3728
+ onCommand,
3729
+ activeCommands
3730
+ }) {
3731
+ const { top, left, transform } = calcToolbarPos(rect, parentScroll);
3732
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3733
+ "div",
3734
+ {
3735
+ ref: elRef,
3736
+ "data-ohw-toolbar": "",
3737
+ style: {
3738
+ position: "fixed",
3739
+ top,
3740
+ left,
3741
+ transform,
3742
+ zIndex: 2147483647,
3743
+ background: "#fff",
3744
+ border: "1px solid #E7E5E4",
3745
+ borderRadius: 6,
3746
+ boxShadow: "0px 2px 4px -2px rgba(0,0,0,.1),0px 4px 6px -1px rgba(0,0,0,.1)",
3747
+ display: "flex",
3748
+ alignItems: "center",
3749
+ padding: 4,
3750
+ gap: 6,
3751
+ fontFamily: "sans-serif",
3752
+ pointerEvents: "auto",
3753
+ whiteSpace: "nowrap"
3754
+ },
3755
+ children: TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react.default.Fragment, { children: [
3756
+ gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { display: "block", width: 1, height: 24, background: "#E7E5E4", flexShrink: 0 } }),
3757
+ btns.map((btn) => {
3758
+ const isActive = activeCommands.has(btn.cmd);
3759
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3760
+ "button",
3761
+ {
3762
+ title: btn.title,
3763
+ onMouseDown: (e) => {
3764
+ e.preventDefault();
3765
+ onCommand(btn.cmd);
3766
+ },
3767
+ onMouseEnter: (e) => {
3768
+ if (!isActive) e.currentTarget.style.background = "#F5F5F4";
3769
+ },
3770
+ onMouseLeave: (e) => {
3771
+ if (!isActive) e.currentTarget.style.background = "transparent";
3772
+ },
3773
+ style: {
3774
+ display: "flex",
3775
+ alignItems: "center",
3776
+ justifyContent: "center",
3777
+ border: "none",
3778
+ background: isActive ? PRIMARY : "transparent",
3779
+ borderRadius: 4,
3780
+ cursor: "pointer",
3781
+ color: isActive ? "#FFFFFF" : "#1C1917",
3782
+ flexShrink: 0,
3783
+ padding: 6
3784
+ },
3785
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3786
+ "svg",
3787
+ {
3788
+ width: "16",
3789
+ height: "16",
3790
+ viewBox: "0 0 24 24",
3791
+ fill: "none",
3792
+ stroke: isActive ? "#FFFFFF" : "#1C1917",
3793
+ strokeWidth: "2.5",
3794
+ strokeLinecap: "round",
3795
+ strokeLinejoin: "round",
3796
+ style: isActive && gi > 0 ? { filter: "drop-shadow(0 0 0.5px #fff)" } : void 0,
3797
+ dangerouslySetInnerHTML: { __html: ICONS[btn.cmd] }
3798
+ }
3799
+ )
3800
+ },
3801
+ btn.cmd
3802
+ );
3803
+ })
3804
+ ] }, gi))
3805
+ }
3806
+ );
3807
+ }
3808
+ function deriveStates(attr) {
3809
+ if (!attr) return [];
3810
+ return ["Default", ...attr.split(",").map((s) => s.trim().charAt(0).toUpperCase() + s.trim().slice(1))];
3811
+ }
3812
+ function StateToggle({
3813
+ rect,
3814
+ activeState,
3815
+ states,
3816
+ onStateChange
3817
+ }) {
3818
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3819
+ ToggleGroup,
3820
+ {
3821
+ "data-ohw-state-toggle": "",
3822
+ "data-ohw-bridge": "",
3823
+ value: activeState,
3824
+ onValueChange: onStateChange,
3825
+ onMouseDown: (e) => e.preventDefault(),
3826
+ className: "fixed z-2147483647 pointer-events-auto shadow-popover",
3827
+ style: {
3828
+ top: rect.top + 8,
3829
+ left: rect.right - 8,
3830
+ transform: "translateX(-100%)"
3831
+ },
3832
+ children: states.map((state) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ToggleGroupItem, { value: state, children: state }, state))
3833
+ }
3834
+ );
3835
+ }
3836
+ var contentCache = /* @__PURE__ */ new Map();
3837
+ function OhhwellsBridge() {
3838
+ const pathname = (0, import_navigation.usePathname)();
3839
+ const router = (0, import_navigation.useRouter)();
3840
+ const searchParams = (0, import_navigation.useSearchParams)();
3841
+ const isEditMode = isEditSessionActive();
3842
+ (0, import_react.useEffect)(() => {
3843
+ if (!isEditMode) return;
3844
+ const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
3845
+ const preconnect2 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.gstatic.com", crossOrigin: "" });
3846
+ const stylesheet = Object.assign(document.createElement("link"), { rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Figtree:ital,wght@0,300..900;1,300..900&display=swap" });
3847
+ document.head.append(preconnect1, preconnect2, stylesheet);
3848
+ return () => {
3849
+ preconnect1.remove();
3850
+ preconnect2.remove();
3851
+ stylesheet.remove();
3852
+ };
3853
+ }, [isEditMode]);
3854
+ const [bridgeRoot, setBridgeRoot] = (0, import_react.useState)(null);
3855
+ (0, import_react.useEffect)(() => {
3856
+ const el = document.createElement("div");
3857
+ el.setAttribute("data-ohw-bridge-root", "");
3858
+ el.setAttribute("data-ohw-bridge", "");
3859
+ el.className = "font-sans";
3860
+ document.body.appendChild(el);
3861
+ setBridgeRoot(el);
3862
+ return () => {
3863
+ el.remove();
3864
+ };
3865
+ }, []);
3866
+ const subdomainFromQuery = searchParams.get("subdomain");
3867
+ const subdomain = subdomainFromQuery ?? (() => {
3868
+ if (typeof window === "undefined") return "";
3869
+ const parts = window.location.hostname.split(".");
3870
+ return parts.length >= 3 && parts[0] !== "www" ? parts[0] : "";
3871
+ })();
3872
+ const postToParent = (0, import_react.useCallback)((data) => {
3873
+ if (typeof window !== "undefined" && window.parent !== window) {
3874
+ window.parent.postMessage(data, "*");
3875
+ }
3876
+ }, []);
3877
+ const [fetchState, setFetchState] = (0, import_react.useState)("idle");
3878
+ const autoSaveTimers = (0, import_react.useRef)(/* @__PURE__ */ new Map());
3879
+ const activeElRef = (0, import_react.useRef)(null);
3880
+ const originalContentRef = (0, import_react.useRef)(null);
3881
+ const activeStateElRef = (0, import_react.useRef)(null);
3882
+ const parentScrollRef = (0, import_react.useRef)(null);
3883
+ const toolbarElRef = (0, import_react.useRef)(null);
3884
+ const glowElRef = (0, import_react.useRef)(null);
3885
+ const hoveredImageRef = (0, import_react.useRef)(null);
3886
+ const editStylesRef = (0, import_react.useRef)(null);
3887
+ const activateRef = (0, import_react.useRef)(() => {
3888
+ });
3889
+ const deactivateRef = (0, import_react.useRef)(() => {
3890
+ });
3891
+ const refreshActiveCommandsRef = (0, import_react.useRef)(() => {
3892
+ });
3893
+ const postToParentRef = (0, import_react.useRef)(postToParent);
3894
+ postToParentRef.current = postToParent;
3895
+ const [toolbarRect, setToolbarRect] = (0, import_react.useState)(null);
3896
+ const [toggleState, setToggleState] = (0, import_react.useState)(null);
3897
+ const [maxBadge, setMaxBadge] = (0, import_react.useState)(null);
3898
+ const [activeCommands, setActiveCommands] = (0, import_react.useState)(/* @__PURE__ */ new Set());
3899
+ (0, import_react.useEffect)(() => {
3900
+ const update = () => {
3901
+ const el = activeElRef.current;
3902
+ if (el) setToolbarRect(el.getBoundingClientRect());
3903
+ setToggleState((prev) => {
3904
+ if (!prev || !activeStateElRef.current) return prev;
3905
+ return { ...prev, rect: activeStateElRef.current.getBoundingClientRect() };
3906
+ });
3907
+ };
3908
+ const vvp = window.visualViewport;
3909
+ if (!vvp) return;
3910
+ vvp.addEventListener("scroll", update);
3911
+ vvp.addEventListener("resize", update);
3912
+ return () => {
3913
+ vvp.removeEventListener("scroll", update);
3914
+ vvp.removeEventListener("resize", update);
3915
+ };
3916
+ }, []);
3917
+ const refreshStateRules = (0, import_react.useCallback)(() => {
3918
+ editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
3919
+ }, []);
3920
+ const deactivate = (0, import_react.useCallback)(() => {
3921
+ const el = activeElRef.current;
3922
+ if (!el) return;
3923
+ el.removeAttribute("contenteditable");
3924
+ activeElRef.current = null;
3925
+ setToolbarRect(null);
3926
+ setMaxBadge(null);
3927
+ setActiveCommands(/* @__PURE__ */ new Set());
3928
+ postToParent({ type: "ow:exit-edit" });
3929
+ }, [postToParent]);
3930
+ const activate = (0, import_react.useCallback)((el) => {
3931
+ if (activeElRef.current === el) return;
3932
+ deactivate();
3933
+ el.setAttribute("contenteditable", "true");
3934
+ el.removeAttribute("data-ohw-hovered");
3935
+ activeElRef.current = el;
3936
+ originalContentRef.current = el.innerHTML;
3937
+ el.focus();
3938
+ setToolbarRect(el.getBoundingClientRect());
3939
+ postToParent({ type: "ow:enter-edit", key: el.dataset.ohwKey });
3940
+ requestAnimationFrame(() => refreshActiveCommandsRef.current());
3941
+ }, [deactivate, postToParent]);
3942
+ activateRef.current = activate;
3943
+ deactivateRef.current = deactivate;
3944
+ (0, import_react.useLayoutEffect)(() => {
3945
+ if (!subdomain || isEditMode) {
3946
+ setFetchState("done");
3947
+ return;
3948
+ }
3949
+ const applyContent = (content) => {
3950
+ const imageLoads = [];
3951
+ for (const [key, val] of Object.entries(content)) {
3952
+ document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
3953
+ if (el.dataset.ohwEditable === "image") {
3954
+ const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
3955
+ if (img && img.src !== val) {
3956
+ img.src = val;
3957
+ imageLoads.push(new Promise((resolve) => {
3958
+ img.onload = () => resolve();
3959
+ img.onerror = () => resolve();
3960
+ }));
3961
+ }
3962
+ } else if (el.dataset.ohwEditable === "bg-image") {
3963
+ const next = `url('${val}')`;
3964
+ if (el.style.backgroundImage !== next) el.style.backgroundImage = next;
3965
+ } else if (el.innerHTML !== val) {
3966
+ el.innerHTML = val;
3967
+ }
3968
+ });
3969
+ }
3970
+ return imageLoads.length > 0 ? Promise.all(imageLoads).then(() => {
3971
+ }) : Promise.resolve();
3972
+ };
3973
+ const cached = contentCache.get(subdomain);
3974
+ if (cached) {
3975
+ applyContent(cached).finally(() => setFetchState("done"));
3976
+ return;
3977
+ }
3978
+ let cancelled = false;
3979
+ setFetchState("loading");
3980
+ const apiUrl = globalThis.process?.env?.NEXT_PUBLIC_FLOWOPS_API_URL ?? "http://localhost:4005";
3981
+ fetch(`${apiUrl}/api/public/sites/${subdomain}/content`, { cache: "no-store" }).then((r2) => r2.ok ? r2.json() : null).then((data) => {
3982
+ if (cancelled) return;
3983
+ const content = data?.content ?? {};
3984
+ contentCache.set(subdomain, content);
3985
+ return applyContent(content);
3986
+ }).catch(() => {
3987
+ }).finally(() => {
3988
+ if (!cancelled) setFetchState("done");
3989
+ });
3990
+ return () => {
3991
+ cancelled = true;
3992
+ };
3993
+ }, [subdomain, isEditMode, pathname]);
3994
+ (0, import_react.useEffect)(() => {
3995
+ if (!subdomain || isEditMode) return;
3996
+ const applyFromCache = () => {
3997
+ const content = contentCache.get(subdomain);
3998
+ if (!content) return;
3999
+ for (const [key, val] of Object.entries(content)) {
4000
+ document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
4001
+ if (el.dataset.ohwEditable === "image") {
4002
+ const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
4003
+ if (img && img.src !== val) img.src = val;
4004
+ } else if (el.dataset.ohwEditable === "bg-image") {
4005
+ const next = `url('${val}')`;
4006
+ if (el.style.backgroundImage !== next) el.style.backgroundImage = next;
4007
+ } else if (el.innerHTML !== val) {
4008
+ el.innerHTML = val;
4009
+ }
4010
+ });
4011
+ }
4012
+ };
4013
+ applyFromCache();
4014
+ const observer = new MutationObserver(applyFromCache);
4015
+ observer.observe(document.body, { childList: true, subtree: true });
4016
+ return () => observer.disconnect();
4017
+ }, [subdomain, isEditMode]);
4018
+ (0, import_react.useLayoutEffect)(() => {
4019
+ const el = document.getElementById("ohw-loader");
4020
+ if (!el) return;
4021
+ const visible = Boolean(subdomain) && fetchState !== "done";
4022
+ el.style.display = visible ? "flex" : "none";
4023
+ }, [subdomain, fetchState]);
4024
+ (0, import_react.useEffect)(() => {
4025
+ postToParent({ type: "ow:navigation", path: pathname });
4026
+ }, [pathname, postToParent]);
4027
+ (0, import_react.useEffect)(() => {
4028
+ if (!isEditMode) return;
4029
+ const measure = () => {
4030
+ const h = document.body.scrollHeight;
4031
+ if (h > 50) postToParent({ type: "ow:height", height: h });
4032
+ };
4033
+ const t1 = setTimeout(measure, 50);
4034
+ const t2 = setTimeout(measure, 500);
4035
+ let lastWidth = window.innerWidth;
4036
+ let resizeTimer = null;
4037
+ const handleResize = () => {
4038
+ if (window.innerWidth === lastWidth) return;
4039
+ lastWidth = window.innerWidth;
4040
+ if (resizeTimer) clearTimeout(resizeTimer);
4041
+ resizeTimer = setTimeout(measure, 150);
4042
+ };
4043
+ window.addEventListener("resize", handleResize);
4044
+ return () => {
4045
+ clearTimeout(t1);
4046
+ clearTimeout(t2);
4047
+ if (resizeTimer) clearTimeout(resizeTimer);
4048
+ window.removeEventListener("resize", handleResize);
4049
+ };
4050
+ }, [pathname, isEditMode, postToParent]);
4051
+ (0, import_react.useEffect)(() => {
4052
+ if (!subdomainFromQuery || isEditMode) return;
4053
+ const handleClick = (e) => {
4054
+ const anchor = e.target.closest("a");
4055
+ if (!anchor || anchor.target === "_blank" || e.defaultPrevented) return;
4056
+ const href = anchor.getAttribute("href");
4057
+ if (!href || /^(https?:|mailto:|tel:|#)/.test(href)) return;
4058
+ const url = new URL(href, window.location.origin);
4059
+ if (url.searchParams.has("subdomain")) return;
4060
+ e.preventDefault();
4061
+ url.searchParams.set("subdomain", subdomainFromQuery);
4062
+ router.push(url.pathname + url.search);
4063
+ };
4064
+ document.addEventListener("click", handleClick, true);
4065
+ return () => document.removeEventListener("click", handleClick, true);
4066
+ }, [subdomainFromQuery, isEditMode, router]);
4067
+ (0, import_react.useEffect)(() => {
4068
+ if (!isEditMode) {
4069
+ editStylesRef.current?.base.remove();
4070
+ editStylesRef.current?.forceHover.remove();
4071
+ editStylesRef.current?.stateViews.remove();
4072
+ editStylesRef.current = null;
4073
+ return;
4074
+ }
4075
+ if (!editStylesRef.current) {
4076
+ const initialVh = window.innerHeight;
4077
+ const base = document.createElement("style");
4078
+ base.setAttribute("data-ohw-edit-style", "");
4079
+ base.textContent = `
4080
+ html { height: auto !important; }
4081
+ body { height: auto !important; min-height: 0 !important; overflow: hidden !important; }
4082
+ .min-h-screen, .min-h-svh, .min-h-dvh { min-height: ${initialVh}px !important; }
4083
+ .h-screen, .h-svh, .h-dvh { height: ${initialVh}px !important; }
4084
+ [style*="100vh"] { min-height: ${initialVh}px !important; height: ${initialVh}px !important; }
4085
+ [style*="100svh"] { min-height: ${initialVh}px !important; height: ${initialVh}px !important; }
4086
+ [style*="100dvh"] { min-height: ${initialVh}px !important; height: ${initialVh}px !important; }
4087
+ [data-ohw-editable] {
4088
+ display: block;
4089
+ }
4090
+ [data-ohw-editable]:not([contenteditable]):not([data-ohw-editable="image"]):not([data-ohw-editable="bg-image"]) { cursor: text !important; }
4091
+ [data-ohw-editable="image"], [data-ohw-editable="image"] *,
4092
+ [data-ohw-editable="bg-image"], [data-ohw-editable="bg-image"] * { cursor: pointer !important; }
4093
+ [data-ohw-hovered]:not([contenteditable]) {
4094
+ outline: 2px dashed ${PRIMARY} !important;
4095
+ outline-offset: 4px;
4096
+ border-radius: 2px;
4097
+ }
4098
+ [data-ohw-editable][contenteditable] {
4099
+ outline: none !important;
4100
+ caret-color: ${PRIMARY};
4101
+ cursor: text !important;
4102
+ }
4103
+ [data-ohw-editable][contenteditable]::selection,
4104
+ [data-ohw-editable][contenteditable] *::selection { background: ${PRIMARY}59 !important; }
4105
+ [data-ohw-editable-state], [data-ohw-editable-state] * { pointer-events: none !important; }
4106
+ [data-ohw-editable-state][data-ohw-active-state] [data-ohw-editable] { pointer-events: auto !important; }
4107
+ `;
4108
+ const forceHover = document.createElement("style");
4109
+ forceHover.setAttribute("data-ohw-active-state-style", "");
4110
+ const stateViews = document.createElement("style");
4111
+ stateViews.setAttribute("data-ohw-state-views-style", "");
4112
+ stateViews.textContent = `
4113
+ [data-ohw-state-view]:not([data-ohw-state-view="default"]) { display: none; }
4114
+ [data-ohw-state-view="default"] [data-ohw-editable] { pointer-events: auto !important; }
4115
+ [data-ohw-state-hovered] { outline: 2px dashed ${PRIMARY} !important; outline-offset: 4px; border-radius: 2px; }
4116
+ [data-ohw-state-hovered]:has([data-ohw-hovered]) { outline: none !important; }
4117
+ `;
4118
+ document.head.appendChild(base);
4119
+ document.head.appendChild(forceHover);
4120
+ document.head.appendChild(stateViews);
4121
+ editStylesRef.current = { base, forceHover, stateViews };
4122
+ }
4123
+ refreshStateRules();
4124
+ const handleClick = (e) => {
4125
+ const target = e.target;
4126
+ if (target.closest("[data-ohw-toolbar]")) return;
4127
+ if (target.closest("[data-ohw-state-toggle]")) return;
4128
+ if (target.closest("[data-ohw-max-badge]")) return;
4129
+ const editable = target.closest("[data-ohw-editable]");
4130
+ if (editable) {
4131
+ if (editable.dataset.ohwEditable === "image" || editable.dataset.ohwEditable === "bg-image") {
4132
+ e.preventDefault();
4133
+ postToParentRef.current({ type: "ow:image-pick", key: editable.dataset.ohwKey ?? "" });
4134
+ return;
4135
+ }
4136
+ e.preventDefault();
4137
+ activateRef.current(editable);
4138
+ return;
4139
+ }
4140
+ if (activeElRef.current) {
4141
+ const sel = window.getSelection();
4142
+ if (sel && !sel.isCollapsed) {
4143
+ const range = sel.getRangeAt(0);
4144
+ if (activeElRef.current.contains(range.commonAncestorContainer)) return;
4145
+ }
4146
+ }
4147
+ const anchor = target.closest("a");
4148
+ if (anchor) e.preventDefault();
4149
+ deactivateRef.current();
4150
+ };
4151
+ const handleMouseOver = (e) => {
4152
+ const editable = e.target.closest("[data-ohw-editable]");
4153
+ if (!editable) return;
4154
+ if (editable.dataset.ohwEditable !== "image" && editable.dataset.ohwEditable !== "bg-image" && !editable.hasAttribute("contenteditable")) {
4155
+ editable.setAttribute("data-ohw-hovered", "");
4156
+ }
4157
+ };
4158
+ const handleMouseOut = (e) => {
4159
+ const editable = e.target.closest("[data-ohw-editable]");
4160
+ if (!editable) return;
4161
+ if (editable.dataset.ohwEditable !== "image" && editable.dataset.ohwEditable !== "bg-image") {
4162
+ editable.removeAttribute("data-ohw-hovered");
4163
+ }
4164
+ };
4165
+ const toProbeCoords = (clientX, clientY, fromParentViewport) => {
4166
+ if (!fromParentViewport) return { x: clientX, y: clientY };
4167
+ const frame = window.frameElement;
4168
+ if (!frame) return { x: clientX, y: clientY };
4169
+ const fr = frame.getBoundingClientRect();
4170
+ return {
4171
+ x: clientX - fr.left - frame.clientLeft,
4172
+ y: clientY - fr.top - frame.clientTop
4173
+ };
4174
+ };
4175
+ const uploadLockedTracks = /* @__PURE__ */ new Set();
4176
+ const resumeAnimTracks = () => {
4177
+ document.querySelectorAll("[data-ohw-hover-paused]").forEach((el) => {
4178
+ if (!uploadLockedTracks.has(el)) el.removeAttribute("data-ohw-hover-paused");
4179
+ });
4180
+ };
4181
+ const getVisibleRect = (el) => {
4182
+ const r2 = el.getBoundingClientRect();
4183
+ let top = r2.top, left = r2.left, bottom = r2.bottom, right = r2.right;
4184
+ let parent = el.parentElement;
4185
+ while (parent) {
4186
+ const style = getComputedStyle(parent);
4187
+ if (style.overflowY === "hidden" || style.overflowY === "clip" || style.overflowX === "hidden" || style.overflowX === "clip") {
4188
+ const pr = parent.getBoundingClientRect();
4189
+ top = Math.max(top, pr.top);
4190
+ bottom = Math.min(bottom, pr.bottom);
4191
+ left = Math.max(left, pr.left);
4192
+ right = Math.min(right, pr.right);
4193
+ }
4194
+ if (parent === document.documentElement) break;
4195
+ parent = parent.parentElement;
4196
+ }
4197
+ return { top, left, width: Math.max(0, right - left), height: Math.max(0, bottom - top) };
4198
+ };
4199
+ const postImageHover = (imgEl, isDragOver = false) => {
4200
+ const r2 = getVisibleRect(imgEl);
4201
+ postToParentRef.current({
4202
+ type: "ow:image-hover",
4203
+ key: imgEl.dataset.ohwKey ?? "",
4204
+ rect: { top: r2.top, left: r2.left, width: r2.width, height: r2.height },
4205
+ ...isDragOver ? { isDragOver: true } : {}
4206
+ });
4207
+ const track = imgEl.closest("[data-ohw-hover-pause]");
4208
+ if (track) track.setAttribute("data-ohw-hover-paused", "");
4209
+ };
4210
+ const findImageAtPoint = (clientX, clientY, fromParentViewport) => {
4211
+ const { x, y } = toProbeCoords(clientX, clientY, fromParentViewport);
4212
+ const images = Array.from(document.querySelectorAll('[data-ohw-editable="image"], [data-ohw-editable="bg-image"]'));
4213
+ const matches = [];
4214
+ for (let i = images.length - 1; i >= 0; i--) {
4215
+ const el = images[i];
4216
+ const ownerCard = el.closest("[data-ohw-editable-state]");
4217
+ if (ownerCard) {
4218
+ const inHoverState = ownerCard.getAttribute("data-ohw-active-state") === "hover";
4219
+ const elState = el.dataset.ohwState;
4220
+ if (el === ownerCard && inHoverState) continue;
4221
+ if (elState === "default" && inHoverState) continue;
4222
+ if (elState === "hover" && !inHoverState) continue;
4223
+ }
4224
+ const r2 = getVisibleRect(el);
4225
+ if (x >= r2.left && x <= r2.left + r2.width && y >= r2.top && y <= r2.top + r2.height) matches.push(el);
4226
+ }
4227
+ if (matches.length === 0) return null;
4228
+ const imageTypeMatches = matches.filter((el) => el.dataset.ohwEditable === "image");
4229
+ const candidatePool = imageTypeMatches.length > 0 ? imageTypeMatches : matches;
4230
+ const smallest = candidatePool.reduce((best, el) => {
4231
+ const br = getVisibleRect(best);
4232
+ const er = getVisibleRect(el);
4233
+ return er.width * er.height < br.width * br.height ? el : best;
4234
+ });
4235
+ const pinned = hoveredImageRef.current;
4236
+ if (pinned && candidatePool.includes(pinned)) {
4237
+ const pr = getVisibleRect(pinned);
4238
+ const stickyPad = 48;
4239
+ const withinPad = x >= pr.left - stickyPad && x <= pr.left + pr.width + stickyPad && y >= pr.top - stickyPad && y <= pr.top + pr.height + stickyPad;
4240
+ if (withinPad) {
4241
+ const yieldToSmaller = smallest !== pinned && candidatePool.includes(smallest) && (() => {
4242
+ const sr = getVisibleRect(smallest);
4243
+ const pr2 = getVisibleRect(pinned);
4244
+ return sr.width * sr.height < pr2.width * pr2.height;
4245
+ })();
4246
+ if (!yieldToSmaller) return pinned;
4247
+ }
4248
+ }
4249
+ return smallest;
4250
+ };
4251
+ const probeImageAt = (clientX, clientY, isDragOver = false, fromParentViewport = false, fromOverlay = false) => {
4252
+ const toggleEl = document.querySelector("[data-ohw-state-toggle]");
4253
+ if (toggleEl) {
4254
+ const { x, y } = toProbeCoords(clientX, clientY, fromParentViewport);
4255
+ const tr = toggleEl.getBoundingClientRect();
4256
+ if (x >= tr.left && x <= tr.right && y >= tr.top && y <= tr.bottom) {
4257
+ if (hoveredImageRef.current) {
4258
+ hoveredImageRef.current = null;
4259
+ resumeAnimTracks();
4260
+ postToParentRef.current({ type: "ow:image-unhover" });
4261
+ }
4262
+ return;
4263
+ }
4264
+ }
4265
+ const imgEl = findImageAtPoint(clientX, clientY, fromParentViewport);
4266
+ if (imgEl) {
4267
+ const { x, y } = toProbeCoords(clientX, clientY, fromParentViewport);
4268
+ const topEl = document.elementFromPoint(x, y);
4269
+ if (topEl?.closest("[data-ohw-toolbar]")) {
4270
+ if (hoveredImageRef.current) {
4271
+ hoveredImageRef.current = null;
4272
+ resumeAnimTracks();
4273
+ postToParentRef.current({ type: "ow:image-unhover" });
4274
+ }
4275
+ return;
4276
+ }
4277
+ const topEditable = topEl?.closest("[data-ohw-editable]");
4278
+ if (topEditable && topEditable.dataset.ohwEditable !== "image" && topEditable.dataset.ohwEditable !== "bg-image") {
4279
+ if (topEditable.hasAttribute("contenteditable") && fromOverlay) return;
4280
+ if (hoveredImageRef.current) {
4281
+ hoveredImageRef.current = null;
4282
+ resumeAnimTracks();
4283
+ postToParentRef.current({ type: "ow:image-unhover" });
4284
+ }
4285
+ document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
4286
+ topEditable.setAttribute("data-ohw-hovered", "");
4287
+ return;
4288
+ }
4289
+ const activeHovered = document.querySelector("[data-ohw-hovered]");
4290
+ if (activeHovered) {
4291
+ const outlinePad = 8;
4292
+ const hr = activeHovered.getBoundingClientRect();
4293
+ if (x >= hr.left - outlinePad && x <= hr.right + outlinePad && y >= hr.top - outlinePad && y <= hr.bottom + outlinePad) {
4294
+ if (hoveredImageRef.current) {
4295
+ hoveredImageRef.current = null;
4296
+ resumeAnimTracks();
4297
+ postToParentRef.current({ type: "ow:image-unhover" });
4298
+ }
4299
+ return;
4300
+ }
4301
+ }
4302
+ document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
4303
+ if (imgEl !== hoveredImageRef.current) {
4304
+ hoveredImageRef.current = imgEl;
4305
+ postImageHover(imgEl, isDragOver);
4306
+ } else if (isDragOver) {
4307
+ postImageHover(imgEl, true);
4308
+ }
4309
+ } else {
4310
+ const inIframeView = clientX >= 0 && clientY >= 0 && clientX <= window.innerWidth && clientY <= window.innerHeight;
4311
+ if (!inIframeView) return;
4312
+ hoveredImageRef.current = null;
4313
+ resumeAnimTracks();
4314
+ postToParentRef.current({ type: "ow:image-unhover" });
4315
+ }
4316
+ };
4317
+ const probeHoverCardsAt = (clientX, clientY, fromParentViewport = false) => {
4318
+ const { x, y } = toProbeCoords(clientX, clientY, fromParentViewport);
4319
+ const toggleEl = document.querySelector("[data-ohw-state-toggle]");
4320
+ if (toggleEl) {
4321
+ const tr = toggleEl.getBoundingClientRect();
4322
+ if (x >= tr.left && x <= tr.right && y >= tr.top && y <= tr.bottom) {
4323
+ return;
4324
+ }
4325
+ }
4326
+ const cards = Array.from(document.querySelectorAll("[data-ohw-editable-state]"));
4327
+ const found = cards.find((card) => {
4328
+ const r2 = card.getBoundingClientRect();
4329
+ return x >= r2.left && x <= r2.right && y >= r2.top && y <= r2.bottom;
4330
+ }) ?? null;
4331
+ const currentLocked = activeStateElRef.current?.hasAttribute("data-ohw-active-state") ? activeStateElRef.current : null;
4332
+ const active = found ?? currentLocked;
4333
+ activeStateElRef.current = active;
4334
+ document.querySelectorAll("[data-ohw-state-hovered]").forEach((el) => el.removeAttribute("data-ohw-state-hovered"));
4335
+ if (active) {
4336
+ if (active.querySelector("[data-ohw-state-view]")) active.setAttribute("data-ohw-state-hovered", "");
4337
+ const states = deriveStates(active.dataset.ohwEditableState ?? "");
4338
+ const activeState = active.hasAttribute("data-ohw-active-state") ? (active.getAttribute("data-ohw-active-state") ?? "Default").charAt(0).toUpperCase() + (active.getAttribute("data-ohw-active-state") ?? "").slice(1) : "Default";
4339
+ setToggleState({ rect: active.getBoundingClientRect(), activeState, states });
4340
+ } else {
4341
+ setToggleState(null);
4342
+ }
4343
+ };
4344
+ const handleMouseMove = (e) => {
4345
+ const { clientX, clientY } = e;
4346
+ probeImageAt(clientX, clientY);
4347
+ probeHoverCardsAt(clientX, clientY);
4348
+ };
4349
+ const handlePointerSync = (e) => {
4350
+ if (e.data?.type !== "ow:pointer-sync") return;
4351
+ const { clientX, clientY, fromOverlay } = e.data;
4352
+ if (typeof clientX !== "number" || typeof clientY !== "number") return;
4353
+ probeImageAt(clientX, clientY, false, false, fromOverlay ?? false);
4354
+ probeHoverCardsAt(clientX, clientY);
4355
+ };
4356
+ const handleDragOver = (e) => {
4357
+ e.preventDefault();
4358
+ const el = findImageAtPoint(e.clientX, e.clientY, false);
4359
+ if (!el) {
4360
+ if (e.dataTransfer) e.dataTransfer.dropEffect = "none";
4361
+ return;
4362
+ }
4363
+ e.dataTransfer.dropEffect = "copy";
4364
+ if (hoveredImageRef.current !== el) {
4365
+ hoveredImageRef.current = el;
4366
+ postImageHover(el, true);
4367
+ }
4368
+ };
4369
+ const handleDragLeave = (e) => {
4370
+ const imgEl = findImageAtPoint(e.clientX, e.clientY, false);
4371
+ if (imgEl) return;
4372
+ hoveredImageRef.current = null;
4373
+ resumeAnimTracks();
4374
+ postToParentRef.current({ type: "ow:image-unhover" });
4375
+ };
4376
+ const handleDrop = (e) => {
4377
+ e.preventDefault();
4378
+ const el = findImageAtPoint(e.clientX, e.clientY, false);
4379
+ if (!el) return;
4380
+ const file = e.dataTransfer?.files?.[0];
4381
+ if (file) {
4382
+ if (file.type.startsWith("image/")) {
4383
+ const key = el.dataset.ohwKey ?? "";
4384
+ const { name, type: mimeType } = file;
4385
+ const r2 = el.getBoundingClientRect();
4386
+ const rect = { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
4387
+ file.arrayBuffer().then((buf) => {
4388
+ window.parent.postMessage({ type: "ow:image-drop", key, name, mimeType, buf, rect }, "*", [buf]);
4389
+ });
4390
+ } else {
4391
+ postToParentRef.current({ type: "ow:image-drop-invalid" });
4392
+ }
4393
+ }
4394
+ hoveredImageRef.current = null;
4395
+ resumeAnimTracks();
4396
+ postToParentRef.current({ type: "ow:image-unhover" });
4397
+ };
4398
+ const handleImageUrl = (e) => {
4399
+ if (e.data?.type !== "ow:image-url") return;
4400
+ const { key, url } = e.data;
4401
+ let notified = false;
4402
+ const notify = () => {
4403
+ if (notified) return;
4404
+ notified = true;
4405
+ document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
4406
+ const track = el.closest("[data-ohw-hover-pause]");
4407
+ if (track) {
4408
+ uploadLockedTracks.delete(track);
4409
+ const stillHovered = hoveredImageRef.current && track.contains(hoveredImageRef.current);
4410
+ if (!stillHovered) track.removeAttribute("data-ohw-hover-paused");
4411
+ }
4412
+ });
4413
+ hoveredImageRef.current = null;
4414
+ postToParentRef.current({ type: "ow:image-loaded", key });
4415
+ };
4416
+ let found = false;
4417
+ document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
4418
+ const track = el.closest("[data-ohw-hover-pause]");
4419
+ if (track) {
4420
+ track.setAttribute("data-ohw-hover-paused", "");
4421
+ }
4422
+ if (el.dataset.ohwEditable === "bg-image") {
4423
+ found = true;
4424
+ const fadeTarget = el;
4425
+ const preload = new Image();
4426
+ preload.onload = () => fadeInBgImage(fadeTarget, url, notify);
4427
+ preload.onerror = () => {
4428
+ fadeTarget.style.backgroundImage = `url('${url}')`;
4429
+ notify();
4430
+ };
4431
+ preload.src = url;
4432
+ } else if (el.dataset.ohwEditable === "image") {
4433
+ const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
4434
+ if (img) {
4435
+ found = true;
4436
+ img.style.opacity = "0";
4437
+ const onReady = () => {
4438
+ img.onload = null;
4439
+ img.onerror = null;
4440
+ fadeInImageElement(img, notify);
4441
+ };
4442
+ img.onload = onReady;
4443
+ img.onerror = onReady;
4444
+ img.src = url;
4445
+ if (img.complete && img.naturalWidth > 0) {
4446
+ requestAnimationFrame(() => onReady());
4447
+ }
4448
+ }
4449
+ }
4450
+ });
4451
+ if (!found) notify();
4452
+ };
4453
+ const handlePaste = (e) => {
4454
+ const el = e.target.closest("[data-ohw-editable]");
4455
+ if (!el) return;
4456
+ e.preventDefault();
4457
+ const text = e.clipboardData?.getData("text/plain") ?? "";
4458
+ const maxLen = el.dataset.ohwMaxLength ? parseInt(el.dataset.ohwMaxLength, 10) : null;
4459
+ if (maxLen) {
4460
+ const current = el.innerText.replace(/\n$/, "").length;
4461
+ const remaining = Math.max(0, maxLen - current);
4462
+ document.execCommand("insertText", false, text.slice(0, remaining));
4463
+ } else {
4464
+ document.execCommand("insertText", false, text);
4465
+ }
4466
+ };
4467
+ const handleInput = (e) => {
4468
+ const el = e.target;
4469
+ const key = el.dataset.ohwKey;
4470
+ if (!key) return;
4471
+ if (el === activeElRef.current) setToolbarRect(el.getBoundingClientRect());
4472
+ const maxLen = el.dataset.ohwMaxLength ? parseInt(el.dataset.ohwMaxLength, 10) : null;
4473
+ if (maxLen) {
4474
+ const current = el.innerText.replace(/\n$/, "").length;
4475
+ if (current > maxLen) {
4476
+ const sel = window.getSelection();
4477
+ const range = sel?.getRangeAt(0);
4478
+ const offset = range?.startOffset ?? 0;
4479
+ el.innerText = el.innerText.replace(/\n$/, "").slice(0, maxLen);
4480
+ const textNode = el.firstChild;
4481
+ if (textNode && sel && range) {
4482
+ const newRange = document.createRange();
4483
+ newRange.setStart(textNode, Math.min(offset - (current - maxLen), maxLen));
4484
+ newRange.collapse(true);
4485
+ sel.removeAllRanges();
4486
+ sel.addRange(newRange);
4487
+ }
4488
+ }
4489
+ setMaxBadge({ rect: el.getBoundingClientRect(), current: Math.min(current, maxLen), max: maxLen });
4490
+ }
4491
+ const html = sanitizeHtml(el.innerHTML);
4492
+ document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((sibling) => {
4493
+ if (sibling !== el) sibling.innerHTML = html;
4494
+ });
4495
+ const timers = autoSaveTimers.current;
4496
+ const existing = timers.get(key);
4497
+ if (existing) clearTimeout(existing);
4498
+ timers.set(key, setTimeout(() => {
4499
+ timers.delete(key);
4500
+ postToParentRef.current({ type: "ow:change", nodes: [{ key, text: html }] });
4501
+ const h = document.documentElement.scrollHeight;
4502
+ if (h > 50) postToParentRef.current({ type: "ow:height", height: h });
4503
+ }, 400));
4504
+ };
4505
+ const handleHydrate = (e) => {
4506
+ if (e.data?.type !== "ow:hydrate") return;
4507
+ const content = e.data.content;
4508
+ if (!content) return;
4509
+ for (const [key, val] of Object.entries(content)) {
4510
+ document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
4511
+ if (el.dataset.ohwEditable === "image") {
4512
+ const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
4513
+ if (img) img.src = val;
4514
+ } else if (el.dataset.ohwEditable === "bg-image") {
4515
+ el.style.backgroundImage = `url('${val}')`;
4516
+ } else {
4517
+ el.innerHTML = val;
4518
+ }
4519
+ });
4520
+ }
4521
+ postToParentRef.current({ type: "ow:hydrate-done" });
4522
+ };
4523
+ window.addEventListener("message", handleHydrate);
4524
+ const handleDeactivate = (e) => {
4525
+ if (e.data?.type !== "ow:deactivate") return;
4526
+ deactivateRef.current();
4527
+ };
4528
+ window.addEventListener("message", handleDeactivate);
4529
+ const handleKeyDown = (e) => {
4530
+ if (e.key !== "Escape") return;
4531
+ const el = activeElRef.current;
4532
+ if (el && originalContentRef.current !== null) {
4533
+ el.innerHTML = originalContentRef.current;
4534
+ const key = el.dataset.ohwKey;
4535
+ if (key) {
4536
+ postToParentRef.current({ type: "ow:change", nodes: [{ key, text: originalContentRef.current }] });
4537
+ }
4538
+ }
4539
+ deactivateRef.current();
4540
+ };
4541
+ const handleScroll = () => {
4542
+ if (activeElRef.current) {
4543
+ const r2 = activeElRef.current.getBoundingClientRect();
4544
+ applyToolbarPos(r2);
4545
+ setMaxBadge((prev) => prev ? { ...prev, rect: r2 } : null);
4546
+ }
4547
+ if (activeStateElRef.current) {
4548
+ const rect = activeStateElRef.current.getBoundingClientRect();
4549
+ setToggleState((prev) => prev ? { ...prev, rect } : null);
4550
+ }
4551
+ if (hoveredImageRef.current) {
4552
+ const r2 = hoveredImageRef.current.getBoundingClientRect();
4553
+ postToParentRef.current({
4554
+ type: "ow:image-hover",
4555
+ key: hoveredImageRef.current.dataset.ohwKey ?? "",
4556
+ rect: { top: r2.top, left: r2.left, width: r2.width, height: r2.height }
4557
+ });
4558
+ }
4559
+ };
4560
+ const handleSave = (e) => {
4561
+ if (e.data?.type !== "ow:save") return;
4562
+ postToParentRef.current({ type: "ow:save-result", nodes: collectEditableNodes() });
4563
+ };
4564
+ const handleSelectionChange = () => {
4565
+ if (!activeElRef.current) return;
4566
+ const next = /* @__PURE__ */ new Set();
4567
+ for (const cmd of ["bold", "italic", "underline", "strikeThrough", "insertUnorderedList", "insertOrderedList"]) {
4568
+ try {
4569
+ if (document.queryCommandState(cmd)) next.add(cmd);
4570
+ } catch {
4571
+ }
4572
+ }
4573
+ const sel = window.getSelection();
4574
+ const anchor = sel?.anchorNode;
4575
+ if (anchor) {
4576
+ const el = anchor.nodeType === Node.TEXT_NODE ? anchor.parentElement : anchor;
4577
+ const block = el?.closest("div, p, h1, h2, h3, h4, h5, h6, li, td, th") ?? el;
4578
+ if (block) {
4579
+ const align = getComputedStyle(block).textAlign;
4580
+ if (align === "center") next.add("justifyCenter");
4581
+ else if (align === "right" || align === "end") next.add("justifyRight");
4582
+ else next.add("justifyLeft");
4583
+ }
4584
+ }
4585
+ setActiveCommands(next);
4586
+ };
4587
+ refreshActiveCommandsRef.current = handleSelectionChange;
4588
+ const handleDocMouseLeave = () => {
4589
+ hoveredImageRef.current = null;
4590
+ document.querySelectorAll("[data-ohw-state-hovered]").forEach((el) => el.removeAttribute("data-ohw-state-hovered"));
4591
+ document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
4592
+ activeStateElRef.current = null;
4593
+ setToggleState(null);
4594
+ };
4595
+ const handleAnimLock = (e) => {
4596
+ if (e.data?.type !== "ow:anim-lock") return;
4597
+ const { key } = e.data;
4598
+ document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
4599
+ const track = el.closest("[data-ohw-hover-pause]");
4600
+ if (track) {
4601
+ uploadLockedTracks.add(track);
4602
+ track.setAttribute("data-ohw-hover-paused", "");
4603
+ }
4604
+ });
4605
+ };
4606
+ const handleCanvasHeight = (e) => {
4607
+ if (e.data?.type !== "ow:canvas-height" || typeof e.data.height !== "number") return;
4608
+ document.documentElement.style.setProperty("--ohw-canvas-h", `${e.data.height}px`);
4609
+ };
4610
+ const applyToolbarPos = (rect) => {
4611
+ const ps = parentScrollRef.current;
4612
+ if (toolbarElRef.current) {
4613
+ const { top, left, transform } = calcToolbarPos(rect, ps);
4614
+ toolbarElRef.current.style.top = `${top}px`;
4615
+ toolbarElRef.current.style.left = `${left}px`;
4616
+ toolbarElRef.current.style.transform = transform;
4617
+ }
4618
+ if (glowElRef.current) {
4619
+ const GAP = 6;
4620
+ glowElRef.current.style.top = `${rect.top - GAP}px`;
4621
+ glowElRef.current.style.left = `${rect.left - GAP}px`;
4622
+ }
4623
+ };
4624
+ const handleParentScroll = (e) => {
4625
+ if (e.data?.type !== "ow:parent-scroll") return;
4626
+ const { iframeOffsetTop, headerH, canvasH } = e.data;
4627
+ parentScrollRef.current = { iframeOffsetTop, headerH, canvasH };
4628
+ if (activeElRef.current) applyToolbarPos(activeElRef.current.getBoundingClientRect());
4629
+ };
4630
+ window.addEventListener("message", handleSave);
4631
+ window.addEventListener("message", handleImageUrl);
4632
+ window.addEventListener("message", handleAnimLock);
4633
+ window.addEventListener("message", handleCanvasHeight);
4634
+ window.addEventListener("message", handleParentScroll);
4635
+ window.addEventListener("message", handlePointerSync);
4636
+ document.addEventListener("click", handleClick, true);
4637
+ document.addEventListener("paste", handlePaste, true);
4638
+ document.addEventListener("input", handleInput, true);
4639
+ document.addEventListener("mouseover", handleMouseOver, true);
4640
+ document.addEventListener("mouseout", handleMouseOut, true);
4641
+ document.addEventListener("mousemove", handleMouseMove, true);
4642
+ document.addEventListener("mouseleave", handleDocMouseLeave);
4643
+ document.addEventListener("dragover", handleDragOver, true);
4644
+ document.addEventListener("dragleave", handleDragLeave, true);
4645
+ document.addEventListener("drop", handleDrop, true);
4646
+ document.addEventListener("keydown", handleKeyDown);
4647
+ document.addEventListener("selectionchange", handleSelectionChange);
4648
+ window.addEventListener("scroll", handleScroll, true);
4649
+ return () => {
4650
+ document.removeEventListener("click", handleClick, true);
4651
+ document.removeEventListener("paste", handlePaste, true);
4652
+ document.removeEventListener("input", handleInput, true);
4653
+ document.removeEventListener("mouseover", handleMouseOver, true);
4654
+ document.removeEventListener("mouseout", handleMouseOut, true);
4655
+ document.removeEventListener("mousemove", handleMouseMove, true);
4656
+ document.removeEventListener("mouseleave", handleDocMouseLeave);
4657
+ document.removeEventListener("dragover", handleDragOver, true);
4658
+ document.removeEventListener("dragleave", handleDragLeave, true);
4659
+ document.removeEventListener("drop", handleDrop, true);
4660
+ document.removeEventListener("keydown", handleKeyDown);
4661
+ document.removeEventListener("selectionchange", handleSelectionChange);
4662
+ window.removeEventListener("scroll", handleScroll, true);
4663
+ window.removeEventListener("message", handleSave);
4664
+ window.removeEventListener("message", handleImageUrl);
4665
+ window.removeEventListener("message", handleAnimLock);
4666
+ window.removeEventListener("message", handleCanvasHeight);
4667
+ window.removeEventListener("message", handleParentScroll);
4668
+ window.removeEventListener("message", handlePointerSync);
4669
+ window.removeEventListener("message", handleHydrate);
4670
+ window.removeEventListener("message", handleDeactivate);
4671
+ autoSaveTimers.current.forEach(clearTimeout);
4672
+ autoSaveTimers.current.clear();
4673
+ };
4674
+ }, [isEditMode, refreshStateRules]);
4675
+ (0, import_react.useEffect)(() => {
4676
+ if (!isEditMode) return;
4677
+ document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
4678
+ el.removeAttribute("data-ohw-active-state");
4679
+ });
4680
+ resetStateViews();
4681
+ document.querySelectorAll("[data-ohw-editable-state]").forEach((el) => {
4682
+ if (el.querySelector("[data-ohw-state-view]")) applyStateViews(el, "default");
4683
+ });
4684
+ activeStateElRef.current = null;
4685
+ setToggleState(null);
4686
+ refreshStateRules();
4687
+ const raf = requestAnimationFrame(() => refreshStateRules());
4688
+ const timer = setTimeout(() => {
4689
+ refreshStateRules();
4690
+ postToParent({ type: "ow:ready", version: "1", nodes: collectEditableNodes() });
4691
+ }, 150);
4692
+ return () => {
4693
+ cancelAnimationFrame(raf);
4694
+ clearTimeout(timer);
4695
+ };
4696
+ }, [pathname, isEditMode, refreshStateRules, postToParent]);
4697
+ const handleCommand = (0, import_react.useCallback)((cmd) => {
4698
+ document.execCommand(cmd, false);
4699
+ activeElRef.current?.focus();
4700
+ if (activeElRef.current) setToolbarRect(activeElRef.current.getBoundingClientRect());
4701
+ refreshActiveCommandsRef.current();
4702
+ }, []);
4703
+ const handleStateChange = (0, import_react.useCallback)((state) => {
4704
+ if (!activeStateElRef.current) return;
4705
+ const el = activeStateElRef.current;
4706
+ if (state === "Default") {
4707
+ deactivate();
4708
+ el.removeAttribute("data-ohw-active-state");
4709
+ applyStateViews(el, "default");
4710
+ } else {
4711
+ el.setAttribute("data-ohw-active-state", state.toLowerCase());
4712
+ applyStateViews(el, state.toLowerCase());
4713
+ }
4714
+ setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
4715
+ }, [deactivate]);
4716
+ return bridgeRoot ? (0, import_react_dom.createPortal)(
4717
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
4718
+ toolbarRect && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
4719
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(GlowFrame, { rect: toolbarRect, elRef: glowElRef }),
4720
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FloatingToolbar, { rect: toolbarRect, parentScroll: parentScrollRef.current, elRef: toolbarElRef, onCommand: handleCommand, activeCommands })
4721
+ ] }),
4722
+ maxBadge && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4723
+ "div",
4724
+ {
4725
+ "data-ohw-max-badge": "",
4726
+ style: {
4727
+ position: "fixed",
4728
+ top: maxBadge.rect.bottom + 4,
4729
+ left: maxBadge.rect.right,
4730
+ transform: "translateX(-100%)",
4731
+ zIndex: 2147483647,
4732
+ background: maxBadge.current > maxBadge.max ? "#FEF2F2" : "#F5F5F4",
4733
+ color: maxBadge.current > maxBadge.max ? "#DC2626" : "#78716C",
4734
+ border: `1px solid ${maxBadge.current > maxBadge.max ? "#FECACA" : "#E7E5E4"}`,
4735
+ borderRadius: 4,
4736
+ padding: "2px 6px",
4737
+ fontSize: 11,
4738
+ fontWeight: 500,
4739
+ pointerEvents: "none"
4740
+ },
4741
+ children: [
4742
+ maxBadge.current,
4743
+ "/",
4744
+ maxBadge.max
4745
+ ]
4746
+ }
4747
+ ),
4748
+ toggleState && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4749
+ StateToggle,
4750
+ {
4751
+ rect: toggleState.rect,
4752
+ activeState: toggleState.activeState,
4753
+ states: toggleState.states,
4754
+ onStateChange: handleStateChange
4755
+ }
4756
+ )
4757
+ ] }),
4758
+ bridgeRoot
4759
+ ) : null;
4760
+ }
4761
+ // Annotate the CommonJS export names for ESM import in node:
4762
+ 0 && (module.exports = {
4763
+ OhhwellsBridge,
4764
+ Toggle,
4765
+ ToggleGroup,
4766
+ ToggleGroupItem,
4767
+ toggleVariants
4768
+ });
4769
+ //# sourceMappingURL=index.cjs.map