@koinzhang/paseo-plugin-customize 0.2.0 → 0.2.1
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/CHANGELOG.md +16 -0
- package/client/mechanism-card.tsx +74 -42
- package/client/surface.tsx +105 -94
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,22 @@ All notable changes to `@koinzhang/paseo-plugin-customize` are documented in thi
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.2.1] - 2026-09-28
|
|
9
|
+
|
|
10
|
+
Requires Paseo **>= 0.9.0**.
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- The board no longer shifts sideways when the entry list grows past one page: the list scrollbar is hidden, the provider/project controls stay pinned at the top, and only the entry list scrolls.
|
|
15
|
+
- The search field shows focus on its outer border only, without the inner outline.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Category tabs, the Skills invocation filter, and search now share one top toolbar.
|
|
20
|
+
- The loading-mechanism note became an inline toolbar dropdown; it opens as an overlay and no longer takes a row of its own.
|
|
21
|
+
|
|
22
|
+
[0.2.1]: https://github.com/koinzhang/paseo-plugins/releases/tag/customize-v0.2.1
|
|
23
|
+
|
|
8
24
|
## [0.2.0] - 2026-09-28
|
|
9
25
|
|
|
10
26
|
Requires Paseo **>= 0.9.0**.
|
|
@@ -1,74 +1,106 @@
|
|
|
1
1
|
import { Icon } from "@getpaseo/plugin/client/react-native";
|
|
2
2
|
import { useState, type ReactNode } from "react";
|
|
3
|
-
import { Pressable, Text, View } from "react-native";
|
|
3
|
+
import { Platform, Pressable, ScrollView, Text, View } from "react-native";
|
|
4
4
|
import type { Mechanism } from "../shared/mechanisms.ts";
|
|
5
5
|
import type { AppLanguage, Messages } from "../shared/i18n.ts";
|
|
6
|
-
import { CONTROL, FONT_WEIGHT, ICON_SIZE, RADIUS, TEXT } from "./design-tokens.ts";
|
|
6
|
+
import { CONTROL, FONT_WEIGHT, ICON_SIZE, MENU, RADIUS, TEXT } from "./design-tokens.ts";
|
|
7
7
|
import type { Colors } from "./ui.tsx";
|
|
8
8
|
|
|
9
|
-
/**
|
|
9
|
+
/** Inline entry with a dropdown for the provider/category loading details. */
|
|
10
10
|
export function MechanismCard({
|
|
11
11
|
mechanism,
|
|
12
12
|
language,
|
|
13
13
|
colors,
|
|
14
14
|
m,
|
|
15
|
+
compact,
|
|
15
16
|
}: {
|
|
16
17
|
mechanism: Mechanism;
|
|
17
18
|
language: AppLanguage;
|
|
18
19
|
colors: Colors;
|
|
19
20
|
m: Messages;
|
|
21
|
+
compact: boolean;
|
|
20
22
|
}): ReactNode {
|
|
21
23
|
const [open, setOpen] = useState(false);
|
|
22
24
|
const pick = (text: { en: string; zh: string }) => (language === "zh-CN" ? text.zh : text.en);
|
|
25
|
+
const title = mechanism.supported ? m.howItWorks : m.unsupported;
|
|
26
|
+
const icon = mechanism.supported ? "Info" : "Ban";
|
|
23
27
|
const [first, ...rest] = mechanism.notes;
|
|
24
|
-
const expandable = mechanism.locations.length > 0 || rest.length > 0;
|
|
25
28
|
|
|
26
29
|
return (
|
|
27
|
-
<View
|
|
28
|
-
style={{
|
|
29
|
-
borderRadius: RADIUS.overlay,
|
|
30
|
-
borderWidth: 1,
|
|
31
|
-
borderColor: colors.border,
|
|
32
|
-
backgroundColor: colors.surface1,
|
|
33
|
-
paddingHorizontal: 12,
|
|
34
|
-
paddingVertical: 8,
|
|
35
|
-
gap: 6,
|
|
36
|
-
}}
|
|
37
|
-
>
|
|
30
|
+
<View style={{ position: "relative", zIndex: open ? 40 : 1, flexShrink: 0 }}>
|
|
38
31
|
<Pressable
|
|
39
32
|
accessibilityRole="button"
|
|
40
33
|
accessibilityState={{ expanded: open }}
|
|
41
|
-
accessibilityLabel={
|
|
42
|
-
disabled={!expandable}
|
|
43
|
-
hitSlop={CONTROL.hitSlop}
|
|
34
|
+
accessibilityLabel={title}
|
|
44
35
|
onPress={() => setOpen((prev) => !prev)}
|
|
45
|
-
style={{
|
|
36
|
+
style={{
|
|
37
|
+
flexDirection: "row",
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
gap: 6,
|
|
40
|
+
height: CONTROL.searchHeight,
|
|
41
|
+
paddingHorizontal: 10,
|
|
42
|
+
borderRadius: RADIUS.control,
|
|
43
|
+
borderWidth: 1,
|
|
44
|
+
borderColor: colors.border,
|
|
45
|
+
backgroundColor: colors.surface1,
|
|
46
|
+
}}
|
|
46
47
|
>
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<Text style={{ ...TEXT.meta, color: colors.foreground, flex: 1 }}>
|
|
51
|
-
<Text style={{ fontWeight: FONT_WEIGHT.semibold }}>{mechanism.supported ? m.howItWorks : m.unsupported}</Text>
|
|
52
|
-
{first ? ` ${pick(first)}` : ""}
|
|
53
|
-
</Text>
|
|
54
|
-
{expandable ? <Icon name={open ? "ChevronUp" : "ChevronDown"} size={ICON_SIZE.inline} color={colors.foregroundMuted} /> : null}
|
|
48
|
+
<Icon name={icon} size={ICON_SIZE.inline} color={colors.foregroundMuted} />
|
|
49
|
+
<Text style={{ ...TEXT.small, fontWeight: FONT_WEIGHT.medium, color: colors.foreground }}>{title}</Text>
|
|
50
|
+
<Icon name={open ? "ChevronUp" : "ChevronDown"} size={ICON_SIZE.inline} color={colors.foregroundMuted} />
|
|
55
51
|
</Pressable>
|
|
56
52
|
{open ? (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
53
|
+
<>
|
|
54
|
+
<Pressable
|
|
55
|
+
accessibilityRole="button"
|
|
56
|
+
accessibilityLabel={m.closeMenu}
|
|
57
|
+
onPress={() => setOpen(false)}
|
|
58
|
+
style={{
|
|
59
|
+
position: (Platform.OS === "web" ? "fixed" : "absolute") as "absolute",
|
|
60
|
+
top: 0,
|
|
61
|
+
left: 0,
|
|
62
|
+
right: 0,
|
|
63
|
+
bottom: 0,
|
|
64
|
+
}}
|
|
65
|
+
/>
|
|
66
|
+
<View
|
|
67
|
+
style={{
|
|
68
|
+
position: "absolute",
|
|
69
|
+
top: "100%",
|
|
70
|
+
right: 0,
|
|
71
|
+
marginTop: 4,
|
|
72
|
+
width: compact ? 280 : MENU.maxWidth,
|
|
73
|
+
borderRadius: RADIUS.overlay,
|
|
74
|
+
borderWidth: 1,
|
|
75
|
+
borderColor: colors.border,
|
|
76
|
+
backgroundColor: colors.surface1,
|
|
77
|
+
shadowColor: "rgba(0, 0, 0, 0.04)",
|
|
78
|
+
shadowOffset: { width: 0, height: 4 },
|
|
79
|
+
shadowRadius: 16,
|
|
80
|
+
elevation: 4,
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
<ScrollView
|
|
84
|
+
style={{ maxHeight: MENU.visibleRows * MENU.rowHeight + 8 }}
|
|
85
|
+
contentContainerStyle={{ padding: 12, gap: 12 }}
|
|
86
|
+
>
|
|
87
|
+
{first ? <Text style={{ ...TEXT.body, color: colors.foreground }}>{pick(first)}</Text> : null}
|
|
88
|
+
{mechanism.locations.map((location, index) => (
|
|
89
|
+
<View key={index} style={{ flexDirection: "row", gap: 8 }}>
|
|
90
|
+
<Text style={{ ...TEXT.meta, color: colors.foregroundMuted, minWidth: 56 }}>{m.scopes[location.scope]}</Text>
|
|
91
|
+
<Text style={{ ...TEXT.path, color: colors.foreground, flex: 1 }} selectable>
|
|
92
|
+
{location.path}
|
|
93
|
+
</Text>
|
|
94
|
+
</View>
|
|
95
|
+
))}
|
|
96
|
+
{rest.map((note, index) => (
|
|
97
|
+
<Text key={index} style={{ ...TEXT.meta, color: colors.foreground }}>
|
|
98
|
+
• {pick(note)}
|
|
99
|
+
</Text>
|
|
100
|
+
))}
|
|
101
|
+
</ScrollView>
|
|
102
|
+
</View>
|
|
103
|
+
</>
|
|
72
104
|
) : null}
|
|
73
105
|
</View>
|
|
74
106
|
);
|
package/client/surface.tsx
CHANGED
|
@@ -74,6 +74,7 @@ export function CustomizeSurface({ theme, layout }: PluginSurfaceProps): ReactNo
|
|
|
74
74
|
const [category, setCategoryState] = useState<Category>("instructions");
|
|
75
75
|
const activeCategory = resolveCategory(provider, category);
|
|
76
76
|
const [query, setQuery] = useState("");
|
|
77
|
+
const [searchFocused, setSearchFocused] = useState(false);
|
|
77
78
|
const [skillFilter, setSkillFilter] = useState<SkillInvocationFilter>("all");
|
|
78
79
|
const [selected, setSelected] = useState<Entry | null>(null);
|
|
79
80
|
|
|
@@ -84,6 +85,7 @@ export function CustomizeSurface({ theme, layout }: PluginSurfaceProps): ReactNo
|
|
|
84
85
|
};
|
|
85
86
|
const setCategory = (next: Category) => {
|
|
86
87
|
setCategoryState(next);
|
|
88
|
+
setSearchFocused(false);
|
|
87
89
|
setSelected(null);
|
|
88
90
|
};
|
|
89
91
|
|
|
@@ -91,6 +93,7 @@ export function CustomizeSurface({ theme, layout }: PluginSurfaceProps): ReactNo
|
|
|
91
93
|
setCategoryState((current) => resolveCategory(provider, current));
|
|
92
94
|
setSelected(null);
|
|
93
95
|
setQuery("");
|
|
96
|
+
setSearchFocused(false);
|
|
94
97
|
}, [provider]);
|
|
95
98
|
|
|
96
99
|
const projects = useQuery({
|
|
@@ -187,101 +190,67 @@ export function CustomizeSurface({ theme, layout }: PluginSurfaceProps): ReactNo
|
|
|
187
190
|
return (
|
|
188
191
|
<View style={{ flex: 1, minHeight: 0, backgroundColor: colors.surface0 }}>
|
|
189
192
|
<View style={{ flex: selected ? 1 - (compact ? PREVIEW_FRACTION.compact : PREVIEW_FRACTION.regular) : 1, minHeight: 0 }}>
|
|
190
|
-
<
|
|
191
|
-
<View
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
>
|
|
200
|
-
|
|
201
|
-
{compatibility
|
|
202
|
-
<
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
/>
|
|
246
|
-
</View>
|
|
193
|
+
<View style={{ paddingHorizontal: page.padding, paddingTop: page.padding, gap: titleGap(compact), zIndex: 1 }}>
|
|
194
|
+
<View
|
|
195
|
+
style={{
|
|
196
|
+
flexDirection: "row",
|
|
197
|
+
alignItems: "center",
|
|
198
|
+
justifyContent: "flex-end",
|
|
199
|
+
zIndex: 30,
|
|
200
|
+
}}
|
|
201
|
+
>
|
|
202
|
+
<View style={{ flexDirection: "row", alignItems: "center", gap: 14, flexShrink: 1, minWidth: 0 }}>
|
|
203
|
+
{compatibility ? (
|
|
204
|
+
<View accessible accessibilityRole="image" accessibilityLabel={m.compatibility(compatibilityState)}>
|
|
205
|
+
<Icon name={compatibilityState === "off" ? "Link2Off" : "Link2"} size={ICON_SIZE.action} color={compatibilityState === "on" || compatibilityState === "supported" ? colors.statusSuccess : compatibilityState === "off" ? colors.foregroundMuted : colors.statusWarning} />
|
|
206
|
+
</View>
|
|
207
|
+
) : null}
|
|
208
|
+
<Dropdown
|
|
209
|
+
label={m.provider}
|
|
210
|
+
options={providerOptions}
|
|
211
|
+
value={provider}
|
|
212
|
+
onChange={setProvider}
|
|
213
|
+
colors={colors}
|
|
214
|
+
triggerLabel={m.chooseProvider}
|
|
215
|
+
closeLabel={m.closeMenu}
|
|
216
|
+
menuAlign={compact ? "left" : "right"}
|
|
217
|
+
disabled={settings.saving}
|
|
218
|
+
/>
|
|
219
|
+
<Dropdown
|
|
220
|
+
label={m.project}
|
|
221
|
+
options={projectOptions}
|
|
222
|
+
value={projectRoot ?? NO_PROJECT}
|
|
223
|
+
onChange={(id) => {
|
|
224
|
+
if (settings.saving) return;
|
|
225
|
+
void settings.save({ ...settings.values, projectRoot: id }, settings.revision);
|
|
226
|
+
setSelected(null);
|
|
227
|
+
}}
|
|
228
|
+
colors={colors}
|
|
229
|
+
triggerLabel={m.chooseProject}
|
|
230
|
+
closeLabel={m.closeMenu}
|
|
231
|
+
emptyLabel={m.noProject}
|
|
232
|
+
disabled={settings.saving}
|
|
233
|
+
/>
|
|
234
|
+
<IconButton
|
|
235
|
+
icon="RefreshCw"
|
|
236
|
+
label={m.refresh}
|
|
237
|
+
color={colors.foregroundMuted}
|
|
238
|
+
busy={result.isFetching}
|
|
239
|
+
tooltip={displayed ? {
|
|
240
|
+
text: m.lastScanned(new Date(displayed.scannedAt).toLocaleString(language)),
|
|
241
|
+
colors,
|
|
242
|
+
} : undefined}
|
|
243
|
+
onPress={() => {
|
|
244
|
+
void providerSnapshot.refetch();
|
|
245
|
+
void result.refetch();
|
|
246
|
+
}}
|
|
247
|
+
/>
|
|
247
248
|
</View>
|
|
248
|
-
<CategoryTabs options={tabs} value={activeCategory} onChange={setCategory} colors={colors} />
|
|
249
|
-
{settings.saveError ? <Text style={{ ...TEXT.small, color: colors.statusDanger }}>{settings.saveError}</Text> : null}
|
|
250
|
-
<MechanismCard key={`${provider}:${activeCategory}`} mechanism={mechanism} language={language} colors={colors} m={m} />
|
|
251
|
-
{result.isError && displayed ? <ErrorState error={result.error} onRetry={() => void result.refetch()} colors={colors} /> : null}
|
|
252
249
|
</View>
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
<View style={{ flexDirection: "row",
|
|
256
|
-
|
|
257
|
-
style={{
|
|
258
|
-
flexGrow: 1,
|
|
259
|
-
flexBasis: 180,
|
|
260
|
-
flexDirection: "row",
|
|
261
|
-
alignItems: "center",
|
|
262
|
-
gap: 6,
|
|
263
|
-
height: CONTROL.searchHeight,
|
|
264
|
-
paddingHorizontal: 10,
|
|
265
|
-
borderRadius: RADIUS.control,
|
|
266
|
-
borderWidth: 1,
|
|
267
|
-
borderColor: colors.border,
|
|
268
|
-
backgroundColor: colors.surface1,
|
|
269
|
-
}}
|
|
270
|
-
>
|
|
271
|
-
<Icon name="Search" size={ICON_SIZE.inline} color={colors.foregroundMuted} />
|
|
272
|
-
<TextInput
|
|
273
|
-
value={query}
|
|
274
|
-
onChangeText={setQuery}
|
|
275
|
-
placeholder={m.search}
|
|
276
|
-
placeholderTextColor={colors.foregroundMuted}
|
|
277
|
-
accessibilityLabel={m.search}
|
|
278
|
-
autoCorrect={false}
|
|
279
|
-
autoCapitalize="none"
|
|
280
|
-
style={{ flex: 1, ...TEXT.small, color: colors.foreground, paddingVertical: 0 }}
|
|
281
|
-
/>
|
|
282
|
-
{queryActive ? <IconButton icon="X" label={m.preview.close} color={colors.foregroundMuted} size={ICON_SIZE.inline} onPress={() => setQuery("")} /> : null}
|
|
283
|
-
</View>
|
|
284
|
-
{activeCategory === "skills" ? (
|
|
250
|
+
<View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8 }}>
|
|
251
|
+
<CategoryTabs options={tabs} value={activeCategory} onChange={setCategory} colors={colors} />
|
|
252
|
+
<View style={{ flexBasis: 220, flexGrow: 1, minWidth: 0, flexDirection: "row", flexWrap: "wrap", justifyContent: "flex-end", alignItems: "center", gap: 8 }}>
|
|
253
|
+
{mechanism.supported && activeCategory === "skills" ? (
|
|
285
254
|
<SegmentedControl
|
|
286
255
|
label={m.skillInvocation}
|
|
287
256
|
options={skillFilterOptions}
|
|
@@ -290,9 +259,51 @@ export function CustomizeSurface({ theme, layout }: PluginSurfaceProps): ReactNo
|
|
|
290
259
|
colors={colors}
|
|
291
260
|
/>
|
|
292
261
|
) : null}
|
|
262
|
+
<MechanismCard key={`${provider}:${activeCategory}`} mechanism={mechanism} language={language} colors={colors} m={m} compact={compact} />
|
|
263
|
+
{mechanism.supported ? (
|
|
264
|
+
<View
|
|
265
|
+
style={{
|
|
266
|
+
width: 220,
|
|
267
|
+
minWidth: 180,
|
|
268
|
+
flexDirection: "row",
|
|
269
|
+
alignItems: "center",
|
|
270
|
+
gap: 6,
|
|
271
|
+
height: CONTROL.searchHeight,
|
|
272
|
+
paddingHorizontal: 10,
|
|
273
|
+
borderRadius: RADIUS.control,
|
|
274
|
+
borderWidth: 1,
|
|
275
|
+
borderColor: searchFocused ? colors.foregroundMuted : colors.border,
|
|
276
|
+
backgroundColor: colors.surface1,
|
|
277
|
+
}}
|
|
278
|
+
>
|
|
279
|
+
<Icon name="Search" size={ICON_SIZE.inline} color={colors.foregroundMuted} />
|
|
280
|
+
<TextInput
|
|
281
|
+
value={query}
|
|
282
|
+
onChangeText={setQuery}
|
|
283
|
+
onFocus={() => setSearchFocused(true)}
|
|
284
|
+
onBlur={() => setSearchFocused(false)}
|
|
285
|
+
placeholder={m.search}
|
|
286
|
+
placeholderTextColor={colors.foregroundMuted}
|
|
287
|
+
accessibilityLabel={m.search}
|
|
288
|
+
autoCorrect={false}
|
|
289
|
+
autoCapitalize="none"
|
|
290
|
+
style={{ flex: 1, ...TEXT.small, color: colors.foreground, paddingVertical: 0, borderWidth: 0, ...(Platform.OS === "web" ? ({ outlineStyle: "none" } as object) : null) }}
|
|
291
|
+
/>
|
|
292
|
+
{queryActive ? <IconButton icon="X" label={m.preview.close} color={colors.foregroundMuted} size={ICON_SIZE.inline} onPress={() => setQuery("")} /> : null}
|
|
293
|
+
</View>
|
|
294
|
+
) : null}
|
|
293
295
|
</View>
|
|
294
|
-
|
|
296
|
+
</View>
|
|
297
|
+
{settings.saveError ? <Text style={{ ...TEXT.small, color: colors.statusDanger }}>{settings.saveError}</Text> : null}
|
|
298
|
+
{result.isError && displayed ? <ErrorState error={result.error} onRetry={() => void result.refetch()} colors={colors} /> : null}
|
|
299
|
+
</View>
|
|
295
300
|
|
|
301
|
+
<ScrollView
|
|
302
|
+
style={{ flex: 1, minHeight: 0, ...(Platform.OS === "web" ? ({ scrollbarWidth: "none", msOverflowStyle: "none" } as object) : null) }}
|
|
303
|
+
contentContainerStyle={{ paddingHorizontal: page.padding, paddingTop: page.gap, paddingBottom: page.padding, gap: page.gap }}
|
|
304
|
+
keyboardShouldPersistTaps="handled"
|
|
305
|
+
showsVerticalScrollIndicator={false}
|
|
306
|
+
>
|
|
296
307
|
{!displayed && (saved.isPending || result.isPending) ? (
|
|
297
308
|
<LoadingState color={colors.foregroundMuted} />
|
|
298
309
|
) : !displayed && (result.isError || saved.isError) ? (
|
package/package.json
CHANGED