@idealyst/mcp-server 1.2.119 → 11.2.120
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/{chunk-UD56HXN3.js → chunk-RVMPULO4.js} +14 -8
- package/dist/chunk-RVMPULO4.js.map +1 -0
- package/dist/index.cjs +39 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -10
- package/dist/index.js.map +1 -1
- package/dist/tools/index.cjs +13 -7
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-UD56HXN3.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -3141,17 +3141,23 @@ navigator.navigate({ path: '/new-location', replace: true });
|
|
|
3141
3141
|
|
|
3142
3142
|
## useParams Hook
|
|
3143
3143
|
|
|
3144
|
-
Access current route path parameters. Returns \`Record<string, string>\`.
|
|
3144
|
+
Access current route path parameters. Returns \`Record<string, string | undefined>\`.
|
|
3145
3145
|
|
|
3146
3146
|
> **WARNING:** \`useParams()\` does NOT accept generic type arguments. Do NOT write \`useParams<{ id: string }>()\` \u2014 this causes TS2558. Access params by key from the returned record instead.
|
|
3147
3147
|
|
|
3148
|
+
> **IMPORTANT:** Param values are \`string | undefined\`, NOT \`string\`. When passing a param to a function that expects \`string\`, you MUST handle the undefined case \u2014 either with a fallback (\`params.id ?? ''\`), a guard (\`if (!params.id) return null\`), or a non-null assertion (\`params.id!\`) if you are certain it exists. Without this, TypeScript will report TS2345.
|
|
3149
|
+
|
|
3148
3150
|
\`\`\`tsx
|
|
3149
3151
|
import { useParams } from '@idealyst/navigation';
|
|
3150
3152
|
|
|
3151
3153
|
function UserScreen() {
|
|
3152
3154
|
// CORRECT \u2014 no type argument
|
|
3153
3155
|
const params = useParams();
|
|
3154
|
-
const userId = params.id; //
|
|
3156
|
+
const userId = params.id; // string | undefined from /user/:id
|
|
3157
|
+
|
|
3158
|
+
// Handle undefined before using in typed contexts:
|
|
3159
|
+
if (!userId) return <Text>User not found</Text>;
|
|
3160
|
+
// Now userId is narrowed to string
|
|
3155
3161
|
|
|
3156
3162
|
// WRONG \u2014 useParams does NOT accept generics
|
|
3157
3163
|
// const params = useParams<{ id: string }>(); // TS2558 error!
|
|
@@ -3162,26 +3168,37 @@ function UserScreen() {
|
|
|
3162
3168
|
|
|
3163
3169
|
## useNavigationState Hook
|
|
3164
3170
|
|
|
3165
|
-
Access navigation state passed via the \`state\` property
|
|
3171
|
+
Access navigation state passed via the \`state\` property.
|
|
3172
|
+
|
|
3173
|
+
> **IMPORTANT \u2014 Type constraints:**
|
|
3174
|
+
> - \`navigate({ state: {...} })\` requires all values to be \`string | number | boolean\` \u2014 NO \`undefined\` or \`null\`. Do NOT spread objects that may contain undefined values.
|
|
3175
|
+
> - \`useNavigationState<T>()\` requires \`T extends Record<string, unknown>\`. Use \`Record<string, string | number | boolean>\` for the type parameter, or a specific interface with NON-optional fields.
|
|
3176
|
+
> - **Do NOT use optional fields (\`?\`) in the type parameter** \u2014 values passed via state are always present (they were explicitly set by navigate()). Use required fields instead.
|
|
3166
3177
|
|
|
3167
3178
|
\`\`\`tsx
|
|
3168
3179
|
import { useNavigationState } from '@idealyst/navigation';
|
|
3169
3180
|
|
|
3170
|
-
// When navigating:
|
|
3181
|
+
// When navigating \u2014 all values must be string | number | boolean:
|
|
3171
3182
|
navigator.navigate({
|
|
3172
3183
|
path: '/recording',
|
|
3173
3184
|
state: { autostart: true, source: 'home' }
|
|
3174
3185
|
});
|
|
3175
3186
|
|
|
3176
|
-
// In destination screen:
|
|
3187
|
+
// In destination screen \u2014 use REQUIRED fields (not optional):
|
|
3177
3188
|
function RecordingScreen() {
|
|
3178
|
-
const
|
|
3179
|
-
autostart
|
|
3180
|
-
source
|
|
3189
|
+
const state = useNavigationState<{
|
|
3190
|
+
autostart: boolean;
|
|
3191
|
+
source: string;
|
|
3181
3192
|
}>();
|
|
3182
3193
|
|
|
3183
|
-
// autostart = true, source = 'home'
|
|
3194
|
+
// state.autostart = true, state.source = 'home'
|
|
3184
3195
|
}
|
|
3196
|
+
|
|
3197
|
+
// For multi-step wizards, pass ALL accumulated data as required fields:
|
|
3198
|
+
navigator.navigate({
|
|
3199
|
+
path: '/step3',
|
|
3200
|
+
state: { firstName: name, lastName: last, theme: selectedTheme }
|
|
3201
|
+
});
|
|
3185
3202
|
\`\`\`
|
|
3186
3203
|
|
|
3187
3204
|
### Consuming State (Web)
|
|
@@ -11239,13 +11256,17 @@ var componentMetadata = {
|
|
|
11239
11256
|
"Standard, alert, and confirmation types",
|
|
11240
11257
|
"Title and close button",
|
|
11241
11258
|
"Backdrop click to close",
|
|
11242
|
-
"Animation types (slide, fade)"
|
|
11259
|
+
"Animation types (slide, fade)",
|
|
11260
|
+
"avoidKeyboard prop shifts dialog when keyboard opens (native)",
|
|
11261
|
+
"height prop gives dialog a definite height so children can use flex: 1",
|
|
11262
|
+
"Content area has flex: 1 \u2014 children can flex into available space"
|
|
11243
11263
|
],
|
|
11244
11264
|
bestPractices: [
|
|
11245
11265
|
"Use sparingly for important interactions",
|
|
11246
11266
|
"Provide clear actions for dismissal",
|
|
11247
11267
|
"Keep dialog content focused",
|
|
11248
|
-
"Use confirmation dialogs for destructive actions"
|
|
11268
|
+
"Use confirmation dialogs for destructive actions",
|
|
11269
|
+
"Use height or maxContentHeight when children need flex-based sizing"
|
|
11249
11270
|
]
|
|
11250
11271
|
},
|
|
11251
11272
|
Divider: {
|
|
@@ -11590,12 +11611,14 @@ var componentMetadata = {
|
|
|
11590
11611
|
"Multiple sizes",
|
|
11591
11612
|
"Character count",
|
|
11592
11613
|
"Auto-resize",
|
|
11593
|
-
"Error state"
|
|
11614
|
+
"Error state",
|
|
11615
|
+
"fill prop for flex-based sizing (fills available space)"
|
|
11594
11616
|
],
|
|
11595
11617
|
bestPractices: [
|
|
11596
11618
|
"Use for multi-line input",
|
|
11597
11619
|
"Show character limits when applicable",
|
|
11598
|
-
"Provide appropriate placeholder text"
|
|
11620
|
+
"Provide appropriate placeholder text",
|
|
11621
|
+
"Use fill prop inside Dialog with avoidKeyboard to shrink with keyboard"
|
|
11599
11622
|
]
|
|
11600
11623
|
},
|
|
11601
11624
|
TextInput: {
|
|
@@ -20879,8 +20902,8 @@ These are mistakes agents make repeatedly. Each one causes TypeScript compilatio
|
|
|
20879
20902
|
11. **NavigatorProvider** takes a \`route\` prop (SINGULAR) \u2014 NOT \`routes\`: \`<NavigatorProvider route={routeConfig} />\`. There is NO \`Router\` export.
|
|
20880
20903
|
12. Use \`useNavigator()\` \u2014 NOT \`useNavigate()\`.
|
|
20881
20904
|
13. \`navigate()\` takes an **object**: \`navigate({ path: '/settings' })\` \u2014 NOT \`navigate('/settings')\` or \`navigate('routeName', params)\`. To pass data use \`vars\`: \`navigate({ path: '/detail/:id', vars: { id: '123' } })\` \u2014 NOT \`params\`: \`navigate({ path: '/detail', params: { id: '123' } })\` (no \`params\` property exists).
|
|
20882
|
-
14. \`
|
|
20883
|
-
15. \`useParams()\` does NOT accept generic type arguments. It returns \`Record<string, string>\`. Do NOT write \`useParams<{ id: string }>()\` \u2014 that causes TS2558.
|
|
20905
|
+
14. \`navigate({ state: {...} })\` values must be \`string | number | boolean\` \u2014 NO \`undefined\`, \`null\`, or objects. When forwarding state across wizard steps, ensure all values are defined before passing: \`navigate({ path: '/step2', state: { firstName: name, age: 25 } })\`. Do NOT use optional fields in state types.
|
|
20906
|
+
15. \`useParams()\` does NOT accept generic type arguments. It returns \`Record<string, string | undefined>\`. Do NOT write \`useParams<{ id: string }>()\` \u2014 that causes TS2558. Always guard for undefined: \`const id = params.id; if (!id) return null;\`.
|
|
20884
20907
|
|
|
20885
20908
|
### Imports & Styling
|
|
20886
20909
|
16. **Never** import from \`react-native\` \u2014 no \`TouchableOpacity\`, \`FlatList\`, \`ScrollView\`, \`Animated\`, \`Dimensions\`, \`Linking\`, \`Platform\`. Idealyst provides cross-platform alternatives for all of these (e.g., \`openExternalLinks\` on Markdown, \`Pressable\` from \`@idealyst/components\`). **\`ScrollView\` is NOT exported from \`@idealyst/components\`** \u2014 use \`<View scrollable>\` instead. Do NOT \`import { ScrollView } from '@idealyst/components'\` \u2014 it will cause a TS import error.
|
|
@@ -70352,7 +70375,7 @@ function postProcessComponentTypes(componentName, result) {
|
|
|
70352
70375
|
}
|
|
70353
70376
|
if (componentName.toLowerCase() === "textarea") {
|
|
70354
70377
|
if (typeof result === "object" && result !== null) {
|
|
70355
|
-
result.usageNote = "TextArea has a DIFFERENT API from TextInput. TextArea uses onChange (not onChangeText) and does NOT have onBlur. TextArea DOES support label, error, and rows props (TextInput does NOT support label/error). Always call get_component_types('TextArea') separately \u2014 do NOT assume it shares TextInput's props.";
|
|
70378
|
+
result.usageNote = "TextArea has a DIFFERENT API from TextInput. TextArea uses onChange (not onChangeText) and does NOT have onBlur. TextArea DOES support label, error, and rows props (TextInput does NOT support label/error). TextArea supports `fill` prop: when true, all container layers get flex: 1 so the textarea expands to fill available vertical space (useful inside Dialog with avoidKeyboard). Always call get_component_types('TextArea') separately \u2014 do NOT assume it shares TextInput's props.";
|
|
70356
70379
|
}
|
|
70357
70380
|
}
|
|
70358
70381
|
if (componentName.toLowerCase() === "image") {
|