tailwind-styled-v4 5.1.10 → 5.1.11
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.browser.mjs +286 -4
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.d.mts +32 -2
- package/dist/index.d.ts +32 -2
- package/dist/index.js +292 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +292 -7
- package/dist/index.mjs.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/next.js +31 -1
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +31 -1
- package/dist/next.mjs.map +1 -1
- package/dist/svelte.js +292 -7
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +292 -7
- package/dist/svelte.mjs.map +1 -1
- package/dist/vue.js +292 -7
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +292 -7
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.browser.mjs
CHANGED
|
@@ -134,8 +134,289 @@ function getContainerRegistry() {
|
|
|
134
134
|
return containerRegistry;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
// packages/domain/core/src/mergeFallback.ts
|
|
138
|
+
var TEXT_SIZE_SUFFIXES = /* @__PURE__ */ new Set([
|
|
139
|
+
"xs",
|
|
140
|
+
"sm",
|
|
141
|
+
"base",
|
|
142
|
+
"lg",
|
|
143
|
+
"xl",
|
|
144
|
+
"2xl",
|
|
145
|
+
"3xl",
|
|
146
|
+
"4xl",
|
|
147
|
+
"5xl",
|
|
148
|
+
"6xl",
|
|
149
|
+
"7xl",
|
|
150
|
+
"8xl",
|
|
151
|
+
"9xl"
|
|
152
|
+
]);
|
|
153
|
+
function isTextSize(suffix) {
|
|
154
|
+
if (TEXT_SIZE_SUFFIXES.has(suffix)) return true;
|
|
155
|
+
if (suffix.startsWith("[")) return true;
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
function isAsciiDigits(s) {
|
|
159
|
+
if (s.length === 0) return true;
|
|
160
|
+
for (let i = 0; i < s.length; i++) {
|
|
161
|
+
const code = s.charCodeAt(i);
|
|
162
|
+
if (code < 48 || code > 57) return false;
|
|
163
|
+
}
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
function isU32(s) {
|
|
167
|
+
return s.length > 0 && /^[0-9]+$/.test(s);
|
|
168
|
+
}
|
|
169
|
+
var DISPLAY_VALUES = /* @__PURE__ */ new Set([
|
|
170
|
+
"block",
|
|
171
|
+
"inline-block",
|
|
172
|
+
"inline",
|
|
173
|
+
"flex",
|
|
174
|
+
"inline-flex",
|
|
175
|
+
"grid",
|
|
176
|
+
"inline-grid",
|
|
177
|
+
"table",
|
|
178
|
+
"inline-table",
|
|
179
|
+
"table-row",
|
|
180
|
+
"table-cell",
|
|
181
|
+
"table-column",
|
|
182
|
+
"table-caption",
|
|
183
|
+
"contents",
|
|
184
|
+
"list-item",
|
|
185
|
+
"hidden",
|
|
186
|
+
"flow-root"
|
|
187
|
+
]);
|
|
188
|
+
var POSITION_VALUES = /* @__PURE__ */ new Set(["static", "relative", "absolute", "fixed", "sticky"]);
|
|
189
|
+
var FONT_WEIGHT_NAMES = /* @__PURE__ */ new Set([
|
|
190
|
+
"thin",
|
|
191
|
+
"extralight",
|
|
192
|
+
"light",
|
|
193
|
+
"normal",
|
|
194
|
+
"medium",
|
|
195
|
+
"semibold",
|
|
196
|
+
"bold",
|
|
197
|
+
"extrabold",
|
|
198
|
+
"black"
|
|
199
|
+
]);
|
|
200
|
+
var TEXT_ALIGN_VALUES = /* @__PURE__ */ new Set(["left", "center", "right", "justify", "start", "end"]);
|
|
201
|
+
var BORDER_SIDE_PREFIXES = ["t-", "r-", "b-", "l-", "x-", "y-", "s-", "e-"];
|
|
202
|
+
var BORDER_STYLE_VALUES = /* @__PURE__ */ new Set(["solid", "dashed", "dotted", "double", "hidden", "none"]);
|
|
203
|
+
function conflictGroup(base) {
|
|
204
|
+
const bracket = base.indexOf("[");
|
|
205
|
+
if (bracket !== -1) {
|
|
206
|
+
const prefix = base.slice(0, bracket).replace(/-+$/, "");
|
|
207
|
+
return prefix.length > 0 ? prefix : "arbitrary";
|
|
208
|
+
}
|
|
209
|
+
if (DISPLAY_VALUES.has(base)) return "display";
|
|
210
|
+
if (POSITION_VALUES.has(base)) return "position";
|
|
211
|
+
if (base.startsWith("overflow-x-")) return "overflow-x";
|
|
212
|
+
if (base.startsWith("overflow-y-")) return "overflow-y";
|
|
213
|
+
if (base.startsWith("overflow-")) return "overflow";
|
|
214
|
+
if (base.startsWith("flex-")) return "flex";
|
|
215
|
+
if (base.startsWith("grid-cols-")) return "grid-cols";
|
|
216
|
+
if (base.startsWith("grid-rows-")) return "grid-rows";
|
|
217
|
+
if (base.startsWith("grid-flow-")) return "grid-flow";
|
|
218
|
+
if (base.startsWith("col-")) return "col";
|
|
219
|
+
if (base.startsWith("row-")) return "row";
|
|
220
|
+
if (base === "grow" || base.startsWith("grow-")) return "grow";
|
|
221
|
+
if (base === "shrink" || base.startsWith("shrink-")) return "shrink";
|
|
222
|
+
if (base.startsWith("gap-x-")) return "gap-x";
|
|
223
|
+
if (base.startsWith("gap-y-")) return "gap-y";
|
|
224
|
+
if (base.startsWith("gap-")) return "gap";
|
|
225
|
+
if (base.startsWith("justify-items-")) return "justify-items";
|
|
226
|
+
if (base.startsWith("justify-self-")) return "justify-self";
|
|
227
|
+
if (base.startsWith("justify-")) return "justify";
|
|
228
|
+
if (base.startsWith("items-")) return "items";
|
|
229
|
+
if (base.startsWith("self-")) return "self";
|
|
230
|
+
if (base.startsWith("place-content-")) return "place-content";
|
|
231
|
+
if (base.startsWith("place-items-")) return "place-items";
|
|
232
|
+
if (base.startsWith("place-self-")) return "place-self";
|
|
233
|
+
if (base.startsWith("content-")) return "content";
|
|
234
|
+
if (base.startsWith("px-")) return "px";
|
|
235
|
+
if (base.startsWith("py-")) return "py";
|
|
236
|
+
if (base.startsWith("pt-")) return "pt";
|
|
237
|
+
if (base.startsWith("pr-")) return "pr";
|
|
238
|
+
if (base.startsWith("pb-")) return "pb";
|
|
239
|
+
if (base.startsWith("pl-")) return "pl";
|
|
240
|
+
if (base.startsWith("ps-")) return "ps";
|
|
241
|
+
if (base.startsWith("pe-")) return "pe";
|
|
242
|
+
if (base.startsWith("p-")) return "p";
|
|
243
|
+
if (base.startsWith("mx-")) return "mx";
|
|
244
|
+
if (base.startsWith("my-")) return "my";
|
|
245
|
+
if (base.startsWith("mt-")) return "mt";
|
|
246
|
+
if (base.startsWith("mr-")) return "mr";
|
|
247
|
+
if (base.startsWith("mb-")) return "mb";
|
|
248
|
+
if (base.startsWith("ml-")) return "ml";
|
|
249
|
+
if (base.startsWith("ms-")) return "ms";
|
|
250
|
+
if (base.startsWith("me-")) return "me";
|
|
251
|
+
if (base === "-m" || base.startsWith("m-") || base.startsWith("-m-")) return "m";
|
|
252
|
+
if (base.startsWith("space-x-")) return "space-x";
|
|
253
|
+
if (base.startsWith("space-y-")) return "space-y";
|
|
254
|
+
if (base.startsWith("size-")) return "size";
|
|
255
|
+
if (base.startsWith("min-w-")) return "min-w";
|
|
256
|
+
if (base.startsWith("max-w-")) return "max-w";
|
|
257
|
+
if (base.startsWith("w-")) return "w";
|
|
258
|
+
if (base.startsWith("min-h-")) return "min-h";
|
|
259
|
+
if (base.startsWith("max-h-")) return "max-h";
|
|
260
|
+
if (base.startsWith("h-")) return "h";
|
|
261
|
+
if (base.startsWith("inset-x-")) return "inset-x";
|
|
262
|
+
if (base.startsWith("inset-y-")) return "inset-y";
|
|
263
|
+
if (base.startsWith("inset-")) return "inset";
|
|
264
|
+
if (base.startsWith("top-")) return "top";
|
|
265
|
+
if (base.startsWith("right-") || base.startsWith("end-")) return "right";
|
|
266
|
+
if (base.startsWith("bottom-")) return "bottom";
|
|
267
|
+
if (base.startsWith("left-") || base.startsWith("start-")) return "left";
|
|
268
|
+
if (base.startsWith("z-")) return "z";
|
|
269
|
+
if (base.startsWith("opacity-")) return "opacity";
|
|
270
|
+
if (base.startsWith("bg-")) {
|
|
271
|
+
if (base.startsWith("bg-opacity-")) return "bg-opacity";
|
|
272
|
+
return "bg";
|
|
273
|
+
}
|
|
274
|
+
if (base.startsWith("from-")) return "from";
|
|
275
|
+
if (base.startsWith("via-")) return "via";
|
|
276
|
+
if (base.startsWith("to-")) return "to";
|
|
277
|
+
if (base.startsWith("text-")) {
|
|
278
|
+
const suffix = base.slice("text-".length);
|
|
279
|
+
if (isTextSize(suffix)) return "text-size";
|
|
280
|
+
if (suffix.startsWith("opacity-")) return "text-opacity";
|
|
281
|
+
if (TEXT_ALIGN_VALUES.has(suffix)) return "text-align";
|
|
282
|
+
return "text-color";
|
|
283
|
+
}
|
|
284
|
+
if (base.startsWith("font-")) {
|
|
285
|
+
const suffix = base.slice("font-".length);
|
|
286
|
+
if (FONT_WEIGHT_NAMES.has(suffix) || isAsciiDigits(suffix)) return "font-weight";
|
|
287
|
+
return "font-family";
|
|
288
|
+
}
|
|
289
|
+
if (base.startsWith("leading-")) return "leading";
|
|
290
|
+
if (base.startsWith("tracking-")) return "tracking";
|
|
291
|
+
if (base.startsWith("border-")) {
|
|
292
|
+
const suffix = base.slice("border-".length);
|
|
293
|
+
const sidePrefix = BORDER_SIDE_PREFIXES.find((p) => suffix.startsWith(p));
|
|
294
|
+
if (sidePrefix) {
|
|
295
|
+
const side = suffix.slice(0, 1);
|
|
296
|
+
const rest = suffix.slice(2);
|
|
297
|
+
if (isU32(rest) || rest.length === 0) return `border-${side}-width`;
|
|
298
|
+
return `border-${side}-color`;
|
|
299
|
+
}
|
|
300
|
+
if (isU32(suffix) || suffix.length === 0) return "border-width";
|
|
301
|
+
if (suffix.startsWith("opacity-")) return "border-opacity";
|
|
302
|
+
if (suffix === "collapse" || suffix === "separate") return "border-collapse";
|
|
303
|
+
if (BORDER_STYLE_VALUES.has(suffix)) return "border-style";
|
|
304
|
+
return "border-color";
|
|
305
|
+
}
|
|
306
|
+
if (base === "border") return "border-width";
|
|
307
|
+
if (base.startsWith("outline-")) return "outline";
|
|
308
|
+
if (base === "outline") return "outline";
|
|
309
|
+
if (base.startsWith("rounded-t") || base.startsWith("rounded-r") || base.startsWith("rounded-b") || base.startsWith("rounded-l") || base.startsWith("rounded-s") || base.startsWith("rounded-e")) {
|
|
310
|
+
const firstChar = base.slice("rounded-".length).charAt(0) || "x";
|
|
311
|
+
return `rounded-${firstChar}`;
|
|
312
|
+
}
|
|
313
|
+
if (base === "rounded" || base.startsWith("rounded-")) return "rounded";
|
|
314
|
+
if (base === "shadow" || base.startsWith("shadow-")) return "shadow";
|
|
315
|
+
if (base.startsWith("ring-offset-")) return "ring-offset";
|
|
316
|
+
if (base === "ring") return "ring-width";
|
|
317
|
+
if (base.startsWith("ring-")) {
|
|
318
|
+
const rest = base.slice("ring-".length);
|
|
319
|
+
const isWidth = rest === "0" || rest === "1" || rest === "2" || rest === "4" || rest === "8" || /^-?\d+(\.\d+)?$/.test(rest) || rest.startsWith("[") && rest.endsWith("]");
|
|
320
|
+
if (isWidth) return "ring-width";
|
|
321
|
+
if (rest === "inset") return "ring-inset";
|
|
322
|
+
return "ring-color";
|
|
323
|
+
}
|
|
324
|
+
if (base.startsWith("rotate-")) return "rotate";
|
|
325
|
+
if (base.startsWith("scale-x-")) return "scale-x";
|
|
326
|
+
if (base.startsWith("scale-y-")) return "scale-y";
|
|
327
|
+
if (base.startsWith("scale-")) return "scale";
|
|
328
|
+
if (base.startsWith("translate-x-")) return "translate-x";
|
|
329
|
+
if (base.startsWith("translate-y-")) return "translate-y";
|
|
330
|
+
if (base.startsWith("skew-x-")) return "skew-x";
|
|
331
|
+
if (base.startsWith("skew-y-")) return "skew-y";
|
|
332
|
+
if (base === "transition" || base.startsWith("transition-")) return "transition";
|
|
333
|
+
if (base.startsWith("duration-")) return "duration";
|
|
334
|
+
if (base.startsWith("ease-")) return "ease";
|
|
335
|
+
if (base.startsWith("delay-")) return "delay";
|
|
336
|
+
if (base === "animate" || base.startsWith("animate-")) return "animate";
|
|
337
|
+
if (base.startsWith("cursor-")) return "cursor";
|
|
338
|
+
if (base.startsWith("pointer-events-")) return "pointer-events";
|
|
339
|
+
if (base.startsWith("select-")) return "select";
|
|
340
|
+
if (base === "visible" || base === "invisible" || base === "collapse") return "visibility";
|
|
341
|
+
if (base.startsWith("object-")) return "object";
|
|
342
|
+
if (base.startsWith("aspect-")) return "aspect";
|
|
343
|
+
if (base.startsWith("order-")) return "order";
|
|
344
|
+
if (base.startsWith("whitespace-")) return "whitespace";
|
|
345
|
+
if (base.startsWith("list-")) return "list";
|
|
346
|
+
if (base.startsWith("fill-")) return "fill";
|
|
347
|
+
if (base.startsWith("stroke-")) return "stroke";
|
|
348
|
+
if (base.startsWith("backdrop-")) {
|
|
349
|
+
const rest = base.slice("backdrop-".length);
|
|
350
|
+
const seg = rest.split("-")[0] || "x";
|
|
351
|
+
return `backdrop-${seg}`;
|
|
352
|
+
}
|
|
353
|
+
if (base.startsWith("scroll-")) return "scroll";
|
|
354
|
+
if (base.startsWith("snap-")) return "snap";
|
|
355
|
+
if (base.startsWith("touch-")) return "touch";
|
|
356
|
+
if (base.startsWith("decoration-")) return "text-decoration";
|
|
357
|
+
if (base.startsWith("caret-")) return "caret";
|
|
358
|
+
if (base.startsWith("accent-")) return "accent";
|
|
359
|
+
if (base.startsWith("appearance-")) return "appearance";
|
|
360
|
+
if (base === "isolate" || base === "isolation-auto") return "isolation";
|
|
361
|
+
if (base.startsWith("mix-blend-")) return "mix-blend";
|
|
362
|
+
if (base.startsWith("bg-blend-")) return "bg-blend";
|
|
363
|
+
if (base.startsWith("float-")) return "float";
|
|
364
|
+
if (base.startsWith("clear-")) return "clear";
|
|
365
|
+
if (base.startsWith("break-")) return "break";
|
|
366
|
+
if (base.startsWith("columns-")) return "columns";
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
function splitVariants(klass) {
|
|
370
|
+
let depth = 0;
|
|
371
|
+
let lastColon = 0;
|
|
372
|
+
for (let i = 0; i < klass.length; i++) {
|
|
373
|
+
const ch = klass.charCodeAt(i);
|
|
374
|
+
if (ch === 91) depth++;
|
|
375
|
+
else if (ch === 93) depth = depth > 0 ? depth - 1 : 0;
|
|
376
|
+
else if (ch === 58 && depth === 0) lastColon = i + 1;
|
|
377
|
+
}
|
|
378
|
+
if (lastColon === 0) return ["", klass];
|
|
379
|
+
return [klass.slice(0, lastColon), klass.slice(lastColon)];
|
|
380
|
+
}
|
|
381
|
+
function mergeClassStringJs(input) {
|
|
382
|
+
const tokens = input.split(/\s+/).filter(Boolean);
|
|
383
|
+
if (tokens.length === 0) return "";
|
|
384
|
+
if (tokens.length === 1) return tokens[0];
|
|
385
|
+
const groupOwner = /* @__PURE__ */ new Map();
|
|
386
|
+
const slots = [];
|
|
387
|
+
for (const token of tokens) {
|
|
388
|
+
const [variants, base] = splitVariants(token);
|
|
389
|
+
const group = conflictGroup(base);
|
|
390
|
+
if (group !== null) {
|
|
391
|
+
const key = `${variants}::${group}`;
|
|
392
|
+
const prevIdx = groupOwner.get(key);
|
|
393
|
+
if (prevIdx !== void 0) slots[prevIdx] = null;
|
|
394
|
+
groupOwner.set(key, slots.length);
|
|
395
|
+
slots.push(token);
|
|
396
|
+
} else {
|
|
397
|
+
slots.push(token);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
return slots.filter((s) => s !== null).join(" ");
|
|
401
|
+
}
|
|
402
|
+
function twMergeRawJs(classLists) {
|
|
403
|
+
const joined = classLists.map((s) => s.trim()).filter((s) => s.length > 0).join(" ");
|
|
404
|
+
if (joined.length === 0) return "";
|
|
405
|
+
return mergeClassStringJs(joined);
|
|
406
|
+
}
|
|
407
|
+
|
|
137
408
|
// packages/domain/core/src/merge.ts
|
|
138
|
-
|
|
409
|
+
var warnedFallback = false;
|
|
410
|
+
function warnFallbackOnce() {
|
|
411
|
+
if (warnedFallback) return;
|
|
412
|
+
warnedFallback = true;
|
|
413
|
+
if (typeof console !== "undefined") {
|
|
414
|
+
console.warn(
|
|
415
|
+
"[tailwind-styled-v4] Native binding 'twMergeRaw' tidak tersedia (normal di browser) \u2014 pakai pure-TS port dari algoritma Rust-nya. Hasil className tetap benar; ini cuma informasi, bukan error."
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
function createTwMerge(options = {}) {
|
|
139
420
|
return function twMerge2(...classLists) {
|
|
140
421
|
const inputs = [];
|
|
141
422
|
for (let i = 0; i < classLists.length; i++) {
|
|
@@ -144,10 +425,11 @@ function createTwMerge(_options = {}) {
|
|
|
144
425
|
}
|
|
145
426
|
if (inputs.length === 0) return "";
|
|
146
427
|
const native = getNativeBinding();
|
|
147
|
-
if (
|
|
148
|
-
|
|
428
|
+
if (native?.twMergeRaw) {
|
|
429
|
+
return native.twMergeRaw(inputs);
|
|
149
430
|
}
|
|
150
|
-
|
|
431
|
+
warnFallbackOnce();
|
|
432
|
+
return twMergeRawJs(inputs);
|
|
151
433
|
};
|
|
152
434
|
}
|
|
153
435
|
var twMerge = createTwMerge();
|