chaincss 2.3.0 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.js CHANGED
@@ -608,6 +608,10 @@ function findBestMatches(query, candidates, maxResults = 3, maxDistance = 3) {
608
608
  return matches.slice(0, maxResults);
609
609
  }
610
610
  function getTypeForCandidate(candidate) {
611
+ if (KNOWN_MACROS.includes(candidate)) return "macro";
612
+ if (KNOWN_SHORTHANDS.includes(candidate)) return "shorthand";
613
+ if (ANIMATION_PRESETS.includes(candidate)) return "animation";
614
+ if (BREAKPOINTS.includes(candidate)) return "breakpoint";
611
615
  if (KNOWN_SHORTHANDS.includes(candidate)) return "shorthand";
612
616
  if (COMMON_CSS_PROPERTIES.includes(candidate)) return "css-property";
613
617
  if (ANIMATION_PRESETS.includes(candidate)) return "animation";
@@ -622,6 +626,7 @@ function getSuggestion(prop, validProperties = [], type = "all") {
622
626
  candidates = [...COMMON_CSS_PROPERTIES, ...validProperties];
623
627
  } else {
624
628
  candidates = [
629
+ ...KNOWN_MACROS,
625
630
  ...KNOWN_SHORTHANDS,
626
631
  ...COMMON_CSS_PROPERTIES,
627
632
  ...validProperties,
@@ -636,10 +641,98 @@ function getSuggestion(prop, validProperties = [], type = "all") {
636
641
  }
637
642
  return null;
638
643
  }
639
- var KNOWN_SHORTHANDS, COMMON_CSS_PROPERTIES, ANIMATION_PRESETS, BREAKPOINTS;
644
+ var KNOWN_MACROS, KNOWN_SHORTHANDS, COMMON_CSS_PROPERTIES, ANIMATION_PRESETS, BREAKPOINTS;
640
645
  var init_suggestions = __esm({
641
646
  "src/compiler/suggestions.ts"() {
642
647
  "use strict";
648
+ KNOWN_MACROS = [
649
+ // Intent Macros
650
+ "stickyHeader",
651
+ "card",
652
+ "hero",
653
+ "container",
654
+ "center",
655
+ "gridList",
656
+ "sidebar",
657
+ "pill",
658
+ "glass",
659
+ "truncate",
660
+ "srOnly",
661
+ "autoContrast",
662
+ // Chain.ts special methods
663
+ "flex",
664
+ "grid",
665
+ "inlineFlex",
666
+ "inlineGrid",
667
+ "flexCenter",
668
+ "gridCenter",
669
+ "stack",
670
+ "cols",
671
+ "rows",
672
+ "bento",
673
+ "gridTable",
674
+ "mx",
675
+ "my",
676
+ "px",
677
+ "py",
678
+ "size",
679
+ "gap",
680
+ "gapX",
681
+ "gapY",
682
+ "inset",
683
+ "insetX",
684
+ "insetY",
685
+ "borderX",
686
+ "borderY",
687
+ "absolute",
688
+ "fixed",
689
+ "sticky",
690
+ "relative",
691
+ "hide",
692
+ "show",
693
+ "unselectable",
694
+ "scrollable",
695
+ "safeArea",
696
+ "circle",
697
+ "square",
698
+ "truncate",
699
+ "fluidText",
700
+ "aspect",
701
+ "lineClamp",
702
+ "glass",
703
+ "glow",
704
+ "textGradient",
705
+ "meshGradient",
706
+ "noise",
707
+ "shimmer",
708
+ "clickScale",
709
+ "pressable",
710
+ "focusRing",
711
+ "skeleton",
712
+ "fullScreen",
713
+ "containerMacro",
714
+ "outlineDebug",
715
+ "parallax",
716
+ "frostedNav",
717
+ "fadeIn",
718
+ "slideInUp",
719
+ "zoomIn",
720
+ "bounce",
721
+ "pulse",
722
+ "spin",
723
+ "shake",
724
+ "float",
725
+ // Semantic macros
726
+ "surface",
727
+ "text",
728
+ "elevation",
729
+ "state",
730
+ "spacing",
731
+ // Intent API
732
+ "intent",
733
+ // Constraint
734
+ "constrain"
735
+ ];
643
736
  KNOWN_SHORTHANDS = [
644
737
  // Spacing
645
738
  "m",
@@ -1105,6 +1105,94 @@ function getAvailableShorthands() {
1105
1105
  }
1106
1106
 
1107
1107
  // src/compiler/suggestions.ts
1108
+ var KNOWN_MACROS = [
1109
+ // Intent Macros
1110
+ "stickyHeader",
1111
+ "card",
1112
+ "hero",
1113
+ "container",
1114
+ "center",
1115
+ "gridList",
1116
+ "sidebar",
1117
+ "pill",
1118
+ "glass",
1119
+ "truncate",
1120
+ "srOnly",
1121
+ "autoContrast",
1122
+ // Chain.ts special methods
1123
+ "flex",
1124
+ "grid",
1125
+ "inlineFlex",
1126
+ "inlineGrid",
1127
+ "flexCenter",
1128
+ "gridCenter",
1129
+ "stack",
1130
+ "cols",
1131
+ "rows",
1132
+ "bento",
1133
+ "gridTable",
1134
+ "mx",
1135
+ "my",
1136
+ "px",
1137
+ "py",
1138
+ "size",
1139
+ "gap",
1140
+ "gapX",
1141
+ "gapY",
1142
+ "inset",
1143
+ "insetX",
1144
+ "insetY",
1145
+ "borderX",
1146
+ "borderY",
1147
+ "absolute",
1148
+ "fixed",
1149
+ "sticky",
1150
+ "relative",
1151
+ "hide",
1152
+ "show",
1153
+ "unselectable",
1154
+ "scrollable",
1155
+ "safeArea",
1156
+ "circle",
1157
+ "square",
1158
+ "truncate",
1159
+ "fluidText",
1160
+ "aspect",
1161
+ "lineClamp",
1162
+ "glass",
1163
+ "glow",
1164
+ "textGradient",
1165
+ "meshGradient",
1166
+ "noise",
1167
+ "shimmer",
1168
+ "clickScale",
1169
+ "pressable",
1170
+ "focusRing",
1171
+ "skeleton",
1172
+ "fullScreen",
1173
+ "containerMacro",
1174
+ "outlineDebug",
1175
+ "parallax",
1176
+ "frostedNav",
1177
+ "fadeIn",
1178
+ "slideInUp",
1179
+ "zoomIn",
1180
+ "bounce",
1181
+ "pulse",
1182
+ "spin",
1183
+ "shake",
1184
+ "float",
1185
+ // Semantic macros
1186
+ "surface",
1187
+ "text",
1188
+ "elevation",
1189
+ "state",
1190
+ "spacing",
1191
+ // Intent API
1192
+ "intent",
1193
+ // Constraint
1194
+ "constrain"
1195
+ ];
1108
1196
  var KNOWN_SHORTHANDS = [
1109
1197
  // Spacing
1110
1198
  "m",
@@ -1411,6 +1499,10 @@ function findBestMatches(query, candidates, maxResults = 3, maxDistance = 3) {
1411
1499
  return matches.slice(0, maxResults);
1412
1500
  }
1413
1501
  function getTypeForCandidate(candidate) {
1502
+ if (KNOWN_MACROS.includes(candidate)) return "macro";
1503
+ if (KNOWN_SHORTHANDS.includes(candidate)) return "shorthand";
1504
+ if (ANIMATION_PRESETS.includes(candidate)) return "animation";
1505
+ if (BREAKPOINTS.includes(candidate)) return "breakpoint";
1414
1506
  if (KNOWN_SHORTHANDS.includes(candidate)) return "shorthand";
1415
1507
  if (COMMON_CSS_PROPERTIES2.includes(candidate)) return "css-property";
1416
1508
  if (ANIMATION_PRESETS.includes(candidate)) return "animation";
@@ -1425,6 +1517,7 @@ function getSuggestion(prop, validProperties = [], type = "all") {
1425
1517
  candidates = [...COMMON_CSS_PROPERTIES2, ...validProperties];
1426
1518
  } else {
1427
1519
  candidates = [
1520
+ ...KNOWN_MACROS,
1428
1521
  ...KNOWN_SHORTHANDS,
1429
1522
  ...COMMON_CSS_PROPERTIES2,
1430
1523
  ...validProperties,
@@ -27,6 +27,11 @@ export declare const intent: {
27
27
  getKnownProperties(): string[];
28
28
  macro(name: string): Record<string, any> | null;
29
29
  getMacros(): string[];
30
+ /**
31
+ * Auto-set text color for accessible contrast against the background.
32
+ * Uses WCAG AA contrast ratio to pick black or white.
33
+ */
34
+ autoContrast(bgColor: string): string;
30
35
  getMacroDescription(name: string): string | null;
31
36
  hasMacro(name: string): boolean;
32
37
  /**
@@ -3,6 +3,7 @@ export interface SuggestionMatch {
3
3
  distance: number;
4
4
  type: 'shorthand' | 'css-property' | 'macro' | 'animation' | 'breakpoint';
5
5
  }
6
+ export declare const KNOWN_MACROS: string[];
6
7
  export declare const KNOWN_SHORTHANDS: string[];
7
8
  export declare const COMMON_CSS_PROPERTIES: string[];
8
9
  export declare const ANIMATION_PRESETS: string[];
@@ -27,6 +28,7 @@ export declare function getDetailedSuggestion(prop: string, validProperties?: st
27
28
  confidence: number;
28
29
  } | null;
29
30
  declare const _default: {
31
+ KNOWN_MACROS: string[];
30
32
  getSuggestion: typeof getSuggestion;
31
33
  getSuggestions: typeof getSuggestions;
32
34
  getPropertySuggestion: typeof getPropertySuggestion;
@@ -139,6 +139,7 @@ export interface ChainCSSConfig {
139
139
  profiling?: boolean;
140
140
  classNameGenerator?: (name: string, options?: any) => string;
141
141
  plugins?: ChainCSSPlugin[];
142
+ macros?: Record<string, (value: any) => Record<string, any>>;
142
143
  minifySelectors?: boolean;
143
144
  extractCritical?: boolean;
144
145
  }
package/dist/index.d.ts CHANGED
@@ -27,6 +27,7 @@ export { createThemeContract, validateTheme, createTheme, Theme } from './compil
27
27
  export { CacheManager } from './compiler/cache-manager.js';
28
28
  export { PersistentCache } from './compiler/content-addressable-cache.js';
29
29
  export { shorthandMap, macros, handleShorthand, isShorthand, expandShorthand, getAvailableShorthands } from './compiler/shorthands.js';
30
+ export { KNOWN_MACROS } from './compiler/suggestions.js';
30
31
  export { helpers } from './compiler/helpers.js';
31
32
  export { animationPresets, createAnimation, getAnimationPreset, hasAnimationPreset, getAnimationPresetNames } from './compiler/animations.js';
32
33
  export { getSuggestion, getSuggestions, getPropertySuggestion, getShorthandSuggestion } from './compiler/suggestions.js';
package/dist/index.js CHANGED
@@ -614,6 +614,10 @@ function findBestMatches(query, candidates, maxResults = 3, maxDistance = 3) {
614
614
  return matches.slice(0, maxResults);
615
615
  }
616
616
  function getTypeForCandidate(candidate) {
617
+ if (KNOWN_MACROS.includes(candidate)) return "macro";
618
+ if (KNOWN_SHORTHANDS.includes(candidate)) return "shorthand";
619
+ if (ANIMATION_PRESETS.includes(candidate)) return "animation";
620
+ if (BREAKPOINTS.includes(candidate)) return "breakpoint";
617
621
  if (KNOWN_SHORTHANDS.includes(candidate)) return "shorthand";
618
622
  if (COMMON_CSS_PROPERTIES.includes(candidate)) return "css-property";
619
623
  if (ANIMATION_PRESETS.includes(candidate)) return "animation";
@@ -628,6 +632,7 @@ function getSuggestion(prop, validProperties = [], type = "all") {
628
632
  candidates = [...COMMON_CSS_PROPERTIES, ...validProperties];
629
633
  } else {
630
634
  candidates = [
635
+ ...KNOWN_MACROS,
631
636
  ...KNOWN_SHORTHANDS,
632
637
  ...COMMON_CSS_PROPERTIES,
633
638
  ...validProperties,
@@ -767,10 +772,98 @@ function getShorthandSuggestion(shorthand) {
767
772
  }
768
773
  return null;
769
774
  }
770
- var KNOWN_SHORTHANDS, COMMON_CSS_PROPERTIES, ANIMATION_PRESETS, BREAKPOINTS;
775
+ var KNOWN_MACROS, KNOWN_SHORTHANDS, COMMON_CSS_PROPERTIES, ANIMATION_PRESETS, BREAKPOINTS;
771
776
  var init_suggestions = __esm({
772
777
  "src/compiler/suggestions.ts"() {
773
778
  "use strict";
779
+ KNOWN_MACROS = [
780
+ // Intent Macros
781
+ "stickyHeader",
782
+ "card",
783
+ "hero",
784
+ "container",
785
+ "center",
786
+ "gridList",
787
+ "sidebar",
788
+ "pill",
789
+ "glass",
790
+ "truncate",
791
+ "srOnly",
792
+ "autoContrast",
793
+ // Chain.ts special methods
794
+ "flex",
795
+ "grid",
796
+ "inlineFlex",
797
+ "inlineGrid",
798
+ "flexCenter",
799
+ "gridCenter",
800
+ "stack",
801
+ "cols",
802
+ "rows",
803
+ "bento",
804
+ "gridTable",
805
+ "mx",
806
+ "my",
807
+ "px",
808
+ "py",
809
+ "size",
810
+ "gap",
811
+ "gapX",
812
+ "gapY",
813
+ "inset",
814
+ "insetX",
815
+ "insetY",
816
+ "borderX",
817
+ "borderY",
818
+ "absolute",
819
+ "fixed",
820
+ "sticky",
821
+ "relative",
822
+ "hide",
823
+ "show",
824
+ "unselectable",
825
+ "scrollable",
826
+ "safeArea",
827
+ "circle",
828
+ "square",
829
+ "truncate",
830
+ "fluidText",
831
+ "aspect",
832
+ "lineClamp",
833
+ "glass",
834
+ "glow",
835
+ "textGradient",
836
+ "meshGradient",
837
+ "noise",
838
+ "shimmer",
839
+ "clickScale",
840
+ "pressable",
841
+ "focusRing",
842
+ "skeleton",
843
+ "fullScreen",
844
+ "containerMacro",
845
+ "outlineDebug",
846
+ "parallax",
847
+ "frostedNav",
848
+ "fadeIn",
849
+ "slideInUp",
850
+ "zoomIn",
851
+ "bounce",
852
+ "pulse",
853
+ "spin",
854
+ "shake",
855
+ "float",
856
+ // Semantic macros
857
+ "surface",
858
+ "text",
859
+ "elevation",
860
+ "state",
861
+ "spacing",
862
+ // Intent API
863
+ "intent",
864
+ // Constraint
865
+ "constrain"
866
+ ];
774
867
  KNOWN_SHORTHANDS = [
775
868
  // Spacing
776
869
  "m",
@@ -7327,6 +7420,7 @@ function createTheme(contract, themeValues) {
7327
7420
 
7328
7421
  // src/index.ts
7329
7422
  init_shorthands();
7423
+ init_suggestions();
7330
7424
  init_helpers();
7331
7425
  init_animations();
7332
7426
  init_suggestions();
@@ -11715,6 +11809,12 @@ var LAYOUT_MACROS = {
11715
11809
  },
11716
11810
  defaults: {}
11717
11811
  },
11812
+ autoContrast: {
11813
+ name: "autoContrast",
11814
+ description: "Automatically sets text color (black/white) for WCAG AA contrast against the background",
11815
+ properties: {},
11816
+ defaults: {}
11817
+ },
11718
11818
  glass: {
11719
11819
  name: "glass",
11720
11820
  description: "Frosted glass morphism effect",
@@ -11911,6 +12011,25 @@ var intent = {
11911
12011
  getMacros() {
11912
12012
  return getAvailableMacros();
11913
12013
  },
12014
+ /**
12015
+ * Auto-set text color for accessible contrast against the background.
12016
+ * Uses WCAG AA contrast ratio to pick black or white.
12017
+ */
12018
+ autoContrast(bgColor) {
12019
+ let r = 128, g = 128, b = 128;
12020
+ const hex = bgColor.replace("#", "");
12021
+ if (hex.length === 3) {
12022
+ r = parseInt(hex[0] + hex[0], 16);
12023
+ g = parseInt(hex[1] + hex[1], 16);
12024
+ b = parseInt(hex[2] + hex[2], 16);
12025
+ } else if (hex.length === 6) {
12026
+ r = parseInt(hex.slice(0, 2), 16);
12027
+ g = parseInt(hex.slice(2, 4), 16);
12028
+ b = parseInt(hex.slice(4, 6), 16);
12029
+ }
12030
+ const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
12031
+ return luminance > 0.5 ? "#000000" : "#ffffff";
12032
+ },
11914
12033
  getMacroDescription(name) {
11915
12034
  return getMacroDescription(name);
11916
12035
  },
@@ -12030,6 +12149,7 @@ export {
12030
12149
  ChainCSSPrefixer,
12031
12150
  DEFAULT_PIPELINE,
12032
12151
  DesignTokens,
12152
+ KNOWN_MACROS,
12033
12153
  PassManager,
12034
12154
  PersistentCache,
12035
12155
  SCROLL_PRESETS,
@@ -64,6 +64,10 @@ function findBestMatches(query, candidates, maxResults = 3, maxDistance = 3) {
64
64
  return matches.slice(0, maxResults);
65
65
  }
66
66
  function getTypeForCandidate(candidate) {
67
+ if (KNOWN_MACROS.includes(candidate)) return "macro";
68
+ if (KNOWN_SHORTHANDS.includes(candidate)) return "shorthand";
69
+ if (ANIMATION_PRESETS.includes(candidate)) return "animation";
70
+ if (BREAKPOINTS.includes(candidate)) return "breakpoint";
67
71
  if (KNOWN_SHORTHANDS.includes(candidate)) return "shorthand";
68
72
  if (COMMON_CSS_PROPERTIES.includes(candidate)) return "css-property";
69
73
  if (ANIMATION_PRESETS.includes(candidate)) return "animation";
@@ -78,6 +82,7 @@ function getSuggestion(prop, validProperties = [], type = "all") {
78
82
  candidates = [...COMMON_CSS_PROPERTIES, ...validProperties];
79
83
  } else {
80
84
  candidates = [
85
+ ...KNOWN_MACROS,
81
86
  ...KNOWN_SHORTHANDS,
82
87
  ...COMMON_CSS_PROPERTIES,
83
88
  ...validProperties,
@@ -92,10 +97,98 @@ function getSuggestion(prop, validProperties = [], type = "all") {
92
97
  }
93
98
  return null;
94
99
  }
95
- var KNOWN_SHORTHANDS, COMMON_CSS_PROPERTIES, ANIMATION_PRESETS, BREAKPOINTS;
100
+ var KNOWN_MACROS, KNOWN_SHORTHANDS, COMMON_CSS_PROPERTIES, ANIMATION_PRESETS, BREAKPOINTS;
96
101
  var init_suggestions = __esm({
97
102
  "src/compiler/suggestions.ts"() {
98
103
  "use strict";
104
+ KNOWN_MACROS = [
105
+ // Intent Macros
106
+ "stickyHeader",
107
+ "card",
108
+ "hero",
109
+ "container",
110
+ "center",
111
+ "gridList",
112
+ "sidebar",
113
+ "pill",
114
+ "glass",
115
+ "truncate",
116
+ "srOnly",
117
+ "autoContrast",
118
+ // Chain.ts special methods
119
+ "flex",
120
+ "grid",
121
+ "inlineFlex",
122
+ "inlineGrid",
123
+ "flexCenter",
124
+ "gridCenter",
125
+ "stack",
126
+ "cols",
127
+ "rows",
128
+ "bento",
129
+ "gridTable",
130
+ "mx",
131
+ "my",
132
+ "px",
133
+ "py",
134
+ "size",
135
+ "gap",
136
+ "gapX",
137
+ "gapY",
138
+ "inset",
139
+ "insetX",
140
+ "insetY",
141
+ "borderX",
142
+ "borderY",
143
+ "absolute",
144
+ "fixed",
145
+ "sticky",
146
+ "relative",
147
+ "hide",
148
+ "show",
149
+ "unselectable",
150
+ "scrollable",
151
+ "safeArea",
152
+ "circle",
153
+ "square",
154
+ "truncate",
155
+ "fluidText",
156
+ "aspect",
157
+ "lineClamp",
158
+ "glass",
159
+ "glow",
160
+ "textGradient",
161
+ "meshGradient",
162
+ "noise",
163
+ "shimmer",
164
+ "clickScale",
165
+ "pressable",
166
+ "focusRing",
167
+ "skeleton",
168
+ "fullScreen",
169
+ "containerMacro",
170
+ "outlineDebug",
171
+ "parallax",
172
+ "frostedNav",
173
+ "fadeIn",
174
+ "slideInUp",
175
+ "zoomIn",
176
+ "bounce",
177
+ "pulse",
178
+ "spin",
179
+ "shake",
180
+ "float",
181
+ // Semantic macros
182
+ "surface",
183
+ "text",
184
+ "elevation",
185
+ "state",
186
+ "spacing",
187
+ // Intent API
188
+ "intent",
189
+ // Constraint
190
+ "constrain"
191
+ ];
99
192
  KNOWN_SHORTHANDS = [
100
193
  // Spacing
101
194
  "m",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chaincss",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "description": "ChainCSS - The first CSS-in-JS library with true auto-detection mixed mode. Zero runtime by default, dynamic when you need it.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -186,6 +186,13 @@ const LAYOUT_MACROS: Record<string, LayoutMacro> = {
186
186
  defaults: {},
187
187
  },
188
188
 
189
+
190
+ autoContrast: {
191
+ name: 'autoContrast',
192
+ description: 'Automatically sets text color (black/white) for WCAG AA contrast against the background',
193
+ properties: {},
194
+ defaults: {},
195
+ },
189
196
  glass: {
190
197
  name: 'glass',
191
198
  description: 'Frosted glass morphism effect',
@@ -366,6 +373,27 @@ export const intent = {
366
373
  // Layout Macros
367
374
  macro(name: string): Record<string, any> | null { return expandLayoutMacro(name); },
368
375
  getMacros(): string[] { return getAvailableMacros(); },
376
+ /**
377
+ * Auto-set text color for accessible contrast against the background.
378
+ * Uses WCAG AA contrast ratio to pick black or white.
379
+ */
380
+ autoContrast(bgColor: string): string {
381
+ // Parse the background color and determine luminance
382
+ let r = 128, g = 128, b = 128;
383
+ const hex = bgColor.replace('#', '');
384
+ if (hex.length === 3) {
385
+ r = parseInt(hex[0] + hex[0], 16);
386
+ g = parseInt(hex[1] + hex[1], 16);
387
+ b = parseInt(hex[2] + hex[2], 16);
388
+ } else if (hex.length === 6) {
389
+ r = parseInt(hex.slice(0, 2), 16);
390
+ g = parseInt(hex.slice(2, 4), 16);
391
+ b = parseInt(hex.slice(4, 6), 16);
392
+ }
393
+ // Relative luminance
394
+ const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
395
+ return luminance > 0.5 ? '#000000' : '#ffffff';
396
+ },
369
397
  getMacroDescription(name: string): string | null { return getMacroDescription(name); },
370
398
  hasMacro(name: string): boolean { return name in LAYOUT_MACROS; },
371
399
  /**
@@ -7,6 +7,31 @@ export interface SuggestionMatch {
7
7
  }
8
8
 
9
9
  // Known shorthands (from shorthandMap)
10
+
11
+ // Known macros (from intent-engine and Chain.ts)
12
+ export const KNOWN_MACROS: string[] = [
13
+ // Intent Macros
14
+ 'stickyHeader', 'card', 'hero', 'container', 'center', 'gridList',
15
+ 'sidebar', 'pill', 'glass', 'truncate', 'srOnly', 'autoContrast',
16
+ // Chain.ts special methods
17
+ 'flex', 'grid', 'inlineFlex', 'inlineGrid', 'flexCenter', 'gridCenter',
18
+ 'stack', 'cols', 'rows', 'bento', 'gridTable',
19
+ 'mx', 'my', 'px', 'py', 'size', 'gap', 'gapX', 'gapY', 'inset', 'insetX', 'insetY',
20
+ 'borderX', 'borderY',
21
+ 'absolute', 'fixed', 'sticky', 'relative',
22
+ 'hide', 'show', 'unselectable', 'scrollable', 'safeArea',
23
+ 'circle', 'square', 'truncate', 'fluidText', 'aspect', 'lineClamp',
24
+ 'glass', 'glow', 'textGradient', 'meshGradient', 'noise', 'shimmer',
25
+ 'clickScale', 'pressable', 'focusRing', 'skeleton',
26
+ 'fullScreen', 'containerMacro', 'outlineDebug', 'parallax', 'frostedNav',
27
+ 'fadeIn', 'slideInUp', 'zoomIn', 'bounce', 'pulse', 'spin', 'shake', 'float',
28
+ // Semantic macros
29
+ 'surface', 'text', 'elevation', 'state', 'spacing',
30
+ // Intent API
31
+ 'intent',
32
+ // Constraint
33
+ 'constrain',
34
+ ];
10
35
  export const KNOWN_SHORTHANDS: string[] = [
11
36
  // Spacing
12
37
  'm', 'mt', 'mr', 'mb', 'ml',
@@ -155,6 +180,10 @@ function findBestMatches(
155
180
 
156
181
  // Get type for a candidate
157
182
  function getTypeForCandidate(candidate: string): 'shorthand' | 'css-property' | 'macro' | 'animation' | 'breakpoint' {
183
+ if (KNOWN_MACROS.includes(candidate)) return 'macro';
184
+ if (KNOWN_SHORTHANDS.includes(candidate)) return 'shorthand';
185
+ if (ANIMATION_PRESETS.includes(candidate)) return 'animation';
186
+ if (BREAKPOINTS.includes(candidate)) return 'breakpoint';
158
187
  if (KNOWN_SHORTHANDS.includes(candidate)) return 'shorthand';
159
188
  if (COMMON_CSS_PROPERTIES.includes(candidate)) return 'css-property';
160
189
  if (ANIMATION_PRESETS.includes(candidate)) return 'animation';
@@ -177,6 +206,7 @@ export function getSuggestion(
177
206
  candidates = [...COMMON_CSS_PROPERTIES, ...validProperties];
178
207
  } else {
179
208
  candidates = [
209
+ ...KNOWN_MACROS,
180
210
  ...KNOWN_SHORTHANDS,
181
211
  ...COMMON_CSS_PROPERTIES,
182
212
  ...validProperties,
@@ -354,6 +384,7 @@ export function getValueSuggestion(
354
384
  export function getAutocompleteSuggestions(prefix: string = '', limit: number = 10): SuggestionMatch[] {
355
385
  const allSuggestions = [
356
386
  ...KNOWN_SHORTHANDS.map(s => ({ name: s, type: 'shorthand' as const, distance: 0 })),
387
+ ...KNOWN_MACROS.map(s => ({ name: s, type: 'macro' as const, distance: 0 })),
357
388
  ...COMMON_CSS_PROPERTIES.map(s => ({ name: s, type: 'css-property' as const, distance: 0 })),
358
389
  ...ANIMATION_PRESETS.map(s => ({ name: s, type: 'animation' as const, distance: 0 })),
359
390
  ...BREAKPOINTS.map(s => ({ name: s, type: 'breakpoint' as const, distance: 0 }))
@@ -421,6 +452,7 @@ export function getDetailedSuggestion(prop: string, validProperties: string[] =
421
452
 
422
453
  // Export default
423
454
  export default {
455
+ KNOWN_MACROS,
424
456
  getSuggestion,
425
457
  getSuggestions,
426
458
  getPropertySuggestion,
package/src/core/types.ts CHANGED
@@ -160,6 +160,7 @@ export interface ChainCSSConfig {
160
160
  classNameGenerator?: (name: string, options?: any) => string;
161
161
 
162
162
  plugins?: ChainCSSPlugin[];
163
+ macros?: Record<string, (value: any) => Record<string, any>>;
163
164
 
164
165
  minifySelectors?: boolean;
165
166
  extractCritical?: boolean;