@tenphi/eslint-plugin-tasty 0.8.0 → 0.10.0
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 +4 -3
- package/dist/configs.js +3 -2
- package/dist/configs.js.map +1 -1
- package/dist/constants.js +234 -15
- package/dist/constants.js.map +1 -1
- package/dist/fix-utils.js +92 -0
- package/dist/fix-utils.js.map +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/rules/consistent-token-usage.js +59 -12
- package/dist/rules/consistent-token-usage.js.map +1 -1
- package/dist/rules/no-important.js +12 -4
- package/dist/rules/no-important.js.map +1 -1
- package/dist/rules/no-nested-selector.js +2 -2
- package/dist/rules/no-nested-selector.js.map +1 -1
- package/dist/rules/no-own-at-root.js +9 -1
- package/dist/rules/no-own-at-root.js.map +1 -1
- package/dist/rules/no-raw-color-values.js +23 -7
- package/dist/rules/no-raw-color-values.js.map +1 -1
- package/dist/rules/prefer-auto-calc.js +23 -1
- package/dist/rules/prefer-auto-calc.js.map +1 -1
- package/dist/rules/prefer-custom-property-syntax.js +79 -4
- package/dist/rules/prefer-custom-property-syntax.js.map +1 -1
- package/dist/rules/prefer-directional-shorthand.js +21 -8
- package/dist/rules/prefer-directional-shorthand.js.map +1 -1
- package/dist/rules/prefer-hide.js +15 -9
- package/dist/rules/prefer-hide.js.map +1 -1
- package/dist/rules/prefer-longhand-property.js +47 -0
- package/dist/rules/prefer-longhand-property.js.map +1 -0
- package/dist/rules/prefer-shorthand-property.js +5 -0
- package/dist/rules/prefer-shorthand-property.js.map +1 -1
- package/dist/rules/valid-default-state-order.js +36 -5
- package/dist/rules/valid-default-state-order.js.map +1 -1
- package/dist/rules/valid-radius-shape.js +18 -2
- package/dist/rules/valid-radius-shape.js.map +1 -1
- package/dist/rules/valid-transition.js +37 -5
- package/dist/rules/valid-transition.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -96,12 +96,13 @@ export default {
|
|
|
96
96
|
| `tasty/no-own-at-root` | warn | `@own()` used at root level where it is redundant |
|
|
97
97
|
| `tasty/valid-default-state-order` | warn | Misplaced default (`''`) or redundant `''` when only `_` is present |
|
|
98
98
|
| `tasty/prefer-shorthand-property` | warn | Use Tasty shorthand instead of native CSS properties (`backgroundColor` → `fill`, etc.) |
|
|
99
|
-
| `tasty/no-raw-color-values` | warn | Raw hex/rgb colors instead of `#color` tokens |
|
|
99
|
+
| `tasty/no-raw-color-values` | warn | Raw hex/rgb/`okhsl`/`okhst`/`oklch`/named colors instead of `#color` tokens |
|
|
100
100
|
| `tasty/consistent-token-usage` | warn | Raw px values when custom units or tokens exist |
|
|
101
101
|
| `tasty/prefer-auto-calc` | warn | `calc(...)` instead of Tasty auto-calc `(...)` |
|
|
102
|
-
| `tasty/prefer-custom-property-syntax` | warn | `var(--prop)` instead of `$prop` / `
|
|
102
|
+
| `tasty/prefer-custom-property-syntax` | warn | `var(--prop)` / `$x-color` / `transparent` / `currentColor` instead of `$prop` / `#color` / `#clear` / `#current` |
|
|
103
103
|
| `tasty/prefer-hide` | warn | `display: 'none'` instead of `hide: true` |
|
|
104
|
-
| `tasty/prefer-directional-shorthand` | warn | 4-value `margin`/`padding` with
|
|
104
|
+
| `tasty/prefer-directional-shorthand` | warn | 4-value `margin`/`padding`/`inset` with placeholder sides instead of directional form |
|
|
105
|
+
| `tasty/prefer-longhand-property` | error | Lossy `flex` shorthand instead of `flexGrow` / `flexShrink` / `flexBasis` |
|
|
105
106
|
|
|
106
107
|
### Strict (includes all recommended rules)
|
|
107
108
|
|
package/dist/configs.js
CHANGED
|
@@ -12,7 +12,7 @@ const recommended = {
|
|
|
12
12
|
"tasty/valid-sub-element": "error",
|
|
13
13
|
"tasty/valid-directional-modifier": "error",
|
|
14
14
|
"tasty/valid-radius-shape": "error",
|
|
15
|
-
"tasty/no-nested-selector": "
|
|
15
|
+
"tasty/no-nested-selector": "error",
|
|
16
16
|
"tasty/static-no-dynamic-values": "error",
|
|
17
17
|
"tasty/static-valid-selector": "error",
|
|
18
18
|
"tasty/valid-preset": "error",
|
|
@@ -27,7 +27,8 @@ const recommended = {
|
|
|
27
27
|
"tasty/prefer-auto-calc": "warn",
|
|
28
28
|
"tasty/prefer-custom-property-syntax": "warn",
|
|
29
29
|
"tasty/prefer-hide": "warn",
|
|
30
|
-
"tasty/prefer-directional-shorthand": "warn"
|
|
30
|
+
"tasty/prefer-directional-shorthand": "warn",
|
|
31
|
+
"tasty/prefer-longhand-property": "error"
|
|
31
32
|
};
|
|
32
33
|
const strict = {
|
|
33
34
|
...recommended,
|
package/dist/configs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configs.js","names":[],"sources":["../src/configs.ts"],"sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\n\nexport const recommended: TSESLint.SharedConfig.RulesRecord = {\n 'tasty/known-property': 'warn',\n 'tasty/valid-value': 'error',\n 'tasty/valid-color-token': 'error',\n 'tasty/valid-custom-unit': 'error',\n 'tasty/valid-boolean-property': 'error',\n 'tasty/valid-state-key': 'error',\n 'tasty/valid-styles-structure': 'error',\n 'tasty/no-nested-state-map': 'error',\n 'tasty/no-important': 'error',\n 'tasty/valid-sub-element': 'error',\n 'tasty/valid-directional-modifier': 'error',\n 'tasty/valid-radius-shape': 'error',\n 'tasty/no-nested-selector': '
|
|
1
|
+
{"version":3,"file":"configs.js","names":[],"sources":["../src/configs.ts"],"sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\n\nexport const recommended: TSESLint.SharedConfig.RulesRecord = {\n 'tasty/known-property': 'warn',\n 'tasty/valid-value': 'error',\n 'tasty/valid-color-token': 'error',\n 'tasty/valid-custom-unit': 'error',\n 'tasty/valid-boolean-property': 'error',\n 'tasty/valid-state-key': 'error',\n 'tasty/valid-styles-structure': 'error',\n 'tasty/no-nested-state-map': 'error',\n 'tasty/no-important': 'error',\n 'tasty/valid-sub-element': 'error',\n 'tasty/valid-directional-modifier': 'error',\n 'tasty/valid-radius-shape': 'error',\n 'tasty/no-nested-selector': 'error',\n 'tasty/static-no-dynamic-values': 'error',\n 'tasty/static-valid-selector': 'error',\n 'tasty/valid-preset': 'error',\n 'tasty/valid-recipe': 'error',\n 'tasty/valid-transition': 'warn',\n 'tasty/require-default-state': 'error',\n 'tasty/no-own-at-root': 'warn',\n 'tasty/valid-default-state-order': 'warn',\n 'tasty/prefer-shorthand-property': 'warn',\n 'tasty/no-raw-color-values': 'warn',\n 'tasty/consistent-token-usage': 'warn',\n 'tasty/prefer-auto-calc': 'warn',\n 'tasty/prefer-custom-property-syntax': 'warn',\n 'tasty/prefer-hide': 'warn',\n 'tasty/prefer-directional-shorthand': 'warn',\n 'tasty/prefer-longhand-property': 'error',\n};\n\nexport const strict: TSESLint.SharedConfig.RulesRecord = {\n ...recommended,\n 'tasty/valid-custom-property': 'warn',\n 'tasty/no-unknown-state-alias': 'warn',\n 'tasty/no-styles-prop': 'warn',\n 'tasty/no-runtime-styles-mutation': 'warn',\n 'tasty/valid-state-definition': 'warn',\n};\n"],"mappings":";AAEA,MAAa,cAAiD;CAC5D,wBAAwB;CACxB,qBAAqB;CACrB,2BAA2B;CAC3B,2BAA2B;CAC3B,gCAAgC;CAChC,yBAAyB;CACzB,gCAAgC;CAChC,6BAA6B;CAC7B,sBAAsB;CACtB,2BAA2B;CAC3B,oCAAoC;CACpC,4BAA4B;CAC5B,4BAA4B;CAC5B,kCAAkC;CAClC,+BAA+B;CAC/B,sBAAsB;CACtB,sBAAsB;CACtB,0BAA0B;CAC1B,+BAA+B;CAC/B,wBAAwB;CACxB,mCAAmC;CACnC,mCAAmC;CACnC,6BAA6B;CAC7B,gCAAgC;CAChC,0BAA0B;CAC1B,uCAAuC;CACvC,qBAAqB;CACrB,sCAAsC;CACtC,kCAAkC;CACnC;AAED,MAAa,SAA4C;CACvD,GAAG;CACH,+BAA+B;CAC/B,gCAAgC;CAChC,wBAAwB;CACxB,oCAAoC;CACpC,gCAAgC;CACjC"}
|
package/dist/constants.js
CHANGED
|
@@ -578,6 +578,30 @@ const DIRECTIONAL_MODIFIERS = {
|
|
|
578
578
|
])
|
|
579
579
|
};
|
|
580
580
|
/**
|
|
581
|
+
* Properties whose 4-value box syntax round-trips losslessly to a directional
|
|
582
|
+
* shorthand, mapped to the *identity* token that marks an unset side.
|
|
583
|
+
*
|
|
584
|
+
* The identity is per-property because it is the CSS initial value of the
|
|
585
|
+
* longhand, not always `0`:
|
|
586
|
+
* - `margin` / `padding` — initial is `0`, so zero tokens are placeholders.
|
|
587
|
+
* - `inset` — initial is `auto`. A `0` here is a REAL offset that the
|
|
588
|
+
* directional shorthand would silently drop, so `auto` is the placeholder.
|
|
589
|
+
*
|
|
590
|
+
* Deliberately excluded because the rewrite is *not* equivalent:
|
|
591
|
+
* - `radius` — the four positions are corners, and a directional modifier
|
|
592
|
+
* addresses a corner pair (`radius: '4px bottom'` rounds both bottom
|
|
593
|
+
* corners), so a single-corner value has no directional equivalent.
|
|
594
|
+
* - `border` — four tokens parse as one border value (width/style/color),
|
|
595
|
+
* not as a box, so there are no per-side placeholders to collapse.
|
|
596
|
+
* - `fade` — each side becomes its own gradient group; collapsing changes the
|
|
597
|
+
* emitted `mask` layers.
|
|
598
|
+
*/
|
|
599
|
+
const DIRECTIONAL_BOX_IDENTITY = {
|
|
600
|
+
margin: "0",
|
|
601
|
+
padding: "0",
|
|
602
|
+
inset: "auto"
|
|
603
|
+
};
|
|
604
|
+
/**
|
|
581
605
|
* Valid radius shape keywords.
|
|
582
606
|
*/
|
|
583
607
|
const RADIUS_SHAPES = new Set([
|
|
@@ -621,7 +645,8 @@ const SEMANTIC_TRANSITIONS = new Set([
|
|
|
621
645
|
const SHORTHAND_MAPPING = {
|
|
622
646
|
backgroundColor: {
|
|
623
647
|
property: "fill",
|
|
624
|
-
hint: "fill: '...'"
|
|
648
|
+
hint: "fill: '...'",
|
|
649
|
+
safeFix: true
|
|
625
650
|
},
|
|
626
651
|
borderColor: {
|
|
627
652
|
property: "border",
|
|
@@ -653,7 +678,8 @@ const SHORTHAND_MAPPING = {
|
|
|
653
678
|
},
|
|
654
679
|
borderRadius: {
|
|
655
680
|
property: "radius",
|
|
656
|
-
hint: "radius: '...'"
|
|
681
|
+
hint: "radius: '...'",
|
|
682
|
+
safeFix: true
|
|
657
683
|
},
|
|
658
684
|
maxWidth: {
|
|
659
685
|
property: "width",
|
|
@@ -759,18 +785,6 @@ const SHORTHAND_MAPPING = {
|
|
|
759
785
|
property: "preset",
|
|
760
786
|
hint: "preset: '...'"
|
|
761
787
|
},
|
|
762
|
-
flexGrow: {
|
|
763
|
-
property: "flex",
|
|
764
|
-
hint: "flex: '...'"
|
|
765
|
-
},
|
|
766
|
-
flexShrink: {
|
|
767
|
-
property: "flex",
|
|
768
|
-
hint: "flex: '...'"
|
|
769
|
-
},
|
|
770
|
-
flexBasis: {
|
|
771
|
-
property: "flex",
|
|
772
|
-
hint: "flex: '...'"
|
|
773
|
-
},
|
|
774
788
|
flexGap: {
|
|
775
789
|
property: "gap",
|
|
776
790
|
hint: "gap: '...'"
|
|
@@ -833,6 +847,25 @@ const SHORTHAND_MAPPING = {
|
|
|
833
847
|
}
|
|
834
848
|
};
|
|
835
849
|
/**
|
|
850
|
+
* CSS shorthands whose *longhands* are the preferred Tasty form — the reverse
|
|
851
|
+
* of `SHORTHAND_MAPPING`.
|
|
852
|
+
*
|
|
853
|
+
* `flex` is lossy in a way the longhands are not: it resets the two components
|
|
854
|
+
* you did not write to values that are not their CSS initial. `flex: '0'`
|
|
855
|
+
* expands to `flex-grow: 0; flex-shrink: 1; flex-basis: 0%`, so it cannot
|
|
856
|
+
* express "do not shrink" (`flexShrink: 0`) at all, and it silently changes
|
|
857
|
+
* `flex-basis`. Writing the longhands keeps each component independent, which
|
|
858
|
+
* also lets them carry separate state maps.
|
|
859
|
+
*/
|
|
860
|
+
const LONGHAND_MAPPING = { flex: {
|
|
861
|
+
longhands: [
|
|
862
|
+
"flexGrow",
|
|
863
|
+
"flexShrink",
|
|
864
|
+
"flexBasis"
|
|
865
|
+
],
|
|
866
|
+
hint: "flexGrow / flexShrink / flexBasis"
|
|
867
|
+
} };
|
|
868
|
+
/**
|
|
836
869
|
* CSS transition property names mapped to Tasty semantic transition names.
|
|
837
870
|
*/
|
|
838
871
|
const TRANSITION_SEMANTIC_MAPPING = {
|
|
@@ -954,7 +987,193 @@ const KNOWN_PSEUDO_CLASSES = new Set([
|
|
|
954
987
|
"::marker",
|
|
955
988
|
"::backdrop"
|
|
956
989
|
]);
|
|
990
|
+
/**
|
|
991
|
+
* CSS named colors (level 1–4) that should be replaced by `#color` tokens.
|
|
992
|
+
* `transparent` and `currentcolor` are excluded — they have their own token
|
|
993
|
+
* suggestions (`#clear`, `#current`) handled by `prefer-custom-property-syntax`.
|
|
994
|
+
*/
|
|
995
|
+
const NAMED_CSS_COLORS = new Set([
|
|
996
|
+
"aliceblue",
|
|
997
|
+
"antiquewhite",
|
|
998
|
+
"aqua",
|
|
999
|
+
"aquamarine",
|
|
1000
|
+
"azure",
|
|
1001
|
+
"beige",
|
|
1002
|
+
"bisque",
|
|
1003
|
+
"black",
|
|
1004
|
+
"blanchedalmond",
|
|
1005
|
+
"blue",
|
|
1006
|
+
"blueviolet",
|
|
1007
|
+
"brown",
|
|
1008
|
+
"burlywood",
|
|
1009
|
+
"cadetblue",
|
|
1010
|
+
"chartreuse",
|
|
1011
|
+
"chocolate",
|
|
1012
|
+
"coral",
|
|
1013
|
+
"cornflowerblue",
|
|
1014
|
+
"cornsilk",
|
|
1015
|
+
"crimson",
|
|
1016
|
+
"cyan",
|
|
1017
|
+
"darkblue",
|
|
1018
|
+
"darkcyan",
|
|
1019
|
+
"darkgoldenrod",
|
|
1020
|
+
"darkgray",
|
|
1021
|
+
"darkgreen",
|
|
1022
|
+
"darkgrey",
|
|
1023
|
+
"darkkhaki",
|
|
1024
|
+
"darkmagenta",
|
|
1025
|
+
"darkolivegreen",
|
|
1026
|
+
"darkorange",
|
|
1027
|
+
"darkorchid",
|
|
1028
|
+
"darkred",
|
|
1029
|
+
"darksalmon",
|
|
1030
|
+
"darkseagreen",
|
|
1031
|
+
"darkslateblue",
|
|
1032
|
+
"darkslategray",
|
|
1033
|
+
"darkslategrey",
|
|
1034
|
+
"darkturquoise",
|
|
1035
|
+
"darkviolet",
|
|
1036
|
+
"deeppink",
|
|
1037
|
+
"deepskyblue",
|
|
1038
|
+
"dimgray",
|
|
1039
|
+
"dimgrey",
|
|
1040
|
+
"dodgerblue",
|
|
1041
|
+
"firebrick",
|
|
1042
|
+
"floralwhite",
|
|
1043
|
+
"forestgreen",
|
|
1044
|
+
"fuchsia",
|
|
1045
|
+
"gainsboro",
|
|
1046
|
+
"ghostwhite",
|
|
1047
|
+
"gold",
|
|
1048
|
+
"goldenrod",
|
|
1049
|
+
"gray",
|
|
1050
|
+
"green",
|
|
1051
|
+
"greenyellow",
|
|
1052
|
+
"grey",
|
|
1053
|
+
"honeydew",
|
|
1054
|
+
"hotpink",
|
|
1055
|
+
"indianred",
|
|
1056
|
+
"indigo",
|
|
1057
|
+
"ivory",
|
|
1058
|
+
"khaki",
|
|
1059
|
+
"lavender",
|
|
1060
|
+
"lavenderblush",
|
|
1061
|
+
"lawngreen",
|
|
1062
|
+
"lemonchiffon",
|
|
1063
|
+
"lightblue",
|
|
1064
|
+
"lightcoral",
|
|
1065
|
+
"lightcyan",
|
|
1066
|
+
"lightgoldenrodyellow",
|
|
1067
|
+
"lightgray",
|
|
1068
|
+
"lightgreen",
|
|
1069
|
+
"lightgrey",
|
|
1070
|
+
"lightpink",
|
|
1071
|
+
"lightsalmon",
|
|
1072
|
+
"lightseagreen",
|
|
1073
|
+
"lightskyblue",
|
|
1074
|
+
"lightslategray",
|
|
1075
|
+
"lightslategrey",
|
|
1076
|
+
"lightsteelblue",
|
|
1077
|
+
"lightyellow",
|
|
1078
|
+
"lime",
|
|
1079
|
+
"limegreen",
|
|
1080
|
+
"linen",
|
|
1081
|
+
"magenta",
|
|
1082
|
+
"maroon",
|
|
1083
|
+
"mediumaquamarine",
|
|
1084
|
+
"mediumblue",
|
|
1085
|
+
"mediumorchid",
|
|
1086
|
+
"mediumpurple",
|
|
1087
|
+
"mediumseagreen",
|
|
1088
|
+
"mediumslateblue",
|
|
1089
|
+
"mediumspringgreen",
|
|
1090
|
+
"mediumturquoise",
|
|
1091
|
+
"mediumvioletred",
|
|
1092
|
+
"midnightblue",
|
|
1093
|
+
"mintcream",
|
|
1094
|
+
"mistyrose",
|
|
1095
|
+
"moccasin",
|
|
1096
|
+
"navajowhite",
|
|
1097
|
+
"navy",
|
|
1098
|
+
"oldlace",
|
|
1099
|
+
"olive",
|
|
1100
|
+
"olivedrab",
|
|
1101
|
+
"orange",
|
|
1102
|
+
"orangered",
|
|
1103
|
+
"orchid",
|
|
1104
|
+
"palegoldenrod",
|
|
1105
|
+
"palegreen",
|
|
1106
|
+
"paleturquoise",
|
|
1107
|
+
"palevioletred",
|
|
1108
|
+
"papayawhip",
|
|
1109
|
+
"peachpuff",
|
|
1110
|
+
"peru",
|
|
1111
|
+
"pink",
|
|
1112
|
+
"plum",
|
|
1113
|
+
"powderblue",
|
|
1114
|
+
"purple",
|
|
1115
|
+
"rebeccapurple",
|
|
1116
|
+
"red",
|
|
1117
|
+
"rosybrown",
|
|
1118
|
+
"royalblue",
|
|
1119
|
+
"saddlebrown",
|
|
1120
|
+
"salmon",
|
|
1121
|
+
"sandybrown",
|
|
1122
|
+
"seagreen",
|
|
1123
|
+
"seashell",
|
|
1124
|
+
"sienna",
|
|
1125
|
+
"silver",
|
|
1126
|
+
"skyblue",
|
|
1127
|
+
"slateblue",
|
|
1128
|
+
"slategray",
|
|
1129
|
+
"slategrey",
|
|
1130
|
+
"snow",
|
|
1131
|
+
"springgreen",
|
|
1132
|
+
"steelblue",
|
|
1133
|
+
"tan",
|
|
1134
|
+
"teal",
|
|
1135
|
+
"thistle",
|
|
1136
|
+
"tomato",
|
|
1137
|
+
"turquoise",
|
|
1138
|
+
"violet",
|
|
1139
|
+
"wheat",
|
|
1140
|
+
"white",
|
|
1141
|
+
"whitesmoke",
|
|
1142
|
+
"yellow",
|
|
1143
|
+
"yellowgreen"
|
|
1144
|
+
]);
|
|
1145
|
+
/**
|
|
1146
|
+
* Properties that accept color values. Used to scope named-color checks so
|
|
1147
|
+
* string properties like `content` or `cursor` don't false-positive.
|
|
1148
|
+
*/
|
|
1149
|
+
const COLOR_BEARING_PROPERTIES = new Set([
|
|
1150
|
+
"fill",
|
|
1151
|
+
"color",
|
|
1152
|
+
"caretColor",
|
|
1153
|
+
"accentColor",
|
|
1154
|
+
"shadow",
|
|
1155
|
+
"border",
|
|
1156
|
+
"outline",
|
|
1157
|
+
"fade",
|
|
1158
|
+
"background",
|
|
1159
|
+
"backgroundColor",
|
|
1160
|
+
"borderColor",
|
|
1161
|
+
"borderTopColor",
|
|
1162
|
+
"borderRightColor",
|
|
1163
|
+
"borderBottomColor",
|
|
1164
|
+
"borderLeftColor",
|
|
1165
|
+
"boxShadow",
|
|
1166
|
+
"textShadow",
|
|
1167
|
+
"textDecorationColor",
|
|
1168
|
+
"outlineColor",
|
|
1169
|
+
"scrollbarColor",
|
|
1170
|
+
"columnRuleColor",
|
|
1171
|
+
"stroke",
|
|
1172
|
+
"stopColor",
|
|
1173
|
+
"floodColor",
|
|
1174
|
+
"lightingColor"
|
|
1175
|
+
]);
|
|
957
1176
|
|
|
958
1177
|
//#endregion
|
|
959
|
-
export { BOOLEAN_TRUE_PROPERTIES, BUILT_IN_STATE_PREFIXES, BUILT_IN_UNITS, CSS_UNITS, DEFAULT_IMPORT_SOURCES, DIRECTIONAL_MODIFIERS, KNOWN_CSS_PROPERTIES, KNOWN_PSEUDO_CLASSES, KNOWN_TASTY_PROPERTIES, PRESET_MODIFIERS, RADIUS_SHAPES, SEMANTIC_TRANSITIONS, SHORTHAND_MAPPING, SPECIAL_STYLE_KEYS, TRANSITION_SEMANTIC_MAPPING };
|
|
1178
|
+
export { BOOLEAN_TRUE_PROPERTIES, BUILT_IN_STATE_PREFIXES, BUILT_IN_UNITS, COLOR_BEARING_PROPERTIES, CSS_UNITS, DEFAULT_IMPORT_SOURCES, DIRECTIONAL_BOX_IDENTITY, DIRECTIONAL_MODIFIERS, KNOWN_CSS_PROPERTIES, KNOWN_PSEUDO_CLASSES, KNOWN_TASTY_PROPERTIES, LONGHAND_MAPPING, NAMED_CSS_COLORS, PRESET_MODIFIERS, RADIUS_SHAPES, SEMANTIC_TRANSITIONS, SHORTHAND_MAPPING, SPECIAL_STYLE_KEYS, TRANSITION_SEMANTIC_MAPPING };
|
|
960
1179
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Built-in tasty style properties that are always valid as style keys.\n */\nexport const KNOWN_TASTY_PROPERTIES = new Set([\n 'display',\n 'font',\n 'preset',\n 'hide',\n 'whiteSpace',\n 'opacity',\n 'transition',\n 'gridArea',\n 'order',\n 'gridColumn',\n 'gridRow',\n 'placeSelf',\n 'alignSelf',\n 'justifySelf',\n 'zIndex',\n 'margin',\n 'inset',\n 'position',\n 'padding',\n 'paddingInline',\n 'paddingBlock',\n 'overflow',\n 'scrollbar',\n 'textAlign',\n 'border',\n 'radius',\n 'shadow',\n 'outline',\n 'color',\n 'fill',\n 'fade',\n 'image',\n 'textTransform',\n 'fontWeight',\n 'fontStyle',\n 'width',\n 'height',\n 'flexBasis',\n 'flexGrow',\n 'flexShrink',\n 'flex',\n 'flow',\n 'placeItems',\n 'placeContent',\n 'alignItems',\n 'alignContent',\n 'justifyItems',\n 'justifyContent',\n 'align',\n 'justify',\n 'gap',\n 'columnGap',\n 'rowGap',\n 'gridColumns',\n 'gridRows',\n 'gridTemplate',\n 'gridAreas',\n 'recipe',\n 'textOverflow',\n 'textDecoration',\n 'animation',\n 'cursor',\n 'pointerEvents',\n 'userSelect',\n 'transform',\n 'transformOrigin',\n 'filter',\n 'backdropFilter',\n 'mixBlendMode',\n 'objectFit',\n 'objectPosition',\n 'resize',\n 'appearance',\n 'listStyle',\n 'listStyleType',\n 'content',\n 'boxSizing',\n 'verticalAlign',\n 'wordBreak',\n 'overflowWrap',\n 'hyphens',\n 'tabSize',\n 'direction',\n 'unicodeBidi',\n 'writingMode',\n 'lineClamp',\n 'aspectRatio',\n 'contain',\n 'container',\n 'containerType',\n 'containerName',\n 'interpolateSize',\n 'willChange',\n 'isolation',\n 'touchAction',\n 'scrollBehavior',\n 'scrollSnapType',\n 'scrollSnapAlign',\n 'caretColor',\n 'accentColor',\n 'colorScheme',\n]);\n\n/**\n * Special top-level keys that are valid but not regular style properties.\n */\nexport const SPECIAL_STYLE_KEYS = new Set([\n '@keyframes',\n '@properties',\n '@fontFace',\n '@counterStyle',\n]);\n\n/**\n * CSS property names (common subset for validation).\n * When a key is camelCase and matches a known CSS property, it's valid.\n */\nexport const KNOWN_CSS_PROPERTIES = new Set([\n 'all',\n 'animation',\n 'animationDelay',\n 'animationDirection',\n 'animationDuration',\n 'animationFillMode',\n 'animationIterationCount',\n 'animationName',\n 'animationPlayState',\n 'animationTimingFunction',\n 'appearance',\n 'aspectRatio',\n 'backdropFilter',\n 'backfaceVisibility',\n 'background',\n 'backgroundAttachment',\n 'backgroundBlendMode',\n 'backgroundClip',\n 'backgroundColor',\n 'backgroundImage',\n 'backgroundOrigin',\n 'backgroundPosition',\n 'backgroundRepeat',\n 'backgroundSize',\n 'blockSize',\n 'border',\n 'borderBlock',\n 'borderBlockColor',\n 'borderBlockEnd',\n 'borderBlockEndColor',\n 'borderBlockEndStyle',\n 'borderBlockEndWidth',\n 'borderBlockStart',\n 'borderBlockStartColor',\n 'borderBlockStartStyle',\n 'borderBlockStartWidth',\n 'borderBlockStyle',\n 'borderBlockWidth',\n 'borderBottom',\n 'borderBottomColor',\n 'borderBottomLeftRadius',\n 'borderBottomRightRadius',\n 'borderBottomStyle',\n 'borderBottomWidth',\n 'borderCollapse',\n 'borderColor',\n 'borderImage',\n 'borderInline',\n 'borderInlineColor',\n 'borderInlineEnd',\n 'borderInlineStart',\n 'borderInlineStyle',\n 'borderInlineWidth',\n 'borderLeft',\n 'borderLeftColor',\n 'borderLeftStyle',\n 'borderLeftWidth',\n 'borderRadius',\n 'borderRight',\n 'borderRightColor',\n 'borderRightStyle',\n 'borderRightWidth',\n 'borderSpacing',\n 'borderStyle',\n 'borderTop',\n 'borderTopColor',\n 'borderTopLeftRadius',\n 'borderTopRightRadius',\n 'borderTopStyle',\n 'borderTopWidth',\n 'borderWidth',\n 'bottom',\n 'boxDecorationBreak',\n 'boxShadow',\n 'boxSizing',\n 'breakAfter',\n 'breakBefore',\n 'breakInside',\n 'captionSide',\n 'caretColor',\n 'clear',\n 'clip',\n 'clipPath',\n 'clipRule',\n 'color',\n 'colorScheme',\n 'columnCount',\n 'columnFill',\n 'columnGap',\n 'columnRule',\n 'columnRuleColor',\n 'columnRuleStyle',\n 'columnRuleWidth',\n 'columnSpan',\n 'columnWidth',\n 'columns',\n 'contain',\n 'containerName',\n 'containerType',\n 'content',\n 'contentVisibility',\n 'counterIncrement',\n 'counterReset',\n 'counterSet',\n 'cursor',\n 'direction',\n 'display',\n 'dominantBaseline',\n 'emptyCells',\n 'fillOpacity',\n 'fillRule',\n 'filter',\n 'flex',\n 'flexBasis',\n 'flexDirection',\n 'flexFlow',\n 'flexGrow',\n 'flexShrink',\n 'flexWrap',\n 'float',\n 'floodColor',\n 'floodOpacity',\n 'font',\n 'fontFamily',\n 'fontFeatureSettings',\n 'fontKerning',\n 'fontOpticalSizing',\n 'fontSize',\n 'fontSizeAdjust',\n 'fontStretch',\n 'fontStyle',\n 'fontSynthesis',\n 'fontVariant',\n 'fontVariantAlternates',\n 'fontVariantCaps',\n 'fontVariantEastAsian',\n 'fontVariantLigatures',\n 'fontVariantNumeric',\n 'fontVariantPosition',\n 'fontWeight',\n 'gap',\n 'grid',\n 'gridArea',\n 'gridAutoColumns',\n 'gridAutoFlow',\n 'gridAutoRows',\n 'gridColumn',\n 'gridColumnEnd',\n 'gridColumnStart',\n 'gridRow',\n 'gridRowEnd',\n 'gridRowStart',\n 'gridTemplate',\n 'gridTemplateAreas',\n 'gridTemplateColumns',\n 'gridTemplateRows',\n 'height',\n 'hyphens',\n 'imageRendering',\n 'inlineSize',\n 'inset',\n 'insetBlock',\n 'insetBlockEnd',\n 'insetBlockStart',\n 'insetInline',\n 'insetInlineEnd',\n 'insetInlineStart',\n 'isolation',\n 'justifyContent',\n 'justifyItems',\n 'justifySelf',\n 'left',\n 'letterSpacing',\n 'lightingColor',\n 'lineBreak',\n 'lineHeight',\n 'listStyle',\n 'listStyleImage',\n 'listStylePosition',\n 'listStyleType',\n 'marker',\n 'markerEnd',\n 'markerMid',\n 'markerStart',\n 'margin',\n 'marginBlock',\n 'marginBlockEnd',\n 'marginBlockStart',\n 'marginBottom',\n 'marginInline',\n 'marginInlineEnd',\n 'marginInlineStart',\n 'marginLeft',\n 'marginRight',\n 'marginTop',\n 'maskImage',\n 'maxBlockSize',\n 'maxHeight',\n 'maxInlineSize',\n 'maxWidth',\n 'minBlockSize',\n 'minHeight',\n 'minInlineSize',\n 'minWidth',\n 'mixBlendMode',\n 'objectFit',\n 'objectPosition',\n 'opacity',\n 'order',\n 'orphans',\n 'outline',\n 'outlineColor',\n 'outlineOffset',\n 'outlineStyle',\n 'outlineWidth',\n 'overflow',\n 'overflowAnchor',\n 'overflowWrap',\n 'overflowX',\n 'overflowY',\n 'overscrollBehavior',\n 'padding',\n 'paddingBlock',\n 'paddingBlockEnd',\n 'paddingBlockStart',\n 'paddingBottom',\n 'paddingInline',\n 'paddingInlineEnd',\n 'paddingInlineStart',\n 'paddingLeft',\n 'paddingRight',\n 'paddingTop',\n 'perspective',\n 'perspectiveOrigin',\n 'placeContent',\n 'placeItems',\n 'placeSelf',\n 'pointerEvents',\n 'position',\n 'quotes',\n 'resize',\n 'right',\n 'rotate',\n 'rowGap',\n 'scale',\n 'scrollBehavior',\n 'scrollMargin',\n 'scrollMarginBlock',\n 'scrollMarginBlockEnd',\n 'scrollMarginBlockStart',\n 'scrollMarginBottom',\n 'scrollMarginInline',\n 'scrollMarginInlineEnd',\n 'scrollMarginInlineStart',\n 'scrollMarginLeft',\n 'scrollMarginRight',\n 'scrollMarginTop',\n 'scrollPadding',\n 'scrollPaddingBlock',\n 'scrollPaddingBlockEnd',\n 'scrollPaddingBlockStart',\n 'scrollPaddingBottom',\n 'scrollPaddingInline',\n 'scrollPaddingInlineEnd',\n 'scrollPaddingInlineStart',\n 'scrollPaddingLeft',\n 'scrollPaddingRight',\n 'scrollPaddingTop',\n 'scrollSnapAlign',\n 'scrollSnapStop',\n 'scrollSnapType',\n 'scrollbarColor',\n 'scrollbarGutter',\n 'scrollbarWidth',\n 'shapeOutside',\n 'shapeRendering',\n 'stopColor',\n 'stopOpacity',\n 'stroke',\n 'strokeDasharray',\n 'strokeDashoffset',\n 'strokeLinecap',\n 'strokeLinejoin',\n 'strokeMiterlimit',\n 'strokeOpacity',\n 'strokeWidth',\n 'tabSize',\n 'tableLayout',\n 'textAlign',\n 'textAlignLast',\n 'textAnchor',\n 'textCombineUpright',\n 'textDecoration',\n 'textDecorationColor',\n 'textDecorationLine',\n 'textDecorationSkipInk',\n 'textDecorationStyle',\n 'textDecorationThickness',\n 'textEmphasis',\n 'textIndent',\n 'textOrientation',\n 'textOverflow',\n 'textRendering',\n 'textShadow',\n 'textSizeAdjust',\n 'textTransform',\n 'textUnderlineOffset',\n 'textUnderlinePosition',\n 'textWrap',\n 'top',\n 'touchAction',\n 'transform',\n 'transformOrigin',\n 'transformStyle',\n 'transition',\n 'transitionDelay',\n 'transitionDuration',\n 'transitionProperty',\n 'transitionTimingFunction',\n 'translate',\n 'unicodeBidi',\n 'userSelect',\n 'verticalAlign',\n 'visibility',\n 'whiteSpace',\n 'widows',\n 'width',\n 'willChange',\n 'wordBreak',\n 'wordSpacing',\n 'writingMode',\n 'zIndex',\n]);\n\n/**\n * Built-in custom units recognized by the tasty parser.\n */\nexport const BUILT_IN_UNITS = new Set(['x', 'r', 'cr', 'bw', 'ow', 'lh', 'sf']);\n\n/**\n * Standard CSS units (always valid).\n */\nexport const CSS_UNITS = new Set([\n 'px',\n 'em',\n 'rem',\n '%',\n 'vw',\n 'vh',\n 'vmin',\n 'vmax',\n 'ch',\n 'ex',\n 'cm',\n 'mm',\n 'in',\n 'pt',\n 'pc',\n 'fr',\n 'deg',\n 'rad',\n 'turn',\n 'grad',\n 's',\n 'ms',\n 'dpi',\n 'dpcm',\n 'dppx',\n 'svw',\n 'svh',\n 'lvw',\n 'lvh',\n 'dvw',\n 'dvh',\n 'cqw',\n 'cqh',\n 'cqi',\n 'cqb',\n 'cqmin',\n 'cqmax',\n 'cap',\n 'ic',\n 'rlh',\n 'vi',\n 'vb',\n]);\n\n/**\n * Properties that accept `true` as a value (means \"use default\").\n */\nexport const BOOLEAN_TRUE_PROPERTIES = new Set([\n 'border',\n 'radius',\n 'padding',\n 'margin',\n 'gap',\n 'fill',\n 'color',\n 'shadow',\n 'outline',\n 'inset',\n 'width',\n 'height',\n 'hide',\n 'preset',\n 'font',\n 'scrollbar',\n]);\n\n/**\n * Directional modifiers and which properties accept them.\n */\nexport const DIRECTIONAL_MODIFIERS: Record<string, Set<string>> = {\n border: new Set(['top', 'right', 'bottom', 'left']),\n radius: new Set([\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'top-left',\n 'top-right',\n 'bottom-left',\n 'bottom-right',\n ]),\n padding: new Set(['top', 'right', 'bottom', 'left']),\n margin: new Set(['top', 'right', 'bottom', 'left']),\n fade: new Set(['top', 'right', 'bottom', 'left']),\n inset: new Set(['top', 'right', 'bottom', 'left']),\n};\n\n/**\n * Valid radius shape keywords.\n */\nexport const RADIUS_SHAPES = new Set(['round', 'ellipse', 'leaf', 'backleaf']);\n\n/**\n * Known semantic transition names.\n */\nexport const SEMANTIC_TRANSITIONS = new Set([\n 'fade',\n 'fill',\n 'border',\n 'radius',\n 'shadow',\n 'preset',\n 'gap',\n 'theme',\n 'color',\n 'outline',\n 'dimension',\n 'flow',\n 'inset',\n 'text',\n 'opacity',\n 'translate',\n 'rotate',\n 'scale',\n 'filter',\n 'image',\n 'background',\n 'width',\n 'height',\n 'zIndex',\n]);\n\n/**\n * Mapping of native CSS properties to tasty shorthand alternatives.\n */\nexport const SHORTHAND_MAPPING: Record<\n string,\n { property: string; hint: string }\n> = {\n backgroundColor: { property: 'fill', hint: \"fill: '...'\" },\n borderColor: { property: 'border', hint: \"border: '...'\" },\n borderWidth: { property: 'border', hint: \"border: '...'\" },\n borderStyle: { property: 'border', hint: \"border: '...'\" },\n borderTop: { property: 'border', hint: \"border: '... top'\" },\n borderRight: { property: 'border', hint: \"border: '... right'\" },\n borderBottom: { property: 'border', hint: \"border: '... bottom'\" },\n borderLeft: { property: 'border', hint: \"border: '... left'\" },\n borderRadius: { property: 'radius', hint: \"radius: '...'\" },\n maxWidth: { property: 'width', hint: \"width: 'max ...'\" },\n minWidth: { property: 'width', hint: \"width: 'min ...'\" },\n maxHeight: { property: 'height', hint: \"height: 'max ...'\" },\n minHeight: { property: 'height', hint: \"height: 'min ...'\" },\n flexDirection: { property: 'flow', hint: \"flow: '...'\" },\n flexWrap: { property: 'flow', hint: \"flow: '...'\" },\n flexFlow: { property: 'flow', hint: \"flow: '...'\" },\n gridAutoFlow: { property: 'flow', hint: \"flow: '...'\" },\n outlineOffset: { property: 'outline', hint: \"outline: '... / offset'\" },\n paddingTop: { property: 'padding', hint: \"padding: '... top'\" },\n paddingRight: { property: 'padding', hint: \"padding: '... right'\" },\n paddingBottom: { property: 'padding', hint: \"padding: '... bottom'\" },\n paddingLeft: { property: 'padding', hint: \"padding: '... left'\" },\n marginTop: { property: 'margin', hint: \"margin: '... top'\" },\n marginRight: { property: 'margin', hint: \"margin: '... right'\" },\n marginBottom: { property: 'margin', hint: \"margin: '... bottom'\" },\n marginLeft: { property: 'margin', hint: \"margin: '... left'\" },\n fontSize: { property: 'preset', hint: \"preset: '...'\" },\n fontWeight: {\n property: 'preset',\n hint: \"preset: 'name / strong' (with strong modifier)\",\n },\n lineHeight: {\n property: 'preset',\n hint: \"preset: 'name / tight' (with tight modifier)\",\n },\n boxShadow: { property: 'shadow', hint: \"shadow: '...'\" },\n backgroundImage: { property: 'image', hint: \"image: '...'\" },\n fontFamily: { property: 'font', hint: \"font: '...'\" },\n fontStyle: {\n property: 'preset',\n hint: \"preset: 'name / italic' (with italic modifier)\",\n },\n letterSpacing: { property: 'preset', hint: \"preset: '...'\" },\n textTransform: { property: 'preset', hint: \"preset: '...'\" },\n flexGrow: { property: 'flex', hint: \"flex: '...'\" },\n flexShrink: { property: 'flex', hint: \"flex: '...'\" },\n flexBasis: { property: 'flex', hint: \"flex: '...'\" },\n flexGap: { property: 'gap', hint: \"gap: '...'\" },\n scrollbarWidth: { property: 'scrollbar', hint: \"scrollbar: '...'\" },\n scrollbarColor: { property: 'scrollbar', hint: \"scrollbar: '...'\" },\n scrollbarGutter: { property: 'scrollbar', hint: \"scrollbar: '...'\" },\n gridTemplateColumns: {\n property: 'gridColumns',\n hint: \"gridColumns: '...'\",\n },\n gridTemplateRows: { property: 'gridRows', hint: \"gridRows: '...'\" },\n gridTemplateAreas: { property: 'gridAreas', hint: \"gridAreas: '...'\" },\n top: { property: 'inset', hint: \"inset: '... top'\" },\n right: { property: 'inset', hint: \"inset: '... right'\" },\n bottom: { property: 'inset', hint: \"inset: '... bottom'\" },\n left: { property: 'inset', hint: \"inset: '... left'\" },\n outlineColor: { property: 'outline', hint: \"outline: '...'\" },\n outlineWidth: { property: 'outline', hint: \"outline: '...'\" },\n outlineStyle: { property: 'outline', hint: \"outline: '...'\" },\n lineClamp: {\n property: 'textOverflow',\n hint: \"textOverflow: 'ellipsis / {lines}'\",\n },\n};\n\n/**\n * CSS transition property names mapped to Tasty semantic transition names.\n */\nexport const TRANSITION_SEMANTIC_MAPPING: Record<string, string> = {\n backgroundColor: 'fill',\n 'background-color': 'fill',\n backgroundImage: 'image',\n 'background-image': 'image',\n borderRadius: 'radius',\n 'border-radius': 'radius',\n borderColor: 'border',\n 'border-color': 'border',\n borderWidth: 'border',\n 'border-width': 'border',\n borderStyle: 'border',\n 'border-style': 'border',\n boxShadow: 'shadow',\n 'box-shadow': 'shadow',\n outlineColor: 'outline',\n 'outline-color': 'outline',\n outlineWidth: 'outline',\n 'outline-width': 'outline',\n outlineOffset: 'outline',\n 'outline-offset': 'outline',\n gridTemplateColumns: 'gridColumns',\n 'grid-template-columns': 'gridColumns',\n gridTemplateRows: 'gridRows',\n 'grid-template-rows': 'gridRows',\n flexDirection: 'flow',\n 'flex-direction': 'flow',\n gridAutoFlow: 'flow',\n 'grid-auto-flow': 'flow',\n fontSize: 'preset',\n 'font-size': 'preset',\n lineHeight: 'preset',\n 'line-height': 'preset',\n letterSpacing: 'preset',\n 'letter-spacing': 'preset',\n};\n\n/**\n * Known preset modifiers.\n */\nexport const PRESET_MODIFIERS = new Set([\n 'strong',\n 'bold',\n 'italic',\n 'icon',\n 'tight',\n]);\n\n/**\n * Default import sources for tasty.\n */\nexport const DEFAULT_IMPORT_SOURCES = ['@tenphi/tasty', '@tenphi/tasty/static'];\n\n/**\n * Built-in state prefixes that are always valid (not aliases).\n */\nexport const BUILT_IN_STATE_PREFIXES = new Set([\n '@media',\n '@root',\n '@parent',\n '@own',\n '@supports',\n '@starting',\n '@keyframes',\n '@properties',\n '@fontFace',\n '@counterStyle',\n]);\n\n/**\n * Known CSS pseudo-classes.\n */\nexport const KNOWN_PSEUDO_CLASSES = new Set([\n ':hover',\n ':focus',\n ':focus-visible',\n ':focus-within',\n ':active',\n ':visited',\n ':link',\n ':checked',\n ':disabled',\n ':enabled',\n ':empty',\n ':first-child',\n ':last-child',\n ':first-of-type',\n ':last-of-type',\n ':only-child',\n ':only-of-type',\n ':root',\n ':target',\n ':valid',\n ':invalid',\n ':required',\n ':optional',\n ':read-only',\n ':read-write',\n ':placeholder-shown',\n ':autofill',\n ':default',\n ':indeterminate',\n ':in-range',\n ':out-of-range',\n ':any-link',\n ':local-link',\n ':is',\n ':not',\n ':where',\n ':has',\n ':nth-child',\n ':nth-last-child',\n ':nth-of-type',\n ':nth-last-of-type',\n '::before',\n '::after',\n '::placeholder',\n '::selection',\n '::first-line',\n '::first-letter',\n '::marker',\n '::backdrop',\n]);\n"],"mappings":";;;;AAGA,MAAa,yBAAyB,IAAI,IAAI;CAC5C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;AAKF,MAAa,qBAAqB,IAAI,IAAI;CACxC;CACA;CACA;CACA;CACD,CAAC;;;;;AAMF,MAAa,uBAAuB,IAAI,IAAI;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA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AiB;CACjB,cAAc;CACd,iBAAiB;CACjB,eAAe;CACf,kBAAkB;CAClB,qBAAqB;CACrB,yBAAyB;CACzB,kBAAkB;CAClB,sBAAsB;CACtB,eAAe;CACf,kBAAkB;CAClB,cAAc;CACd,kBAAkB;CAClB,UAAU;CACV,aAAa;CACb,YAAY;CACZ,eAAe;CACf,eAAe;CACf,kBAAkB;CACnB;;;;AAKD,MAAa,mBAAmB,IAAI,IAAI;CACtC;CACA;CACA;CACA;CACA;CACD,CAAC;;;;AAKF,MAAa,yBAAyB,CAAC,iBAAiB,uBAAuB;;;;AAK/E,MAAa,0BAA0B,IAAI,IAAI;CAC7C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;AAKF,MAAa,uBAAuB,IAAI,IAAI;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Built-in tasty style properties that are always valid as style keys.\n */\nexport const KNOWN_TASTY_PROPERTIES = new Set([\n 'display',\n 'font',\n 'preset',\n 'hide',\n 'whiteSpace',\n 'opacity',\n 'transition',\n 'gridArea',\n 'order',\n 'gridColumn',\n 'gridRow',\n 'placeSelf',\n 'alignSelf',\n 'justifySelf',\n 'zIndex',\n 'margin',\n 'inset',\n 'position',\n 'padding',\n 'paddingInline',\n 'paddingBlock',\n 'overflow',\n 'scrollbar',\n 'textAlign',\n 'border',\n 'radius',\n 'shadow',\n 'outline',\n 'color',\n 'fill',\n 'fade',\n 'image',\n 'textTransform',\n 'fontWeight',\n 'fontStyle',\n 'width',\n 'height',\n 'flexBasis',\n 'flexGrow',\n 'flexShrink',\n 'flex',\n 'flow',\n 'placeItems',\n 'placeContent',\n 'alignItems',\n 'alignContent',\n 'justifyItems',\n 'justifyContent',\n 'align',\n 'justify',\n 'gap',\n 'columnGap',\n 'rowGap',\n 'gridColumns',\n 'gridRows',\n 'gridTemplate',\n 'gridAreas',\n 'recipe',\n 'textOverflow',\n 'textDecoration',\n 'animation',\n 'cursor',\n 'pointerEvents',\n 'userSelect',\n 'transform',\n 'transformOrigin',\n 'filter',\n 'backdropFilter',\n 'mixBlendMode',\n 'objectFit',\n 'objectPosition',\n 'resize',\n 'appearance',\n 'listStyle',\n 'listStyleType',\n 'content',\n 'boxSizing',\n 'verticalAlign',\n 'wordBreak',\n 'overflowWrap',\n 'hyphens',\n 'tabSize',\n 'direction',\n 'unicodeBidi',\n 'writingMode',\n 'lineClamp',\n 'aspectRatio',\n 'contain',\n 'container',\n 'containerType',\n 'containerName',\n 'interpolateSize',\n 'willChange',\n 'isolation',\n 'touchAction',\n 'scrollBehavior',\n 'scrollSnapType',\n 'scrollSnapAlign',\n 'caretColor',\n 'accentColor',\n 'colorScheme',\n]);\n\n/**\n * Special top-level keys that are valid but not regular style properties.\n */\nexport const SPECIAL_STYLE_KEYS = new Set([\n '@keyframes',\n '@properties',\n '@fontFace',\n '@counterStyle',\n]);\n\n/**\n * CSS property names (common subset for validation).\n * When a key is camelCase and matches a known CSS property, it's valid.\n */\nexport const KNOWN_CSS_PROPERTIES = new Set([\n 'all',\n 'animation',\n 'animationDelay',\n 'animationDirection',\n 'animationDuration',\n 'animationFillMode',\n 'animationIterationCount',\n 'animationName',\n 'animationPlayState',\n 'animationTimingFunction',\n 'appearance',\n 'aspectRatio',\n 'backdropFilter',\n 'backfaceVisibility',\n 'background',\n 'backgroundAttachment',\n 'backgroundBlendMode',\n 'backgroundClip',\n 'backgroundColor',\n 'backgroundImage',\n 'backgroundOrigin',\n 'backgroundPosition',\n 'backgroundRepeat',\n 'backgroundSize',\n 'blockSize',\n 'border',\n 'borderBlock',\n 'borderBlockColor',\n 'borderBlockEnd',\n 'borderBlockEndColor',\n 'borderBlockEndStyle',\n 'borderBlockEndWidth',\n 'borderBlockStart',\n 'borderBlockStartColor',\n 'borderBlockStartStyle',\n 'borderBlockStartWidth',\n 'borderBlockStyle',\n 'borderBlockWidth',\n 'borderBottom',\n 'borderBottomColor',\n 'borderBottomLeftRadius',\n 'borderBottomRightRadius',\n 'borderBottomStyle',\n 'borderBottomWidth',\n 'borderCollapse',\n 'borderColor',\n 'borderImage',\n 'borderInline',\n 'borderInlineColor',\n 'borderInlineEnd',\n 'borderInlineStart',\n 'borderInlineStyle',\n 'borderInlineWidth',\n 'borderLeft',\n 'borderLeftColor',\n 'borderLeftStyle',\n 'borderLeftWidth',\n 'borderRadius',\n 'borderRight',\n 'borderRightColor',\n 'borderRightStyle',\n 'borderRightWidth',\n 'borderSpacing',\n 'borderStyle',\n 'borderTop',\n 'borderTopColor',\n 'borderTopLeftRadius',\n 'borderTopRightRadius',\n 'borderTopStyle',\n 'borderTopWidth',\n 'borderWidth',\n 'bottom',\n 'boxDecorationBreak',\n 'boxShadow',\n 'boxSizing',\n 'breakAfter',\n 'breakBefore',\n 'breakInside',\n 'captionSide',\n 'caretColor',\n 'clear',\n 'clip',\n 'clipPath',\n 'clipRule',\n 'color',\n 'colorScheme',\n 'columnCount',\n 'columnFill',\n 'columnGap',\n 'columnRule',\n 'columnRuleColor',\n 'columnRuleStyle',\n 'columnRuleWidth',\n 'columnSpan',\n 'columnWidth',\n 'columns',\n 'contain',\n 'containerName',\n 'containerType',\n 'content',\n 'contentVisibility',\n 'counterIncrement',\n 'counterReset',\n 'counterSet',\n 'cursor',\n 'direction',\n 'display',\n 'dominantBaseline',\n 'emptyCells',\n 'fillOpacity',\n 'fillRule',\n 'filter',\n 'flex',\n 'flexBasis',\n 'flexDirection',\n 'flexFlow',\n 'flexGrow',\n 'flexShrink',\n 'flexWrap',\n 'float',\n 'floodColor',\n 'floodOpacity',\n 'font',\n 'fontFamily',\n 'fontFeatureSettings',\n 'fontKerning',\n 'fontOpticalSizing',\n 'fontSize',\n 'fontSizeAdjust',\n 'fontStretch',\n 'fontStyle',\n 'fontSynthesis',\n 'fontVariant',\n 'fontVariantAlternates',\n 'fontVariantCaps',\n 'fontVariantEastAsian',\n 'fontVariantLigatures',\n 'fontVariantNumeric',\n 'fontVariantPosition',\n 'fontWeight',\n 'gap',\n 'grid',\n 'gridArea',\n 'gridAutoColumns',\n 'gridAutoFlow',\n 'gridAutoRows',\n 'gridColumn',\n 'gridColumnEnd',\n 'gridColumnStart',\n 'gridRow',\n 'gridRowEnd',\n 'gridRowStart',\n 'gridTemplate',\n 'gridTemplateAreas',\n 'gridTemplateColumns',\n 'gridTemplateRows',\n 'height',\n 'hyphens',\n 'imageRendering',\n 'inlineSize',\n 'inset',\n 'insetBlock',\n 'insetBlockEnd',\n 'insetBlockStart',\n 'insetInline',\n 'insetInlineEnd',\n 'insetInlineStart',\n 'isolation',\n 'justifyContent',\n 'justifyItems',\n 'justifySelf',\n 'left',\n 'letterSpacing',\n 'lightingColor',\n 'lineBreak',\n 'lineHeight',\n 'listStyle',\n 'listStyleImage',\n 'listStylePosition',\n 'listStyleType',\n 'marker',\n 'markerEnd',\n 'markerMid',\n 'markerStart',\n 'margin',\n 'marginBlock',\n 'marginBlockEnd',\n 'marginBlockStart',\n 'marginBottom',\n 'marginInline',\n 'marginInlineEnd',\n 'marginInlineStart',\n 'marginLeft',\n 'marginRight',\n 'marginTop',\n 'maskImage',\n 'maxBlockSize',\n 'maxHeight',\n 'maxInlineSize',\n 'maxWidth',\n 'minBlockSize',\n 'minHeight',\n 'minInlineSize',\n 'minWidth',\n 'mixBlendMode',\n 'objectFit',\n 'objectPosition',\n 'opacity',\n 'order',\n 'orphans',\n 'outline',\n 'outlineColor',\n 'outlineOffset',\n 'outlineStyle',\n 'outlineWidth',\n 'overflow',\n 'overflowAnchor',\n 'overflowWrap',\n 'overflowX',\n 'overflowY',\n 'overscrollBehavior',\n 'padding',\n 'paddingBlock',\n 'paddingBlockEnd',\n 'paddingBlockStart',\n 'paddingBottom',\n 'paddingInline',\n 'paddingInlineEnd',\n 'paddingInlineStart',\n 'paddingLeft',\n 'paddingRight',\n 'paddingTop',\n 'perspective',\n 'perspectiveOrigin',\n 'placeContent',\n 'placeItems',\n 'placeSelf',\n 'pointerEvents',\n 'position',\n 'quotes',\n 'resize',\n 'right',\n 'rotate',\n 'rowGap',\n 'scale',\n 'scrollBehavior',\n 'scrollMargin',\n 'scrollMarginBlock',\n 'scrollMarginBlockEnd',\n 'scrollMarginBlockStart',\n 'scrollMarginBottom',\n 'scrollMarginInline',\n 'scrollMarginInlineEnd',\n 'scrollMarginInlineStart',\n 'scrollMarginLeft',\n 'scrollMarginRight',\n 'scrollMarginTop',\n 'scrollPadding',\n 'scrollPaddingBlock',\n 'scrollPaddingBlockEnd',\n 'scrollPaddingBlockStart',\n 'scrollPaddingBottom',\n 'scrollPaddingInline',\n 'scrollPaddingInlineEnd',\n 'scrollPaddingInlineStart',\n 'scrollPaddingLeft',\n 'scrollPaddingRight',\n 'scrollPaddingTop',\n 'scrollSnapAlign',\n 'scrollSnapStop',\n 'scrollSnapType',\n 'scrollbarColor',\n 'scrollbarGutter',\n 'scrollbarWidth',\n 'shapeOutside',\n 'shapeRendering',\n 'stopColor',\n 'stopOpacity',\n 'stroke',\n 'strokeDasharray',\n 'strokeDashoffset',\n 'strokeLinecap',\n 'strokeLinejoin',\n 'strokeMiterlimit',\n 'strokeOpacity',\n 'strokeWidth',\n 'tabSize',\n 'tableLayout',\n 'textAlign',\n 'textAlignLast',\n 'textAnchor',\n 'textCombineUpright',\n 'textDecoration',\n 'textDecorationColor',\n 'textDecorationLine',\n 'textDecorationSkipInk',\n 'textDecorationStyle',\n 'textDecorationThickness',\n 'textEmphasis',\n 'textIndent',\n 'textOrientation',\n 'textOverflow',\n 'textRendering',\n 'textShadow',\n 'textSizeAdjust',\n 'textTransform',\n 'textUnderlineOffset',\n 'textUnderlinePosition',\n 'textWrap',\n 'top',\n 'touchAction',\n 'transform',\n 'transformOrigin',\n 'transformStyle',\n 'transition',\n 'transitionDelay',\n 'transitionDuration',\n 'transitionProperty',\n 'transitionTimingFunction',\n 'translate',\n 'unicodeBidi',\n 'userSelect',\n 'verticalAlign',\n 'visibility',\n 'whiteSpace',\n 'widows',\n 'width',\n 'willChange',\n 'wordBreak',\n 'wordSpacing',\n 'writingMode',\n 'zIndex',\n]);\n\n/**\n * Built-in custom units recognized by the tasty parser.\n */\nexport const BUILT_IN_UNITS = new Set(['x', 'r', 'cr', 'bw', 'ow', 'lh', 'sf']);\n\n/**\n * Standard CSS units (always valid).\n */\nexport const CSS_UNITS = new Set([\n 'px',\n 'em',\n 'rem',\n '%',\n 'vw',\n 'vh',\n 'vmin',\n 'vmax',\n 'ch',\n 'ex',\n 'cm',\n 'mm',\n 'in',\n 'pt',\n 'pc',\n 'fr',\n 'deg',\n 'rad',\n 'turn',\n 'grad',\n 's',\n 'ms',\n 'dpi',\n 'dpcm',\n 'dppx',\n 'svw',\n 'svh',\n 'lvw',\n 'lvh',\n 'dvw',\n 'dvh',\n 'cqw',\n 'cqh',\n 'cqi',\n 'cqb',\n 'cqmin',\n 'cqmax',\n 'cap',\n 'ic',\n 'rlh',\n 'vi',\n 'vb',\n]);\n\n/**\n * Properties that accept `true` as a value (means \"use default\").\n */\nexport const BOOLEAN_TRUE_PROPERTIES = new Set([\n 'border',\n 'radius',\n 'padding',\n 'margin',\n 'gap',\n 'fill',\n 'color',\n 'shadow',\n 'outline',\n 'inset',\n 'width',\n 'height',\n 'hide',\n 'preset',\n 'font',\n 'scrollbar',\n]);\n\n/**\n * Directional modifiers and which properties accept them.\n */\nexport const DIRECTIONAL_MODIFIERS: Record<string, Set<string>> = {\n border: new Set(['top', 'right', 'bottom', 'left']),\n radius: new Set([\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'top-left',\n 'top-right',\n 'bottom-left',\n 'bottom-right',\n ]),\n padding: new Set(['top', 'right', 'bottom', 'left']),\n margin: new Set(['top', 'right', 'bottom', 'left']),\n fade: new Set(['top', 'right', 'bottom', 'left']),\n inset: new Set(['top', 'right', 'bottom', 'left']),\n};\n\n/**\n * Properties whose 4-value box syntax round-trips losslessly to a directional\n * shorthand, mapped to the *identity* token that marks an unset side.\n *\n * The identity is per-property because it is the CSS initial value of the\n * longhand, not always `0`:\n * - `margin` / `padding` — initial is `0`, so zero tokens are placeholders.\n * - `inset` — initial is `auto`. A `0` here is a REAL offset that the\n * directional shorthand would silently drop, so `auto` is the placeholder.\n *\n * Deliberately excluded because the rewrite is *not* equivalent:\n * - `radius` — the four positions are corners, and a directional modifier\n * addresses a corner pair (`radius: '4px bottom'` rounds both bottom\n * corners), so a single-corner value has no directional equivalent.\n * - `border` — four tokens parse as one border value (width/style/color),\n * not as a box, so there are no per-side placeholders to collapse.\n * - `fade` — each side becomes its own gradient group; collapsing changes the\n * emitted `mask` layers.\n */\nexport const DIRECTIONAL_BOX_IDENTITY: Record<string, string> = {\n margin: '0',\n padding: '0',\n inset: 'auto',\n};\n\n/**\n * Valid radius shape keywords.\n */\nexport const RADIUS_SHAPES = new Set(['round', 'ellipse', 'leaf', 'backleaf']);\n\n/**\n * Known semantic transition names.\n */\nexport const SEMANTIC_TRANSITIONS = new Set([\n 'fade',\n 'fill',\n 'border',\n 'radius',\n 'shadow',\n 'preset',\n 'gap',\n 'theme',\n 'color',\n 'outline',\n 'dimension',\n 'flow',\n 'inset',\n 'text',\n 'opacity',\n 'translate',\n 'rotate',\n 'scale',\n 'filter',\n 'image',\n 'background',\n 'width',\n 'height',\n 'zIndex',\n]);\n\n/**\n * Mapping of native CSS properties to tasty shorthand alternatives.\n */\nexport const SHORTHAND_MAPPING: Record<\n string,\n { property: string; hint: string; safeFix?: boolean }\n> = {\n backgroundColor: { property: 'fill', hint: \"fill: '...'\", safeFix: true },\n borderColor: { property: 'border', hint: \"border: '...'\" },\n borderWidth: { property: 'border', hint: \"border: '...'\" },\n borderStyle: { property: 'border', hint: \"border: '...'\" },\n borderTop: { property: 'border', hint: \"border: '... top'\" },\n borderRight: { property: 'border', hint: \"border: '... right'\" },\n borderBottom: { property: 'border', hint: \"border: '... bottom'\" },\n borderLeft: { property: 'border', hint: \"border: '... left'\" },\n borderRadius: { property: 'radius', hint: \"radius: '...'\", safeFix: true },\n maxWidth: { property: 'width', hint: \"width: 'max ...'\" },\n minWidth: { property: 'width', hint: \"width: 'min ...'\" },\n maxHeight: { property: 'height', hint: \"height: 'max ...'\" },\n minHeight: { property: 'height', hint: \"height: 'min ...'\" },\n flexDirection: { property: 'flow', hint: \"flow: '...'\" },\n flexWrap: { property: 'flow', hint: \"flow: '...'\" },\n flexFlow: { property: 'flow', hint: \"flow: '...'\" },\n gridAutoFlow: { property: 'flow', hint: \"flow: '...'\" },\n outlineOffset: { property: 'outline', hint: \"outline: '... / offset'\" },\n paddingTop: { property: 'padding', hint: \"padding: '... top'\" },\n paddingRight: { property: 'padding', hint: \"padding: '... right'\" },\n paddingBottom: { property: 'padding', hint: \"padding: '... bottom'\" },\n paddingLeft: { property: 'padding', hint: \"padding: '... left'\" },\n marginTop: { property: 'margin', hint: \"margin: '... top'\" },\n marginRight: { property: 'margin', hint: \"margin: '... right'\" },\n marginBottom: { property: 'margin', hint: \"margin: '... bottom'\" },\n marginLeft: { property: 'margin', hint: \"margin: '... left'\" },\n fontSize: { property: 'preset', hint: \"preset: '...'\" },\n fontWeight: {\n property: 'preset',\n hint: \"preset: 'name / strong' (with strong modifier)\",\n },\n lineHeight: {\n property: 'preset',\n hint: \"preset: 'name / tight' (with tight modifier)\",\n },\n boxShadow: { property: 'shadow', hint: \"shadow: '...'\" },\n backgroundImage: { property: 'image', hint: \"image: '...'\" },\n fontFamily: { property: 'font', hint: \"font: '...'\" },\n fontStyle: {\n property: 'preset',\n hint: \"preset: 'name / italic' (with italic modifier)\",\n },\n letterSpacing: { property: 'preset', hint: \"preset: '...'\" },\n textTransform: { property: 'preset', hint: \"preset: '...'\" },\n flexGap: { property: 'gap', hint: \"gap: '...'\" },\n scrollbarWidth: { property: 'scrollbar', hint: \"scrollbar: '...'\" },\n scrollbarColor: { property: 'scrollbar', hint: \"scrollbar: '...'\" },\n scrollbarGutter: { property: 'scrollbar', hint: \"scrollbar: '...'\" },\n gridTemplateColumns: {\n property: 'gridColumns',\n hint: \"gridColumns: '...'\",\n },\n gridTemplateRows: { property: 'gridRows', hint: \"gridRows: '...'\" },\n gridTemplateAreas: { property: 'gridAreas', hint: \"gridAreas: '...'\" },\n top: { property: 'inset', hint: \"inset: '... top'\" },\n right: { property: 'inset', hint: \"inset: '... right'\" },\n bottom: { property: 'inset', hint: \"inset: '... bottom'\" },\n left: { property: 'inset', hint: \"inset: '... left'\" },\n outlineColor: { property: 'outline', hint: \"outline: '...'\" },\n outlineWidth: { property: 'outline', hint: \"outline: '...'\" },\n outlineStyle: { property: 'outline', hint: \"outline: '...'\" },\n lineClamp: {\n property: 'textOverflow',\n hint: \"textOverflow: 'ellipsis / {lines}'\",\n },\n};\n\n/**\n * CSS shorthands whose *longhands* are the preferred Tasty form — the reverse\n * of `SHORTHAND_MAPPING`.\n *\n * `flex` is lossy in a way the longhands are not: it resets the two components\n * you did not write to values that are not their CSS initial. `flex: '0'`\n * expands to `flex-grow: 0; flex-shrink: 1; flex-basis: 0%`, so it cannot\n * express \"do not shrink\" (`flexShrink: 0`) at all, and it silently changes\n * `flex-basis`. Writing the longhands keeps each component independent, which\n * also lets them carry separate state maps.\n */\nexport const LONGHAND_MAPPING: Record<\n string,\n { longhands: string[]; hint: string }\n> = {\n flex: {\n longhands: ['flexGrow', 'flexShrink', 'flexBasis'],\n hint: 'flexGrow / flexShrink / flexBasis',\n },\n};\n\n/**\n * CSS transition property names mapped to Tasty semantic transition names.\n */\nexport const TRANSITION_SEMANTIC_MAPPING: Record<string, string> = {\n backgroundColor: 'fill',\n 'background-color': 'fill',\n backgroundImage: 'image',\n 'background-image': 'image',\n borderRadius: 'radius',\n 'border-radius': 'radius',\n borderColor: 'border',\n 'border-color': 'border',\n borderWidth: 'border',\n 'border-width': 'border',\n borderStyle: 'border',\n 'border-style': 'border',\n boxShadow: 'shadow',\n 'box-shadow': 'shadow',\n outlineColor: 'outline',\n 'outline-color': 'outline',\n outlineWidth: 'outline',\n 'outline-width': 'outline',\n outlineOffset: 'outline',\n 'outline-offset': 'outline',\n gridTemplateColumns: 'gridColumns',\n 'grid-template-columns': 'gridColumns',\n gridTemplateRows: 'gridRows',\n 'grid-template-rows': 'gridRows',\n flexDirection: 'flow',\n 'flex-direction': 'flow',\n gridAutoFlow: 'flow',\n 'grid-auto-flow': 'flow',\n fontSize: 'preset',\n 'font-size': 'preset',\n lineHeight: 'preset',\n 'line-height': 'preset',\n letterSpacing: 'preset',\n 'letter-spacing': 'preset',\n};\n\n/**\n * Known preset modifiers.\n */\nexport const PRESET_MODIFIERS = new Set([\n 'strong',\n 'bold',\n 'italic',\n 'icon',\n 'tight',\n]);\n\n/**\n * Default import sources for tasty.\n */\nexport const DEFAULT_IMPORT_SOURCES = ['@tenphi/tasty', '@tenphi/tasty/static'];\n\n/**\n * Built-in state prefixes that are always valid (not aliases).\n */\nexport const BUILT_IN_STATE_PREFIXES = new Set([\n '@media',\n '@root',\n '@parent',\n '@own',\n '@supports',\n '@starting',\n '@keyframes',\n '@properties',\n '@fontFace',\n '@counterStyle',\n]);\n\n/**\n * Known CSS pseudo-classes.\n */\nexport const KNOWN_PSEUDO_CLASSES = new Set([\n ':hover',\n ':focus',\n ':focus-visible',\n ':focus-within',\n ':active',\n ':visited',\n ':link',\n ':checked',\n ':disabled',\n ':enabled',\n ':empty',\n ':first-child',\n ':last-child',\n ':first-of-type',\n ':last-of-type',\n ':only-child',\n ':only-of-type',\n ':root',\n ':target',\n ':valid',\n ':invalid',\n ':required',\n ':optional',\n ':read-only',\n ':read-write',\n ':placeholder-shown',\n ':autofill',\n ':default',\n ':indeterminate',\n ':in-range',\n ':out-of-range',\n ':any-link',\n ':local-link',\n ':is',\n ':not',\n ':where',\n ':has',\n ':nth-child',\n ':nth-last-child',\n ':nth-of-type',\n ':nth-last-of-type',\n '::before',\n '::after',\n '::placeholder',\n '::selection',\n '::first-line',\n '::first-letter',\n '::marker',\n '::backdrop',\n]);\n\n/**\n * CSS named colors (level 1–4) that should be replaced by `#color` tokens.\n * `transparent` and `currentcolor` are excluded — they have their own token\n * suggestions (`#clear`, `#current`) handled by `prefer-custom-property-syntax`.\n */\nexport const NAMED_CSS_COLORS = new Set<string>([\n 'aliceblue',\n 'antiquewhite',\n 'aqua',\n 'aquamarine',\n 'azure',\n 'beige',\n 'bisque',\n 'black',\n 'blanchedalmond',\n 'blue',\n 'blueviolet',\n 'brown',\n 'burlywood',\n 'cadetblue',\n 'chartreuse',\n 'chocolate',\n 'coral',\n 'cornflowerblue',\n 'cornsilk',\n 'crimson',\n 'cyan',\n 'darkblue',\n 'darkcyan',\n 'darkgoldenrod',\n 'darkgray',\n 'darkgreen',\n 'darkgrey',\n 'darkkhaki',\n 'darkmagenta',\n 'darkolivegreen',\n 'darkorange',\n 'darkorchid',\n 'darkred',\n 'darksalmon',\n 'darkseagreen',\n 'darkslateblue',\n 'darkslategray',\n 'darkslategrey',\n 'darkturquoise',\n 'darkviolet',\n 'deeppink',\n 'deepskyblue',\n 'dimgray',\n 'dimgrey',\n 'dodgerblue',\n 'firebrick',\n 'floralwhite',\n 'forestgreen',\n 'fuchsia',\n 'gainsboro',\n 'ghostwhite',\n 'gold',\n 'goldenrod',\n 'gray',\n 'green',\n 'greenyellow',\n 'grey',\n 'honeydew',\n 'hotpink',\n 'indianred',\n 'indigo',\n 'ivory',\n 'khaki',\n 'lavender',\n 'lavenderblush',\n 'lawngreen',\n 'lemonchiffon',\n 'lightblue',\n 'lightcoral',\n 'lightcyan',\n 'lightgoldenrodyellow',\n 'lightgray',\n 'lightgreen',\n 'lightgrey',\n 'lightpink',\n 'lightsalmon',\n 'lightseagreen',\n 'lightskyblue',\n 'lightslategray',\n 'lightslategrey',\n 'lightsteelblue',\n 'lightyellow',\n 'lime',\n 'limegreen',\n 'linen',\n 'magenta',\n 'maroon',\n 'mediumaquamarine',\n 'mediumblue',\n 'mediumorchid',\n 'mediumpurple',\n 'mediumseagreen',\n 'mediumslateblue',\n 'mediumspringgreen',\n 'mediumturquoise',\n 'mediumvioletred',\n 'midnightblue',\n 'mintcream',\n 'mistyrose',\n 'moccasin',\n 'navajowhite',\n 'navy',\n 'oldlace',\n 'olive',\n 'olivedrab',\n 'orange',\n 'orangered',\n 'orchid',\n 'palegoldenrod',\n 'palegreen',\n 'paleturquoise',\n 'palevioletred',\n 'papayawhip',\n 'peachpuff',\n 'peru',\n 'pink',\n 'plum',\n 'powderblue',\n 'purple',\n 'rebeccapurple',\n 'red',\n 'rosybrown',\n 'royalblue',\n 'saddlebrown',\n 'salmon',\n 'sandybrown',\n 'seagreen',\n 'seashell',\n 'sienna',\n 'silver',\n 'skyblue',\n 'slateblue',\n 'slategray',\n 'slategrey',\n 'snow',\n 'springgreen',\n 'steelblue',\n 'tan',\n 'teal',\n 'thistle',\n 'tomato',\n 'turquoise',\n 'violet',\n 'wheat',\n 'white',\n 'whitesmoke',\n 'yellow',\n 'yellowgreen',\n]);\n\n/**\n * Properties that accept color values. Used to scope named-color checks so\n * string properties like `content` or `cursor` don't false-positive.\n */\nexport const COLOR_BEARING_PROPERTIES = new Set<string>([\n // Tasty enhanced properties\n 'fill',\n 'color',\n 'caretColor',\n 'accentColor',\n 'shadow',\n 'border',\n 'outline',\n 'fade',\n // CSS background\n 'background',\n 'backgroundColor',\n // CSS border colors\n 'borderColor',\n 'borderTopColor',\n 'borderRightColor',\n 'borderBottomColor',\n 'borderLeftColor',\n // CSS shadows\n 'boxShadow',\n 'textShadow',\n // CSS text decoration\n 'textDecorationColor',\n // CSS outline / misc\n 'outlineColor',\n 'scrollbarColor',\n 'columnRuleColor',\n // SVG\n 'stroke',\n 'stopColor',\n 'floodColor',\n 'lightingColor',\n]);\n"],"mappings":";;;;AAGA,MAAa,yBAAyB,IAAI,IAAI;CAC5C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;AAKF,MAAa,qBAAqB,IAAI,IAAI;CACxC;CACA;CACA;CACA;CACD,CAAC;;;;;AAMF,MAAa,uBAAuB,IAAI,IAAI;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;AAKF,MAAa,iBAAiB,IAAI,IAAI;CAAC;CAAK;CAAK;CAAM;CAAM;CAAM;CAAM;CAAK,CAAC;;;;AAK/E,MAAa,YAAY,IAAI,IAAI;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;C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CAClB,cAAc;CACd,kBAAkB;CAClB,UAAU;CACV,aAAa;CACb,YAAY;CACZ,eAAe;CACf,eAAe;CACf,kBAAkB;CACnB;;;;AAKD,MAAa,mBAAmB,IAAI,IAAI;CACtC;CACA;CACA;CACA;CACA;CACD,CAAC;;;;AAKF,MAAa,yBAAyB,CAAC,iBAAiB,uBAAuB;;;;AAK/E,MAAa,0BAA0B,IAAI,IAAI;CAC7C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;AAKF,MAAa,uBAAuB,IAAI,IAAI;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;;;AAOF,MAAa,mBAAmB,IAAI,IAAY;CAC9C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;;AAMF,MAAa,2BAA2B,IAAI,IAAY;CAEtD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;CAEA;CACA;CACA;CAEA;CACA;CACA;CACA;CACD,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { getStringValue } from "./utils.js";
|
|
2
|
+
|
|
3
|
+
//#region src/fix-utils.ts
|
|
4
|
+
/**
|
|
5
|
+
* Source range of a string literal's content, excluding the surrounding
|
|
6
|
+
* quotes/backticks. Returns null for non-string nodes (or template literals
|
|
7
|
+
* with expressions, whose cooked value is not a simple substring of source).
|
|
8
|
+
*/
|
|
9
|
+
function getStringContentRange(node) {
|
|
10
|
+
if (node.type === "Literal" && typeof node.value === "string") return {
|
|
11
|
+
start: node.range[0] + 1,
|
|
12
|
+
end: node.range[1] - 1
|
|
13
|
+
};
|
|
14
|
+
if (node.type === "TemplateLiteral" && node.expressions.length === 0) return {
|
|
15
|
+
start: node.range[0] + 1,
|
|
16
|
+
end: node.range[1] - 1
|
|
17
|
+
};
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Build non-overlapping range fixes inside a string literal's content.
|
|
22
|
+
*
|
|
23
|
+
* `edits` are offsets within the value string the rule already scanned (the
|
|
24
|
+
* cooked value returned by `getStringValue`). They are mapped to source ranges
|
|
25
|
+
* inside the literal content.
|
|
26
|
+
*
|
|
27
|
+
* Escape guard: when the raw source content does not equal the cooked value
|
|
28
|
+
* (i.e. the literal contains escape sequences), character offsets would drift,
|
|
29
|
+
* so we bail out and emit no fix. Tasty style values rarely contain escapes,
|
|
30
|
+
* so this loses almost nothing while staying correct.
|
|
31
|
+
*/
|
|
32
|
+
function replaceInStringValue(fixer, valueNode, edits, sourceCode) {
|
|
33
|
+
const contentRange = getStringContentRange(valueNode);
|
|
34
|
+
if (!contentRange) return null;
|
|
35
|
+
const rawContent = sourceCode.getText(valueNode).slice(1, -1);
|
|
36
|
+
const cooked = getStringValue(valueNode);
|
|
37
|
+
if (cooked === null || rawContent !== cooked) return null;
|
|
38
|
+
const sorted = [...edits].sort((a, b) => a.start - b.start);
|
|
39
|
+
for (let i = 1; i < sorted.length; i++) if (sorted[i].start < sorted[i - 1].end) return null;
|
|
40
|
+
return sorted.map((edit) => fixer.replaceTextRange([contentRange.start + edit.start, contentRange.start + edit.end], edit.replacement));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Replace the entire content of a string literal (keeping the surrounding
|
|
44
|
+
* quotes/backticks intact). Safe for replacements that contain no quote
|
|
45
|
+
* characters (true for all Tasty token rewrites).
|
|
46
|
+
*/
|
|
47
|
+
function replaceStringValue(fixer, valueNode, newValue) {
|
|
48
|
+
const contentRange = getStringContentRange(valueNode);
|
|
49
|
+
if (!contentRange) return null;
|
|
50
|
+
return fixer.replaceTextRange([contentRange.start, contentRange.end], newValue);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Remove an object property along with an adjacent comma so the result is
|
|
54
|
+
* valid syntax. Prefers removing the comma/whitespace after the property;
|
|
55
|
+
* for a trailing property, removes the comma/whitespace before it instead.
|
|
56
|
+
*/
|
|
57
|
+
function removePropertyWithComma(fixer, prop, sourceCode) {
|
|
58
|
+
const objectNode = prop.parent;
|
|
59
|
+
if (!objectNode || objectNode.type !== "ObjectExpression") return null;
|
|
60
|
+
const props = objectNode.properties;
|
|
61
|
+
const idx = props.indexOf(prop);
|
|
62
|
+
if (idx === -1) return null;
|
|
63
|
+
if (idx < props.length - 1) {
|
|
64
|
+
const nextStart = props[idx + 1].range[0];
|
|
65
|
+
return fixer.removeRange([prop.range[0], nextStart]);
|
|
66
|
+
}
|
|
67
|
+
const removeStart = idx > 0 ? props[idx - 1].range[1] : objectNode.range[0] + 1;
|
|
68
|
+
return fixer.removeRange([removeStart, prop.range[1]]);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Move a property to `targetIndex` within its parent object (indexed among
|
|
72
|
+
* `Property` members only). Rebuilds the content between the braces with the
|
|
73
|
+
* properties joined by `, ` — acceptable for state maps, which are simple and
|
|
74
|
+
* rarely carry inline comments. Returns null when the property is already at
|
|
75
|
+
* the target index.
|
|
76
|
+
*/
|
|
77
|
+
function movePropertyToIndex(fixer, prop, targetIndex, sourceCode) {
|
|
78
|
+
const objectNode = prop.parent;
|
|
79
|
+
if (!objectNode || objectNode.type !== "ObjectExpression") return null;
|
|
80
|
+
const props = objectNode.properties.filter((p) => p.type === "Property");
|
|
81
|
+
const idx = props.indexOf(prop);
|
|
82
|
+
if (idx === -1 || idx === targetIndex) return null;
|
|
83
|
+
const reordered = [...props];
|
|
84
|
+
const [moved] = reordered.splice(idx, 1);
|
|
85
|
+
reordered.splice(targetIndex, 0, moved);
|
|
86
|
+
const newText = reordered.map((p) => sourceCode.getText(p)).join(", ");
|
|
87
|
+
return fixer.replaceTextRange([objectNode.range[0] + 1, objectNode.range[1] - 1], ` ${newText} `);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
//#endregion
|
|
91
|
+
export { movePropertyToIndex, removePropertyWithComma, replaceInStringValue, replaceStringValue };
|
|
92
|
+
//# sourceMappingURL=fix-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fix-utils.js","names":[],"sources":["../src/fix-utils.ts"],"sourcesContent":["import type { TSESLint, TSESTree } from '@typescript-eslint/utils';\nimport { getStringValue } from './utils.js';\n\n/**\n * Source range of a string literal's content, excluding the surrounding\n * quotes/backticks. Returns null for non-string nodes (or template literals\n * with expressions, whose cooked value is not a simple substring of source).\n */\nexport function getStringContentRange(\n node: TSESTree.Node,\n): { start: number; end: number } | null {\n if (node.type === 'Literal' && typeof node.value === 'string') {\n return { start: node.range[0] + 1, end: node.range[1] - 1 };\n }\n if (node.type === 'TemplateLiteral' && node.expressions.length === 0) {\n return { start: node.range[0] + 1, end: node.range[1] - 1 };\n }\n return null;\n}\n\nexport interface StringEdit {\n /** Offset within the (cooked) value string where the edit starts. */\n start: number;\n /** Offset where the edit ends (exclusive). */\n end: number;\n /** Replacement text. */\n replacement: string;\n}\n\n/**\n * Build non-overlapping range fixes inside a string literal's content.\n *\n * `edits` are offsets within the value string the rule already scanned (the\n * cooked value returned by `getStringValue`). They are mapped to source ranges\n * inside the literal content.\n *\n * Escape guard: when the raw source content does not equal the cooked value\n * (i.e. the literal contains escape sequences), character offsets would drift,\n * so we bail out and emit no fix. Tasty style values rarely contain escapes,\n * so this loses almost nothing while staying correct.\n */\nexport function replaceInStringValue(\n fixer: TSESLint.RuleFixer,\n valueNode: TSESTree.Node,\n edits: StringEdit[],\n sourceCode: TSESLint.SourceCode,\n): TSESLint.RuleFix[] | null {\n const contentRange = getStringContentRange(valueNode);\n if (!contentRange) return null;\n\n const rawContent = sourceCode.getText(valueNode).slice(1, -1);\n const cooked = getStringValue(valueNode);\n if (cooked === null || rawContent !== cooked) return null;\n\n const sorted = [...edits].sort((a, b) => a.start - b.start);\n for (let i = 1; i < sorted.length; i++) {\n if (sorted[i].start < sorted[i - 1].end) return null;\n }\n\n return sorted.map((edit) =>\n fixer.replaceTextRange(\n [contentRange.start + edit.start, contentRange.start + edit.end],\n edit.replacement,\n ),\n );\n}\n\n/**\n * Replace the entire content of a string literal (keeping the surrounding\n * quotes/backticks intact). Safe for replacements that contain no quote\n * characters (true for all Tasty token rewrites).\n */\nexport function replaceStringValue(\n fixer: TSESLint.RuleFixer,\n valueNode: TSESTree.Node,\n newValue: string,\n): TSESLint.RuleFix | null {\n const contentRange = getStringContentRange(valueNode);\n if (!contentRange) return null;\n return fixer.replaceTextRange(\n [contentRange.start, contentRange.end],\n newValue,\n );\n}\n\n/**\n * Remove an object property along with an adjacent comma so the result is\n * valid syntax. Prefers removing the comma/whitespace after the property;\n * for a trailing property, removes the comma/whitespace before it instead.\n */\nexport function removePropertyWithComma(\n fixer: TSESLint.RuleFixer,\n prop: TSESTree.Property,\n sourceCode: TSESLint.SourceCode,\n): TSESLint.RuleFix | null {\n const objectNode = prop.parent;\n if (!objectNode || objectNode.type !== 'ObjectExpression') return null;\n\n const props = objectNode.properties;\n const idx = props.indexOf(prop);\n if (idx === -1) return null;\n\n void sourceCode;\n\n if (idx < props.length - 1) {\n const nextStart = props[idx + 1].range[0];\n return fixer.removeRange([prop.range[0], nextStart]);\n }\n\n const removeStart =\n idx > 0 ? props[idx - 1].range[1] : objectNode.range[0] + 1;\n return fixer.removeRange([removeStart, prop.range[1]]);\n}\n\n/**\n * Move a property to `targetIndex` within its parent object (indexed among\n * `Property` members only). Rebuilds the content between the braces with the\n * properties joined by `, ` — acceptable for state maps, which are simple and\n * rarely carry inline comments. Returns null when the property is already at\n * the target index.\n */\nexport function movePropertyToIndex(\n fixer: TSESLint.RuleFixer,\n prop: TSESTree.Property,\n targetIndex: number,\n sourceCode: TSESLint.SourceCode,\n): TSESLint.RuleFix | null {\n const objectNode = prop.parent;\n if (!objectNode || objectNode.type !== 'ObjectExpression') return null;\n\n const props = objectNode.properties.filter(\n (p): p is TSESTree.Property => p.type === 'Property',\n );\n const idx = props.indexOf(prop);\n if (idx === -1 || idx === targetIndex) return null;\n\n const reordered = [...props];\n const [moved] = reordered.splice(idx, 1);\n reordered.splice(targetIndex, 0, moved);\n\n const newText = reordered.map((p) => sourceCode.getText(p)).join(', ');\n\n return fixer.replaceTextRange(\n [objectNode.range[0] + 1, objectNode.range[1] - 1],\n ` ${newText} `,\n );\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,sBACd,MACuC;AACvC,KAAI,KAAK,SAAS,aAAa,OAAO,KAAK,UAAU,SACnD,QAAO;EAAE,OAAO,KAAK,MAAM,KAAK;EAAG,KAAK,KAAK,MAAM,KAAK;EAAG;AAE7D,KAAI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C;;CAGtD,MAAM,cACJ,MAAM,IAAI,MAAM,MAAM,GAAG,MAAM,KAAK,WAAW,MAAM,KAAK;AAC5D,QAAO,MAAM,YAAY,CAAC,aAAa,KAAK,MAAM,GAAG,CAAC;;;;;;;;;AAUxD,SAAgB,oBACd,OACA,MACA,aACA,YACyB;CACzB,MAAM,aAAa,KAAK;AACxB,KAAI,CAAC,cAAc,WAAW,SAAS,mBAAoB,QAAO;CAElE,MAAM,QAAQ,WAAW,WAAW,QACjC,MAA8B,EAAE,SAAS,WAC3C;CACD,MAAM,MAAM,MAAM,QAAQ,KAAK;AAC/B,KAAI,QAAQ,MAAM,QAAQ,YAAa,QAAO;CAE9C,MAAM,YAAY,CAAC,GAAG,MAAM;CAC5B,MAAM,CAAC,SAAS,UAAU,OAAO,KAAK,EAAE;AACxC,WAAU,OAAO,aAAa,GAAG,MAAM;CAEvC,MAAM,UAAU,UAAU,KAAK,MAAM,WAAW,QAAQ,EAAE,CAAC,CAAC,KAAK,KAAK;AAEtE,QAAO,MAAM,iBACX,CAAC,WAAW,MAAM,KAAK,GAAG,WAAW,MAAM,KAAK,EAAE,EAClD,IAAI,QAAQ,GACb"}
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ import prefer_auto_calc_default from "./rules/prefer-auto-calc.js";
|
|
|
31
31
|
import prefer_custom_property_syntax_default from "./rules/prefer-custom-property-syntax.js";
|
|
32
32
|
import prefer_hide_default from "./rules/prefer-hide.js";
|
|
33
33
|
import prefer_directional_shorthand_default from "./rules/prefer-directional-shorthand.js";
|
|
34
|
+
import prefer_longhand_property_default from "./rules/prefer-longhand-property.js";
|
|
34
35
|
import { recommended, strict } from "./configs.js";
|
|
35
36
|
|
|
36
37
|
//#region src/index.ts
|
|
@@ -72,7 +73,8 @@ const plugin = {
|
|
|
72
73
|
"prefer-auto-calc": prefer_auto_calc_default,
|
|
73
74
|
"prefer-custom-property-syntax": prefer_custom_property_syntax_default,
|
|
74
75
|
"prefer-hide": prefer_hide_default,
|
|
75
|
-
"prefer-directional-shorthand": prefer_directional_shorthand_default
|
|
76
|
+
"prefer-directional-shorthand": prefer_directional_shorthand_default,
|
|
77
|
+
"prefer-longhand-property": prefer_longhand_property_default
|
|
76
78
|
},
|
|
77
79
|
configs: {
|
|
78
80
|
recommended: {
|