@walkeros/explorer 4.2.0-next-1780942291149 → 4.2.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,6 +1,6 @@
1
+ import React, { ReactNode, FC, PropsWithChildren, RefObject } from 'react';
1
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
3
  import { Destination, WalkerOS, Elb } from '@walkeros/core';
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';
6
6
  import { RJSFSchema } from '@rjsf/utils';
@@ -9,6 +9,93 @@ export { Monaco } from '@monaco-editor/react';
9
9
  export { Icon } from '@iconify/react';
10
10
  import { ClassValue } from 'clsx';
11
11
 
12
+ /**
13
+ * Shared model for the unified tag visualization. One recursive `Tag` atom
14
+ * (like a DOM element) drives both auto-layout skeletons and overlay editors.
15
+ * Later building blocks (renderers, overlay editor) consume these types.
16
+ */
17
+ /** The kind of a tag. Drives color and layout role. */
18
+ type TagType = 'global' | 'context' | 'entity' | 'action' | 'property';
19
+ /** Position and size in the tree's coordinate space. */
20
+ interface TagRect {
21
+ x: number;
22
+ y: number;
23
+ w: number;
24
+ h: number;
25
+ }
26
+ /**
27
+ * A single tag node. Recursive: a tag may nest children, mirroring how a
28
+ * tagged DOM element wraps its descendants.
29
+ */
30
+ interface Tag$3 {
31
+ /** Required, stable id: drives selection, diffing, React keys, drag identity. */
32
+ id: string;
33
+ type: TagType;
34
+ /** Tab label. */
35
+ name: string;
36
+ /** Resolved value; absent means shape-only (the data is not decided yet). */
37
+ value?: string;
38
+ /** Optional freeform caption. */
39
+ label?: string;
40
+ /** Present => explicit/overlay position; absent => auto-computed by layout. */
41
+ rect?: TagRect;
42
+ /** For type 'context': depth rank where the closest context is 0. */
43
+ contextIndex?: number;
44
+ children?: Tag$3[];
45
+ }
46
+ /**
47
+ * A full tag tree. The coordinate space is grid units for auto layout, or
48
+ * image-natural pixels when overlaying a screenshot.
49
+ */
50
+ interface TagTree {
51
+ width: number;
52
+ height: number;
53
+ /** Optional background screenshot, used in overlay mode. */
54
+ src?: string;
55
+ roots: Tag$3[];
56
+ }
57
+ /**
58
+ * Build a stable tag id from a seed and an index, e.g. `product-0`. Pure: no
59
+ * randomness, no clock. Use during tree construction to give every tag a
60
+ * deterministic identity.
61
+ */
62
+ declare function makeTagId(seed: string, index: number): string;
63
+
64
+ interface TagProps {
65
+ type: TagType;
66
+ /** Tab label: the tag's own identifier (entity / context key / global key /
67
+ * action verb / property key). Never the type word; color conveys the type. */
68
+ name: string;
69
+ /** Resolved value; absent means shape-only. */
70
+ value?: string;
71
+ /** Optional freeform caption shown centered in the body. */
72
+ label?: string;
73
+ /** For type 'context': depth rank (closest = 0). Retained on the model but not
74
+ * rendered: the tab carries only the identifier. */
75
+ contextIndex?: number;
76
+ /** When false the straddle tab is hidden (hover-caption mode); the box and
77
+ * value still render so geometry never changes. Defaults to true. */
78
+ showCaption?: boolean;
79
+ /** Positioning supplied by the layout layer (e.g. overlay coordinates). */
80
+ style?: React.CSSProperties;
81
+ className?: string;
82
+ selected?: boolean;
83
+ dragging?: boolean;
84
+ /** When true the header is filled (active). Driven by the hovered containing
85
+ * chain so the whole related path (e.g. entity + its action) highlights
86
+ * together, not just the box under the pointer. */
87
+ highlighted?: boolean;
88
+ children?: React.ReactNode;
89
+ }
90
+ /**
91
+ * The unified visual atom: one rectangle with a straddling pill-tab header and a
92
+ * centered body, like a tagged DOM element. The `type` drives color only; the
93
+ * layout layer supplies `style` and/or nested `children`. Appearance only and
94
+ * pure: it knows nothing about where it sits or how big it is. All styling is
95
+ * theme-variable driven via the `.elb-tag-skeleton` BEM block.
96
+ */
97
+ declare function Tag$2({ type, name, value, label, showCaption, style, className, selected, dragging, highlighted, children, }: TagProps): React.ReactElement;
98
+
12
99
  interface DemoEnv extends Destination.BaseEnv {
13
100
  elb: (output: string) => void;
14
101
  }
@@ -544,6 +631,277 @@ interface PropertyTableProps {
544
631
  }
545
632
  declare function PropertyTable({ schema, className, emptyMessage, }: PropertyTableProps): react_jsx_runtime.JSX.Element;
546
633
 
634
+ /**
635
+ * A single key/value detail on a box: a property, a context entry, or a global.
636
+ * `value` is optional so a skeleton can show the shape ("price") before the
637
+ * data is decided ("price: 29.99").
638
+ */
639
+ interface TagSkeletonDetail {
640
+ key: string;
641
+ value?: string;
642
+ }
643
+ /** Every container is the same box; the kind only drives color. */
644
+ type BoxKind = 'entity' | 'context' | 'globals';
645
+
646
+ /**
647
+ * One tagged entity, rendered as a rectangle. Mirrors walkerOS data-elb
648
+ * tagging: `entity` is the `data-elb` name, `properties` are the
649
+ * `data-elb-<entity>` values, `actions` are the `data-elbaction` triggers,
650
+ * `context` is the `data-elbcontext` scope wrapping this box, and `children`
651
+ * are nested `data-elb` entities drawn as boxes inside this one.
652
+ */
653
+ interface TagSkeletonNode {
654
+ /**
655
+ * Stable identity. Optional today (falls back to a path-based key); the
656
+ * overlay editor uses it to select and diff boxes while dragging.
657
+ */
658
+ id?: string;
659
+ entity: string;
660
+ /** Optional freeform caption, centered inside the box. */
661
+ label?: string;
662
+ properties?: TagSkeletonDetail[];
663
+ /** Trigger:action pairs, e.g. "click:add", "load:view". */
664
+ actions?: string[];
665
+ /** data-elbcontext entries wrapping this box. */
666
+ context?: TagSkeletonDetail[];
667
+ children?: TagSkeletonNode[];
668
+ }
669
+ interface TagSkeletonProps {
670
+ /** Root entities. Each renders as a top-level rectangle. */
671
+ nodes: TagSkeletonNode[];
672
+ /** data-elbglobals — page-wide scope drawn as the outermost box. */
673
+ globals?: TagSkeletonDetail[];
674
+ className?: string;
675
+ }
676
+ /**
677
+ * Renders a walkerOS tagging skeleton: nested rectangles built from data-elb
678
+ * semantics (auto layout, content-driven, document nesting). Purely
679
+ * presentational. Superseded by `TagCanvas`; kept as a thin back-compat wrapper
680
+ * that adapts `{nodes, globals}` into a `TagTree`. For drawing rectangles onto a
681
+ * screenshot, see `TagSkeletonOverlay`. All styling lives in theme CSS
682
+ * variables.
683
+ */
684
+ declare function TagSkeleton({ nodes, globals, className, }: TagSkeletonProps): React.ReactElement;
685
+
686
+ /** A rectangle in the grid's coordinate space (image pixels). */
687
+ interface TagOverlayRect {
688
+ x: number;
689
+ y: number;
690
+ width: number;
691
+ height: number;
692
+ }
693
+ /** One rectangle drawn onto the screenshot. Positioning is flat: every box
694
+ * anchors to the frame, not to a parent. `kind` only drives color. */
695
+ interface TagOverlayBox {
696
+ id?: string;
697
+ /** Defaults to "entity". */
698
+ kind?: BoxKind;
699
+ /** Tab label. */
700
+ name: string;
701
+ rect: TagOverlayRect;
702
+ label?: string;
703
+ actions?: string[];
704
+ properties?: TagSkeletonDetail[];
705
+ }
706
+ /**
707
+ * The grid: its own coordinate space (match the screenshot's dimensions) plus
708
+ * the boxes placed within it. Rects are authored in these units; the frame
709
+ * renders them as percentages, so any display `size` stays aligned.
710
+ */
711
+ interface TagGrid {
712
+ width: number;
713
+ height: number;
714
+ boxes: TagOverlayBox[];
715
+ }
716
+ interface TagSkeletonOverlayProps {
717
+ /** Background screenshot. */
718
+ src: string;
719
+ grid: TagGrid;
720
+ /** Display width of the frame. Number = pixels; string = any CSS width.
721
+ * Image and grid scale together. Defaults to "100%". */
722
+ size?: number | string;
723
+ alt?: string;
724
+ className?: string;
725
+ }
726
+ /**
727
+ * Draws a tagging skeleton onto a screenshot. One relative anchor frame sized
728
+ * to `src`; every box is positioned absolutely as a percentage of that frame,
729
+ * so changing `size` scales image and grid together. Superseded by `TagCanvas`;
730
+ * kept as a thin back-compat wrapper that adapts `{src, grid}` into a `TagTree`
731
+ * with explicit rects. Positioning is flat (logical nesting drives color, not
732
+ * position). Purely presentational; drag/resize is a separate controlled editor
733
+ * on top. All styling lives in theme CSS variables.
734
+ */
735
+ declare function TagSkeletonOverlay({ src, grid, size, alt, className, }: TagSkeletonOverlayProps): React.ReactElement;
736
+
737
+ interface TagCanvasProps {
738
+ /** The tag tree to render. Rects are honored verbatim; missing rects are
739
+ * auto-computed by `layout()`. */
740
+ tree: TagTree;
741
+ /** Display width of the anchor frame. Number = pixels; string = any CSS
742
+ * width. Image and grid scale together. Defaults to "100%". */
743
+ size?: number | string;
744
+ /** Alt text for the optional background screenshot. */
745
+ alt?: string;
746
+ className?: string;
747
+ /** Id of the selected tag, if any. */
748
+ selectedId?: string;
749
+ /** Id of the tag currently being dragged, if any. */
750
+ draggingId?: string;
751
+ /**
752
+ * Tab visibility. `'always'` (default) shows every straddle tab. `'hover'`
753
+ * hides all tabs and reveals only the laminar containing chain under the
754
+ * pointer, so the structure is read on demand without permanent chrome.
755
+ */
756
+ captions?: 'always' | 'hover';
757
+ }
758
+ /**
759
+ * The pure renderer that draws a `TagTree`. It runs `layout()` to resolve every
760
+ * tag to an absolute rect (auto for reading mode, verbatim for overlays), then
761
+ * draws one relative anchor frame and positions each `Tag` absolutely as a
762
+ * percentage of that frame. So changing `size` scales image and grid together.
763
+ *
764
+ * When `tree.src` is set the frame shows the screenshot and boxes use the
765
+ * transparent overlay fill. Purely presentational; drag/resize is a separate
766
+ * controlled editor on top. All styling lives in theme CSS variables.
767
+ *
768
+ * With `captions="hover"` the tabs are hidden until the pointer enters a box;
769
+ * the revealed set is the laminar containing chain at the pointer (every node
770
+ * whose rect contains it), computed with an O(n) point-in-rect test per move.
771
+ */
772
+ declare function TagCanvas({ tree, size, alt, className, selectedId, draggingId, captions, }: TagCanvasProps): React.ReactElement;
773
+
774
+ interface TagTreeEditorProps {
775
+ /** The model tree (controlled). The editor never holds model state. */
776
+ tree: TagTree;
777
+ /** Called with a new tree on every commit (move/resize/keyboard). */
778
+ onChange: (tree: TagTree) => void;
779
+ /** Display width of the anchor frame. Number = px; string = any CSS width. */
780
+ size?: number | string;
781
+ className?: string;
782
+ /** Hysteresis margin in grid units for re-parent arming. */
783
+ hysteresis?: number;
784
+ /** Tab visibility forwarded to the inner canvas. Defaults to 'always'. */
785
+ captions?: 'always' | 'hover';
786
+ }
787
+ /**
788
+ * Controlled drag/resize editor for a `TagTree`. Owns no model state: it renders
789
+ * the prop `tree` through `TagCanvas`, holds only transient interaction state in
790
+ * the pure reducer, and emits a new tree via `onChange` on every commit. Pointer
791
+ * pixels are converted to the tree's grid-unit space via one measured `scale`
792
+ * (frame rendered width / tree.width) tracked with a ResizeObserver. Appearance
793
+ * lives in the atom/SCSS; this component is interaction-only.
794
+ */
795
+ declare function TagTreeEditor({ tree, onChange, size, className, hysteresis, captions, }: TagTreeEditorProps): React.ReactElement;
796
+
797
+ /**
798
+ * Pure auto-layout for a `TagTree`. Turns a recursive tag tree into a flat list
799
+ * of absolutely positioned rectangles in the tree's grid-unit coordinate space.
800
+ *
801
+ * Laminar by construction: any two emitted rects are fully nested or fully
802
+ * disjoint, never partially overlapping. Geometry mirrors hierarchy (a property
803
+ * inside an entity is drawn inside it), exactly like DOM nesting.
804
+ *
805
+ * Pure: no React, no DOM, no randomness, no clock. Given the same tree and
806
+ * options it always returns the same result.
807
+ */
808
+
809
+ /** One tag with its resolved absolute position and tree placement. */
810
+ interface PositionedTag {
811
+ tag: Tag$3;
812
+ rect: TagRect;
813
+ depth: number;
814
+ parentId: string | null;
815
+ }
816
+ /** Flattened layout. `nodes` are ordered parents-before-children (paint order). */
817
+ interface LayoutResult {
818
+ width: number;
819
+ height: number;
820
+ nodes: PositionedTag[];
821
+ }
822
+ /** Tunable geometry, all in grid units. */
823
+ interface LayoutOptions {
824
+ /** Uniform inner padding inside every container. */
825
+ pad: number;
826
+ /** Extra top space reserved for a container's straddling tab. */
827
+ gutter: number;
828
+ /** Spacing between siblings (rows, leaves, stacked containers). */
829
+ gap: number;
830
+ /** Default leaf width before any name-based growth. */
831
+ leafW: number;
832
+ /** Leaf height. */
833
+ leafH: number;
834
+ /** Minimum width a container may collapse to. */
835
+ minContainerW: number;
836
+ /** Minimum height a container may collapse to. */
837
+ minContainerH: number;
838
+ }
839
+ /**
840
+ * Lay out a tag tree.
841
+ *
842
+ * Per node: an explicit `tag.rect` is honored verbatim; otherwise the rect is
843
+ * computed (bottom-up measure, top-down place). A tree may freely mix both.
844
+ *
845
+ * Roots stack vertically from the origin. The returned canvas size follows one
846
+ * rule: if the tree carries a `src` (overlay mode) or any root has an explicit
847
+ * rect, the tree's own `width`/`height` are honored as the canvas (so authored
848
+ * coordinates stay aligned to the screenshot). Otherwise the canvas is the
849
+ * computed bounding box of all roots, never smaller than the tree's declared
850
+ * size.
851
+ */
852
+ declare function layout(tree: TagTree, opts?: Partial<LayoutOptions>): LayoutResult;
853
+
854
+ /**
855
+ * Pure containment rule for the overlay editor. Given a proposed rect and its
856
+ * geometric context (parent content box, canvas, same-parent siblings, this
857
+ * node's own children bounding box, and a minimum size), `clampRect` returns a
858
+ * laminar-valid rect: large enough to hold its children, fully inside its
859
+ * container, and disjoint from every sibling. When no such position exists it
860
+ * returns the caller-supplied `fallback` (the pre-drag rect), so the editor can
861
+ * snap back rather than emit a non-laminar tree.
862
+ *
863
+ * Pure: no React, no DOM, no randomness, no clock. Same inputs => same output.
864
+ */
865
+
866
+ interface ClampContext {
867
+ /** Parent's CONTENT box (null = the node sits directly on the canvas root). */
868
+ parentContent: TagRect | null;
869
+ /** The full canvas bounds. */
870
+ canvas: TagRect;
871
+ /** Resolved rects of same-parent siblings, excluding self. */
872
+ siblings: TagRect[];
873
+ /** Union of this node's own children rects, or null when it has none. */
874
+ childrenBBox: TagRect | null;
875
+ /** Minimum allowed size for the rect. */
876
+ min: {
877
+ w: number;
878
+ h: number;
879
+ };
880
+ }
881
+ declare function clampRect(proposed: TagRect, ctx: ClampContext, fallback: TagRect): TagRect;
882
+
883
+ /**
884
+ * Map resolved walker events + globals into a {@link TagTree}.
885
+ *
886
+ * Reading mode: no rects are set (width/height 0) so {@link TagCanvas} runs
887
+ * `layout()` to auto-place boxes.
888
+ *
889
+ * Dedupe choices:
890
+ * - Entities are grouped by entity name PLUS a stable signature of their
891
+ * resolved `data` (see {@link dataSignature}). Same entity on multiple
892
+ * triggers collapses to one Tag; two genuinely different instances (same
893
+ * name, different data) stay separate.
894
+ * - Actions within a group dedupe on the exact action+trigger pair.
895
+ *
896
+ * Page-skip: `getEvents` injects a synthetic `page` entity when an action
897
+ * resolves to no `data-elb` entity. That is not a real tagged entity, so we
898
+ * drop any event whose `entity` is `page`.
899
+ */
900
+ declare function scopeToTagTree(scope: Element | Document): TagTree;
901
+
902
+ declare const Tag$1: typeof Tag$2;
903
+ type Tag$1 = Tag$3;
904
+
547
905
  interface DropdownProps {
548
906
  /** Trigger element (button, link, etc.) */
549
907
  trigger: React.ReactNode;
@@ -1434,4 +1792,7 @@ declare function validateWalkerOSReferences(text: string, context: Partial<Intel
1434
1792
  */
1435
1793
  declare function extractFlowIntelliSenseContext(json: string): Partial<IntelliSenseContext>;
1436
1794
 
1437
- 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, 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 };
1795
+ declare const Tag: typeof Tag$2;
1796
+ type Tag = Tag$1;
1797
+
1798
+ 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, type LayoutOptions, type LayoutResult, LiveCode, type LiveCodeProps, type LoadPackageTypesOptions, MDXCode, MDXProvider, type MonacoSchemaExtension, type PackageInfo, type PositionedTag, Preview, type PreviewProps, PromotionPlayground, type PromotionPlaygroundProps, PropertyTable, type PropertyTableProps, REFERENCE_PATTERNS, type RefKind, Spinner, type SpinnerProps, Tag, TagCanvas, type TagCanvasProps, type TagGrid, type TagOverlayBox, type TagOverlayRect, type TagProps, type TagRect, TagSkeleton, type TagSkeletonDetail, type TagSkeletonNode, TagSkeletonOverlay, type TagSkeletonOverlayProps, type TagSkeletonProps, type TagTree, TagTreeEditor, type TagTreeEditorProps, type TagType, type UseDropdownReturn, allowedRefKinds, applyWalkerOSDecorations, clampRect, cn, createFbqDestination, createGtagDestination, createPlausibleDestination, disposeWalkerOSProviders, enrichFlowConfigSchema, enrichSchema, extractFlowIntelliSenseContext, findWalkerOSReferences, generateModelPath, getContractCompletions, getEnrichedContractSchema, getEnvCompletions, getFlowCompletions, getJsonPathAtOffset, getMappingPathCompletions, getSecretCompletions, getStoreCompletions, getVariableCompletions, getVariablesSchema, initializeMonacoTypes, isMonacoCancellation, layout, lighthouseTheme, loadPackageTypes, loadTypeLibraryFromURL, makeTagId, palenightTheme, registerAllThemes, registerJsonSchema, registerLighthouseTheme, registerPalenightTheme, registerWalkerOSDecorationStyles, registerWalkerOSProviders, registerWalkerOSTypes, removeIntelliSenseContext, resolveTypesUrl, scopeToTagTree, setIntelliSenseContext, setPackageTypesBaseUrl, unregisterJsonSchema, useDropdown, validateWalkerOSReferences };