@damarkuncoro/meta-architecture-style-engine 0.1.3 → 0.1.4
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/lib/cjs/cli/index.js +250 -125
- package/lib/cjs/cli/index.js.map +1 -1
- package/lib/cjs/index.d.ts +31 -30
- package/lib/cjs/index.js +268 -98
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/integration/postcss/index.d.ts +1 -1
- package/lib/cjs/integration/postcss/index.js +17 -2
- package/lib/cjs/integration/postcss/index.js.map +1 -1
- package/lib/cjs/integration/tailwind/index.d.ts +1 -1
- package/lib/cjs/{types-HxpHKBfo.d.ts → types-C03kyQDa.d.ts} +2 -0
- package/lib/esm/cli/index.js +250 -125
- package/lib/esm/cli/index.js.map +1 -1
- package/lib/esm/index.d.mts +31 -30
- package/lib/esm/index.js +268 -98
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/integration/postcss/index.d.mts +1 -1
- package/lib/esm/integration/postcss/index.js +9 -2
- package/lib/esm/integration/postcss/index.js.map +1 -1
- package/lib/esm/integration/tailwind/index.d.mts +1 -1
- package/lib/esm/{types-HxpHKBfo.d.mts → types-C03kyQDa.d.mts} +2 -0
- package/package.json +9 -11
package/lib/cjs/cli/index.js
CHANGED
|
@@ -234,6 +234,7 @@ var TokenType = {
|
|
|
234
234
|
HOVER: "HOVER",
|
|
235
235
|
ACTIVE: "ACTIVE",
|
|
236
236
|
DISABLED: "DISABLED",
|
|
237
|
+
CONTAINER: "CONTAINER",
|
|
237
238
|
// Domains
|
|
238
239
|
LAYOUT: "LAYOUT",
|
|
239
240
|
TYPOGRAPHY: "TYPOGRAPHY",
|
|
@@ -245,6 +246,8 @@ var TokenType = {
|
|
|
245
246
|
RBRACE: "RBRACE",
|
|
246
247
|
LBRACKET: "LBRACKET",
|
|
247
248
|
RBRACKET: "RBRACKET",
|
|
249
|
+
LPAREN: "LPAREN",
|
|
250
|
+
RPAREN: "RPAREN",
|
|
248
251
|
COLON: "COLON",
|
|
249
252
|
SEMICOLON: "SEMICOLON",
|
|
250
253
|
COMMA: "COMMA",
|
|
@@ -281,6 +284,7 @@ var ContractDSLTokenizer = class {
|
|
|
281
284
|
["hover", TokenType.HOVER],
|
|
282
285
|
["active", TokenType.ACTIVE],
|
|
283
286
|
["disabled", TokenType.DISABLED],
|
|
287
|
+
["container", TokenType.CONTAINER],
|
|
284
288
|
// Domains
|
|
285
289
|
["layout", TokenType.LAYOUT],
|
|
286
290
|
["typography", TokenType.TYPOGRAPHY],
|
|
@@ -333,6 +337,8 @@ var ContractDSLTokenizer = class {
|
|
|
333
337
|
if (char === "}") return this.createToken(TokenType.RBRACE, char);
|
|
334
338
|
if (char === "[") return this.createToken(TokenType.LBRACKET, char);
|
|
335
339
|
if (char === "]") return this.createToken(TokenType.RBRACKET, char);
|
|
340
|
+
if (char === "(") return this.createToken(TokenType.LPAREN, char);
|
|
341
|
+
if (char === ")") return this.createToken(TokenType.RPAREN, char);
|
|
336
342
|
if (char === ":") return this.createToken(TokenType.COLON, char);
|
|
337
343
|
if (char === ";") return this.createToken(TokenType.SEMICOLON, char);
|
|
338
344
|
if (char === ",") return this.createToken(TokenType.COMMA, char);
|
|
@@ -561,7 +567,7 @@ var ContractDSLParser = class {
|
|
|
561
567
|
this.expect(TokenType.CONSTRAINTS);
|
|
562
568
|
this.expect(TokenType.LBRACE);
|
|
563
569
|
const constraints = [];
|
|
564
|
-
while (this.peek()?.type === TokenType.MOBILE || this.peek()?.type === TokenType.TABLET || this.peek()?.type === TokenType.DESKTOP || this.peek()?.type === TokenType.LIGHT || this.peek()?.type === TokenType.DARK || this.peek()?.type === TokenType.WEB || this.peek()?.type === TokenType.NATIVE || this.peek()?.type === TokenType.CANVAS || this.peek()?.type === TokenType.DEFAULT_CTX || this.peek()?.type === TokenType.HOVER || this.peek()?.type === TokenType.ACTIVE || this.peek()?.type === TokenType.DISABLED) {
|
|
570
|
+
while (this.peek()?.type === TokenType.MOBILE || this.peek()?.type === TokenType.TABLET || this.peek()?.type === TokenType.DESKTOP || this.peek()?.type === TokenType.LIGHT || this.peek()?.type === TokenType.DARK || this.peek()?.type === TokenType.WEB || this.peek()?.type === TokenType.NATIVE || this.peek()?.type === TokenType.CANVAS || this.peek()?.type === TokenType.DEFAULT_CTX || this.peek()?.type === TokenType.HOVER || this.peek()?.type === TokenType.ACTIVE || this.peek()?.type === TokenType.DISABLED || this.peek()?.type === TokenType.CONTAINER) {
|
|
565
571
|
constraints.push(this.parseConstraint());
|
|
566
572
|
}
|
|
567
573
|
this.expect(TokenType.RBRACE);
|
|
@@ -572,7 +578,13 @@ var ContractDSLParser = class {
|
|
|
572
578
|
* @returns Constraint AST
|
|
573
579
|
*/
|
|
574
580
|
parseConstraint() {
|
|
575
|
-
|
|
581
|
+
let context = this.expectContext();
|
|
582
|
+
if (context === "container" && this.peek()?.type === TokenType.LPAREN) {
|
|
583
|
+
this.expect(TokenType.LPAREN);
|
|
584
|
+
const name = this.expectIdentifier();
|
|
585
|
+
this.expect(TokenType.RPAREN);
|
|
586
|
+
context = `container(${name})`;
|
|
587
|
+
}
|
|
576
588
|
this.expect(TokenType.COLON);
|
|
577
589
|
this.expect(TokenType.LBRACKET);
|
|
578
590
|
const tokens = [];
|
|
@@ -651,7 +663,7 @@ var ContractDSLParser = class {
|
|
|
651
663
|
*/
|
|
652
664
|
expectContext() {
|
|
653
665
|
const token = this.peek();
|
|
654
|
-
if (!token || token.type !== TokenType.MOBILE && token.type !== TokenType.TABLET && token.type !== TokenType.DESKTOP && token.type !== TokenType.LIGHT && token.type !== TokenType.DARK && token.type !== TokenType.WEB && token.type !== TokenType.NATIVE && token.type !== TokenType.CANVAS && token.type !== TokenType.DEFAULT_CTX && token.type !== TokenType.DEFAULT && token.type !== TokenType.HOVER && token.type !== TokenType.ACTIVE && token.type !== TokenType.DISABLED) {
|
|
666
|
+
if (!token || token.type !== TokenType.MOBILE && token.type !== TokenType.TABLET && token.type !== TokenType.DESKTOP && token.type !== TokenType.LIGHT && token.type !== TokenType.DARK && token.type !== TokenType.WEB && token.type !== TokenType.NATIVE && token.type !== TokenType.CANVAS && token.type !== TokenType.DEFAULT_CTX && token.type !== TokenType.DEFAULT && token.type !== TokenType.HOVER && token.type !== TokenType.ACTIVE && token.type !== TokenType.DISABLED && token.type !== TokenType.CONTAINER) {
|
|
655
667
|
throw new ParserError(
|
|
656
668
|
`Expected context, got ${token?.type || "EOF"}`,
|
|
657
669
|
token?.line || 0,
|
|
@@ -901,9 +913,9 @@ var ContractDSLValidator = class {
|
|
|
901
913
|
* @param errors - Array to collect errors
|
|
902
914
|
*/
|
|
903
915
|
validateConstraint(constraint, allows, path3, errors) {
|
|
904
|
-
if (!this.validContexts.has(constraint.context)) {
|
|
916
|
+
if (!this.validContexts.has(constraint.context) && !constraint.context.startsWith("container")) {
|
|
905
917
|
errors.push(new ValidationError(
|
|
906
|
-
`Invalid context: '${constraint.context}'. Must be one of: ${Array.from(this.validContexts).join(", ")}`,
|
|
918
|
+
`Invalid context: '${constraint.context}'. Must be one of: ${Array.from(this.validContexts).join(", ")} or start with 'container'`,
|
|
907
919
|
`${path3}.context`
|
|
908
920
|
));
|
|
909
921
|
}
|
|
@@ -1024,12 +1036,23 @@ var ContractDSLCompiler = class {
|
|
|
1024
1036
|
* @returns StyleRule
|
|
1025
1037
|
*/
|
|
1026
1038
|
compilePropertyToRule(property, errors) {
|
|
1027
|
-
|
|
1039
|
+
const rule = {
|
|
1028
1040
|
property: property.name,
|
|
1029
1041
|
domain: this.inferDomain(property.name, errors),
|
|
1030
1042
|
allowedTokens: property.allows,
|
|
1031
1043
|
conflictsWith: property.conflicts
|
|
1032
1044
|
};
|
|
1045
|
+
if (property.constraints && property.constraints.length > 0) {
|
|
1046
|
+
const constraints = {};
|
|
1047
|
+
for (const constraint of property.constraints) {
|
|
1048
|
+
constraints[constraint.context] = constraint.allows;
|
|
1049
|
+
}
|
|
1050
|
+
return {
|
|
1051
|
+
...rule,
|
|
1052
|
+
constraints
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
return rule;
|
|
1033
1056
|
}
|
|
1034
1057
|
/**
|
|
1035
1058
|
* Infer domain from property name
|
|
@@ -1461,6 +1484,118 @@ var CSSMaterializer = class {
|
|
|
1461
1484
|
}
|
|
1462
1485
|
};
|
|
1463
1486
|
|
|
1487
|
+
// src/data/tokens.ts
|
|
1488
|
+
var TOKENS = {
|
|
1489
|
+
// Colors - Intent based
|
|
1490
|
+
"color.primary": { id: "color.primary", domain: "color", value: "#2563eb" },
|
|
1491
|
+
// blue-600
|
|
1492
|
+
"color.secondary": { id: "color.secondary", domain: "color", value: "#4b5563" },
|
|
1493
|
+
// gray-600
|
|
1494
|
+
"color.danger": { id: "color.danger", domain: "color", value: "#dc2626" },
|
|
1495
|
+
// red-600
|
|
1496
|
+
// Spacing - Scale based
|
|
1497
|
+
"space.sm": { id: "space.sm", domain: "layout", value: "0.5rem" },
|
|
1498
|
+
// 8px
|
|
1499
|
+
"space.md": { id: "space.md", domain: "layout", value: "1rem" },
|
|
1500
|
+
// 16px
|
|
1501
|
+
"space.lg": { id: "space.lg", domain: "layout", value: "1.5rem" },
|
|
1502
|
+
// 24px
|
|
1503
|
+
// Forbidden/Raw tokens (for demo)
|
|
1504
|
+
"raw.hex": { id: "raw.hex", domain: "color", value: "#123456" },
|
|
1505
|
+
// Illegal
|
|
1506
|
+
// Surface (Theme Aware!)
|
|
1507
|
+
"surface.card": {
|
|
1508
|
+
id: "surface.card",
|
|
1509
|
+
domain: "color",
|
|
1510
|
+
value: {
|
|
1511
|
+
light: "#ffffff",
|
|
1512
|
+
// white
|
|
1513
|
+
dark: "#1e293b"
|
|
1514
|
+
// slate-800
|
|
1515
|
+
}
|
|
1516
|
+
},
|
|
1517
|
+
"surface.ground": {
|
|
1518
|
+
id: "surface.ground",
|
|
1519
|
+
domain: "color",
|
|
1520
|
+
value: {
|
|
1521
|
+
light: "#f9fafb",
|
|
1522
|
+
// gray-50
|
|
1523
|
+
dark: "#0f172a"
|
|
1524
|
+
// slate-900
|
|
1525
|
+
}
|
|
1526
|
+
},
|
|
1527
|
+
"surface.paper": {
|
|
1528
|
+
id: "surface.paper",
|
|
1529
|
+
domain: "color",
|
|
1530
|
+
value: {
|
|
1531
|
+
light: "#ffffff",
|
|
1532
|
+
// white
|
|
1533
|
+
dark: "#334155"
|
|
1534
|
+
// slate-700
|
|
1535
|
+
}
|
|
1536
|
+
},
|
|
1537
|
+
// Text (Theme Aware!)
|
|
1538
|
+
"text.light": {
|
|
1539
|
+
id: "text.light",
|
|
1540
|
+
domain: "color",
|
|
1541
|
+
value: {
|
|
1542
|
+
light: "#ffffff",
|
|
1543
|
+
// white
|
|
1544
|
+
dark: "#f3f4f6"
|
|
1545
|
+
// gray-100
|
|
1546
|
+
}
|
|
1547
|
+
},
|
|
1548
|
+
"text.dark": {
|
|
1549
|
+
id: "text.dark",
|
|
1550
|
+
domain: "color",
|
|
1551
|
+
value: {
|
|
1552
|
+
light: "#111827",
|
|
1553
|
+
// gray-900
|
|
1554
|
+
dark: "#ffffff"
|
|
1555
|
+
// white
|
|
1556
|
+
}
|
|
1557
|
+
},
|
|
1558
|
+
"text.primary": {
|
|
1559
|
+
id: "text.primary",
|
|
1560
|
+
domain: "color",
|
|
1561
|
+
value: {
|
|
1562
|
+
light: "#111827",
|
|
1563
|
+
// gray-900
|
|
1564
|
+
dark: "#f9fafb"
|
|
1565
|
+
// gray-50
|
|
1566
|
+
}
|
|
1567
|
+
},
|
|
1568
|
+
"text.secondary": {
|
|
1569
|
+
id: "text.secondary",
|
|
1570
|
+
domain: "color",
|
|
1571
|
+
value: {
|
|
1572
|
+
light: "#6b7280",
|
|
1573
|
+
// gray-500
|
|
1574
|
+
dark: "#9ca3af"
|
|
1575
|
+
// gray-400
|
|
1576
|
+
}
|
|
1577
|
+
},
|
|
1578
|
+
// Effects
|
|
1579
|
+
"shadow.sm": { id: "shadow.sm", domain: "effect", value: "0 1px 2px 0 rgb(0 0 0 / 0.05)" },
|
|
1580
|
+
"shadow.md": { id: "shadow.md", domain: "effect", value: "0 4px 6px -1px rgb(0 0 0 / 0.1)" },
|
|
1581
|
+
"shadow.lg": { id: "shadow.lg", domain: "effect", value: "0 10px 15px -3px rgb(0 0 0 / 0.1)" },
|
|
1582
|
+
// Radius (Moved to effect domain for consistency)
|
|
1583
|
+
"radius.md": { id: "radius.md", domain: "effect", value: "0.375rem" },
|
|
1584
|
+
// 6px
|
|
1585
|
+
"radius.lg": { id: "radius.lg", domain: "effect", value: "0.5rem" },
|
|
1586
|
+
// 8px
|
|
1587
|
+
"radius.full": { id: "radius.full", domain: "effect", value: "9999px" },
|
|
1588
|
+
// Typography - Font Sizes
|
|
1589
|
+
"text.sm": { id: "text.sm", domain: "typography", value: "0.875rem" },
|
|
1590
|
+
"text.base": { id: "text.base", domain: "typography", value: "1rem" },
|
|
1591
|
+
"text.lg": { id: "text.lg", domain: "typography", value: "1.125rem" },
|
|
1592
|
+
"text.xl": { id: "text.xl", domain: "typography", value: "1.25rem" },
|
|
1593
|
+
// Typography - Font Weights
|
|
1594
|
+
"weight.normal": { id: "weight.normal", domain: "typography", value: "400" },
|
|
1595
|
+
"weight.medium": { id: "weight.medium", domain: "typography", value: "500" },
|
|
1596
|
+
"weight.bold": { id: "weight.bold", domain: "typography", value: "700" }
|
|
1597
|
+
};
|
|
1598
|
+
|
|
1464
1599
|
// src/integration/atomic/reset.ts
|
|
1465
1600
|
var CSS_RESET = `/* MASE Grounding (Reset) */
|
|
1466
1601
|
*, ::before, ::after {
|
|
@@ -1792,6 +1927,72 @@ var ThemeGenerator = class {
|
|
|
1792
1927
|
}
|
|
1793
1928
|
};
|
|
1794
1929
|
|
|
1930
|
+
// src/integration/atomic/core/VariantGenerator.ts
|
|
1931
|
+
var VariantGenerator = class {
|
|
1932
|
+
constructor() {
|
|
1933
|
+
this.variants = /* @__PURE__ */ new Map();
|
|
1934
|
+
this.registerStandardVariants();
|
|
1935
|
+
}
|
|
1936
|
+
registerStandardVariants() {
|
|
1937
|
+
this.registerVariant("hover", { name: "hover", selector: ":hover" });
|
|
1938
|
+
this.registerVariant("focus", { name: "focus", selector: ":focus" });
|
|
1939
|
+
this.registerVariant("active", { name: "active", selector: ":active" });
|
|
1940
|
+
this.registerVariant("disabled", { name: "disabled", selector: ":disabled" });
|
|
1941
|
+
this.registerVariant("group-hover", { name: "group-hover", selector: ".group:hover &" });
|
|
1942
|
+
this.registerVariant("sm", { name: "sm", media: "(min-width: 640px)" });
|
|
1943
|
+
this.registerVariant("md", { name: "md", media: "(min-width: 768px)" });
|
|
1944
|
+
this.registerVariant("lg", { name: "lg", media: "(min-width: 1024px)" });
|
|
1945
|
+
this.registerVariant("xl", { name: "xl", media: "(min-width: 1280px)" });
|
|
1946
|
+
this.registerVariant("2xl", { name: "2xl", media: "(min-width: 1536px)" });
|
|
1947
|
+
}
|
|
1948
|
+
registerVariant(name, definition) {
|
|
1949
|
+
this.variants.set(name, definition);
|
|
1950
|
+
}
|
|
1951
|
+
/**
|
|
1952
|
+
* Apply variant to a CSS utility string
|
|
1953
|
+
* @param css - Original utility CSS (e.g. .w-full { width: 100%; })
|
|
1954
|
+
* @param variantName - Name of variant to apply (e.g. 'hover', 'md', '@sidebar')
|
|
1955
|
+
* @returns Transformed CSS
|
|
1956
|
+
*/
|
|
1957
|
+
applyVariant(css, variantName) {
|
|
1958
|
+
let variant = this.variants.get(variantName);
|
|
1959
|
+
if (!variant && variantName.startsWith("@")) {
|
|
1960
|
+
const containerName = variantName.substring(1);
|
|
1961
|
+
variant = {
|
|
1962
|
+
name: variantName,
|
|
1963
|
+
container: `${containerName} (min-width: 0px)`
|
|
1964
|
+
// Placeholder
|
|
1965
|
+
};
|
|
1966
|
+
}
|
|
1967
|
+
if (!variant) return "";
|
|
1968
|
+
const classMatch = css.match(/^\.([^{]+)/);
|
|
1969
|
+
if (!classMatch) return "";
|
|
1970
|
+
const originalClass = classMatch[1].trim();
|
|
1971
|
+
const variantPrefix = variant.name.replace(/[^a-zA-Z0-9-_]/g, "\\$&");
|
|
1972
|
+
const newClass = `.${variantPrefix}\\:${originalClass}`;
|
|
1973
|
+
let newCss = css.replace(/^\.[^{]+/, newClass);
|
|
1974
|
+
if (variant.selector) {
|
|
1975
|
+
if (variant.selector.includes("&")) {
|
|
1976
|
+
const complexSelector = variant.selector.replace("&", newClass);
|
|
1977
|
+
newCss = newCss.replace(newClass, complexSelector);
|
|
1978
|
+
} else {
|
|
1979
|
+
newCss = newCss.replace(newClass, `${newClass}${variant.selector}`);
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
if (variant.media) {
|
|
1983
|
+
newCss = `@media ${variant.media} {
|
|
1984
|
+
${newCss.replace(/\n/g, "\n ")}
|
|
1985
|
+
}`;
|
|
1986
|
+
}
|
|
1987
|
+
if (variant.container) {
|
|
1988
|
+
newCss = `@container ${variant.container} {
|
|
1989
|
+
${newCss.replace(/\n/g, "\n ")}
|
|
1990
|
+
}`;
|
|
1991
|
+
}
|
|
1992
|
+
return newCss;
|
|
1993
|
+
}
|
|
1994
|
+
};
|
|
1995
|
+
|
|
1795
1996
|
// src/integration/atomic/handlers/BaseHandler.ts
|
|
1796
1997
|
var BaseHandler = class {
|
|
1797
1998
|
/**
|
|
@@ -1857,11 +2058,6 @@ var BaseHandler = class {
|
|
|
1857
2058
|
generateRulesFromPrefix(token, varName, suffix, prefixMap) {
|
|
1858
2059
|
const prefixes = Object.keys(prefixMap).sort((a, b) => b.length - a.length);
|
|
1859
2060
|
for (const prefix of prefixes) {
|
|
1860
|
-
console.log("Checking prefix:", prefix);
|
|
1861
|
-
console.log("Token ID:", token.id);
|
|
1862
|
-
console.log("Suffix:", suffix);
|
|
1863
|
-
console.log("Match ID:", token.id === prefix || token.id.startsWith(`${prefix}-`));
|
|
1864
|
-
console.log("Match Suffix:", suffix === prefix || suffix.startsWith(`${prefix}-`));
|
|
1865
2061
|
if (token.id === prefix || token.id.startsWith(`${prefix}-`) || suffix === prefix || suffix.startsWith(`${prefix}-`)) {
|
|
1866
2062
|
const definition = prefixMap[prefix];
|
|
1867
2063
|
const selector = suffix;
|
|
@@ -2642,9 +2838,40 @@ var FilterHandler = class extends BaseHandler {
|
|
|
2642
2838
|
}
|
|
2643
2839
|
};
|
|
2644
2840
|
|
|
2841
|
+
// src/integration/atomic/handlers/ContainerHandler.ts
|
|
2842
|
+
var ContainerHandler = class extends BaseHandler {
|
|
2843
|
+
canHandle(token) {
|
|
2844
|
+
return this.validateToken(token) && (this.containsKeyword(token.id, "container.type") || this.containsKeyword(token.id, "container.name") || this.containsKeyword(token.id, "container-type") || this.containsKeyword(token.id, "container-name") || // Explicitly handle 'container' keyword if it's related to queries
|
|
2845
|
+
this.containsKeyword(token.id, "container") && !this.containsKeyword(token.id, "width"));
|
|
2846
|
+
}
|
|
2847
|
+
generate(token, varName, suffix) {
|
|
2848
|
+
if (!this.validateToken(token)) {
|
|
2849
|
+
return "";
|
|
2850
|
+
}
|
|
2851
|
+
if (this.containsKeyword(token.id, "container.type") || this.containsKeyword(token.id, "container-type")) {
|
|
2852
|
+
return this.generateUtilities(token, varName, suffix, {
|
|
2853
|
+
"container.type": { property: "container-type", classPrefix: "container-type" },
|
|
2854
|
+
"container-type": "container-type"
|
|
2855
|
+
});
|
|
2856
|
+
}
|
|
2857
|
+
if (this.containsKeyword(token.id, "container.name") || this.containsKeyword(token.id, "container-name")) {
|
|
2858
|
+
return this.generateUtilities(token, varName, suffix, {
|
|
2859
|
+
"container.name": { property: "container-name", classPrefix: "container-name" },
|
|
2860
|
+
"container-name": "container-name"
|
|
2861
|
+
});
|
|
2862
|
+
}
|
|
2863
|
+
return this.generateUtilities(token, varName, suffix, {
|
|
2864
|
+
"@container": { property: "container-type", classPrefix: "container-type", valueTransform: () => "inline-size" },
|
|
2865
|
+
// Only match 'container' if it's not one of the above (already handled by if-blocks)
|
|
2866
|
+
"container": { property: "container-type", valueTransform: (val) => val === "normal" ? "normal" : "inline-size" }
|
|
2867
|
+
});
|
|
2868
|
+
}
|
|
2869
|
+
};
|
|
2870
|
+
|
|
2645
2871
|
// src/integration/atomic/core/UtilityGenerator.ts
|
|
2646
2872
|
var UtilityGenerator = class {
|
|
2647
2873
|
constructor() {
|
|
2874
|
+
this.variantGenerator = new VariantGenerator();
|
|
2648
2875
|
this.handlers = [
|
|
2649
2876
|
new FlexboxHandler(),
|
|
2650
2877
|
new GridHandler(),
|
|
@@ -2661,7 +2888,8 @@ var UtilityGenerator = class {
|
|
|
2661
2888
|
new TransformHandler(),
|
|
2662
2889
|
new TransitionHandler(),
|
|
2663
2890
|
new InteractivityHandler(),
|
|
2664
|
-
new AccessibilityHandler()
|
|
2891
|
+
new AccessibilityHandler(),
|
|
2892
|
+
new ContainerHandler()
|
|
2665
2893
|
];
|
|
2666
2894
|
}
|
|
2667
2895
|
/**
|
|
@@ -2702,6 +2930,14 @@ var UtilityGenerator = class {
|
|
|
2702
2930
|
const utility = this.processToken(token, context);
|
|
2703
2931
|
if (utility) {
|
|
2704
2932
|
utilities.push(utility);
|
|
2933
|
+
if (context.variants && context.variants.length > 0) {
|
|
2934
|
+
context.variants.forEach((variant) => {
|
|
2935
|
+
const variantUtility = this.variantGenerator.applyVariant(utility, variant);
|
|
2936
|
+
if (variantUtility) {
|
|
2937
|
+
utilities.push(variantUtility);
|
|
2938
|
+
}
|
|
2939
|
+
});
|
|
2940
|
+
}
|
|
2705
2941
|
}
|
|
2706
2942
|
});
|
|
2707
2943
|
return utilities;
|
|
@@ -2733,7 +2969,8 @@ var AtomicCSSGenerator = class {
|
|
|
2733
2969
|
createContext(options) {
|
|
2734
2970
|
return {
|
|
2735
2971
|
prefix: options.prefix || "mase-",
|
|
2736
|
-
selector: options.selector || ":root"
|
|
2972
|
+
selector: options.selector || ":root",
|
|
2973
|
+
variants: options.variants
|
|
2737
2974
|
};
|
|
2738
2975
|
}
|
|
2739
2976
|
/**
|
|
@@ -2749,118 +2986,6 @@ var AtomicCSSGenerator = class {
|
|
|
2749
2986
|
}
|
|
2750
2987
|
};
|
|
2751
2988
|
|
|
2752
|
-
// src/data/tokens.ts
|
|
2753
|
-
var TOKENS = {
|
|
2754
|
-
// Colors - Intent based
|
|
2755
|
-
"color.primary": { id: "color.primary", domain: "color", value: "#2563eb" },
|
|
2756
|
-
// blue-600
|
|
2757
|
-
"color.secondary": { id: "color.secondary", domain: "color", value: "#4b5563" },
|
|
2758
|
-
// gray-600
|
|
2759
|
-
"color.danger": { id: "color.danger", domain: "color", value: "#dc2626" },
|
|
2760
|
-
// red-600
|
|
2761
|
-
// Spacing - Scale based
|
|
2762
|
-
"space.sm": { id: "space.sm", domain: "layout", value: "0.5rem" },
|
|
2763
|
-
// 8px
|
|
2764
|
-
"space.md": { id: "space.md", domain: "layout", value: "1rem" },
|
|
2765
|
-
// 16px
|
|
2766
|
-
"space.lg": { id: "space.lg", domain: "layout", value: "1.5rem" },
|
|
2767
|
-
// 24px
|
|
2768
|
-
// Forbidden/Raw tokens (for demo)
|
|
2769
|
-
"raw.hex": { id: "raw.hex", domain: "color", value: "#123456" },
|
|
2770
|
-
// Illegal
|
|
2771
|
-
// Surface (Theme Aware!)
|
|
2772
|
-
"surface.card": {
|
|
2773
|
-
id: "surface.card",
|
|
2774
|
-
domain: "color",
|
|
2775
|
-
value: {
|
|
2776
|
-
light: "#ffffff",
|
|
2777
|
-
// white
|
|
2778
|
-
dark: "#1e293b"
|
|
2779
|
-
// slate-800
|
|
2780
|
-
}
|
|
2781
|
-
},
|
|
2782
|
-
"surface.ground": {
|
|
2783
|
-
id: "surface.ground",
|
|
2784
|
-
domain: "color",
|
|
2785
|
-
value: {
|
|
2786
|
-
light: "#f9fafb",
|
|
2787
|
-
// gray-50
|
|
2788
|
-
dark: "#0f172a"
|
|
2789
|
-
// slate-900
|
|
2790
|
-
}
|
|
2791
|
-
},
|
|
2792
|
-
"surface.paper": {
|
|
2793
|
-
id: "surface.paper",
|
|
2794
|
-
domain: "color",
|
|
2795
|
-
value: {
|
|
2796
|
-
light: "#ffffff",
|
|
2797
|
-
// white
|
|
2798
|
-
dark: "#334155"
|
|
2799
|
-
// slate-700
|
|
2800
|
-
}
|
|
2801
|
-
},
|
|
2802
|
-
// Text (Theme Aware!)
|
|
2803
|
-
"text.light": {
|
|
2804
|
-
id: "text.light",
|
|
2805
|
-
domain: "color",
|
|
2806
|
-
value: {
|
|
2807
|
-
light: "#ffffff",
|
|
2808
|
-
// white
|
|
2809
|
-
dark: "#f3f4f6"
|
|
2810
|
-
// gray-100
|
|
2811
|
-
}
|
|
2812
|
-
},
|
|
2813
|
-
"text.dark": {
|
|
2814
|
-
id: "text.dark",
|
|
2815
|
-
domain: "color",
|
|
2816
|
-
value: {
|
|
2817
|
-
light: "#111827",
|
|
2818
|
-
// gray-900
|
|
2819
|
-
dark: "#ffffff"
|
|
2820
|
-
// white
|
|
2821
|
-
}
|
|
2822
|
-
},
|
|
2823
|
-
"text.primary": {
|
|
2824
|
-
id: "text.primary",
|
|
2825
|
-
domain: "color",
|
|
2826
|
-
value: {
|
|
2827
|
-
light: "#111827",
|
|
2828
|
-
// gray-900
|
|
2829
|
-
dark: "#f9fafb"
|
|
2830
|
-
// gray-50
|
|
2831
|
-
}
|
|
2832
|
-
},
|
|
2833
|
-
"text.secondary": {
|
|
2834
|
-
id: "text.secondary",
|
|
2835
|
-
domain: "color",
|
|
2836
|
-
value: {
|
|
2837
|
-
light: "#6b7280",
|
|
2838
|
-
// gray-500
|
|
2839
|
-
dark: "#9ca3af"
|
|
2840
|
-
// gray-400
|
|
2841
|
-
}
|
|
2842
|
-
},
|
|
2843
|
-
// Effects
|
|
2844
|
-
"shadow.sm": { id: "shadow.sm", domain: "effect", value: "0 1px 2px 0 rgb(0 0 0 / 0.05)" },
|
|
2845
|
-
"shadow.md": { id: "shadow.md", domain: "effect", value: "0 4px 6px -1px rgb(0 0 0 / 0.1)" },
|
|
2846
|
-
"shadow.lg": { id: "shadow.lg", domain: "effect", value: "0 10px 15px -3px rgb(0 0 0 / 0.1)" },
|
|
2847
|
-
// Radius (Moved to effect domain for consistency)
|
|
2848
|
-
"radius.md": { id: "radius.md", domain: "effect", value: "0.375rem" },
|
|
2849
|
-
// 6px
|
|
2850
|
-
"radius.lg": { id: "radius.lg", domain: "effect", value: "0.5rem" },
|
|
2851
|
-
// 8px
|
|
2852
|
-
"radius.full": { id: "radius.full", domain: "effect", value: "9999px" },
|
|
2853
|
-
// Typography - Font Sizes
|
|
2854
|
-
"text.sm": { id: "text.sm", domain: "typography", value: "0.875rem" },
|
|
2855
|
-
"text.base": { id: "text.base", domain: "typography", value: "1rem" },
|
|
2856
|
-
"text.lg": { id: "text.lg", domain: "typography", value: "1.125rem" },
|
|
2857
|
-
"text.xl": { id: "text.xl", domain: "typography", value: "1.25rem" },
|
|
2858
|
-
// Typography - Font Weights
|
|
2859
|
-
"weight.normal": { id: "weight.normal", domain: "typography", value: "400" },
|
|
2860
|
-
"weight.medium": { id: "weight.medium", domain: "typography", value: "500" },
|
|
2861
|
-
"weight.bold": { id: "weight.bold", domain: "typography", value: "700" }
|
|
2862
|
-
};
|
|
2863
|
-
|
|
2864
2989
|
// src/cli/commands/generate-css.ts
|
|
2865
2990
|
var fs4 = __toESM(require("fs"));
|
|
2866
2991
|
var path2 = __toESM(require("path"));
|