@walkeros/explorer 3.3.1 → 3.4.0

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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { Destination, WalkerOS, Mapping, Elb } from '@walkeros/core';
2
+ import { Destination, WalkerOS, Elb } from '@walkeros/core';
3
3
  import React, { ReactNode, FC, PropsWithChildren, RefObject } from 'react';
4
4
  import * as monaco_editor from 'monaco-editor';
5
5
  import { editor } from 'monaco-editor';
@@ -8,88 +8,6 @@ export { Icon } from '@iconify/react';
8
8
  import { ClassValue } from 'clsx';
9
9
  import { Monaco } from '@monaco-editor/react';
10
10
 
11
- interface DestinationDemoProps {
12
- destination: Destination.Instance;
13
- event: WalkerOS.PartialEvent;
14
- mapping?: Mapping.Rule | string;
15
- settings?: unknown;
16
- include?: string[];
17
- generic?: boolean;
18
- initFirst?: boolean;
19
- labelEvent?: string;
20
- labelMapping?: string;
21
- labelOutput?: string;
22
- fn?: (event: WalkerOS.Event, context: Destination.PushContext) => Promise<string>;
23
- }
24
- /**
25
- * DestinationDemo - Interactive destination testing component
26
- *
27
- * Automatically captures destination.push() calls and displays the output.
28
- * The component auto-detects the destination's env from destination.examples.env.push.
29
- *
30
- * Props:
31
- * - destination: Destination instance with examples.env.push export
32
- * - event: walkerOS event to process
33
- * - mapping: Optional mapping rules
34
- * - settings: Destination-specific settings
35
- * - generic: If true, wraps mapping in { '*': { '*': mapping } }
36
- * - labelEvent: Label for event panel (default: 'Event')
37
- * - labelMapping: Label for mapping panel (default: 'Mapping')
38
- * - labelOutput: Label for output panel (default: 'Result')
39
- *
40
- * Example:
41
- * ```tsx
42
- * import destinationPlausible from '@walkeros/web-destination-plausible';
43
- * import { examples } from '@walkeros/web-destination-plausible';
44
- * import { getEvent } from '@walkeros/core';
45
- *
46
- * const destination = { ...destinationPlausible, examples };
47
- *
48
- * <DestinationDemo
49
- * destination={destination}
50
- * event={getEvent('order complete')}
51
- * mapping={examples.mapping.purchase}
52
- * settings={{ domain: 'elbwalker.com' }}
53
- * generic={true}
54
- * />
55
- * ```
56
- */
57
- declare function createCaptureFn(fnName: string, onCapture: (output: string) => void): (...args: unknown[]) => void;
58
- declare function DestinationDemo({ destination, event: initialEvent, mapping: initialMapping, settings, include, generic, initFirst, labelEvent, labelMapping, labelOutput, fn, }: DestinationDemoProps): react_jsx_runtime.JSX.Element;
59
-
60
- interface DestinationInitDemoProps {
61
- destination: Destination.Instance;
62
- settings?: unknown;
63
- labelSettings?: string;
64
- labelOutput?: string;
65
- }
66
- /**
67
- * DestinationInitDemo - Interactive destination initialization testing component
68
- *
69
- * Automatically captures destination.init() calls and displays the output.
70
- * The component auto-detects the destination's env from destination.examples.env.init.
71
- *
72
- * Props:
73
- * - destination: Destination instance with examples.env.init export
74
- * - settings: Initial destination-specific settings
75
- * - labelSettings: Label for settings panel (default: 'Settings')
76
- * - labelOutput: Label for output panel (default: 'Result')
77
- *
78
- * Example:
79
- * ```tsx
80
- * import destinationGtag from '@walkeros/web-destination-gtag';
81
- * import { examples } from '@walkeros/web-destination-gtag';
82
- *
83
- * const destination = { ...destinationGtag, examples };
84
- *
85
- * <DestinationInitDemo
86
- * destination={destination}
87
- * settings={{ ga4: { measurementId: 'G-XXXXXXXXXX' } }}
88
- * />
89
- * ```
90
- */
91
- declare function DestinationInitDemo({ destination, settings: initialSettings, labelSettings, labelOutput, }: DestinationInitDemoProps): react_jsx_runtime.JSX.Element;
92
-
93
11
  interface DemoEnv extends Destination.BaseEnv {
94
12
  elb: (output: string) => void;
95
13
  }
@@ -157,8 +75,14 @@ interface LiveCodeProps {
157
75
  language?: string;
158
76
  format?: boolean;
159
77
  rowHeight?: 'auto' | 'equal' | 'synced' | number;
78
+ /** Language for the Result panel. Defaults to json (the typical output
79
+ * shape). Set to `javascript` when emptyText includes `//` comments. */
80
+ outputLanguage?: string;
81
+ /** Language for the Config panel. Defaults to `json`. Override when the
82
+ * Config panel content is not JSON. */
83
+ configLanguage?: string;
160
84
  }
161
- declare function LiveCode({ input: initInput, config: initConfig, output: initOutput, options, fn, fnName, labelInput, labelConfig, labelOutput, emptyText, disableInput, disableConfig, showQuotes, className, language, format, rowHeight, }: LiveCodeProps): react_jsx_runtime.JSX.Element;
85
+ declare function LiveCode({ input: initInput, config: initConfig, output: initOutput, options, fn, fnName, labelInput, labelConfig, labelOutput, emptyText, disableInput, disableConfig, showQuotes, className, language, format, rowHeight, outputLanguage, configLanguage, }: LiveCodeProps): react_jsx_runtime.JSX.Element;
162
86
 
163
87
  interface CollectorBoxProps {
164
88
  event: string;
@@ -217,10 +141,12 @@ declare function BrowserBox({ html, css, js, onHtmlChange, onCssChange, onJsChan
217
141
  interface FlowItem {
218
142
  icon: ReactNode;
219
143
  label: string;
144
+ link?: string;
220
145
  }
221
146
  interface FlowSection {
222
147
  title: string;
223
148
  items: FlowItem[];
149
+ moreLink?: string;
224
150
  }
225
151
  interface FlowColumn {
226
152
  title: string;
@@ -635,6 +561,52 @@ declare function DropdownItem({ children, onClick, disabled, variant, className,
635
561
  */
636
562
  declare function DropdownDivider({ className }: DropdownDividerProps): react_jsx_runtime.JSX.Element;
637
563
 
564
+ /**
565
+ * Tab with code content for CodeView
566
+ */
567
+ interface CodeViewTab {
568
+ id: string;
569
+ label: string;
570
+ code: string;
571
+ language?: string;
572
+ }
573
+ interface CodeViewProps {
574
+ code?: string;
575
+ language?: string;
576
+ tabs?: CodeViewTab[];
577
+ activeTab?: string;
578
+ onTabChange?: (id: string) => void;
579
+ defaultTab?: string;
580
+ label?: string;
581
+ header?: string;
582
+ showHeader?: boolean;
583
+ showTrafficLights?: boolean;
584
+ showCopy?: boolean;
585
+ footer?: React.ReactNode;
586
+ height?: string | number;
587
+ className?: string;
588
+ style?: React.CSSProperties;
589
+ }
590
+ /**
591
+ * CodeView - Read-only code rendered with the same visual chrome as CodeBox.
592
+ *
593
+ * Composes Box + CodeStatic. Use for non-interactive code blocks where Monaco
594
+ * would be overkill but you want visual parity with `<CodeBox disabled>`.
595
+ *
596
+ * @example
597
+ * <CodeView code={snippet} language="typescript" label="Setup" />
598
+ *
599
+ * @example
600
+ * <CodeView
601
+ * tabs={[
602
+ * { id: 'js', label: 'JavaScript', code: jsCode, language: 'javascript' },
603
+ * { id: 'ts', label: 'TypeScript', code: tsCode, language: 'typescript' },
604
+ * ]}
605
+ * showTrafficLights
606
+ * />
607
+ */
608
+ declare function CodeView({ code, language, tabs, activeTab: controlledActiveTab, onTabChange, defaultTab, label, header, showHeader, showTrafficLights, showCopy, footer, height, className, style, }: CodeViewProps): react_jsx_runtime.JSX.Element;
609
+
638
610
  interface PreviewProps {
639
611
  html: string;
640
612
  css?: string;
@@ -657,6 +629,15 @@ interface PreviewProps {
657
629
  */
658
630
  declare function Preview({ html, css, elb, label, }: PreviewProps): react_jsx_runtime.JSX.Element;
659
631
 
632
+ interface CodeStaticProps {
633
+ code: string;
634
+ language?: string;
635
+ className?: string;
636
+ /** Force theme. If omitted, auto-detected from <html> data-theme / class. */
637
+ theme?: 'light' | 'dark';
638
+ }
639
+ declare function CodeStatic({ code, language, className, theme, }: CodeStaticProps): React.ReactElement;
640
+
660
641
  interface BoxTab {
661
642
  id: string;
662
643
  label: string;
@@ -832,6 +813,26 @@ interface SpinnerProps {
832
813
  */
833
814
  declare function Spinner({ size, className }: SpinnerProps): react_jsx_runtime.JSX.Element;
834
815
 
816
+ /**
817
+ * Detect `@monaco-editor/loader`'s cancelation rejection.
818
+ *
819
+ * When a component using `<CodeBox>` unmounts before Monaco's loader promise
820
+ * settles (React strict-mode double-mount, route change, Fast Refresh),
821
+ * `@monaco-editor/loader`'s `makeCancelable` wrapper calls `.cancel()` and
822
+ * the wrapped promise rejects with `{type: 'cancelation', msg: 'operation
823
+ * is manually canceled'}`. The rejection lives inside `@monaco-editor/react`
824
+ * and is not catchable from userland, so consumers suppress it via a
825
+ * `window.addEventListener('unhandledrejection', ...)` filter (canonical
826
+ * workaround, see https://github.com/suren-atoyan/monaco-react/issues/440).
827
+ *
828
+ * webpack-dev-server's runtime overlay hooks rejections independently and
829
+ * wraps the reason in `new Error(reason, { cause: reason })`, so the same
830
+ * identity check must walk `.cause` too.
831
+ *
832
+ * This predicate handles both shapes (raw reason and wrapping Error).
833
+ */
834
+ declare function isMonacoCancellation(value: unknown): boolean;
835
+
835
836
  /**
836
837
  * MDXProvider - Makes components available in MDX files without explicit imports
837
838
  *
@@ -847,8 +848,6 @@ declare function Spinner({ size, className }: SpinnerProps): react_jsx_runtime.J
847
848
  * Available components (no import needed):
848
849
  * - CodeBox: Monaco editor for code display (also auto-used for ```code blocks)
849
850
  * - PropertyTable: Display schema-based property documentation
850
- * - DestinationInitDemo: Interactive demo for destination initialization
851
- * - DestinationDemo: Interactive demo for destination event processing
852
851
  *
853
852
  * @example
854
853
  * // Wrap your app
@@ -1103,14 +1102,6 @@ interface LoadPackageTypesOptions {
1103
1102
  package: string;
1104
1103
  /** Version to load (e.g., '0.1.0', 'latest') */
1105
1104
  version?: string;
1106
- /** CDN to use ('unpkg' or 'jsdelivr') */
1107
- cdn?: 'unpkg' | 'jsdelivr';
1108
- /** Path to .d.ts file within package (defaults to '/dist/index.d.ts') */
1109
- typesPath?: string;
1110
- }
1111
- interface LoadPackageTypesOptions {
1112
- package: string;
1113
- version?: string;
1114
1105
  }
1115
1106
  declare function loadPackageTypes(monaco: Monaco, options: LoadPackageTypesOptions): Promise<boolean>;
1116
1107
  /**
@@ -1148,9 +1139,12 @@ declare function initializeMonacoTypes(monaco: Monaco): void;
1148
1139
 
1149
1140
  /**
1150
1141
  * Generate a unique model path for a Code instance.
1142
+ * Extension matches the language so Monaco's TypeScript worker treats `.tsx`
1143
+ * files as TSX, `.ts` files as TS, etc. Without this, all snippets live on
1144
+ * `.json` paths and TypeScript diagnostics misbehave.
1151
1145
  * Used as the `path` prop for @monaco-editor/react Editor.
1152
1146
  */
1153
- declare function generateModelPath(): string;
1147
+ declare function generateModelPath(language?: string): string;
1154
1148
  /**
1155
1149
  * Register a JSON schema for a specific model path.
1156
1150
  * Triggers a global setDiagnosticsOptions update.
@@ -1276,65 +1270,4 @@ declare function validateWalkerOSReferences(text: string, context: Partial<Intel
1276
1270
  */
1277
1271
  declare function extractFlowIntelliSenseContext(json: string): Partial<IntelliSenseContext>;
1278
1272
 
1279
- /**
1280
- * Formats captured function calls for display
1281
- *
1282
- * @param calls - Array of captured calls with path and args
1283
- * @param defaultMessage - Message to show when no calls captured
1284
- * @returns Formatted string of function calls
1285
- *
1286
- * @example
1287
- * formatCapturedCalls([
1288
- * { path: ['window', 'gtag'], args: ['config', 'G-XXX'] }
1289
- * ])
1290
- * // Returns: "gtag('config', 'G-XXX');"
1291
- */
1292
- declare function formatCapturedCalls(calls: Array<{
1293
- path: string[];
1294
- args: unknown[];
1295
- }>, defaultMessage?: string): string;
1296
- /**
1297
- * Creates a capture function for destination push method
1298
- * Uses walkerOS core mockEnv to intercept function calls
1299
- *
1300
- * @param destination - Destination instance with push method
1301
- * @param destinationEnv - Destination's exported env (usually examples.env.push)
1302
- * @returns Async function that executes push and returns formatted output
1303
- *
1304
- * @example
1305
- * import destinationGtag, { examples } from '@walkeros/web-destination-gtag';
1306
- * import { getEvent } from '@walkeros/core';
1307
- *
1308
- * const captureFn = captureDestinationPush(destinationGtag, examples.env.push);
1309
- *
1310
- * // Use in DestinationDemo
1311
- * <DestinationDemo
1312
- * destination={destinationGtag}
1313
- * event={getEvent('order complete')}
1314
- * mapping={examples.mapping.purchase}
1315
- * fn={captureFn}
1316
- * />
1317
- */
1318
- declare function captureDestinationPush(destination: Destination.Instance, destinationEnv: unknown): (event: WalkerOS.Event, context: Destination.PushContext) => Promise<string>;
1319
- /**
1320
- * Advanced: Creates a raw capture function that returns call data
1321
- * Use this when you need custom formatting or processing of calls
1322
- *
1323
- * @param destinationEnv - Destination's exported env
1324
- * @returns Function that returns both env and getCalls function
1325
- *
1326
- * @example
1327
- * const { env, getCalls } = createRawCapture(examples.env.push);
1328
- * await destination.init({ ...context, env });
1329
- * const calls = getCalls();
1330
- * // Process calls as needed
1331
- */
1332
- declare function createRawCapture(destinationEnv: unknown): {
1333
- env: Record<string, unknown>;
1334
- getCalls: () => {
1335
- path: string[];
1336
- args: unknown[];
1337
- }[];
1338
- };
1339
-
1340
- export { ArchitectureFlow, type ArchitectureFlowProps, Box, type BoxProps, type BoxTab, BrowserBox, type BrowserBoxProps, Button, ButtonGroup, type ButtonGroupProps, ButtonLink, type ButtonLinkProps, type ButtonProps, Code, CodeBox, type CodeBoxProps, type CodeBoxTab, type CodeProps, CodeSnippet, type CodeSnippetProps, CollectorBox, type CollectorBoxProps, DestinationDemo, type DestinationDemoProps, DestinationInitDemo as DestinationInit, DestinationInitDemo, type DestinationInitDemoProps, DestinationDemo as DestinationPush, Dropdown, DropdownDivider, type DropdownDividerProps, DropdownItem, type DropdownItemProps, type DropdownProps, type ExplorerTheme, type FlowColumn, type FlowItem, FlowMap, type FlowMapProps, type FlowSection, type FlowStageConfig, Footer, type FooterProps, Grid, type GridProps, Header, type HeaderProps, type IntelliSenseContext, LiveCode, type LiveCodeProps, type LoadPackageTypesOptions, MDXCode, MDXProvider, type MonacoSchemaExtension, type PackageInfo, Preview, type PreviewProps, PromotionPlayground, type PromotionPlaygroundProps, PropertyTable, type PropertyTableProps, REFERENCE_PATTERNS, Spinner, type SpinnerProps, type UseDropdownReturn, applyWalkerOSDecorations, captureDestinationPush, cn, createCaptureFn, createFbqDestination, createGtagDestination, createPlausibleDestination, createRawCapture, disposeWalkerOSProviders, enrichFlowConfigSchema, enrichSchema, extractFlowIntelliSenseContext, findWalkerOSReferences, formatCapturedCalls, generateModelPath, getEnrichedContractSchema, getVariablesSchema, initializeMonacoTypes, lighthouseTheme, loadPackageTypes, loadTypeLibraryFromURL, palenightTheme, registerAllThemes, registerJsonSchema, registerLighthouseTheme, registerPalenightTheme, registerWalkerOSDecorationStyles, registerWalkerOSProviders, registerWalkerOSTypes, removeIntelliSenseContext, setIntelliSenseContext, unregisterJsonSchema, useDropdown, validateWalkerOSReferences };
1273
+ export { ArchitectureFlow, type ArchitectureFlowProps, Box, type BoxProps, type BoxTab, BrowserBox, type BrowserBoxProps, Button, ButtonGroup, type ButtonGroupProps, ButtonLink, type ButtonLinkProps, type ButtonProps, Code, CodeBox, type CodeBoxProps, type CodeBoxTab, type CodeProps, CodeSnippet, type CodeSnippetProps, CodeStatic, type CodeStaticProps, CodeView, type CodeViewProps, type CodeViewTab, CollectorBox, type CollectorBoxProps, Dropdown, DropdownDivider, type DropdownDividerProps, DropdownItem, type DropdownItemProps, type DropdownProps, type ExplorerTheme, type FlowColumn, type FlowItem, FlowMap, type FlowMapProps, type FlowSection, type FlowStageConfig, Footer, type FooterProps, Grid, type GridProps, Header, type HeaderProps, type IntelliSenseContext, LiveCode, type LiveCodeProps, type LoadPackageTypesOptions, MDXCode, MDXProvider, type MonacoSchemaExtension, type PackageInfo, Preview, type PreviewProps, PromotionPlayground, type PromotionPlaygroundProps, PropertyTable, type PropertyTableProps, REFERENCE_PATTERNS, Spinner, type SpinnerProps, type UseDropdownReturn, applyWalkerOSDecorations, cn, createFbqDestination, createGtagDestination, createPlausibleDestination, disposeWalkerOSProviders, enrichFlowConfigSchema, enrichSchema, extractFlowIntelliSenseContext, findWalkerOSReferences, generateModelPath, getEnrichedContractSchema, getVariablesSchema, initializeMonacoTypes, isMonacoCancellation, lighthouseTheme, loadPackageTypes, loadTypeLibraryFromURL, palenightTheme, registerAllThemes, registerJsonSchema, registerLighthouseTheme, registerPalenightTheme, registerWalkerOSDecorationStyles, registerWalkerOSProviders, registerWalkerOSTypes, removeIntelliSenseContext, setIntelliSenseContext, unregisterJsonSchema, useDropdown, validateWalkerOSReferences };