@weasel-js/labkit 0.7.2 → 1.0.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.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -3
  3. package/dist/_dts/{DrawCommand-CEvS5AdV.d.ts → DrawCommand-BwRCZYuo.d.ts} +106 -52
  4. package/dist/_dts/{useExperimentState-eSvpwV_P.d.ts → useExperimentState-CJn2hHzd.d.ts} +6 -4
  5. package/dist/{chunk-SSMHPMDV.js → chunk-53XSBIUK.js} +12 -11
  6. package/dist/chunk-53XSBIUK.js.map +1 -0
  7. package/dist/{chunk-BG6NLMOL.js → chunk-FP5LYDVX.js} +1229 -1227
  8. package/dist/chunk-FP5LYDVX.js.map +1 -0
  9. package/dist/{chunk-ERZQAU4N.js → chunk-HNXVLKBG.js} +3 -3
  10. package/dist/{chunk-ERZQAU4N.js.map → chunk-HNXVLKBG.js.map} +1 -1
  11. package/dist/{chunk-5XDFILHZ.js → chunk-XVBXYKFJ.js} +1675 -670
  12. package/dist/chunk-XVBXYKFJ.js.map +1 -0
  13. package/dist/fonts/inter-latin.woff2 +0 -0
  14. package/dist/fonts/oswald-latin-variable.woff2 +0 -0
  15. package/dist/index.d.ts +37 -13
  16. package/dist/index.js +776 -27
  17. package/dist/index.js.map +1 -1
  18. package/dist/passthrough/weasel-canvas.d.ts +1 -1
  19. package/dist/passthrough/weasel-canvas.js +1 -1
  20. package/dist/passthrough/weasel-ui.d.ts +332 -189
  21. package/dist/passthrough/weasel-ui.js +2 -2
  22. package/dist/state/index.d.ts +2 -2
  23. package/dist/state/index.js +2 -2
  24. package/dist/styles.css +229 -288
  25. package/dist/ui/layers/index.js +3 -3
  26. package/package.json +5 -6
  27. package/src/canvas/CanvasStack.less +1 -1
  28. package/src/controls/ControlPanel.less +12 -12
  29. package/src/dragdrop/DragGhost.less +2 -2
  30. package/src/dragdrop/Palette.less +6 -6
  31. package/src/index.ts +2 -0
  32. package/src/lab/Lab.test.tsx +20 -15
  33. package/src/lab/Lab.tsx +33 -32
  34. package/src/lab/LabContext.ts +3 -3
  35. package/src/lab/LabShell.less +14 -14
  36. package/src/lab/LabShell.test.tsx +7 -20
  37. package/src/lab/LabShell.tsx +22 -13
  38. package/src/lab/WorkspaceGrid.less +1 -1
  39. package/src/lab/WorkspaceGrid.stories.tsx +4 -4
  40. package/src/lab/index.ts +1 -1
  41. package/src/lab/useSystemMode.ts +30 -0
  42. package/src/layers/LayerList.less +9 -9
  43. package/src/primitives/FpsMeter.less +5 -5
  44. package/src/primitives/ScaleIndicator.less +7 -7
  45. package/src/primitives/Sidebar.less +12 -12
  46. package/src/primitives/StatusBar.less +10 -10
  47. package/src/primitives/Toolbar.less +16 -16
  48. package/src/state/store.test.ts +17 -9
  49. package/src/state/store.ts +13 -10
  50. package/src/state/types.ts +5 -2
  51. package/src/theme/Interstellar.stories.less +20 -20
  52. package/src/theme/Interstellar.stories.tsx +44 -59
  53. package/src/theme/base.less +29 -28
  54. package/src/theme/interstellar.test.ts +30 -0
  55. package/src/theme/interstellar.tokens.json +57 -0
  56. package/src/theme/interstellar.ts +9 -0
  57. package/src/ui/layers/LayerStack.less +21 -21
  58. package/src/ui/properties/CurveField.less +5 -5
  59. package/src/ui/properties/EffectCard.tsx +2 -2
  60. package/src/ui/properties/PropertyGroup.less +6 -6
  61. package/src/ui/properties/PropertyPanel.less +70 -70
  62. package/src/ui/properties/SpeechBalloonPanels.stories.tsx +1 -1
  63. package/src/ui/properties/storyLayouts.tsx +1 -1
  64. package/src/workspace/Workspace.less +14 -14
  65. package/src/workspace/Workspace.stories.tsx +2 -2
  66. package/src/workspace/Workspace.test.tsx +2 -2
  67. package/dist/chunk-5XDFILHZ.js.map +0 -1
  68. package/dist/chunk-BG6NLMOL.js.map +0 -1
  69. package/dist/chunk-SSMHPMDV.js.map +0 -1
  70. package/dist/theme-interstellar.css +0 -25
  71. package/dist/theme-light.css +0 -13
  72. package/src/fonts/oswald-latin-variable.woff2 +0 -0
  73. package/src/theme/interstellar.less +0 -34
  74. package/src/theme/light.less +0 -14
  75. package/src/theme/tokens.less +0 -85
Binary file
package/dist/index.d.ts CHANGED
@@ -7,8 +7,8 @@ export { C as CanvasCapability, a as CanvasLayer, D as DragDropCapability, b as
7
7
  import * as react_jsx_runtime from 'react/jsx-runtime';
8
8
  import * as react from 'react';
9
9
  import { ReactNode } from 'react';
10
- import { S as StorageAdapter, W as WorkspaceRecord, e as SavedSnapshot } from './_dts/useExperimentState-eSvpwV_P.js';
11
- export { C as CreateLabStoreOptions, E as ExperimentStateHandle, b as LabStoreContext, c as LabStoreProvider, d as LabStoreState, U as UndoStack, f as WorkspaceIdContext, g as WorkspaceIdProvider, i as createMemoryAdapter, l as localStorageAdapter, n as noneAdapter, s as sessionStorageAdapter, u as urlHashAdapter, j as useExperimentState, k as useLabStore, m as useWorkspaceId } from './_dts/useExperimentState-eSvpwV_P.js';
10
+ import { S as StorageAdapter, o as LabMode, W as WorkspaceRecord, e as SavedSnapshot } from './_dts/useExperimentState-CJn2hHzd.js';
11
+ export { C as CreateLabStoreOptions, E as ExperimentStateHandle, b as LabStoreContext, c as LabStoreProvider, d as LabStoreState, U as UndoStack, f as WorkspaceIdContext, g as WorkspaceIdProvider, i as createMemoryAdapter, l as localStorageAdapter, n as noneAdapter, s as sessionStorageAdapter, u as urlHashAdapter, j as useExperimentState, k as useLabStore, m as useWorkspaceId } from './_dts/useExperimentState-CJn2hHzd.js';
12
12
  export { LayerList, LayerListProps } from './layers/index.js';
13
13
  export { FpsMeter, ScaleIndicator, ScaleIndicatorProps, Sidebar, SidebarProps, StatusBar, StatusBarProps, Toolbar, ToolbarProps } from './primitives/index.js';
14
14
  export { LayerStack, LayerStackItem, LayerStackProps } from './ui/layers/index.js';
@@ -42,18 +42,18 @@ interface LabProps {
42
42
  defaultInstrument: string;
43
43
  storage?: StorageAdapter | null;
44
44
  storageKey?: string;
45
- theme?: 'auto' | 'light' | 'interstellar';
45
+ mode?: LabMode;
46
46
  /**
47
47
  * Optional list of CSS colors used to compose the interstellar theme's
48
48
  * cosmic backdrop. Each color becomes one radial-gradient blob on the
49
49
  * dark void base. Order maps to a fixed spread of positions; extras wrap
50
- * around. Ignored unless `theme="interstellar"` is active.
50
+ * around. Ignored unless the resolved mode is dark.
51
51
  */
52
52
  nebula?: readonly string[];
53
53
  title?: string;
54
54
  children?: ReactNode;
55
55
  }
56
- declare function Lab({ instruments, defaultInstrument, storage, storageKey, theme, nebula, title, children, }: LabProps): react_jsx_runtime.JSX.Element;
56
+ declare function Lab({ instruments, defaultInstrument, storage, storageKey, mode, nebula, title, children, }: LabProps): react_jsx_runtime.JSX.Element;
57
57
 
58
58
  interface LabContextValue {
59
59
  instruments: Instrument[];
@@ -66,13 +66,12 @@ interface LabContextValue {
66
66
  saveSnapshot: (workspaceId: string, name?: string) => void;
67
67
  loadSnapshot: (workspaceId: string, snapshotId: string) => void;
68
68
  deleteSnapshot: (snapshotId: string) => void;
69
- theme: 'auto' | 'light' | 'interstellar';
70
- setTheme: (t: 'auto' | 'light' | 'interstellar') => void;
69
+ mode: LabMode;
70
+ setMode: (m: LabMode) => void;
71
71
  }
72
72
  declare const LabContext: react.Context<LabContextValue | null>;
73
73
  declare function useLabContext(): LabContextValue;
74
74
 
75
- type LabTheme = 'auto' | 'light' | 'interstellar';
76
75
  interface LabShellProps {
77
76
  title: string;
78
77
  children: ReactNode;
@@ -80,16 +79,41 @@ interface LabShellProps {
80
79
  header?: ReactNode;
81
80
  /** Optional content rendered into the footer. */
82
81
  footer?: ReactNode;
83
- /** Theme override. "auto" (default) follows prefers-color-scheme. */
84
- theme?: LabTheme;
82
+ /** Color mode. "auto" (default) follows prefers-color-scheme. */
83
+ mode?: LabMode;
85
84
  }
86
- declare function LabShell({ title, children, header, footer, theme }: LabShellProps): react_jsx_runtime.JSX.Element;
85
+ declare function LabShell({ title, children, header, footer, mode }: LabShellProps): react_jsx_runtime.JSX.Element;
87
86
 
88
87
  interface WorkspaceGridProps {
89
88
  children: ReactNode;
90
89
  }
91
90
  declare function WorkspaceGrid({ children }: WorkspaceGridProps): react_jsx_runtime.JSX.Element;
92
91
 
92
+ type TokenValue = string | number | readonly (string | number)[];
93
+ interface RawToken {
94
+ readonly type: string;
95
+ readonly value: TokenValue;
96
+ /** Render the referenced color at this alpha, 0–1. */
97
+ readonly alpha?: number | undefined;
98
+ readonly description?: string | undefined;
99
+ }
100
+ type FlatTokens = Record<string, RawToken>;
101
+
102
+ interface Theme {
103
+ readonly name: string;
104
+ readonly extends: Theme | null;
105
+ readonly defaultMode: string;
106
+ readonly tokens: FlatTokens;
107
+ readonly modes: Readonly<Record<string, FlatTokens>>;
108
+ }
109
+
110
+ /**
111
+ * labkit's theme: a cosmic dark and a warm parchment light, extending the
112
+ * built-in weasel theme. Authored as DTCG and loaded at import time — the
113
+ * interchange path a theme exported from a design tool would take.
114
+ */
115
+ declare const interstellarTheme: Theme;
116
+
93
117
  type CurveMark = {
94
118
  kind: 'band';
95
119
  x: [number, number];
@@ -406,5 +430,5 @@ declare function cloneWorkspace(workspaces: WorkspaceRecord[], id: string): Work
406
430
  declare function closeWorkspace(workspaces: WorkspaceRecord[], id: string): WorkspaceRecord[];
407
431
  declare function resetWorkspace(workspaces: WorkspaceRecord[], id: string, instruments: Instrument[]): WorkspaceRecord[];
408
432
 
409
- export { CheckboxRow, ColorRow, ConfigField, CurveField, DefaultSidebar, DefaultStatusBar, DefaultToolbar, EffectCard, EffectCardList, Instrument, Lab, LabContext, LabShell, NumberRow, PropertyGroup, PropertyList, PropertyPanel, PropertyRow, SavedSnapshot, SelectRow, SliderRow, StorageAdapter, Subpanel, TextRow, ToggleRow, Workspace, WorkspaceChrome, WorkspaceGrid, WorkspaceRecord, addWorkspace, cloneWorkspace, closeWorkspace, defineInstrument, detectCapabilities, gridDims, resetWorkspace, useLabContext, validateConfigSchema };
410
- export type { CapabilityFlags, CheckboxRowProps, ColorRowProps, CurveFieldProps, CurveMark, DefaultSidebarProps, DefaultStatusBarProps, DefaultToolbarProps, EffectCardListItem, EffectCardListProps, EffectCardProps, GridDims, LabContextValue, LabProps, LabShellProps, LabTheme, NumberRowProps, PropertyGroupProps, PropertyListPack, PropertyListProps, PropertyPanelProps, PropertyRowLayout, PropertyRowProps, PropertyRowVariant, SelectRowProps, SidebarSlot, SliderRowProps, StatusBarSlot, SubpanelProps, TextRowProps, ToggleRowProps, ToolbarSlot, ValidationResult, WorkspaceChromeProps, WorkspaceGridProps, WorkspaceProps, WorkspaceSidebarContext, WorkspaceStatusBarContext, WorkspaceToolbarContext };
433
+ export { CheckboxRow, ColorRow, ConfigField, CurveField, DefaultSidebar, DefaultStatusBar, DefaultToolbar, EffectCard, EffectCardList, Instrument, Lab, LabContext, LabMode, LabShell, NumberRow, PropertyGroup, PropertyList, PropertyPanel, PropertyRow, SavedSnapshot, SelectRow, SliderRow, StorageAdapter, Subpanel, TextRow, ToggleRow, Workspace, WorkspaceChrome, WorkspaceGrid, WorkspaceRecord, addWorkspace, cloneWorkspace, closeWorkspace, defineInstrument, detectCapabilities, gridDims, interstellarTheme, resetWorkspace, useLabContext, validateConfigSchema };
434
+ export type { CapabilityFlags, CheckboxRowProps, ColorRowProps, CurveFieldProps, CurveMark, DefaultSidebarProps, DefaultStatusBarProps, DefaultToolbarProps, EffectCardListItem, EffectCardListProps, EffectCardProps, GridDims, LabContextValue, LabProps, LabShellProps, NumberRowProps, PropertyGroupProps, PropertyListPack, PropertyListProps, PropertyPanelProps, PropertyRowLayout, PropertyRowProps, PropertyRowVariant, SelectRowProps, SidebarSlot, SliderRowProps, StatusBarSlot, SubpanelProps, TextRowProps, ToggleRowProps, ToolbarSlot, ValidationResult, WorkspaceChromeProps, WorkspaceGridProps, WorkspaceProps, WorkspaceSidebarContext, WorkspaceStatusBarContext, WorkspaceToolbarContext };