@tenphi/eslint-plugin-tasty 0.10.0 → 0.11.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 CHANGED
@@ -101,7 +101,7 @@ export default {
101
101
  | `tasty/prefer-auto-calc` | warn | `calc(...)` instead of Tasty auto-calc `(...)` |
102
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`/`inset` with placeholder sides instead of directional form |
104
+ | `tasty/prefer-directional-shorthand` | warn | 4-value `margin`/`padding`/`inset`/`radius`/`fade`/`border` with placeholder positions instead of directional form |
105
105
  | `tasty/prefer-longhand-property` | error | Lossy `flex` shorthand instead of `flexGrow` / `flexShrink` / `flexBasis` |
106
106
 
107
107
  ### Strict (includes all recommended rules)
package/dist/constants.js CHANGED
@@ -578,30 +578,68 @@ 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.
581
+ * Position names a 4-value box maps onto, in source order.
582
+ */
583
+ const BOX_SIDES = [
584
+ "top",
585
+ "right",
586
+ "bottom",
587
+ "left"
588
+ ];
589
+ const BOX_CORNERS = [
590
+ "top-left",
591
+ "top-right",
592
+ "bottom-right",
593
+ "bottom-left"
594
+ ];
595
+ /**
596
+ * Properties whose 4-value box syntax has a directional-shorthand equivalent.
589
597
  *
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
+ * `radius` uses corner names rather than sides: a directional modifier
599
+ * addresses the corner *pair* along an edge, so only `top-left` & co. can
600
+ * express a single corner (requires `@tenphi/tasty` >= 2.10).
598
601
  */
599
- const DIRECTIONAL_BOX_IDENTITY = {
600
- margin: "0",
601
- padding: "0",
602
- inset: "auto"
602
+ const DIRECTIONAL_BOX = {
603
+ margin: {
604
+ identity: "0",
605
+ positions: BOX_SIDES,
606
+ fixable: true
607
+ },
608
+ padding: {
609
+ identity: "0",
610
+ positions: BOX_SIDES,
611
+ fixable: true
612
+ },
613
+ inset: {
614
+ identity: "auto",
615
+ positions: BOX_SIDES,
616
+ fixable: true
617
+ },
618
+ radius: {
619
+ identity: "0",
620
+ positions: BOX_CORNERS,
621
+ fixable: true
622
+ },
623
+ fade: {
624
+ identity: "0",
625
+ positions: BOX_SIDES,
626
+ fixable: true
627
+ },
628
+ border: {
629
+ identity: "0",
630
+ positions: BOX_SIDES,
631
+ fixable: false,
632
+ note: "four border tokens parse as one border value, so the current style sets no border at all"
633
+ }
603
634
  };
604
635
  /**
636
+ * Properties that support a `dock` modifier — pin one edge and span its full
637
+ * length. Lets a 4-value box with a single `identity` side collapse, e.g.
638
+ * `inset: 'auto 0 0 0'` -> `inset: '0 bottom dock'`.
639
+ * Requires `@tenphi/tasty` >= 2.10.
640
+ */
641
+ const DOCK_PROPERTIES = new Set(["inset"]);
642
+ /**
605
643
  * Valid radius shape keywords.
606
644
  */
607
645
  const RADIUS_SHAPES = new Set([
@@ -1175,5 +1213,5 @@ const COLOR_BEARING_PROPERTIES = new Set([
1175
1213
  ]);
1176
1214
 
1177
1215
  //#endregion
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 };
1216
+ export { BOOLEAN_TRUE_PROPERTIES, BUILT_IN_STATE_PREFIXES, BUILT_IN_UNITS, COLOR_BEARING_PROPERTIES, CSS_UNITS, DEFAULT_IMPORT_SOURCES, DIRECTIONAL_BOX, DIRECTIONAL_MODIFIERS, DOCK_PROPERTIES, 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 };
1179
1217
  //# sourceMappingURL=constants.js.map
@@ -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 * 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,IA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AAqB;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;;;;;;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"}
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 * Position names a 4-value box maps onto, in source order.\n */\nexport const BOX_SIDES = ['top', 'right', 'bottom', 'left'] as const;\nexport const BOX_CORNERS = [\n 'top-left',\n 'top-right',\n 'bottom-right',\n 'bottom-left',\n] as const;\n\nexport interface DirectionalBoxConfig {\n /**\n * The token that marks an unset position — dropping it from the shorthand\n * leaves the emitted CSS unchanged. This is the CSS initial value of the\n * longhand, which is not always `0`: `inset` initialises to `auto`, so a `0`\n * there is a real offset the shorthand must not drop.\n */\n identity: string;\n /** Modifier names for each of the four positions, in source order. */\n positions: readonly string[];\n /**\n * Whether `eslint --fix` may apply the rewrite. False when the rewrite is\n * still an improvement but changes what the browser renders, so a human has\n * to opt in.\n */\n fixable: boolean;\n /**\n * Set when the 4-value form is not interpreted per-position at all, so the\n * current output is wrong rather than merely verbose. Surfaced in the report.\n */\n note?: string;\n}\n\n/**\n * Properties whose 4-value box syntax has a directional-shorthand equivalent.\n *\n * `radius` uses corner names rather than sides: a directional modifier\n * addresses the corner *pair* along an edge, so only `top-left` & co. can\n * express a single corner (requires `@tenphi/tasty` >= 2.10).\n */\nexport const DIRECTIONAL_BOX: Record<string, DirectionalBoxConfig> = {\n margin: { identity: '0', positions: BOX_SIDES, fixable: true },\n padding: { identity: '0', positions: BOX_SIDES, fixable: true },\n inset: { identity: 'auto', positions: BOX_SIDES, fixable: true },\n radius: { identity: '0', positions: BOX_CORNERS, fixable: true },\n fade: { identity: '0', positions: BOX_SIDES, fixable: true },\n // Four `border` tokens parse as a single border value (width/style/color),\n // not as a box: `border: '0 0 1bw 0'` emits `border: 0 solid …` — no border\n // on any side. The directional form is what the author meant, but applying\n // it changes rendering, so it stays a manual fix.\n border: {\n identity: '0',\n positions: BOX_SIDES,\n fixable: false,\n note: 'four border tokens parse as one border value, so the current style sets no border at all',\n },\n};\n\n/**\n * Properties that support a `dock` modifier — pin one edge and span its full\n * length. Lets a 4-value box with a single `identity` side collapse, e.g.\n * `inset: 'auto 0 0 0'` -> `inset: '0 bottom dock'`.\n * Requires `@tenphi/tasty` >= 2.10.\n */\nexport const DOCK_PROPERTIES = new Set(['inset']);\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;CACA;CACA;CACA;CACA;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,0BAA0B,IAAI,IAAI;CAC7C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;AAKF,MAAa,wBAAqD;CAChE,QAAQ,IAAI,IAAI;EAAC;EAAO;EAAS;EAAU;EAAO,CAAC;CACnD,QAAQ,IAAI,IAAI;EACd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;CACF,SAAS,IAAI,IAAI;EAAC;EAAO;EAAS;EAAU;EAAO,CAAC;CACpD,QAAQ,IAAI,IAAI;EAAC;EAAO;EAAS;EAAU;EAAO,CAAC;CACnD,MAAM,IAAI,IAAI;EAAC;EAAO;EAAS;EAAU;EAAO,CAAC;CACjD,OAAO,IAAI,IAAI;EAAC;EAAO;EAAS;EAAU;EAAO,CAAC;CACnD;;;;AAKD,MAAa,YAAY;CAAC;CAAO;CAAS;CAAU;CAAO;AAC3D,MAAa,cAAc;CACzB;CACA;CACA;CACA;CACD;;;;;;;;AAgCD,MAAa,kBAAwD;CACnE,QAAQ;EAAE,UAAU;EAA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ACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;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"}
@@ -1,66 +1,105 @@
1
1
  import { createRule } from "../create-rule.js";
2
- import { DIRECTIONAL_BOX_IDENTITY } from "../constants.js";
2
+ import { DIRECTIONAL_BOX, DOCK_PROPERTIES } from "../constants.js";
3
3
  import { getKeyName, getStringValue } from "../utils.js";
4
4
  import { TastyContext, styleObjectListeners } from "../context.js";
5
5
  import { replaceStringValue } from "../fix-utils.js";
6
6
 
7
7
  //#region src/rules/prefer-directional-shorthand.ts
8
- const SIDES = [
9
- "top",
10
- "right",
11
- "bottom",
12
- "left"
13
- ];
14
8
  function isZeroLike(token) {
15
9
  const trimmed = token.trim();
16
10
  if (trimmed === "0") return true;
17
11
  return /^0+(?:\.0+)?(?:px|em|rem|%|x|r|cr|bw|ow|lh|sf)?$/i.test(trimmed);
18
12
  }
19
13
  /**
20
- * Whether `token` is the placeholder value for an unset side, i.e. dropping it
14
+ * Whether `token` is the placeholder for an unset position, i.e. dropping it
21
15
  * from the shorthand leaves the emitted CSS unchanged.
22
16
  */
23
17
  function isIdentity(token, identity) {
24
18
  if (identity === "auto") return token.trim().toLowerCase() === "auto";
25
19
  return isZeroLike(token);
26
20
  }
27
- function suggestDirectional(value, identity) {
21
+ /**
22
+ * Rewrites a 4-value box into the directional shorthand, or returns null when
23
+ * no equivalent form exists.
24
+ *
25
+ * The value is always carried into the suggestion, never dropped in favour of
26
+ * the property default. Whether an explicit value *equals* the default is
27
+ * project-dependent: `margin` defaults to `var(--gap)` (4px out of the box)
28
+ * while `1x` is 8px, so `margin: '0 0 1x 0'` -> `margin: 'bottom'` would
29
+ * silently change the spacing.
30
+ */
31
+ function suggestDirectional(value, config, supportsDock) {
28
32
  const tokens = value.trim().split(/\s+/);
29
33
  if (tokens.length !== 4) return null;
30
- const meaningful = tokens.map((token, index) => ({
31
- token,
32
- side: SIDES[index]
33
- })).filter(({ token }) => !isIdentity(token, identity));
34
- if (meaningful.length !== 1) return null;
35
- const { token, side } = meaningful[0];
36
- return `${token} ${side}`;
34
+ const { identity, positions } = config;
35
+ const placeholders = tokens.map((token) => isIdentity(token, identity));
36
+ const setCount = placeholders.filter((placeholder) => !placeholder).length;
37
+ if (setCount === 1) {
38
+ const index = placeholders.indexOf(false);
39
+ return `${tokens[index]} ${positions[index]}`;
40
+ }
41
+ if (supportsDock && setCount === 3) {
42
+ const freeIndex = placeholders.indexOf(true);
43
+ const set = tokens.filter((_, index) => index !== freeIndex);
44
+ if (new Set(set).size === 1) return `${set[0]} ${positions[(freeIndex + 2) % 4]} dock`;
45
+ }
46
+ return null;
37
47
  }
38
48
  var prefer_directional_shorthand_default = createRule({
39
49
  name: "prefer-directional-shorthand",
40
50
  meta: {
41
51
  type: "suggestion",
42
52
  fixable: "code",
43
- docs: { description: "Suggest Tasty directional shorthand instead of 4-value CSS box syntax with zero placeholders" },
44
- messages: { preferDirectionalShorthand: "'{{property}}' value '{{raw}}' only sets one side. Use the directional shorthand '{{suggestion}}' (e.g. '1x bottom') instead." },
53
+ hasSuggestions: true,
54
+ docs: { description: "Suggest Tasty directional shorthand instead of 4-value CSS box syntax with placeholder positions" },
55
+ messages: {
56
+ preferDirectionalShorthand: "'{{property}}' value '{{raw}}' only sets part of the box. Use the directional shorthand '{{suggestion}}' instead.",
57
+ preferDirectionalUnrendered: "'{{property}}' value '{{raw}}' does not do what it looks like — {{note}}. Use '{{suggestion}}' instead."
58
+ },
45
59
  schema: []
46
60
  },
47
61
  defaultOptions: [],
48
62
  create(context) {
49
63
  const ctx = new TastyContext(context);
50
64
  function checkValue(property, value, node) {
51
- const suggestion = suggestDirectional(value, DIRECTIONAL_BOX_IDENTITY[property]);
65
+ const config = DIRECTIONAL_BOX[property];
66
+ const suggestion = suggestDirectional(value, config, DOCK_PROPERTIES.has(property));
52
67
  if (!suggestion) return;
68
+ if (config.fixable) {
69
+ context.report({
70
+ node,
71
+ messageId: "preferDirectionalShorthand",
72
+ data: {
73
+ property,
74
+ raw: value,
75
+ suggestion
76
+ },
77
+ fix(fixer) {
78
+ return replaceStringValue(fixer, node, suggestion);
79
+ }
80
+ });
81
+ return;
82
+ }
53
83
  context.report({
54
84
  node,
55
- messageId: "preferDirectionalShorthand",
85
+ messageId: "preferDirectionalUnrendered",
56
86
  data: {
57
87
  property,
58
88
  raw: value,
59
- suggestion
89
+ suggestion,
90
+ note: config.note ?? ""
60
91
  },
61
- fix(fixer) {
62
- return replaceStringValue(fixer, node, suggestion);
63
- }
92
+ suggest: [{
93
+ messageId: "preferDirectionalShorthand",
94
+ data: {
95
+ property,
96
+ raw: value,
97
+ suggestion
98
+ },
99
+ fix(fixer) {
100
+ return replaceStringValue(fixer, node, suggestion);
101
+ }
102
+ }]
64
103
  });
65
104
  }
66
105
  function handleStyleObject(node) {
@@ -69,7 +108,7 @@ var prefer_directional_shorthand_default = createRule({
69
108
  if (prop.type !== "Property" || prop.computed) continue;
70
109
  const key = getKeyName(prop.key);
71
110
  if (key === null) continue;
72
- if (!(key in DIRECTIONAL_BOX_IDENTITY)) continue;
111
+ if (!(key in DIRECTIONAL_BOX)) continue;
73
112
  const str = getStringValue(prop.value);
74
113
  if (str) {
75
114
  checkValue(key, str, prop.value);
@@ -1 +1 @@
1
- {"version":3,"file":"prefer-directional-shorthand.js","names":[],"sources":["../../src/rules/prefer-directional-shorthand.ts"],"sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport { createRule } from '../create-rule.js';\nimport { TastyContext, styleObjectListeners } from '../context.js';\nimport { getKeyName, getStringValue } from '../utils.js';\nimport { DIRECTIONAL_BOX_IDENTITY } from '../constants.js';\nimport { replaceStringValue } from '../fix-utils.js';\n\ntype MessageIds = 'preferDirectionalShorthand';\n\nconst SIDES = ['top', 'right', 'bottom', 'left'] as const;\n\nfunction isZeroLike(token: string): boolean {\n const trimmed = token.trim();\n if (trimmed === '0') return true;\n return /^0+(?:\\.0+)?(?:px|em|rem|%|x|r|cr|bw|ow|lh|sf)?$/i.test(trimmed);\n}\n\n/**\n * Whether `token` is the placeholder value for an unset side, i.e. dropping it\n * from the shorthand leaves the emitted CSS unchanged.\n */\nfunction isIdentity(token: string, identity: string): boolean {\n if (identity === 'auto') return token.trim().toLowerCase() === 'auto';\n return isZeroLike(token);\n}\n\nfunction suggestDirectional(value: string, identity: string): string | null {\n const tokens = value.trim().split(/\\s+/);\n if (tokens.length !== 4) return null;\n\n const meaningful = tokens\n .map((token, index) => ({ token, side: SIDES[index] }))\n .filter(({ token }) => !isIdentity(token, identity));\n\n // Only collapse when exactly one side carries a real value — otherwise the\n // directional shorthand would drop the others.\n if (meaningful.length !== 1) return null;\n\n const { token, side } = meaningful[0];\n return `${token} ${side}`;\n}\n\nexport default createRule<[], MessageIds>({\n name: 'prefer-directional-shorthand',\n meta: {\n type: 'suggestion',\n fixable: 'code',\n docs: {\n description:\n 'Suggest Tasty directional shorthand instead of 4-value CSS box syntax with zero placeholders',\n },\n messages: {\n preferDirectionalShorthand:\n \"'{{property}}' value '{{raw}}' only sets one side. Use the directional shorthand '{{suggestion}}' (e.g. '1x bottom') instead.\",\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n const ctx = new TastyContext(context);\n\n function checkValue(\n property: string,\n value: string,\n node: TSESTree.Node,\n ): void {\n const suggestion = suggestDirectional(\n value,\n DIRECTIONAL_BOX_IDENTITY[property],\n );\n if (!suggestion) return;\n\n context.report({\n node,\n messageId: 'preferDirectionalShorthand',\n data: { property, raw: value, suggestion },\n fix(fixer) {\n return replaceStringValue(fixer, node, suggestion);\n },\n });\n }\n\n function handleStyleObject(node: TSESTree.ObjectExpression) {\n if (!ctx.isStyleObject(node)) return;\n\n for (const prop of node.properties) {\n if (prop.type !== 'Property' || prop.computed) continue;\n\n const key = getKeyName(prop.key);\n if (key === null) continue;\n if (!(key in DIRECTIONAL_BOX_IDENTITY)) continue;\n\n const str = getStringValue(prop.value);\n if (str) {\n checkValue(key, str, prop.value);\n continue;\n }\n\n if (prop.value.type === 'ObjectExpression') {\n for (const stateProp of prop.value.properties) {\n if (stateProp.type !== 'Property') continue;\n const stateStr = getStringValue(stateProp.value);\n if (stateStr) {\n checkValue(key, stateStr, stateProp.value);\n }\n }\n }\n }\n }\n\n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,kBAAkB,MAAiC;AAC1D,OAAI,CAAC,IAAI,cAAc,KAAK,CAAE;AAE9B,QAAK,MAAM,QAAQ,KAAK,YAAY;AAClC,QAAI,KAAK,SAAS,cAAc,KAAK,SAAU;IAE/C,MAAM,MAAM,WAAW,KAAK,IAAI;AAChC,QAAI,QAAQ,KAAM;AAClB,QAAI,EAAE,OAAO,0BAA2B;IAExC,MAAM,MAAM,eAAe,KAAK,MAAM;AACtC,QAAI,KAAK;AACP,gBAAW,KAAK,KAAK,KAAK,MAAM;AAChC;;AAGF,QAAI,KAAK,MAAM,SAAS,mBACtB,MAAK,MAAM,aAAa,KAAK,MAAM,YAAY;AAC7C,SAAI,UAAU,SAAS,WAAY;KACnC,MAAM,WAAW,eAAe,UAAU,MAAM;AAChD,SAAI,SACF,YAAW,KAAK,UAAU,UAAU,MAAM;;;;AAOpD,SAAO;GACL,kBAAkB,MAAM;AACtB,QAAI,YAAY,KAAK;;GAEvB,GAAG,qBAAqB,kBAAkB;GAC3C;;CAEJ,CAAC"}
1
+ {"version":3,"file":"prefer-directional-shorthand.js","names":[],"sources":["../../src/rules/prefer-directional-shorthand.ts"],"sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport { createRule } from '../create-rule.js';\nimport { TastyContext, styleObjectListeners } from '../context.js';\nimport { getKeyName, getStringValue } from '../utils.js';\nimport {\n DIRECTIONAL_BOX,\n DOCK_PROPERTIES,\n type DirectionalBoxConfig,\n} from '../constants.js';\nimport { replaceStringValue } from '../fix-utils.js';\n\ntype MessageIds = 'preferDirectionalShorthand' | 'preferDirectionalUnrendered';\n\nfunction isZeroLike(token: string): boolean {\n const trimmed = token.trim();\n if (trimmed === '0') return true;\n return /^0+(?:\\.0+)?(?:px|em|rem|%|x|r|cr|bw|ow|lh|sf)?$/i.test(trimmed);\n}\n\n/**\n * Whether `token` is the placeholder for an unset position, i.e. dropping it\n * from the shorthand leaves the emitted CSS unchanged.\n */\nfunction isIdentity(token: string, identity: string): boolean {\n if (identity === 'auto') return token.trim().toLowerCase() === 'auto';\n return isZeroLike(token);\n}\n\n/**\n * Rewrites a 4-value box into the directional shorthand, or returns null when\n * no equivalent form exists.\n *\n * The value is always carried into the suggestion, never dropped in favour of\n * the property default. Whether an explicit value *equals* the default is\n * project-dependent: `margin` defaults to `var(--gap)` (4px out of the box)\n * while `1x` is 8px, so `margin: '0 0 1x 0'` -> `margin: 'bottom'` would\n * silently change the spacing.\n */\nfunction suggestDirectional(\n value: string,\n config: DirectionalBoxConfig,\n supportsDock: boolean,\n): string | null {\n const tokens = value.trim().split(/\\s+/);\n if (tokens.length !== 4) return null;\n\n const { identity, positions } = config;\n const placeholders = tokens.map((token) => isIdentity(token, identity));\n const setCount = placeholders.filter((placeholder) => !placeholder).length;\n\n // Exactly one real value: collapse to `<value> <position>`.\n if (setCount === 1) {\n const index = placeholders.indexOf(false);\n\n return `${tokens[index]} ${positions[index]}`;\n }\n\n // Three equal real values around a single placeholder: one edge pinned with\n // the perpendicular pair spanned, which `dock` expresses. The docked edge is\n // opposite the placeholder.\n if (supportsDock && setCount === 3) {\n const freeIndex = placeholders.indexOf(true);\n const set = tokens.filter((_, index) => index !== freeIndex);\n\n if (new Set(set).size === 1) {\n return `${set[0]} ${positions[(freeIndex + 2) % 4]} dock`;\n }\n }\n\n return null;\n}\n\nexport default createRule<[], MessageIds>({\n name: 'prefer-directional-shorthand',\n meta: {\n type: 'suggestion',\n fixable: 'code',\n hasSuggestions: true,\n docs: {\n description:\n 'Suggest Tasty directional shorthand instead of 4-value CSS box syntax with placeholder positions',\n },\n messages: {\n preferDirectionalShorthand:\n \"'{{property}}' value '{{raw}}' only sets part of the box. Use the directional shorthand '{{suggestion}}' instead.\",\n preferDirectionalUnrendered:\n \"'{{property}}' value '{{raw}}' does not do what it looks like — {{note}}. Use '{{suggestion}}' instead.\",\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n const ctx = new TastyContext(context);\n\n function checkValue(\n property: string,\n value: string,\n node: TSESTree.Node,\n ): void {\n const config = DIRECTIONAL_BOX[property];\n const suggestion = suggestDirectional(\n value,\n config,\n DOCK_PROPERTIES.has(property),\n );\n if (!suggestion) return;\n\n if (config.fixable) {\n context.report({\n node,\n messageId: 'preferDirectionalShorthand',\n data: { property, raw: value, suggestion },\n fix(fixer) {\n return replaceStringValue(fixer, node, suggestion);\n },\n });\n\n return;\n }\n\n // Applying this changes what the browser renders, so it is offered as a\n // manual suggestion rather than an `eslint --fix` rewrite.\n context.report({\n node,\n messageId: 'preferDirectionalUnrendered',\n data: { property, raw: value, suggestion, note: config.note ?? '' },\n suggest: [\n {\n messageId: 'preferDirectionalShorthand',\n data: { property, raw: value, suggestion },\n fix(fixer) {\n return replaceStringValue(fixer, node, suggestion);\n },\n },\n ],\n });\n }\n\n function handleStyleObject(node: TSESTree.ObjectExpression) {\n if (!ctx.isStyleObject(node)) return;\n\n for (const prop of node.properties) {\n if (prop.type !== 'Property' || prop.computed) continue;\n\n const key = getKeyName(prop.key);\n if (key === null) continue;\n if (!(key in DIRECTIONAL_BOX)) continue;\n\n const str = getStringValue(prop.value);\n if (str) {\n checkValue(key, str, prop.value);\n continue;\n }\n\n if (prop.value.type === 'ObjectExpression') {\n for (const stateProp of prop.value.properties) {\n if (stateProp.type !== 'Property') continue;\n const stateStr = getStringValue(stateProp.value);\n if (stateStr) {\n checkValue(key, stateStr, stateProp.value);\n }\n }\n }\n }\n }\n\n return {\n ImportDeclaration(node) {\n ctx.trackImport(node);\n },\n ...styleObjectListeners(handleStyleObject),\n };\n },\n});\n"],"mappings":";;;;;;;AAaA,SAAS,WAAW,OAAwB;CAC1C,MAAM,UAAU,MAAM,MAAM;AAC5B,KAAI,YAAY,IAAK,QAAO;AAC5B,QAAO,oDAAoD,KAAK,QAAQ;;;;;;AAO1E,SAAS,WAAW,OAAe,UAA2B;AAC5D,KAAI,aAAa,OAAQ,QAAO,MAAM,MAAM,CAAC,aAAa,KAAK;AAC/D,QAAO,WAAW,MAAM;;;;;;;;;;;;A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E;KAAU,KAAK;KAAO;KAAY,MAAM,OAAO,QAAQ;KAAI;IACnE,SAAS,CACP;KACE,WAAW;KACX,MAAM;MAAE;MAAU,KAAK;MAAO;MAAY;KAC1C,IAAI,OAAO;AACT,aAAO,mBAAmB,OAAO,MAAM,WAAW;;KAErD,CACF;IACF,CAAC;;EAGJ,SAAS,kBAAkB,MAAiC;AAC1D,OAAI,CAAC,IAAI,cAAc,KAAK,CAAE;AAE9B,QAAK,MAAM,QAAQ,KAAK,YAAY;AAClC,QAAI,KAAK,SAAS,cAAc,KAAK,SAAU;IAE/C,MAAM,MAAM,WAAW,KAAK,IAAI;AAChC,QAAI,QAAQ,KAAM;AAClB,QAAI,EAAE,OAAO,iBAAkB;IAE/B,MAAM,MAAM,eAAe,KAAK,MAAM;AACtC,QAAI,KAAK;AACP,gBAAW,KAAK,KAAK,KAAK,MAAM;AAChC;;AAGF,QAAI,KAAK,MAAM,SAAS,mBACtB,MAAK,MAAM,aAAa,KAAK,MAAM,YAAY;AAC7C,SAAI,UAAU,SAAS,WAAY;KACnC,MAAM,WAAW,eAAe,UAAU,MAAM;AAChD,SAAI,SACF,YAAW,KAAK,UAAU,UAAU,MAAM;;;;AAOpD,SAAO;GACL,kBAAkB,MAAM;AACtB,QAAI,YAAY,KAAK;;GAEvB,GAAG,qBAAqB,kBAAkB;GAC3C;;CAEJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenphi/eslint-plugin-tasty",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "ESLint plugin for validating tasty() and tastyStatic() style objects",
5
5
  "type": "module",
6
6
  "exports": {