@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.
- package/dist/__tests__/annotated-string.test.d.ts +1 -1
- package/dist/__tests__/annotated-string.test.d.ts.map +1 -1
- package/dist/__tests__/annotated-string.test.js +39 -26
- package/dist/__tests__/annotated-string.test.js.map +1 -1
- package/dist/__tests__/interaction.test.js +35 -52
- package/dist/__tests__/interaction.test.js.map +1 -1
- package/dist/__tests__/text.test.d.ts +1 -1
- package/dist/__tests__/text.test.d.ts.map +1 -1
- package/dist/__tests__/text.test.js +16 -22
- package/dist/__tests__/text.test.js.map +1 -1
- package/dist/__tests__/windowsizeclass.test.js +66 -57
- package/dist/__tests__/windowsizeclass.test.js.map +1 -1
- package/dist/annotated-string.d.ts +4 -2
- package/dist/annotated-string.d.ts.map +1 -1
- package/dist/annotated-string.js +17 -19
- package/dist/annotated-string.js.map +1 -1
- package/dist/button.d.ts +3 -2
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +12 -8
- package/dist/button.js.map +1 -1
- package/dist/canvas.d.ts +3 -3
- package/dist/canvas.d.ts.map +1 -1
- package/dist/canvas.js +40 -31
- package/dist/canvas.js.map +1 -1
- package/dist/checkbox.d.ts +2 -1
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/checkbox.js +11 -18
- package/dist/checkbox.js.map +1 -1
- package/dist/image.d.ts +6 -4
- package/dist/image.d.ts.map +1 -1
- package/dist/image.js +21 -32
- package/dist/image.js.map +1 -1
- package/dist/index.d.ts +14 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -17
- package/dist/index.js.map +1 -1
- package/dist/input.d.ts +3 -1
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +13 -20
- package/dist/input.js.map +1 -1
- package/dist/interaction.d.ts.map +1 -1
- package/dist/interaction.js +27 -9
- package/dist/interaction.js.map +1 -1
- package/dist/layout.d.ts +7 -3
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +10 -10
- package/dist/layout.js.map +1 -1
- package/dist/spacer.d.ts +3 -2
- package/dist/spacer.d.ts.map +1 -1
- package/dist/spacer.js +5 -5
- package/dist/spacer.js.map +1 -1
- package/dist/surface.d.ts +10 -9
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +13 -30
- package/dist/surface.js.map +1 -1
- package/dist/text.d.ts +5 -3
- package/dist/text.d.ts.map +1 -1
- package/dist/text.js +12 -23
- package/dist/text.js.map +1 -1
- package/dist/textarea.d.ts +3 -1
- package/dist/textarea.d.ts.map +1 -1
- package/dist/textarea.js +13 -20
- package/dist/textarea.js.map +1 -1
- package/dist/typography.d.ts +129 -101
- package/dist/typography.d.ts.map +1 -1
- package/dist/typography.js +25 -29
- package/dist/typography.js.map +1 -1
- package/package.json +2 -2
- package/dist/__tests__/children-signature.test.d.ts +0 -2
- package/dist/__tests__/children-signature.test.d.ts.map +0 -1
- package/dist/__tests__/children-signature.test.js +0 -106
- package/dist/__tests__/children-signature.test.js.map +0 -1
package/dist/typography.d.ts
CHANGED
|
@@ -1,109 +1,137 @@
|
|
|
1
|
-
|
|
2
|
-
export type CSSProperties = {
|
|
3
|
-
[key: string]: string | number | undefined;
|
|
4
|
-
};
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
5
2
|
export interface TextStyleDef {
|
|
6
|
-
fontSize:
|
|
7
|
-
lineHeight: number;
|
|
3
|
+
fontSize: string;
|
|
8
4
|
fontWeight: number | "bold" | "normal";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
color?: string;
|
|
5
|
+
lineHeight: string;
|
|
6
|
+
letterSpacing?: string;
|
|
12
7
|
}
|
|
13
8
|
export declare const TextStyle: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
package/dist/typography.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../src/typography.ts"],"names":[],"mappings":"AAAA,
|
|
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"}
|
package/dist/typography.js
CHANGED
|
@@ -1,34 +1,30 @@
|
|
|
1
1
|
export const TextStyle = {
|
|
2
|
-
displayLarge: { fontSize:
|
|
3
|
-
displayMedium: { fontSize:
|
|
4
|
-
displaySmall: { fontSize:
|
|
5
|
-
headlineLarge: { fontSize:
|
|
6
|
-
headlineMedium: { fontSize:
|
|
7
|
-
headlineSmall: { fontSize:
|
|
8
|
-
titleLarge: { fontSize:
|
|
9
|
-
titleMedium: { fontSize:
|
|
10
|
-
titleSmall: { fontSize:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
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
|
package/dist/typography.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typography.js","sourceRoot":"","sources":["../src/typography.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typography.js","sourceRoot":"","sources":["../src/typography.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,YAAY,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAG,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAyB;IACjG,aAAa,EAAC,EAAE,QAAQ,EAAE,QAAQ,EAAG,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAyB;IACnG,YAAY,EAAE,EAAE,QAAQ,EAAE,SA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
|
2
2
|
"name": "@jalvin/ui",
|
|
3
|
-
"version": "2.0.
|
|
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.
|
|
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 +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,CAAC,MAAM,CAAC,CAAC;IAExC,EAAE,CAAC,wEAAwE,EAAE,GAAG,EAAE;QAChF,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC1C,MAAM,OAAO,GAAG;YACd,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC;YAC/B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC;SAC/B,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QAEhC,MAAM,OAA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