@weasel-js/labkit 1.6.0 → 1.7.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/_dts/{CanvasStackContext-DQgcH1ny.d.ts → CanvasStackContext-D2jnIwfk.d.ts} +1 -1
- package/dist/_dts/FloatingPanel-7j0IcXwz.d.ts +30 -0
- package/dist/_dts/{LayerList.d-2c9yup5Y.d.ts → LayerList.d-DiuEArKq.d.ts} +4 -4
- package/dist/_dts/PrefsRow.d-TOZ7BgD9.d.ts +79 -0
- package/dist/_dts/PropertyPanel.d-D-1paCbE.d.ts +141 -0
- package/dist/_dts/{Select.d-BchGMC2Y.d.ts → Select.d-Bensr_MT.d.ts} +15 -6
- package/dist/_dts/Stage-CCWfQQWM.d.ts +202 -0
- package/dist/_dts/index-B2Yj5aA0.d.ts +274 -0
- package/dist/_dts/{index-B0--8PEM.d.ts → index-CsYqUHD3.d.ts} +12 -13
- package/dist/_dts/{types-B7y8hX1D.d.ts → types-CRPSGFAp.d.ts} +33 -5
- package/dist/_dts/{frac-DTRq7Xpb.d.ts → types-CSm9jgol.d.ts} +700 -650
- package/dist/_dts/{useTrialState-CP4jfuKl.d.ts → useTrialState-CTZPgeZ7.d.ts} +2 -3
- package/dist/canvas/index.d.ts +40 -8
- package/dist/canvas/index.js +5 -3
- package/dist/chrome/index.d.ts +5 -6
- package/dist/chrome/index.js +9 -7
- package/dist/chunk-24W5VEJW.js +18 -0
- package/dist/chunk-24W5VEJW.js.map +1 -0
- package/dist/chunk-275JRRVD.js +728 -0
- package/dist/chunk-275JRRVD.js.map +1 -0
- package/dist/chunk-3RY6WL5T.js +38 -0
- package/dist/chunk-3RY6WL5T.js.map +1 -0
- package/dist/chunk-4LJSC7MB.js +143 -0
- package/dist/chunk-4LJSC7MB.js.map +1 -0
- package/dist/{chunk-3FI7Y4R4.js → chunk-7BO7HNGF.js} +5 -5
- package/dist/{chunk-3FI7Y4R4.js.map → chunk-7BO7HNGF.js.map} +1 -1
- package/dist/chunk-AWQG7FCC.js +19 -0
- package/dist/chunk-AWQG7FCC.js.map +1 -0
- package/dist/chunk-CZZPXUOU.js +3 -0
- package/dist/{chunk-SBXNQW4G.js.map → chunk-CZZPXUOU.js.map} +1 -1
- package/dist/{chunk-ZORVNOKX.js → chunk-FMK7UQ6V.js} +24 -145
- package/dist/chunk-FMK7UQ6V.js.map +1 -0
- package/dist/{chunk-BVL7Y574.js → chunk-FZ7YFQN7.js} +26 -10
- package/dist/chunk-FZ7YFQN7.js.map +1 -0
- package/dist/{chunk-USO6TERP.js → chunk-GOZLNM4L.js} +11 -9
- package/dist/chunk-GOZLNM4L.js.map +1 -0
- package/dist/{chunk-H5VIV7MQ.js → chunk-I5DUQ5HM.js} +88 -82
- package/dist/chunk-I5DUQ5HM.js.map +1 -0
- package/dist/chunk-J7OWWTCW.js +143 -0
- package/dist/chunk-J7OWWTCW.js.map +1 -0
- package/dist/{chunk-H6ZAOWNE.js → chunk-JVBYV6TL.js} +3 -3
- package/dist/{chunk-H6ZAOWNE.js.map → chunk-JVBYV6TL.js.map} +1 -1
- package/dist/{chunk-VQ47KWD5.js → chunk-KMJ7RWD3.js} +18 -7
- package/dist/chunk-KMJ7RWD3.js.map +1 -0
- package/dist/{chunk-ERFMC6WU.js → chunk-M7HP3FTK.js} +20 -11
- package/dist/chunk-M7HP3FTK.js.map +1 -0
- package/dist/chunk-MIM5R4ZT.js +14972 -0
- package/dist/chunk-MIM5R4ZT.js.map +1 -0
- package/dist/{chunk-HFRE4QQV.js → chunk-T5IBSPAM.js} +96 -32
- package/dist/chunk-T5IBSPAM.js.map +1 -0
- package/dist/chunk-UNAZSLWE.js +294 -0
- package/dist/chunk-UNAZSLWE.js.map +1 -0
- package/dist/{chunk-RS3HRQWU.js → chunk-WPLAANH4.js} +4 -3
- package/dist/chunk-WPLAANH4.js.map +1 -0
- package/dist/{chunk-AWH3SRPW.js → chunk-Y23G2VZL.js} +5 -37
- package/dist/chunk-Y23G2VZL.js.map +1 -0
- package/dist/{chunk-MOLIUNVH.js → chunk-YT75VYRD.js} +4 -4
- package/dist/{chunk-MOLIUNVH.js.map → chunk-YT75VYRD.js.map} +1 -1
- package/dist/chunk-ZIFPHIWZ.js +302 -0
- package/dist/chunk-ZIFPHIWZ.js.map +1 -0
- package/dist/config/index.d.ts +48 -40
- package/dist/config/index.js +4 -5
- package/dist/controls/index.d.ts +91 -7
- package/dist/controls/index.js +5 -4
- package/dist/dragdrop/index.d.ts +9 -7
- package/dist/dragdrop/index.js +3 -2
- package/dist/index.d.ts +294 -82
- package/dist/index.js +425 -402
- package/dist/index.js.map +1 -1
- package/dist/layers/index.d.ts +4 -5
- package/dist/layers/index.js +2 -1
- package/dist/loupe/index.d.ts +20 -17
- package/dist/loupe/index.js +5 -3
- package/dist/overview/index.d.ts +56 -0
- package/dist/overview/index.js +289 -0
- package/dist/overview/index.js.map +1 -0
- package/dist/passthrough/weasel-ui.d.ts +239 -69
- package/dist/passthrough/weasel-ui.js +3 -2
- package/dist/primitives/index.d.ts +5 -204
- package/dist/primitives/index.js +6 -4
- package/dist/state/index.d.ts +8 -8
- package/dist/state/index.js +4 -5
- package/dist/state/index.js.map +1 -1
- package/dist/styles.css +152 -82
- package/dist/undo/index.d.ts +4 -4
- package/package.json +17 -12
- package/src/annotations/AnnotationOverlay.tsx +2 -2
- package/src/annotations/Annotations.less +0 -10
- package/src/annotations/MarkList.tsx +4 -8
- package/src/annotations/index.ts +1 -0
- package/src/annotations/paint.test.ts +3 -14
- package/src/annotations/paint.ts +3 -19
- package/src/annotations/store.test.ts +26 -0
- package/src/annotations/store.ts +25 -6
- package/src/annotations/svgNodes.test.ts +6 -9
- package/src/annotations/svgNodes.ts +3 -3
- package/src/annotations/toolMap.test.ts +37 -2
- package/src/annotations/toolMap.ts +13 -0
- package/src/annotations/types.ts +27 -0
- package/src/canvas/AGENTS.md +9 -10
- package/src/canvas/CameraInput.test.tsx +136 -0
- package/src/canvas/CameraInput.tsx +322 -0
- package/src/canvas/CanvasStack.tsx +47 -58
- package/src/canvas/LinkedCursor.less +16 -0
- package/src/canvas/LinkedCursor.tsx +54 -0
- package/src/canvas/Stage.test.tsx +33 -4
- package/src/canvas/Stage.tsx +47 -37
- package/src/canvas/cameraRegistry.test.ts +55 -0
- package/src/canvas/cameraRegistry.ts +86 -0
- package/src/canvas/cameraView.test.ts +60 -0
- package/src/canvas/cameraView.ts +61 -0
- package/src/canvas/cameraZoom.test.ts +46 -0
- package/src/canvas/cameraZoom.ts +24 -0
- package/src/canvas/index.ts +23 -2
- package/src/canvas/sharedScope.test.tsx +94 -0
- package/src/chrome/ChromeRegions.stories.tsx +1 -0
- package/src/chrome/regions/PaletteRegion.less +0 -7
- package/src/chrome/regions/SidebarRegion.less +12 -2
- package/src/chrome/regions/SidebarRegion.test.tsx +9 -2
- package/src/config/builder.test.ts +2 -1
- package/src/config/builder.ts +15 -8
- package/src/config/entry.test.ts +3 -1
- package/src/config/fromConfigField.test.ts +14 -0
- package/src/config/fromConfigField.ts +19 -4
- package/src/config/index.ts +4 -1
- package/src/config/path.ts +2 -5
- package/src/config/resolve.ts +15 -1
- package/src/config/sectionTree.test.ts +12 -6
- package/src/config/sectionTree.ts +15 -5
- package/src/config/types.ts +34 -9
- package/src/controls/ControlPanel.less +1 -1
- package/src/controls/ControlPanel.stories.tsx +3 -2
- package/src/controls/ControlPanel.test.tsx +76 -13
- package/src/controls/ControlPanel.tsx +80 -11
- package/src/controls/inDialog.test.tsx +18 -0
- package/src/controls/inDialog.tsx +2 -10
- package/src/index.test.ts +1 -1
- package/src/index.ts +23 -5
- package/src/instrument/SineWave.smoke.test.tsx +2 -0
- package/src/instrument/types.ts +10 -1
- package/src/lab/Lab.nebula.test.tsx +11 -2
- package/src/lab/Lab.test.tsx +3 -1
- package/src/lab/Lab.tsx +87 -76
- package/src/lab/{LabFit.stories.less → LabFit.browser.test.less} +1 -1
- package/src/lab/{LabFit.stories.tsx → LabFit.browser.test.tsx} +41 -63
- package/src/lab/LabFullChrome.stories.tsx +1 -0
- package/src/lab/LabHeader.test.tsx +24 -14
- package/src/lab/LabHeader.tsx +11 -12
- package/src/lab/LabShell.less +8 -17
- package/src/lab/LabSwitcher.less +6 -6
- package/src/lab/LabZoom.test.tsx +223 -0
- package/src/lab/LabZoom.tsx +170 -0
- package/src/lab/index.ts +1 -0
- package/src/loupe/AGENTS.md +7 -6
- package/src/loupe/LoupeGestures.tsx +15 -10
- package/src/loupe/TrialLoupe.tsx +5 -5
- package/src/loupe/index.ts +1 -0
- package/src/loupe/loupeActions.ts +6 -2
- package/src/overview/AGENTS.md +38 -0
- package/src/overview/OverviewMarks.test.tsx +100 -0
- package/src/overview/OverviewMarks.tsx +93 -0
- package/src/overview/TrialOverview.less +53 -0
- package/src/overview/TrialOverview.stories.tsx +50 -0
- package/src/overview/TrialOverview.test.tsx +116 -0
- package/src/overview/TrialOverview.tsx +376 -0
- package/src/overview/index.ts +2 -0
- package/src/passthrough/weasel-ui.test.ts +2 -0
- package/src/passthrough/weasel-ui.ts +23 -4
- package/src/primitives/FloatingPanel.test.tsx +11 -0
- package/src/primitives/FloatingPanel.tsx +2 -5
- package/src/primitives/JobProgress.less +1 -1
- package/src/primitives/Legend.stories.tsx +1 -0
- package/src/primitives/Readout.browser.test.tsx +137 -0
- package/src/primitives/Readout.less +12 -0
- package/src/primitives/Readout.stories.tsx +58 -0
- package/src/primitives/Readout.test.tsx +93 -0
- package/src/primitives/Readout.tsx +56 -0
- package/src/primitives/index.ts +2 -0
- package/src/specimen/Specimen.stories.tsx +1 -0
- package/src/specimen/Specimen.tsx +21 -4
- package/src/state/Persistence.browser.test.tsx +47 -0
- package/src/state/labRecords.test.ts +4 -1
- package/src/state/store.test.ts +9 -5
- package/src/state/usePersistedState.test.tsx +1 -1
- package/src/state/useTrialState.test.tsx +1 -1
- package/src/styles.less +3 -0
- package/src/theme/Interstellar.stories.tsx +4 -6
- package/src/theme/base.less +21 -47
- package/src/theme/interstellar.test.ts +1 -1
- package/src/theme/interstellar.theme.json +10 -3
- package/src/tools/labTool.ts +6 -2
- package/src/trial/Trial.annotations.test.tsx +16 -0
- package/src/trial/Trial.less +0 -13
- package/src/trial/Trial.loupe.test.tsx +73 -1
- package/src/trial/Trial.stories.tsx +2 -0
- package/src/trial/Trial.tsx +23 -1
- package/src/trial/TrialChrome.tsx +21 -3
- package/src/trial/trialOps.test.ts +4 -4
- package/dist/_dts/PrefsRow.d-DFpPIeIC.d.ts +0 -39
- package/dist/_dts/inDialog-D5ZKGjiD.d.ts +0 -23
- package/dist/_dts/index-DINmCuLA.d.ts +0 -453
- package/dist/_dts/number.d-OeQYQoUO.d.ts +0 -28
- package/dist/_dts/usePanZoom-Bq73pwFe.d.ts +0 -117
- package/dist/chunk-2AYGEN57.js +0 -32
- package/dist/chunk-2AYGEN57.js.map +0 -1
- package/dist/chunk-AWH3SRPW.js.map +0 -1
- package/dist/chunk-BVL7Y574.js.map +0 -1
- package/dist/chunk-ERFMC6WU.js.map +0 -1
- package/dist/chunk-H5VIV7MQ.js.map +0 -1
- package/dist/chunk-HFRE4QQV.js.map +0 -1
- package/dist/chunk-RS3HRQWU.js.map +0 -1
- package/dist/chunk-SBXNQW4G.js +0 -3
- package/dist/chunk-TT5C5S6R.js +0 -368
- package/dist/chunk-TT5C5S6R.js.map +0 -1
- package/dist/chunk-USO6TERP.js.map +0 -1
- package/dist/chunk-VQ47KWD5.js.map +0 -1
- package/dist/chunk-WUJXJC5O.js +0 -14568
- package/dist/chunk-WUJXJC5O.js.map +0 -1
- package/dist/chunk-ZORVNOKX.js.map +0 -1
- package/src/canvas/usePanZoom.test.ts +0 -244
- package/src/canvas/usePanZoom.ts +0 -147
- package/src/state/Persistence.stories.tsx +0 -75
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as StorageAdapter, e as LabStoreState, T as TrialRecord, f as SavedSnapshot, s as LabMode, i as UndockedPanel, t as InstrumentList, v as InstrumentHooks, C as CreateLabStoreOptions, h as TrialStateHandle } from './types-CSm9jgol.js';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode, ReactElement, Dispatch, SetStateAction } from 'react';
|
|
4
4
|
import { StoreApi } from 'zustand/vanilla';
|
|
5
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
5
|
|
|
7
6
|
/** Persist to `localStorage`, one JSON value per record. Survives a reload and
|
|
8
7
|
* reaches other tabs through the `storage` event. */
|
|
@@ -182,7 +181,7 @@ interface PersistenceProps {
|
|
|
182
181
|
}
|
|
183
182
|
/** Persisted values for a page with no lab: `usePersistedState` below it keeps
|
|
184
183
|
* what it holds across a reload. Both props are read once, at mount. */
|
|
185
|
-
declare function Persistence({ storageKey, storage, fallback, children }: PersistenceProps):
|
|
184
|
+
declare function Persistence({ storageKey, storage, fallback, children }: PersistenceProps): react.JSX.Element;
|
|
186
185
|
|
|
187
186
|
/** Options for `usePersistedState`. */
|
|
188
187
|
interface PersistedStateOptions {
|
package/dist/canvas/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
export { C as CameraContext, a as CameraContextValue, b as CameraInput, c as CameraInputProps, d as CameraPublishContext, e as CameraRegistry, f as CameraRegistryContext, g as CameraScope, h as CameraView, i as CameraViewOptions, j as CanvasStack, k as CanvasStackProps, S as STAGE_VIEW_ID, l as Stage, m as StageProps, Z as ZoomAtOptions, n as ZoomRange, o as centerOn, p as createCameraRegistry, q as fitStage, s as screenToWorld, u as useCameraView, r as usePublishCamera, w as worldToScreen, z as zoomAt } from '../_dts/Stage-CCWfQQWM.js';
|
|
1
2
|
import * as react from 'react';
|
|
2
|
-
export { C as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import '
|
|
6
|
-
|
|
3
|
+
export { C as CanvasLayerDescriptor, a as CanvasStackContext, b as CanvasStackContextValue, c as CanvasStackSurface } from '../_dts/CanvasStackContext-D2jnIwfk.js';
|
|
4
|
+
import { View } from '@weasel-js/core';
|
|
5
|
+
import { W as WorldFrame } from '../_dts/types-CSm9jgol.js';
|
|
6
|
+
import { Point, ViewTransform } from '../index.js';
|
|
7
|
+
export { D as DEFAULT_FRAME, V as ViewportSize, l as WorldSpec, m as applyCamera, r as resolveFrame } from '../_dts/types-CSm9jgol.js';
|
|
8
|
+
import '../_dts/PrefsRow.d-TOZ7BgD9.js';
|
|
7
9
|
import '@weasel-js/theme';
|
|
8
|
-
import '
|
|
9
|
-
import '../_dts/types-B7y8hX1D.js';
|
|
10
|
+
import '../_dts/types-CRPSGFAp.js';
|
|
10
11
|
import '../_dts/types-DJ79Tg5J.js';
|
|
11
12
|
|
|
12
13
|
/** Where a trial's camera takes a wheel event from outside its own element. */
|
|
@@ -21,5 +22,36 @@ type CameraWheelSlot = {
|
|
|
21
22
|
*/
|
|
22
23
|
declare const CameraWheelContext: react.Context<CameraWheelSlot | null>;
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
/**
|
|
26
|
+
* labkit's camera as a weasel `View`, so core's viewport actions drive it.
|
|
27
|
+
*
|
|
28
|
+
* labkit places a world point on screen at
|
|
29
|
+
* `originPx + pan + zoom * (x, yDir * y)`. A weasel `View` places one at
|
|
30
|
+
* `(p - (x, y)) * scale`. Over *frame-local* coordinates — the world with `y`
|
|
31
|
+
* multiplied by `yDir` — the two are the same affine map, which is all a pan
|
|
32
|
+
* or a zoom about a screen point needs.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/** The weasel `View` equal to `view` under `frame`. */
|
|
36
|
+
declare function toCameraView(view: ViewTransform, frame?: WorldFrame): View;
|
|
37
|
+
/** The labkit camera equal to weasel `view` under `frame`. */
|
|
38
|
+
declare function fromCameraView(view: View, frame?: WorldFrame): ViewTransform;
|
|
39
|
+
/** A frame-local point in the instrument's world, and back — the map is its
|
|
40
|
+
* own inverse. */
|
|
41
|
+
declare function frameLocalToWorld(p: Point, frame?: WorldFrame): Point;
|
|
42
|
+
/**
|
|
43
|
+
* `next` with its zoom held to [`min`, `max`], about the screen point the step
|
|
44
|
+
* from `prev` was anchored on, so a zoom that hits a bound stays anchored where
|
|
45
|
+
* the pointer is. A pan (equal scales) passes through.
|
|
46
|
+
*/
|
|
47
|
+
declare function clampZoomAbout(prev: View, next: View, min: number, max: number): View;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The other side of a linked cursor: a crosshair on the camera's own element
|
|
51
|
+
* wherever the shared pointer is over some other view — an overview, say. The
|
|
52
|
+
* same crosshair core paints on a weasel canvas.
|
|
53
|
+
*/
|
|
54
|
+
declare function LinkedCursor(): react.JSX.Element | null;
|
|
55
|
+
|
|
56
|
+
export { CameraWheelContext, LinkedCursor, WorldFrame, clampZoomAbout, frameLocalToWorld, fromCameraView, toCameraView };
|
|
25
57
|
export type { CameraWheelSlot };
|
package/dist/canvas/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { centerOn, zoomAt } from '../chunk-
|
|
3
|
-
export {
|
|
1
|
+
export { CanvasStack, LinkedCursor, Stage, fitStage } from '../chunk-ZIFPHIWZ.js';
|
|
2
|
+
export { centerOn, zoomAt } from '../chunk-JVBYV6TL.js';
|
|
3
|
+
export { screenToWorld, worldToScreen } from '../chunk-AWQG7FCC.js';
|
|
4
4
|
import '../chunk-WIG6XHJ7.js';
|
|
5
|
+
export { CameraContext, CameraInput, CameraPublishContext, CameraRegistryContext, CameraScope, CameraWheelContext, STAGE_VIEW_ID, clampZoomAbout, createCameraRegistry, frameLocalToWorld, fromCameraView, toCameraView, useCameraView, usePublishCamera } from '../chunk-UNAZSLWE.js';
|
|
6
|
+
export { DEFAULT_FRAME, applyCamera, resolveFrame } from '../chunk-24W5VEJW.js';
|
|
5
7
|
export { CanvasStackContext } from '../chunk-CQLQPQ4P.js';
|
|
6
8
|
import '../chunk-2YILQ7Y5.js';
|
|
7
9
|
//# sourceMappingURL=index.js.map
|
package/dist/chrome/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export { a as LabAsideRegion, b as LabChromeContext, L as LabContribution, e as LabFooterRegion, f as LabHeaderRegion, g as LabRegion, h as LabRegionProps, i as LabSidebarRegion, P as PaletteRegion, j as PaletteRegionProps, S as SidebarRegion, k as SidebarRegionProps, l as StatusRegion, m as StatusRegionProps, T as TitleBarPlacement, n as TitleBarRegion, o as TitleBarRegionProps, p as ToolbarRegion, q as ToolbarRegionProps, V as ViewportRegion, r as ViewportRegionProps, t as builtinContributions, w as contributionsIn, x as labContributions, y as mergeContributions, C as suppressContributions, D as toolContributions, E as useLabChromeContext } from '../_dts/index-
|
|
2
|
-
export {
|
|
3
|
-
import '../_dts/types-
|
|
4
|
-
import '
|
|
5
|
-
import '../_dts/PrefsRow.d-DFpPIeIC.js';
|
|
1
|
+
export { a as LabAsideRegion, b as LabChromeContext, L as LabContribution, e as LabFooterRegion, f as LabHeaderRegion, g as LabRegion, h as LabRegionProps, i as LabSidebarRegion, P as PaletteRegion, j as PaletteRegionProps, S as SidebarRegion, k as SidebarRegionProps, l as StatusRegion, m as StatusRegionProps, T as TitleBarPlacement, n as TitleBarRegion, o as TitleBarRegionProps, p as ToolbarRegion, q as ToolbarRegionProps, V as ViewportRegion, r as ViewportRegionProps, t as builtinContributions, w as contributionsIn, x as labContributions, y as mergeContributions, C as suppressContributions, D as toolContributions, E as useLabChromeContext } from '../_dts/index-CsYqUHD3.js';
|
|
2
|
+
export { a9 as ContributionBase, ad as IconComponent, ak as RegionContribution, ao as SidebarSection, ap as SidebarSlotContext, ar as StatusReadout, au as ToolItem, av as ToolSlotContext, aw as ToolbarItem, ax as TrialChromeContext, Y as TrialContribution, ay as TrialRegion, aA as ViewportControl } from '../_dts/types-CSm9jgol.js';
|
|
3
|
+
import '../_dts/types-CRPSGFAp.js';
|
|
4
|
+
import '../_dts/PrefsRow.d-TOZ7BgD9.js';
|
|
6
5
|
import '@weasel-js/theme';
|
|
7
6
|
import 'react';
|
|
8
|
-
import '
|
|
7
|
+
import '@weasel-js/core';
|
|
9
8
|
import '../_dts/types-DJ79Tg5J.js';
|
package/dist/chrome/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
export { LabAsideRegion, LabFooterRegion, LabHeaderRegion, LabSidebarRegion, PaletteRegion, SidebarRegion, StatusRegion, TitleBarRegion, ToolbarRegion, ViewportRegion, builtinContributions, contributionsIn, labContributions, mergeContributions, suppressContributions, toolContributions, useLabChromeContext } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { LabAsideRegion, LabFooterRegion, LabHeaderRegion, LabSidebarRegion, PaletteRegion, SidebarRegion, StatusRegion, TitleBarRegion, ToolbarRegion, ViewportRegion, builtinContributions, contributionsIn, labContributions, mergeContributions, suppressContributions, toolContributions, useLabChromeContext } from '../chunk-I5DUQ5HM.js';
|
|
2
|
+
import '../chunk-3RY6WL5T.js';
|
|
3
|
+
import '../chunk-7BO7HNGF.js';
|
|
4
|
+
import '../chunk-CZZPXUOU.js';
|
|
4
5
|
import '../chunk-RWNDDKOH.js';
|
|
5
|
-
import '../chunk-
|
|
6
|
+
import '../chunk-T5IBSPAM.js';
|
|
6
7
|
import '../chunk-Z76KEZAX.js';
|
|
7
|
-
import '../chunk-
|
|
8
|
-
import '../chunk-
|
|
8
|
+
import '../chunk-KMJ7RWD3.js';
|
|
9
|
+
import '../chunk-Y23G2VZL.js';
|
|
9
10
|
import '../chunk-CQLQPQ4P.js';
|
|
10
11
|
import '../chunk-2YILQ7Y5.js';
|
|
11
|
-
import '../chunk-
|
|
12
|
+
import '../chunk-MIM5R4ZT.js';
|
|
13
|
+
import '../chunk-275JRRVD.js';
|
|
12
14
|
//# sourceMappingURL=index.js.map
|
|
13
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/canvas/worldSpec.ts
|
|
2
|
+
var DEFAULT_FRAME = { originPx: { x: 0, y: 0 }, yDir: 1 };
|
|
3
|
+
function resolveFrame(spec, size) {
|
|
4
|
+
if (!spec) return DEFAULT_FRAME;
|
|
5
|
+
const origin = spec.origin ?? { x: 0, y: 0 };
|
|
6
|
+
return {
|
|
7
|
+
originPx: { x: origin.x * size.width, y: origin.y * size.height },
|
|
8
|
+
yDir: spec.yAxis === "up" ? -1 : 1
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function applyCamera(ctx, view, frame = DEFAULT_FRAME) {
|
|
12
|
+
ctx.translate(frame.originPx.x + view.pan.x, frame.originPx.y + view.pan.y);
|
|
13
|
+
ctx.scale(view.zoom, view.zoom * frame.yDir);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { DEFAULT_FRAME, applyCamera, resolveFrame };
|
|
17
|
+
//# sourceMappingURL=chunk-24W5VEJW.js.map
|
|
18
|
+
//# sourceMappingURL=chunk-24W5VEJW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/canvas/worldSpec.ts"],"names":[],"mappings":";AA2BO,IAAM,aAAA,GAA4B,EAAE,QAAA,EAAU,EAAE,CAAA,EAAG,GAAG,CAAA,EAAG,CAAA,EAAE,EAAG,IAAA,EAAM,CAAA;AAEpE,SAAS,YAAA,CAAa,MAA6B,IAAA,EAAgC;AACxF,EAAA,IAAI,CAAC,MAAM,OAAO,aAAA;AAClB,EAAA,MAAM,SAAS,IAAA,CAAK,MAAA,IAAU,EAAE,CAAA,EAAG,CAAA,EAAG,GAAG,CAAA,EAAE;AAC3C,EAAA,OAAO;AAAA,IACL,QAAA,EAAU,EAAE,CAAA,EAAG,MAAA,CAAO,CAAA,GAAI,IAAA,CAAK,KAAA,EAAO,CAAA,EAAG,MAAA,CAAO,CAAA,GAAI,IAAA,CAAK,MAAA,EAAO;AAAA,IAChE,IAAA,EAAM,IAAA,CAAK,KAAA,KAAU,IAAA,GAAO,EAAA,GAAK;AAAA,GACnC;AACF;AAIO,SAAS,WAAA,CACd,GAAA,EACA,IAAA,EACA,KAAA,GAAoB,aAAA,EACd;AACN,EAAA,GAAA,CAAI,SAAA,CAAU,KAAA,CAAM,QAAA,CAAS,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,EAAG,KAAA,CAAM,QAAA,CAAS,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA;AAC1E,EAAA,GAAA,CAAI,MAAM,IAAA,CAAK,IAAA,EAAM,IAAA,CAAK,IAAA,GAAO,MAAM,IAAI,CAAA;AAC7C","file":"chunk-24W5VEJW.js","sourcesContent":["import type { Point, ViewTransform } from '../instrument/types';\n\n/** How an instrument's world sits on the canvas, independent of the camera.\n * The defaults reproduce the convention labkit shipped before this existed:\n * world (0,0) at the element's top-left, y growing downward. */\nexport interface WorldSpec {\n /** Where world (0,0) sits at `pan` zero, as a fraction of the viewport.\n * `{x:0,y:0}` top-left (default); `{x:0.5,y:0.5}` centre. */\n origin?: Point;\n /** Which way the world y axis runs on screen. Default `'down'`. */\n yAxis?: 'down' | 'up';\n}\n\n/** A viewport's CSS-pixel size. */\nexport interface ViewportSize {\n width: number;\n height: number;\n}\n\n/** A `WorldSpec` resolved against a viewport: what the coordinate helpers,\n * the camera and the wheel all read. */\nexport interface WorldFrame {\n /** Screen position of world (0,0) at `pan` zero. */\n originPx: Point;\n yDir: 1 | -1;\n}\n\nexport const DEFAULT_FRAME: WorldFrame = { originPx: { x: 0, y: 0 }, yDir: 1 };\n\nexport function resolveFrame(spec: WorldSpec | undefined, size: ViewportSize): WorldFrame {\n if (!spec) return DEFAULT_FRAME;\n const origin = spec.origin ?? { x: 0, y: 0 };\n return {\n originPx: { x: origin.x * size.width, y: origin.y * size.height },\n yDir: spec.yAxis === 'up' ? -1 : 1,\n };\n}\n\n/** Put a 2D context into the instrument's world coordinates, so a layer's\n * `draw` works in them. Must stay the exact inverse of `screenToWorld`. */\nexport function applyCamera(\n ctx: CanvasRenderingContext2D,\n view: ViewTransform,\n frame: WorldFrame = DEFAULT_FRAME,\n): void {\n ctx.translate(frame.originPx.x + view.pan.x, frame.originPx.y + view.pan.y);\n ctx.scale(view.zoom, view.zoom * frame.yDir);\n}\n"]}
|