@idealyst/mcp-server 1.2.118 → 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-O2B33ZYL.js → chunk-RVMPULO4.js} +623 -51
- package/dist/chunk-RVMPULO4.js.map +1 -0
- package/dist/index.cjs +645 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -10
- package/dist/index.js.map +1 -1
- package/dist/tools/index.cjs +626 -50
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.d.cts +16 -3
- package/dist/tools/index.d.ts +16 -3
- package/dist/tools/index.js +9 -1
- package/package.json +5 -5
- package/dist/chunk-O2B33ZYL.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
storageGuides,
|
|
8
8
|
toolDefinitions,
|
|
9
9
|
translateGuides
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-RVMPULO4.js";
|
|
11
11
|
|
|
12
12
|
// src/index.ts
|
|
13
13
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
@@ -2757,6 +2757,7 @@ const appRouter: NavigatorParam = {
|
|
|
2757
2757
|
> - Layout props do NOT include \`children\` \u2014 content renders via \`<Outlet />\`
|
|
2758
2758
|
> - Always create \`.web.tsx\`, \`.native.tsx\`, AND a base \`index.ts\` \u2014 without the base \`index.ts\`, TypeScript reports TS2307 (cannot find module)
|
|
2759
2759
|
> - The base \`index.ts\` re-exports from the \`.web\` version; bundlers pick the right platform file at runtime
|
|
2760
|
+
> - **Web-only CSS** in \`.web.tsx\`: cast with \`as any\`, NOT \`as React.CSSProperties\` \u2014 \`CSSProperties\` is incompatible with \`StyleProp<ViewStyle>\` (TS2322). Example: \`style={{ position: 'fixed', transition: 'width 0.2s' } as any}\`
|
|
2760
2761
|
|
|
2761
2762
|
## GeneralLayout Component
|
|
2762
2763
|
|
|
@@ -3127,17 +3128,23 @@ navigator.navigate({ path: '/new-location', replace: true });
|
|
|
3127
3128
|
|
|
3128
3129
|
## useParams Hook
|
|
3129
3130
|
|
|
3130
|
-
Access current route path parameters. Returns \`Record<string, string>\`.
|
|
3131
|
+
Access current route path parameters. Returns \`Record<string, string | undefined>\`.
|
|
3131
3132
|
|
|
3132
3133
|
> **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.
|
|
3133
3134
|
|
|
3135
|
+
> **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.
|
|
3136
|
+
|
|
3134
3137
|
\`\`\`tsx
|
|
3135
3138
|
import { useParams } from '@idealyst/navigation';
|
|
3136
3139
|
|
|
3137
3140
|
function UserScreen() {
|
|
3138
3141
|
// CORRECT \u2014 no type argument
|
|
3139
3142
|
const params = useParams();
|
|
3140
|
-
const userId = params.id; //
|
|
3143
|
+
const userId = params.id; // string | undefined from /user/:id
|
|
3144
|
+
|
|
3145
|
+
// Handle undefined before using in typed contexts:
|
|
3146
|
+
if (!userId) return <Text>User not found</Text>;
|
|
3147
|
+
// Now userId is narrowed to string
|
|
3141
3148
|
|
|
3142
3149
|
// WRONG \u2014 useParams does NOT accept generics
|
|
3143
3150
|
// const params = useParams<{ id: string }>(); // TS2558 error!
|
|
@@ -3148,26 +3155,37 @@ function UserScreen() {
|
|
|
3148
3155
|
|
|
3149
3156
|
## useNavigationState Hook
|
|
3150
3157
|
|
|
3151
|
-
Access navigation state passed via the \`state\` property
|
|
3158
|
+
Access navigation state passed via the \`state\` property.
|
|
3159
|
+
|
|
3160
|
+
> **IMPORTANT \u2014 Type constraints:**
|
|
3161
|
+
> - \`navigate({ state: {...} })\` requires all values to be \`string | number | boolean\` \u2014 NO \`undefined\` or \`null\`. Do NOT spread objects that may contain undefined values.
|
|
3162
|
+
> - \`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.
|
|
3163
|
+
> - **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.
|
|
3152
3164
|
|
|
3153
3165
|
\`\`\`tsx
|
|
3154
3166
|
import { useNavigationState } from '@idealyst/navigation';
|
|
3155
3167
|
|
|
3156
|
-
// When navigating:
|
|
3168
|
+
// When navigating \u2014 all values must be string | number | boolean:
|
|
3157
3169
|
navigator.navigate({
|
|
3158
3170
|
path: '/recording',
|
|
3159
3171
|
state: { autostart: true, source: 'home' }
|
|
3160
3172
|
});
|
|
3161
3173
|
|
|
3162
|
-
// In destination screen:
|
|
3174
|
+
// In destination screen \u2014 use REQUIRED fields (not optional):
|
|
3163
3175
|
function RecordingScreen() {
|
|
3164
|
-
const
|
|
3165
|
-
autostart
|
|
3166
|
-
source
|
|
3176
|
+
const state = useNavigationState<{
|
|
3177
|
+
autostart: boolean;
|
|
3178
|
+
source: string;
|
|
3167
3179
|
}>();
|
|
3168
3180
|
|
|
3169
|
-
// autostart = true, source = 'home'
|
|
3181
|
+
// state.autostart = true, state.source = 'home'
|
|
3170
3182
|
}
|
|
3183
|
+
|
|
3184
|
+
// For multi-step wizards, pass ALL accumulated data as required fields:
|
|
3185
|
+
navigator.navigate({
|
|
3186
|
+
path: '/step3',
|
|
3187
|
+
state: { firstName: name, lastName: last, theme: selectedTheme }
|
|
3188
|
+
});
|
|
3171
3189
|
\`\`\`
|
|
3172
3190
|
|
|
3173
3191
|
### Consuming State (Web)
|