@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/tools/index.cjs
CHANGED
|
@@ -67,12 +67,16 @@ __export(tools_exports, {
|
|
|
67
67
|
getInstallGuideDefinition: () => getInstallGuideDefinition,
|
|
68
68
|
getIntro: () => getIntro,
|
|
69
69
|
getIntroDefinition: () => getIntroDefinition,
|
|
70
|
+
getLiveActivityGuide: () => getLiveActivityGuide,
|
|
71
|
+
getLiveActivityGuideDefinition: () => getLiveActivityGuideDefinition,
|
|
70
72
|
getLottieGuide: () => getLottieGuide,
|
|
71
73
|
getLottieGuideDefinition: () => getLottieGuideDefinition,
|
|
72
74
|
getMarkdownGuide: () => getMarkdownGuide,
|
|
73
75
|
getMarkdownGuideDefinition: () => getMarkdownGuideDefinition,
|
|
74
76
|
getNavigationTypes: () => getNavigationTypes2,
|
|
75
77
|
getNavigationTypesDefinition: () => getNavigationTypesDefinition,
|
|
78
|
+
getNetworkGuide: () => getNetworkGuide,
|
|
79
|
+
getNetworkGuideDefinition: () => getNetworkGuideDefinition,
|
|
76
80
|
getNotificationsGuide: () => getNotificationsGuide,
|
|
77
81
|
getNotificationsGuideDefinition: () => getNotificationsGuideDefinition,
|
|
78
82
|
getOauthClientGuide: () => getOauthClientGuide,
|
|
@@ -667,6 +671,21 @@ var getLiveActivityGuideDefinition = {
|
|
|
667
671
|
required: ["topic"]
|
|
668
672
|
}
|
|
669
673
|
};
|
|
674
|
+
var getNetworkGuideDefinition = {
|
|
675
|
+
name: "get_network_guide",
|
|
676
|
+
description: "Get documentation for @idealyst/network cross-platform network connectivity and utilities package. Covers useNetwork hook, fetchWithTimeout, retry, waitForNetwork, and examples.",
|
|
677
|
+
inputSchema: {
|
|
678
|
+
type: "object",
|
|
679
|
+
properties: {
|
|
680
|
+
topic: {
|
|
681
|
+
type: "string",
|
|
682
|
+
description: "Topic to get docs for: 'overview', 'api', 'examples'",
|
|
683
|
+
enum: ["overview", "api", "examples"]
|
|
684
|
+
}
|
|
685
|
+
},
|
|
686
|
+
required: ["topic"]
|
|
687
|
+
}
|
|
688
|
+
};
|
|
670
689
|
var toolDefinitions = [
|
|
671
690
|
// Component tools
|
|
672
691
|
listComponentsDefinition,
|
|
@@ -702,6 +721,7 @@ var toolDefinitions = [
|
|
|
702
721
|
getPaymentsGuideDefinition,
|
|
703
722
|
getNotificationsGuideDefinition,
|
|
704
723
|
getLiveActivityGuideDefinition,
|
|
724
|
+
getNetworkGuideDefinition,
|
|
705
725
|
// Package tools
|
|
706
726
|
listPackagesDefinition,
|
|
707
727
|
getPackageDocsDefinition,
|
|
@@ -894,13 +914,17 @@ var componentMetadata = {
|
|
|
894
914
|
"Standard, alert, and confirmation types",
|
|
895
915
|
"Title and close button",
|
|
896
916
|
"Backdrop click to close",
|
|
897
|
-
"Animation types (slide, fade)"
|
|
917
|
+
"Animation types (slide, fade)",
|
|
918
|
+
"avoidKeyboard prop shifts dialog when keyboard opens (native)",
|
|
919
|
+
"height prop gives dialog a definite height so children can use flex: 1",
|
|
920
|
+
"Content area has flex: 1 \u2014 children can flex into available space"
|
|
898
921
|
],
|
|
899
922
|
bestPractices: [
|
|
900
923
|
"Use sparingly for important interactions",
|
|
901
924
|
"Provide clear actions for dismissal",
|
|
902
925
|
"Keep dialog content focused",
|
|
903
|
-
"Use confirmation dialogs for destructive actions"
|
|
926
|
+
"Use confirmation dialogs for destructive actions",
|
|
927
|
+
"Use height or maxContentHeight when children need flex-based sizing"
|
|
904
928
|
]
|
|
905
929
|
},
|
|
906
930
|
Divider: {
|
|
@@ -954,9 +978,10 @@ var componentMetadata = {
|
|
|
954
978
|
},
|
|
955
979
|
Image: {
|
|
956
980
|
category: "display",
|
|
957
|
-
description: "Cross-platform image component with loading and error states",
|
|
981
|
+
description: "Cross-platform image component for displaying photos, pictures, and remote/local images with loading and error states",
|
|
958
982
|
features: [
|
|
959
|
-
"
|
|
983
|
+
"Display photos, pictures, and media from URLs or local sources",
|
|
984
|
+
"Multiple resize modes (cover, contain, stretch, center)",
|
|
960
985
|
"Loading placeholder",
|
|
961
986
|
"Error fallback",
|
|
962
987
|
"Lazy loading",
|
|
@@ -1244,12 +1269,14 @@ var componentMetadata = {
|
|
|
1244
1269
|
"Multiple sizes",
|
|
1245
1270
|
"Character count",
|
|
1246
1271
|
"Auto-resize",
|
|
1247
|
-
"Error state"
|
|
1272
|
+
"Error state",
|
|
1273
|
+
"fill prop for flex-based sizing (fills available space)"
|
|
1248
1274
|
],
|
|
1249
1275
|
bestPractices: [
|
|
1250
1276
|
"Use for multi-line input",
|
|
1251
1277
|
"Show character limits when applicable",
|
|
1252
|
-
"Provide appropriate placeholder text"
|
|
1278
|
+
"Provide appropriate placeholder text",
|
|
1279
|
+
"Use fill prop inside Dialog with avoidKeyboard to shrink with keyboard"
|
|
1253
1280
|
]
|
|
1254
1281
|
},
|
|
1255
1282
|
TextInput: {
|
|
@@ -1326,7 +1353,11 @@ var componentAliases = {
|
|
|
1326
1353
|
fab: "IconButton",
|
|
1327
1354
|
modal: "Dialog",
|
|
1328
1355
|
tooltip: "Tooltip",
|
|
1329
|
-
snackbar: "Toast"
|
|
1356
|
+
snackbar: "Toast",
|
|
1357
|
+
photo: "Image",
|
|
1358
|
+
picture: "Image",
|
|
1359
|
+
img: "Image",
|
|
1360
|
+
thumbnail: "Image"
|
|
1330
1361
|
};
|
|
1331
1362
|
function findComponentName(componentName) {
|
|
1332
1363
|
if (componentMetadata[componentName]) {
|
|
@@ -3081,7 +3112,8 @@ yarn add @idealyst/audio
|
|
|
3081
3112
|
2. **Audio Session** \u2014 On iOS/Android, configure the audio session category before recording/playback
|
|
3082
3113
|
3. **Audio Profiles** \u2014 Pre-configured \`AudioConfig\` presets: \`speech\`, \`highQuality\`, \`studio\`, \`phone\`
|
|
3083
3114
|
4. **Session Presets** \u2014 Pre-configured \`AudioSessionConfig\` presets: \`playback\`, \`record\`, \`voiceChat\`, \`ambient\`, \`default\`, \`backgroundRecord\`
|
|
3084
|
-
5. **
|
|
3115
|
+
5. **Audio Level** \u2014 \`recorder.level\` returns \`AudioLevel { current: number, peak: number, rms: number, db: number }\`. All values are 0.0-1.0 except \`db\` (-Infinity to 0).
|
|
3116
|
+
6. **Background Recording** \u2014 \`useBackgroundRecorder\` hook for recording that continues when the app is backgrounded (iOS/Android). Requires app-level native entitlements.
|
|
3085
3117
|
|
|
3086
3118
|
## Exports
|
|
3087
3119
|
|
|
@@ -3179,6 +3211,22 @@ interface UsePlayerOptions {
|
|
|
3179
3211
|
| toggleMute | () => void | Toggle mute |
|
|
3180
3212
|
|
|
3181
3213
|
> **Critical:** \`feedPCMData()\` accepts \`ArrayBufferLike | Int16Array\` \u2014 **NOT strings or base64**.
|
|
3214
|
+
> If you receive base64-encoded audio from an external API and need to play it back, you MUST decode it to binary first.
|
|
3215
|
+
> **Cross-platform base64 decode** (do NOT use \`atob()\` \u2014 it's browser-only):
|
|
3216
|
+
> \`\`\`typescript
|
|
3217
|
+
> // Cross-platform: works on web AND React Native
|
|
3218
|
+
> function base64ToArrayBuffer(base64: string): ArrayBuffer {
|
|
3219
|
+
> const binaryString = typeof atob !== 'undefined'
|
|
3220
|
+
> ? atob(base64)
|
|
3221
|
+
> : Buffer.from(base64, 'base64').toString('binary');
|
|
3222
|
+
> const bytes = new Uint8Array(binaryString.length);
|
|
3223
|
+
> for (let i = 0; i < binaryString.length; i++) {
|
|
3224
|
+
> bytes[i] = binaryString.charCodeAt(i);
|
|
3225
|
+
> }
|
|
3226
|
+
> return bytes.buffer;
|
|
3227
|
+
> }
|
|
3228
|
+
> // Then: player.feedPCMData(base64ToArrayBuffer(encodedAudio));
|
|
3229
|
+
> \`\`\`
|
|
3182
3230
|
|
|
3183
3231
|
---
|
|
3184
3232
|
|
|
@@ -3628,7 +3676,7 @@ function BackgroundTranscriber() {
|
|
|
3628
3676
|
|
|
3629
3677
|
\`\`\`tsx
|
|
3630
3678
|
import React from 'react';
|
|
3631
|
-
import { View, Text } from '@idealyst/components';
|
|
3679
|
+
import { View, Text, Progress } from '@idealyst/components';
|
|
3632
3680
|
import { useRecorder, AUDIO_PROFILES } from '@idealyst/audio';
|
|
3633
3681
|
|
|
3634
3682
|
function AudioLevelMeter() {
|
|
@@ -3642,22 +3690,10 @@ function AudioLevelMeter() {
|
|
|
3642
3690
|
<Text>Level: {Math.round(recorder.level.current * 100)}%</Text>
|
|
3643
3691
|
<Text>Peak: {Math.round(recorder.level.peak * 100)}%</Text>
|
|
3644
3692
|
<Text>dB: {recorder.level.db.toFixed(1)}</Text>
|
|
3645
|
-
<
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
borderRadius: 10,
|
|
3650
|
-
overflow: 'hidden',
|
|
3651
|
-
}}
|
|
3652
|
-
>
|
|
3653
|
-
<View
|
|
3654
|
-
style={{
|
|
3655
|
-
width: \`\${recorder.level.current * 100}%\`,
|
|
3656
|
-
height: '100%',
|
|
3657
|
-
backgroundColor: recorder.level.current > 0.8 ? 'red' : 'green',
|
|
3658
|
-
}}
|
|
3659
|
-
/>
|
|
3660
|
-
</View>
|
|
3693
|
+
<Progress
|
|
3694
|
+
value={recorder.level.current * 100}
|
|
3695
|
+
intent={recorder.level.current > 0.8 ? 'danger' : 'success'}
|
|
3696
|
+
/>
|
|
3661
3697
|
</View>
|
|
3662
3698
|
);
|
|
3663
3699
|
}
|
|
@@ -3731,6 +3767,8 @@ function CameraScreen() {
|
|
|
3731
3767
|
|
|
3732
3768
|
Renders the camera preview. Must receive a camera instance from \`useCamera().cameraRef.current\`.
|
|
3733
3769
|
|
|
3770
|
+
> **IMPORTANT:** CameraPreview uses \`resizeMode\` ('cover' | 'contain'). But when displaying captured photos, use the **Image** component with \`objectFit\` \u2014 NOT \`resizeMode\`. Image does NOT have a \`resizeMode\` prop. Example: \`<Image source={photo.uri} objectFit="cover" />\`.
|
|
3771
|
+
|
|
3734
3772
|
\`\`\`typescript
|
|
3735
3773
|
interface CameraPreviewProps {
|
|
3736
3774
|
camera: ICamera | null; // Camera instance from useCamera().cameraRef.current
|
|
@@ -4112,7 +4150,9 @@ import {
|
|
|
4112
4150
|
\`\`\`
|
|
4113
4151
|
|
|
4114
4152
|
> **Common mistakes:**
|
|
4153
|
+
> - **\`pick()\` returns \`FilePickerResult\`, NOT an array.** Access files via \`result.files\`: \`result.files.length\`, \`result.files[0].uri\`. Do NOT write \`result.length\` or \`result[0]\` \u2014 \`FilePickerResult\` is an object: \`{ cancelled: boolean, files: PickedFile[], rejected: RejectedFile[] }\`.
|
|
4115
4154
|
> - The method is \`pick()\`, NOT \`pickFiles()\`
|
|
4155
|
+
> - \`pick()\` accepts overrides DIRECTLY: \`picker.pick({ allowedTypes: ['image'] })\` \u2014 NOT \`picker.pick({ config: { allowedTypes: ['image'] } })\`. The \`{ config: ... }\` wrapper is ONLY for \`useFilePicker()\` initialization.
|
|
4116
4156
|
> - \`FileType\` values are: \`'image' | 'video' | 'audio' | 'document' | 'archive' | 'any'\` \u2014 NOT \`'pdf'\` or \`'doc'\`
|
|
4117
4157
|
> - \`PickedFile\` has \`uri\`, \`name\`, \`size\`, \`type\`, \`extension\` \u2014 dimensions are in optional \`dimensions?: { width, height }\`, NOT top-level \`width\`/\`height\`
|
|
4118
4158
|
|
|
@@ -4167,7 +4207,7 @@ interface UseFilePickerOptions {
|
|
|
4167
4207
|
| permission | PermissionResult \\| null | Permission result |
|
|
4168
4208
|
| error | FilePickerError \\| null | Current error |
|
|
4169
4209
|
| files | PickedFile[] | Last picked files |
|
|
4170
|
-
| pick | (
|
|
4210
|
+
| pick | (overrides?: Partial\\<FilePickerConfig\\>) => Promise<FilePickerResult> | **Open file picker. Overrides go DIRECTLY \u2014 NOT wrapped in \`{ config }\`.** Example: \`picker.pick({ allowedTypes: ['image'] })\` \u2014 NOT \`picker.pick({ config: { allowedTypes: ['image'] } })\` |
|
|
4171
4211
|
| captureFromCamera | (options?) => Promise<FilePickerResult> | Open camera to capture |
|
|
4172
4212
|
| clear | () => void | Clear picked files |
|
|
4173
4213
|
| checkPermission | () => Promise<PermissionResult> | Check permission |
|
|
@@ -4304,6 +4344,27 @@ interface PickedFile {
|
|
|
4304
4344
|
|
|
4305
4345
|
> **Note:** \`dimensions\` is an optional nested object \u2014 NOT top-level \`width\`/\`height\` properties.
|
|
4306
4346
|
|
|
4347
|
+
### FilePickerResult (returned by pick())
|
|
4348
|
+
|
|
4349
|
+
\`\`\`typescript
|
|
4350
|
+
interface FilePickerResult {
|
|
4351
|
+
cancelled: boolean; // Whether user cancelled the picker
|
|
4352
|
+
files: PickedFile[]; // Picked files (empty if cancelled)
|
|
4353
|
+
rejected: RejectedFile[]; // Files rejected by validation
|
|
4354
|
+
error?: FilePickerError; // Error if picker failed
|
|
4355
|
+
}
|
|
4356
|
+
\`\`\`
|
|
4357
|
+
|
|
4358
|
+
> **CRITICAL:** \`pick()\` returns \`FilePickerResult\`, NOT an array. Always access \`result.files\` to get the array of picked files:
|
|
4359
|
+
> \`\`\`typescript
|
|
4360
|
+
> const result = await picker.pick();
|
|
4361
|
+
> if (!result.cancelled && result.files.length > 0) {
|
|
4362
|
+
> const file = result.files[0]; // \u2705 Correct
|
|
4363
|
+
> console.log(file.uri, file.name);
|
|
4364
|
+
> }
|
|
4365
|
+
> // \u274C WRONG: result.length, result[0] \u2014 FilePickerResult is NOT an array
|
|
4366
|
+
> \`\`\`
|
|
4367
|
+
|
|
4307
4368
|
### FilePickerConfig
|
|
4308
4369
|
|
|
4309
4370
|
\`\`\`typescript
|
|
@@ -4952,9 +5013,9 @@ Animate any style property changes. Returns an animated style object.
|
|
|
4952
5013
|
|
|
4953
5014
|
\`\`\`typescript
|
|
4954
5015
|
interface AnimationOptions {
|
|
4955
|
-
duration?: Duration; // ms or theme token key
|
|
4956
|
-
easing?: EasingKey; // Theme easing key
|
|
4957
|
-
delay?: number; // Delay before animation (
|
|
5016
|
+
duration?: Duration; // ms or theme token key (e.g., 300, 500)
|
|
5017
|
+
easing?: EasingKey; // Theme easing key (e.g., 'easeOut', 'spring')
|
|
5018
|
+
delay?: number; // Delay in ms before animation starts (e.g., 100, 200). Useful for staggered entrance animations.
|
|
4958
5019
|
}
|
|
4959
5020
|
|
|
4960
5021
|
interface UseAnimatedStyleOptions extends AnimationOptions {
|
|
@@ -4981,6 +5042,20 @@ const entranceStyle = useAnimatedStyle(
|
|
|
4981
5042
|
{ opacity: ready ? 1 : 0, transform: { y: ready ? 0 : 20 } },
|
|
4982
5043
|
{ duration: 400, easing: 'easeOut' }
|
|
4983
5044
|
);
|
|
5045
|
+
|
|
5046
|
+
// Staggered entrance: use delay for each item
|
|
5047
|
+
const style1 = useAnimatedStyle(
|
|
5048
|
+
{ opacity: ready ? 1 : 0, transform: { y: ready ? 0 : 20 } },
|
|
5049
|
+
{ duration: 300, easing: 'easeOut', delay: 0 }
|
|
5050
|
+
);
|
|
5051
|
+
const style2 = useAnimatedStyle(
|
|
5052
|
+
{ opacity: ready ? 1 : 0, transform: { y: ready ? 0 : 20 } },
|
|
5053
|
+
{ duration: 300, easing: 'easeOut', delay: 100 }
|
|
5054
|
+
);
|
|
5055
|
+
const style3 = useAnimatedStyle(
|
|
5056
|
+
{ opacity: ready ? 1 : 0, transform: { y: ready ? 0 : 20 } },
|
|
5057
|
+
{ duration: 300, easing: 'easeOut', delay: 200 }
|
|
5058
|
+
);
|
|
4984
5059
|
\`\`\`
|
|
4985
5060
|
|
|
4986
5061
|
---
|
|
@@ -5132,16 +5207,18 @@ For expand/collapse, animate \`opacity\` + \`maxHeight\` together. Do NOT includ
|
|
|
5132
5207
|
|
|
5133
5208
|
## Transform Syntax
|
|
5134
5209
|
|
|
5135
|
-
|
|
5210
|
+
**ALWAYS use object syntax** for transforms in useAnimatedStyle/usePresence:
|
|
5136
5211
|
|
|
5137
5212
|
\`\`\`typescript
|
|
5138
|
-
//
|
|
5213
|
+
// CORRECT: object syntax (required for animations)
|
|
5139
5214
|
transform: { x: 10, y: 20, scale: 1.2, rotate: 45 }
|
|
5140
5215
|
|
|
5141
|
-
//
|
|
5142
|
-
transform: [{ translateX: 10 }, { translateY: 20 }
|
|
5216
|
+
// WRONG in useAnimatedStyle: array syntax does NOT animate correctly
|
|
5217
|
+
// transform: [{ translateX: 10 }, { translateY: 20 }] // \u274C won't animate
|
|
5143
5218
|
\`\`\`
|
|
5144
5219
|
|
|
5220
|
+
> **IMPORTANT:** Array-syntax transforms (React Native style) do NOT work with \`useAnimatedStyle\` or \`usePresence\`. Always use the simplified object syntax: \`transform: { x, y, scale, rotate }\`. Array syntax is only valid in static \`style\` props on non-animated elements.
|
|
5221
|
+
|
|
5145
5222
|
| Property | Type | Maps to |
|
|
5146
5223
|
|----------|------|---------|
|
|
5147
5224
|
| x | number | translateX |
|
|
@@ -10079,6 +10156,396 @@ function MyScreen() {
|
|
|
10079
10156
|
`
|
|
10080
10157
|
};
|
|
10081
10158
|
|
|
10159
|
+
// src/data/network-guides.ts
|
|
10160
|
+
var networkGuides = {
|
|
10161
|
+
"idealyst://network/overview": `# @idealyst/network Overview
|
|
10162
|
+
|
|
10163
|
+
Cross-platform network connectivity and utilities for React and React Native. Know when the user has network, what kind, and react to changes in real time.
|
|
10164
|
+
|
|
10165
|
+
## Features
|
|
10166
|
+
|
|
10167
|
+
- **useNetwork Hook** \u2014 Real-time network state with isConnected, connection type, effective speed
|
|
10168
|
+
- **Network State Listener** \u2014 Subscribe to connectivity changes outside React
|
|
10169
|
+
- **Connection Details** \u2014 WiFi, cellular (2G/3G/4G/5G), ethernet, bluetooth, VPN detection
|
|
10170
|
+
- **Effective Connection Type** \u2014 slow-2g, 2g, 3g, 4g speed categories
|
|
10171
|
+
- **Internet Reachability** \u2014 Distinguish "connected to network" from "can reach internet"
|
|
10172
|
+
- **fetchWithTimeout** \u2014 Fetch wrapper with configurable timeout and auto-abort
|
|
10173
|
+
- **retry** \u2014 Exponential backoff retry with optional network-aware gating
|
|
10174
|
+
- **waitForNetwork** \u2014 Promise that resolves when the device comes back online
|
|
10175
|
+
- **Data Saver Detection** \u2014 Detect if user has enabled data-saving mode (web)
|
|
10176
|
+
- **Cross-Platform** \u2014 navigator.onLine + Network Information API (web), @react-native-community/netinfo (native)
|
|
10177
|
+
- **TypeScript** \u2014 Full type safety and IntelliSense
|
|
10178
|
+
|
|
10179
|
+
## Installation
|
|
10180
|
+
|
|
10181
|
+
\`\`\`bash
|
|
10182
|
+
yarn add @idealyst/network
|
|
10183
|
+
|
|
10184
|
+
# React Native also needs:
|
|
10185
|
+
yarn add @react-native-community/netinfo
|
|
10186
|
+
cd ios && pod install
|
|
10187
|
+
\`\`\`
|
|
10188
|
+
|
|
10189
|
+
## Quick Start
|
|
10190
|
+
|
|
10191
|
+
\`\`\`tsx
|
|
10192
|
+
import { useNetwork } from '@idealyst/network';
|
|
10193
|
+
|
|
10194
|
+
function App() {
|
|
10195
|
+
const { isConnected, type, effectiveType } = useNetwork();
|
|
10196
|
+
|
|
10197
|
+
if (!isConnected) {
|
|
10198
|
+
return <Text>You are offline</Text>;
|
|
10199
|
+
}
|
|
10200
|
+
|
|
10201
|
+
return (
|
|
10202
|
+
<Text>
|
|
10203
|
+
Connected via {type} ({effectiveType})
|
|
10204
|
+
</Text>
|
|
10205
|
+
);
|
|
10206
|
+
}
|
|
10207
|
+
\`\`\`
|
|
10208
|
+
|
|
10209
|
+
## Platform Details
|
|
10210
|
+
|
|
10211
|
+
- **Web**: Uses \`navigator.onLine\`, \`online\`/\`offline\` events, and the Network Information API (\`navigator.connection\`) for connection type, downlink speed, RTT, and data saver detection
|
|
10212
|
+
- **React Native**: Uses \`@react-native-community/netinfo\` for connection type, cellular generation, internet reachability, and real-time state changes
|
|
10213
|
+
- **SSR**: Safe for server-side rendering \u2014 returns sensible defaults when \`navigator\` is unavailable
|
|
10214
|
+
`,
|
|
10215
|
+
"idealyst://network/api": `# Network API Reference
|
|
10216
|
+
|
|
10217
|
+
Complete API reference for @idealyst/network.
|
|
10218
|
+
|
|
10219
|
+
## useNetwork
|
|
10220
|
+
|
|
10221
|
+
React hook for monitoring network connectivity. Returns reactive state that updates automatically.
|
|
10222
|
+
|
|
10223
|
+
\`\`\`tsx
|
|
10224
|
+
const {
|
|
10225
|
+
state, // NetworkState \u2014 full state object
|
|
10226
|
+
isConnected, // boolean \u2014 device has active network
|
|
10227
|
+
isInternetReachable,// boolean | null \u2014 can reach internet (null = unknown)
|
|
10228
|
+
type, // NetworkConnectionType \u2014 'wifi' | 'cellular' | 'ethernet' | ...
|
|
10229
|
+
effectiveType, // EffectiveConnectionType \u2014 'slow-2g' | '2g' | '3g' | '4g' | 'unknown'
|
|
10230
|
+
refresh, // () => Promise<NetworkState> \u2014 manually refresh state
|
|
10231
|
+
} = useNetwork(options?: UseNetworkOptions);
|
|
10232
|
+
\`\`\`
|
|
10233
|
+
|
|
10234
|
+
### UseNetworkOptions
|
|
10235
|
+
|
|
10236
|
+
| Option | Type | Default | Description |
|
|
10237
|
+
|--------|------|---------|-------------|
|
|
10238
|
+
| fetchOnMount | boolean | true | Fetch initial state on mount |
|
|
10239
|
+
| reachabilityUrl | string | (google 204) | URL for reachability pings (web only) |
|
|
10240
|
+
| reachabilityPollInterval | number | 0 | Polling interval in ms for reachability checks (web only). 0 = disabled |
|
|
10241
|
+
|
|
10242
|
+
---
|
|
10243
|
+
|
|
10244
|
+
## getNetworkState
|
|
10245
|
+
|
|
10246
|
+
Get a one-time snapshot of the current network state.
|
|
10247
|
+
|
|
10248
|
+
\`\`\`tsx
|
|
10249
|
+
// Web (synchronous)
|
|
10250
|
+
import { getNetworkState } from '@idealyst/network';
|
|
10251
|
+
const state: NetworkState = getNetworkState();
|
|
10252
|
+
|
|
10253
|
+
// Native (async \u2014 requires NetInfo fetch)
|
|
10254
|
+
import { getNetworkState } from '@idealyst/network';
|
|
10255
|
+
const state: NetworkState = await getNetworkState();
|
|
10256
|
+
\`\`\`
|
|
10257
|
+
|
|
10258
|
+
**Note:** On web, \`getNetworkState()\` is synchronous. On native, it returns a Promise.
|
|
10259
|
+
|
|
10260
|
+
---
|
|
10261
|
+
|
|
10262
|
+
## addNetworkStateListener
|
|
10263
|
+
|
|
10264
|
+
Subscribe to network state changes outside of React.
|
|
10265
|
+
|
|
10266
|
+
\`\`\`tsx
|
|
10267
|
+
import { addNetworkStateListener } from '@idealyst/network';
|
|
10268
|
+
|
|
10269
|
+
const unsubscribe = addNetworkStateListener((state) => {
|
|
10270
|
+
console.log('Network changed:', state.isConnected, state.type);
|
|
10271
|
+
});
|
|
10272
|
+
|
|
10273
|
+
// Later:
|
|
10274
|
+
unsubscribe();
|
|
10275
|
+
\`\`\`
|
|
10276
|
+
|
|
10277
|
+
---
|
|
10278
|
+
|
|
10279
|
+
## fetchWithTimeout
|
|
10280
|
+
|
|
10281
|
+
Fetch wrapper that automatically aborts if the request exceeds a timeout.
|
|
10282
|
+
|
|
10283
|
+
\`\`\`tsx
|
|
10284
|
+
import { fetchWithTimeout } from '@idealyst/network';
|
|
10285
|
+
|
|
10286
|
+
const response = await fetchWithTimeout('https://api.example.com/data', {
|
|
10287
|
+
timeout: 5000, // 5 seconds (default: 10000)
|
|
10288
|
+
method: 'GET',
|
|
10289
|
+
headers: { 'Authorization': 'Bearer token' },
|
|
10290
|
+
});
|
|
10291
|
+
\`\`\`
|
|
10292
|
+
|
|
10293
|
+
### FetchWithTimeoutOptions
|
|
10294
|
+
|
|
10295
|
+
Extends standard \`RequestInit\` with:
|
|
10296
|
+
|
|
10297
|
+
| Option | Type | Default | Description |
|
|
10298
|
+
|--------|------|---------|-------------|
|
|
10299
|
+
| timeout | number | 10000 | Timeout in milliseconds |
|
|
10300
|
+
|
|
10301
|
+
---
|
|
10302
|
+
|
|
10303
|
+
## retry
|
|
10304
|
+
|
|
10305
|
+
Retry a function with exponential backoff. Optionally waits for network before retrying.
|
|
10306
|
+
|
|
10307
|
+
\`\`\`tsx
|
|
10308
|
+
import { retry } from '@idealyst/network';
|
|
10309
|
+
|
|
10310
|
+
const data = await retry(
|
|
10311
|
+
() => fetch('https://api.example.com/data').then(r => r.json()),
|
|
10312
|
+
{
|
|
10313
|
+
maxRetries: 3,
|
|
10314
|
+
baseDelay: 1000,
|
|
10315
|
+
maxDelay: 30000,
|
|
10316
|
+
retryOnlyWhenConnected: true,
|
|
10317
|
+
},
|
|
10318
|
+
);
|
|
10319
|
+
\`\`\`
|
|
10320
|
+
|
|
10321
|
+
### RetryOptions
|
|
10322
|
+
|
|
10323
|
+
| Option | Type | Default | Description |
|
|
10324
|
+
|--------|------|---------|-------------|
|
|
10325
|
+
| maxRetries | number | 3 | Maximum retry attempts |
|
|
10326
|
+
| baseDelay | number | 1000 | Base delay in ms (doubles each attempt) |
|
|
10327
|
+
| maxDelay | number | 30000 | Maximum delay cap in ms |
|
|
10328
|
+
| retryOnlyWhenConnected | boolean | true | Wait for network before retrying |
|
|
10329
|
+
|
|
10330
|
+
---
|
|
10331
|
+
|
|
10332
|
+
## waitForNetwork
|
|
10333
|
+
|
|
10334
|
+
Returns a promise that resolves when the device comes back online.
|
|
10335
|
+
|
|
10336
|
+
\`\`\`tsx
|
|
10337
|
+
import { waitForNetwork } from '@idealyst/network';
|
|
10338
|
+
|
|
10339
|
+
// Wait up to 30 seconds for connectivity
|
|
10340
|
+
await waitForNetwork({ timeout: 30000 });
|
|
10341
|
+
console.log('Back online!');
|
|
10342
|
+
\`\`\`
|
|
10343
|
+
|
|
10344
|
+
If already online, resolves immediately. Rejects with an error if the timeout is exceeded.
|
|
10345
|
+
|
|
10346
|
+
### WaitForNetworkOptions
|
|
10347
|
+
|
|
10348
|
+
| Option | Type | Default | Description |
|
|
10349
|
+
|--------|------|---------|-------------|
|
|
10350
|
+
| timeout | number | 30000 | Max wait time in ms before rejecting |
|
|
10351
|
+
|
|
10352
|
+
---
|
|
10353
|
+
|
|
10354
|
+
## NetworkState
|
|
10355
|
+
|
|
10356
|
+
Full network state object returned by the hook and listeners.
|
|
10357
|
+
|
|
10358
|
+
\`\`\`tsx
|
|
10359
|
+
interface NetworkState {
|
|
10360
|
+
isConnected: boolean; // Device has active network
|
|
10361
|
+
isInternetReachable: boolean | null; // Internet reachable (null = unknown)
|
|
10362
|
+
type: NetworkConnectionType; // 'wifi' | 'cellular' | 'ethernet' | ...
|
|
10363
|
+
effectiveType: EffectiveConnectionType; // 'slow-2g' | '2g' | '3g' | '4g' | 'unknown'
|
|
10364
|
+
cellularGeneration: CellularGeneration; // '2g' | '3g' | '4g' | '5g' | null (native only)
|
|
10365
|
+
downlink: number | null; // Mbps (web only, from Network Info API)
|
|
10366
|
+
rtt: number | null; // Round-trip time ms (web only)
|
|
10367
|
+
isDataSaving: boolean | null; // Data saver enabled (web only)
|
|
10368
|
+
}
|
|
10369
|
+
\`\`\`
|
|
10370
|
+
|
|
10371
|
+
## Type Aliases
|
|
10372
|
+
|
|
10373
|
+
\`\`\`tsx
|
|
10374
|
+
type NetworkConnectionType = 'wifi' | 'cellular' | 'ethernet' | 'bluetooth' | 'vpn' | 'other' | 'none' | 'unknown';
|
|
10375
|
+
type EffectiveConnectionType = 'slow-2g' | '2g' | '3g' | '4g' | 'unknown';
|
|
10376
|
+
type CellularGeneration = '2g' | '3g' | '4g' | '5g' | null;
|
|
10377
|
+
\`\`\`
|
|
10378
|
+
`,
|
|
10379
|
+
"idealyst://network/examples": `# Network Examples
|
|
10380
|
+
|
|
10381
|
+
Complete code examples for common @idealyst/network patterns.
|
|
10382
|
+
|
|
10383
|
+
## Offline Banner
|
|
10384
|
+
|
|
10385
|
+
\`\`\`tsx
|
|
10386
|
+
import { useNetwork } from '@idealyst/network';
|
|
10387
|
+
import { View, Text } from '@idealyst/components';
|
|
10388
|
+
|
|
10389
|
+
function OfflineBanner() {
|
|
10390
|
+
const { isConnected } = useNetwork();
|
|
10391
|
+
|
|
10392
|
+
if (isConnected) return null;
|
|
10393
|
+
|
|
10394
|
+
return (
|
|
10395
|
+
<View style={{ backgroundColor: '#f44336', padding: 8 }}>
|
|
10396
|
+
<Text style={{ color: '#fff', textAlign: 'center' }}>
|
|
10397
|
+
No internet connection
|
|
10398
|
+
</Text>
|
|
10399
|
+
</View>
|
|
10400
|
+
);
|
|
10401
|
+
}
|
|
10402
|
+
\`\`\`
|
|
10403
|
+
|
|
10404
|
+
## Adaptive Quality Based on Connection
|
|
10405
|
+
|
|
10406
|
+
\`\`\`tsx
|
|
10407
|
+
import { useNetwork } from '@idealyst/network';
|
|
10408
|
+
|
|
10409
|
+
function MediaPlayer({ videoId }: { videoId: string }) {
|
|
10410
|
+
const { effectiveType, isDataSaving } = useNetwork().state;
|
|
10411
|
+
|
|
10412
|
+
const quality = (() => {
|
|
10413
|
+
if (isDataSaving) return 'low';
|
|
10414
|
+
switch (effectiveType) {
|
|
10415
|
+
case 'slow-2g':
|
|
10416
|
+
case '2g':
|
|
10417
|
+
return 'low';
|
|
10418
|
+
case '3g':
|
|
10419
|
+
return 'medium';
|
|
10420
|
+
case '4g':
|
|
10421
|
+
default:
|
|
10422
|
+
return 'high';
|
|
10423
|
+
}
|
|
10424
|
+
})();
|
|
10425
|
+
|
|
10426
|
+
return <VideoPlayer videoId={videoId} quality={quality} />;
|
|
10427
|
+
}
|
|
10428
|
+
\`\`\`
|
|
10429
|
+
|
|
10430
|
+
## Retry API Calls
|
|
10431
|
+
|
|
10432
|
+
\`\`\`tsx
|
|
10433
|
+
import { retry, fetchWithTimeout } from '@idealyst/network';
|
|
10434
|
+
|
|
10435
|
+
async function fetchUserProfile(userId: string) {
|
|
10436
|
+
const response = await retry(
|
|
10437
|
+
() => fetchWithTimeout(\`https://api.example.com/users/\${userId}\`, {
|
|
10438
|
+
timeout: 5000,
|
|
10439
|
+
}),
|
|
10440
|
+
{ maxRetries: 3, baseDelay: 1000 },
|
|
10441
|
+
);
|
|
10442
|
+
|
|
10443
|
+
if (!response.ok) {
|
|
10444
|
+
throw new Error(\`Failed to fetch user: \${response.status}\`);
|
|
10445
|
+
}
|
|
10446
|
+
|
|
10447
|
+
return response.json();
|
|
10448
|
+
}
|
|
10449
|
+
\`\`\`
|
|
10450
|
+
|
|
10451
|
+
## Wait for Network Before Action
|
|
10452
|
+
|
|
10453
|
+
\`\`\`tsx
|
|
10454
|
+
import { waitForNetwork } from '@idealyst/network';
|
|
10455
|
+
|
|
10456
|
+
async function syncData() {
|
|
10457
|
+
// If offline, wait up to 60 seconds for connectivity
|
|
10458
|
+
await waitForNetwork({ timeout: 60000 });
|
|
10459
|
+
|
|
10460
|
+
// Now we're online \u2014 sync
|
|
10461
|
+
const response = await fetch('https://api.example.com/sync', {
|
|
10462
|
+
method: 'POST',
|
|
10463
|
+
body: JSON.stringify(pendingChanges),
|
|
10464
|
+
});
|
|
10465
|
+
|
|
10466
|
+
return response.json();
|
|
10467
|
+
}
|
|
10468
|
+
\`\`\`
|
|
10469
|
+
|
|
10470
|
+
## Network State Listener (Outside React)
|
|
10471
|
+
|
|
10472
|
+
\`\`\`tsx
|
|
10473
|
+
import { addNetworkStateListener } from '@idealyst/network';
|
|
10474
|
+
|
|
10475
|
+
// Subscribe to changes (e.g., in a service or module)
|
|
10476
|
+
const unsubscribe = addNetworkStateListener((state) => {
|
|
10477
|
+
if (!state.isConnected) {
|
|
10478
|
+
queueManager.pause();
|
|
10479
|
+
} else {
|
|
10480
|
+
queueManager.resume();
|
|
10481
|
+
}
|
|
10482
|
+
});
|
|
10483
|
+
|
|
10484
|
+
// Cleanup when done
|
|
10485
|
+
unsubscribe();
|
|
10486
|
+
\`\`\`
|
|
10487
|
+
|
|
10488
|
+
## Connection Type Display
|
|
10489
|
+
|
|
10490
|
+
\`\`\`tsx
|
|
10491
|
+
import { useNetwork } from '@idealyst/network';
|
|
10492
|
+
import { View, Text } from '@idealyst/components';
|
|
10493
|
+
|
|
10494
|
+
function NetworkInfo() {
|
|
10495
|
+
const { state } = useNetwork();
|
|
10496
|
+
|
|
10497
|
+
return (
|
|
10498
|
+
<View>
|
|
10499
|
+
<Text>Status: {state.isConnected ? 'Online' : 'Offline'}</Text>
|
|
10500
|
+
<Text>Type: {state.type}</Text>
|
|
10501
|
+
<Text>Speed: {state.effectiveType}</Text>
|
|
10502
|
+
{state.cellularGeneration && (
|
|
10503
|
+
<Text>Cellular: {state.cellularGeneration}</Text>
|
|
10504
|
+
)}
|
|
10505
|
+
{state.downlink != null && (
|
|
10506
|
+
<Text>Downlink: {state.downlink} Mbps</Text>
|
|
10507
|
+
)}
|
|
10508
|
+
{state.rtt != null && (
|
|
10509
|
+
<Text>RTT: {state.rtt} ms</Text>
|
|
10510
|
+
)}
|
|
10511
|
+
{state.isDataSaving != null && (
|
|
10512
|
+
<Text>Data Saver: {state.isDataSaving ? 'On' : 'Off'}</Text>
|
|
10513
|
+
)}
|
|
10514
|
+
</View>
|
|
10515
|
+
);
|
|
10516
|
+
}
|
|
10517
|
+
\`\`\`
|
|
10518
|
+
|
|
10519
|
+
## Fetch with Timeout
|
|
10520
|
+
|
|
10521
|
+
\`\`\`tsx
|
|
10522
|
+
import { fetchWithTimeout } from '@idealyst/network';
|
|
10523
|
+
|
|
10524
|
+
async function quickHealthCheck() {
|
|
10525
|
+
try {
|
|
10526
|
+
const response = await fetchWithTimeout('https://api.example.com/health', {
|
|
10527
|
+
timeout: 3000,
|
|
10528
|
+
method: 'HEAD',
|
|
10529
|
+
});
|
|
10530
|
+
return response.ok;
|
|
10531
|
+
} catch {
|
|
10532
|
+
return false;
|
|
10533
|
+
}
|
|
10534
|
+
}
|
|
10535
|
+
\`\`\`
|
|
10536
|
+
|
|
10537
|
+
## Best Practices
|
|
10538
|
+
|
|
10539
|
+
1. **Use \`useNetwork\` for UI** \u2014 The hook handles subscriptions and cleanup automatically
|
|
10540
|
+
2. **Use \`addNetworkStateListener\` for services** \u2014 For non-React code (queue managers, sync services)
|
|
10541
|
+
3. **Combine retry + fetchWithTimeout** \u2014 For resilient API calls
|
|
10542
|
+
4. **Check \`isInternetReachable\`** \u2014 Being "connected" to WiFi doesn't mean you have internet
|
|
10543
|
+
5. **Respect data saver** \u2014 Reduce payload sizes and avoid autoplay when \`isDataSaving\` is true
|
|
10544
|
+
6. **Don't poll too aggressively** \u2014 If using \`reachabilityPollInterval\`, keep it >= 15000ms
|
|
10545
|
+
7. **Use \`waitForNetwork\` for offline-first** \u2014 Queue operations and wait for connectivity to sync
|
|
10546
|
+
`
|
|
10547
|
+
};
|
|
10548
|
+
|
|
10082
10549
|
// src/data/packages.ts
|
|
10083
10550
|
var packages = {
|
|
10084
10551
|
components: {
|
|
@@ -11261,6 +11728,52 @@ await end(info.id, { dismissalPolicy: 'default' });`,
|
|
|
11261
11728
|
"deliveryActivity() / timerActivity() / mediaActivity() / progressActivity() - Template presets"
|
|
11262
11729
|
],
|
|
11263
11730
|
relatedPackages: ["notifications"]
|
|
11731
|
+
},
|
|
11732
|
+
network: {
|
|
11733
|
+
name: "Network",
|
|
11734
|
+
npmName: "@idealyst/network",
|
|
11735
|
+
description: "Cross-platform network connectivity and utilities for React and React Native. Real-time connection monitoring, fetch with timeout, retry with exponential backoff, and wait-for-network primitives.",
|
|
11736
|
+
category: "utility",
|
|
11737
|
+
platforms: ["web", "native"],
|
|
11738
|
+
documentationStatus: "full",
|
|
11739
|
+
installation: "yarn add @idealyst/network",
|
|
11740
|
+
peerDependencies: [
|
|
11741
|
+
"@react-native-community/netinfo (native)"
|
|
11742
|
+
],
|
|
11743
|
+
features: [
|
|
11744
|
+
"useNetwork hook \u2014 real-time isConnected, connection type, effective speed",
|
|
11745
|
+
"Network state listener for non-React code",
|
|
11746
|
+
"Connection type detection \u2014 WiFi, cellular, ethernet, bluetooth, VPN",
|
|
11747
|
+
"Effective connection speed \u2014 slow-2g, 2g, 3g, 4g",
|
|
11748
|
+
"Cellular generation \u2014 2G, 3G, 4G, 5G (native)",
|
|
11749
|
+
"Internet reachability \u2014 distinguish connected from reachable",
|
|
11750
|
+
"fetchWithTimeout \u2014 fetch with configurable auto-abort",
|
|
11751
|
+
"retry \u2014 exponential backoff with network-aware gating",
|
|
11752
|
+
"waitForNetwork \u2014 promise that resolves when back online",
|
|
11753
|
+
"Data saver detection (web)",
|
|
11754
|
+
"Downlink speed and RTT estimation (web)"
|
|
11755
|
+
],
|
|
11756
|
+
quickStart: `import { useNetwork } from '@idealyst/network';
|
|
11757
|
+
|
|
11758
|
+
function App() {
|
|
11759
|
+
const { isConnected, type, effectiveType } = useNetwork();
|
|
11760
|
+
|
|
11761
|
+
if (!isConnected) {
|
|
11762
|
+
return <Text>You are offline</Text>;
|
|
11763
|
+
}
|
|
11764
|
+
|
|
11765
|
+
return <Text>Connected via {type} ({effectiveType})</Text>;
|
|
11766
|
+
}`,
|
|
11767
|
+
apiHighlights: [
|
|
11768
|
+
"useNetwork(options?) - React hook for real-time network state",
|
|
11769
|
+
"getNetworkState() - One-time state snapshot (sync on web, async on native)",
|
|
11770
|
+
"addNetworkStateListener(cb) - Subscribe to changes (returns unsubscribe)",
|
|
11771
|
+
"fetchWithTimeout(url, options) - Fetch with auto-abort timeout",
|
|
11772
|
+
"retry(fn, options) - Exponential backoff retry",
|
|
11773
|
+
"waitForNetwork(options) - Promise that resolves when online",
|
|
11774
|
+
"NetworkState { isConnected, isInternetReachable, type, effectiveType, cellularGeneration, downlink, rtt, isDataSaving }"
|
|
11775
|
+
],
|
|
11776
|
+
relatedPackages: ["storage", "config"]
|
|
11264
11777
|
}
|
|
11265
11778
|
};
|
|
11266
11779
|
function getPackagesByCategory() {
|
|
@@ -15673,14 +16186,19 @@ This server has tools for every aspect of the framework. **Look up APIs as you n
|
|
|
15673
16186
|
|
|
15674
16187
|
### Workflow
|
|
15675
16188
|
|
|
15676
|
-
Write code iteratively
|
|
16189
|
+
Write code iteratively \u2014 **look up one API, write one file, repeat**:
|
|
16190
|
+
|
|
16191
|
+
1. Call \`get_intro\` (this response)
|
|
16192
|
+
2. Look up the API for your FIRST file only (e.g., \`get_component_types("Button,Card,Text")\`)
|
|
16193
|
+
3. **Write that file immediately** using the Write tool
|
|
16194
|
+
4. Then look up the next API you need, write the next file, and so on
|
|
15677
16195
|
|
|
15678
16196
|
- **Before using a component** \u2014 call \`get_component_types\` for its props (supports batching: \`get_component_types("Button,Card,Text")\`)
|
|
15679
16197
|
- **Before using a package** \u2014 call its dedicated \`get_*_guide\` tool with topic \`api\`
|
|
15680
16198
|
- **Search icons once** \u2014 batch all terms into one call: \`search_icons("home settings check timer")\`
|
|
15681
16199
|
- **Check recipes** \u2014 \`search_recipes\` for ready-made patterns you can adapt
|
|
15682
16200
|
|
|
15683
|
-
Do NOT
|
|
16201
|
+
> **WARNING: Do NOT load multiple package guides, component types, AND icon searches all before writing your first file.** Each tool response is large. If you accumulate 4+ tool responses without writing any code, you WILL exhaust your output token budget and produce zero files. The correct pattern is: **research \u2192 write \u2192 research \u2192 write**, NOT **research \u2192 research \u2192 research \u2192 write**.
|
|
15684
16202
|
|
|
15685
16203
|
### Component Tools
|
|
15686
16204
|
- \`list_components\` / \`search_components\` \u2014 Discover available components
|
|
@@ -15755,6 +16273,10 @@ const tabs: { icon: IconName }[] = [{ icon: 'home' }, { icon: 'search' }]; // NO
|
|
|
15755
16273
|
|
|
15756
16274
|
> **CRITICAL:** Icon names do NOT have an \`mdi:\` prefix. Use bare names like \`'delete'\`, \`'home'\`, \`'check-circle'\` \u2014 NOT \`'mdi:delete'\`, \`'mdi:home'\`, etc.
|
|
15757
16275
|
> **CRITICAL:** When defining arrays or objects with icon fields, type them as \`IconName\` \u2014 never \`string\`. Using \`string\` will cause TS2322 when passed to component props.
|
|
16276
|
+
> **CRITICAL:** Helper functions that return icon names MUST have return type \`IconName\`, not \`string\`. Example: \`function getIcon(type: string): IconName { return type === 'pdf' ? 'file-pdf-box' : 'file-document-outline'; }\` \u2014 NOT \`function getIcon(type: string): string\`.
|
|
16277
|
+
> **CRITICAL:** ONLY use icon names returned by \`search_icons\`. Do NOT guess or invent icon names \u2014 unverified names render as blank with runtime warnings. If you need an icon, search for it first.
|
|
16278
|
+
|
|
16279
|
+
**Common verified icon names** (use these without searching): \`home\`, \`cog\`, \`account\`, \`magnify\`, \`plus\`, \`close\`, \`check\`, \`chevron-left\`, \`chevron-right\`, \`chevron-down\`, \`chevron-up\`, \`arrow-left\`, \`arrow-right\`, \`menu\`, \`dots-vertical\`, \`pencil\`, \`delete\`, \`heart\`, \`star\`, \`bell\`, \`email\`, \`phone\`, \`camera\`, \`camera-flip\`, \`flash\`, \`flash-off\`, \`image\`, \`send\`, \`share\`, \`download\`, \`upload\`, \`eye\`, \`eye-off\`, \`lock\`, \`logout\`, \`refresh\`, \`calendar\`, \`clock\`, \`map-marker\`, \`chart-line\`, \`view-dashboard\`, \`account-group\`, \`message\`, \`information\`, \`alert\`, \`check-circle\`, \`close-circle\`, \`play\`, \`pause\`, \`stop\`, \`microphone\`, \`microphone-off\`, \`file-document-outline\`. For any icon NOT on this list, use \`search_icons\` to verify.
|
|
15758
16280
|
|
|
15759
16281
|
---
|
|
15760
16282
|
|
|
@@ -15764,26 +16286,27 @@ These are mistakes agents make repeatedly. Each one causes TypeScript compilatio
|
|
|
15764
16286
|
|
|
15765
16287
|
### Component Props
|
|
15766
16288
|
1. **Text** does NOT have \`variant\`, \`intent\`, \`size\`, \`fontSize\`, \`numberOfLines\`, \`ellipsizeMode\`, \`selectable\`, \`textColor\`, or \`onPress\`. Use \`typography\` (\`h1\`\u2013\`h6\`, \`subtitle1\`, \`subtitle2\`, \`body1\`, \`body2\`, \`caption\`), \`weight\` (\`light\`, \`normal\`, \`medium\`, \`semibold\`, \`bold\`), and \`color\` (\`primary\`, \`secondary\`, \`tertiary\`, \`inverse\`). **\`textColor\` is an Icon-only prop** \u2014 Text uses \`color\`. For pressable text, wrap in \`Pressable\` or use \`Button type="text"\`.
|
|
15767
|
-
2. **TextInput** does NOT have \`label\`, \`error\`, \`editable\`, \`autoComplete\`, \`keyboardType\`, or \`onChange\`. Compose labels/errors with \`Text\` + \`View\`. Use \`onChangeText\`, \`inputMode\` (\`'text' | 'email' | 'password' | 'number'\` \u2014 NOT \`'decimal'\`, \`'numeric'\`, \`'tel'\`, \`'url'\`), and \`textContentType\`. TextArea
|
|
16289
|
+
2. **TextInput** does NOT have \`label\`, \`error\`, \`editable\`, \`autoComplete\`, \`keyboardType\`, or \`onChange\`. Compose labels/errors with \`Text\` + \`View\`. Use \`onChangeText\`, \`inputMode\` (\`'text' | 'email' | 'password' | 'number'\` \u2014 NOT \`'decimal'\`, \`'numeric'\`, \`'tel'\`, \`'url'\`), and \`textContentType\`. **TextArea has a DIFFERENT API** \u2014 it DOES support \`label\`, \`error\`, \`rows\`, \`onChange\`, but does NOT have \`onBlur\` or \`onChangeText\`. Always look up TextArea types separately.
|
|
15768
16290
|
3. **Button/IconButton** \`type\` is \`'contained' | 'outlined' | 'text'\` \u2014 NOT \`'ghost'\`, \`'solid'\`, \`'default'\`. Button has \`leftIcon\` and \`rightIcon\` \u2014 NOT \`icon\`.
|
|
15769
16291
|
4. **View** does NOT have \`direction\`, \`align\`, or \`onPress\` props. For touch handling, wrap content in \`Pressable\` from \`@idealyst/components\` (NOT from \`react-native\`): \`<Pressable onPress={handlePress}><View>...</View></Pressable>\`. For horizontal layout use \`style={{ flexDirection: 'row' }}\`. View spacing shorthand props (all accept Size: \`xs\`|\`sm\`|\`md\`|\`lg\`|\`xl\`): \`padding\`, \`paddingVertical\`, \`paddingHorizontal\`, \`margin\`, \`marginVertical\`, \`marginHorizontal\`, \`gap\`/\`spacing\`. Do NOT use \`paddingTop\`, \`paddingBottom\`, \`paddingLeft\`, \`paddingRight\`, \`marginTop\`, \`marginBottom\`, \`marginLeft\`, \`marginRight\` as shorthand props \u2014 they do NOT exist and will cause TS2353. For single-side spacing, use \`style={{ paddingTop: 16 }}\`. Other View props: \`background\`, \`radius\`, \`border\`, \`scrollable\`. \`border\` is \`'none' | 'thin' | 'thick'\` \u2014 NOT \`'outline'\`, \`'solid'\`.
|
|
15770
|
-
5. **Badge** \`type\` is \`'filled' | 'outlined' | 'dot'\` \u2014 NOT \`'soft'\`, \`'subtle'\`, \`'solid'\`.
|
|
16292
|
+
5. **Badge** \`type\` is \`'filled' | 'outlined' | 'dot'\` \u2014 NOT \`'soft'\`, \`'subtle'\`, \`'solid'\`. **Intent type narrowing (CRITICAL):** TS widens string literals in objects/arrays to \`string\`, which fails \`intent\` props. Rules: (a) Simple ternaries in JSX work fine: \`<Badge intent={cond ? 'success' : 'danger'}>\`. (b) **Do NOT use \`as const\` on ternary expressions** \u2014 \`(cond ? 'a' : 'b') as const\` causes TS1355. (c) **Arrays/objects with intent values MUST use \`as const\`**: \`const items = [{ intent: 'success' as const, label: 'OK' }]\` or \`const items = [{ intent: 'success', label: 'OK' }] as const\`. Without \`as const\`, \`item.intent\` becomes \`string\` which fails. (d) For computed values, use typed variable: \`const intent: Intent = ...;\` (import Intent from @idealyst/theme). This applies to ALL components with intent/type props.
|
|
15771
16293
|
6. **Avatar** uses \`src\` for image URL, \`fallback\` for initials \u2014 NOT \`name\`, \`initials\`, \`label\`. Shape: \`'circle' | 'square'\`.
|
|
15772
16294
|
7. **Link** requires a \`to\` prop (path string) \u2014 it's a navigation link, NOT pressable text.
|
|
15773
16295
|
8. **List** takes \`children\` \u2014 NOT \`data\`, \`renderItem\`, or \`keyExtractor\`. Map your data: \`<List>{items.map(item => <View key={item.id}>...</View>)}</List>\`
|
|
15774
16296
|
9. **Skeleton** uses \`shape\` prop (\`'rectangle' | 'circle' | 'rounded'\`) \u2014 NOT \`variant\`. Props: \`width\`, \`height\`, \`shape\`, \`animation\` (\`'pulse' | 'wave' | 'none'\`). Do NOT build custom skeletons with react-native \`Animated\`.
|
|
15775
16297
|
10. The component is **TextInput**, NOT \`Input\`.
|
|
15776
|
-
11. **Card** is a simple container \u2014 there are NO compound components like \`Card.Content\`, \`Card.Header\`, \`Card.Body\`, \`Card.Footer\`, \`Card.Title\`. Just put children directly inside \`<Card>...</Card>\`.
|
|
16298
|
+
11. **Card** is a simple container \u2014 there are NO compound components like \`Card.Content\`, \`Card.Header\`, \`Card.Body\`, \`Card.Footer\`, \`Card.Title\`. Just put children directly inside \`<Card>...</Card>\`. **Card does NOT have \`border\`, \`scrollable\`, or \`backgroundColor\` props** (those are View-only). Card styling props: \`type\` (\`'default'|'outlined'|'elevated'|'filled'\`), \`radius\`, \`intent\`, \`background\`, plus spacing (\`padding\`, \`margin\`, \`gap\`). For borders use \`type="outlined"\`.
|
|
16299
|
+
12. **Switch** uses \`checked\` and \`onChange\` \u2014 NOT \`value\` and \`onValueChange\` (React Native convention). Also has \`label\`, \`labelPosition\`, \`disabled\`.
|
|
15777
16300
|
|
|
15778
16301
|
### Navigation
|
|
15779
|
-
11.
|
|
16302
|
+
11. **NavigatorProvider** takes a \`route\` prop (SINGULAR) \u2014 NOT \`routes\`: \`<NavigatorProvider route={routeConfig} />\`. There is NO \`Router\` export.
|
|
15780
16303
|
12. Use \`useNavigator()\` \u2014 NOT \`useNavigate()\`.
|
|
15781
16304
|
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).
|
|
15782
|
-
14. \`
|
|
15783
|
-
15. \`useParams()\` does NOT accept generic type arguments. It returns \`Record<string, string>\`. Do NOT write \`useParams<{ id: string }>()\` \u2014 that causes TS2558.
|
|
16305
|
+
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.
|
|
16306
|
+
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;\`.
|
|
15784
16307
|
|
|
15785
16308
|
### Imports & Styling
|
|
15786
|
-
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\`).
|
|
16309
|
+
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.
|
|
15787
16310
|
17. **Never** import from \`react-native-unistyles\` \u2014 use \`@idealyst/theme\` (\`configureThemes\`, \`ThemeSettings\`, \`useTheme\`).
|
|
15788
16311
|
18. **useTheme()** returns the Theme object **directly** (NOT wrapped): \`const theme = useTheme();\`. Do NOT destructure: \`const { theme } = useTheme()\` \u2014 causes TS2339.
|
|
15789
16312
|
19. **Spacing & Layout**: Use component shorthand props for spacing \u2014 NOT \`theme.spacing\` (which does NOT exist). The correct patterns:
|
|
@@ -15798,13 +16321,28 @@ These are mistakes agents make repeatedly. Each one causes TypeScript compilatio
|
|
|
15798
16321
|
- **WRONG**: \`theme.colors.intent.danger\` \u2014 does NOT exist; intents are at \`theme.intents.danger\`
|
|
15799
16322
|
- **WRONG**: \`theme.intents.primary.bg\` \u2014 IntentValue does NOT have \`bg\` or \`text\`. IntentValue has: \`primary\` (main color string), \`contrast\` (text-on-bg color), \`light\`, \`dark\`
|
|
15800
16323
|
- **CORRECT**: \`theme.intents.primary.primary\` for the color, \`theme.intents.primary.contrast\` for text on that color
|
|
16324
|
+
- **Color key reference** (all keys available):
|
|
16325
|
+
- \`theme.colors.surface\`: \`screen\`, \`primary\`, \`secondary\`, \`tertiary\`, \`inverse\`, \`inverse-secondary\`, \`inverse-tertiary\`
|
|
16326
|
+
- \`theme.colors.text\`: \`primary\`, \`secondary\`, \`tertiary\`, \`inverse\`, \`inverse-secondary\`, \`inverse-tertiary\`
|
|
16327
|
+
- \`theme.colors.border\`: \`primary\`, \`secondary\`, \`tertiary\`, \`disabled\`
|
|
16328
|
+
- \`theme.intents\`: \`primary\`, \`secondary\`, \`success\`, \`warning\`, \`danger\`, \`info\`, \`neutral\` (each has \`.primary\`, \`.contrast\`, \`.light\`, \`.dark\`)
|
|
15801
16329
|
|
|
15802
16330
|
### Cross-Platform (CRITICAL)
|
|
15803
16331
|
20. **Never use raw HTML/SVG elements** (\`<svg>\`, \`<circle>\`, \`<canvas>\`, \`<div>\`, \`<span>\`, \`<input>\`) \u2014 they are web-only and will crash on React Native, just like react-native primitives crash on web. Also never use CSS \`transition\` or \`animation\` properties in styles \u2014 they don't exist on native. If you need custom drawing or circular progress, use \`@idealyst/animate\` hooks or \`@idealyst/charts\` \u2014 never raw SVG.
|
|
15804
|
-
21. **Avoid web-only CSS** like \`cursor: 'pointer'\` in shared styles \u2014 not valid on native. Use \`Pressable\` or \`Button\` for interactive elements (they handle cursor automatically on web).
|
|
16332
|
+
21. **Avoid web-only CSS** like \`cursor: 'pointer'\` in shared styles \u2014 not valid on native. Use \`Pressable\` or \`Button\` for interactive elements (they handle cursor automatically on web). Percentage widths (\`width: '50%'\`) do NOT work reliably on React Native \u2014 use \`flex\` instead.
|
|
16333
|
+
23. **Use theme colors, never hardcoded hex** \u2014 import \`useTheme\` from \`@idealyst/theme\` and use \`theme.colors.surface.secondary\` (not \`'#f5f5f5'\`), \`theme.colors.border.primary\` (not \`'#e0e0e0'\`), \`theme.intents.primary.primary\` (not \`'#1976d2'\`). Hardcoded colors break dark mode and branding customization. **Exception:** Semi-transparent overlays for camera/media UIs may use \`rgba(0,0,0,0.5)\` since the theme has no overlay color. For other overlays, prefer \`theme.colors.surface.inverse\` with opacity.
|
|
16334
|
+
22. **Platform file barrel exports**: When creating \`Component.web.tsx\` + \`Component.native.tsx\`, you need THREE index files:
|
|
16335
|
+
- \`index.web.ts\` \u2014 \`export { default as Component } from './Component.web';\`
|
|
16336
|
+
- \`index.native.ts\` \u2014 \`export { default as Component } from './Component.native';\`
|
|
16337
|
+
- \`index.ts\` \u2014 \`export { default as Component } from './Component.web';\` (base file for TypeScript resolution)
|
|
16338
|
+
- **WRONG**: \`export { default } from './Component';\` \u2014 no bare \`Component.ts\` exists, only \`.web.tsx\`/\`.native.tsx\`. This causes TS2307.
|
|
16339
|
+
- **Web-only styles in .web.tsx files**: Cast CSS-only properties with \`as any\`, NOT \`as React.CSSProperties\`. Example: \`style={{ position: 'fixed', transition: 'width 0.2s' } as any}\`. \`React.CSSProperties\` is incompatible with \`StyleProp<ViewStyle>\` \u2014 this causes TS2322.
|
|
15805
16340
|
|
|
15806
16341
|
### React 19 TypeScript
|
|
15807
16342
|
- **useRef** requires an initial argument: \`useRef<T>(null)\` \u2014 NOT \`useRef<T>()\`. Omitting the argument causes TS2554. For non-null refs use: \`useRef<number>(0)\`, \`useRef<string[]>([])\`.
|
|
16343
|
+
- **onLayout** callback: The event shape is \`e.nativeEvent.layout.{x, y, width, height}\` \u2014 NOT \`e.layout.width\`. Always destructure: \`onLayout={(e) => { const { width, height } = e.nativeEvent.layout; }}\`. Writing \`e.layout\` causes TS2339.
|
|
16344
|
+
- **Badge children** accepts \`ReactNode\` including numbers \u2014 \`<Badge>{count}</Badge>\` is valid. But if you pass a number to a **string** prop, wrap it: \`<Badge>{String(count)}</Badge>\` or use template literal.
|
|
16345
|
+
- **String literals with apostrophes**: Use backticks or double quotes for strings containing apostrophes \u2014 \`\`I'll be back\`\` or \`"I'll be back"\` \u2014 NOT \`'I'll be back'\` (unescaped \`'\` breaks the string and causes cascading TS errors).
|
|
15808
16346
|
|
|
15809
16347
|
### Scaffolded Project Layout
|
|
15810
16348
|
When working in a CLI-scaffolded workspace (created with \`idealyst init\` + \`idealyst create\`), files go in specific locations:
|
|
@@ -15821,11 +16359,11 @@ When working in a CLI-scaffolded workspace (created with \`idealyst init\` + \`i
|
|
|
15821
16359
|
> **TIP:** Before writing backend code, call \`search_recipes({ query: "trpc" })\` to get the \`trpc-feature\` recipe \u2014 it has the complete step-by-step pattern with correct file paths.
|
|
15822
16360
|
|
|
15823
16361
|
### Package-Specific (call guide tools for full API)
|
|
15824
|
-
18. **Audio** (\`@idealyst/audio\`) is **PCM streaming**, NOT file-based. \`recorder.stop()\` returns \`void\`. Data is \`ArrayBufferLike\`, NOT strings. Call \`get_audio_guide\` topic \`api\`.
|
|
16362
|
+
18. **Audio** (\`@idealyst/audio\`) is **PCM streaming**, NOT file-based. \`recorder.stop()\` returns \`void\`. Data is \`ArrayBufferLike\`, NOT strings. Do NOT use \`atob()\` for base64 decoding \u2014 it's browser-only. See the guide for cross-platform patterns. Call \`get_audio_guide\` topic \`api\`.
|
|
15825
16363
|
19. **Camera** (\`@idealyst/camera\`): Component is \`CameraPreview\`, NOT \`Camera\`. Permission is \`requestPermission()\`, NOT \`requestCameraPermission\`. \`CameraStatus\` is an interface (\`.state\`, \`.permission\`), NOT a string. Call \`get_camera_guide\` topic \`api\`.
|
|
15826
|
-
20. **Files** (\`@idealyst/files\`):
|
|
16364
|
+
20. **Files** (\`@idealyst/files\`): \`pick()\` returns \`FilePickerResult\` (an **object**, NOT an array). Access files via \`result.files\`: \`result.files.length\`, \`result.files[0].uri\`. Do NOT write \`result.length\` or \`result[0]\`. \`useFilePicker()\` takes \`{ config: { allowedTypes: ['image'], multiple: true } }\` \u2014 NOT \`{ type: 'image' }\`. \`FileType\` is \`'image' | 'video' | 'audio' | 'document' | 'archive' | 'any'\` \u2014 NOT \`'pdf'\` or \`'doc'\`. Call \`get_files_guide\` topic \`api\`.
|
|
15827
16365
|
21. **Storage** (\`@idealyst/storage\`): Methods are \`getItem()\`/\`setItem()\`, NOT \`get()\`/\`set()\`. Values are string-only. Call \`get_storage_guide\` topic \`api\`.
|
|
15828
|
-
22. **Animate** (\`@idealyst/animate\`): There is NO \`useSequence\` or \`useKeyframes\` \u2014 only \`useAnimatedStyle\`, \`useAnimatedValue\`, \`usePresence\`, \`useGradientBorder\`. Easing values are **camelCase**: \`'easeOut'\` NOT \`'ease-out'\`. \`useAnimatedValue\` REQUIRES an initial number: \`useAnimatedValue(0)\` \u2014 NOT \`useAnimatedValue()\`. Call \`get_animate_guide\` topic \`api\`.
|
|
16366
|
+
22. **Animate** (\`@idealyst/animate\`): There is NO \`useSequence\` or \`useKeyframes\` \u2014 only \`useAnimatedStyle\`, \`useAnimatedValue\`, \`usePresence\`, \`useGradientBorder\`. Easing values are **camelCase**: \`'easeOut'\` NOT \`'ease-out'\`. \`useAnimatedValue\` REQUIRES an initial number: \`useAnimatedValue(0)\` \u2014 NOT \`useAnimatedValue()\`. \`useAnimatedStyle\` supports a \`delay\` option (ms) for staggered entrances. Transform syntax: use **object** format \`{ x, y, scale, rotate }\` \u2014 NOT array format \`[{ translateX }]\` which doesn't animate. Call \`get_animate_guide\` topic \`api\`.
|
|
15829
16367
|
23. **Charts** (\`@idealyst/charts\`): \`ChartDataSeries\` requires \`id\` and \`name\` (NOT \`label\`). \`AxisConfig\` uses \`show\` (NOT \`visible\`). \`tickFormat\` type is \`(value: number | string | Date) => string\`. Call \`get_charts_guide\` topic \`api\`.
|
|
15830
16368
|
`;
|
|
15831
16369
|
|
|
@@ -23291,7 +23829,7 @@ var import_url = require("url");
|
|
|
23291
23829
|
// src/generated/types.json
|
|
23292
23830
|
var types_default = {
|
|
23293
23831
|
version: "1.0.93",
|
|
23294
|
-
extractedAt: "2026-02-
|
|
23832
|
+
extractedAt: "2026-02-24T21:11:17.058Z",
|
|
23295
23833
|
components: {
|
|
23296
23834
|
Accordion: {
|
|
23297
23835
|
name: "Accordion",
|
|
@@ -45592,7 +46130,7 @@ var types_default = {
|
|
|
45592
46130
|
navigation: {
|
|
45593
46131
|
TabBarScreenOptions: 'export type TabBarScreenOptions = {\n /**\n * Icon for tab/drawer navigation.\n *\n * Can be:\n * - A **string** (icon name) \u2014 e.g. `"home"`, `"cog"`. The default layout renders\n * `<Icon name={tabBarIcon} size="sm" />` automatically.\n * - A **render function** \u2014 receives `{ focused, color, size }`. The `size` param is\n * a number (from native tab bars); **ignore it** and use a Size token instead:\n * `tabBarIcon: ({ focused }) => <Icon name={focused ? \'home\' : \'home-outline\'} size="sm" />`\n */\n tabBarIcon?: string | ((props: { focused: boolean; color: string; size: string | number }) => React.ReactElement)\n\n /**\n * Label for tab/drawer navigation\n */\n tabBarLabel?: string;\n \n /**\n * Badge for tab navigation\n */\n tabBarBadge?: string | number;\n \n /**\n * Whether to show the tab bar for this screen\n */\n tabBarVisible?: boolean;\n} & ScreenOptions',
|
|
45594
46132
|
NavigatorOptions: "export type NavigatorOptions = {\n\n \n /**\n * Custom header title component or string\n */\n headerTitle?: React.ComponentType | React.ReactElement | string;\n \n /**\n * Custom header left component (overrides back button)\n */\n headerLeft?: React.ComponentType | React.ReactElement;\n \n /**\n * Whether to show header back button\n */\n headerBackVisible?: boolean;\n \n /**\n * Custom header right component\n */\n headerRight?: React.ComponentType | React.ReactElement;\n \n /**\n * Whether to hide the native React Navigation header (mobile only)\n */\n headerShown?: boolean;\n}",
|
|
45595
|
-
ScreenOptions: "export type ScreenOptions = {\n /**\n * Screen title for navigation headers\n */\n title?: string;\n headerShown?: boolean;\n /**\n * When true, renders the screen outside of parent layout wrappers.\n * Useful for fullscreen modals, onboarding flows, or any screen that\n * should not inherit the parent navigator's layout (header, sidebar, tabs, etc.)\n *\n * Web: Screen renders as a sibling route without the parent LayoutComponent\n * Native: Screen uses fullScreenModal presentation\n */\n fullScreen?: boolean;\n\n} & NavigatorOptions;",
|
|
46133
|
+
ScreenOptions: "export type ScreenOptions = {\n /**\n * Screen title for navigation headers\n */\n title?: string;\n headerShown?: boolean;\n /**\n * Icon name for this screen (used by custom layout components like sidebars, drawers, etc.)\n */\n icon?: string;\n /**\n * When true, renders the screen outside of parent layout wrappers.\n * Useful for fullscreen modals, onboarding flows, or any screen that\n * should not inherit the parent navigator's layout (header, sidebar, tabs, etc.)\n *\n * Web: Screen renders as a sibling route without the parent LayoutComponent\n * Native: Screen uses fullScreenModal presentation\n */\n fullScreen?: boolean;\n\n} & NavigatorOptions;",
|
|
45596
46134
|
NotFoundComponentProps: "export type NotFoundComponentProps = {\n /** The full path that was attempted */\n path: string\n /** Any route parameters that were parsed from the path */\n params?: Record<string, string>\n}",
|
|
45597
46135
|
BaseNavigatorParam: "export type BaseNavigatorParam = {\n path: string\n type: 'navigator'\n /**\n * Navigator options. When this navigator is nested inside a tab or drawer,\n * you can include TabBarScreenOptions (tabBarIcon, tabBarLabel, tabBarBadge)\n * so the parent layout can render the tab/drawer entry for this navigator.\n */\n options?: TabBarScreenOptions\n /**\n * Handler called when an invalid route is accessed.\n * - Return NavigateParams to redirect to a different route\n * - Return undefined to show the notFoundComponent (if set)\n * If not defined, bubbles up to parent navigator.\n *\n * @param invalidPath - The path that was attempted but not found\n * @returns NavigateParams to redirect, or undefined to use notFoundComponent\n */\n onInvalidRoute?: (invalidPath: string) => NavigateParams | undefined\n /**\n * Component to render/navigate to when route is invalid and onInvalidRoute returns undefined.\n * - Web: Renders at the current URL via catch-all route\n * - Native: Navigated to as a screen\n * - Optional: If not set and nothing handles the route, a warning is logged\n */\n notFoundComponent?: React.ComponentType<NotFoundComponentProps>\n}",
|
|
45598
46136
|
TabNavigatorParam: "export type TabNavigatorParam = {\n layout: 'tab'\n routes: RouteParam<TabBarScreenOptions>[]\n layoutComponent?: TabLayoutComponent\n} & BaseNavigatorParam",
|
|
@@ -65235,12 +65773,32 @@ function postProcessComponentTypes(componentName, result) {
|
|
|
65235
65773
|
}
|
|
65236
65774
|
if (componentName.toLowerCase() === "card") {
|
|
65237
65775
|
if (typeof result === "object" && result !== null) {
|
|
65238
|
-
result.usageNote =
|
|
65776
|
+
result.usageNote = "Card is a SIMPLE CONTAINER \u2014 there are NO compound components. Do NOT use Card.Content, Card.Header, Card.Body, Card.Footer, Card.Title \u2014 they do NOT exist and will cause TS2339. Just put children directly inside <Card>...</Card>. Example: <Card padding=\"md\"><Text>Title</Text><Text>Body</Text></Card>. **Card does NOT have `border`, `scrollable`, or `backgroundColor` props** \u2014 those are View-only props. Using `border` on Card causes TS2322. For borders use `type='outlined'`. For elevated cards use `type='elevated'`. Card styling props: padding, paddingVertical, paddingHorizontal, margin, marginVertical, marginHorizontal, gap/spacing, radius, type ('default'|'outlined'|'elevated'|'filled'), intent, background, style, onPress, disabled. For custom shadows use style={{ ...theme.shadows.md }}.";
|
|
65239
65777
|
}
|
|
65240
65778
|
}
|
|
65241
65779
|
if (componentName.toLowerCase() === "view") {
|
|
65242
65780
|
if (typeof result === "object" && result !== null) {
|
|
65243
|
-
result.usageNote = "View spacing shorthand props: padding, paddingVertical, paddingHorizontal, margin, marginVertical, marginHorizontal, gap/spacing. These accept Size values (xs, sm, md, lg, xl). Do NOT use paddingTop, paddingBottom, paddingLeft, paddingRight, marginTop, marginBottom, marginLeft, marginRight as shorthand props \u2014 they do NOT exist and will cause TS2353. For single-side spacing use style={{ paddingTop: 16 }}.";
|
|
65781
|
+
result.usageNote = "View spacing shorthand props: padding, paddingVertical, paddingHorizontal, margin, marginVertical, marginHorizontal, gap/spacing. These accept Size values (xs, sm, md, lg, xl). Do NOT use paddingTop, paddingBottom, paddingLeft, paddingRight, marginTop, marginBottom, marginLeft, marginRight as shorthand props \u2014 they do NOT exist and will cause TS2353. For single-side spacing use style={{ paddingTop: 16 }}. View does NOT have a `pointerEvents` JSX prop. Use style={{ pointerEvents: 'none' }} instead.";
|
|
65782
|
+
}
|
|
65783
|
+
}
|
|
65784
|
+
if (componentName.toLowerCase() === "textarea") {
|
|
65785
|
+
if (typeof result === "object" && result !== null) {
|
|
65786
|
+
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.";
|
|
65787
|
+
}
|
|
65788
|
+
}
|
|
65789
|
+
if (componentName.toLowerCase() === "image") {
|
|
65790
|
+
if (typeof result === "object" && result !== null) {
|
|
65791
|
+
result.usageNote = "Image uses `objectFit` (CSS convention) \u2014 NOT `resizeMode` (React Native convention). Valid objectFit values: 'contain', 'cover', 'fill', 'none', 'scale-down'. Image uses `source` prop (accepts URL string or ImageSourcePropType) \u2014 NOT `src`. Example: <Image source=\"https://example.com/photo.jpg\" objectFit=\"cover\" width={200} height={200} />";
|
|
65792
|
+
}
|
|
65793
|
+
}
|
|
65794
|
+
if (componentName.toLowerCase() === "icon") {
|
|
65795
|
+
if (typeof result === "object" && result !== null) {
|
|
65796
|
+
result.usageNote = "Icon color props: Use `intent` for semantic coloring (primary, danger, success, etc.) \u2014 renders the icon in the intent's primary color. Use `textColor` for text-semantic coloring (primary, secondary, tertiary, inverse) \u2014 renders the icon using theme.colors.text[textColor]. Use `color` for arbitrary hex/rgb colors. If the icon represents an action or status, use `intent`. If it should match surrounding text color, use `textColor`.";
|
|
65797
|
+
}
|
|
65798
|
+
}
|
|
65799
|
+
if (componentName.toLowerCase() === "badge") {
|
|
65800
|
+
if (typeof result === "object" && result !== null) {
|
|
65801
|
+
result.usageNote = "Badge `intent` expects Intent: 'primary' | 'success' | 'danger' | 'warning' | 'neutral' | 'info'. Simple ternaries in JSX work fine: `<Badge intent={x > 5 ? 'success' : 'danger'}>` \u2014 TS infers the union. **Do NOT use `as const` on ternary expressions** \u2014 `(cond ? 'a' : 'b') as const` causes TS1355. For arrays of objects, use `as const` on each property value: `{ intent: 'success' as const }`, or use `as const` on the entire array literal. For complex logic, declare a typed variable: `const intent: Intent = cond ? 'success' : 'danger';` (import Intent from @idealyst/theme). This applies to all intent/type props on Badge, Button, Card, Icon, etc.";
|
|
65244
65802
|
}
|
|
65245
65803
|
}
|
|
65246
65804
|
return result;
|
|
@@ -65515,6 +66073,8 @@ function getNavigationTypes2(args = {}) {
|
|
|
65515
66073
|
const result = getNavigationTypes(format);
|
|
65516
66074
|
if (typeof result === "object" && result !== null) {
|
|
65517
66075
|
result.tabBarIconNote = `IMPORTANT: tabBarIcon can be a string (icon name) or a render function. String form (simplest): tabBarIcon: 'home' \u2014 the layout renders <Icon name="home" size="sm" /> automatically. Function form: tabBarIcon: ({ focused }) => <Icon name={focused ? 'home' : 'home-outline'} size="sm" /> WARNING: The function receives { size: number } from native tab bars, but Icon expects a Size token ('xs'|'sm'|'md'|'lg'|'xl'). Do NOT pass the size param to Icon. Use a fixed size token like 'sm' or 'md' instead.`;
|
|
66076
|
+
result.layoutNote = "IMPORTANT: For custom layouts (sidebar, drawer), import Outlet from @idealyst/navigation \u2014 NOT from react-router-dom. Outlet renders the active route's content inside your layout. Example: import { Outlet, useNavigator } from '@idealyst/navigation'; ScreenOptions has: title, headerShown, icon (string), fullScreen. StackLayoutProps has: options, routes (RouteWithFullPath<ScreenOptions>[]), currentPath. Access route metadata: route.options?.icon, route.options?.title, route.fullPath.";
|
|
66077
|
+
result.usageExample = "## NavigatorProvider Usage\n\n```tsx\nimport { NavigatorProvider } from '@idealyst/navigation';\nimport type { NavigatorParam } from '@idealyst/navigation';\n\nconst routeConfig: NavigatorParam = {\n path: '/',\n type: 'navigator',\n layout: 'tab',\n routes: [\n { path: '/home', type: 'screen', component: HomeScreen, options: { title: 'Home', tabBarIcon: 'home' } },\n { path: '/settings', type: 'screen', component: SettingsScreen, options: { title: 'Settings', tabBarIcon: 'cog' } },\n ],\n};\n\n// CRITICAL: The prop is \"route\" (SINGULAR), NOT \"routes\"\nexport const App = () => <NavigatorProvider route={routeConfig} />;\n```";
|
|
65518
66078
|
}
|
|
65519
66079
|
return jsonResponse(result);
|
|
65520
66080
|
} catch (error) {
|
|
@@ -65724,6 +66284,17 @@ function getLiveActivityGuide(args) {
|
|
|
65724
66284
|
}
|
|
65725
66285
|
return textResponse(guide);
|
|
65726
66286
|
}
|
|
66287
|
+
function getNetworkGuide(args) {
|
|
66288
|
+
const topic = args.topic;
|
|
66289
|
+
const uri = `idealyst://network/${topic}`;
|
|
66290
|
+
const guide = networkGuides[uri];
|
|
66291
|
+
if (!guide) {
|
|
66292
|
+
return textResponse(
|
|
66293
|
+
`Topic "${topic}" not found. Available topics: overview, api, examples`
|
|
66294
|
+
);
|
|
66295
|
+
}
|
|
66296
|
+
return textResponse(guide);
|
|
66297
|
+
}
|
|
65727
66298
|
function listPackages(args = {}) {
|
|
65728
66299
|
const category = args.category;
|
|
65729
66300
|
if (category) {
|
|
@@ -65974,6 +66545,7 @@ var toolHandlers = {
|
|
|
65974
66545
|
get_payments_guide: getPaymentsGuide,
|
|
65975
66546
|
get_notifications_guide: getNotificationsGuide,
|
|
65976
66547
|
get_live_activity_guide: getLiveActivityGuide,
|
|
66548
|
+
get_network_guide: getNetworkGuide,
|
|
65977
66549
|
list_packages: listPackages,
|
|
65978
66550
|
get_package_docs: getPackageDocs,
|
|
65979
66551
|
search_packages: searchPackages2,
|
|
@@ -66029,12 +66601,16 @@ function callTool(name, args = {}) {
|
|
|
66029
66601
|
getInstallGuideDefinition,
|
|
66030
66602
|
getIntro,
|
|
66031
66603
|
getIntroDefinition,
|
|
66604
|
+
getLiveActivityGuide,
|
|
66605
|
+
getLiveActivityGuideDefinition,
|
|
66032
66606
|
getLottieGuide,
|
|
66033
66607
|
getLottieGuideDefinition,
|
|
66034
66608
|
getMarkdownGuide,
|
|
66035
66609
|
getMarkdownGuideDefinition,
|
|
66036
66610
|
getNavigationTypes,
|
|
66037
66611
|
getNavigationTypesDefinition,
|
|
66612
|
+
getNetworkGuide,
|
|
66613
|
+
getNetworkGuideDefinition,
|
|
66038
66614
|
getNotificationsGuide,
|
|
66039
66615
|
getNotificationsGuideDefinition,
|
|
66040
66616
|
getOauthClientGuide,
|