tailwind-zag 1.0.3 → 1.0.5

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 CHANGED
@@ -1,214 +1,498 @@
1
- 'use strict';
1
+ //#region rolldown:runtime
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 __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
2
26
 
3
- var plugin = require('tailwindcss/plugin.js');
27
+ //#endregion
28
+ let tailwindcss_plugin_js = require("tailwindcss/plugin.js");
29
+ tailwindcss_plugin_js = __toESM(tailwindcss_plugin_js);
4
30
 
5
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
-
7
- var plugin__default = /*#__PURE__*/_interopDefault(plugin);
8
-
9
- // src/index.ts
10
- var STATIC_VARIANT_ENTRIES = [
11
- { key: "hover", values: [null] },
12
- { key: "focus", values: [null] },
13
- { key: "focus-visible", values: [null] },
14
- { key: "focusable", values: [null] },
15
- { key: "active", values: [null] },
16
- { key: "valid", values: [null] },
17
- { key: "invalid", values: [null] },
18
- { key: "disabled", values: [null] },
19
- { key: "readonly", values: [null, "read-only"] },
20
- { key: "current", values: [null] },
21
- { key: "inview", values: [null] },
22
- { key: "copied", values: [null] },
23
- { key: "collapsible", values: [null] },
24
- { key: "highlighted", values: [null] },
25
- { key: "selected", values: [null] },
26
- { key: "placeholder", values: [null] },
27
- { key: "placeholder-shown", values: [null] },
28
- { key: "autoresize", values: [null] },
29
- { key: "required", values: [null] },
30
- { key: "grabbed", values: [null] },
31
- { key: "dragging", values: [null] },
32
- { key: "complete", values: [null] },
33
- { key: "incomplete", values: [null] },
34
- { key: "expanded", values: [null, 'state="expanded"'] },
35
- { key: "half", values: [null] },
36
- { key: "first", values: [null] },
37
- { key: "mounted", values: [null] },
38
- { key: "overlap", values: [null] },
39
- { key: "sibling", values: [null] },
40
- { key: "paused", values: [null] },
41
- { key: "pressed", values: [null] },
42
- { key: "on", values: ['state="on"'] },
43
- { key: "off", values: ['state="off"'] },
44
- { key: "open", values: ['state="open"'] },
45
- { key: "closed", values: ['state="closed"'] },
46
- { key: "hidden", values: [null, 'state="hidden"'] },
47
- { key: "visible", values: [null, 'state="visible"'] },
48
- { key: "checked", values: [null, 'state="checked"'] },
49
- { key: "unchecked", values: [null, 'state="unchecked"'] },
50
- { key: "indeterminate", values: [null, 'state="indeterminate"'] },
51
- { key: "vertical", values: ['orientation="vertical"'] },
52
- { key: "horizontal", values: ['orientation="horizontal"'] },
53
- { key: "placement-top", values: ['placement="top"'] },
54
- { key: "placement-top-end", values: ['placement="top-end"'] },
55
- { key: "placement-top-start", values: ['placement="top-start"'] },
56
- { key: "placement-left", values: ['placement="left"'] },
57
- { key: "placement-left-end", values: ['placement="left-end"'] },
58
- { key: "placement-left-start", values: ['placement="left-start"'] },
59
- { key: "placement-right", values: ['placement="right"'] },
60
- { key: "placement-right-end", values: ['placement="right-end"'] },
61
- { key: "placement-right-start", values: ['placement="right-start"'] },
62
- { key: "placement-bottom", values: ['placement="bottom"'] },
63
- { key: "placement-bottom-end", values: ['placement="bottom-end"'] },
64
- { key: "placement-bottom-start", values: ['placement="bottom-start"'] },
65
- { key: "side-top", values: ['side="top"'] },
66
- { key: "side-left", values: ['side="left"'] },
67
- { key: "side-right", values: ['side="right"'] },
68
- { key: "side-bottom", values: ['side="bottom"'] },
69
- { key: "align-center", values: ['align="center"'] },
70
- { key: "align-start", values: ['align="start"'] },
71
- { key: "align-end", values: ['align="end"'] },
72
- { key: "now", values: [null] },
73
- { key: "today", values: [null] },
74
- { key: "weekend", values: [null] },
75
- { key: "in-range", values: [null] },
76
- { key: "out-of-range", values: ["outside-range"] },
77
- { key: "range-start", values: [null] },
78
- { key: "range-end", values: [null] },
79
- { key: "unavailable", values: [null] },
80
- { key: "topmost", values: [null] },
81
- { key: "view-day", values: ['view="day"'] },
82
- { key: "view-month", values: ['view="month"'] },
83
- { key: "view-year", values: ['view="year"'] },
84
- { key: "under-value", values: ['state="under-value"'] },
85
- { key: "over-value", values: ['state="over-value"'] },
86
- { key: "at-value", values: ['state="at-value"'] },
87
- { key: "delete-intent", values: [null] },
88
- { key: "unit-hour", values: ['unit="hour"'] },
89
- { key: "unit-minute", values: ['unit="minute"'] },
90
- { key: "unit-second", values: ['unit="second"'] },
91
- { key: "unit-period", values: ['unit="period"'] },
92
- { key: "channel-hue", values: ['channel="hue"'] },
93
- { key: "channel-saturation", values: ['channel="saturation"'] },
94
- { key: "channel-brightness", values: ['channel="brightness"'] },
95
- { key: "channel-lightness", values: ['channel="lightness"'] },
96
- { key: "channel-red", values: ['channel="red"'] },
97
- { key: "channel-green", values: ['channel="green"'] },
98
- { key: "channel-blue", values: ['channel="blue"'] },
99
- { key: "channel-alpha", values: ['channel="alpha"'] },
100
- { key: "channel-hex", values: ['channel="hex"'] },
101
- { key: "channel-css", values: ['channel="css"'] },
102
- { key: "tour-highlighted", values: [null] },
103
- { key: "scroll-lock", values: [null] },
104
- { key: "inert", values: [null] },
105
- { key: "empty", values: [null] },
106
- { key: "fullscreen", values: [null] },
107
- { key: "loading", values: [null] }
31
+ //#region src/index.ts
32
+ const STATIC_VARIANT_ENTRIES = [
33
+ {
34
+ key: "hover",
35
+ values: [null]
36
+ },
37
+ {
38
+ key: "focus",
39
+ values: [null]
40
+ },
41
+ {
42
+ key: "focus-visible",
43
+ values: [null]
44
+ },
45
+ {
46
+ key: "focusable",
47
+ values: [null]
48
+ },
49
+ {
50
+ key: "active",
51
+ values: [null]
52
+ },
53
+ {
54
+ key: "valid",
55
+ values: [null]
56
+ },
57
+ {
58
+ key: "invalid",
59
+ values: [null]
60
+ },
61
+ {
62
+ key: "disabled",
63
+ values: [null]
64
+ },
65
+ {
66
+ key: "readonly",
67
+ values: [null, "read-only"]
68
+ },
69
+ {
70
+ key: "current",
71
+ values: [null]
72
+ },
73
+ {
74
+ key: "inview",
75
+ values: [null]
76
+ },
77
+ {
78
+ key: "copied",
79
+ values: [null]
80
+ },
81
+ {
82
+ key: "collapsible",
83
+ values: [null]
84
+ },
85
+ {
86
+ key: "highlighted",
87
+ values: [null]
88
+ },
89
+ {
90
+ key: "selected",
91
+ values: [null]
92
+ },
93
+ {
94
+ key: "placeholder",
95
+ values: [null]
96
+ },
97
+ {
98
+ key: "placeholder-shown",
99
+ values: [null]
100
+ },
101
+ {
102
+ key: "autoresize",
103
+ values: [null]
104
+ },
105
+ {
106
+ key: "required",
107
+ values: [null]
108
+ },
109
+ {
110
+ key: "grabbed",
111
+ values: [null]
112
+ },
113
+ {
114
+ key: "dragging",
115
+ values: [null]
116
+ },
117
+ {
118
+ key: "complete",
119
+ values: [null]
120
+ },
121
+ {
122
+ key: "incomplete",
123
+ values: [null]
124
+ },
125
+ {
126
+ key: "expanded",
127
+ values: [null, "state=\"expanded\""]
128
+ },
129
+ {
130
+ key: "half",
131
+ values: [null]
132
+ },
133
+ {
134
+ key: "first",
135
+ values: [null]
136
+ },
137
+ {
138
+ key: "mounted",
139
+ values: [null]
140
+ },
141
+ {
142
+ key: "overlap",
143
+ values: [null]
144
+ },
145
+ {
146
+ key: "sibling",
147
+ values: [null]
148
+ },
149
+ {
150
+ key: "paused",
151
+ values: [null]
152
+ },
153
+ {
154
+ key: "pressed",
155
+ values: [null]
156
+ },
157
+ {
158
+ key: "on",
159
+ values: ["state=\"on\""]
160
+ },
161
+ {
162
+ key: "off",
163
+ values: ["state=\"off\""]
164
+ },
165
+ {
166
+ key: "open",
167
+ values: ["state=\"open\""]
168
+ },
169
+ {
170
+ key: "closed",
171
+ values: ["state=\"closed\""]
172
+ },
173
+ {
174
+ key: "hidden",
175
+ values: [null, "state=\"hidden\""]
176
+ },
177
+ {
178
+ key: "visible",
179
+ values: [null, "state=\"visible\""]
180
+ },
181
+ {
182
+ key: "checked",
183
+ values: [null, "state=\"checked\""]
184
+ },
185
+ {
186
+ key: "unchecked",
187
+ values: [null, "state=\"unchecked\""]
188
+ },
189
+ {
190
+ key: "indeterminate",
191
+ values: [null, "state=\"indeterminate\""]
192
+ },
193
+ {
194
+ key: "vertical",
195
+ values: ["orientation=\"vertical\""]
196
+ },
197
+ {
198
+ key: "horizontal",
199
+ values: ["orientation=\"horizontal\""]
200
+ },
201
+ {
202
+ key: "placement-top",
203
+ values: ["placement=\"top\""]
204
+ },
205
+ {
206
+ key: "placement-top-end",
207
+ values: ["placement=\"top-end\""]
208
+ },
209
+ {
210
+ key: "placement-top-start",
211
+ values: ["placement=\"top-start\""]
212
+ },
213
+ {
214
+ key: "placement-left",
215
+ values: ["placement=\"left\""]
216
+ },
217
+ {
218
+ key: "placement-left-end",
219
+ values: ["placement=\"left-end\""]
220
+ },
221
+ {
222
+ key: "placement-left-start",
223
+ values: ["placement=\"left-start\""]
224
+ },
225
+ {
226
+ key: "placement-right",
227
+ values: ["placement=\"right\""]
228
+ },
229
+ {
230
+ key: "placement-right-end",
231
+ values: ["placement=\"right-end\""]
232
+ },
233
+ {
234
+ key: "placement-right-start",
235
+ values: ["placement=\"right-start\""]
236
+ },
237
+ {
238
+ key: "placement-bottom",
239
+ values: ["placement=\"bottom\""]
240
+ },
241
+ {
242
+ key: "placement-bottom-end",
243
+ values: ["placement=\"bottom-end\""]
244
+ },
245
+ {
246
+ key: "placement-bottom-start",
247
+ values: ["placement=\"bottom-start\""]
248
+ },
249
+ {
250
+ key: "side-top",
251
+ values: ["side=\"top\""]
252
+ },
253
+ {
254
+ key: "side-left",
255
+ values: ["side=\"left\""]
256
+ },
257
+ {
258
+ key: "side-right",
259
+ values: ["side=\"right\""]
260
+ },
261
+ {
262
+ key: "side-bottom",
263
+ values: ["side=\"bottom\""]
264
+ },
265
+ {
266
+ key: "align-center",
267
+ values: ["align=\"center\""]
268
+ },
269
+ {
270
+ key: "align-start",
271
+ values: ["align=\"start\""]
272
+ },
273
+ {
274
+ key: "align-end",
275
+ values: ["align=\"end\""]
276
+ },
277
+ {
278
+ key: "now",
279
+ values: [null]
280
+ },
281
+ {
282
+ key: "today",
283
+ values: [null]
284
+ },
285
+ {
286
+ key: "weekend",
287
+ values: [null]
288
+ },
289
+ {
290
+ key: "in-range",
291
+ values: [null]
292
+ },
293
+ {
294
+ key: "out-of-range",
295
+ values: ["outside-range"]
296
+ },
297
+ {
298
+ key: "range-start",
299
+ values: [null]
300
+ },
301
+ {
302
+ key: "range-end",
303
+ values: [null]
304
+ },
305
+ {
306
+ key: "unavailable",
307
+ values: [null]
308
+ },
309
+ {
310
+ key: "topmost",
311
+ values: [null]
312
+ },
313
+ {
314
+ key: "view-day",
315
+ values: ["view=\"day\""]
316
+ },
317
+ {
318
+ key: "view-month",
319
+ values: ["view=\"month\""]
320
+ },
321
+ {
322
+ key: "view-year",
323
+ values: ["view=\"year\""]
324
+ },
325
+ {
326
+ key: "under-value",
327
+ values: ["state=\"under-value\""]
328
+ },
329
+ {
330
+ key: "over-value",
331
+ values: ["state=\"over-value\""]
332
+ },
333
+ {
334
+ key: "at-value",
335
+ values: ["state=\"at-value\""]
336
+ },
337
+ {
338
+ key: "delete-intent",
339
+ values: [null]
340
+ },
341
+ {
342
+ key: "unit-hour",
343
+ values: ["unit=\"hour\""]
344
+ },
345
+ {
346
+ key: "unit-minute",
347
+ values: ["unit=\"minute\""]
348
+ },
349
+ {
350
+ key: "unit-second",
351
+ values: ["unit=\"second\""]
352
+ },
353
+ {
354
+ key: "unit-period",
355
+ values: ["unit=\"period\""]
356
+ },
357
+ {
358
+ key: "channel-hue",
359
+ values: ["channel=\"hue\""]
360
+ },
361
+ {
362
+ key: "channel-saturation",
363
+ values: ["channel=\"saturation\""]
364
+ },
365
+ {
366
+ key: "channel-brightness",
367
+ values: ["channel=\"brightness\""]
368
+ },
369
+ {
370
+ key: "channel-lightness",
371
+ values: ["channel=\"lightness\""]
372
+ },
373
+ {
374
+ key: "channel-red",
375
+ values: ["channel=\"red\""]
376
+ },
377
+ {
378
+ key: "channel-green",
379
+ values: ["channel=\"green\""]
380
+ },
381
+ {
382
+ key: "channel-blue",
383
+ values: ["channel=\"blue\""]
384
+ },
385
+ {
386
+ key: "channel-alpha",
387
+ values: ["channel=\"alpha\""]
388
+ },
389
+ {
390
+ key: "channel-hex",
391
+ values: ["channel=\"hex\""]
392
+ },
393
+ {
394
+ key: "channel-css",
395
+ values: ["channel=\"css\""]
396
+ },
397
+ {
398
+ key: "tour-highlighted",
399
+ values: [null]
400
+ },
401
+ {
402
+ key: "scroll-lock",
403
+ values: [null]
404
+ },
405
+ {
406
+ key: "inert",
407
+ values: [null]
408
+ },
409
+ {
410
+ key: "empty",
411
+ values: [null]
412
+ },
413
+ {
414
+ key: "fullscreen",
415
+ values: [null]
416
+ },
417
+ {
418
+ key: "loading",
419
+ values: [null]
420
+ },
421
+ {
422
+ key: "loaded",
423
+ values: [null]
424
+ }
108
425
  ];
109
- var DEFAULT_DYNAMIC_VARIANT_ENTRY_KNOWN_INT_VALUES = Array.from({
110
- length: 10
111
- }).reduce((o, _v, i) => {
112
- o[i] = i.toString();
113
- return o;
426
+ const DEFAULT_DYNAMIC_VARIANT_ENTRY_KNOWN_INT_VALUES = Array.from({ length: 10 }).reduce((o, _v, i) => {
427
+ o[i] = i.toString();
428
+ return o;
114
429
  }, {});
115
430
  function isInt(subject) {
116
- return !Number.isNaN(Number.parseInt(subject));
431
+ return !Number.isNaN(Number.parseInt(subject, 36));
117
432
  }
118
- var DYNAMIC_VARIANT_ENTRIES = [
119
- { key: "scope" },
120
- { key: "part" },
121
- { key: "value" },
122
- { key: "valuetext" },
123
- {
124
- key: "index",
125
- validate: isInt,
126
- knownValues: DEFAULT_DYNAMIC_VARIANT_ENTRY_KNOWN_INT_VALUES
127
- },
128
- {
129
- key: "columns",
130
- validate: isInt,
131
- knownValues: DEFAULT_DYNAMIC_VARIANT_ENTRY_KNOWN_INT_VALUES
132
- },
133
- { key: "branch" },
134
- {
135
- key: "depth",
136
- validate: isInt,
137
- knownValues: DEFAULT_DYNAMIC_VARIANT_ENTRY_KNOWN_INT_VALUES
138
- },
139
- {
140
- key: "path",
141
- validate: isInt,
142
- knownValues: DEFAULT_DYNAMIC_VARIANT_ENTRY_KNOWN_INT_VALUES
143
- },
144
- {
145
- key: "type",
146
- knownValues: {
147
- /* toast */
148
- info: "info",
149
- error: "error",
150
- warning: "warning",
151
- success: "success",
152
- loading: "loading",
153
- /* tour */
154
- floating: "floating",
155
- tooltip: "tooltip",
156
- dialog: "dialog",
157
- wait: "wait"
158
- }
159
- }
433
+ const DYNAMIC_VARIANT_ENTRIES = [
434
+ { key: "scope" },
435
+ { key: "part" },
436
+ { key: "value" },
437
+ { key: "valuetext" },
438
+ {
439
+ key: "index",
440
+ validate: isInt,
441
+ knownValues: DEFAULT_DYNAMIC_VARIANT_ENTRY_KNOWN_INT_VALUES
442
+ },
443
+ {
444
+ key: "columns",
445
+ validate: isInt,
446
+ knownValues: DEFAULT_DYNAMIC_VARIANT_ENTRY_KNOWN_INT_VALUES
447
+ },
448
+ { key: "branch" },
449
+ {
450
+ key: "depth",
451
+ validate: isInt,
452
+ knownValues: DEFAULT_DYNAMIC_VARIANT_ENTRY_KNOWN_INT_VALUES
453
+ },
454
+ {
455
+ key: "path",
456
+ validate: isInt,
457
+ knownValues: DEFAULT_DYNAMIC_VARIANT_ENTRY_KNOWN_INT_VALUES
458
+ },
459
+ {
460
+ key: "type",
461
+ knownValues: {
462
+ info: "info",
463
+ error: "error",
464
+ warning: "warning",
465
+ success: "success",
466
+ loading: "loading",
467
+ floating: "floating",
468
+ tooltip: "tooltip",
469
+ dialog: "dialog",
470
+ wait: "wait"
471
+ }
472
+ }
160
473
  ];
161
- var index_default = plugin__default.default.withOptions((config = {}) => {
162
- const prefix = config.prefix ?? "ui";
163
- return ({ addVariant, matchVariant }) => {
164
- for (const { key, values } of STATIC_VARIANT_ENTRIES) {
165
- addVariant(
166
- `${prefix}-${key}`,
167
- values.map((value) => value === null ? `&[data-${key}]` : `&[data-${value}]`)
168
- );
169
- addVariant(
170
- `${prefix}-not-${key}`,
171
- values.map((value) => value === null ? `&:not([data-${key}])` : `&:not([data-${value}])`)
172
- );
173
- addVariant(
174
- `${prefix}-group-${key}`,
175
- values.map(
176
- (value) => value === null ? `.group[data-${key}] &` : `.group[data-${value}] &`
177
- )
178
- );
179
- addVariant(
180
- `${prefix}-peer-${key}`,
181
- values.map(
182
- (value) => value === null ? `.peer[data-${key}] ~ &` : `.peer[data-${value}] ~ &`
183
- )
184
- );
185
- }
186
- for (const { key, knownValues, validate } of DYNAMIC_VARIANT_ENTRIES) {
187
- const isValid = validate ?? (() => true);
188
- matchVariant(
189
- `${prefix}-${key}`,
190
- (value) => !isValid(value) ? [] : `&[data-${key}="${value}"]`,
191
- { values: knownValues }
192
- );
193
- matchVariant(
194
- `${prefix}-not-${key}`,
195
- (value) => !isValid(value) ? [] : `&:not([data-${key}="${value}"])`,
196
- { values: knownValues }
197
- );
198
- matchVariant(
199
- `${prefix}-group-${key}`,
200
- (value) => !isValid(value) ? [] : `.group[data-${key}="${value}"] &`,
201
- { values: knownValues }
202
- );
203
- matchVariant(
204
- `${prefix}-peer-${key}`,
205
- (value) => !isValid(value) ? [] : `.peer[data-${value}="${value}"] ~ &`,
206
- { values: knownValues }
207
- );
208
- }
209
- };
474
+ /**
475
+ * @see https://github.com/calvo-jp/tailwindcss-plugin-zag
476
+ */
477
+ var src_default = tailwindcss_plugin_js.default.withOptions((config = {}) => {
478
+ const prefix = config.prefix ?? "ui";
479
+ return ({ addVariant, matchVariant }) => {
480
+ for (const { key, values } of STATIC_VARIANT_ENTRIES) {
481
+ addVariant(`${prefix}-${key}`, values.map((value) => value === null ? `&[data-${key}]` : `&[data-${value}]`));
482
+ addVariant(`${prefix}-not-${key}`, values.map((value) => value === null ? `&:not([data-${key}])` : `&:not([data-${value}])`));
483
+ addVariant(`${prefix}-group-${key}`, values.map((value) => value === null ? `.group[data-${key}] &` : `.group[data-${value}] &`));
484
+ addVariant(`${prefix}-peer-${key}`, values.map((value) => value === null ? `.peer[data-${key}] ~ &` : `.peer[data-${value}] ~ &`));
485
+ }
486
+ for (const { key, knownValues, validate } of DYNAMIC_VARIANT_ENTRIES) {
487
+ const isValid = validate ?? (() => true);
488
+ matchVariant(`${prefix}-${key}`, (value) => !isValid(value) ? [] : `&[data-${key}="${value}"]`, { values: knownValues });
489
+ matchVariant(`${prefix}-not-${key}`, (value) => !isValid(value) ? [] : `&:not([data-${key}="${value}"])`, { values: knownValues });
490
+ matchVariant(`${prefix}-group-${key}`, (value) => !isValid(value) ? [] : `.group[data-${key}="${value}"] &`, { values: knownValues });
491
+ matchVariant(`${prefix}-peer-${key}`, (value) => !isValid(value) ? [] : `.peer[data-${value}="${value}"] ~ &`, { values: knownValues });
492
+ }
493
+ };
210
494
  });
211
495
 
212
- module.exports = index_default;
213
- //# sourceMappingURL=index.cjs.map
496
+ //#endregion
497
+ module.exports = src_default;
214
498
  //# sourceMappingURL=index.cjs.map