@jalvin/ui 2.0.41 → 2.0.43

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.
Files changed (72) hide show
  1. package/dist/__tests__/annotated-string.test.d.ts +1 -1
  2. package/dist/__tests__/annotated-string.test.d.ts.map +1 -1
  3. package/dist/__tests__/annotated-string.test.js +39 -26
  4. package/dist/__tests__/annotated-string.test.js.map +1 -1
  5. package/dist/__tests__/interaction.test.js +35 -52
  6. package/dist/__tests__/interaction.test.js.map +1 -1
  7. package/dist/__tests__/text.test.d.ts +1 -1
  8. package/dist/__tests__/text.test.d.ts.map +1 -1
  9. package/dist/__tests__/text.test.js +16 -22
  10. package/dist/__tests__/text.test.js.map +1 -1
  11. package/dist/__tests__/windowsizeclass.test.js +66 -57
  12. package/dist/__tests__/windowsizeclass.test.js.map +1 -1
  13. package/dist/annotated-string.d.ts +4 -2
  14. package/dist/annotated-string.d.ts.map +1 -1
  15. package/dist/annotated-string.js +17 -19
  16. package/dist/annotated-string.js.map +1 -1
  17. package/dist/button.d.ts +3 -2
  18. package/dist/button.d.ts.map +1 -1
  19. package/dist/button.js +12 -8
  20. package/dist/button.js.map +1 -1
  21. package/dist/canvas.d.ts +3 -3
  22. package/dist/canvas.d.ts.map +1 -1
  23. package/dist/canvas.js +40 -31
  24. package/dist/canvas.js.map +1 -1
  25. package/dist/checkbox.d.ts +2 -1
  26. package/dist/checkbox.d.ts.map +1 -1
  27. package/dist/checkbox.js +11 -18
  28. package/dist/checkbox.js.map +1 -1
  29. package/dist/image.d.ts +6 -4
  30. package/dist/image.d.ts.map +1 -1
  31. package/dist/image.js +21 -32
  32. package/dist/image.js.map +1 -1
  33. package/dist/index.d.ts +14 -15
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +19 -17
  36. package/dist/index.js.map +1 -1
  37. package/dist/input.d.ts +3 -1
  38. package/dist/input.d.ts.map +1 -1
  39. package/dist/input.js +13 -20
  40. package/dist/input.js.map +1 -1
  41. package/dist/interaction.d.ts.map +1 -1
  42. package/dist/interaction.js +27 -9
  43. package/dist/interaction.js.map +1 -1
  44. package/dist/layout.d.ts +7 -3
  45. package/dist/layout.d.ts.map +1 -1
  46. package/dist/layout.js +10 -10
  47. package/dist/layout.js.map +1 -1
  48. package/dist/spacer.d.ts +3 -2
  49. package/dist/spacer.d.ts.map +1 -1
  50. package/dist/spacer.js +5 -5
  51. package/dist/spacer.js.map +1 -1
  52. package/dist/surface.d.ts +10 -9
  53. package/dist/surface.d.ts.map +1 -1
  54. package/dist/surface.js +13 -30
  55. package/dist/surface.js.map +1 -1
  56. package/dist/text.d.ts +5 -3
  57. package/dist/text.d.ts.map +1 -1
  58. package/dist/text.js +12 -23
  59. package/dist/text.js.map +1 -1
  60. package/dist/textarea.d.ts +3 -1
  61. package/dist/textarea.d.ts.map +1 -1
  62. package/dist/textarea.js +13 -20
  63. package/dist/textarea.js.map +1 -1
  64. package/dist/typography.d.ts +129 -101
  65. package/dist/typography.d.ts.map +1 -1
  66. package/dist/typography.js +25 -29
  67. package/dist/typography.js.map +1 -1
  68. package/package.json +2 -2
  69. package/dist/__tests__/children-signature.test.d.ts +0 -2
  70. package/dist/__tests__/children-signature.test.d.ts.map +0 -1
  71. package/dist/__tests__/children-signature.test.js +0 -106
  72. package/dist/__tests__/children-signature.test.js.map +0 -1
@@ -1,109 +1,137 @@
1
- /** Local definition for standard CSS properties. */
2
- export type CSSProperties = {
3
- [key: string]: string | number | undefined;
4
- };
1
+ import type { CSSProperties } from "react";
5
2
  export interface TextStyleDef {
6
- fontSize: number;
7
- lineHeight: number;
3
+ fontSize: string;
8
4
  fontWeight: number | "bold" | "normal";
9
- letterSpacing: number;
10
- fontFamily?: string;
11
- color?: string;
5
+ lineHeight: string;
6
+ letterSpacing?: string;
12
7
  }
13
8
  export declare const TextStyle: {
14
- readonly displayLarge: {
15
- readonly fontSize: 57;
16
- readonly lineHeight: 64;
17
- readonly fontWeight: 400;
18
- readonly letterSpacing: -0.25;
19
- };
20
- readonly displayMedium: {
21
- readonly fontSize: 45;
22
- readonly lineHeight: 52;
23
- readonly fontWeight: 400;
24
- readonly letterSpacing: 0;
25
- };
26
- readonly displaySmall: {
27
- readonly fontSize: 36;
28
- readonly lineHeight: 44;
29
- readonly fontWeight: 400;
30
- readonly letterSpacing: 0;
31
- };
32
- readonly headlineLarge: {
33
- readonly fontSize: 32;
34
- readonly lineHeight: 40;
35
- readonly fontWeight: 400;
36
- readonly letterSpacing: 0;
37
- };
38
- readonly headlineMedium: {
39
- readonly fontSize: 28;
40
- readonly lineHeight: 36;
41
- readonly fontWeight: 400;
42
- readonly letterSpacing: 0;
43
- };
44
- readonly headlineSmall: {
45
- readonly fontSize: 24;
46
- readonly lineHeight: 32;
47
- readonly fontWeight: 400;
48
- readonly letterSpacing: 0;
49
- };
50
- readonly titleLarge: {
51
- readonly fontSize: 22;
52
- readonly lineHeight: 28;
53
- readonly fontWeight: 400;
54
- readonly letterSpacing: 0;
55
- };
56
- readonly titleMedium: {
57
- readonly fontSize: 16;
58
- readonly lineHeight: 24;
59
- readonly fontWeight: 500;
60
- readonly letterSpacing: 0.15;
61
- };
62
- readonly titleSmall: {
63
- readonly fontSize: 14;
64
- readonly lineHeight: 20;
65
- readonly fontWeight: 500;
66
- readonly letterSpacing: 0.1;
67
- };
68
- readonly labelLarge: {
69
- readonly fontSize: 14;
70
- readonly lineHeight: 20;
71
- readonly fontWeight: 500;
72
- readonly letterSpacing: 0.1;
73
- };
74
- readonly labelMedium: {
75
- readonly fontSize: 12;
76
- readonly lineHeight: 16;
77
- readonly fontWeight: 500;
78
- readonly letterSpacing: 0.5;
79
- };
80
- readonly labelSmall: {
81
- readonly fontSize: 11;
82
- readonly lineHeight: 16;
83
- readonly fontWeight: 500;
84
- readonly letterSpacing: 0.5;
85
- };
86
- readonly bodyLarge: {
87
- readonly fontSize: 16;
88
- readonly lineHeight: 24;
89
- readonly fontWeight: 400;
90
- readonly letterSpacing: 0.5;
91
- };
92
- readonly bodyMedium: {
93
- readonly fontSize: 14;
94
- readonly lineHeight: 20;
95
- readonly fontWeight: 400;
96
- readonly letterSpacing: 0.25;
97
- };
98
- readonly bodySmall: {
99
- readonly fontSize: 12;
100
- readonly lineHeight: 16;
101
- readonly fontWeight: 400;
102
- readonly letterSpacing: 0.4;
9
+ displayLarge: {
10
+ fontSize: string;
11
+ fontWeight: number;
12
+ lineHeight: string;
13
+ };
14
+ displayMedium: {
15
+ fontSize: string;
16
+ fontWeight: number;
17
+ lineHeight: string;
18
+ };
19
+ displaySmall: {
20
+ fontSize: string;
21
+ fontWeight: number;
22
+ lineHeight: string;
23
+ };
24
+ headlineLarge: {
25
+ fontSize: string;
26
+ fontWeight: number;
27
+ lineHeight: string;
28
+ };
29
+ headlineMedium: {
30
+ fontSize: string;
31
+ fontWeight: number;
32
+ lineHeight: string;
33
+ };
34
+ headlineSmall: {
35
+ fontSize: string;
36
+ fontWeight: number;
37
+ lineHeight: string;
38
+ };
39
+ titleLarge: {
40
+ fontSize: string;
41
+ fontWeight: number;
42
+ lineHeight: string;
43
+ };
44
+ titleMedium: {
45
+ fontSize: string;
46
+ fontWeight: number;
47
+ lineHeight: string;
48
+ letterSpacing: string;
49
+ };
50
+ titleSmall: {
51
+ fontSize: string;
52
+ fontWeight: number;
53
+ lineHeight: string;
54
+ letterSpacing: string;
55
+ };
56
+ bodyLarge: {
57
+ fontSize: string;
58
+ fontWeight: number;
59
+ lineHeight: string;
60
+ letterSpacing: string;
61
+ };
62
+ bodyMedium: {
63
+ fontSize: string;
64
+ fontWeight: number;
65
+ lineHeight: string;
66
+ letterSpacing: string;
67
+ };
68
+ bodySmall: {
69
+ fontSize: string;
70
+ fontWeight: number;
71
+ lineHeight: string;
72
+ letterSpacing: string;
73
+ };
74
+ labelLarge: {
75
+ fontSize: string;
76
+ fontWeight: number;
77
+ lineHeight: string;
78
+ letterSpacing: string;
79
+ };
80
+ labelMedium: {
81
+ fontSize: string;
82
+ fontWeight: number;
83
+ lineHeight: string;
84
+ letterSpacing: string;
85
+ };
86
+ labelSmall: {
87
+ fontSize: string;
88
+ fontWeight: number;
89
+ lineHeight: string;
90
+ letterSpacing: string;
91
+ };
92
+ h1: {
93
+ fontSize: string;
94
+ fontWeight: "bold";
95
+ lineHeight: string;
96
+ };
97
+ h2: {
98
+ fontSize: string;
99
+ fontWeight: "bold";
100
+ lineHeight: string;
101
+ };
102
+ h3: {
103
+ fontSize: string;
104
+ fontWeight: "bold";
105
+ lineHeight: string;
106
+ };
107
+ h4: {
108
+ fontSize: string;
109
+ fontWeight: "bold";
110
+ lineHeight: string;
111
+ };
112
+ body: {
113
+ fontSize: string;
114
+ fontWeight: "normal";
115
+ lineHeight: string;
116
+ };
117
+ caption: {
118
+ fontSize: string;
119
+ fontWeight: "normal";
120
+ lineHeight: string;
121
+ };
122
+ button: {
123
+ fontSize: string;
124
+ fontWeight: number;
125
+ lineHeight: string;
126
+ letterSpacing: string;
127
+ };
128
+ code: {
129
+ fontSize: string;
130
+ fontWeight: "normal";
131
+ lineHeight: string;
132
+ letterSpacing: string;
103
133
  };
104
134
  };
105
- /**
106
- * Converts a TextStyle token to standard CSS properties.
107
- */
135
+ export type TextStyleKey = keyof typeof TextStyle;
108
136
  export declare function textStyleToCSS(style: TextStyleDef): CSSProperties;
109
137
  //# sourceMappingURL=typography.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../src/typography.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,MAAM,aAAa,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAE3E,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBZ,CAAC;AAEX;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,aAAa,CAUjE"}
1
+ {"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../src/typography.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BkB,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,SAAS,CAAC;AAElD,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,aAAa,CAEjE"}
@@ -1,34 +1,30 @@
1
1
  export const TextStyle = {
2
- displayLarge: { fontSize: 57, lineHeight: 64, fontWeight: 400, letterSpacing: -0.25 },
3
- displayMedium: { fontSize: 45, lineHeight: 52, fontWeight: 400, letterSpacing: 0 },
4
- displaySmall: { fontSize: 36, lineHeight: 44, fontWeight: 400, letterSpacing: 0 },
5
- headlineLarge: { fontSize: 32, lineHeight: 40, fontWeight: 400, letterSpacing: 0 },
6
- headlineMedium: { fontSize: 28, lineHeight: 36, fontWeight: 400, letterSpacing: 0 },
7
- headlineSmall: { fontSize: 24, lineHeight: 32, fontWeight: 400, letterSpacing: 0 },
8
- titleLarge: { fontSize: 22, lineHeight: 28, fontWeight: 400, letterSpacing: 0 },
9
- titleMedium: { fontSize: 16, lineHeight: 24, fontWeight: 500, letterSpacing: 0.15 },
10
- titleSmall: { fontSize: 14, lineHeight: 20, fontWeight: 500, letterSpacing: 0.1 },
11
- labelLarge: { fontSize: 14, lineHeight: 20, fontWeight: 500, letterSpacing: 0.1 },
12
- labelMedium: { fontSize: 12, lineHeight: 16, fontWeight: 500, letterSpacing: 0.5 },
13
- labelSmall: { fontSize: 11, lineHeight: 16, fontWeight: 500, letterSpacing: 0.5 },
14
- bodyLarge: { fontSize: 16, lineHeight: 24, fontWeight: 400, letterSpacing: 0.5 },
15
- bodyMedium: { fontSize: 14, lineHeight: 20, fontWeight: 400, letterSpacing: 0.25 },
16
- bodySmall: { fontSize: 12, lineHeight: 16, fontWeight: 400, letterSpacing: 0.4 },
2
+ displayLarge: { fontSize: "3.5rem", fontWeight: 400, lineHeight: "4rem" },
3
+ displayMedium: { fontSize: "2.8rem", fontWeight: 400, lineHeight: "3.2rem" },
4
+ displaySmall: { fontSize: "2.25rem", fontWeight: 400, lineHeight: "2.75rem" },
5
+ headlineLarge: { fontSize: "2rem", fontWeight: 400, lineHeight: "2.5rem" },
6
+ headlineMedium: { fontSize: "1.75rem", fontWeight: 400, lineHeight: "2.25rem" },
7
+ headlineSmall: { fontSize: "1.5rem", fontWeight: 400, lineHeight: "2rem" },
8
+ titleLarge: { fontSize: "1.375rem", fontWeight: 500, lineHeight: "1.75rem" },
9
+ titleMedium: { fontSize: "1rem", fontWeight: 500, lineHeight: "1.5rem", letterSpacing: "0.009em" },
10
+ titleSmall: { fontSize: "0.875rem", fontWeight: 500, lineHeight: "1.25rem", letterSpacing: "0.007em" },
11
+ bodyLarge: { fontSize: "1rem", fontWeight: 400, lineHeight: "1.5rem", letterSpacing: "0.009em" },
12
+ bodyMedium: { fontSize: "0.875rem", fontWeight: 400, lineHeight: "1.25rem", letterSpacing: "0.018em" },
13
+ bodySmall: { fontSize: "0.75rem", fontWeight: 400, lineHeight: "1rem", letterSpacing: "0.025em" },
14
+ labelLarge: { fontSize: "0.875rem", fontWeight: 500, lineHeight: "1.25rem", letterSpacing: "0.007em" },
15
+ labelMedium: { fontSize: "0.75rem", fontWeight: 500, lineHeight: "1rem", letterSpacing: "0.031em" },
16
+ labelSmall: { fontSize: "0.6875rem", fontWeight: 500, lineHeight: "1rem", letterSpacing: "0.045em" },
17
+ // Shortcuts
18
+ h1: { fontSize: "2rem", fontWeight: "bold", lineHeight: "2.5rem" },
19
+ h2: { fontSize: "1.5rem", fontWeight: "bold", lineHeight: "2rem" },
20
+ h3: { fontSize: "1.25rem", fontWeight: "bold", lineHeight: "1.75rem" },
21
+ h4: { fontSize: "1.125rem", fontWeight: "bold", lineHeight: "1.5rem" },
22
+ body: { fontSize: "1rem", fontWeight: "normal", lineHeight: "1.5rem" },
23
+ caption: { fontSize: "0.75rem", fontWeight: "normal", lineHeight: "1rem" },
24
+ button: { fontSize: "0.875rem", fontWeight: 500, lineHeight: "1rem", letterSpacing: "0.031em" },
25
+ code: { fontSize: "0.875rem", fontWeight: "normal", lineHeight: "1.4rem", letterSpacing: "-0.01em" },
17
26
  };
18
- /**
19
- * Converts a TextStyle token to standard CSS properties.
20
- */
21
27
  export function textStyleToCSS(style) {
22
- const css = {
23
- fontSize: `${style.fontSize}px`,
24
- lineHeight: `${style.lineHeight}px`,
25
- fontWeight: style.fontWeight,
26
- letterSpacing: `${style.letterSpacing}px`,
27
- };
28
- if (style.fontFamily)
29
- css.fontFamily = style.fontFamily;
30
- if (style.color)
31
- css.color = style.color;
32
- return css;
28
+ return style;
33
29
  }
34
30
  //# sourceMappingURL=typography.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"typography.js","sourceRoot":"","sources":["../src/typography.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,Y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AE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAyB;CACrF,CAAC;AAIzC,MAAM,UAAU,cAAc,CAAC,KAAmB;IAChD,OAAO,KAAsB,CAAC;AAChC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jalvin/ui",
3
- "version": "2.0.41",
3
+ "version": "2.0.43",
4
4
  "description": "Jalvin UI — Compose-style component library (Column, Row, Box, Button, Text, …)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "@jalvin/runtime": ">=2.0.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@jalvin/runtime": "2.0.41",
24
+ "@jalvin/runtime": "2.0.43",
25
25
  "@testing-library/dom": "^10.4.1",
26
26
  "@testing-library/jest-dom": "^6.9.1",
27
27
  "@types/node": "^20.0.0",
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=children-signature.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"children-signature.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/children-signature.test.ts"],"names":[],"mappings":""}
@@ -1,106 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import * as fs from "fs";
3
- import * as path from "path";
4
- /**
5
- * Tests to ensure all child-accepting UI components use consistent
6
- * second-argument children signature (not props-style).
7
- *
8
- * This prevents runtime mismatches like the 2.0.35 incident where
9
- * Scaffold/Card took children as second arg, but Column/Row read from props.
10
- */
11
- describe("UI children signature consistency", () => {
12
- // Components that accept children
13
- const CHILD_COMPONENTS = [
14
- "Scaffold",
15
- "Card",
16
- "Column",
17
- "Row",
18
- "Box",
19
- "Button",
20
- "IconButton",
21
- ];
22
- // Text is intentionally different (uses props.children and props.text)
23
- const INTENTIONAL_EXCEPTIONS = ["Text"];
24
- it("all child-accepting components use second-argument style in TypeScript", () => {
25
- const srcDir = path.join(__dirname, "..");
26
- const tsFiles = [
27
- path.join(srcDir, "surface.ts"),
28
- path.join(srcDir, "layout.ts"),
29
- path.join(srcDir, "button.ts"),
30
- ].filter(f => fs.existsSync(f));
31
- const content = tsFiles
32
- .map((f) => fs.readFileSync(f, "utf-8"))
33
- .join("\n");
34
- for (const component of CHILD_COMPONENTS) {
35
- // Find the component function definition
36
- const componentRegex = new RegExp(`export function ${component}\\([\\s\\S]*?\\):\\s*HTMLElement`, "");
37
- const match = content.match(componentRegex);
38
- if (!match)
39
- continue; // Component might not be in the checked files
40
- const functionSig = match[0];
41
- // Check: should have children as second parameter (after Props)
42
- // Pattern: }: PropType, children?: Node[]
43
- // (handles multi-line with whitespace variations)
44
- const hasSecondArgChildren = /:\s*\w+Props\s*,\s*children\?/s.test(functionSig);
45
- expect(hasSecondArgChildren, `${component} should have children as second-argument, not in props`).toBe(true);
46
- // Check: should NOT have children in props destructuring
47
- // Pattern: { ..., children... }
48
- const propsMatch = functionSig.match(/\{[\s\S]*?\}:\s*\w+Props/);
49
- if (propsMatch) {
50
- const propsBody = propsMatch[0];
51
- expect(!propsBody.includes("children"), `${component} props should NOT include children field`).toBe(true);
52
- }
53
- }
54
- });
55
- it("interface props do not include children field", () => {
56
- const srcDir = path.join(__dirname, "..");
57
- const tsFiles = [
58
- path.join(srcDir, "surface.ts"),
59
- path.join(srcDir, "layout.ts"),
60
- path.join(srcDir, "button.ts"),
61
- ].filter(f => fs.existsSync(f));
62
- const content = tsFiles
63
- .map((f) => fs.readFileSync(f, "utf-8"))
64
- .join("\n");
65
- // Get interface definitions for components with children
66
- for (const component of CHILD_COMPONENTS) {
67
- // Look for interfaces like ScaffoldProps, CardProps, etc.
68
- const interfaceName = `${component}Props`;
69
- const interfacePattern = new RegExp(`export interface ${interfaceName}\\s*\\{[^}]*?\\}`, "s");
70
- const match = content.match(interfacePattern);
71
- if (match) {
72
- const interfaceBody = match[0];
73
- // For non-exception components, children should NOT be in the interface
74
- if (!INTENTIONAL_EXCEPTIONS.includes(component)) {
75
- expect(!interfaceBody.includes("children"), `${interfaceName} should NOT include children field (children are second-argument)`).toBe(true);
76
- }
77
- }
78
- }
79
- });
80
- it("component implementations use children correctly as second arg", () => {
81
- const srcDir = path.join(__dirname, "..");
82
- const layoutContent = fs.readFileSync(path.join(srcDir, "layout.ts"), "utf-8");
83
- // Check that Column/Row/Box all use children ?? [] pattern
84
- for (const component of ["Column", "Row", "Box"]) {
85
- expect(layoutContent.includes(`children ?? []`), `${component} should use children ?? [] pattern`).toBe(true);
86
- }
87
- });
88
- it("compiled dist files maintain second-argument children signature", () => {
89
- const distDir = path.join(__dirname, "../../dist");
90
- // Check if dist exists (it will after build)
91
- if (!fs.existsSync(distDir)) {
92
- console.warn("dist/ not found; skipping compiled output check");
93
- return;
94
- }
95
- const jsFiles = [
96
- path.join(distDir, "surface.js"),
97
- path.join(distDir, "layout.js"),
98
- path.join(distDir, "button.js"),
99
- ].filter((f) => fs.existsSync(f));
100
- const content = jsFiles.map((f) => fs.readFileSync(f, "utf-8")).join("\n");
101
- // Check that second-argument children patterns exist in compiled code
102
- // Pattern: }, children) or }, children =
103
- expect(/},\s*children\s*[),=]/m.test(content), "Compiled code should have children as second parameter").toBe(true);
104
- });
105
- });
106
- //# sourceMappingURL=children-signature.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"children-signature.test.js","sourceRoot":"","sources":["../../src/__tests__/children-signature.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B;;;;;;GAMG;AAEH,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;IACjD,kCAAkC;IAClC,MAAM,gBAAgB,GAAG;QACvB,UAAU;QACV,MAAM;QACN,QAAQ;QACR,KAAK;QACL,KAAK;QACL,QAAQ;QACR,YAAY;KACb,CAAC;IAEF,uEAAuE;IACvE,MAAM,sBAAsB,GAAG,CAA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