@usefragments/core 1.10.0 → 1.10.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/codes/index.d.ts +1 -1
- package/dist/compiled-types/index.d.ts +1 -1
- package/dist/generate/index.d.ts +1 -1
- package/dist/{governance-B5WWcmFY.d.ts → governance-CLk_wkP9.d.ts} +1 -1
- package/dist/index.d.ts +136 -357
- package/dist/index.js +7 -454
- package/dist/index.js.map +1 -1
- package/dist/preview-runtime.d.ts +48 -0
- package/dist/preview-runtime.js +91 -0
- package/dist/preview-runtime.js.map +1 -0
- package/dist/react-types.d.ts +3 -2
- package/dist/registry.d.ts +18 -18
- package/dist/schemas/index.d.ts +1 -1
- package/dist/storyAdapter.d.ts +187 -0
- package/dist/storyAdapter.js +371 -0
- package/dist/storyAdapter.js.map +1 -0
- package/dist/test-utils.d.ts +1 -1
- package/package.json +9 -1
- package/src/index.ts +0 -35
- package/src/react-create-element.test.ts +22 -0
- package/src/react-create-element.ts +12 -0
- package/src/react-types.ts +2 -1
- package/src/storyAdapter.ts +3 -2
- package/src/tokens/scss.test.ts +32 -1
- package/src/tokens/scss.ts +12 -7
- package/dist/{index-DtHxs0Pf.d.ts → index-_sxhUNqx.d.ts} +12 -12
package/src/tokens/scss.ts
CHANGED
|
@@ -27,12 +27,15 @@ export function detectTokenPrefix(names: string[]): string {
|
|
|
27
27
|
|
|
28
28
|
export function parseScssVariables(content: string): Map<string, string> {
|
|
29
29
|
const vars = new Map<string, string>();
|
|
30
|
-
const scssVarRegex = /^\s*(\$[\w-]+)\s*:\s*(
|
|
30
|
+
const scssVarRegex = /^\s*(\$[\w-]+)\s*:\s*([\s\S]*?)\s*(?:!default\s*)?;/gm;
|
|
31
31
|
|
|
32
32
|
let match: RegExpExecArray | null;
|
|
33
33
|
while ((match = scssVarRegex.exec(content)) !== null) {
|
|
34
34
|
const name = match[1];
|
|
35
|
-
const value = match[2]
|
|
35
|
+
const value = match[2]
|
|
36
|
+
.replace(/\s*\/\/[^\n]*$/gm, "")
|
|
37
|
+
.replace(/\s+/g, " ")
|
|
38
|
+
.trim();
|
|
36
39
|
if (!vars.has(name)) {
|
|
37
40
|
vars.set(name, value);
|
|
38
41
|
}
|
|
@@ -45,7 +48,7 @@ export function resolveTokenValue(
|
|
|
45
48
|
rawValue: string,
|
|
46
49
|
scssVars: Map<string, string>,
|
|
47
50
|
cssVarValues: Map<string, string>,
|
|
48
|
-
depth = 0
|
|
51
|
+
depth = 0
|
|
49
52
|
): string {
|
|
50
53
|
if (depth > 5) return rawValue;
|
|
51
54
|
|
|
@@ -60,9 +63,7 @@ export function resolveTokenValue(
|
|
|
60
63
|
|
|
61
64
|
resolved = resolved.replace(/(?<![#\{])(\$[\w-]+)/g, (_, varName) => {
|
|
62
65
|
const val = scssVars.get(varName);
|
|
63
|
-
return val !== undefined
|
|
64
|
-
? resolveTokenValue(val, scssVars, cssVarValues, depth + 1)
|
|
65
|
-
: varName;
|
|
66
|
+
return val !== undefined ? resolveTokenValue(val, scssVars, cssVarValues, depth + 1) : varName;
|
|
66
67
|
});
|
|
67
68
|
|
|
68
69
|
resolved = resolved.replace(
|
|
@@ -76,7 +77,7 @@ export function resolveTokenValue(
|
|
|
76
77
|
return resolveTokenValue(fallback.trim(), scssVars, cssVarValues, depth + 1);
|
|
77
78
|
}
|
|
78
79
|
return original;
|
|
79
|
-
}
|
|
80
|
+
}
|
|
80
81
|
);
|
|
81
82
|
|
|
82
83
|
return resolved;
|
|
@@ -134,6 +135,10 @@ export function parseScssTokens(content: string, filePath = "tokens.scss"): Toke
|
|
|
134
135
|
|
|
135
136
|
for (const [name, value] of scssVars) {
|
|
136
137
|
if (seenNames.has(name)) continue;
|
|
138
|
+
// Parenthesized Sass maps are containers, not addressable token values.
|
|
139
|
+
// Keep them in `scssVars` for reference resolution, but let the dedicated
|
|
140
|
+
// map-entry parser expose their individual members.
|
|
141
|
+
if (value.startsWith("(")) continue;
|
|
137
142
|
seenNames.add(name);
|
|
138
143
|
tokens.push({
|
|
139
144
|
name,
|
|
@@ -2575,7 +2575,6 @@ declare const agentFormatSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
2575
2575
|
maxIterations: number;
|
|
2576
2576
|
scoreDelta: number;
|
|
2577
2577
|
};
|
|
2578
|
-
status?: undefined;
|
|
2579
2578
|
suppressions?: {
|
|
2580
2579
|
reason: string;
|
|
2581
2580
|
scope: "file" | "line" | "block";
|
|
@@ -2589,6 +2588,7 @@ declare const agentFormatSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
2589
2588
|
exitCode: 0 | 1;
|
|
2590
2589
|
gatingFindingCount: number;
|
|
2591
2590
|
} | undefined;
|
|
2591
|
+
status?: undefined;
|
|
2592
2592
|
findings?: {
|
|
2593
2593
|
message: string;
|
|
2594
2594
|
ruleId: string;
|
|
@@ -2719,7 +2719,6 @@ declare const agentFormatSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
2719
2719
|
maxIterations: number;
|
|
2720
2720
|
scoreDelta: number;
|
|
2721
2721
|
};
|
|
2722
|
-
status?: undefined;
|
|
2723
2722
|
suppressions?: {
|
|
2724
2723
|
reason: string;
|
|
2725
2724
|
code?: string | undefined;
|
|
@@ -2733,6 +2732,7 @@ declare const agentFormatSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
2733
2732
|
exitCode: 0 | 1;
|
|
2734
2733
|
gatingFindingCount: number;
|
|
2735
2734
|
} | undefined;
|
|
2735
|
+
status?: undefined;
|
|
2736
2736
|
findings?: {
|
|
2737
2737
|
message: string;
|
|
2738
2738
|
ruleId: string;
|
|
@@ -3327,9 +3327,9 @@ declare const agentFormatSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
3327
3327
|
reasons: string[];
|
|
3328
3328
|
}>;
|
|
3329
3329
|
}, "strip", z.ZodTypeAny, {
|
|
3330
|
-
status: "indeterminate";
|
|
3331
3330
|
schemaVersion: "typestyle.agent.v2";
|
|
3332
3331
|
summary: string;
|
|
3332
|
+
status: "indeterminate";
|
|
3333
3333
|
passed: false;
|
|
3334
3334
|
reasons: ["zero_rules_loaded"];
|
|
3335
3335
|
integrity: {
|
|
@@ -3471,9 +3471,9 @@ declare const agentFormatSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
3471
3471
|
inputsHash?: string | undefined;
|
|
3472
3472
|
} | undefined;
|
|
3473
3473
|
}, {
|
|
3474
|
-
status: "indeterminate";
|
|
3475
3474
|
schemaVersion: "typestyle.agent.v2";
|
|
3476
3475
|
summary: string;
|
|
3476
|
+
status: "indeterminate";
|
|
3477
3477
|
passed: false;
|
|
3478
3478
|
reasons: ["zero_rules_loaded"];
|
|
3479
3479
|
integrity: {
|
|
@@ -4135,7 +4135,6 @@ declare const agentFormatSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
4135
4135
|
gatingFindingCount: number;
|
|
4136
4136
|
}>;
|
|
4137
4137
|
}, "strip", z.ZodTypeAny, {
|
|
4138
|
-
status: "indeterminate";
|
|
4139
4138
|
schemaVersion: "typestyle.agent.v2";
|
|
4140
4139
|
summary: string;
|
|
4141
4140
|
verdict: {
|
|
@@ -4143,6 +4142,7 @@ declare const agentFormatSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
4143
4142
|
exitCode: 0;
|
|
4144
4143
|
gatingFindingCount: number;
|
|
4145
4144
|
};
|
|
4145
|
+
status: "indeterminate";
|
|
4146
4146
|
passed: true;
|
|
4147
4147
|
reasons: ["zero_rules_loaded"];
|
|
4148
4148
|
integrity: {
|
|
@@ -4279,7 +4279,6 @@ declare const agentFormatSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
4279
4279
|
}[] | undefined;
|
|
4280
4280
|
score?: undefined;
|
|
4281
4281
|
}, {
|
|
4282
|
-
status: "indeterminate";
|
|
4283
4282
|
schemaVersion: "typestyle.agent.v2";
|
|
4284
4283
|
summary: string;
|
|
4285
4284
|
verdict: {
|
|
@@ -4287,6 +4286,7 @@ declare const agentFormatSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
4287
4286
|
exitCode: 0;
|
|
4288
4287
|
gatingFindingCount: number;
|
|
4289
4288
|
};
|
|
4289
|
+
status: "indeterminate";
|
|
4290
4290
|
passed: true;
|
|
4291
4291
|
reasons: ["zero_rules_loaded"];
|
|
4292
4292
|
integrity: {
|
|
@@ -5126,7 +5126,6 @@ declare const agentOutputSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
|
|
5126
5126
|
maxIterations: number;
|
|
5127
5127
|
scoreDelta: number;
|
|
5128
5128
|
};
|
|
5129
|
-
status?: undefined;
|
|
5130
5129
|
suppressions?: {
|
|
5131
5130
|
reason: string;
|
|
5132
5131
|
scope: "file" | "line" | "block";
|
|
@@ -5140,6 +5139,7 @@ declare const agentOutputSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
|
|
5140
5139
|
exitCode: 0 | 1;
|
|
5141
5140
|
gatingFindingCount: number;
|
|
5142
5141
|
} | undefined;
|
|
5142
|
+
status?: undefined;
|
|
5143
5143
|
findings?: {
|
|
5144
5144
|
message: string;
|
|
5145
5145
|
ruleId: string;
|
|
@@ -5270,7 +5270,6 @@ declare const agentOutputSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
|
|
5270
5270
|
maxIterations: number;
|
|
5271
5271
|
scoreDelta: number;
|
|
5272
5272
|
};
|
|
5273
|
-
status?: undefined;
|
|
5274
5273
|
suppressions?: {
|
|
5275
5274
|
reason: string;
|
|
5276
5275
|
code?: string | undefined;
|
|
@@ -5284,6 +5283,7 @@ declare const agentOutputSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
|
|
5284
5283
|
exitCode: 0 | 1;
|
|
5285
5284
|
gatingFindingCount: number;
|
|
5286
5285
|
} | undefined;
|
|
5286
|
+
status?: undefined;
|
|
5287
5287
|
findings?: {
|
|
5288
5288
|
message: string;
|
|
5289
5289
|
ruleId: string;
|
|
@@ -5878,9 +5878,9 @@ declare const agentOutputSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
|
|
5878
5878
|
reasons: string[];
|
|
5879
5879
|
}>;
|
|
5880
5880
|
}, "strip", z.ZodTypeAny, {
|
|
5881
|
-
status: "indeterminate";
|
|
5882
5881
|
schemaVersion: "typestyle.agent.v2";
|
|
5883
5882
|
summary: string;
|
|
5883
|
+
status: "indeterminate";
|
|
5884
5884
|
passed: false;
|
|
5885
5885
|
reasons: ["zero_rules_loaded"];
|
|
5886
5886
|
integrity: {
|
|
@@ -6022,9 +6022,9 @@ declare const agentOutputSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
|
|
6022
6022
|
inputsHash?: string | undefined;
|
|
6023
6023
|
} | undefined;
|
|
6024
6024
|
}, {
|
|
6025
|
-
status: "indeterminate";
|
|
6026
6025
|
schemaVersion: "typestyle.agent.v2";
|
|
6027
6026
|
summary: string;
|
|
6027
|
+
status: "indeterminate";
|
|
6028
6028
|
passed: false;
|
|
6029
6029
|
reasons: ["zero_rules_loaded"];
|
|
6030
6030
|
integrity: {
|
|
@@ -6686,7 +6686,6 @@ declare const agentOutputSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
|
|
6686
6686
|
gatingFindingCount: number;
|
|
6687
6687
|
}>;
|
|
6688
6688
|
}, "strip", z.ZodTypeAny, {
|
|
6689
|
-
status: "indeterminate";
|
|
6690
6689
|
schemaVersion: "typestyle.agent.v2";
|
|
6691
6690
|
summary: string;
|
|
6692
6691
|
verdict: {
|
|
@@ -6694,6 +6693,7 @@ declare const agentOutputSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
|
|
6694
6693
|
exitCode: 0;
|
|
6695
6694
|
gatingFindingCount: number;
|
|
6696
6695
|
};
|
|
6696
|
+
status: "indeterminate";
|
|
6697
6697
|
passed: true;
|
|
6698
6698
|
reasons: ["zero_rules_loaded"];
|
|
6699
6699
|
integrity: {
|
|
@@ -6830,7 +6830,6 @@ declare const agentOutputSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
|
|
6830
6830
|
}[] | undefined;
|
|
6831
6831
|
score?: undefined;
|
|
6832
6832
|
}, {
|
|
6833
|
-
status: "indeterminate";
|
|
6834
6833
|
schemaVersion: "typestyle.agent.v2";
|
|
6835
6834
|
summary: string;
|
|
6836
6835
|
verdict: {
|
|
@@ -6838,6 +6837,7 @@ declare const agentOutputSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
|
|
6838
6837
|
exitCode: 0;
|
|
6839
6838
|
gatingFindingCount: number;
|
|
6840
6839
|
};
|
|
6840
|
+
status: "indeterminate";
|
|
6841
6841
|
passed: true;
|
|
6842
6842
|
reasons: ["zero_rules_loaded"];
|
|
6843
6843
|
integrity: {
|