@mgcrea/react-native-tailwind 0.5.0 → 0.5.2
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/README.md +281 -320
- package/dist/babel/index.cjs +109 -80
- package/dist/parser/__snapshots__/aspectRatio.test.js.snap +9 -0
- package/dist/parser/__snapshots__/borders.test.js.snap +23 -0
- package/dist/parser/__snapshots__/colors.test.js.snap +99 -0
- package/dist/parser/__snapshots__/shadows.test.js.snap +76 -0
- package/dist/parser/__snapshots__/sizing.test.js.snap +61 -0
- package/dist/parser/__snapshots__/spacing.test.js.snap +40 -0
- package/dist/parser/__snapshots__/typography.test.js.snap +30 -0
- package/dist/parser/layout.js +1 -1
- package/dist/parser/layout.test.js +1 -1
- package/dist/parser/shadows.d.ts +9 -13
- package/dist/parser/shadows.js +1 -1
- package/dist/parser/shadows.test.js +1 -1
- package/dist/react-native.d.ts +1 -1
- package/dist/types.d.ts +4 -6
- package/package.json +1 -1
- package/src/parser/layout.test.ts +92 -0
- package/src/parser/layout.ts +122 -16
- package/src/parser/shadows.test.ts +20 -29
- package/src/parser/shadows.ts +45 -94
- package/src/react-native.d.ts +1 -1
- package/src/types.ts +1 -3
package/dist/babel/index.cjs
CHANGED
|
@@ -452,6 +452,40 @@ function parseColor(cls, customColors) {
|
|
|
452
452
|
}
|
|
453
453
|
|
|
454
454
|
// src/parser/layout.ts
|
|
455
|
+
function parseArbitraryInset(value) {
|
|
456
|
+
const pxMatch = value.match(/^\[(-?\d+)(?:px)?\]$/);
|
|
457
|
+
if (pxMatch) {
|
|
458
|
+
return parseInt(pxMatch[1], 10);
|
|
459
|
+
}
|
|
460
|
+
const percentMatch = value.match(/^\[(-?\d+(?:\.\d+)?)%\]$/);
|
|
461
|
+
if (percentMatch) {
|
|
462
|
+
return `${percentMatch[1]}%`;
|
|
463
|
+
}
|
|
464
|
+
if (value.startsWith("[") && value.endsWith("]")) {
|
|
465
|
+
if (process.env.NODE_ENV !== "production") {
|
|
466
|
+
console.warn(
|
|
467
|
+
`[react-native-tailwind] Unsupported arbitrary inset unit: ${value}. Only px and % are supported.`
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
return null;
|
|
471
|
+
}
|
|
472
|
+
return null;
|
|
473
|
+
}
|
|
474
|
+
function parseArbitraryZIndex(value) {
|
|
475
|
+
const zMatch = value.match(/^\[(-?\d+)\]$/);
|
|
476
|
+
if (zMatch) {
|
|
477
|
+
return parseInt(zMatch[1], 10);
|
|
478
|
+
}
|
|
479
|
+
if (value.startsWith("[") && value.endsWith("]")) {
|
|
480
|
+
if (process.env.NODE_ENV !== "production") {
|
|
481
|
+
console.warn(
|
|
482
|
+
`[react-native-tailwind] Invalid arbitrary z-index: ${value}. Only integers are supported.`
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
return null;
|
|
486
|
+
}
|
|
487
|
+
return null;
|
|
488
|
+
}
|
|
455
489
|
var DISPLAY_MAP = {
|
|
456
490
|
flex: { display: "flex" },
|
|
457
491
|
hidden: { display: "none" }
|
|
@@ -550,6 +584,10 @@ var INSET_SCALE = {
|
|
|
550
584
|
function parseLayout(cls) {
|
|
551
585
|
if (cls.startsWith("z-")) {
|
|
552
586
|
const zKey = cls.substring(2);
|
|
587
|
+
const arbitraryZ = parseArbitraryZIndex(zKey);
|
|
588
|
+
if (arbitraryZ !== null) {
|
|
589
|
+
return { zIndex: arbitraryZ };
|
|
590
|
+
}
|
|
553
591
|
const zValue = Z_INDEX_SCALE[zKey];
|
|
554
592
|
if (zValue !== void 0) {
|
|
555
593
|
return { zIndex: zValue };
|
|
@@ -560,6 +598,10 @@ function parseLayout(cls) {
|
|
|
560
598
|
if (topKey === "auto") {
|
|
561
599
|
return {};
|
|
562
600
|
}
|
|
601
|
+
const arbitraryTop = parseArbitraryInset(topKey);
|
|
602
|
+
if (arbitraryTop !== null) {
|
|
603
|
+
return { top: arbitraryTop };
|
|
604
|
+
}
|
|
563
605
|
const topValue = INSET_SCALE[topKey];
|
|
564
606
|
if (topValue !== void 0) {
|
|
565
607
|
return { top: topValue };
|
|
@@ -570,6 +612,10 @@ function parseLayout(cls) {
|
|
|
570
612
|
if (rightKey === "auto") {
|
|
571
613
|
return {};
|
|
572
614
|
}
|
|
615
|
+
const arbitraryRight = parseArbitraryInset(rightKey);
|
|
616
|
+
if (arbitraryRight !== null) {
|
|
617
|
+
return { right: arbitraryRight };
|
|
618
|
+
}
|
|
573
619
|
const rightValue = INSET_SCALE[rightKey];
|
|
574
620
|
if (rightValue !== void 0) {
|
|
575
621
|
return { right: rightValue };
|
|
@@ -580,6 +626,10 @@ function parseLayout(cls) {
|
|
|
580
626
|
if (bottomKey === "auto") {
|
|
581
627
|
return {};
|
|
582
628
|
}
|
|
629
|
+
const arbitraryBottom = parseArbitraryInset(bottomKey);
|
|
630
|
+
if (arbitraryBottom !== null) {
|
|
631
|
+
return { bottom: arbitraryBottom };
|
|
632
|
+
}
|
|
583
633
|
const bottomValue = INSET_SCALE[bottomKey];
|
|
584
634
|
if (bottomValue !== void 0) {
|
|
585
635
|
return { bottom: bottomValue };
|
|
@@ -590,20 +640,21 @@ function parseLayout(cls) {
|
|
|
590
640
|
if (leftKey === "auto") {
|
|
591
641
|
return {};
|
|
592
642
|
}
|
|
643
|
+
const arbitraryLeft = parseArbitraryInset(leftKey);
|
|
644
|
+
if (arbitraryLeft !== null) {
|
|
645
|
+
return { left: arbitraryLeft };
|
|
646
|
+
}
|
|
593
647
|
const leftValue = INSET_SCALE[leftKey];
|
|
594
648
|
if (leftValue !== void 0) {
|
|
595
649
|
return { left: leftValue };
|
|
596
650
|
}
|
|
597
651
|
}
|
|
598
|
-
if (cls.startsWith("inset-")) {
|
|
599
|
-
const insetKey = cls.substring(6);
|
|
600
|
-
const insetValue = INSET_SCALE[insetKey];
|
|
601
|
-
if (insetValue !== void 0) {
|
|
602
|
-
return { top: insetValue, right: insetValue, bottom: insetValue, left: insetValue };
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
652
|
if (cls.startsWith("inset-x-")) {
|
|
606
653
|
const insetKey = cls.substring(8);
|
|
654
|
+
const arbitraryInset = parseArbitraryInset(insetKey);
|
|
655
|
+
if (arbitraryInset !== null) {
|
|
656
|
+
return { left: arbitraryInset, right: arbitraryInset };
|
|
657
|
+
}
|
|
607
658
|
const insetValue = INSET_SCALE[insetKey];
|
|
608
659
|
if (insetValue !== void 0) {
|
|
609
660
|
return { left: insetValue, right: insetValue };
|
|
@@ -611,103 +662,81 @@ function parseLayout(cls) {
|
|
|
611
662
|
}
|
|
612
663
|
if (cls.startsWith("inset-y-")) {
|
|
613
664
|
const insetKey = cls.substring(8);
|
|
665
|
+
const arbitraryInset = parseArbitraryInset(insetKey);
|
|
666
|
+
if (arbitraryInset !== null) {
|
|
667
|
+
return { top: arbitraryInset, bottom: arbitraryInset };
|
|
668
|
+
}
|
|
614
669
|
const insetValue = INSET_SCALE[insetKey];
|
|
615
670
|
if (insetValue !== void 0) {
|
|
616
671
|
return { top: insetValue, bottom: insetValue };
|
|
617
672
|
}
|
|
618
673
|
}
|
|
674
|
+
if (cls.startsWith("inset-")) {
|
|
675
|
+
const insetKey = cls.substring(6);
|
|
676
|
+
const arbitraryInset = parseArbitraryInset(insetKey);
|
|
677
|
+
if (arbitraryInset !== null) {
|
|
678
|
+
return { top: arbitraryInset, right: arbitraryInset, bottom: arbitraryInset, left: arbitraryInset };
|
|
679
|
+
}
|
|
680
|
+
const insetValue = INSET_SCALE[insetKey];
|
|
681
|
+
if (insetValue !== void 0) {
|
|
682
|
+
return { top: insetValue, right: insetValue, bottom: insetValue, left: insetValue };
|
|
683
|
+
}
|
|
684
|
+
}
|
|
619
685
|
return DISPLAY_MAP[cls] ?? FLEX_DIRECTION_MAP[cls] ?? FLEX_WRAP_MAP[cls] ?? FLEX_MAP[cls] ?? GROW_SHRINK_MAP[cls] ?? JUSTIFY_CONTENT_MAP[cls] ?? ALIGN_ITEMS_MAP[cls] ?? ALIGN_SELF_MAP[cls] ?? ALIGN_CONTENT_MAP[cls] ?? POSITION_MAP[cls] ?? OVERFLOW_MAP[cls] ?? null;
|
|
620
686
|
}
|
|
621
687
|
|
|
622
688
|
// src/parser/shadows.ts
|
|
623
|
-
var
|
|
624
|
-
var SHADOW_DEFINITIONS = {
|
|
689
|
+
var SHADOW_SCALE = {
|
|
625
690
|
"shadow-sm": {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
},
|
|
632
|
-
android: {
|
|
633
|
-
elevation: 1
|
|
634
|
-
}
|
|
691
|
+
shadowColor: "#000000",
|
|
692
|
+
shadowOffset: { width: 0, height: 1 },
|
|
693
|
+
shadowOpacity: 0.05,
|
|
694
|
+
shadowRadius: 1,
|
|
695
|
+
elevation: 1
|
|
635
696
|
},
|
|
636
697
|
shadow: {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
},
|
|
643
|
-
android: {
|
|
644
|
-
elevation: 2
|
|
645
|
-
}
|
|
698
|
+
shadowColor: "#000000",
|
|
699
|
+
shadowOffset: { width: 0, height: 1 },
|
|
700
|
+
shadowOpacity: 0.1,
|
|
701
|
+
shadowRadius: 2,
|
|
702
|
+
elevation: 2
|
|
646
703
|
},
|
|
647
704
|
"shadow-md": {
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
},
|
|
654
|
-
android: {
|
|
655
|
-
elevation: 4
|
|
656
|
-
}
|
|
705
|
+
shadowColor: "#000000",
|
|
706
|
+
shadowOffset: { width: 0, height: 3 },
|
|
707
|
+
shadowOpacity: 0.15,
|
|
708
|
+
shadowRadius: 4,
|
|
709
|
+
elevation: 4
|
|
657
710
|
},
|
|
658
711
|
"shadow-lg": {
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
},
|
|
665
|
-
android: {
|
|
666
|
-
elevation: 8
|
|
667
|
-
}
|
|
712
|
+
shadowColor: "#000000",
|
|
713
|
+
shadowOffset: { width: 0, height: 6 },
|
|
714
|
+
shadowOpacity: 0.2,
|
|
715
|
+
shadowRadius: 8,
|
|
716
|
+
elevation: 8
|
|
668
717
|
},
|
|
669
718
|
"shadow-xl": {
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
},
|
|
676
|
-
android: {
|
|
677
|
-
elevation: 12
|
|
678
|
-
}
|
|
719
|
+
shadowColor: "#000000",
|
|
720
|
+
shadowOffset: { width: 0, height: 10 },
|
|
721
|
+
shadowOpacity: 0.25,
|
|
722
|
+
shadowRadius: 12,
|
|
723
|
+
elevation: 12
|
|
679
724
|
},
|
|
680
725
|
"shadow-2xl": {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
},
|
|
687
|
-
android: {
|
|
688
|
-
elevation: 16
|
|
689
|
-
}
|
|
726
|
+
shadowColor: "#000000",
|
|
727
|
+
shadowOffset: { width: 0, height: 20 },
|
|
728
|
+
shadowOpacity: 0.3,
|
|
729
|
+
shadowRadius: 24,
|
|
730
|
+
elevation: 16
|
|
690
731
|
},
|
|
691
732
|
"shadow-none": {
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
},
|
|
698
|
-
android: {
|
|
699
|
-
elevation: 0
|
|
700
|
-
}
|
|
733
|
+
shadowColor: "transparent",
|
|
734
|
+
shadowOffset: { width: 0, height: 0 },
|
|
735
|
+
shadowOpacity: 0,
|
|
736
|
+
shadowRadius: 0,
|
|
737
|
+
elevation: 0
|
|
701
738
|
}
|
|
702
739
|
};
|
|
703
|
-
function buildShadowScale() {
|
|
704
|
-
const scale = {};
|
|
705
|
-
for (const [key, value] of Object.entries(SHADOW_DEFINITIONS)) {
|
|
706
|
-
scale[key] = import_react_native.Platform.select(value);
|
|
707
|
-
}
|
|
708
|
-
return scale;
|
|
709
|
-
}
|
|
710
|
-
var SHADOW_SCALE = buildShadowScale();
|
|
711
740
|
function parseShadow(cls) {
|
|
712
741
|
if (cls in SHADOW_SCALE) {
|
|
713
742
|
return SHADOW_SCALE[cls];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
|
+
|
|
3
|
+
exports[`BORDER_WIDTH_SCALE should export complete border width scale 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"0": 0,
|
|
6
|
+
"2": 2,
|
|
7
|
+
"4": 4,
|
|
8
|
+
"8": 8,
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
exports[`BORDER_RADIUS_SCALE should export complete border radius scale 1`] = `
|
|
13
|
+
{
|
|
14
|
+
"2xl": 16,
|
|
15
|
+
"3xl": 24,
|
|
16
|
+
"full": 9999,
|
|
17
|
+
"lg": 8,
|
|
18
|
+
"md": 6,
|
|
19
|
+
"none": 0,
|
|
20
|
+
"sm": 2,
|
|
21
|
+
"xl": 12,
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
|
+
|
|
3
|
+
exports[`COLORS should export complete color palette 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"black": "#000000",
|
|
6
|
+
"blue-100": "#DBEAFE",
|
|
7
|
+
"blue-200": "#BFDBFE",
|
|
8
|
+
"blue-300": "#93C5FD",
|
|
9
|
+
"blue-400": "#60A5FA",
|
|
10
|
+
"blue-50": "#EFF6FF",
|
|
11
|
+
"blue-500": "#3B82F6",
|
|
12
|
+
"blue-600": "#2563EB",
|
|
13
|
+
"blue-700": "#1D4ED8",
|
|
14
|
+
"blue-800": "#1E40AF",
|
|
15
|
+
"blue-900": "#1E3A8A",
|
|
16
|
+
"gray-100": "#F3F4F6",
|
|
17
|
+
"gray-200": "#E5E7EB",
|
|
18
|
+
"gray-300": "#D1D5DB",
|
|
19
|
+
"gray-400": "#9CA3AF",
|
|
20
|
+
"gray-50": "#F9FAFB",
|
|
21
|
+
"gray-500": "#6B7280",
|
|
22
|
+
"gray-600": "#4B5563",
|
|
23
|
+
"gray-700": "#374151",
|
|
24
|
+
"gray-800": "#1F2937",
|
|
25
|
+
"gray-900": "#111827",
|
|
26
|
+
"green-100": "#DCFCE7",
|
|
27
|
+
"green-200": "#BBF7D0",
|
|
28
|
+
"green-300": "#86EFAC",
|
|
29
|
+
"green-400": "#4ADE80",
|
|
30
|
+
"green-50": "#F0FDF4",
|
|
31
|
+
"green-500": "#22C55E",
|
|
32
|
+
"green-600": "#16A34A",
|
|
33
|
+
"green-700": "#15803D",
|
|
34
|
+
"green-800": "#166534",
|
|
35
|
+
"green-900": "#14532D",
|
|
36
|
+
"indigo-100": "#E0E7FF",
|
|
37
|
+
"indigo-200": "#C7D2FE",
|
|
38
|
+
"indigo-300": "#A5B4FC",
|
|
39
|
+
"indigo-400": "#818CF8",
|
|
40
|
+
"indigo-50": "#EEF2FF",
|
|
41
|
+
"indigo-500": "#6366F1",
|
|
42
|
+
"indigo-600": "#4F46E5",
|
|
43
|
+
"indigo-700": "#4338CA",
|
|
44
|
+
"indigo-800": "#3730A3",
|
|
45
|
+
"indigo-900": "#312E81",
|
|
46
|
+
"orange-100": "#FFEDD5",
|
|
47
|
+
"orange-200": "#FED7AA",
|
|
48
|
+
"orange-300": "#FDBA74",
|
|
49
|
+
"orange-400": "#FB923C",
|
|
50
|
+
"orange-50": "#FFF7ED",
|
|
51
|
+
"orange-500": "#F97316",
|
|
52
|
+
"orange-600": "#EA580C",
|
|
53
|
+
"orange-700": "#C2410C",
|
|
54
|
+
"orange-800": "#9A3412",
|
|
55
|
+
"orange-900": "#7C2D12",
|
|
56
|
+
"pink-100": "#FCE7F3",
|
|
57
|
+
"pink-200": "#FBCFE8",
|
|
58
|
+
"pink-300": "#F9A8D4",
|
|
59
|
+
"pink-400": "#F472B6",
|
|
60
|
+
"pink-50": "#FDF2F8",
|
|
61
|
+
"pink-500": "#EC4899",
|
|
62
|
+
"pink-600": "#DB2777",
|
|
63
|
+
"pink-700": "#BE185D",
|
|
64
|
+
"pink-800": "#9D174D",
|
|
65
|
+
"pink-900": "#831843",
|
|
66
|
+
"purple-100": "#F3E8FF",
|
|
67
|
+
"purple-200": "#E9D5FF",
|
|
68
|
+
"purple-300": "#D8B4FE",
|
|
69
|
+
"purple-400": "#C084FC",
|
|
70
|
+
"purple-50": "#FAF5FF",
|
|
71
|
+
"purple-500": "#A855F7",
|
|
72
|
+
"purple-600": "#9333EA",
|
|
73
|
+
"purple-700": "#7E22CE",
|
|
74
|
+
"purple-800": "#6B21A8",
|
|
75
|
+
"purple-900": "#581C87",
|
|
76
|
+
"red-100": "#FEE2E2",
|
|
77
|
+
"red-200": "#FECACA",
|
|
78
|
+
"red-300": "#FCA5A5",
|
|
79
|
+
"red-400": "#F87171",
|
|
80
|
+
"red-50": "#FEF2F2",
|
|
81
|
+
"red-500": "#EF4444",
|
|
82
|
+
"red-600": "#DC2626",
|
|
83
|
+
"red-700": "#B91C1C",
|
|
84
|
+
"red-800": "#991B1B",
|
|
85
|
+
"red-900": "#7F1D1D",
|
|
86
|
+
"transparent": "transparent",
|
|
87
|
+
"white": "#FFFFFF",
|
|
88
|
+
"yellow-100": "#FEF9C3",
|
|
89
|
+
"yellow-200": "#FEF08A",
|
|
90
|
+
"yellow-300": "#FDE047",
|
|
91
|
+
"yellow-400": "#FACC15",
|
|
92
|
+
"yellow-50": "#FEFCE8",
|
|
93
|
+
"yellow-500": "#EAB308",
|
|
94
|
+
"yellow-600": "#CA8A04",
|
|
95
|
+
"yellow-700": "#A16207",
|
|
96
|
+
"yellow-800": "#854D0E",
|
|
97
|
+
"yellow-900": "#713F12",
|
|
98
|
+
}
|
|
99
|
+
`;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
|
+
|
|
3
|
+
exports[`SHADOW_SCALE should export complete shadow scale 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"shadow": {
|
|
6
|
+
"elevation": 2,
|
|
7
|
+
"shadowColor": "#000000",
|
|
8
|
+
"shadowOffset": {
|
|
9
|
+
"height": 1,
|
|
10
|
+
"width": 0,
|
|
11
|
+
},
|
|
12
|
+
"shadowOpacity": 0.1,
|
|
13
|
+
"shadowRadius": 2,
|
|
14
|
+
},
|
|
15
|
+
"shadow-2xl": {
|
|
16
|
+
"elevation": 16,
|
|
17
|
+
"shadowColor": "#000000",
|
|
18
|
+
"shadowOffset": {
|
|
19
|
+
"height": 20,
|
|
20
|
+
"width": 0,
|
|
21
|
+
},
|
|
22
|
+
"shadowOpacity": 0.3,
|
|
23
|
+
"shadowRadius": 24,
|
|
24
|
+
},
|
|
25
|
+
"shadow-lg": {
|
|
26
|
+
"elevation": 8,
|
|
27
|
+
"shadowColor": "#000000",
|
|
28
|
+
"shadowOffset": {
|
|
29
|
+
"height": 6,
|
|
30
|
+
"width": 0,
|
|
31
|
+
},
|
|
32
|
+
"shadowOpacity": 0.2,
|
|
33
|
+
"shadowRadius": 8,
|
|
34
|
+
},
|
|
35
|
+
"shadow-md": {
|
|
36
|
+
"elevation": 4,
|
|
37
|
+
"shadowColor": "#000000",
|
|
38
|
+
"shadowOffset": {
|
|
39
|
+
"height": 3,
|
|
40
|
+
"width": 0,
|
|
41
|
+
},
|
|
42
|
+
"shadowOpacity": 0.15,
|
|
43
|
+
"shadowRadius": 4,
|
|
44
|
+
},
|
|
45
|
+
"shadow-none": {
|
|
46
|
+
"elevation": 0,
|
|
47
|
+
"shadowColor": "transparent",
|
|
48
|
+
"shadowOffset": {
|
|
49
|
+
"height": 0,
|
|
50
|
+
"width": 0,
|
|
51
|
+
},
|
|
52
|
+
"shadowOpacity": 0,
|
|
53
|
+
"shadowRadius": 0,
|
|
54
|
+
},
|
|
55
|
+
"shadow-sm": {
|
|
56
|
+
"elevation": 1,
|
|
57
|
+
"shadowColor": "#000000",
|
|
58
|
+
"shadowOffset": {
|
|
59
|
+
"height": 1,
|
|
60
|
+
"width": 0,
|
|
61
|
+
},
|
|
62
|
+
"shadowOpacity": 0.05,
|
|
63
|
+
"shadowRadius": 1,
|
|
64
|
+
},
|
|
65
|
+
"shadow-xl": {
|
|
66
|
+
"elevation": 12,
|
|
67
|
+
"shadowColor": "#000000",
|
|
68
|
+
"shadowOffset": {
|
|
69
|
+
"height": 10,
|
|
70
|
+
"width": 0,
|
|
71
|
+
},
|
|
72
|
+
"shadowOpacity": 0.25,
|
|
73
|
+
"shadowRadius": 12,
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
|
+
|
|
3
|
+
exports[`SIZE_SCALE should export complete size scale 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"0": 0,
|
|
6
|
+
"0.5": 2,
|
|
7
|
+
"1": 4,
|
|
8
|
+
"1.5": 6,
|
|
9
|
+
"10": 40,
|
|
10
|
+
"11": 44,
|
|
11
|
+
"12": 48,
|
|
12
|
+
"14": 56,
|
|
13
|
+
"16": 64,
|
|
14
|
+
"2": 8,
|
|
15
|
+
"2.5": 10,
|
|
16
|
+
"20": 80,
|
|
17
|
+
"24": 96,
|
|
18
|
+
"28": 112,
|
|
19
|
+
"3": 12,
|
|
20
|
+
"3.5": 14,
|
|
21
|
+
"32": 128,
|
|
22
|
+
"36": 144,
|
|
23
|
+
"4": 16,
|
|
24
|
+
"40": 160,
|
|
25
|
+
"44": 176,
|
|
26
|
+
"48": 192,
|
|
27
|
+
"5": 20,
|
|
28
|
+
"52": 208,
|
|
29
|
+
"56": 224,
|
|
30
|
+
"6": 24,
|
|
31
|
+
"60": 240,
|
|
32
|
+
"64": 256,
|
|
33
|
+
"7": 28,
|
|
34
|
+
"72": 288,
|
|
35
|
+
"8": 32,
|
|
36
|
+
"80": 320,
|
|
37
|
+
"9": 36,
|
|
38
|
+
"96": 384,
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
exports[`SIZE_PERCENTAGES should export complete percentage sizes 1`] = `
|
|
43
|
+
{
|
|
44
|
+
"1/2": "50%",
|
|
45
|
+
"1/3": "33.333333%",
|
|
46
|
+
"1/4": "25%",
|
|
47
|
+
"1/5": "20%",
|
|
48
|
+
"1/6": "16.666667%",
|
|
49
|
+
"2/3": "66.666667%",
|
|
50
|
+
"2/4": "50%",
|
|
51
|
+
"2/5": "40%",
|
|
52
|
+
"2/6": "33.333333%",
|
|
53
|
+
"3/4": "75%",
|
|
54
|
+
"3/5": "60%",
|
|
55
|
+
"3/6": "50%",
|
|
56
|
+
"4/5": "80%",
|
|
57
|
+
"4/6": "66.666667%",
|
|
58
|
+
"5/6": "83.333333%",
|
|
59
|
+
"full": "100%",
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
|
+
|
|
3
|
+
exports[`SPACING_SCALE should export complete spacing scale 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"0": 0,
|
|
6
|
+
"0.5": 2,
|
|
7
|
+
"1": 4,
|
|
8
|
+
"1.5": 6,
|
|
9
|
+
"10": 40,
|
|
10
|
+
"11": 44,
|
|
11
|
+
"12": 48,
|
|
12
|
+
"14": 56,
|
|
13
|
+
"16": 64,
|
|
14
|
+
"2": 8,
|
|
15
|
+
"2.5": 10,
|
|
16
|
+
"20": 80,
|
|
17
|
+
"24": 96,
|
|
18
|
+
"28": 112,
|
|
19
|
+
"3": 12,
|
|
20
|
+
"3.5": 14,
|
|
21
|
+
"32": 128,
|
|
22
|
+
"36": 144,
|
|
23
|
+
"4": 16,
|
|
24
|
+
"40": 160,
|
|
25
|
+
"44": 176,
|
|
26
|
+
"48": 192,
|
|
27
|
+
"5": 20,
|
|
28
|
+
"52": 208,
|
|
29
|
+
"56": 224,
|
|
30
|
+
"6": 24,
|
|
31
|
+
"60": 240,
|
|
32
|
+
"64": 256,
|
|
33
|
+
"7": 28,
|
|
34
|
+
"72": 288,
|
|
35
|
+
"8": 32,
|
|
36
|
+
"80": 320,
|
|
37
|
+
"9": 36,
|
|
38
|
+
"96": 384,
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
|
+
|
|
3
|
+
exports[`FONT_SIZES should export complete font size scale 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"2xl": 24,
|
|
6
|
+
"3xl": 30,
|
|
7
|
+
"4xl": 36,
|
|
8
|
+
"5xl": 48,
|
|
9
|
+
"6xl": 60,
|
|
10
|
+
"7xl": 72,
|
|
11
|
+
"8xl": 96,
|
|
12
|
+
"9xl": 128,
|
|
13
|
+
"base": 16,
|
|
14
|
+
"lg": 18,
|
|
15
|
+
"sm": 14,
|
|
16
|
+
"xl": 20,
|
|
17
|
+
"xs": 12,
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
exports[`LETTER_SPACING_SCALE should export complete letter spacing scale 1`] = `
|
|
22
|
+
{
|
|
23
|
+
"normal": 0,
|
|
24
|
+
"tight": -0.4,
|
|
25
|
+
"tighter": -0.8,
|
|
26
|
+
"wide": 0.4,
|
|
27
|
+
"wider": 0.8,
|
|
28
|
+
"widest": 1.6,
|
|
29
|
+
}
|
|
30
|
+
`;
|
package/dist/parser/layout.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});exports.Z_INDEX_SCALE=exports.INSET_SCALE=void 0;exports.parseLayout=parseLayout;var DISPLAY_MAP={flex:{display:"flex"},hidden:{display:"none"}};var FLEX_DIRECTION_MAP={"flex-row":{flexDirection:"row"},"flex-row-reverse":{flexDirection:"row-reverse"},"flex-col":{flexDirection:"column"},"flex-col-reverse":{flexDirection:"column-reverse"}};var FLEX_WRAP_MAP={"flex-wrap":{flexWrap:"wrap"},"flex-wrap-reverse":{flexWrap:"wrap-reverse"},"flex-nowrap":{flexWrap:"nowrap"}};var FLEX_MAP={"flex-1":{flex:1},"flex-auto":{flex:1},"flex-none":{flex:0}};var GROW_SHRINK_MAP={grow:{flexGrow:1},"grow-0":{flexGrow:0},shrink:{flexShrink:1},"shrink-0":{flexShrink:0}};var JUSTIFY_CONTENT_MAP={"justify-start":{justifyContent:"flex-start"},"justify-end":{justifyContent:"flex-end"},"justify-center":{justifyContent:"center"},"justify-between":{justifyContent:"space-between"},"justify-around":{justifyContent:"space-around"},"justify-evenly":{justifyContent:"space-evenly"}};var ALIGN_ITEMS_MAP={"items-start":{alignItems:"flex-start"},"items-end":{alignItems:"flex-end"},"items-center":{alignItems:"center"},"items-baseline":{alignItems:"baseline"},"items-stretch":{alignItems:"stretch"}};var ALIGN_SELF_MAP={"self-auto":{alignSelf:"auto"},"self-start":{alignSelf:"flex-start"},"self-end":{alignSelf:"flex-end"},"self-center":{alignSelf:"center"},"self-stretch":{alignSelf:"stretch"},"self-baseline":{alignSelf:"baseline"}};var ALIGN_CONTENT_MAP={"content-start":{alignContent:"flex-start"},"content-end":{alignContent:"flex-end"},"content-center":{alignContent:"center"},"content-between":{alignContent:"space-between"},"content-around":{alignContent:"space-around"},"content-stretch":{alignContent:"stretch"}};var POSITION_MAP={absolute:{position:"absolute"},relative:{position:"relative"}};var OVERFLOW_MAP={"overflow-hidden":{overflow:"hidden"},"overflow-visible":{overflow:"visible"},"overflow-scroll":{overflow:"scroll"}};var Z_INDEX_SCALE=exports.Z_INDEX_SCALE={0:0,10:10,20:20,30:30,40:40,50:50,auto:0};var INSET_SCALE=exports.INSET_SCALE={0:0,0.5:2,1:4,1.5:6,2:8,2.5:10,3:12,3.5:14,4:16,5:20,6:24,8:32,10:40,12:48,16:64,20:80,24:96};function parseLayout(cls){var _ref,_ref2,_ref3,_ref4,_ref5,_ref6,_ref7,_ref8,_ref9,_ref0,_DISPLAY_MAP$cls;if(cls.startsWith("z-")){var zKey=cls.substring(2);var zValue=Z_INDEX_SCALE[zKey];if(zValue!==undefined){return{zIndex:zValue};}}if(cls.startsWith("top-")){var topKey=cls.substring(4);if(topKey==="auto"){return{};}var topValue=INSET_SCALE[topKey];if(topValue!==undefined){return{top:topValue};}}if(cls.startsWith("right-")){var rightKey=cls.substring(6);if(rightKey==="auto"){return{};}var rightValue=INSET_SCALE[rightKey];if(rightValue!==undefined){return{right:rightValue};}}if(cls.startsWith("bottom-")){var bottomKey=cls.substring(7);if(bottomKey==="auto"){return{};}var bottomValue=INSET_SCALE[bottomKey];if(bottomValue!==undefined){return{bottom:bottomValue};}}if(cls.startsWith("left-")){var leftKey=cls.substring(5);if(leftKey==="auto"){return{};}var leftValue=INSET_SCALE[leftKey];if(leftValue!==undefined){return{left:leftValue};}}if(cls.startsWith("inset-")){var insetKey=cls.substring(
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.Z_INDEX_SCALE=exports.INSET_SCALE=void 0;exports.parseLayout=parseLayout;function parseArbitraryInset(value){var pxMatch=value.match(/^\[(-?\d+)(?:px)?\]$/);if(pxMatch){return parseInt(pxMatch[1],10);}var percentMatch=value.match(/^\[(-?\d+(?:\.\d+)?)%\]$/);if(percentMatch){return`${percentMatch[1]}%`;}if(value.startsWith("[")&&value.endsWith("]")){if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Unsupported arbitrary inset unit: ${value}. Only px and % are supported.`);}return null;}return null;}function parseArbitraryZIndex(value){var zMatch=value.match(/^\[(-?\d+)\]$/);if(zMatch){return parseInt(zMatch[1],10);}if(value.startsWith("[")&&value.endsWith("]")){if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Invalid arbitrary z-index: ${value}. Only integers are supported.`);}return null;}return null;}var DISPLAY_MAP={flex:{display:"flex"},hidden:{display:"none"}};var FLEX_DIRECTION_MAP={"flex-row":{flexDirection:"row"},"flex-row-reverse":{flexDirection:"row-reverse"},"flex-col":{flexDirection:"column"},"flex-col-reverse":{flexDirection:"column-reverse"}};var FLEX_WRAP_MAP={"flex-wrap":{flexWrap:"wrap"},"flex-wrap-reverse":{flexWrap:"wrap-reverse"},"flex-nowrap":{flexWrap:"nowrap"}};var FLEX_MAP={"flex-1":{flex:1},"flex-auto":{flex:1},"flex-none":{flex:0}};var GROW_SHRINK_MAP={grow:{flexGrow:1},"grow-0":{flexGrow:0},shrink:{flexShrink:1},"shrink-0":{flexShrink:0}};var JUSTIFY_CONTENT_MAP={"justify-start":{justifyContent:"flex-start"},"justify-end":{justifyContent:"flex-end"},"justify-center":{justifyContent:"center"},"justify-between":{justifyContent:"space-between"},"justify-around":{justifyContent:"space-around"},"justify-evenly":{justifyContent:"space-evenly"}};var ALIGN_ITEMS_MAP={"items-start":{alignItems:"flex-start"},"items-end":{alignItems:"flex-end"},"items-center":{alignItems:"center"},"items-baseline":{alignItems:"baseline"},"items-stretch":{alignItems:"stretch"}};var ALIGN_SELF_MAP={"self-auto":{alignSelf:"auto"},"self-start":{alignSelf:"flex-start"},"self-end":{alignSelf:"flex-end"},"self-center":{alignSelf:"center"},"self-stretch":{alignSelf:"stretch"},"self-baseline":{alignSelf:"baseline"}};var ALIGN_CONTENT_MAP={"content-start":{alignContent:"flex-start"},"content-end":{alignContent:"flex-end"},"content-center":{alignContent:"center"},"content-between":{alignContent:"space-between"},"content-around":{alignContent:"space-around"},"content-stretch":{alignContent:"stretch"}};var POSITION_MAP={absolute:{position:"absolute"},relative:{position:"relative"}};var OVERFLOW_MAP={"overflow-hidden":{overflow:"hidden"},"overflow-visible":{overflow:"visible"},"overflow-scroll":{overflow:"scroll"}};var Z_INDEX_SCALE=exports.Z_INDEX_SCALE={0:0,10:10,20:20,30:30,40:40,50:50,auto:0};var INSET_SCALE=exports.INSET_SCALE={0:0,0.5:2,1:4,1.5:6,2:8,2.5:10,3:12,3.5:14,4:16,5:20,6:24,8:32,10:40,12:48,16:64,20:80,24:96};function parseLayout(cls){var _ref,_ref2,_ref3,_ref4,_ref5,_ref6,_ref7,_ref8,_ref9,_ref0,_DISPLAY_MAP$cls;if(cls.startsWith("z-")){var zKey=cls.substring(2);var arbitraryZ=parseArbitraryZIndex(zKey);if(arbitraryZ!==null){return{zIndex:arbitraryZ};}var zValue=Z_INDEX_SCALE[zKey];if(zValue!==undefined){return{zIndex:zValue};}}if(cls.startsWith("top-")){var topKey=cls.substring(4);if(topKey==="auto"){return{};}var arbitraryTop=parseArbitraryInset(topKey);if(arbitraryTop!==null){return{top:arbitraryTop};}var topValue=INSET_SCALE[topKey];if(topValue!==undefined){return{top:topValue};}}if(cls.startsWith("right-")){var rightKey=cls.substring(6);if(rightKey==="auto"){return{};}var arbitraryRight=parseArbitraryInset(rightKey);if(arbitraryRight!==null){return{right:arbitraryRight};}var rightValue=INSET_SCALE[rightKey];if(rightValue!==undefined){return{right:rightValue};}}if(cls.startsWith("bottom-")){var bottomKey=cls.substring(7);if(bottomKey==="auto"){return{};}var arbitraryBottom=parseArbitraryInset(bottomKey);if(arbitraryBottom!==null){return{bottom:arbitraryBottom};}var bottomValue=INSET_SCALE[bottomKey];if(bottomValue!==undefined){return{bottom:bottomValue};}}if(cls.startsWith("left-")){var leftKey=cls.substring(5);if(leftKey==="auto"){return{};}var arbitraryLeft=parseArbitraryInset(leftKey);if(arbitraryLeft!==null){return{left:arbitraryLeft};}var leftValue=INSET_SCALE[leftKey];if(leftValue!==undefined){return{left:leftValue};}}if(cls.startsWith("inset-x-")){var insetKey=cls.substring(8);var arbitraryInset=parseArbitraryInset(insetKey);if(arbitraryInset!==null){return{left:arbitraryInset,right:arbitraryInset};}var insetValue=INSET_SCALE[insetKey];if(insetValue!==undefined){return{left:insetValue,right:insetValue};}}if(cls.startsWith("inset-y-")){var _insetKey=cls.substring(8);var _arbitraryInset=parseArbitraryInset(_insetKey);if(_arbitraryInset!==null){return{top:_arbitraryInset,bottom:_arbitraryInset};}var _insetValue=INSET_SCALE[_insetKey];if(_insetValue!==undefined){return{top:_insetValue,bottom:_insetValue};}}if(cls.startsWith("inset-")){var _insetKey2=cls.substring(6);var _arbitraryInset2=parseArbitraryInset(_insetKey2);if(_arbitraryInset2!==null){return{top:_arbitraryInset2,right:_arbitraryInset2,bottom:_arbitraryInset2,left:_arbitraryInset2};}var _insetValue2=INSET_SCALE[_insetKey2];if(_insetValue2!==undefined){return{top:_insetValue2,right:_insetValue2,bottom:_insetValue2,left:_insetValue2};}}return(_ref=(_ref2=(_ref3=(_ref4=(_ref5=(_ref6=(_ref7=(_ref8=(_ref9=(_ref0=(_DISPLAY_MAP$cls=DISPLAY_MAP[cls])!=null?_DISPLAY_MAP$cls:FLEX_DIRECTION_MAP[cls])!=null?_ref0:FLEX_WRAP_MAP[cls])!=null?_ref9:FLEX_MAP[cls])!=null?_ref8:GROW_SHRINK_MAP[cls])!=null?_ref7:JUSTIFY_CONTENT_MAP[cls])!=null?_ref6:ALIGN_ITEMS_MAP[cls])!=null?_ref5:ALIGN_SELF_MAP[cls])!=null?_ref4:ALIGN_CONTENT_MAP[cls])!=null?_ref3:POSITION_MAP[cls])!=null?_ref2:OVERFLOW_MAP[cls])!=null?_ref:null;}
|