@stacksjs/components 0.2.855 → 0.2.858

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.
Files changed (100) hide show
  1. package/dist/ContextMenu-43g3w5tp.stx +188 -0
  2. package/dist/DataGrid-7rt7v865.stx +376 -0
  3. package/dist/GraphView-0t3t9mec.stx +320 -0
  4. package/dist/JsonTree-satc4010.stx +317 -0
  5. package/dist/PreviewFrame-erbgvzj8.stx +257 -0
  6. package/dist/SplitPane-7sqfdwqa.stx +159 -0
  7. package/dist/component-api/component-api.js +36 -0
  8. package/dist/context-menu/context-menu.js +575 -0
  9. package/dist/data-grid/data-grid.js +1244 -0
  10. package/dist/graph-view/graph-view.js +1408 -0
  11. package/dist/index.d.ts +8 -0
  12. package/dist/index.js +22 -20
  13. package/dist/json-tree/json-tree.js +1121 -0
  14. package/dist/preview-frame/preview-frame.js +356 -0
  15. package/dist/split-pane/split-pane.js +364 -0
  16. package/dist/ui/context-menu/ContextMenu.d.ts +14 -0
  17. package/dist/ui/context-menu/context-menu.d.ts +8 -0
  18. package/dist/ui/context-menu/core.d.ts +74 -0
  19. package/dist/ui/context-menu/index.d.ts +11 -0
  20. package/dist/ui/context-menu/view.d.ts +36 -0
  21. package/dist/ui/data-grid/DataGrid.d.ts +30 -0
  22. package/dist/ui/data-grid/core.d.ts +141 -0
  23. package/dist/ui/data-grid/data-grid.d.ts +9 -0
  24. package/dist/ui/data-grid/index.d.ts +20 -0
  25. package/dist/ui/data-grid/view.d.ts +56 -0
  26. package/dist/ui/graph-view/GraphView.d.ts +21 -0
  27. package/dist/ui/graph-view/core/edges.d.ts +34 -0
  28. package/dist/ui/graph-view/core/force.d.ts +10 -0
  29. package/dist/ui/graph-view/core/graph.d.ts +83 -0
  30. package/dist/ui/graph-view/core/index.d.ts +5 -0
  31. package/dist/ui/graph-view/core/layered.d.ts +24 -0
  32. package/dist/ui/graph-view/core/viewport.d.ts +34 -0
  33. package/dist/ui/graph-view/graph-view.d.ts +9 -0
  34. package/dist/ui/graph-view/index.d.ts +21 -0
  35. package/dist/ui/graph-view/view.d.ts +51 -0
  36. package/dist/ui/json-tree/JsonTree.d.ts +18 -0
  37. package/dist/ui/json-tree/core.d.ts +108 -0
  38. package/dist/ui/json-tree/index.d.ts +18 -0
  39. package/dist/ui/json-tree/json-tree.d.ts +10 -0
  40. package/dist/ui/json-tree/tinker.d.ts +84 -0
  41. package/dist/ui/json-tree/view.d.ts +59 -0
  42. package/dist/ui/preview-frame/PreviewFrame.d.ts +44 -0
  43. package/dist/ui/preview-frame/core.d.ts +81 -0
  44. package/dist/ui/preview-frame/index.d.ts +19 -0
  45. package/dist/ui/preview-frame/preview-frame.d.ts +8 -0
  46. package/dist/ui/preview-frame/view.d.ts +37 -0
  47. package/dist/ui/split-pane/SplitPane.d.ts +18 -0
  48. package/dist/ui/split-pane/core.d.ts +58 -0
  49. package/dist/ui/split-pane/index.d.ts +15 -0
  50. package/dist/ui/split-pane/split-pane.d.ts +8 -0
  51. package/dist/ui/split-pane/view.d.ts +27 -0
  52. package/dist/ui/virtual-table/index.d.ts +6 -0
  53. package/dist/utils/component-api.d.ts +4 -0
  54. package/package.json +38 -3
  55. package/src/index.ts +8 -0
  56. package/src/ui/code-editor/README.md +2 -1
  57. package/src/ui/context-menu/ContextMenu.stx +188 -0
  58. package/src/ui/context-menu/README.md +117 -0
  59. package/src/ui/context-menu/context-menu.ts +8 -0
  60. package/src/ui/context-menu/core.ts +250 -0
  61. package/src/ui/context-menu/index.ts +16 -0
  62. package/src/ui/context-menu/view.ts +540 -0
  63. package/src/ui/data-grid/DataGrid.stx +376 -0
  64. package/src/ui/data-grid/README.md +204 -0
  65. package/src/ui/data-grid/core.ts +813 -0
  66. package/src/ui/data-grid/data-grid.ts +9 -0
  67. package/src/ui/data-grid/index.ts +34 -0
  68. package/src/ui/data-grid/view.ts +806 -0
  69. package/src/ui/graph-view/GraphView.stx +320 -0
  70. package/src/ui/graph-view/README.md +210 -0
  71. package/src/ui/graph-view/core/edges.ts +180 -0
  72. package/src/ui/graph-view/core/force.ts +237 -0
  73. package/src/ui/graph-view/core/graph.ts +277 -0
  74. package/src/ui/graph-view/core/index.ts +5 -0
  75. package/src/ui/graph-view/core/layered.ts +256 -0
  76. package/src/ui/graph-view/core/viewport.ts +141 -0
  77. package/src/ui/graph-view/graph-view.ts +9 -0
  78. package/src/ui/graph-view/index.ts +35 -0
  79. package/src/ui/graph-view/view.ts +809 -0
  80. package/src/ui/json-tree/JsonTree.stx +317 -0
  81. package/src/ui/json-tree/README.md +193 -0
  82. package/src/ui/json-tree/core.ts +588 -0
  83. package/src/ui/json-tree/index.ts +28 -0
  84. package/src/ui/json-tree/json-tree.ts +10 -0
  85. package/src/ui/json-tree/tinker.ts +349 -0
  86. package/src/ui/json-tree/view.ts +665 -0
  87. package/src/ui/preview-frame/PreviewFrame.stx +257 -0
  88. package/src/ui/preview-frame/README.md +107 -0
  89. package/src/ui/preview-frame/core.ts +195 -0
  90. package/src/ui/preview-frame/index.ts +31 -0
  91. package/src/ui/preview-frame/preview-frame.ts +8 -0
  92. package/src/ui/preview-frame/view.ts +336 -0
  93. package/src/ui/split-pane/README.md +87 -0
  94. package/src/ui/split-pane/SplitPane.stx +159 -0
  95. package/src/ui/split-pane/core.ts +200 -0
  96. package/src/ui/split-pane/index.ts +24 -0
  97. package/src/ui/split-pane/split-pane.ts +8 -0
  98. package/src/ui/split-pane/view.ts +305 -0
  99. package/src/ui/virtual-table/index.ts +6 -0
  100. package/src/utils/component-api.ts +72 -0
@@ -0,0 +1,59 @@
1
+ import { TreeModel } from './core';
2
+ import type { TreeNode, TreeOpenKind, TreePath } from './core';
3
+ export declare interface JsonTreeOptions {
4
+ value?: TreeNode | TreeNode[] | null
5
+ depth?: number
6
+ rowHeight?: number
7
+ overscan?: number
8
+ openable?: ((node: TreeNode, path: TreePath) => TreeOpenKind | TreeOpenKind[] | null | undefined) | null
9
+ contextMenu?: boolean
10
+ }
11
+ export declare interface TreeSelectDetail {
12
+ id: string
13
+ node: TreeNode
14
+ path: TreePath
15
+ pathText: string
16
+ }
17
+ export declare interface TreeToggleDetail extends TreeSelectDetail {
18
+ expanded: boolean
19
+ }
20
+ export declare interface TreeCopyDetail {
21
+ what: 'value' | 'path'
22
+ text: string
23
+ path: TreePath
24
+ node: TreeNode
25
+ }
26
+ export declare interface TreeOpenDetail extends TreeSelectDetail {
27
+ as: TreeOpenKind
28
+ }
29
+ export declare interface TreeContextDetail extends TreeSelectDetail {
30
+ x: number
31
+ y: number
32
+ }
33
+ export declare interface JsonTreeCallbacks {
34
+ onSelect?: (detail: TreeSelectDetail) => void
35
+ onToggle?: (detail: TreeToggleDetail) => void
36
+ onCopy?: (detail: TreeCopyDetail) => void
37
+ onOpen?: (detail: TreeOpenDetail) => void
38
+ onLoadMore?: (detail: TreeSelectDetail) => void
39
+ onContext?: (detail: TreeContextDetail) => void
40
+ }
41
+ export declare class JsonTreeView {
42
+ readonly model: TreeModel;
43
+ constructor(root: HTMLElement, options?: JsonTreeOptions, callbacks?: JsonTreeCallbacks);
44
+ setValue(value: TreeNode | TreeNode[] | null | undefined): void;
45
+ setDepth(depth: number): void;
46
+ setOpenable(openable: JsonTreeOptions['openable']): void;
47
+ setContextMenu(on: boolean): void;
48
+ expandAll(id?: string): void;
49
+ collapseAll(): void;
50
+ expand(id: string): boolean;
51
+ collapse(id: string): boolean;
52
+ reveal(id: string): boolean;
53
+ appendChildren(id: string, nodes: TreeNode[], more?: number): boolean;
54
+ getSelected(): TreeSelectDetail | null;
55
+ select(id: string): boolean;
56
+ focus(): void;
57
+ get drawn(): number;
58
+ destroy(): void;
59
+ }
@@ -0,0 +1,44 @@
1
+ import type { DefineComponent } from '@stacksjs/stx';
2
+ declare const __dtsx_component__: __DtsxStxComponentType;
3
+ export declare const html: boolean;
4
+ export declare const viewport: unknown;
5
+ export declare const frameWidth: unknown;
6
+ export declare const frameHeight: unknown;
7
+ export declare const landscape: ReturnType<typeof $bool>;
8
+ export declare const scheme: unknown;
9
+ /*
10
+ * Off unless asked for. A page's scripts never share the host's origin either
11
+ * way; this decides whether they run at all.
12
+ */
13
+ export declare const scripts: ReturnType<typeof $bool>;
14
+ export declare const forms: ReturnType<typeof $bool>;
15
+ export declare const toolbar: unknown;
16
+ export declare const title: unknown;
17
+ /* A CSS length for the whole component, toolbar included. */
18
+ export declare const height: unknown;
19
+ export declare const className: unknown;
20
+ export declare const previewId: unknown;
21
+ /** @defaultValue `[ { name: 'fill', label: 'Fill' }, { name: 'phone', label: 'Phone' }, { name: 'tablet', label: 'Tablet' }, { name: 'desktop', label: 'Desktop' }, ]` */
22
+ export declare const viewports: ({
23
+ /** @defaultValue 'fill' */
24
+ name: string;
25
+ /** @defaultValue 'Fill' */
26
+ label: string
27
+ } | {
28
+ /** @defaultValue 'phone' */
29
+ name: string;
30
+ /** @defaultValue 'Phone' */
31
+ label: string
32
+ } | {
33
+ /** @defaultValue 'tablet' */
34
+ name: string;
35
+ /** @defaultValue 'Tablet' */
36
+ label: string
37
+ } | {
38
+ /** @defaultValue 'desktop' */
39
+ name: string;
40
+ /** @defaultValue 'Desktop' */
41
+ label: string
42
+ })[];
43
+ declare type __DtsxStxComponentType = DefineComponent<{ html?: unknown, viewport?: unknown, frameWidth?: unknown, frameHeight?: unknown, landscape?: unknown, scheme?: unknown, scripts?: unknown, forms?: unknown, toolbar?: unknown, title?: string, height?: string, className?: string, id?: string }> & { readonly __stxEmits?: ["load", "reload", "viewport", "scheme"] }
44
+ export default __dtsx_component__;
@@ -0,0 +1,81 @@
1
+ /**
2
+ * The viewport a name stands for.
3
+ *
4
+ * A width and a height given outright win over a name. `landscape` turns a
5
+ * preset on its side; a desktop is already on its side and stays as it is.
6
+ * A name nobody knows fills the box, which is the least surprising thing to do
7
+ * with it.
8
+ */
9
+ export declare function resolveViewport(name: unknown, options?: { width?: unknown, height?: unknown, landscape?: boolean }): ResolvedViewport;
10
+ /**
11
+ * How much to shrink a viewport so it fits a box, never enlarging it: a page
12
+ * drawn larger than life would misreport what it looks like.
13
+ */
14
+ export declare function fitScale(viewport: ViewportSize, available: ViewportSize, padding?: number): number;
15
+ /** `390 × 844`, with the scale when the page is shown smaller than life. */
16
+ export declare function describeViewport(viewport: ResolvedViewport, scale?: number): string;
17
+ export declare function normalizeScheme(value: unknown): PreviewScheme;
18
+ /**
19
+ * The frame's `sandbox` value. Empty is the strictest there is: no scripts, no
20
+ * forms, an origin of its own. An empty string still has to be written as the
21
+ * attribute, since a frame with no `sandbox` attribute is not sandboxed at all.
22
+ */
23
+ export declare function sandboxValue(options?: SandboxOptions): string;
24
+ /** Whether a sandbox value keeps the page away from the host. */
25
+ export declare function isIsolatingSandbox(value: string): boolean;
26
+ /**
27
+ * The document the frame is given.
28
+ *
29
+ * A fragment (`<h1>Hi</h1>`) is wrapped in a page that follows the colour
30
+ * scheme, so bare markup is dark on a dark preview the way it would be in a
31
+ * dark page. A whole document is left as its author wrote it: a mail that
32
+ * declares no dark styles is shown light, which is what a mail client does
33
+ * with it.
34
+ *
35
+ * Either way links open "in a new window", which the sandbox refuses, so a
36
+ * click cannot navigate the preview away from what is being previewed.
37
+ */
38
+ export declare function buildDocument(html: string | null | undefined, options?: DocumentOptions): string;
39
+ /** Whether a document says which colour schemes it supports. */
40
+ export declare function declaresColorScheme(html: string): boolean;
41
+ /** The preset after `name` in the toolbar's order, for the arrow keys. `fill` comes first. */
42
+ export declare function stepViewport(name: ViewportName, direction: 1 | -1): ViewportName;
43
+ /** CSS pixels, portrait for the two that are held in a hand. */
44
+ export declare const VIEWPORT_PRESETS: readonly ViewportPreset[];
45
+ /**
46
+ * Tokens that would give the page a way back to the host, and are never
47
+ * granted whatever is asked for. `allow-same-origin` puts the page in the
48
+ * host's origin, where its scripts can read the host's storage and DOM; the
49
+ * navigation ones let it replace the host page; popups get a window the
50
+ * sandbox does not cover.
51
+ */
52
+ export declare const FORBIDDEN_SANDBOX_TOKENS: readonly string[];
53
+ export declare interface ViewportSize {
54
+ width: number
55
+ height: number
56
+ }
57
+ export declare interface ViewportPreset extends ViewportSize {
58
+ name: Exclude<ViewportName, 'fill' | 'custom'>
59
+ label: string
60
+ }
61
+ export declare interface ResolvedViewport {
62
+ name: ViewportName
63
+ size: ViewportSize | null
64
+ landscape: boolean
65
+ }
66
+ export declare interface SandboxOptions {
67
+ scripts?: boolean
68
+ forms?: boolean
69
+ }
70
+ export declare interface DocumentOptions {
71
+ title?: string
72
+ }
73
+ /**
74
+ * What a preview is made of, before there is a frame. No DOM.
75
+ *
76
+ * The document that goes into the frame, the permissions the frame is given,
77
+ * and the arithmetic of showing a phone-sized page in a box that is not
78
+ * phone-sized.
79
+ */
80
+ export type PreviewScheme = 'light' | 'dark' | 'auto';
81
+ export type ViewportName = 'fill' | 'phone' | 'tablet' | 'desktop' | 'custom';
@@ -0,0 +1,19 @@
1
+ import type { PreviewScheme, ViewportName } from './core';
2
+ export declare interface PreviewFrameProps {
3
+ html?: string
4
+ viewport?: Exclude<ViewportName, 'custom'>
5
+ frameWidth?: number
6
+ frameHeight?: number
7
+ landscape?: boolean
8
+ scheme?: PreviewScheme
9
+ scripts?: boolean
10
+ forms?: boolean
11
+ toolbar?: boolean
12
+ title?: string
13
+ height?: string
14
+ id?: string
15
+ className?: string
16
+ }
17
+ export * from './core';
18
+ export { default as PreviewFrame } from './PreviewFrame';
19
+ export * from './view';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The preview frame without its stx template.
3
+ *
4
+ * `@stacksjs/components/preview-frame`. The document and sandbox a preview is
5
+ * built from (`./core`, no DOM), and the view that puts one in a frame.
6
+ */
7
+ export * from './core';
8
+ export * from './view';
@@ -0,0 +1,37 @@
1
+ import type { PreviewScheme, ViewportName } from './core';
2
+ export declare interface PreviewFrameOptions {
3
+ html?: string
4
+ viewport?: ViewportName | string
5
+ frameWidth?: number | null
6
+ frameHeight?: number | null
7
+ landscape?: boolean
8
+ scheme?: PreviewScheme
9
+ scripts?: boolean
10
+ forms?: boolean
11
+ title?: string
12
+ }
13
+ export declare interface PreviewState {
14
+ viewport: ViewportName
15
+ width: number | null
16
+ height: number | null
17
+ landscape: boolean
18
+ scale: number
19
+ scheme: PreviewScheme
20
+ effectiveScheme: 'light' | 'dark'
21
+ }
22
+ export declare interface PreviewFrameCallbacks {
23
+ onLoad?: (state: PreviewState) => void
24
+ onReload?: (state: PreviewState) => void
25
+ onViewport?: (state: PreviewState) => void
26
+ onScheme?: (state: PreviewState) => void
27
+ }
28
+ export declare class PreviewFrameView {
29
+ constructor(root: HTMLElement, options?: PreviewFrameOptions, callbacks?: PreviewFrameCallbacks);
30
+ getState(): PreviewState;
31
+ setHtml(html: string | null | undefined): void;
32
+ setViewport(name: string, options?: { landscape?: boolean, width?: number | null, height?: number | null }): void;
33
+ setScheme(scheme: unknown): void;
34
+ setPermissions(options: { scripts?: boolean, forms?: boolean }): void;
35
+ reload(): void;
36
+ destroy(): void;
37
+ }
@@ -0,0 +1,18 @@
1
+ import type { DefineComponent } from '@stacksjs/stx';
2
+ declare const __dtsx_component__: __DtsxStxComponentType;
3
+ export declare const direction: boolean;
4
+ /*
5
+ * Shares, one per pane: `[30, 70]`, `[1, 2, 1]`, or the text `30,70`. Left
6
+ * out, each pane's own `data-size` is used, and equal shares after that.
7
+ */
8
+ export declare const sizes: ReturnType<typeof Array.isArray>;
9
+ export declare const minSize: unknown;
10
+ export declare const step: unknown;
11
+ export declare const storageKey: unknown;
12
+ export declare const label: unknown;
13
+ /* A CSS length. A split fills the box it is given, so the box needs a height. */
14
+ export declare const height: unknown;
15
+ export declare const className: unknown;
16
+ export declare const splitId: unknown;
17
+ declare type __DtsxStxComponentType = DefineComponent<{ direction?: unknown, sizes?: unknown, minSize?: unknown, step?: unknown, storageKey?: string, label?: string, height?: string, className?: string, id?: string }> & { readonly __stxEmits?: ["resize", "resize-end"] }
18
+ export default __dtsx_component__;
@@ -0,0 +1,58 @@
1
+ /** Equal shares for `count` panes. */
2
+ export declare function equalSizes(count: number): number[];
3
+ /**
4
+ * Fractions that add up to one, from any list of positive numbers.
5
+ *
6
+ * `[30, 70]`, `[0.3, 0.7]` and `[3, 7]` are the same layout. A list of the
7
+ * wrong length, or one holding anything that is not a positive finite number,
8
+ * is not a layout, and the panes are shared equally instead.
9
+ */
10
+ export declare function normalizeSizes(sizes: readonly number[] | null | undefined, count: number): number[];
11
+ /**
12
+ * Read sizes as they arrive from an attribute, a prop or storage: an array, a
13
+ * JSON array, or `30,70`. Null when there is nothing usable.
14
+ */
15
+ export declare function parseSizes(value: unknown): number[] | null;
16
+ /** A pixel length from `120`, `'120'` or `'120px'`. The fallback for anything else. */
17
+ export declare function parseLength(value: unknown, fallback: number): number;
18
+ /**
19
+ * Bring a layout inside its limits for a container `total` pixels long.
20
+ *
21
+ * A pane under its minimum is raised to it and the difference is taken from
22
+ * the panes that have room, in proportion to the room they have. When the
23
+ * minimums do not fit at all the container is simply too small, and the panes
24
+ * share it in proportion to their minimums, which is the least wrong answer.
25
+ */
26
+ export declare function fitSizes(sizes: readonly number[], total: number, limits: readonly PaneLimit[]): number[];
27
+ /**
28
+ * Move the divider after pane `index` by `delta` pixels.
29
+ *
30
+ * A positive delta grows the pane before the divider. The pane next to the
31
+ * divider on the other side shrinks first; once it is at its minimum the one
32
+ * beyond it gives, and so on, which is what dragging a divider through a
33
+ * narrow pane should do. The pane that grows stops at its maximum.
34
+ */
35
+ export declare function resizeAt(sizes: readonly number[], index: number, delta: number, total: number, limits: readonly PaneLimit[]): number[];
36
+ /** How far the divider after pane `index` can move each way, in pixels. */
37
+ export declare function dividerRange(sizes: readonly number[], index: number, total: number, limits: readonly PaneLimit[]): { back: number, forward: number };
38
+ /** What a separator reports to assistive technology: the pane before it, in percent. */
39
+ export declare function separatorValue(sizes: readonly number[], index: number, total: number, limits: readonly PaneLimit[]): { now: number, min: number, max: number };
40
+ /** The storage name a layout is kept under. */
41
+ export declare function storageName(key: string): string;
42
+ /** Sizes as they are stored: rounded, so the text is short and stable. */
43
+ export declare function serializeSizes(sizes: readonly number[]): string;
44
+ /** The pixel limits of one pane. `max` is `Infinity` when there is none. */
45
+ export declare interface PaneLimit {
46
+ min: number
47
+ max: number
48
+ }
49
+ /**
50
+ * The arithmetic of a split layout. No DOM.
51
+ *
52
+ * A layout is a list of fractions, one per pane, that add up to one. Fractions
53
+ * rather than pixels, so a window that changes size keeps its proportions and
54
+ * a saved layout means the same thing on another screen. Pixels come in only
55
+ * where a person does: a drag is so many pixels, and a pane must not get
56
+ * narrower than so many.
57
+ */
58
+ export type SplitDirection = 'horizontal' | 'vertical';
@@ -0,0 +1,15 @@
1
+ import type { SplitDirection } from './core';
2
+ export declare interface SplitPaneProps {
3
+ direction?: SplitDirection
4
+ sizes?: number[] | string
5
+ minSize?: number
6
+ step?: number
7
+ storageKey?: string
8
+ label?: string
9
+ height?: string
10
+ id?: string
11
+ className?: string
12
+ }
13
+ export * from './core';
14
+ export { default as SplitPane } from './SplitPane';
15
+ export * from './view';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The split layout without its stx template.
3
+ *
4
+ * `@stacksjs/components/split-pane`. The arithmetic (`./core`, no DOM) and the
5
+ * view that applies it to any element whose children are the panes.
6
+ */
7
+ export * from './core';
8
+ export * from './view';
@@ -0,0 +1,27 @@
1
+ import type { SplitDirection } from './core';
2
+ export declare interface SplitPaneOptions {
3
+ direction?: SplitDirection
4
+ sizes?: number[] | null
5
+ minSize?: number
6
+ storageKey?: string
7
+ step?: number
8
+ label?: string
9
+ }
10
+ export declare interface SplitResizeDetail {
11
+ sizes: number[]
12
+ pixels: number[]
13
+ index: number
14
+ source: 'pointer' | 'keyboard' | 'reset' | 'api'
15
+ }
16
+ export declare interface SplitPaneCallbacks {
17
+ onResize?: (detail: SplitResizeDetail) => void
18
+ onResizeEnd?: (detail: SplitResizeDetail) => void
19
+ }
20
+ export declare class SplitPaneView {
21
+ constructor(root: HTMLElement, options?: SplitPaneOptions, callbacks?: SplitPaneCallbacks);
22
+ getSizes(): number[];
23
+ setSizes(sizes: readonly number[] | null | undefined): void;
24
+ reset(index?: number): void;
25
+ setDirection(direction: SplitDirection): void;
26
+ destroy(): void;
27
+ }
@@ -16,4 +16,10 @@ export declare interface VirtualTableProps<T = any> {
16
16
  hoverable?: boolean
17
17
  className?: string
18
18
  }
19
+ /**
20
+ * @deprecated Use `<DataGrid>` (`../data-grid`). It virtualizes columns as
21
+ * well as rows and adds sorting, resizing, filtering, selection, keyboard
22
+ * navigation and export. `<VirtualTable>` stays so existing pages keep
23
+ * working, and gets no new features.
24
+ */
19
25
  export { default as VirtualTable } from './VirtualTable';
@@ -0,0 +1,4 @@
1
+ export declare function componentApi<T = ExposedMethods>(target: Element | string | null | undefined): T | null;
2
+ /** What a component exposes when nothing more precise is known: methods by name. */
3
+ // eslint-disable-next-line ts/no-explicit-any
4
+ export type ExposedMethods = Record<string, (..._arguments: any[]) => any>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/components",
3
3
  "type": "module",
4
- "version": "0.2.855",
4
+ "version": "0.2.858",
5
5
  "description": "A modern component library built with STX, featuring headwind utility classes and TypeScript syntax highlighting.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -57,6 +57,41 @@
57
57
  "bun": "./dist/code-editor/editor.js",
58
58
  "import": "./dist/code-editor/editor.js"
59
59
  },
60
+ "./component-api": {
61
+ "types": "./dist/utils/component-api.d.ts",
62
+ "bun": "./dist/component-api/component-api.js",
63
+ "import": "./dist/component-api/component-api.js"
64
+ },
65
+ "./context-menu": {
66
+ "types": "./dist/ui/context-menu/context-menu.d.ts",
67
+ "bun": "./dist/context-menu/context-menu.js",
68
+ "import": "./dist/context-menu/context-menu.js"
69
+ },
70
+ "./data-grid": {
71
+ "types": "./dist/ui/data-grid/data-grid.d.ts",
72
+ "bun": "./dist/data-grid/data-grid.js",
73
+ "import": "./dist/data-grid/data-grid.js"
74
+ },
75
+ "./graph-view": {
76
+ "types": "./dist/ui/graph-view/graph-view.d.ts",
77
+ "bun": "./dist/graph-view/graph-view.js",
78
+ "import": "./dist/graph-view/graph-view.js"
79
+ },
80
+ "./json-tree": {
81
+ "types": "./dist/ui/json-tree/json-tree.d.ts",
82
+ "bun": "./dist/json-tree/json-tree.js",
83
+ "import": "./dist/json-tree/json-tree.js"
84
+ },
85
+ "./preview-frame": {
86
+ "types": "./dist/ui/preview-frame/preview-frame.d.ts",
87
+ "bun": "./dist/preview-frame/preview-frame.js",
88
+ "import": "./dist/preview-frame/preview-frame.js"
89
+ },
90
+ "./split-pane": {
91
+ "types": "./dist/ui/split-pane/split-pane.d.ts",
92
+ "bun": "./dist/split-pane/split-pane.js",
93
+ "import": "./dist/split-pane/split-pane.js"
94
+ },
60
95
  "./overlays": {
61
96
  "types": "./dist/utils/overlays.d.ts",
62
97
  "bun": "./dist/overlays/overlays.js",
@@ -89,8 +124,8 @@
89
124
  "dependencies": {
90
125
  "@iconify-json/f7": "^1.2.2",
91
126
  "@stacksjs/ts-css": "^0.3.11",
92
- "@stacksjs/stx": "0.2.855",
93
- "bun-plugin-stx": "0.2.855",
127
+ "@stacksjs/stx": "0.2.858",
128
+ "bun-plugin-stx": "0.2.858",
94
129
  "ts-syntax-highlighter": "^0.2.20",
95
130
  "ts-video-player": "^0.1.11"
96
131
  },
package/src/index.ts CHANGED
@@ -32,13 +32,17 @@ export * from './ui/choice-chips'
32
32
  export * from './ui/code-editor'
33
33
  export * from './ui/combobox'
34
34
  export * from './ui/command-palette'
35
+ export * from './ui/context-menu'
36
+ export * from './ui/data-grid'
35
37
  export * from './ui/dialog'
36
38
  export * from './ui/drawer'
37
39
  export * from './ui/dropdown'
38
40
  export * from './ui/form'
41
+ export * from './ui/graph-view'
39
42
  export * from './ui/grouped-list'
40
43
  export * from './ui/image'
41
44
  export * from './ui/input'
45
+ export * from './ui/json-tree'
42
46
  export * from './ui/list'
43
47
  export * from './ui/listbox'
44
48
  // The phone primitives: a bottom tab bar, filter pills, dense list rows.
@@ -50,6 +54,7 @@ export * from './ui/pagination'
50
54
  export * from './ui/payment'
51
55
  export * from './ui/popover'
52
56
  export * from './ui/portal'
57
+ export * from './ui/preview-frame'
53
58
  export * from './ui/progress'
54
59
  export * from './ui/radio'
55
60
  export * from './ui/radio-group'
@@ -58,6 +63,7 @@ export * from './ui/select'
58
63
  export * from './ui/sidebar'
59
64
  export * from './ui/skeleton'
60
65
  export * from './ui/spinner'
66
+ export * from './ui/split-pane'
61
67
  export * from './ui/stepper'
62
68
  export * from './ui/storage'
63
69
  export * from './ui/switch'
@@ -72,6 +78,8 @@ export * from './ui/virtual-list'
72
78
  export * from './ui/virtual-table'
73
79
  export * from './utils/accessibility'
74
80
  export * from './utils/animation'
81
+ // A component's exposed methods, from outside it.
82
+ export * from './utils/component-api'
75
83
  export * from './utils/error-handling'
76
84
  // Export utilities
77
85
  export * from './utils/highlighter'
@@ -83,7 +83,8 @@ Lines and columns are zero-based everywhere, as a language server counts them.
83
83
 
84
84
  ## Methods
85
85
 
86
- Through a ref on the component: `getValue`, `setValue`, `getSelection`,
86
+ From `componentApi(target)` (`@stacksjs/components/component-api`), where
87
+ `target` is the component's element, its id or a selector: `getValue`, `setValue`, `getSelection`,
87
88
  `setSelection(anchor, head)`, `focus`, `undo`, `redo`, `exec(command)`,
88
89
  `setWidgets`, `setDiagnostics`, `setGhostText`, `showCompletions(items, { from })`,
89
90
  `closeCompletions`, and `editor()` for the controller itself.