@astryxdesign/cli 0.7.5-canary.51c62ca → 0.7.5-canary.f2dafed
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/assets/templates/blocks/components/Tokenizer/TokenizerClear.tsx +14 -15
- package/assets/templates/blocks/components/Tokenizer/TokenizerCreatable.tsx +30 -30
- package/assets/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx +14 -15
- package/assets/templates/blocks/components/Tokenizer/TokenizerIcon.tsx +14 -15
- package/assets/templates/blocks/components/Tokenizer/TokenizerMaxEntries.tsx +16 -17
- package/assets/templates/blocks/components/Tokenizer/TokenizerOverflow.tsx +29 -29
- package/assets/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx +8 -9
- package/assets/templates/blocks/components/Tokenizer/TokenizerStates.tsx +41 -39
- package/foundation/text/string-utils.mjs +0 -33
- package/foundation/text/string-utils.test.mjs +0 -17
- package/package.json +9 -9
|
@@ -26,20 +26,19 @@ export default function TokenizerClear() {
|
|
|
26
26
|
const [value, setValue] = useState<SearchableItem[]>([users[0], users[1]]);
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
</div>
|
|
29
|
+
<Stack direction="vertical" gap={2}>
|
|
30
|
+
<Text type="supporting" color="secondary">
|
|
31
|
+
Clear-all button appears when tokens are selected
|
|
32
|
+
</Text>
|
|
33
|
+
<Tokenizer
|
|
34
|
+
label="Team Members"
|
|
35
|
+
placeholder="Search people..."
|
|
36
|
+
searchSource={userSource}
|
|
37
|
+
value={value}
|
|
38
|
+
onChange={items => setValue(items)}
|
|
39
|
+
hasClear
|
|
40
|
+
containerStyle={{width: 400}}
|
|
41
|
+
/>
|
|
42
|
+
</Stack>
|
|
44
43
|
);
|
|
45
44
|
}
|
|
@@ -32,36 +32,36 @@ export default function TokenizerCreatable() {
|
|
|
32
32
|
const [members, setMembers] = useState<SearchableItem[]>([]);
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<
|
|
36
|
-
<Stack direction="vertical" gap={
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</Stack>
|
|
50
|
-
<Stack direction="vertical" gap={1}>
|
|
51
|
-
<Text type="supporting" color="secondary">
|
|
52
|
-
Create or search
|
|
53
|
-
</Text>
|
|
54
|
-
<Tokenizer
|
|
55
|
-
label="Team Members"
|
|
56
|
-
searchSource={userSource}
|
|
57
|
-
value={members}
|
|
58
|
-
onChange={items => setMembers(items)}
|
|
59
|
-
hasCreate
|
|
60
|
-
hasEntriesOnFocus
|
|
61
|
-
placeholder="Search or type a new name..."
|
|
62
|
-
/>
|
|
63
|
-
</Stack>
|
|
35
|
+
<Stack direction="vertical" gap={4}>
|
|
36
|
+
<Stack direction="vertical" gap={1}>
|
|
37
|
+
<Text type="supporting" color="secondary">
|
|
38
|
+
Free-text only
|
|
39
|
+
</Text>
|
|
40
|
+
<Tokenizer
|
|
41
|
+
label="Tags"
|
|
42
|
+
searchSource={emptySource}
|
|
43
|
+
value={tags}
|
|
44
|
+
onChange={items => setTags(items)}
|
|
45
|
+
hasCreate
|
|
46
|
+
placeholder="Type a tag and press Enter..."
|
|
47
|
+
containerStyle={{width: 400}}
|
|
48
|
+
/>
|
|
64
49
|
</Stack>
|
|
65
|
-
|
|
50
|
+
<Stack direction="vertical" gap={1}>
|
|
51
|
+
<Text type="supporting" color="secondary">
|
|
52
|
+
Create or search
|
|
53
|
+
</Text>
|
|
54
|
+
<Tokenizer
|
|
55
|
+
label="Team Members"
|
|
56
|
+
searchSource={userSource}
|
|
57
|
+
value={members}
|
|
58
|
+
onChange={items => setMembers(items)}
|
|
59
|
+
hasCreate
|
|
60
|
+
hasEntriesOnFocus
|
|
61
|
+
placeholder="Search or type a new name..."
|
|
62
|
+
containerStyle={{width: 400}}
|
|
63
|
+
/>
|
|
64
|
+
</Stack>
|
|
65
|
+
</Stack>
|
|
66
66
|
);
|
|
67
67
|
}
|
|
@@ -28,20 +28,19 @@ export default function TokenizerEndContent() {
|
|
|
28
28
|
const [value, setValue] = useState<SearchableItem[]>([users[0], users[2]]);
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
|
-
<
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
</div>
|
|
31
|
+
<Stack direction="vertical" gap={2}>
|
|
32
|
+
<Text type="supporting" color="secondary">
|
|
33
|
+
Action button in the end slot
|
|
34
|
+
</Text>
|
|
35
|
+
<Tokenizer
|
|
36
|
+
label="Team Members"
|
|
37
|
+
placeholder="Search people..."
|
|
38
|
+
searchSource={userSource}
|
|
39
|
+
value={value}
|
|
40
|
+
onChange={items => setValue(items)}
|
|
41
|
+
endContent={<Button label="Apply" variant="primary" size="sm" />}
|
|
42
|
+
containerStyle={{width: 400}}
|
|
43
|
+
/>
|
|
44
|
+
</Stack>
|
|
46
45
|
);
|
|
47
46
|
}
|
|
@@ -27,20 +27,19 @@ export default function TokenizerIcon() {
|
|
|
27
27
|
const [value, setValue] = useState<SearchableItem[]>([users[0], users[2]]);
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
</div>
|
|
30
|
+
<Stack direction="vertical" gap={2}>
|
|
31
|
+
<Text type="supporting" color="secondary">
|
|
32
|
+
Leading icon reinforces the search affordance
|
|
33
|
+
</Text>
|
|
34
|
+
<Tokenizer
|
|
35
|
+
label="Team Members"
|
|
36
|
+
placeholder="Search people..."
|
|
37
|
+
searchSource={userSource}
|
|
38
|
+
value={value}
|
|
39
|
+
onChange={items => setValue(items)}
|
|
40
|
+
startIcon={MagnifyingGlassIcon}
|
|
41
|
+
containerStyle={{width: 400}}
|
|
42
|
+
/>
|
|
43
|
+
</Stack>
|
|
45
44
|
);
|
|
46
45
|
}
|
|
@@ -31,22 +31,21 @@ export default function TokenizerMaxEntries() {
|
|
|
31
31
|
const [value, setValue] = useState<SearchableItem[]>([skills[0], skills[1]]);
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
|
-
<
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
</div>
|
|
34
|
+
<Stack direction="vertical" gap={2}>
|
|
35
|
+
<Text type="supporting" color="secondary">
|
|
36
|
+
Limited to {MAX_SKILLS} selections — {MAX_SKILLS - value.length}{' '}
|
|
37
|
+
remaining
|
|
38
|
+
</Text>
|
|
39
|
+
<Tokenizer
|
|
40
|
+
label="Top Skills"
|
|
41
|
+
placeholder="Search skills..."
|
|
42
|
+
description={`Choose up to ${MAX_SKILLS} skills`}
|
|
43
|
+
searchSource={skillSource}
|
|
44
|
+
value={value}
|
|
45
|
+
onChange={items => setValue(items)}
|
|
46
|
+
maxEntries={MAX_SKILLS}
|
|
47
|
+
containerStyle={{width: 400}}
|
|
48
|
+
/>
|
|
49
|
+
</Stack>
|
|
51
50
|
);
|
|
52
51
|
}
|
|
@@ -28,35 +28,35 @@ export default function TokenizerOverflow() {
|
|
|
28
28
|
const [layerValue, setLayerValue] = useState<SearchableItem[]>(users);
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
|
-
<
|
|
32
|
-
<Stack direction="vertical" gap={
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
</Stack>
|
|
46
|
-
<Stack direction="vertical" gap={1}>
|
|
47
|
-
<Text type="supporting" color="secondary">
|
|
48
|
-
Layer overflow — expands as overlay, no layout shift
|
|
49
|
-
</Text>
|
|
50
|
-
<Tokenizer
|
|
51
|
-
label="Layer Overflow"
|
|
52
|
-
placeholder="Add more..."
|
|
53
|
-
searchSource={userSource}
|
|
54
|
-
value={layerValue}
|
|
55
|
-
onChange={items => setLayerValue(items)}
|
|
56
|
-
tokenOverflowBehavior="unfocusedLayer"
|
|
57
|
-
/>
|
|
58
|
-
</Stack>
|
|
31
|
+
<Stack direction="vertical" gap={4}>
|
|
32
|
+
<Stack direction="vertical" gap={1}>
|
|
33
|
+
<Text type="supporting" color="secondary">
|
|
34
|
+
Inline overflow — content shifts down on expand
|
|
35
|
+
</Text>
|
|
36
|
+
<Tokenizer
|
|
37
|
+
label="Inline Overflow"
|
|
38
|
+
placeholder="Add more..."
|
|
39
|
+
searchSource={userSource}
|
|
40
|
+
value={inlineValue}
|
|
41
|
+
onChange={items => setInlineValue(items)}
|
|
42
|
+
tokenOverflowBehavior="unfocusedInline"
|
|
43
|
+
containerStyle={{width: 400, maxWidth: 400}}
|
|
44
|
+
/>
|
|
59
45
|
</Stack>
|
|
60
|
-
|
|
46
|
+
<Stack direction="vertical" gap={1}>
|
|
47
|
+
<Text type="supporting" color="secondary">
|
|
48
|
+
Layer overflow — expands as overlay, no layout shift
|
|
49
|
+
</Text>
|
|
50
|
+
<Tokenizer
|
|
51
|
+
label="Layer Overflow"
|
|
52
|
+
placeholder="Add more..."
|
|
53
|
+
searchSource={userSource}
|
|
54
|
+
value={layerValue}
|
|
55
|
+
onChange={items => setLayerValue(items)}
|
|
56
|
+
tokenOverflowBehavior="unfocusedLayer"
|
|
57
|
+
containerStyle={{width: 400, maxWidth: 400}}
|
|
58
|
+
/>
|
|
59
|
+
</Stack>
|
|
60
|
+
</Stack>
|
|
61
61
|
);
|
|
62
62
|
}
|
|
@@ -17,14 +17,13 @@ export default function TokenizerShowcase() {
|
|
|
17
17
|
{id: '2', label: 'Engineering'},
|
|
18
18
|
]);
|
|
19
19
|
return (
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</div>
|
|
20
|
+
<Tokenizer
|
|
21
|
+
label="Tags"
|
|
22
|
+
placeholder="Search..."
|
|
23
|
+
searchSource={source}
|
|
24
|
+
value={value}
|
|
25
|
+
onChange={setValue}
|
|
26
|
+
containerStyle={{width: 400}}
|
|
27
|
+
/>
|
|
29
28
|
);
|
|
30
29
|
}
|
|
@@ -32,44 +32,46 @@ export default function TokenizerStates() {
|
|
|
32
32
|
]);
|
|
33
33
|
|
|
34
34
|
return (
|
|
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
|
-
|
|
35
|
+
<Stack direction="vertical" gap={4}>
|
|
36
|
+
<Tokenizer
|
|
37
|
+
label="Disabled field"
|
|
38
|
+
searchSource={userSource}
|
|
39
|
+
value={[users[0], users[2]]}
|
|
40
|
+
onChange={() => {}}
|
|
41
|
+
isDisabled
|
|
42
|
+
containerStyle={{width: 400}}
|
|
43
|
+
/>
|
|
44
|
+
<Tokenizer
|
|
45
|
+
label="Error message"
|
|
46
|
+
placeholder="Search people..."
|
|
47
|
+
searchSource={userSource}
|
|
48
|
+
value={errorValue}
|
|
49
|
+
onChange={items => setErrorValue(items)}
|
|
50
|
+
isRequired
|
|
51
|
+
status={{type: 'error', message: 'At least one reviewer is required'}}
|
|
52
|
+
containerStyle={{width: 400}}
|
|
53
|
+
/>
|
|
54
|
+
<Tokenizer
|
|
55
|
+
label="Warning message"
|
|
56
|
+
placeholder="Search people..."
|
|
57
|
+
searchSource={userSource}
|
|
58
|
+
value={warningValue}
|
|
59
|
+
onChange={items => setWarningValue(items)}
|
|
60
|
+
status={{
|
|
61
|
+
type: 'warning',
|
|
62
|
+
message: 'Consider adding at least 2 approvers',
|
|
63
|
+
}}
|
|
64
|
+
containerStyle={{width: 400}}
|
|
65
|
+
/>
|
|
66
|
+
<Tokenizer
|
|
67
|
+
label="Success message"
|
|
68
|
+
placeholder="Search people..."
|
|
69
|
+
searchSource={userSource}
|
|
70
|
+
value={successValue}
|
|
71
|
+
onChange={items => setSuccessValue(items)}
|
|
72
|
+
status={{type: 'success', message: 'All required reviewers added'}}
|
|
73
|
+
containerStyle={{width: 400}}
|
|
74
|
+
/>
|
|
75
|
+
</Stack>
|
|
74
76
|
);
|
|
75
77
|
}
|
|
@@ -209,39 +209,6 @@ export async function searchComponents(needle, coreDir, components) {
|
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
// --- Pass 3: a name made of other words around a component's name ---
|
|
213
|
-
// Only when nothing above matched: a contiguous run of the needle's words
|
|
214
|
-
// ("Primitive Button", "Meta Employee Typeahead") that is a component's
|
|
215
|
-
// whole name. Longer runs and runs nearer the end score higher.
|
|
216
|
-
if (scored.size === 0) {
|
|
217
|
-
const words = String(needle)
|
|
218
|
-
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
219
|
-
.replace(/([A-Z])([A-Z][a-z])/g, '$1 $2')
|
|
220
|
-
.toLowerCase()
|
|
221
|
-
.split(/[^a-z0-9]+/)
|
|
222
|
-
.filter(Boolean);
|
|
223
|
-
const byLower = new Map(allNames.map(n => [n.toLowerCase(), n]));
|
|
224
|
-
const longest = Math.max(0, ...allNames.map(n => n.length));
|
|
225
|
-
for (let i = 0; i < words.length; i++) {
|
|
226
|
-
let run = '';
|
|
227
|
-
for (let j = i + 1; j <= words.length; j++) {
|
|
228
|
-
// Grow the run one word at a time; stop once no name is that long.
|
|
229
|
-
run += words[j - 1];
|
|
230
|
-
if (run.length > longest) break;
|
|
231
|
-
if (run.length < 4 || run === term) continue;
|
|
232
|
-
const comp = byLower.get(run);
|
|
233
|
-
if (!comp) continue;
|
|
234
|
-
const span = j - i;
|
|
235
|
-
const atEnd = j === words.length ? 1 : 0;
|
|
236
|
-
addMatch(comp, 10 + Math.min(span, 4) + atEnd, 'name part "' + run + '"');
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
// Keep only the strongest name parts, so a weaker part never sits
|
|
240
|
-
// beside the best one.
|
|
241
|
-
const best = Math.max(0, ...[...scored.values()].map(r => r.score));
|
|
242
|
-
for (const [name, r] of scored) if (r.score < best) scored.delete(name);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
212
|
const results = Array.from(scored.values())
|
|
246
213
|
.map(r =>
|
|
247
214
|
keywordAt.has(r.name)
|
|
@@ -116,23 +116,6 @@ describe('searchComponents', () => {
|
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
|
|
119
|
-
it('suggests a component whose whole name is a run of the needle\'s words when nothing else matches', async () => {
|
|
120
|
-
const results = await searchComponents('FancyWidgetPanel', NO_CORE, {
|
|
121
|
-
g: ['Panel', 'Widget', 'Sheet'],
|
|
122
|
-
});
|
|
123
|
-
expect(results.map(r => r.name)).toEqual(['Panel']);
|
|
124
|
-
expect(results[0].reason).toBe('name part "panel"');
|
|
125
|
-
expect(results.every(r => r.score < 20)).toBe(true);
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it('adds no name-part matches when another signal matched', async () => {
|
|
129
|
-
const results = await searchComponents('Panl', NO_CORE, {
|
|
130
|
-
g: ['Panel', 'Sheet'],
|
|
131
|
-
});
|
|
132
|
-
expect(results.map(r => r.name)).toEqual(['Panel']);
|
|
133
|
-
expect(results[0].score).toBe(80);
|
|
134
|
-
});
|
|
135
|
-
|
|
136
119
|
it('breaks a score tie alphabetically', async () => {
|
|
137
120
|
// Both names are edit-distance 2 from "bcd" -> both score 40 -> alpha order.
|
|
138
121
|
const results = await searchComponents('bcd', NO_CORE, {g: ['Xbc', 'Abc']});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.7.5-canary.
|
|
3
|
+
"version": "0.7.5-canary.f2dafed",
|
|
4
4
|
"displayName": "CLI",
|
|
5
5
|
"description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -106,10 +106,10 @@
|
|
|
106
106
|
"zod": "^4.4.3"
|
|
107
107
|
},
|
|
108
108
|
"peerDependencies": {
|
|
109
|
-
"@astryxdesign/charts": "0.7.5-canary.
|
|
110
|
-
"@astryxdesign/core": "0.7.5-canary.
|
|
111
|
-
"@astryxdesign/lab": "0.7.5-canary.
|
|
112
|
-
"@astryxdesign/theme-neutral": "0.7.5-canary.
|
|
109
|
+
"@astryxdesign/charts": "0.7.5-canary.f2dafed",
|
|
110
|
+
"@astryxdesign/core": "0.7.5-canary.f2dafed",
|
|
111
|
+
"@astryxdesign/lab": "0.7.5-canary.f2dafed",
|
|
112
|
+
"@astryxdesign/theme-neutral": "0.7.5-canary.f2dafed"
|
|
113
113
|
},
|
|
114
114
|
"peerDependenciesMeta": {
|
|
115
115
|
"@astryxdesign/charts": {
|
|
@@ -126,10 +126,10 @@
|
|
|
126
126
|
}
|
|
127
127
|
},
|
|
128
128
|
"devDependencies": {
|
|
129
|
-
"@astryxdesign/charts": "0.7.5-canary.
|
|
130
|
-
"@astryxdesign/core": "0.7.5-canary.
|
|
131
|
-
"@astryxdesign/lab": "0.7.5-canary.
|
|
132
|
-
"@astryxdesign/theme-neutral": "0.7.5-canary.
|
|
129
|
+
"@astryxdesign/charts": "0.7.5-canary.f2dafed",
|
|
130
|
+
"@astryxdesign/core": "0.7.5-canary.f2dafed",
|
|
131
|
+
"@astryxdesign/lab": "0.7.5-canary.f2dafed",
|
|
132
|
+
"@astryxdesign/theme-neutral": "0.7.5-canary.f2dafed",
|
|
133
133
|
"@heroicons/react": "^2.2.0",
|
|
134
134
|
"@stylexjs/stylex": "^0.19.0",
|
|
135
135
|
"@types/babel__core": "^7.20.5",
|