@weasel-js/labkit 1.4.1 → 1.4.3
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/README.md +28 -2
- package/dist/_dts/{CanvasStackContext-BIRUVVGH.d.ts → CanvasStackContext-Dde8_1my.d.ts} +1 -1
- package/dist/_dts/{PrefsForm.d-CgxUequc.d.ts → PrefsForm.d-DDHFANkc.d.ts} +1 -1
- package/dist/_dts/{frac-X7mWgd7y.d.ts → frac-B5mB8LsJ.d.ts} +33 -13
- package/dist/_dts/{index-FEa1MudK.d.ts → index-DelFfeV0.d.ts} +99 -31
- package/dist/_dts/types-B9_zrHmb.d.ts +166 -0
- package/dist/_dts/{types-ChVJJHvk.d.ts → types-BP2OCcpg.d.ts} +41 -4
- package/dist/_dts/types-x92Kfeme.d.ts +62 -0
- package/dist/_dts/{useTrialState-Cdm13fvl.d.ts → useTrialState-D6Vb3T-g.d.ts} +11 -7
- package/dist/canvas/index.d.ts +9 -8
- package/dist/canvas/index.js +1 -2
- package/dist/chrome/index.d.ts +16 -9
- package/dist/chrome/index.js +5 -5
- package/dist/{chunk-MSR7EVS6.js → chunk-2RQPGOQF.js} +6 -5
- package/dist/chunk-2RQPGOQF.js.map +1 -0
- package/dist/{chunk-LJSIUFYD.js → chunk-5TROQVQ2.js} +46 -21
- package/dist/chunk-5TROQVQ2.js.map +1 -0
- package/dist/{chunk-53AZ2O2N.js → chunk-ASWKLRKJ.js} +92 -45
- package/dist/chunk-ASWKLRKJ.js.map +1 -0
- package/dist/{chunk-BMQWLKOL.js → chunk-C42T6DJT.js} +94 -83
- package/dist/chunk-C42T6DJT.js.map +1 -0
- package/dist/chunk-E44SU6XS.js +50 -0
- package/dist/chunk-E44SU6XS.js.map +1 -0
- package/dist/{chunk-OFCBEZMU.js → chunk-FQMJUVHJ.js} +3 -3
- package/dist/{chunk-OFCBEZMU.js.map → chunk-FQMJUVHJ.js.map} +1 -1
- package/dist/{chunk-PP7ZWAMV.js → chunk-I6JCVE24.js} +3 -3
- package/dist/chunk-I6JCVE24.js.map +1 -0
- package/dist/chunk-ISCOFAUO.js +170 -0
- package/dist/chunk-ISCOFAUO.js.map +1 -0
- package/dist/chunk-MHAGC6VD.js +7320 -0
- package/dist/chunk-MHAGC6VD.js.map +1 -0
- package/dist/{chunk-7TRFMIWX.js → chunk-QAGAHJKZ.js} +4 -4
- package/dist/{chunk-7TRFMIWX.js.map → chunk-QAGAHJKZ.js.map} +1 -1
- package/dist/{chunk-D7QIPGEB.js → chunk-RS3HRQWU.js} +62 -60
- package/dist/chunk-RS3HRQWU.js.map +1 -0
- package/dist/{chunk-RLOXQZW3.js → chunk-TJ7QY3OC.js} +3 -3
- package/dist/{chunk-RLOXQZW3.js.map → chunk-TJ7QY3OC.js.map} +1 -1
- package/dist/controls/index.d.ts +5 -4
- package/dist/controls/index.js +3 -3
- package/dist/dragdrop/index.d.ts +9 -8
- package/dist/dragdrop/index.js +1 -2
- package/dist/index.d.ts +152 -57
- package/dist/index.js +315 -200
- package/dist/index.js.map +1 -1
- package/dist/layers/index.d.ts +27 -11
- package/dist/layers/index.js +2 -3
- package/dist/loupe/index.d.ts +8 -7
- package/dist/loupe/index.js +1 -2
- package/dist/passthrough/weasel-canvas.d.ts +1 -3
- package/dist/passthrough/weasel-canvas.js +1 -1
- package/dist/passthrough/weasel-canvas.js.map +1 -1
- package/dist/passthrough/weasel-ui.d.ts +171 -22
- package/dist/passthrough/weasel-ui.js +1 -2
- package/dist/primitives/index.js +3 -4
- package/dist/state/index.d.ts +6 -3
- package/dist/state/index.js +3 -2
- package/dist/state/index.js.map +1 -1
- package/dist/styles.css +21 -4
- package/dist/surface/index.js +1 -2
- package/dist/ui/layers/index.d.ts +22 -9
- package/dist/ui/layers/index.js +1 -2
- package/dist/undo/index.d.ts +6 -6
- package/package.json +7 -7
- package/src/annotations/AnnotationTargets.tsx +6 -1
- package/src/annotations/Annotations.overlay.test.tsx +2 -0
- package/src/annotations/ExportMenu.test.tsx +16 -0
- package/src/annotations/ExportMenu.tsx +0 -5
- package/src/annotations/types.ts +4 -1
- package/src/canvas/useOrbit.test.ts +7 -3
- package/src/canvas/usePanZoom.test.ts +7 -3
- package/src/chrome/ChromeRegions.stories.tsx +42 -1
- package/src/chrome/builtins.test.ts +4 -0
- package/src/chrome/builtins.tsx +18 -0
- package/src/chrome/index.ts +1 -1
- package/src/chrome/regions/SidebarRegion.tsx +7 -6
- package/src/chrome/regions/TitleBarRegion.test.tsx +64 -0
- package/src/chrome/regions/TitleBarRegion.tsx +16 -7
- package/src/chrome/regions/ToolbarRegion.test.tsx +14 -0
- package/src/chrome/regions/ToolbarRegion.tsx +2 -2
- package/src/chrome/regions/ViewportRegion.tsx +2 -2
- package/src/chrome/regions/regions.test.tsx +45 -1
- package/src/chrome/types.ts +21 -3
- package/src/config/builder.test.ts +56 -2
- package/src/config/builder.ts +73 -13
- package/src/config/index.ts +16 -1
- package/src/config/path.test.ts +109 -0
- package/src/config/path.ts +76 -0
- package/src/config/resolve.test.ts +93 -2
- package/src/config/resolve.ts +72 -29
- package/src/config/types.ts +99 -9
- package/src/config/visible.ts +6 -4
- package/src/controls/ControlPanel.stories.tsx +38 -4
- package/src/controls/ControlPanel.test.tsx +152 -0
- package/src/controls/ControlPanel.tsx +134 -40
- package/src/dragdrop/DragDropRuntime.tsx +74 -61
- package/src/dragdrop/Palette.tsx +4 -3
- package/src/dragdrop/dragDrop.test.tsx +35 -12
- package/src/index.ts +18 -2
- package/src/instrument/serializers.ts +36 -0
- package/src/instrument/types.ts +8 -7
- package/src/lab/Lab.test.tsx +36 -1
- package/src/lab/Lab.tsx +12 -3
- package/src/lab/LabContext.ts +5 -1
- package/src/lab/LabShell.less +17 -2
- package/src/lab/LabShell.test.tsx +8 -0
- package/src/lab/LabShell.tsx +3 -1
- package/src/layers/AGENTS.md +29 -7
- package/src/layers/LayerList.less +16 -0
- package/src/layers/LayerList.stories.tsx +66 -0
- package/src/layers/LayerList.test.tsx +117 -5
- package/src/layers/LayerList.tsx +192 -53
- package/src/layers/index.ts +1 -1
- package/src/passthrough/weasel-ui.ts +5 -0
- package/src/primitives/FloatingPanel.test.tsx +8 -3
- package/src/primitives/ZoomControl.less +6 -2
- package/src/primitives/ZoomControl.tsx +1 -0
- package/src/state/helpers.ts +1 -1
- package/src/state/store.test.ts +233 -1
- package/src/state/store.ts +57 -24
- package/src/state/types.ts +44 -3
- package/src/state/useTrialState.ts +1 -1
- package/src/trial/Trial.config.test.tsx +44 -0
- package/src/trial/Trial.less +4 -0
- package/src/trial/Trial.targets.test.tsx +96 -0
- package/src/trial/Trial.test.tsx +171 -14
- package/src/trial/Trial.tsx +7 -4
- package/src/trial/TrialChrome.tsx +32 -7
- package/src/trial/TrialTitleBar.tsx +7 -3
- package/src/trial/index.ts +1 -0
- package/src/trial/trialOps.test.ts +49 -1
- package/src/trial/trialOps.ts +24 -6
- package/dist/_dts/types-lg4TSCb2.d.ts +0 -164
- package/dist/_dts/weasel-canvas-FJTFi3ZZ.d.ts +0 -5041
- package/dist/chunk-53AZ2O2N.js.map +0 -1
- package/dist/chunk-BMQWLKOL.js.map +0 -1
- package/dist/chunk-D7QIPGEB.js.map +0 -1
- package/dist/chunk-DG2IFMLA.js +0 -29970
- package/dist/chunk-DG2IFMLA.js.map +0 -1
- package/dist/chunk-J6SBFZYT.js +0 -7121
- package/dist/chunk-J6SBFZYT.js.map +0 -1
- package/dist/chunk-LJSIUFYD.js.map +0 -1
- package/dist/chunk-MIT3ISW4.js +0 -100
- package/dist/chunk-MIT3ISW4.js.map +0 -1
- package/dist/chunk-MSR7EVS6.js.map +0 -1
- package/dist/chunk-PP7ZWAMV.js.map +0 -1
package/dist/layers/index.d.ts
CHANGED
|
@@ -1,24 +1,40 @@
|
|
|
1
|
-
import { E as LayerDescriptor } from '../_dts/frac-
|
|
2
|
-
export { B as LayerCapability } from '../_dts/frac-
|
|
1
|
+
import { E as LayerDescriptor } from '../_dts/frac-B5mB8LsJ.js';
|
|
2
|
+
export { B as LayerCapability } from '../_dts/frac-B5mB8LsJ.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import 'react';
|
|
5
|
-
import '../_dts/types-
|
|
6
|
-
import '
|
|
7
|
-
import '../_dts/PrefsForm.d-
|
|
8
|
-
import '../_dts/types-
|
|
5
|
+
import '../_dts/types-B9_zrHmb.js';
|
|
6
|
+
import '@weasel-js/core';
|
|
7
|
+
import '../_dts/PrefsForm.d-DDHFANkc.js';
|
|
8
|
+
import '../_dts/types-x92Kfeme.js';
|
|
9
|
+
import '../_dts/types-BP2OCcpg.js';
|
|
9
10
|
import '../_dts/types-DJ79Tg5J.js';
|
|
10
11
|
|
|
12
|
+
/** A layer that may itself contain layers. A plain `LayerDescriptor` is one
|
|
13
|
+
* of these with no children, so a flat list needs no change. */
|
|
14
|
+
interface LayerTreeNode extends LayerDescriptor {
|
|
15
|
+
children?: LayerTreeNode[];
|
|
16
|
+
/** Render this node's children hidden on first paint. Ignored once
|
|
17
|
+
* `collapsedIds` is supplied. */
|
|
18
|
+
defaultCollapsed?: boolean;
|
|
19
|
+
}
|
|
11
20
|
/** Props for `<LayerList>`. */
|
|
12
21
|
interface LayerListProps {
|
|
13
|
-
layers:
|
|
22
|
+
layers: LayerTreeNode[];
|
|
14
23
|
visibility: Record<string, boolean>;
|
|
15
|
-
|
|
24
|
+
/** The whole tree, with the dragged node moved. Reordering is scoped to a
|
|
25
|
+
* node's siblings: a drag never changes which parent a layer sits under. */
|
|
26
|
+
onReorder: (newOrder: LayerTreeNode[]) => void;
|
|
16
27
|
onToggle: (id: string, visible: boolean) => void;
|
|
28
|
+
/** Ids whose children are hidden. Supplying it makes collapse controlled;
|
|
29
|
+
* without it the list keeps its own, seeded from `defaultCollapsed`. */
|
|
30
|
+
collapsedIds?: readonly string[];
|
|
31
|
+
onCollapsedChange?: (ids: string[]) => void;
|
|
17
32
|
className?: string;
|
|
18
33
|
}
|
|
19
34
|
/** A reorderable list of layers with per-layer visibility toggles. Layers
|
|
20
|
-
* marked `alwaysOn` are pinned and cannot be reordered or hidden.
|
|
21
|
-
|
|
35
|
+
* marked `alwaysOn` are pinned and cannot be reordered or hidden. Layers with
|
|
36
|
+
* `children` render as an expandable subtree. */
|
|
37
|
+
declare function LayerList({ layers, visibility, onReorder, onToggle, collapsedIds, onCollapsedChange, className, }: LayerListProps): react_jsx_runtime.JSX.Element;
|
|
22
38
|
|
|
23
39
|
export { LayerDescriptor, LayerList };
|
|
24
|
-
export type { LayerListProps };
|
|
40
|
+
export type { LayerListProps, LayerTreeNode };
|
package/dist/layers/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export { LayerList } from '../chunk-
|
|
1
|
+
export { LayerList } from '../chunk-ISCOFAUO.js';
|
|
2
2
|
import '../chunk-SBXNQW4G.js';
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-DG2IFMLA.js';
|
|
3
|
+
import '../chunk-MHAGC6VD.js';
|
|
5
4
|
//# sourceMappingURL=index.js.map
|
|
6
5
|
//# sourceMappingURL=index.js.map
|
package/dist/loupe/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ae as LoupePoint, af as LoupeMode, V as ViewTransform, W as WorldFrame, c as WorldSpec, a2 as ViewportSize, K as LoupeRenderArgs, N as ResolvedLoupe } from '../_dts/frac-
|
|
3
|
-
export { L as LOUPE_DEFAULTS, G as LoupeCapability, J as LoupeDeclaration, ab as resolveLoupe } from '../_dts/frac-
|
|
4
|
-
import { c as CanvasStackSurface, C as CanvasLayerDescriptor } from '../_dts/CanvasStackContext-
|
|
2
|
+
import { ae as LoupePoint, af as LoupeMode, V as ViewTransform, W as WorldFrame, c as WorldSpec, a2 as ViewportSize, K as LoupeRenderArgs, N as ResolvedLoupe } from '../_dts/frac-B5mB8LsJ.js';
|
|
3
|
+
export { L as LOUPE_DEFAULTS, G as LoupeCapability, J as LoupeDeclaration, ab as resolveLoupe } from '../_dts/frac-B5mB8LsJ.js';
|
|
4
|
+
import { c as CanvasStackSurface, C as CanvasLayerDescriptor } from '../_dts/CanvasStackContext-Dde8_1my.js';
|
|
5
5
|
import { RefObject, ReactNode } from 'react';
|
|
6
|
-
import '../_dts/types-
|
|
7
|
-
import '
|
|
8
|
-
import '../_dts/PrefsForm.d-
|
|
9
|
-
import '../_dts/types-
|
|
6
|
+
import '../_dts/types-B9_zrHmb.js';
|
|
7
|
+
import '@weasel-js/core';
|
|
8
|
+
import '../_dts/PrefsForm.d-DDHFANkc.js';
|
|
9
|
+
import '../_dts/types-x92Kfeme.js';
|
|
10
|
+
import '../_dts/types-BP2OCcpg.js';
|
|
10
11
|
import '../_dts/types-DJ79Tg5J.js';
|
|
11
12
|
|
|
12
13
|
/** Props for `<CanvasLoupe>`. */
|
package/dist/loupe/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { CanvasLoupe, DomLoupe, LOUPE_DEFAULTS, LoupeBubble, TrialLoupe, drawCanvasLens, lensCamera, lensSourceRect, resolveLoupe, sampleStack, useLoupe } from '../chunk-
|
|
1
|
+
export { CanvasLoupe, DomLoupe, LOUPE_DEFAULTS, LoupeBubble, TrialLoupe, drawCanvasLens, lensCamera, lensSourceRect, resolveLoupe, sampleStack, useLoupe } from '../chunk-TJ7QY3OC.js';
|
|
2
2
|
import '../chunk-CTRKTLYZ.js';
|
|
3
3
|
import '../chunk-2AYGEN57.js';
|
|
4
4
|
import '../chunk-CQLQPQ4P.js';
|
|
5
|
-
import '../chunk-DG2IFMLA.js';
|
|
6
5
|
//# sourceMappingURL=index.js.map
|
|
7
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import 'react';
|
|
3
|
-
import 'react/jsx-runtime';
|
|
1
|
+
export { ComputeFitViewOptions, FALLBACK_FIT_VIEW, IndicatorStyle, MinimapCanvas, MinimapCanvasProps, MinimapFit, SceneViewCanvas, SceneViewCanvasProps, SceneViewDrawOne, buildSceneViewCommands, computeFitView, computeIndicatorCommand, renderSceneToCanvas } from '@weasel-js/core';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { FALLBACK_FIT_VIEW, MinimapCanvas, SceneViewCanvas, buildSceneViewCommands, computeFitView, computeIndicatorCommand, renderSceneToCanvas } from '
|
|
1
|
+
export { FALLBACK_FIT_VIEW, MinimapCanvas, SceneViewCanvas, buildSceneViewCommands, computeFitView, computeIndicatorCommand, renderSceneToCanvas } from '@weasel-js/core';
|
|
2
2
|
//# sourceMappingURL=weasel-canvas.js.map
|
|
3
3
|
//# sourceMappingURL=weasel-canvas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"weasel-canvas.js"}
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"weasel-canvas.js","sourcesContent":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { ToolPrefLeaf, ToolPrefGroup, ToolsApi } from '@weasel-js/core';
|
|
3
|
+
export { ToolPref as BuiltinPref, ToolPrefBoolean as PrefBoolean, ToolPrefBooleanControl as PrefBooleanControl, ToolPrefColor as PrefColor, ToolPrefCustom as PrefCustom, ToolPrefEnum as PrefEnum, ToolPrefEnumControl as PrefEnumControl, ToolPrefEnumEncoding as PrefEnumEncoding, ToolPrefGroup as PrefGroup, ToolPrefKind as PrefKind, ToolPrefLeaf as PrefLeaf, ToolPrefNumber as PrefNumber, ToolPrefNumberControl as PrefNumberControl, ToolPrefNumberUnit as PrefNumberUnit, ToolPrefObject as PrefObject, ToolPrefPaint as PrefPaint, ToolPrefString as PrefString, ToolPrefStringControl as PrefStringControl } from '@weasel-js/core';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ReactNode, CSSProperties, ButtonHTMLAttributes, ReactElement, KeyboardEvent, RefObject, PointerEvent, RefCallback } from 'react';
|
|
6
6
|
export { LayerStack, LayerStackItem, LayerStackProps } from '../ui/layers/index.js';
|
|
7
|
-
export { a as PrefRenderContext, P as PrefRenderer } from '../_dts/PrefsForm.d-
|
|
7
|
+
export { a as PrefRenderContext, P as PrefRenderer } from '../_dts/PrefsForm.d-DDHFANkc.js';
|
|
8
8
|
import { TextFieldProps, ValidationResult, CheckboxProps as CheckboxProps$1, SwitchProps as SwitchProps$1, TabProps as TabProps$1, TabListProps as TabListProps$1, TabPanelProps as TabPanelProps$1, TabsProps as TabsProps$1, RadioProps as RadioProps$1, RadioGroupProps as RadioGroupProps$1, NumberFieldProps as NumberFieldProps$1, SelectProps as SelectProps$1, ListBoxItemProps, ComboBoxProps as ComboBoxProps$1, SliderProps as SliderProps$1, ModalOverlayProps, DialogProps as DialogProps$1, PopoverProps } from 'react-aria-components';
|
|
9
9
|
export { DialogTrigger as CalloutTrigger } from 'react-aria-components';
|
|
10
10
|
|
|
@@ -136,18 +136,6 @@ declare function Icon({ name, className, size, label }: IconProps & {
|
|
|
136
136
|
name: IconName;
|
|
137
137
|
}): react_jsx_runtime.JSX.Element;
|
|
138
138
|
|
|
139
|
-
/** Holds the set of available modes and which one is active, and notifies
|
|
140
|
-
* subscribers when that changes. `getVersion` is a monotonic counter for
|
|
141
|
-
* render-cache invalidation. Unknown mode ids throw rather than being
|
|
142
|
-
* ignored. */
|
|
143
|
-
interface ModeRegistry {
|
|
144
|
-
current(): ModeDefinition;
|
|
145
|
-
setMode(id: string): void;
|
|
146
|
-
byId(id: string): ModeDefinition;
|
|
147
|
-
getVersion(): number;
|
|
148
|
-
subscribe(listener: () => void): () => void;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
139
|
/** Props for {@link ActionBar}. */
|
|
152
140
|
interface ActionBarProps {
|
|
153
141
|
/** Group key — only actions with `action.group === group` are rendered. */
|
|
@@ -982,6 +970,69 @@ declare function DataGrid<Row extends {
|
|
|
982
970
|
id: string;
|
|
983
971
|
}>(props: DataGridProps<Row>): react_jsx_runtime.JSX.Element;
|
|
984
972
|
|
|
973
|
+
/** Which way the mark points when the section is closed. */
|
|
974
|
+
type DisclosureDirection = 'right' | 'down';
|
|
975
|
+
/** Props for `<Disclosure>`. */
|
|
976
|
+
interface DisclosureProps {
|
|
977
|
+
/** Whether the section it controls is open. The consumer owns this. */
|
|
978
|
+
open: boolean;
|
|
979
|
+
onToggle: () => void;
|
|
980
|
+
/**
|
|
981
|
+
* Names the section, for a screen reader. The control has no text of its
|
|
982
|
+
* own, so without this it announces as an unlabeled button.
|
|
983
|
+
*/
|
|
984
|
+
label: string;
|
|
985
|
+
/**
|
|
986
|
+
* `id` of the element this expands. Sets `aria-controls`, which lets a
|
|
987
|
+
* screen reader move to the revealed content.
|
|
988
|
+
*/
|
|
989
|
+
controls?: string;
|
|
990
|
+
/** Which way the closed mark points. `'right'` (default) rotates down when
|
|
991
|
+
* open; `'down'` rotates up. */
|
|
992
|
+
direction?: DisclosureDirection;
|
|
993
|
+
/** Mark size in px. The hit target is at least 20px and grows with it.
|
|
994
|
+
* Default 12. */
|
|
995
|
+
size?: number;
|
|
996
|
+
disabled?: boolean;
|
|
997
|
+
className?: string;
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* The twisty on a collapsible section: a triangle that turns as it opens.
|
|
1001
|
+
*
|
|
1002
|
+
* Presentational — it holds no open/closed state and renders no children.
|
|
1003
|
+
* The consumer owns the state and the panel; this is the control that toggles
|
|
1004
|
+
* it, and `aria-expanded` is what ties the two together.
|
|
1005
|
+
*
|
|
1006
|
+
* Three things it settles that a hand-rolled twisty keeps getting wrong. The
|
|
1007
|
+
* mark is drawn rather than typed, because `--wzl-font-ui` carries no ▸/▾ and
|
|
1008
|
+
* a text glyph falls back to whatever the system offers at whatever size that
|
|
1009
|
+
* font renders it — around 6px against 13px body text, which reads as dirt on
|
|
1010
|
+
* the screen. The hit target is larger than the mark. And it is a sibling of
|
|
1011
|
+
* the row's label rather than a child, so clicking to expand does not actuate
|
|
1012
|
+
* the label's own control.
|
|
1013
|
+
*
|
|
1014
|
+
* Deliberately not part of the icon register, on the same grounds as
|
|
1015
|
+
* `DragHandleGlyph`: that register is outline strokes at a fixed weight, and
|
|
1016
|
+
* `base.mjs` rejects a solid triangle in it by name. A disclosure mark is
|
|
1017
|
+
* filled.
|
|
1018
|
+
*/
|
|
1019
|
+
declare function Disclosure({ open, onToggle, label, controls, direction, size, disabled, className, }: DisclosureProps): react_jsx_runtime.JSX.Element;
|
|
1020
|
+
/** Props for `<DisclosureRow>`. */
|
|
1021
|
+
interface DisclosureRowProps extends Omit<DisclosureProps, 'className'> {
|
|
1022
|
+
/** The row's own content — a label, a checkbox, a count. */
|
|
1023
|
+
children: ReactNode;
|
|
1024
|
+
className?: string;
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* A `<Disclosure>` and a row of content beside it, laid out so the twisty
|
|
1028
|
+
* leads and the content takes the rest.
|
|
1029
|
+
*
|
|
1030
|
+
* The layout is the point: the twisty sits *outside* whatever the row puts in
|
|
1031
|
+
* it, so a row whose content is a `<label>` wrapping a checkbox stays
|
|
1032
|
+
* clickable as a label without the twisty actuating it.
|
|
1033
|
+
*/
|
|
1034
|
+
declare function DisclosureRow({ children, className, ...twisty }: DisclosureRowProps): react_jsx_runtime.JSX.Element;
|
|
1035
|
+
|
|
985
1036
|
/** Props for `<DragHandleGlyph>`. */
|
|
986
1037
|
interface DragHandleGlyphProps {
|
|
987
1038
|
/** Height in px; width scales with it. Default 16. */
|
|
@@ -1586,6 +1637,67 @@ interface ToolGroupProps {
|
|
|
1586
1637
|
*/
|
|
1587
1638
|
declare function ToolGroup(props: ToolGroupProps): react_jsx_runtime.JSX.Element;
|
|
1588
1639
|
|
|
1640
|
+
/** The full vocabulary of capability tags shipped in the default preset.
|
|
1641
|
+
* Apps and other consumers can add their own tags; this list is what
|
|
1642
|
+
* `weasel-modes` itself uses. */
|
|
1643
|
+
declare const ALL_TAGS: readonly ["navigation", "creates-selection", "creates-paths", "creates-shapes", "creates-text", "edits-anchors", "edits-text", "transforms-selection", "samples-color", "applies-fill", "edits-page"];
|
|
1644
|
+
/** One capability a tool or contribution declares, and a mode allows. Any
|
|
1645
|
+
* string is accepted so apps can add tags of their own; `ALL_TAGS` is the
|
|
1646
|
+
* set this package ships. */
|
|
1647
|
+
type CapabilityTag = (typeof ALL_TAGS)[number] | (string & {});
|
|
1648
|
+
|
|
1649
|
+
/** How a mode tints the workspace — the area around the page — so the user
|
|
1650
|
+
* can see at a glance which mode is active. */
|
|
1651
|
+
interface WorkspaceVisual {
|
|
1652
|
+
tint?: string;
|
|
1653
|
+
gradient?: 'top-down' | 'bottom-up';
|
|
1654
|
+
intensity?: number;
|
|
1655
|
+
}
|
|
1656
|
+
/**
|
|
1657
|
+
* A mode: an app-level editing context that narrows which tools are usable and
|
|
1658
|
+
* how the workspace looks. Tools live inside modes; a tool is never "in" one.
|
|
1659
|
+
*
|
|
1660
|
+
* `kind` picks the lifecycle. A `soft` mode (path-edit, isolation, text-edit)
|
|
1661
|
+
* is a scoped context with no commit ceremony — every edit inside it is
|
|
1662
|
+
* independently undoable and `exit` is non-destructive. A `strict` mode
|
|
1663
|
+
* (free-transform, crop) is a transaction: the whole session collapses to one
|
|
1664
|
+
* undoable step and leaving requires an explicit `commit` or `cancel`.
|
|
1665
|
+
*/
|
|
1666
|
+
interface ModeDefinition {
|
|
1667
|
+
id: string;
|
|
1668
|
+
kind: 'soft' | 'strict';
|
|
1669
|
+
/** Capability tags this mode allows beyond IMPLICIT_TAGS. */
|
|
1670
|
+
allows: CapabilityTag[];
|
|
1671
|
+
/** When true, out-of-target objects dim at the renderer layer. */
|
|
1672
|
+
scoping: boolean;
|
|
1673
|
+
workspace?: WorkspaceVisual;
|
|
1674
|
+
entry?: {
|
|
1675
|
+
shortcut?: string;
|
|
1676
|
+
trigger?: 'double-click-target';
|
|
1677
|
+
};
|
|
1678
|
+
exit?: {
|
|
1679
|
+
shortcut?: string;
|
|
1680
|
+
};
|
|
1681
|
+
commit?: {
|
|
1682
|
+
shortcut?: string;
|
|
1683
|
+
};
|
|
1684
|
+
cancel?: {
|
|
1685
|
+
shortcut?: string;
|
|
1686
|
+
};
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
/** Holds the set of available modes and which one is active, and notifies
|
|
1690
|
+
* subscribers when that changes. `getVersion` is a monotonic counter for
|
|
1691
|
+
* render-cache invalidation. Unknown mode ids throw rather than being
|
|
1692
|
+
* ignored. */
|
|
1693
|
+
interface ModeRegistry {
|
|
1694
|
+
current(): ModeDefinition;
|
|
1695
|
+
setMode(id: string): void;
|
|
1696
|
+
byId(id: string): ModeDefinition;
|
|
1697
|
+
getVersion(): number;
|
|
1698
|
+
subscribe(listener: () => void): () => void;
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1589
1701
|
interface ShortcutInput {
|
|
1590
1702
|
key: string | readonly string[];
|
|
1591
1703
|
mod?: boolean;
|
|
@@ -1799,6 +1911,12 @@ type NumberFieldProps = Omit<NumberFieldProps$1, 'children' | 'className'> & {
|
|
|
1799
1911
|
/** Native input placeholder — e.g. `'Mixed'` for a multi-selection
|
|
1800
1912
|
* editor with no shared value. */
|
|
1801
1913
|
placeholder?: string;
|
|
1914
|
+
/**
|
|
1915
|
+
* `'fill'` (the default) takes the width of whatever row the field sits in.
|
|
1916
|
+
* `'fit'` sizes it to `--wzl-number-field-width` (`9ch` by default) plus its
|
|
1917
|
+
* own chrome, rather than to the input's 20-character intrinsic width.
|
|
1918
|
+
*/
|
|
1919
|
+
width?: 'fill' | 'fit';
|
|
1802
1920
|
className?: string;
|
|
1803
1921
|
};
|
|
1804
1922
|
/**
|
|
@@ -1821,9 +1939,28 @@ declare const NumberField: react.ForwardRefExoticComponent<Omit<NumberFieldProps
|
|
|
1821
1939
|
/** Native input placeholder — e.g. `'Mixed'` for a multi-selection
|
|
1822
1940
|
* editor with no shared value. */
|
|
1823
1941
|
placeholder?: string;
|
|
1942
|
+
/**
|
|
1943
|
+
* `'fill'` (the default) takes the width of whatever row the field sits in.
|
|
1944
|
+
* `'fit'` sizes it to `--wzl-number-field-width` (`9ch` by default) plus its
|
|
1945
|
+
* own chrome, rather than to the input's 20-character intrinsic width.
|
|
1946
|
+
*/
|
|
1947
|
+
width?: "fill" | "fit";
|
|
1824
1948
|
className?: string;
|
|
1825
1949
|
} & react.RefAttributes<HTMLInputElement>>;
|
|
1826
1950
|
|
|
1951
|
+
/** The `portalContainer` prop every weasel overlay accepts. */
|
|
1952
|
+
interface OverlayPortalProps {
|
|
1953
|
+
/**
|
|
1954
|
+
* Where the overlay's portal mounts. Defaults to the nearest ancestor of
|
|
1955
|
+
* the overlay's own position that carries a weasel theme, so the overlay
|
|
1956
|
+
* resolves the same `--wzl-*` tokens as the control it belongs to. Pass
|
|
1957
|
+
* `null` for `document.body`.
|
|
1958
|
+
*/
|
|
1959
|
+
portalContainer?: Element | null;
|
|
1960
|
+
}
|
|
1961
|
+
/** React Aria props minus the portal key a weasel overlay owns. */
|
|
1962
|
+
type WithoutPortalTarget<T> = Omit<T, 'UNSTABLE_portalContainer'>;
|
|
1963
|
+
|
|
1827
1964
|
/** One option in a {@link Select}'s `options` list. */
|
|
1828
1965
|
type SelectOption = {
|
|
1829
1966
|
value: string;
|
|
@@ -1855,8 +1992,14 @@ type SelectProps<T extends Key$1 = string> = Omit<SelectProps$1<object>, 'childr
|
|
|
1855
1992
|
selectedKey?: T | null;
|
|
1856
1993
|
defaultSelectedKey?: T;
|
|
1857
1994
|
onSelectionChange?: (key: T) => void;
|
|
1995
|
+
/**
|
|
1996
|
+
* `'fill'` (the default) takes the width of whatever row the select sits in.
|
|
1997
|
+
* `'fit'` sizes the trigger to its widest option, so it neither swallows a
|
|
1998
|
+
* toolbar's slack nor changes width as the selection moves.
|
|
1999
|
+
*/
|
|
2000
|
+
width?: 'fill' | 'fit';
|
|
1858
2001
|
className?: string;
|
|
1859
|
-
};
|
|
2002
|
+
} & OverlayPortalProps;
|
|
1860
2003
|
/**
|
|
1861
2004
|
* Form select wrapping React Aria's Select. Pass either `options` for a
|
|
1862
2005
|
* quick declarative render or `children` of `<SelectItem>` for control over
|
|
@@ -1907,8 +2050,14 @@ type ComboBoxProps<T extends Key = string> = Omit<ComboBoxProps$1<object>, 'chil
|
|
|
1907
2050
|
defaultSelectedKey?: T;
|
|
1908
2051
|
onSelectionChange?: (key: T | null) => void;
|
|
1909
2052
|
emptyLabel?: ReactNode;
|
|
2053
|
+
/**
|
|
2054
|
+
* `'fill'` (the default) takes the width of whatever row the combo box sits
|
|
2055
|
+
* in. `'fit'` sizes the input to its widest option, so it neither swallows a
|
|
2056
|
+
* toolbar's slack nor cuts a selection off once one is made.
|
|
2057
|
+
*/
|
|
2058
|
+
width?: 'fill' | 'fit';
|
|
1910
2059
|
className?: string;
|
|
1911
|
-
};
|
|
2060
|
+
} & OverlayPortalProps;
|
|
1912
2061
|
/**
|
|
1913
2062
|
* Filterable single-select wrapping React Aria's ComboBox. The user can
|
|
1914
2063
|
* type to filter; selection commits to `onSelectionChange`. When no value
|
|
@@ -1940,7 +2089,7 @@ type RangeSliderProps = Omit<SliderProps$1, 'children' | 'className'> & {
|
|
|
1940
2089
|
declare function RangeSlider(props: RangeSliderProps): react_jsx_runtime.JSX.Element;
|
|
1941
2090
|
|
|
1942
2091
|
/** Props for {@link Dialog}, on top of React Aria's `ModalOverlay` props. */
|
|
1943
|
-
type DialogProps = Omit<ModalOverlayProps
|
|
2092
|
+
type DialogProps = Omit<WithoutPortalTarget<ModalOverlayProps>, 'children' | 'className'> & OverlayPortalProps & {
|
|
1944
2093
|
/** Heading rendered in the dialog's default header. Omit when supplying
|
|
1945
2094
|
* a custom `header` slot via children. */
|
|
1946
2095
|
title?: ReactNode;
|
|
@@ -1971,7 +2120,7 @@ declare function Dialog(props: DialogProps): react_jsx_runtime.JSX.Element;
|
|
|
1971
2120
|
type CalloutTone = 'info' | 'warning' | 'danger';
|
|
1972
2121
|
|
|
1973
2122
|
/** Props for {@link Callout}, on top of React Aria's `Popover` props. */
|
|
1974
|
-
type CalloutProps = Omit<PopoverProps
|
|
2123
|
+
type CalloutProps = Omit<WithoutPortalTarget<PopoverProps>, 'children' | 'className' | 'isNonModal' | 'triggerRef'> & OverlayPortalProps & {
|
|
1975
2124
|
children?: ReactNode;
|
|
1976
2125
|
className?: string;
|
|
1977
2126
|
/** Optional heading rendered above the body. */
|
|
@@ -2385,7 +2534,7 @@ interface ReorderDragHandlers {
|
|
|
2385
2534
|
* drop. A drop that would leave a contiguous block where it already is does
|
|
2386
2535
|
* not call `onReorder`.
|
|
2387
2536
|
*
|
|
2388
|
-
* A press opens
|
|
2537
|
+
* A press opens a `startThresholdDrag` on the *container*, which owns the
|
|
2389
2538
|
* rest of the gesture: a drag that leaves the list still tracks, a release
|
|
2390
2539
|
* anywhere still drops, and a release the window never delivered still ends
|
|
2391
2540
|
* the drag. The container is the origin rather than the row because rows come
|
|
@@ -2466,5 +2615,5 @@ declare const MINUS_SIGN = "\u2212";
|
|
|
2466
2615
|
*/
|
|
2467
2616
|
declare function formatNumber(value: number, options?: Intl.NumberFormatOptions): string;
|
|
2468
2617
|
|
|
2469
|
-
export { ActionBar, ActionsBar, Badge, Button, Callout, Checkbox, ComboBox, ComboBoxItem, CurveEditor, DataGrid, Dialog, DragHandleGlyph, EDGE_PROFILES, Field, ICON_PATHS, Icon, Input, KeyCap, KeySequence, MINUS_SIGN, NumberField, OptionsBar, Plot2D, PointPlotter, Powerline,
|
|
2470
|
-
export type { ActionBarProps, ActionsBarItem, ActionsBarProps, ActionsBarSize, ActionsBarVariant, AddPointMode, AnchorRenderProps, AxesSettings, BadgeProps, BadgeShape, BadgeSize, BadgeTone, BadgeVariant, BoundsCtx, BuiltInEdgeName, ButtonProps, ButtonSize, ButtonVariant, CalloutProps, CheckboxProps, ChromaCurve, ChromaCurvePoint, ComboBoxItemProps, ComboBoxOption, ComboBoxProps, ControlPoint, CurveDomain, CurveEditorProps, DataGridColumn, DataGridProps, DialogProps, DragHandleGlyphProps, EdgeCap, EdgeProfile, EndpointMode, FieldOrientation, FieldProps, FillSettings, GradientTrackOpts, GridSettings, IconName, IconProps, InputProps, InterpolationMode, KeyCapProps, KeyCapVariant, KeySequenceProps, KeySpec, KeycapKind, LayerListItem, LogicalMod, LogicalModSpec, NumberFieldProps, OptionsBarItem, OptionsBarProps, OptionsBarSize, OptionsBarVariant, Platform, Plot2DCoords, Plot2DHandle, Plot2DProps, PointPlotterProps, PowerlineProps, PowerlineSegment, RadioGroupProps, RadioProps, RangeSliderProps, ReorderDragHandlers, ReorderDragState, RovingItem, RovingTabIndex, SelectItemProps, SelectOption, SelectProps, SidebarPanelProps, SidebarProps, SliderProps, SwitchProps, TabListProps, TabPanelProps, TabProps, TabsProps, Thumb, ThumbRenderCtx, ThumbShape, ToggleBarItem, ToggleBarProps, ToggleBarSize, ToggleBarVariant, ToolButtonProps, ToolGroupProps, ToolPaletteProps, TrackCtx, UseReorderDragListOptions, UseRovingTabIndexOptions };
|
|
2618
|
+
export { ActionBar, ActionsBar, Badge, Button, Callout, Checkbox, ComboBox, ComboBoxItem, CurveEditor, DataGrid, Dialog, Disclosure, DisclosureRow, DragHandleGlyph, EDGE_PROFILES, Field, ICON_PATHS, Icon, Input, KeyCap, KeySequence, MINUS_SIGN, NumberField, OptionsBar, Plot2D, PointPlotter, Powerline, Radio, RadioGroup, RangeSlider, Select, SelectItem, Sidebar, SidebarPanel, Slider, Switch, Tab, TabList, TabPanel, Tabs, ToggleBar, ToolButton, ToolGroup, ToolPalette, chromaAt, detectPlatform, dlog, fieldClasses, formatNumber, formatShortcut, formatShortcutParts, inferKeycapKind, isDebugEnabled, isPrefLeaf, keyGlyph, keySpecFromKey, keySpecsFromMods, oklchToHex, paintGradientTrack, prefValueAtPath, useReorderDragList, useRovingTabIndex, visiblePrefSubtree };
|
|
2619
|
+
export type { ActionBarProps, ActionsBarItem, ActionsBarProps, ActionsBarSize, ActionsBarVariant, AddPointMode, AnchorRenderProps, AxesSettings, BadgeProps, BadgeShape, BadgeSize, BadgeTone, BadgeVariant, BoundsCtx, BuiltInEdgeName, ButtonProps, ButtonSize, ButtonVariant, CalloutProps, CheckboxProps, ChromaCurve, ChromaCurvePoint, ComboBoxItemProps, ComboBoxOption, ComboBoxProps, ControlPoint, CurveDomain, CurveEditorProps, DataGridColumn, DataGridProps, DialogProps, DisclosureDirection, DisclosureProps, DisclosureRowProps, DragHandleGlyphProps, EdgeCap, EdgeProfile, EndpointMode, FieldOrientation, FieldProps, FillSettings, GradientTrackOpts, GridSettings, IconName, IconProps, InputProps, InterpolationMode, KeyCapProps, KeyCapVariant, KeySequenceProps, KeySpec, KeycapKind, LayerListItem, LogicalMod, LogicalModSpec, NumberFieldProps, OptionsBarItem, OptionsBarProps, OptionsBarSize, OptionsBarVariant, Platform, Plot2DCoords, Plot2DHandle, Plot2DProps, PointPlotterProps, PowerlineProps, PowerlineSegment, RadioGroupProps, RadioProps, RangeSliderProps, ReorderDragHandlers, ReorderDragState, RovingItem, RovingTabIndex, SelectItemProps, SelectOption, SelectProps, SidebarPanelProps, SidebarProps, SliderProps, SwitchProps, TabListProps, TabPanelProps, TabProps, TabsProps, Thumb, ThumbRenderCtx, ThumbShape, ToggleBarItem, ToggleBarProps, ToggleBarSize, ToggleBarVariant, ToolButtonProps, ToolGroupProps, ToolPaletteProps, TrackCtx, UseReorderDragListOptions, UseRovingTabIndexOptions };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import '../chunk-SBXNQW4G.js';
|
|
2
|
-
export { m as ActionBar,
|
|
3
|
-
import '../chunk-DG2IFMLA.js';
|
|
2
|
+
export { m as ActionBar, r8 as ActionsBar, Lt as Badge, a3 as Button, g3 as Callout, l5 as CalloutTrigger, o as Checkbox, g2 as ComboBox, v3 as ComboBoxItem, L as CurveEditor, s2 as DataGrid, l3 as Dialog, r5 as Disclosure, i2 as DisclosureRow, n4 as DragHandleGlyph, Je as EDGE_PROFILES, n2 as Field, t as ICON_PATHS, r as Icon, u2 as Input, s3 as KeyCap, c2 as KeySequence, c3 as LayerStack, e2 as MINUS_SIGN, f2 as NumberField, r7 as OptionsBar, f3 as Plot2D, n7 as PointPlotter, r9 as Powerline, u3 as Radio, l as RadioGroup, l2 as RangeSlider, g as Select, b2 as SelectItem, n5 as Sidebar, s4 as SidebarPanel, y2 as Slider, a2 as Switch, c4 as Tab, s5 as TabList, l4 as TabPanel, o4 as Tabs, r6 as ToggleBar, o3 as ToolButton, n6 as ToolGroup, _2 as ToolPalette, Jn as chromaAt, u4 as detectPlatform, a as dlog, r3 as fieldClasses, t3 as formatNumber, d2 as formatShortcut, u5 as formatShortcutParts, o2 as inferKeycapKind, i as isDebugEnabled, t2 as isPrefLeaf, e as keyGlyph, p2 as keySpecFromKey, d as keySpecsFromMods, qn as oklchToHex, v2 as paintGradientTrack, n3 as prefValueAtPath, s as useReorderDragList, a4 as useRovingTabIndex, r4 as visiblePrefSubtree } from '../chunk-MHAGC6VD.js';
|
|
4
3
|
//# sourceMappingURL=weasel-ui.js.map
|
|
5
4
|
//# sourceMappingURL=weasel-ui.js.map
|
package/dist/primitives/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export { FloatingPanel, JobProgress, Legend, Sidebar } from '../chunk-
|
|
2
|
-
export { FpsMeter, ScaleIndicator, StatusBar, Toolbar, ZoomControl } from '../chunk-
|
|
1
|
+
export { FloatingPanel, JobProgress, Legend, Sidebar } from '../chunk-QAGAHJKZ.js';
|
|
2
|
+
export { FpsMeter, ScaleIndicator, StatusBar, Toolbar, ZoomControl } from '../chunk-2RQPGOQF.js';
|
|
3
3
|
import '../chunk-SBXNQW4G.js';
|
|
4
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-MHAGC6VD.js';
|
|
5
5
|
import '../chunk-CQLQPQ4P.js';
|
|
6
|
-
import '../chunk-DG2IFMLA.js';
|
|
7
6
|
//# sourceMappingURL=index.js.map
|
|
8
7
|
//# sourceMappingURL=index.js.map
|
package/dist/state/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
export { C as CURRENT_DOCUMENT_VERSION, L as LabStore, a as LabStoreActions, b as LabStoreContext, c as LabStoreProvider, T as TrialIdContext, d as TrialIdProvider, e as createLabStore, f as createMemoryAdapter, l as labDocumentKey, g as localStorageAdapter, n as noneAdapter, q as quarantineKey, s as sessionStorageAdapter, u as urlHashAdapter, h as useLabStore, i as useTrialId, j as useTrialState } from '../_dts/useTrialState-
|
|
2
|
-
import { S as SerializedTrial, I as InstrumentSerializers, T as TrialRecord, U as UndoStack, a as StorageAdapter } from '../_dts/types-
|
|
3
|
-
export { C as CreateLabStoreOptions, L as LabDocument, b as LabStoreState, M as Migration, c as SavedSnapshot, d as TrialStateHandle, e as UndockedPanel, f as UndockedPanels, g as dockPanel, p as panelKey, u as undockPanel } from '../_dts/types-
|
|
1
|
+
export { C as CURRENT_DOCUMENT_VERSION, L as LabStore, a as LabStoreActions, b as LabStoreContext, c as LabStoreProvider, T as TrialIdContext, d as TrialIdProvider, e as createLabStore, f as createMemoryAdapter, l as labDocumentKey, g as localStorageAdapter, n as noneAdapter, q as quarantineKey, s as sessionStorageAdapter, u as urlHashAdapter, h as useLabStore, i as useTrialId, j as useTrialState } from '../_dts/useTrialState-D6Vb3T-g.js';
|
|
2
|
+
import { S as SerializedTrial, I as InstrumentSerializers, T as TrialRecord, U as UndoStack, a as StorageAdapter } from '../_dts/types-BP2OCcpg.js';
|
|
3
|
+
export { C as CreateLabStoreOptions, L as LabDocument, b as LabStoreState, M as Migration, c as SavedSnapshot, d as TrialStateHandle, e as UndockedPanel, f as UndockedPanels, g as dockPanel, p as panelKey, u as undockPanel } from '../_dts/types-BP2OCcpg.js';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
6
6
|
import 'zustand/vanilla';
|
|
7
|
+
import '../_dts/types-B9_zrHmb.js';
|
|
8
|
+
import '@weasel-js/core';
|
|
9
|
+
import '../_dts/PrefsForm.d-DDHFANkc.js';
|
|
7
10
|
|
|
8
11
|
/** The storage key a lab writes one of its buckets under. Namespaced by
|
|
9
12
|
* `storageKey` so two labs sharing an origin do not collide. */
|
package/dist/state/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { createLabStore } from '../chunk-
|
|
2
|
-
export { CURRENT_DOCUMENT_VERSION, createLabStore, createMemoryAdapter, decodeUrlHash, deserializeTrials, dockPanel, emptyUndoStack, encodeUrlHash, labDocumentKey, labStorageKey, localStorageAdapter, noneAdapter, panelKey, quarantineKey, serializeTrials, sessionStorageAdapter, undockPanel, urlHashAdapter, useTrialState } from '../chunk-
|
|
1
|
+
import { createLabStore } from '../chunk-5TROQVQ2.js';
|
|
2
|
+
export { CURRENT_DOCUMENT_VERSION, createLabStore, createMemoryAdapter, decodeUrlHash, deserializeTrials, dockPanel, emptyUndoStack, encodeUrlHash, labDocumentKey, labStorageKey, localStorageAdapter, noneAdapter, panelKey, quarantineKey, serializeTrials, sessionStorageAdapter, undockPanel, urlHashAdapter, useTrialState } from '../chunk-5TROQVQ2.js';
|
|
3
3
|
import { LabStoreProvider, TrialIdProvider } from '../chunk-2YILQ7Y5.js';
|
|
4
4
|
export { LabStoreContext, LabStoreProvider, TrialIdContext, TrialIdProvider, useLabStore, useTrialId } from '../chunk-2YILQ7Y5.js';
|
|
5
|
+
import '../chunk-E44SU6XS.js';
|
|
5
6
|
import { useRef } from 'react';
|
|
6
7
|
import { jsx } from 'react/jsx-runtime';
|
|
7
8
|
|
package/dist/state/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/state/SingletonExperiment.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/state/SingletonExperiment.tsx"],"names":[],"mappings":";;;;;;;;AAKA,IAAM,oBAAA,GAAuB,eAAA;AAoBtB,SAAS,2BAAA,CAAoC;AAAA,EAClD,EAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA,OAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAAA,EAA6C;AAC3C,EAAA,MAAM,QAAA,GAAW,OAAwB,IAAI,CAAA;AAC7C,EAAA,IAAI,QAAA,CAAS,YAAY,IAAA,EAAM;AAC7B,IAAA,MAAM,KAAA,GAAQ,cAAA,CAAe,EAAE,UAAA,EAAY,SAAS,CAAA;AACpD,IAAA,IAAI,CAAC,KAAA,CAAM,QAAA,EAAS,CAAE,MAAA,CAAO,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,EAAA,KAAO,EAAE,CAAA,EAAG;AACrD,MAAA,KAAA,CAAM,QAAA,GAAW,QAAA,CAAS;AAAA,QACxB,EAAA;AAAA,QACA,cAAA,EAAgB,oBAAA;AAAA,QAChB,MAAA,EAAQ,aAAA;AAAA,QACR,KAAA,EAAO,YAAA;AAAA,QACP,IAAA,EAAM,EAAE,IAAA,EAAM,CAAA,EAAG,GAAA,EAAK,EAAE,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAA,EAAE;AAAE,OACtC,CAAA;AAAA,IACH;AACA,IAAA,QAAA,CAAS,OAAA,GAAU,KAAA;AAAA,EACrB;AACA,EAAA,uBACE,GAAA,CAAC,gBAAA,EAAA,EAAiB,KAAA,EAAO,QAAA,CAAS,OAAA,EAChC,8BAAC,eAAA,EAAA,EAAgB,OAAA,EAAS,EAAA,EAAK,QAAA,EAAS,CAAA,EAC1C,CAAA;AAEJ","file":"index.js","sourcesContent":["import { type ReactNode, useRef } from 'react';\nimport { LabStoreProvider, TrialIdProvider } from './context';\nimport { createLabStore, type LabStore } from './store';\nimport type { StorageAdapter } from './types';\n\nconst SINGLETON_INSTRUMENT = '__singleton__';\n\n/** Props for `<SingletonExperimentProvider>`. */\nexport interface SingletonExperimentProviderProps<TS, TC> {\n /** Stable id for the synthetic trial; also doubles as the\n * TrialIdContext value. */\n id: string;\n initialConfig: TC;\n initialState: TS;\n storage: StorageAdapter;\n storageKey: string;\n children: ReactNode;\n}\n\n/**\n * One-trial `<Lab>` substitute for single-screen experiments. Mounts\n * a `LabStoreProvider` + `TrialIdProvider` with one synthetic\n * trial, so `useTrialState` works without going through the\n * full `<Lab instruments={...}>` runtime.\n */\nexport function SingletonExperimentProvider<TS, TC>({\n id,\n initialConfig,\n initialState,\n storage,\n storageKey,\n children,\n}: SingletonExperimentProviderProps<TS, TC>) {\n const storeRef = useRef<LabStore | null>(null);\n if (storeRef.current === null) {\n const store = createLabStore({ storageKey, storage });\n if (!store.getState().trials.some((w) => w.id === id)) {\n store.getState().addTrial({\n id,\n instrumentName: SINGLETON_INSTRUMENT,\n config: initialConfig,\n state: initialState,\n view: { zoom: 1, pan: { x: 0, y: 0 } },\n });\n }\n storeRef.current = store;\n }\n return (\n <LabStoreProvider store={storeRef.current}>\n <TrialIdProvider trialId={id}>{children}</TrialIdProvider>\n </LabStoreProvider>\n );\n}\n"]}
|