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/vue.js CHANGED
@@ -205,7 +205,7 @@ var nativeBinding = null;
205
205
  var bindingLoadAttempted = false;
206
206
  var getBinding = () => {
207
207
  if (isBrowser2) {
208
- throw new Error(NATIVE_UNAVAILABLE_MESSAGE + "\n\nNative bindings are not available in browser. Use the compiled CSS output instead.");
208
+ return null;
209
209
  }
210
210
  if (nativeBinding) return nativeBinding;
211
211
  if (bindingLoadAttempted) {
@@ -213,10 +213,10 @@ var getBinding = () => {
213
213
  }
214
214
  bindingLoadAttempted = true;
215
215
  try {
216
- const runtimeDir = isBrowser2 ? "" : (0, import_node_path2.dirname)(
216
+ const runtimeDir = (0, import_node_path2.dirname)(
217
217
  typeof __filename !== "undefined" ? __filename : typeof import_meta2 !== "undefined" && importMetaUrl ? (0, import_node_url2.fileURLToPath)(importMetaUrl) : process.cwd()
218
218
  );
219
- const result = isBrowser2 ? { path: null, source: "not-found", platform: "browser", tried: [] } : resolveNativeBinary(runtimeDir);
219
+ const result = resolveNativeBinary(runtimeDir);
220
220
  if (result.path && result.path.endsWith(".node")) {
221
221
  const mod = _loadNative(result.path);
222
222
  if (mod?.batchSplitClasses) {
@@ -235,7 +235,291 @@ var getNativeBinding = getBinding;
235
235
 
236
236
  // packages/domain/core/src/merge.ts
237
237
  init_cjs_shims();
238
- function createTwMerge(_options = {}) {
238
+
239
+ // packages/domain/core/src/mergeFallback.ts
240
+ init_cjs_shims();
241
+ var TEXT_SIZE_SUFFIXES = /* @__PURE__ */ new Set([
242
+ "xs",
243
+ "sm",
244
+ "base",
245
+ "lg",
246
+ "xl",
247
+ "2xl",
248
+ "3xl",
249
+ "4xl",
250
+ "5xl",
251
+ "6xl",
252
+ "7xl",
253
+ "8xl",
254
+ "9xl"
255
+ ]);
256
+ function isTextSize(suffix) {
257
+ if (TEXT_SIZE_SUFFIXES.has(suffix)) return true;
258
+ if (suffix.startsWith("[")) return true;
259
+ return false;
260
+ }
261
+ function isAsciiDigits(s) {
262
+ if (s.length === 0) return true;
263
+ for (let i = 0; i < s.length; i++) {
264
+ const code = s.charCodeAt(i);
265
+ if (code < 48 || code > 57) return false;
266
+ }
267
+ return true;
268
+ }
269
+ function isU32(s) {
270
+ return s.length > 0 && /^[0-9]+$/.test(s);
271
+ }
272
+ var DISPLAY_VALUES = /* @__PURE__ */ new Set([
273
+ "block",
274
+ "inline-block",
275
+ "inline",
276
+ "flex",
277
+ "inline-flex",
278
+ "grid",
279
+ "inline-grid",
280
+ "table",
281
+ "inline-table",
282
+ "table-row",
283
+ "table-cell",
284
+ "table-column",
285
+ "table-caption",
286
+ "contents",
287
+ "list-item",
288
+ "hidden",
289
+ "flow-root"
290
+ ]);
291
+ var POSITION_VALUES = /* @__PURE__ */ new Set(["static", "relative", "absolute", "fixed", "sticky"]);
292
+ var FONT_WEIGHT_NAMES = /* @__PURE__ */ new Set([
293
+ "thin",
294
+ "extralight",
295
+ "light",
296
+ "normal",
297
+ "medium",
298
+ "semibold",
299
+ "bold",
300
+ "extrabold",
301
+ "black"
302
+ ]);
303
+ var TEXT_ALIGN_VALUES = /* @__PURE__ */ new Set(["left", "center", "right", "justify", "start", "end"]);
304
+ var BORDER_SIDE_PREFIXES = ["t-", "r-", "b-", "l-", "x-", "y-", "s-", "e-"];
305
+ var BORDER_STYLE_VALUES = /* @__PURE__ */ new Set(["solid", "dashed", "dotted", "double", "hidden", "none"]);
306
+ function conflictGroup(base) {
307
+ const bracket = base.indexOf("[");
308
+ if (bracket !== -1) {
309
+ const prefix = base.slice(0, bracket).replace(/-+$/, "");
310
+ return prefix.length > 0 ? prefix : "arbitrary";
311
+ }
312
+ if (DISPLAY_VALUES.has(base)) return "display";
313
+ if (POSITION_VALUES.has(base)) return "position";
314
+ if (base.startsWith("overflow-x-")) return "overflow-x";
315
+ if (base.startsWith("overflow-y-")) return "overflow-y";
316
+ if (base.startsWith("overflow-")) return "overflow";
317
+ if (base.startsWith("flex-")) return "flex";
318
+ if (base.startsWith("grid-cols-")) return "grid-cols";
319
+ if (base.startsWith("grid-rows-")) return "grid-rows";
320
+ if (base.startsWith("grid-flow-")) return "grid-flow";
321
+ if (base.startsWith("col-")) return "col";
322
+ if (base.startsWith("row-")) return "row";
323
+ if (base === "grow" || base.startsWith("grow-")) return "grow";
324
+ if (base === "shrink" || base.startsWith("shrink-")) return "shrink";
325
+ if (base.startsWith("gap-x-")) return "gap-x";
326
+ if (base.startsWith("gap-y-")) return "gap-y";
327
+ if (base.startsWith("gap-")) return "gap";
328
+ if (base.startsWith("justify-items-")) return "justify-items";
329
+ if (base.startsWith("justify-self-")) return "justify-self";
330
+ if (base.startsWith("justify-")) return "justify";
331
+ if (base.startsWith("items-")) return "items";
332
+ if (base.startsWith("self-")) return "self";
333
+ if (base.startsWith("place-content-")) return "place-content";
334
+ if (base.startsWith("place-items-")) return "place-items";
335
+ if (base.startsWith("place-self-")) return "place-self";
336
+ if (base.startsWith("content-")) return "content";
337
+ if (base.startsWith("px-")) return "px";
338
+ if (base.startsWith("py-")) return "py";
339
+ if (base.startsWith("pt-")) return "pt";
340
+ if (base.startsWith("pr-")) return "pr";
341
+ if (base.startsWith("pb-")) return "pb";
342
+ if (base.startsWith("pl-")) return "pl";
343
+ if (base.startsWith("ps-")) return "ps";
344
+ if (base.startsWith("pe-")) return "pe";
345
+ if (base.startsWith("p-")) return "p";
346
+ if (base.startsWith("mx-")) return "mx";
347
+ if (base.startsWith("my-")) return "my";
348
+ if (base.startsWith("mt-")) return "mt";
349
+ if (base.startsWith("mr-")) return "mr";
350
+ if (base.startsWith("mb-")) return "mb";
351
+ if (base.startsWith("ml-")) return "ml";
352
+ if (base.startsWith("ms-")) return "ms";
353
+ if (base.startsWith("me-")) return "me";
354
+ if (base === "-m" || base.startsWith("m-") || base.startsWith("-m-")) return "m";
355
+ if (base.startsWith("space-x-")) return "space-x";
356
+ if (base.startsWith("space-y-")) return "space-y";
357
+ if (base.startsWith("size-")) return "size";
358
+ if (base.startsWith("min-w-")) return "min-w";
359
+ if (base.startsWith("max-w-")) return "max-w";
360
+ if (base.startsWith("w-")) return "w";
361
+ if (base.startsWith("min-h-")) return "min-h";
362
+ if (base.startsWith("max-h-")) return "max-h";
363
+ if (base.startsWith("h-")) return "h";
364
+ if (base.startsWith("inset-x-")) return "inset-x";
365
+ if (base.startsWith("inset-y-")) return "inset-y";
366
+ if (base.startsWith("inset-")) return "inset";
367
+ if (base.startsWith("top-")) return "top";
368
+ if (base.startsWith("right-") || base.startsWith("end-")) return "right";
369
+ if (base.startsWith("bottom-")) return "bottom";
370
+ if (base.startsWith("left-") || base.startsWith("start-")) return "left";
371
+ if (base.startsWith("z-")) return "z";
372
+ if (base.startsWith("opacity-")) return "opacity";
373
+ if (base.startsWith("bg-")) {
374
+ if (base.startsWith("bg-opacity-")) return "bg-opacity";
375
+ return "bg";
376
+ }
377
+ if (base.startsWith("from-")) return "from";
378
+ if (base.startsWith("via-")) return "via";
379
+ if (base.startsWith("to-")) return "to";
380
+ if (base.startsWith("text-")) {
381
+ const suffix = base.slice("text-".length);
382
+ if (isTextSize(suffix)) return "text-size";
383
+ if (suffix.startsWith("opacity-")) return "text-opacity";
384
+ if (TEXT_ALIGN_VALUES.has(suffix)) return "text-align";
385
+ return "text-color";
386
+ }
387
+ if (base.startsWith("font-")) {
388
+ const suffix = base.slice("font-".length);
389
+ if (FONT_WEIGHT_NAMES.has(suffix) || isAsciiDigits(suffix)) return "font-weight";
390
+ return "font-family";
391
+ }
392
+ if (base.startsWith("leading-")) return "leading";
393
+ if (base.startsWith("tracking-")) return "tracking";
394
+ if (base.startsWith("border-")) {
395
+ const suffix = base.slice("border-".length);
396
+ const sidePrefix = BORDER_SIDE_PREFIXES.find((p) => suffix.startsWith(p));
397
+ if (sidePrefix) {
398
+ const side = suffix.slice(0, 1);
399
+ const rest = suffix.slice(2);
400
+ if (isU32(rest) || rest.length === 0) return `border-${side}-width`;
401
+ return `border-${side}-color`;
402
+ }
403
+ if (isU32(suffix) || suffix.length === 0) return "border-width";
404
+ if (suffix.startsWith("opacity-")) return "border-opacity";
405
+ if (suffix === "collapse" || suffix === "separate") return "border-collapse";
406
+ if (BORDER_STYLE_VALUES.has(suffix)) return "border-style";
407
+ return "border-color";
408
+ }
409
+ if (base === "border") return "border-width";
410
+ if (base.startsWith("outline-")) return "outline";
411
+ if (base === "outline") return "outline";
412
+ 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")) {
413
+ const firstChar = base.slice("rounded-".length).charAt(0) || "x";
414
+ return `rounded-${firstChar}`;
415
+ }
416
+ if (base === "rounded" || base.startsWith("rounded-")) return "rounded";
417
+ if (base === "shadow" || base.startsWith("shadow-")) return "shadow";
418
+ if (base.startsWith("ring-offset-")) return "ring-offset";
419
+ if (base === "ring") return "ring-width";
420
+ if (base.startsWith("ring-")) {
421
+ const rest = base.slice("ring-".length);
422
+ const isWidth = rest === "0" || rest === "1" || rest === "2" || rest === "4" || rest === "8" || /^-?\d+(\.\d+)?$/.test(rest) || rest.startsWith("[") && rest.endsWith("]");
423
+ if (isWidth) return "ring-width";
424
+ if (rest === "inset") return "ring-inset";
425
+ return "ring-color";
426
+ }
427
+ if (base.startsWith("rotate-")) return "rotate";
428
+ if (base.startsWith("scale-x-")) return "scale-x";
429
+ if (base.startsWith("scale-y-")) return "scale-y";
430
+ if (base.startsWith("scale-")) return "scale";
431
+ if (base.startsWith("translate-x-")) return "translate-x";
432
+ if (base.startsWith("translate-y-")) return "translate-y";
433
+ if (base.startsWith("skew-x-")) return "skew-x";
434
+ if (base.startsWith("skew-y-")) return "skew-y";
435
+ if (base === "transition" || base.startsWith("transition-")) return "transition";
436
+ if (base.startsWith("duration-")) return "duration";
437
+ if (base.startsWith("ease-")) return "ease";
438
+ if (base.startsWith("delay-")) return "delay";
439
+ if (base === "animate" || base.startsWith("animate-")) return "animate";
440
+ if (base.startsWith("cursor-")) return "cursor";
441
+ if (base.startsWith("pointer-events-")) return "pointer-events";
442
+ if (base.startsWith("select-")) return "select";
443
+ if (base === "visible" || base === "invisible" || base === "collapse") return "visibility";
444
+ if (base.startsWith("object-")) return "object";
445
+ if (base.startsWith("aspect-")) return "aspect";
446
+ if (base.startsWith("order-")) return "order";
447
+ if (base.startsWith("whitespace-")) return "whitespace";
448
+ if (base.startsWith("list-")) return "list";
449
+ if (base.startsWith("fill-")) return "fill";
450
+ if (base.startsWith("stroke-")) return "stroke";
451
+ if (base.startsWith("backdrop-")) {
452
+ const rest = base.slice("backdrop-".length);
453
+ const seg = rest.split("-")[0] || "x";
454
+ return `backdrop-${seg}`;
455
+ }
456
+ if (base.startsWith("scroll-")) return "scroll";
457
+ if (base.startsWith("snap-")) return "snap";
458
+ if (base.startsWith("touch-")) return "touch";
459
+ if (base.startsWith("decoration-")) return "text-decoration";
460
+ if (base.startsWith("caret-")) return "caret";
461
+ if (base.startsWith("accent-")) return "accent";
462
+ if (base.startsWith("appearance-")) return "appearance";
463
+ if (base === "isolate" || base === "isolation-auto") return "isolation";
464
+ if (base.startsWith("mix-blend-")) return "mix-blend";
465
+ if (base.startsWith("bg-blend-")) return "bg-blend";
466
+ if (base.startsWith("float-")) return "float";
467
+ if (base.startsWith("clear-")) return "clear";
468
+ if (base.startsWith("break-")) return "break";
469
+ if (base.startsWith("columns-")) return "columns";
470
+ return null;
471
+ }
472
+ function splitVariants(klass) {
473
+ let depth = 0;
474
+ let lastColon = 0;
475
+ for (let i = 0; i < klass.length; i++) {
476
+ const ch = klass.charCodeAt(i);
477
+ if (ch === 91) depth++;
478
+ else if (ch === 93) depth = depth > 0 ? depth - 1 : 0;
479
+ else if (ch === 58 && depth === 0) lastColon = i + 1;
480
+ }
481
+ if (lastColon === 0) return ["", klass];
482
+ return [klass.slice(0, lastColon), klass.slice(lastColon)];
483
+ }
484
+ function mergeClassStringJs(input) {
485
+ const tokens = input.split(/\s+/).filter(Boolean);
486
+ if (tokens.length === 0) return "";
487
+ if (tokens.length === 1) return tokens[0];
488
+ const groupOwner = /* @__PURE__ */ new Map();
489
+ const slots = [];
490
+ for (const token of tokens) {
491
+ const [variants, base] = splitVariants(token);
492
+ const group = conflictGroup(base);
493
+ if (group !== null) {
494
+ const key = `${variants}::${group}`;
495
+ const prevIdx = groupOwner.get(key);
496
+ if (prevIdx !== void 0) slots[prevIdx] = null;
497
+ groupOwner.set(key, slots.length);
498
+ slots.push(token);
499
+ } else {
500
+ slots.push(token);
501
+ }
502
+ }
503
+ return slots.filter((s) => s !== null).join(" ");
504
+ }
505
+ function twMergeRawJs(classLists) {
506
+ const joined = classLists.map((s) => s.trim()).filter((s) => s.length > 0).join(" ");
507
+ if (joined.length === 0) return "";
508
+ return mergeClassStringJs(joined);
509
+ }
510
+
511
+ // packages/domain/core/src/merge.ts
512
+ var warnedFallback = false;
513
+ function warnFallbackOnce() {
514
+ if (warnedFallback) return;
515
+ warnedFallback = true;
516
+ if (typeof console !== "undefined") {
517
+ console.warn(
518
+ "[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."
519
+ );
520
+ }
521
+ }
522
+ function createTwMerge(options = {}) {
239
523
  return function twMerge2(...classLists) {
240
524
  const inputs = [];
241
525
  for (let i = 0; i < classLists.length; i++) {
@@ -244,10 +528,11 @@ function createTwMerge(_options = {}) {
244
528
  }
245
529
  if (inputs.length === 0) return "";
246
530
  const native = getNativeBinding();
247
- if (!native?.twMergeRaw) {
248
- throw new Error("Native binding 'twMergeRaw' is required but not available.");
531
+ if (native?.twMergeRaw) {
532
+ return native.twMergeRaw(inputs);
249
533
  }
250
- return native.twMergeRaw(inputs);
534
+ warnFallbackOnce();
535
+ return twMergeRawJs(inputs);
251
536
  };
252
537
  }
253
538
  var twMerge = createTwMerge();