tailwind-styled-v4 5.1.10 → 5.1.12
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 +334 -9
- 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 +342 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +342 -12
- package/dist/index.mjs.map +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/runtime-css.js +1 -0
- package/dist/runtime-css.mjs +1 -0
- package/dist/runtime.js +1 -0
- package/dist/runtime.mjs +1 -0
- 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/theme.js +1 -0
- package/dist/theme.mjs +1 -0
- 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/metafile-cjs.json +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
3
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
3
4
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
@@ -181,7 +182,7 @@ var nativeBinding = null;
|
|
|
181
182
|
var bindingLoadAttempted = false;
|
|
182
183
|
var getBinding = () => {
|
|
183
184
|
if (isBrowser2) {
|
|
184
|
-
|
|
185
|
+
return null;
|
|
185
186
|
}
|
|
186
187
|
if (nativeBinding) return nativeBinding;
|
|
187
188
|
if (bindingLoadAttempted) {
|
|
@@ -189,10 +190,10 @@ var getBinding = () => {
|
|
|
189
190
|
}
|
|
190
191
|
bindingLoadAttempted = true;
|
|
191
192
|
try {
|
|
192
|
-
const runtimeDir =
|
|
193
|
+
const runtimeDir = dirname(
|
|
193
194
|
typeof __filename !== "undefined" ? __filename : typeof import.meta !== "undefined" && import.meta.url ? fileURLToPath3(import.meta.url) : process.cwd()
|
|
194
195
|
);
|
|
195
|
-
const result =
|
|
196
|
+
const result = resolveNativeBinary(runtimeDir);
|
|
196
197
|
if (result.path && result.path.endsWith(".node")) {
|
|
197
198
|
const mod = _loadNative(result.path);
|
|
198
199
|
if (mod?.batchSplitClasses) {
|
|
@@ -331,7 +332,291 @@ function getContainerRegistry() {
|
|
|
331
332
|
|
|
332
333
|
// packages/domain/core/src/merge.ts
|
|
333
334
|
init_esm_shims();
|
|
334
|
-
|
|
335
|
+
|
|
336
|
+
// packages/domain/core/src/mergeFallback.ts
|
|
337
|
+
init_esm_shims();
|
|
338
|
+
var TEXT_SIZE_SUFFIXES = /* @__PURE__ */ new Set([
|
|
339
|
+
"xs",
|
|
340
|
+
"sm",
|
|
341
|
+
"base",
|
|
342
|
+
"lg",
|
|
343
|
+
"xl",
|
|
344
|
+
"2xl",
|
|
345
|
+
"3xl",
|
|
346
|
+
"4xl",
|
|
347
|
+
"5xl",
|
|
348
|
+
"6xl",
|
|
349
|
+
"7xl",
|
|
350
|
+
"8xl",
|
|
351
|
+
"9xl"
|
|
352
|
+
]);
|
|
353
|
+
function isTextSize(suffix) {
|
|
354
|
+
if (TEXT_SIZE_SUFFIXES.has(suffix)) return true;
|
|
355
|
+
if (suffix.startsWith("[")) return true;
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
function isAsciiDigits(s) {
|
|
359
|
+
if (s.length === 0) return true;
|
|
360
|
+
for (let i = 0; i < s.length; i++) {
|
|
361
|
+
const code = s.charCodeAt(i);
|
|
362
|
+
if (code < 48 || code > 57) return false;
|
|
363
|
+
}
|
|
364
|
+
return true;
|
|
365
|
+
}
|
|
366
|
+
function isU32(s) {
|
|
367
|
+
return s.length > 0 && /^[0-9]+$/.test(s);
|
|
368
|
+
}
|
|
369
|
+
var DISPLAY_VALUES = /* @__PURE__ */ new Set([
|
|
370
|
+
"block",
|
|
371
|
+
"inline-block",
|
|
372
|
+
"inline",
|
|
373
|
+
"flex",
|
|
374
|
+
"inline-flex",
|
|
375
|
+
"grid",
|
|
376
|
+
"inline-grid",
|
|
377
|
+
"table",
|
|
378
|
+
"inline-table",
|
|
379
|
+
"table-row",
|
|
380
|
+
"table-cell",
|
|
381
|
+
"table-column",
|
|
382
|
+
"table-caption",
|
|
383
|
+
"contents",
|
|
384
|
+
"list-item",
|
|
385
|
+
"hidden",
|
|
386
|
+
"flow-root"
|
|
387
|
+
]);
|
|
388
|
+
var POSITION_VALUES = /* @__PURE__ */ new Set(["static", "relative", "absolute", "fixed", "sticky"]);
|
|
389
|
+
var FONT_WEIGHT_NAMES = /* @__PURE__ */ new Set([
|
|
390
|
+
"thin",
|
|
391
|
+
"extralight",
|
|
392
|
+
"light",
|
|
393
|
+
"normal",
|
|
394
|
+
"medium",
|
|
395
|
+
"semibold",
|
|
396
|
+
"bold",
|
|
397
|
+
"extrabold",
|
|
398
|
+
"black"
|
|
399
|
+
]);
|
|
400
|
+
var TEXT_ALIGN_VALUES = /* @__PURE__ */ new Set(["left", "center", "right", "justify", "start", "end"]);
|
|
401
|
+
var BORDER_SIDE_PREFIXES = ["t-", "r-", "b-", "l-", "x-", "y-", "s-", "e-"];
|
|
402
|
+
var BORDER_STYLE_VALUES = /* @__PURE__ */ new Set(["solid", "dashed", "dotted", "double", "hidden", "none"]);
|
|
403
|
+
function conflictGroup(base) {
|
|
404
|
+
const bracket = base.indexOf("[");
|
|
405
|
+
if (bracket !== -1) {
|
|
406
|
+
const prefix = base.slice(0, bracket).replace(/-+$/, "");
|
|
407
|
+
return prefix.length > 0 ? prefix : "arbitrary";
|
|
408
|
+
}
|
|
409
|
+
if (DISPLAY_VALUES.has(base)) return "display";
|
|
410
|
+
if (POSITION_VALUES.has(base)) return "position";
|
|
411
|
+
if (base.startsWith("overflow-x-")) return "overflow-x";
|
|
412
|
+
if (base.startsWith("overflow-y-")) return "overflow-y";
|
|
413
|
+
if (base.startsWith("overflow-")) return "overflow";
|
|
414
|
+
if (base.startsWith("flex-")) return "flex";
|
|
415
|
+
if (base.startsWith("grid-cols-")) return "grid-cols";
|
|
416
|
+
if (base.startsWith("grid-rows-")) return "grid-rows";
|
|
417
|
+
if (base.startsWith("grid-flow-")) return "grid-flow";
|
|
418
|
+
if (base.startsWith("col-")) return "col";
|
|
419
|
+
if (base.startsWith("row-")) return "row";
|
|
420
|
+
if (base === "grow" || base.startsWith("grow-")) return "grow";
|
|
421
|
+
if (base === "shrink" || base.startsWith("shrink-")) return "shrink";
|
|
422
|
+
if (base.startsWith("gap-x-")) return "gap-x";
|
|
423
|
+
if (base.startsWith("gap-y-")) return "gap-y";
|
|
424
|
+
if (base.startsWith("gap-")) return "gap";
|
|
425
|
+
if (base.startsWith("justify-items-")) return "justify-items";
|
|
426
|
+
if (base.startsWith("justify-self-")) return "justify-self";
|
|
427
|
+
if (base.startsWith("justify-")) return "justify";
|
|
428
|
+
if (base.startsWith("items-")) return "items";
|
|
429
|
+
if (base.startsWith("self-")) return "self";
|
|
430
|
+
if (base.startsWith("place-content-")) return "place-content";
|
|
431
|
+
if (base.startsWith("place-items-")) return "place-items";
|
|
432
|
+
if (base.startsWith("place-self-")) return "place-self";
|
|
433
|
+
if (base.startsWith("content-")) return "content";
|
|
434
|
+
if (base.startsWith("px-")) return "px";
|
|
435
|
+
if (base.startsWith("py-")) return "py";
|
|
436
|
+
if (base.startsWith("pt-")) return "pt";
|
|
437
|
+
if (base.startsWith("pr-")) return "pr";
|
|
438
|
+
if (base.startsWith("pb-")) return "pb";
|
|
439
|
+
if (base.startsWith("pl-")) return "pl";
|
|
440
|
+
if (base.startsWith("ps-")) return "ps";
|
|
441
|
+
if (base.startsWith("pe-")) return "pe";
|
|
442
|
+
if (base.startsWith("p-")) return "p";
|
|
443
|
+
if (base.startsWith("mx-")) return "mx";
|
|
444
|
+
if (base.startsWith("my-")) return "my";
|
|
445
|
+
if (base.startsWith("mt-")) return "mt";
|
|
446
|
+
if (base.startsWith("mr-")) return "mr";
|
|
447
|
+
if (base.startsWith("mb-")) return "mb";
|
|
448
|
+
if (base.startsWith("ml-")) return "ml";
|
|
449
|
+
if (base.startsWith("ms-")) return "ms";
|
|
450
|
+
if (base.startsWith("me-")) return "me";
|
|
451
|
+
if (base === "-m" || base.startsWith("m-") || base.startsWith("-m-")) return "m";
|
|
452
|
+
if (base.startsWith("space-x-")) return "space-x";
|
|
453
|
+
if (base.startsWith("space-y-")) return "space-y";
|
|
454
|
+
if (base.startsWith("size-")) return "size";
|
|
455
|
+
if (base.startsWith("min-w-")) return "min-w";
|
|
456
|
+
if (base.startsWith("max-w-")) return "max-w";
|
|
457
|
+
if (base.startsWith("w-")) return "w";
|
|
458
|
+
if (base.startsWith("min-h-")) return "min-h";
|
|
459
|
+
if (base.startsWith("max-h-")) return "max-h";
|
|
460
|
+
if (base.startsWith("h-")) return "h";
|
|
461
|
+
if (base.startsWith("inset-x-")) return "inset-x";
|
|
462
|
+
if (base.startsWith("inset-y-")) return "inset-y";
|
|
463
|
+
if (base.startsWith("inset-")) return "inset";
|
|
464
|
+
if (base.startsWith("top-")) return "top";
|
|
465
|
+
if (base.startsWith("right-") || base.startsWith("end-")) return "right";
|
|
466
|
+
if (base.startsWith("bottom-")) return "bottom";
|
|
467
|
+
if (base.startsWith("left-") || base.startsWith("start-")) return "left";
|
|
468
|
+
if (base.startsWith("z-")) return "z";
|
|
469
|
+
if (base.startsWith("opacity-")) return "opacity";
|
|
470
|
+
if (base.startsWith("bg-")) {
|
|
471
|
+
if (base.startsWith("bg-opacity-")) return "bg-opacity";
|
|
472
|
+
return "bg";
|
|
473
|
+
}
|
|
474
|
+
if (base.startsWith("from-")) return "from";
|
|
475
|
+
if (base.startsWith("via-")) return "via";
|
|
476
|
+
if (base.startsWith("to-")) return "to";
|
|
477
|
+
if (base.startsWith("text-")) {
|
|
478
|
+
const suffix = base.slice("text-".length);
|
|
479
|
+
if (isTextSize(suffix)) return "text-size";
|
|
480
|
+
if (suffix.startsWith("opacity-")) return "text-opacity";
|
|
481
|
+
if (TEXT_ALIGN_VALUES.has(suffix)) return "text-align";
|
|
482
|
+
return "text-color";
|
|
483
|
+
}
|
|
484
|
+
if (base.startsWith("font-")) {
|
|
485
|
+
const suffix = base.slice("font-".length);
|
|
486
|
+
if (FONT_WEIGHT_NAMES.has(suffix) || isAsciiDigits(suffix)) return "font-weight";
|
|
487
|
+
return "font-family";
|
|
488
|
+
}
|
|
489
|
+
if (base.startsWith("leading-")) return "leading";
|
|
490
|
+
if (base.startsWith("tracking-")) return "tracking";
|
|
491
|
+
if (base.startsWith("border-")) {
|
|
492
|
+
const suffix = base.slice("border-".length);
|
|
493
|
+
const sidePrefix = BORDER_SIDE_PREFIXES.find((p) => suffix.startsWith(p));
|
|
494
|
+
if (sidePrefix) {
|
|
495
|
+
const side = suffix.slice(0, 1);
|
|
496
|
+
const rest = suffix.slice(2);
|
|
497
|
+
if (isU32(rest) || rest.length === 0) return `border-${side}-width`;
|
|
498
|
+
return `border-${side}-color`;
|
|
499
|
+
}
|
|
500
|
+
if (isU32(suffix) || suffix.length === 0) return "border-width";
|
|
501
|
+
if (suffix.startsWith("opacity-")) return "border-opacity";
|
|
502
|
+
if (suffix === "collapse" || suffix === "separate") return "border-collapse";
|
|
503
|
+
if (BORDER_STYLE_VALUES.has(suffix)) return "border-style";
|
|
504
|
+
return "border-color";
|
|
505
|
+
}
|
|
506
|
+
if (base === "border") return "border-width";
|
|
507
|
+
if (base.startsWith("outline-")) return "outline";
|
|
508
|
+
if (base === "outline") return "outline";
|
|
509
|
+
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")) {
|
|
510
|
+
const firstChar = base.slice("rounded-".length).charAt(0) || "x";
|
|
511
|
+
return `rounded-${firstChar}`;
|
|
512
|
+
}
|
|
513
|
+
if (base === "rounded" || base.startsWith("rounded-")) return "rounded";
|
|
514
|
+
if (base === "shadow" || base.startsWith("shadow-")) return "shadow";
|
|
515
|
+
if (base.startsWith("ring-offset-")) return "ring-offset";
|
|
516
|
+
if (base === "ring") return "ring-width";
|
|
517
|
+
if (base.startsWith("ring-")) {
|
|
518
|
+
const rest = base.slice("ring-".length);
|
|
519
|
+
const isWidth = rest === "0" || rest === "1" || rest === "2" || rest === "4" || rest === "8" || /^-?\d+(\.\d+)?$/.test(rest) || rest.startsWith("[") && rest.endsWith("]");
|
|
520
|
+
if (isWidth) return "ring-width";
|
|
521
|
+
if (rest === "inset") return "ring-inset";
|
|
522
|
+
return "ring-color";
|
|
523
|
+
}
|
|
524
|
+
if (base.startsWith("rotate-")) return "rotate";
|
|
525
|
+
if (base.startsWith("scale-x-")) return "scale-x";
|
|
526
|
+
if (base.startsWith("scale-y-")) return "scale-y";
|
|
527
|
+
if (base.startsWith("scale-")) return "scale";
|
|
528
|
+
if (base.startsWith("translate-x-")) return "translate-x";
|
|
529
|
+
if (base.startsWith("translate-y-")) return "translate-y";
|
|
530
|
+
if (base.startsWith("skew-x-")) return "skew-x";
|
|
531
|
+
if (base.startsWith("skew-y-")) return "skew-y";
|
|
532
|
+
if (base === "transition" || base.startsWith("transition-")) return "transition";
|
|
533
|
+
if (base.startsWith("duration-")) return "duration";
|
|
534
|
+
if (base.startsWith("ease-")) return "ease";
|
|
535
|
+
if (base.startsWith("delay-")) return "delay";
|
|
536
|
+
if (base === "animate" || base.startsWith("animate-")) return "animate";
|
|
537
|
+
if (base.startsWith("cursor-")) return "cursor";
|
|
538
|
+
if (base.startsWith("pointer-events-")) return "pointer-events";
|
|
539
|
+
if (base.startsWith("select-")) return "select";
|
|
540
|
+
if (base === "visible" || base === "invisible" || base === "collapse") return "visibility";
|
|
541
|
+
if (base.startsWith("object-")) return "object";
|
|
542
|
+
if (base.startsWith("aspect-")) return "aspect";
|
|
543
|
+
if (base.startsWith("order-")) return "order";
|
|
544
|
+
if (base.startsWith("whitespace-")) return "whitespace";
|
|
545
|
+
if (base.startsWith("list-")) return "list";
|
|
546
|
+
if (base.startsWith("fill-")) return "fill";
|
|
547
|
+
if (base.startsWith("stroke-")) return "stroke";
|
|
548
|
+
if (base.startsWith("backdrop-")) {
|
|
549
|
+
const rest = base.slice("backdrop-".length);
|
|
550
|
+
const seg = rest.split("-")[0] || "x";
|
|
551
|
+
return `backdrop-${seg}`;
|
|
552
|
+
}
|
|
553
|
+
if (base.startsWith("scroll-")) return "scroll";
|
|
554
|
+
if (base.startsWith("snap-")) return "snap";
|
|
555
|
+
if (base.startsWith("touch-")) return "touch";
|
|
556
|
+
if (base.startsWith("decoration-")) return "text-decoration";
|
|
557
|
+
if (base.startsWith("caret-")) return "caret";
|
|
558
|
+
if (base.startsWith("accent-")) return "accent";
|
|
559
|
+
if (base.startsWith("appearance-")) return "appearance";
|
|
560
|
+
if (base === "isolate" || base === "isolation-auto") return "isolation";
|
|
561
|
+
if (base.startsWith("mix-blend-")) return "mix-blend";
|
|
562
|
+
if (base.startsWith("bg-blend-")) return "bg-blend";
|
|
563
|
+
if (base.startsWith("float-")) return "float";
|
|
564
|
+
if (base.startsWith("clear-")) return "clear";
|
|
565
|
+
if (base.startsWith("break-")) return "break";
|
|
566
|
+
if (base.startsWith("columns-")) return "columns";
|
|
567
|
+
return null;
|
|
568
|
+
}
|
|
569
|
+
function splitVariants(klass) {
|
|
570
|
+
let depth = 0;
|
|
571
|
+
let lastColon = 0;
|
|
572
|
+
for (let i = 0; i < klass.length; i++) {
|
|
573
|
+
const ch = klass.charCodeAt(i);
|
|
574
|
+
if (ch === 91) depth++;
|
|
575
|
+
else if (ch === 93) depth = depth > 0 ? depth - 1 : 0;
|
|
576
|
+
else if (ch === 58 && depth === 0) lastColon = i + 1;
|
|
577
|
+
}
|
|
578
|
+
if (lastColon === 0) return ["", klass];
|
|
579
|
+
return [klass.slice(0, lastColon), klass.slice(lastColon)];
|
|
580
|
+
}
|
|
581
|
+
function mergeClassStringJs(input) {
|
|
582
|
+
const tokens = input.split(/\s+/).filter(Boolean);
|
|
583
|
+
if (tokens.length === 0) return "";
|
|
584
|
+
if (tokens.length === 1) return tokens[0];
|
|
585
|
+
const groupOwner = /* @__PURE__ */ new Map();
|
|
586
|
+
const slots = [];
|
|
587
|
+
for (const token of tokens) {
|
|
588
|
+
const [variants, base] = splitVariants(token);
|
|
589
|
+
const group = conflictGroup(base);
|
|
590
|
+
if (group !== null) {
|
|
591
|
+
const key = `${variants}::${group}`;
|
|
592
|
+
const prevIdx = groupOwner.get(key);
|
|
593
|
+
if (prevIdx !== void 0) slots[prevIdx] = null;
|
|
594
|
+
groupOwner.set(key, slots.length);
|
|
595
|
+
slots.push(token);
|
|
596
|
+
} else {
|
|
597
|
+
slots.push(token);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return slots.filter((s) => s !== null).join(" ");
|
|
601
|
+
}
|
|
602
|
+
function twMergeRawJs(classLists) {
|
|
603
|
+
const joined = classLists.map((s) => s.trim()).filter((s) => s.length > 0).join(" ");
|
|
604
|
+
if (joined.length === 0) return "";
|
|
605
|
+
return mergeClassStringJs(joined);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
// packages/domain/core/src/merge.ts
|
|
609
|
+
var warnedFallback = false;
|
|
610
|
+
function warnFallbackOnce() {
|
|
611
|
+
if (warnedFallback) return;
|
|
612
|
+
warnedFallback = true;
|
|
613
|
+
if (typeof console !== "undefined") {
|
|
614
|
+
console.warn(
|
|
615
|
+
"[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."
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
function createTwMerge(options = {}) {
|
|
335
620
|
return function twMerge2(...classLists) {
|
|
336
621
|
const inputs = [];
|
|
337
622
|
for (let i = 0; i < classLists.length; i++) {
|
|
@@ -340,10 +625,11 @@ function createTwMerge(_options = {}) {
|
|
|
340
625
|
}
|
|
341
626
|
if (inputs.length === 0) return "";
|
|
342
627
|
const native = getNativeBinding();
|
|
343
|
-
if (
|
|
344
|
-
|
|
628
|
+
if (native?.twMergeRaw) {
|
|
629
|
+
return native.twMergeRaw(inputs);
|
|
345
630
|
}
|
|
346
|
-
|
|
631
|
+
warnFallbackOnce();
|
|
632
|
+
return twMergeRawJs(inputs);
|
|
347
633
|
};
|
|
348
634
|
}
|
|
349
635
|
var twMerge = createTwMerge();
|
|
@@ -833,8 +1119,49 @@ function wrapWithSubProxy(component, tagLabel) {
|
|
|
833
1119
|
});
|
|
834
1120
|
}
|
|
835
1121
|
|
|
1122
|
+
// packages/domain/core/src/parseTemplateFallback.ts
|
|
1123
|
+
init_esm_shims();
|
|
1124
|
+
var SUB_RE = /(?:\[([a-zA-Z][a-zA-Z0-9_-]*)\]|([a-zA-Z][a-zA-Z0-9_-]*))\s*\{([^}]*)\}/g;
|
|
1125
|
+
var COMMENT_RE = /\/\/[^\n]*/g;
|
|
1126
|
+
function collapseSpaces(s) {
|
|
1127
|
+
return s.replace(/\s+/g, " ").trim();
|
|
1128
|
+
}
|
|
1129
|
+
function cleanBlock(raw) {
|
|
1130
|
+
const noComments = raw.replace(COMMENT_RE, "");
|
|
1131
|
+
const lines = noComments.split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
|
|
1132
|
+
return collapseSpaces(lines.join(" "));
|
|
1133
|
+
}
|
|
1134
|
+
function parseTemplateJs(raw) {
|
|
1135
|
+
const subs = {};
|
|
1136
|
+
let base = raw;
|
|
1137
|
+
for (const match of raw.matchAll(SUB_RE)) {
|
|
1138
|
+
const fullMatch = match[0];
|
|
1139
|
+
const name = match[1] ?? match[2] ?? "";
|
|
1140
|
+
const innerRaw = match[3] ?? "";
|
|
1141
|
+
if (name) {
|
|
1142
|
+
subs[name] = cleanBlock(innerRaw);
|
|
1143
|
+
}
|
|
1144
|
+
base = base.replace(fullMatch, "");
|
|
1145
|
+
}
|
|
1146
|
+
return {
|
|
1147
|
+
base: cleanBlock(base),
|
|
1148
|
+
subs,
|
|
1149
|
+
hasSubs: Object.keys(subs).length > 0
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
|
|
836
1153
|
// packages/domain/core/src/twProxy.ts
|
|
837
1154
|
var _parsedTemplateCache = /* @__PURE__ */ new Map();
|
|
1155
|
+
var warnedParseTemplateFallback = false;
|
|
1156
|
+
function warnParseTemplateFallbackOnce() {
|
|
1157
|
+
if (warnedParseTemplateFallback) return;
|
|
1158
|
+
warnedParseTemplateFallback = true;
|
|
1159
|
+
if (typeof console !== "undefined") {
|
|
1160
|
+
console.warn(
|
|
1161
|
+
"[tailwind-styled-v4] Native binding 'parseTemplate' tidak tersedia (normal di browser, untuk komponen yang di-chain dengan .extend/.withVariants/.animate/.withSub) \u2014 pakai pure-TS port dari algoritma Rust-nya. Hasil tetap benar; ini cuma informasi, bukan error."
|
|
1162
|
+
);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
838
1165
|
function parseTemplate(strings, exprs) {
|
|
839
1166
|
const raw = strings.raw.reduce((acc, str, i) => {
|
|
840
1167
|
const expr = exprs[i];
|
|
@@ -844,12 +1171,15 @@ function parseTemplate(strings, exprs) {
|
|
|
844
1171
|
const cached = _parsedTemplateCache.get(raw);
|
|
845
1172
|
if (cached) return cached;
|
|
846
1173
|
const binding = getNativeBinding();
|
|
847
|
-
|
|
848
|
-
|
|
1174
|
+
let result;
|
|
1175
|
+
if (binding?.parseTemplate) {
|
|
1176
|
+
const r = binding.parseTemplate(raw);
|
|
1177
|
+
const subs = r.hasSubs ? JSON.parse(r.subsJson) : {};
|
|
1178
|
+
result = { base: r.base, subs, hasSubs: r.hasSubs };
|
|
1179
|
+
} else {
|
|
1180
|
+
warnParseTemplateFallbackOnce();
|
|
1181
|
+
result = parseTemplateJs(raw);
|
|
849
1182
|
}
|
|
850
|
-
const r = binding.parseTemplate(raw);
|
|
851
|
-
const subs = r.hasSubs ? JSON.parse(r.subsJson) : {};
|
|
852
|
-
const result = { base: r.base, subs, hasSubs: r.hasSubs };
|
|
853
1183
|
_parsedTemplateCache.set(raw, result);
|
|
854
1184
|
return result;
|
|
855
1185
|
}
|