@walkeros/explorer 4.7.2 → 4.8.0-next-1791496487198

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.cts CHANGED
@@ -1,40 +1,24 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { Destination, WalkerOS, Flow, Elb } from '@walkeros/core';
3
- import React, { ReactNode, FC, PropsWithChildren, RefObject } from 'react';
2
+ import { Destination, WalkerOS, Flow, Collector } from '@walkeros/core';
3
+ import React, { ReactNode, AriaAttributes, ReactElement, ButtonHTMLAttributes } from 'react';
4
4
  import * as monaco_editor from 'monaco-editor';
5
5
  import { editor } from 'monaco-editor';
6
6
  import { RJSFSchema } from '@rjsf/utils';
7
+ import { SourceBrowser } from '@walkeros/web-source-browser';
7
8
  import { Monaco } from '@monaco-editor/react';
8
9
  export { Monaco } from '@monaco-editor/react';
9
10
  export { Icon } from '@iconify/react';
10
- import { ClassValue } from 'clsx';
11
11
 
12
12
  interface DemoEnv extends Destination.BaseEnv {
13
13
  elb: (output: string) => void;
14
14
  }
15
15
  type DestinationCode = Destination.Instance<Destination.Types<unknown, unknown, DemoEnv>>;
16
- /**
17
- * Creates a gtag-style destination for demo purposes.
18
- * Formats output as: gtag('event', 'event_name', { data })
19
- */
20
- declare function createGtagDestination(): DestinationCode;
21
- /**
22
- * Creates a Facebook Pixel-style destination for demo purposes.
23
- * Formats output as: fbq('track', 'EventName', { data })
24
- */
25
- declare function createFbqDestination(): DestinationCode;
26
- /**
27
- * Creates a Plausible-style destination for demo purposes.
28
- * Formats output as: plausible('event_name', { props: { data } })
29
- */
30
- declare function createPlausibleDestination(): DestinationCode;
31
16
 
32
17
  interface PromotionPlaygroundProps {
33
18
  initialHtml?: string;
34
19
  initialCss?: string;
35
20
  initialJs?: string;
36
21
  initialMapping?: string;
37
- labelCode?: string;
38
22
  labelPreview?: string;
39
23
  labelEvents?: string;
40
24
  labelMapping?: string;
@@ -44,19 +28,33 @@ interface PromotionPlaygroundProps {
44
28
  /**
45
29
  * PromotionPlayground - Full walkerOS demonstration with live code editing
46
30
  *
47
- * Shows the complete chain:
48
- * 1. Code Editor - Edit HTML/CSS/JS with walkerOS data attributes
49
- * 2. Preview - Live rendered output that captures real events
50
- * 3. Events - Real events captured from preview interactions
51
- * 4. Mapping - Apply transformations and see destination output
52
- * 5. Result - Final destination function calls
53
- *
54
- * Uses a single unified collector flow:
55
- * - PromotionPlayground owns the collector with destinations
56
- * - Preview initializes browser source using parent's elb
57
- * - Events flow through one collector to all destinations
31
+ * Shows the complete chain, one box each:
32
+ * 1. Preview - the live page, with HTML/CSS/JS tabs to edit it; captures real events
33
+ * 2. Events - the events the preview sent
34
+ * 3. Mapping - editable rules for the destination
35
+ * 4. Result - the destination call each event becomes
36
+ *
37
+ * One collector runs the flow: Preview binds a browser source to it, and its
38
+ * destinations fill the Events and Result boxes. Whatever fails says so in
39
+ * the box it concerns.
58
40
  */
59
- declare function PromotionPlayground({ initialHtml, initialCss, initialJs, initialMapping, labelCode, labelPreview, labelEvents, labelMapping, labelResult, destination: destinationProp, }: PromotionPlaygroundProps): react_jsx_runtime.JSX.Element;
41
+ declare function PromotionPlayground({ initialHtml, initialCss, initialJs, initialMapping, labelPreview, labelEvents, labelMapping, labelResult, destination: destinationProp, }: PromotionPlaygroundProps): react_jsx_runtime.JSX.Element;
42
+
43
+ interface PlaygroundProps {
44
+ eyebrow?: ReactNode;
45
+ title?: ReactNode;
46
+ lead?: ReactNode;
47
+ }
48
+ /**
49
+ * The walkerOS playground: a tagged component, the event it sends, the
50
+ * mapping and the vendor call it becomes, live.
51
+ *
52
+ * One real flow runs the chain. `startFlow` starts a collector with the
53
+ * browser source scoped to the preview's shadow root and the gtag destination
54
+ * with the editor's mapping. The destination's `window` is a stub that hands
55
+ * each gtag call to the Result panel instead of sending it to GA4.
56
+ */
57
+ declare function Playground({ eyebrow, title, lead, }: PlaygroundProps): react_jsx_runtime.JSX.Element;
60
58
 
61
59
  interface LiveCodeProps {
62
60
  input: unknown;
@@ -68,6 +66,7 @@ interface LiveCodeProps {
68
66
  labelInput?: string;
69
67
  labelConfig?: string;
70
68
  labelOutput?: string;
69
+ /** Plain words in the empty Result box, such as why a run returns nothing. */
71
70
  emptyText?: string;
72
71
  disableInput?: boolean;
73
72
  disableConfig?: boolean;
@@ -77,7 +76,7 @@ interface LiveCodeProps {
77
76
  format?: boolean;
78
77
  rowHeight?: 'auto' | 'equal' | 'synced' | number;
79
78
  /** Language for the Result panel. Defaults to json (the typical output
80
- * shape). Set to `javascript` when emptyText includes `//` comments. */
79
+ * shape). */
81
80
  outputLanguage?: string;
82
81
  /** Language for the Config panel. Defaults to `json`. Override when the
83
82
  * Config panel content is not JSON. */
@@ -85,29 +84,6 @@ interface LiveCodeProps {
85
84
  }
86
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;
87
86
 
88
- interface CollectorBoxProps {
89
- event: string;
90
- mapping: string;
91
- destination: DestinationCode;
92
- label?: string;
93
- wordWrap?: boolean;
94
- }
95
- /**
96
- * CollectorBox - Runs a collector with destination to transform events
97
- *
98
- * Takes raw event and mapping config, processes through collector pipeline,
99
- * and displays the formatted destination output.
100
- *
101
- * @example
102
- * <CollectorBox
103
- * event={JSON.stringify(event)}
104
- * mapping={mappingConfig}
105
- * destination={createGtagDestination()}
106
- * label="Result"
107
- * />
108
- */
109
- declare function CollectorBox({ event, mapping, destination, label, wordWrap, }: CollectorBoxProps): react_jsx_runtime.JSX.Element;
110
-
111
87
  interface BrowserBoxProps {
112
88
  html?: string;
113
89
  css?: string;
@@ -330,6 +306,12 @@ interface CodeBoxProps extends Omit<CodeProps, 'code'> {
330
306
  errors: number;
331
307
  warnings: number;
332
308
  }) => void;
309
+ /** Plain words shown over the editor while `code` is empty, such as what fills it. */
310
+ placeholder?: string;
311
+ /** What failed for this box, shown above the editor with an icon and the word Error. */
312
+ error?: string;
313
+ /** `status` for input validation the reader is typing through; `alert` (default) otherwise. */
314
+ errorRole?: 'alert' | 'status';
333
315
  footer?: React.ReactNode;
334
316
  height?: string | number;
335
317
  style?: React.CSSProperties;
@@ -374,7 +356,7 @@ interface CodeBoxProps extends Omit<CodeProps, 'code'> {
374
356
  * showFormat
375
357
  * />
376
358
  */
377
- declare function CodeBox({ code, language, onChange, disabled, autoHeight, label, header, showHeader, tabs, activeTab: controlledActiveTab, onTabChange, defaultTab, showTrafficLights, showCopy, showFormat, showSettings, onValidationIssues, footer, height, style, className, ...codeProps }: CodeBoxProps): react_jsx_runtime.JSX.Element;
359
+ declare function CodeBox({ code, language, onChange, disabled, autoHeight, label, header, showHeader, tabs, activeTab: controlledActiveTab, onTabChange, defaultTab, showTrafficLights, showCopy, showFormat, showSettings, onValidationIssues, placeholder, error, errorRole, footer, height, style, className, ...codeProps }: CodeBoxProps): react_jsx_runtime.JSX.Element;
378
360
 
379
361
  interface CodeDiffBoxProps {
380
362
  original: string;
@@ -542,73 +524,6 @@ interface StepExampleProps {
542
524
  */
543
525
  declare function StepExample({ example, className }: StepExampleProps): react_jsx_runtime.JSX.Element;
544
526
 
545
- interface DropdownProps {
546
- /** Trigger element (button, link, etc.) */
547
- trigger: React.ReactNode;
548
- /** Whether dropdown is open (controlled) */
549
- isOpen: boolean;
550
- /** Toggle handler */
551
- onToggle: () => void;
552
- /** Dropdown content */
553
- children: React.ReactNode;
554
- /** Alignment of dropdown panel */
555
- align?: 'left' | 'right';
556
- /** ARIA label for accessibility */
557
- ariaLabel?: string;
558
- /** Additional CSS class */
559
- className?: string;
560
- }
561
- interface DropdownItemProps {
562
- /** Item content */
563
- children: React.ReactNode;
564
- /** Click handler */
565
- onClick?: () => void;
566
- /** Disabled state */
567
- disabled?: boolean;
568
- /** Visual variant */
569
- variant?: 'default' | 'danger';
570
- /** Additional CSS class */
571
- className?: string;
572
- }
573
- interface DropdownDividerProps {
574
- /** Additional CSS class */
575
- className?: string;
576
- }
577
- /**
578
- * Dropdown - Generic dropdown container (UI only)
579
- *
580
- * Pure UI component for dropdown menus.
581
- * Click-outside and keyboard handling should be implemented in the parent
582
- * via hooks like useDropdown.
583
- *
584
- * @example
585
- * <Dropdown
586
- * trigger={<button>Menu</button>}
587
- * isOpen={isOpen}
588
- * onToggle={toggle}
589
- * align="right"
590
- * >
591
- * <DropdownItem onClick={handleAction}>Action</DropdownItem>
592
- * <DropdownDivider />
593
- * <DropdownItem onClick={handleLogout} variant="danger">Logout</DropdownItem>
594
- * </Dropdown>
595
- */
596
- declare function Dropdown({ trigger, isOpen, onToggle, children, align, ariaLabel, className, }: DropdownProps): react_jsx_runtime.JSX.Element;
597
- /**
598
- * DropdownItem - Menu item within a dropdown
599
- *
600
- * @example
601
- * <DropdownItem onClick={handleClick}>Action</DropdownItem>
602
- */
603
- declare function DropdownItem({ children, onClick, disabled, variant, className, }: DropdownItemProps): react_jsx_runtime.JSX.Element;
604
- /**
605
- * DropdownDivider - Visual separator between menu items
606
- *
607
- * @example
608
- * <DropdownDivider />
609
- */
610
- declare function DropdownDivider({ className }: DropdownDividerProps): react_jsx_runtime.JSX.Element;
611
-
612
527
  /**
613
528
  * Tab with code content for CodeView
614
529
  */
@@ -655,16 +570,20 @@ interface CodeViewProps {
655
570
  */
656
571
  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;
657
572
 
658
- /**
659
- * Minimal "product add" example shown when a browser-source step provides no
660
- * HTML of its own. Demonstrates an entity with a click:add action.
661
- */
662
- declare const DEFAULT_FALLBACK_HTML = "<div data-elb=\"product\" data-elbaction=\"click:add\"><button data-elb-product=\"name:Example;price:9.99\">Add to cart</button></div>";
663
573
  interface PreviewProps {
664
574
  html?: string;
665
575
  css?: string;
666
576
  js?: string;
667
- elb?: Elb.Fn;
577
+ /**
578
+ * The collector that captures the preview's events. Preview binds a browser
579
+ * source to its document through the collector's own source wiring, so
580
+ * every click and load event runs the collector's pipeline. Without it the
581
+ * preview only renders. The source is the preview's own, not one of the
582
+ * collector's `sources`: `walker consent` and `walker user` do not reach
583
+ * it, and the collector's status does not list it.
584
+ */
585
+ collector?: Collector.Instance;
586
+ /** The box's name; with `editable`, the name of its first tab. */
668
587
  label?: string;
669
588
  /**
670
589
  * Opt-in editor tabs. When true, the header shows a `tabs` ButtonGroup to
@@ -685,8 +604,8 @@ interface PreviewProps {
685
604
  * Preview - HTML preview wrapped in a Box with highlight buttons
686
605
  *
687
606
  * Renders HTML in an isolated iframe with highlight buttons footer.
688
- * When elb is provided, initializes walkerOS browser source in iframe
689
- * that pushes events to the parent collector.
607
+ * With a collector, a walkerOS browser source captures the iframe's events
608
+ * into it; a source that fails to start says so in the box.
690
609
  *
691
610
  * Load semantics mirror a real browser: `load` triggers (and pageview) fire
692
611
  * once on the initial load and again only when the user clicks Reload. Editing
@@ -697,10 +616,62 @@ interface PreviewProps {
697
616
  * // Read-only preview
698
617
  * <Preview html={html} css={css} label="Preview" />
699
618
  *
700
- * // Interactive preview with event capture (elb from parent collector)
701
- * <Preview html={html} css={css} elb={elb} label="Preview" />
619
+ * // Interactive preview that captures events into a collector
620
+ * <Preview html={html} css={css} collector={collector} label="Preview" />
621
+ */
622
+ declare function Preview({ html, css, js, collector, label, editable, initialTab, onHtmlChange, onCssChange, onJsChange, lineNumbers, wordWrap, }: PreviewProps): react_jsx_runtime.JSX.Element;
623
+
624
+ interface ViewSourceProps extends AriaAttributes {
625
+ /** Exactly one element: the component whose HTML is shown. */
626
+ children: ReactElement;
627
+ /**
628
+ * The page's elb (the browser source's push). After an edit is applied, and
629
+ * after Reset brings the original back, ViewSource calls
630
+ * `elb('walker init', element)` so the new nodes get their triggers.
631
+ */
632
+ elb?: SourceBrowser.Push;
633
+ /**
634
+ * Lets the wrapped element fill a stretched grid or flex cell as it does
635
+ * unwrapped (cards in a grid row). The root and its content become
636
+ * one-column grids: an auto-height element fills the cell, its margins,
637
+ * own self-alignment and explicit height still apply, and its vertical
638
+ * margins stay inside the wrapper. Leave it off for an element centered
639
+ * with auto margins (a section with `mx-auto`), which a grid shrinks to
640
+ * fit.
641
+ */
642
+ stretch?: boolean;
643
+ className?: string;
644
+ id?: string;
645
+ [dataAttribute: `data-${string}`]: string | undefined;
646
+ }
647
+ /**
648
+ * ViewSource - shows a component's live HTML in place and lets you edit it.
649
+ *
650
+ * Wraps exactly one element and adds no frame of its own. A toggle at the
651
+ * top right switches between Visual and Code. Code shows the element's live
652
+ * HTML, formatted and editable, on a dark code surface; the code covers the
653
+ * element's visible box (its border box when it paints a background or
654
+ * border, else its content box inside the padding), and the toggle sits at
655
+ * that box's top right. Escape leaves the editor for the toggle.
656
+ * Back in Visual, a changed edit replaces the element as plain HTML (React
657
+ * handlers inside it are inactive) and `elb('walker init', element)`
658
+ * registers its triggers. Reset, an icon beside the toggle, mounts the
659
+ * original children again and registers theirs the same way.
660
+ *
661
+ * ViewSources nest: an outer snapshot shows the inner wrapped elements
662
+ * without their wrappers, and only the innermost hovered toolbar shows. An
663
+ * applied outer edit is plain HTML, so it has no inner wrappers until Reset.
664
+ *
665
+ * Wrap the outermost tagged element of a section, never an element inside one
666
+ * with a click action: a click on the toolbar bubbles to the wrapper's
667
+ * ancestors.
668
+ *
669
+ * @example
670
+ * <ViewSource elb={elb}>
671
+ * <PromotionHero />
672
+ * </ViewSource>
702
673
  */
703
- declare function Preview({ html, css, js, elb, label, editable, initialTab, onHtmlChange, onCssChange, onJsChange, lineNumbers, wordWrap, }: PreviewProps): react_jsx_runtime.JSX.Element;
674
+ declare function ViewSource({ children, elb, stretch, className, ...rest }: ViewSourceProps): react_jsx_runtime.JSX.Element;
704
675
 
705
676
  interface CodeDiffSummary {
706
677
  /** Count of hunks that exist only in modified (pure additions). */
@@ -730,7 +701,8 @@ interface CodeDiffProps {
730
701
  /**
731
702
  * CodeDiff — read-only Monaco DiffEditor atom.
732
703
  *
733
- * Generic: diffs any Monaco-supported language. Theme follows [data-theme].
704
+ * Generic: diffs any Monaco-supported language. A dark island in both page
705
+ * themes, like every code surface.
734
706
  * Use <CodeDiffBox> for the full chrome (header, summary, toggle, copy).
735
707
  */
736
708
  declare function CodeDiff({ original, modified, language, height, renderSideBySide, onSummaryChange, beforeMount, onMount, className, }: CodeDiffProps): react_jsx_runtime.JSX.Element;
@@ -742,6 +714,8 @@ interface CodeStaticProps {
742
714
  }
743
715
  declare function CodeStatic({ code, language, className, }: CodeStaticProps): React.ReactElement;
744
716
 
717
+ type Theme = 'dark' | 'light';
718
+
745
719
  interface BoxTab {
746
720
  id: string;
747
721
  label: string;
@@ -765,8 +739,17 @@ interface BoxProps {
765
739
  onTabChange?: (id: string) => void;
766
740
  defaultTab?: string;
767
741
  showTrafficLights?: boolean;
742
+ /** Pins the box to one theme, whatever the page theme (a dark island). */
743
+ theme?: Theme;
744
+ /** What failed in this box, shown above its content with an icon and the word Error. */
745
+ error?: string;
746
+ /**
747
+ * How the error is announced: `alert` (default) interrupts, for a failure;
748
+ * `status` waits, for input validation that changes as the reader types.
749
+ */
750
+ errorRole?: 'alert' | 'status';
768
751
  }
769
- declare function Box({ header, headerActions, footer, children, className, style, height, minHeight, maxHeight, tiny, resizable, showHeader, tabs, activeTab: controlledActiveTab, onTabChange, defaultTab, showTrafficLights, }: BoxProps): react_jsx_runtime.JSX.Element;
752
+ declare function Box({ header, headerActions, footer, children, className, style, height, minHeight, maxHeight, tiny, resizable, showHeader, tabs, activeTab: controlledActiveTab, onTabChange, defaultTab, showTrafficLights, theme, error, errorRole, }: BoxProps): react_jsx_runtime.JSX.Element;
770
753
 
771
754
  interface GridProps {
772
755
  children: React.ReactNode;
@@ -776,6 +759,13 @@ interface GridProps {
776
759
  */
777
760
  columns?: number;
778
761
  minBoxWidth?: number | string;
762
+ /**
763
+ * Fixed box width in px: one row at every container width, scrolled
764
+ * sideways and snapping to each box. A box never grows past the row, so a
765
+ * narrow container still shows the edge of the next one. Overrides
766
+ * `columns` and `minBoxWidth`.
767
+ */
768
+ boxWidth?: number;
779
769
  gap?: number | string;
780
770
  rowHeight?: 'auto' | 'equal' | 'synced' | number;
781
771
  maxRowHeight?: number | string | 'none';
@@ -788,7 +778,8 @@ interface GridProps {
788
778
  * Provides consistent grid layout for box components with horizontal
789
779
  * scrolling when content exceeds available space. Boxes keep a minimum width.
790
780
  * By default all boxes share one row; `columns` sets the boxes per row and
791
- * wraps the rest. Narrow containers stack the boxes.
781
+ * wraps the rest. Narrow containers stack the boxes. `boxWidth` keeps one
782
+ * row of fixed-width boxes at every width instead.
792
783
  *
793
784
  * @example
794
785
  * // 5 boxes with default 350px minimum width
@@ -809,6 +800,15 @@ interface GridProps {
809
800
  * </Grid>
810
801
  *
811
802
  * @example
803
+ * // One row of 350px boxes, scrolled sideways on any screen
804
+ * <Grid boxWidth={350}>
805
+ * <Preview ... />
806
+ * <CodeBox ... />
807
+ * <CodeBox ... />
808
+ * <CodeBox ... />
809
+ * </Grid>
810
+ *
811
+ * @example
812
812
  * // Custom row height
813
813
  * <Grid columns={2} rowHeight={300}>
814
814
  * <CodeBox ... />
@@ -835,7 +835,7 @@ interface GridProps {
835
835
  * <CodeBox ... />
836
836
  * </Grid>
837
837
  */
838
- declare function Grid({ children, columns, minBoxWidth, gap, rowHeight, maxRowHeight, showScrollButtons, className, }: GridProps): react_jsx_runtime.JSX.Element;
838
+ declare function Grid({ children, columns, minBoxWidth, boxWidth, gap, rowHeight, maxRowHeight, showScrollButtons, className, }: GridProps): react_jsx_runtime.JSX.Element;
839
839
 
840
840
  interface HeaderProps {
841
841
  label: string;
@@ -843,26 +843,6 @@ interface HeaderProps {
843
843
  }
844
844
  declare function Header({ label, children }: HeaderProps): react_jsx_runtime.JSX.Element;
845
845
 
846
- interface FooterProps {
847
- children: React.ReactNode;
848
- className?: string;
849
- }
850
- /**
851
- * Footer - Footer atom component for boxes
852
- *
853
- * Provides a fixed-height footer area at the bottom of a box.
854
- * Pairs with Header component for consistent box structure.
855
- *
856
- * @example
857
- * <Box header="Preview">
858
- * <Preview ... />
859
- * <Footer>
860
- * <ButtonGroup buttons={...} />
861
- * </Footer>
862
- * </Box>
863
- */
864
- declare function Footer({ children, className }: FooterProps): react_jsx_runtime.JSX.Element;
865
-
866
846
  interface ButtonProps {
867
847
  active?: boolean;
868
848
  onClick?: () => void;
@@ -900,33 +880,32 @@ interface ButtonGroupProps {
900
880
  */
901
881
  declare function ButtonGroup({ buttons, onButtonClick, className, variant, }: ButtonGroupProps): react_jsx_runtime.JSX.Element;
902
882
 
903
- interface ButtonLinkProps {
904
- variant?: 'default' | 'primary' | 'secondary';
905
- size?: 'md' | 'lg';
906
- href?: string;
907
- onClick?: () => void;
908
- children: React.ReactNode;
909
- className?: string;
910
- disabled?: boolean;
883
+ interface ToggleButtonOption {
884
+ label: string;
885
+ value: string;
911
886
  }
912
- declare function ButtonLink({ variant, size, href, onClick, children, className, disabled, }: ButtonLinkProps): react_jsx_runtime.JSX.Element;
913
-
914
- interface SpinnerProps {
915
- /** Size of the spinner */
916
- size?: 'sm' | 'md' | 'lg';
917
- /** Additional CSS class */
918
- className?: string;
887
+ interface ToggleButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange' | 'onClick' | 'type' | 'value'> {
888
+ options: ToggleButtonOption[];
889
+ value: string;
890
+ onChange: (value: string) => void;
891
+ /**
892
+ * Which label the button shows: the option a click switches to (`next`,
893
+ * the default, so the label names the action) or the selected one
894
+ * (`current`, so the label names the state).
895
+ */
896
+ shows?: 'next' | 'current';
919
897
  }
920
898
  /**
921
- * Spinner - Loading indicator
922
- *
923
- * Pure UI component for showing loading state.
924
- * No internal state - controlled via parent.
925
- *
926
- * @example
927
- * <Spinner size="md" />
899
+ * ToggleButton - one button that switches between options. A click selects
900
+ * the next option after `value` (after the last, the first). By default it
901
+ * shows that next option, so its label names the action; with
902
+ * `shows="current"` it shows the selected one.
903
+ *
904
+ * Every label sits in the same grid cell and only one is visible, so the
905
+ * button always takes the longest label's width and never changes size. An
906
+ * `aria-label` should contain the shown word ("Show code" for "Code").
928
907
  */
929
- declare function Spinner({ size, className }: SpinnerProps): react_jsx_runtime.JSX.Element;
908
+ declare function ToggleButton({ options, value, onChange, shows, className, ...rest }: ToggleButtonProps): react_jsx_runtime.JSX.Element;
930
909
 
931
910
  /**
932
911
  * Detect `@monaco-editor/loader`'s cancelation rejection.
@@ -995,242 +974,33 @@ declare function allowedRefKinds(nodeType: IntelliSenseContext['nodeType'], subP
995
974
  declare function getJsonPathAtOffset(json: string, offset: number): string[];
996
975
 
997
976
  /**
998
- * MDXProvider - Makes components available in MDX files without explicit imports
999
- *
1000
- * This provider wraps MDX content and injects React components for HTML elements.
1001
- * Components are automatically used when rendering markdown/MDX content.
1002
- *
1003
- * Key features:
1004
- * - No imports needed in MDX files
1005
- * - Consistent styling across all documentation
1006
- * - Theme-aware (respects data-theme attribute)
1007
- * - Automatic inline vs block code detection
1008
- *
1009
- * Available components (no import needed):
1010
- * - CodeBox: Monaco editor for code display (also auto-used for ```code blocks)
1011
- * - PropertyTable: Display schema-based property documentation
1012
- *
1013
- * @example
1014
- * // Wrap your app
1015
- * <MDXProvider>
1016
- * <App />
1017
- * </MDXProvider>
1018
- *
1019
- * @example
1020
- * // Then in any .mdx file, no imports needed:
1021
- * # Documentation
1022
- *
1023
- * Inline `code` and markdown blocks:
1024
- * ```typescript
1025
- * const example = "Hello";
1026
- * ```
1027
- *
1028
- * Or use components directly:
1029
- * <CodeBox code="const x = 1;" language="javascript" />
1030
- * <PropertyTable schema={mySchema} />
1031
- */
1032
- declare const MDXProvider: FC<PropsWithChildren>;
1033
-
1034
- interface MDXCodeProps {
1035
- className?: string;
1036
- }
1037
- /**
1038
- * MDXCode - Code component for MDX files
1039
- *
1040
- * Automatically detects and renders inline vs block code:
1041
- * - Inline code: `example` → <code className="elb-code-inline">
1042
- * - Block code: ```language\ncode\n``` → Uses CodeBox with Monaco editor
1043
- *
1044
- * Language detection:
1045
- * - Extracts language from className (e.g., "language-typescript")
1046
- * - Maps common MDX language names to Monaco language IDs
1047
- *
1048
- * Block code features (via CodeBox):
1049
- * - Full Monaco editor with syntax highlighting
1050
- * - Theme-aware (Palenight dark, VS Light)
1051
- * - Copy to clipboard button
1052
- * - Auto-height to fit content
1053
- * - Read-only mode
1054
- *
1055
- * @example
1056
- * // In MDX files (no import needed with MDXProvider):
1057
- * Inline `code` example
1058
- *
1059
- * ```typescript
1060
- * const block = "code";
1061
- * ```
1062
- */
1063
- declare const MDXCode: FC<PropsWithChildren<MDXCodeProps>>;
1064
-
1065
- /**
1066
- * Utility function to merge class names with Tailwind CSS classes
1067
- * Uses clsx for conditional classes and tailwind-merge to handle conflicts
1068
- */
1069
- declare function cn(...inputs: ClassValue[]): string;
1070
-
1071
- interface UseDropdownReturn {
1072
- /** Whether dropdown is currently open */
1073
- isOpen: boolean;
1074
- /** Toggle dropdown open/closed */
1075
- toggle: () => void;
1076
- /** Open the dropdown */
1077
- open: () => void;
1078
- /** Close the dropdown */
1079
- close: () => void;
1080
- /** Ref to attach to the container element for click-outside detection */
1081
- containerRef: RefObject<HTMLDivElement | null>;
1082
- }
1083
- /**
1084
- * useDropdown - Manages dropdown open/close state with click-outside and keyboard handling
977
+ * The one code theme of walkerOS Explorer
1085
978
  *
1086
- * Provides:
1087
- * - Open/close state management
1088
- * - Click-outside detection to close
1089
- * - Escape key handling to close
1090
- *
1091
- * @example
1092
- * const { isOpen, toggle, close, containerRef } = useDropdown();
1093
- *
1094
- * return (
1095
- * <div ref={containerRef}>
1096
- * <Dropdown isOpen={isOpen} onToggle={toggle}>
1097
- * ...
1098
- * </Dropdown>
1099
- * </div>
1100
- * );
1101
- */
1102
- declare function useDropdown(): UseDropdownReturn;
1103
-
1104
- declare const palenightTheme: editor.IStandaloneThemeData;
1105
- /**
1106
- * Register the palenight theme with Monaco Editor
1107
- * Call this function before creating any editor instances
979
+ * Code surfaces are dark in both page themes, so Monaco (CodeBox) and Shiki
980
+ * (CodeView) share one theme, built from the design constants.
1108
981
  */
1109
- declare function registerPalenightTheme(monaco: typeof monaco_editor): void;
1110
982
 
1111
- declare const lighthouseTheme: editor.IStandaloneThemeData;
1112
- /**
1113
- * Register the lighthouse theme with Monaco Editor
1114
- * Call this function before creating any editor instances
1115
- */
1116
- declare function registerLighthouseTheme(monaco: typeof monaco_editor): void;
1117
-
1118
- /**
1119
- * TypeScript type definitions for walkerOS Explorer themes
1120
- *
1121
- * These types provide type-safe access to theme properties and enable
1122
- * programmatic theme customization.
1123
- */
1124
- interface ExplorerTheme {
1125
- mode: 'light' | 'dark';
1126
- colors: {
1127
- text: string;
1128
- textLabel: string;
1129
- textButton: string;
1130
- textButtonHover: string;
1131
- textButtonActive: string;
1132
- textMuted: string;
1133
- textToggle: string;
1134
- textInput: string;
1135
- textPlaceholder: string;
1136
- bgBox: string;
1137
- bgHeader: string;
1138
- bgFooter: string;
1139
- bgButtonHover: string;
1140
- bgButtonActive: string;
1141
- bgButtonGroup: string;
1142
- bgInput: string;
1143
- bgInputHover: string;
1144
- bgCodeInline: string;
1145
- bgDropdown: string;
1146
- bgDropdownOptionHover: string;
1147
- bgDropdownOptionHighlighted: string;
1148
- borderBox: string;
1149
- borderHeader: string;
1150
- borderFooter: string;
1151
- borderButtonGroup: string;
1152
- borderInput: string;
1153
- borderInputFocus: string;
1154
- buttonPrimary: string;
1155
- buttonPrimaryHover: string;
1156
- buttonPrimaryText: string;
1157
- buttonDanger: string;
1158
- buttonDangerHover: string;
1159
- buttonDangerText: string;
1160
- statusEnabled: string;
1161
- statusDisabled: string;
1162
- statusWarning: string;
1163
- highlightPrimary: string;
1164
- highlightGlobals: string;
1165
- highlightContext: string;
1166
- highlightEntity: string;
1167
- highlightProperty: string;
1168
- highlightAction: string;
1169
- highlightBackground: string;
1170
- highlightText: string;
1171
- highlightHover: string;
1172
- highlightSeparator: string;
1173
- };
1174
- typography: {
1175
- fontFamily: string;
1176
- fontMono: string;
1177
- fontSize: {
1178
- base: string;
1179
- label: string;
1180
- toggle: string;
1181
- highlightButton: string;
1182
- };
1183
- fontWeight: {
1184
- normal: number;
1185
- semibold: number;
1186
- };
1187
- lineHeight: {
1188
- base: number;
1189
- };
1190
- };
1191
- spacing: {
1192
- header: string;
1193
- footer: string;
1194
- button: string;
1195
- buttonGroup: string;
1196
- gridGap: string;
1197
- };
1198
- radius: {
1199
- box: string;
1200
- button: string;
1201
- buttonGroup: string;
1202
- highlightButton: string;
1203
- };
1204
- shadows: {
1205
- buttonActive: string;
1206
- dropdown: string;
1207
- };
1208
- grid: {
1209
- minBoxWidth: string;
1210
- rowMinHeight: string;
1211
- rowMaxHeight: string;
1212
- boxMaxHeightMobile: string;
1213
- };
1214
- monaco: {
1215
- theme: string;
1216
- fontSize: string;
1217
- lineHeight: string;
983
+ /** Monaco `defineTheme` key and Shiki theme name of the code theme. */
984
+ declare const ELB_THEME_DARK = "elbTheme-dark";
985
+ /** The part of the Monaco API that registering a theme needs. */
986
+ interface MonacoThemeRegistry {
987
+ editor: {
988
+ defineTheme(themeName: string, themeData: editor.IStandaloneThemeData): void;
1218
989
  };
1219
990
  }
1220
-
1221
991
  /**
1222
- * Register all Monaco themes
1223
- * Convenience function for registering both themes at once
992
+ * Register the code theme with Monaco. Call it before the first editor
993
+ * mounts; Code and CodeDiff do so in their `beforeMount`.
1224
994
  *
1225
995
  * @example
1226
996
  * ```typescript
1227
- * import { registerAllThemes } from '@walkeros/explorer';
1228
- * import * as monaco from 'monaco-editor';
997
+ * import { registerTheme, ELB_THEME_DARK } from '@walkeros/explorer';
1229
998
  *
1230
- * registerAllThemes(monaco);
999
+ * registerTheme(monaco);
1000
+ * monaco.editor.setTheme(ELB_THEME_DARK);
1231
1001
  * ```
1232
1002
  */
1233
- declare function registerAllThemes(monaco: typeof monaco_editor): void;
1003
+ declare function registerTheme(monaco: MonacoThemeRegistry): void;
1234
1004
 
1235
1005
  /**
1236
1006
  * Monaco Editor TypeScript Type Management
@@ -1435,4 +1205,4 @@ declare function validateWalkerOSReferences(text: string, context: Partial<Intel
1435
1205
  */
1436
1206
  declare function extractFlowIntelliSenseContext(json: string): Partial<IntelliSenseContext>;
1437
1207
 
1438
- 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, CodeDiff, CodeDiffBox, type CodeDiffBoxProps, type CodeDiffProps, type CodeDiffSummary, type CodeProps, CodeSnippet, type CodeSnippetProps, CodeStatic, type CodeStaticProps, CodeView, type CodeViewProps, type CodeViewTab, CollectorBox, type CollectorBoxProps, type CompletionEntry, DEFAULT_FALLBACK_HTML, 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, type RefKind, Spinner, type SpinnerProps, StepExample, type StepExampleProps, type UseDropdownReturn, allowedRefKinds, applyWalkerOSDecorations, cn, createFbqDestination, createGtagDestination, createPlausibleDestination, disposeWalkerOSProviders, enrichFlowConfigSchema, enrichSchema, extractFlowIntelliSenseContext, findWalkerOSReferences, generateModelPath, getContractCompletions, getEnrichedContractSchema, getEnvCompletions, getFlowCompletions, getJsonPathAtOffset, getMappingPathCompletions, getSecretCompletions, getStoreCompletions, getVariableCompletions, getVariablesSchema, initializeMonacoTypes, isMonacoCancellation, lighthouseTheme, loadPackageTypes, loadTypeLibraryFromURL, palenightTheme, registerAllThemes, registerJsonSchema, registerLighthouseTheme, registerPalenightTheme, registerWalkerOSDecorationStyles, registerWalkerOSProviders, registerWalkerOSTypes, removeIntelliSenseContext, resolveTypesUrl, setIntelliSenseContext, setPackageTypesBaseUrl, unregisterJsonSchema, useDropdown, validateWalkerOSReferences };
1208
+ export { ArchitectureFlow, type ArchitectureFlowProps, Box, type BoxProps, type BoxTab, BrowserBox, type BrowserBoxProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, Code, CodeBox, type CodeBoxProps, type CodeBoxTab, CodeDiff, CodeDiffBox, type CodeDiffBoxProps, type CodeDiffProps, type CodeDiffSummary, type CodeProps, CodeSnippet, type CodeSnippetProps, CodeStatic, type CodeStaticProps, CodeView, type CodeViewProps, type CodeViewTab, type CompletionEntry, ELB_THEME_DARK, type FlowColumn, type FlowItem, FlowMap, type FlowMapProps, type FlowSection, type FlowStageConfig, Grid, type GridProps, Header, type HeaderProps, type IntelliSenseContext, LiveCode, type LiveCodeProps, type LoadPackageTypesOptions, type MonacoSchemaExtension, type PackageInfo, Playground, type PlaygroundProps, Preview, type PreviewProps, PromotionPlayground, type PromotionPlaygroundProps, PropertyTable, type PropertyTableProps, REFERENCE_PATTERNS, type RefKind, StepExample, type StepExampleProps, ToggleButton, type ToggleButtonProps, ViewSource, type ViewSourceProps, allowedRefKinds, applyWalkerOSDecorations, disposeWalkerOSProviders, enrichFlowConfigSchema, enrichSchema, extractFlowIntelliSenseContext, findWalkerOSReferences, generateModelPath, getContractCompletions, getEnrichedContractSchema, getEnvCompletions, getFlowCompletions, getJsonPathAtOffset, getMappingPathCompletions, getSecretCompletions, getStoreCompletions, getVariableCompletions, getVariablesSchema, initializeMonacoTypes, isMonacoCancellation, loadPackageTypes, loadTypeLibraryFromURL, registerJsonSchema, registerTheme, registerWalkerOSDecorationStyles, registerWalkerOSProviders, registerWalkerOSTypes, removeIntelliSenseContext, resolveTypesUrl, setIntelliSenseContext, setPackageTypesBaseUrl, unregisterJsonSchema, validateWalkerOSReferences };