@weasel-js/labkit 1.4.2 → 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 +20 -2
- package/dist/_dts/{CanvasStackContext-kjILVnPj.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-A4R6v4ld.d.ts → frac-B5mB8LsJ.d.ts} +7 -4
- package/dist/_dts/{index-CsU9WhjM.d.ts → index-DelFfeV0.d.ts} +15 -7
- package/dist/_dts/types-B9_zrHmb.d.ts +166 -0
- package/dist/_dts/{types-BbXpvQa8.d.ts → types-BP2OCcpg.d.ts} +21 -3
- package/dist/_dts/types-x92Kfeme.d.ts +62 -0
- package/dist/_dts/{useTrialState-DKjqpv20.d.ts → useTrialState-D6Vb3T-g.d.ts} +7 -7
- package/dist/canvas/index.d.ts +9 -8
- package/dist/canvas/index.js +1 -2
- package/dist/chrome/index.d.ts +7 -6
- package/dist/chrome/index.js +5 -5
- package/dist/{chunk-UTOEDPNU.js → chunk-2RQPGOQF.js} +7 -6
- package/dist/chunk-2RQPGOQF.js.map +1 -0
- package/dist/{chunk-ULDW42CR.js → chunk-5TROQVQ2.js} +25 -21
- package/dist/chunk-5TROQVQ2.js.map +1 -0
- package/dist/{chunk-XKENZTNE.js → chunk-ASWKLRKJ.js} +65 -49
- package/dist/chunk-ASWKLRKJ.js.map +1 -0
- package/dist/{chunk-W2FJR5FF.js → chunk-C42T6DJT.js} +74 -76
- 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-WS6ZRV75.js → chunk-FQMJUVHJ.js} +3 -3
- package/dist/{chunk-WS6ZRV75.js.map → chunk-FQMJUVHJ.js.map} +1 -1
- package/dist/{chunk-FJG4PHTL.js → chunk-I6JCVE24.js} +3 -3
- package/dist/chunk-I6JCVE24.js.map +1 -0
- package/dist/{chunk-NSOVI3AZ.js → chunk-ISCOFAUO.js} +6 -6
- package/dist/{chunk-NSOVI3AZ.js.map → chunk-ISCOFAUO.js.map} +1 -1
- package/dist/chunk-MHAGC6VD.js +7320 -0
- package/dist/chunk-MHAGC6VD.js.map +1 -0
- package/dist/{chunk-UDXOYZEC.js → chunk-QAGAHJKZ.js} +4 -4
- package/dist/{chunk-UDXOYZEC.js.map → chunk-QAGAHJKZ.js.map} +1 -1
- package/dist/{chunk-TN7YSJVU.js → chunk-RS3HRQWU.js} +3 -3
- package/dist/{chunk-TN7YSJVU.js.map → chunk-RS3HRQWU.js.map} +1 -1
- package/dist/{chunk-D5KQ5OY6.js → chunk-TJ7QY3OC.js} +3 -3
- package/dist/{chunk-D5KQ5OY6.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 +6 -5
- package/dist/dragdrop/index.js +1 -2
- package/dist/index.d.ts +90 -23
- package/dist/index.js +199 -117
- package/dist/index.js.map +1 -1
- package/dist/layers/index.d.ts +7 -6
- 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 +88 -20
- 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 +2 -2
- package/dist/surface/index.js +1 -2
- package/dist/ui/layers/index.js +1 -2
- package/dist/undo/index.d.ts +6 -6
- package/package.json +7 -7
- package/src/annotations/ExportMenu.test.tsx +16 -0
- package/src/annotations/ExportMenu.tsx +0 -5
- 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 +114 -0
- package/src/controls/ControlPanel.tsx +99 -50
- package/src/index.ts +16 -1
- package/src/instrument/serializers.ts +36 -0
- package/src/instrument/types.ts +4 -2
- package/src/lab/Lab.test.tsx +29 -1
- package/src/lab/Lab.tsx +10 -1
- package/src/lab/LabShell.test.tsx +8 -0
- package/src/lab/LabShell.tsx +3 -1
- 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 +155 -1
- package/src/state/store.ts +30 -24
- package/src/state/types.ts +24 -3
- package/src/state/useTrialState.ts +1 -1
- package/src/trial/Trial.config.test.tsx +44 -0
- package/src/trial/Trial.tsx +3 -3
- package/src/trial/TrialChrome.tsx +10 -5
- package/src/trial/trialOps.ts +4 -8
- package/dist/_dts/types-lg4TSCb2.d.ts +0 -164
- package/dist/_dts/weasel-canvas-FJTFi3ZZ.d.ts +0 -5041
- package/dist/chunk-54ZWZ5FQ.js +0 -29997
- package/dist/chunk-54ZWZ5FQ.js.map +0 -1
- package/dist/chunk-FJG4PHTL.js.map +0 -1
- package/dist/chunk-ISSVF5PT.js +0 -7263
- package/dist/chunk-ISSVF5PT.js.map +0 -1
- package/dist/chunk-ULDW42CR.js.map +0 -1
- package/dist/chunk-UTOEDPNU.js.map +0 -1
- package/dist/chunk-W2FJR5FF.js.map +0 -1
- package/dist/chunk-XKENZTNE.js.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Toolbar, ZoomControl, ScaleIndicator, FpsMeter, useRovingTabIndex, StatusBar } from './chunk-
|
|
2
|
-
import { ControlPanel } from './chunk-
|
|
3
|
-
import { b,
|
|
4
|
-
import { SelectIcon, PencilIcon, LineIcon, ArrowIcon, RectIcon, EllipseIcon, TextIcon } from './chunk-54ZWZ5FQ.js';
|
|
1
|
+
import { Toolbar, ZoomControl, ScaleIndicator, FpsMeter, useRovingTabIndex, StatusBar } from './chunk-2RQPGOQF.js';
|
|
2
|
+
import { ControlPanel } from './chunk-ASWKLRKJ.js';
|
|
3
|
+
import { p, u, c, n, f, r2, h, b, g3, u2, A, j, U, M, x, N, g, _, v, P, y, n6, o3 } from './chunk-MHAGC6VD.js';
|
|
5
4
|
import { createContext, useContext, useState, useId, useRef, useSyncExternalStore, useCallback } from 'react';
|
|
6
5
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
7
6
|
|
|
@@ -98,14 +97,13 @@ function ExportMenu() {
|
|
|
98
97
|
}
|
|
99
98
|
),
|
|
100
99
|
/* @__PURE__ */ jsx(
|
|
101
|
-
|
|
100
|
+
g3,
|
|
102
101
|
{
|
|
103
102
|
triggerRef: { current: anchor },
|
|
104
103
|
isOpen: open,
|
|
105
104
|
onOpenChange: setOpen,
|
|
106
105
|
onDismiss: () => setOpen(false),
|
|
107
106
|
placement: "bottom end",
|
|
108
|
-
UNSTABLE_portalContainer: anchor?.closest(".lk-root") ?? void 0,
|
|
109
107
|
"aria-labelledby": titleId,
|
|
110
108
|
children: /* @__PURE__ */ jsxs("div", { className: "lk-export__panel", children: [
|
|
111
109
|
/* @__PURE__ */ jsx("span", { className: "lk-export__title", id: titleId, children: "Export" }),
|
|
@@ -123,18 +121,18 @@ function ExportMenu() {
|
|
|
123
121
|
] }),
|
|
124
122
|
/* @__PURE__ */ jsxs("div", { className: "lk-export__row", children: [
|
|
125
123
|
/* @__PURE__ */ jsx("span", { children: "Format" }),
|
|
126
|
-
/* @__PURE__ */ jsx("span", { className: "lk-export__choices", role: "radiogroup", "aria-label": "Format", children: FORMATS.map((
|
|
124
|
+
/* @__PURE__ */ jsx("span", { className: "lk-export__choices", role: "radiogroup", "aria-label": "Format", children: FORMATS.map((f2) => /* @__PURE__ */ jsxs("label", { children: [
|
|
127
125
|
/* @__PURE__ */ jsx(
|
|
128
126
|
"input",
|
|
129
127
|
{
|
|
130
128
|
type: "radio",
|
|
131
129
|
name: "lk-export-format",
|
|
132
|
-
checked: format ===
|
|
133
|
-
onChange: () => setFormat(
|
|
130
|
+
checked: format === f2.id,
|
|
131
|
+
onChange: () => setFormat(f2.id)
|
|
134
132
|
}
|
|
135
133
|
),
|
|
136
|
-
|
|
137
|
-
] },
|
|
134
|
+
f2.label
|
|
135
|
+
] }, f2.id)) })
|
|
138
136
|
] }),
|
|
139
137
|
/* @__PURE__ */ jsxs("div", { className: "lk-export__row", children: [
|
|
140
138
|
/* @__PURE__ */ jsx("span", { children: "Scale" }),
|
|
@@ -188,7 +186,7 @@ function MarkList({ meaning, config }) {
|
|
|
188
186
|
)
|
|
189
187
|
] }),
|
|
190
188
|
/* @__PURE__ */ jsx(
|
|
191
|
-
|
|
189
|
+
u2,
|
|
192
190
|
{
|
|
193
191
|
className: "lk-mark-list__title",
|
|
194
192
|
"aria-label": `Title of ${a.kind} on ${a.target}`,
|
|
@@ -229,13 +227,13 @@ var TOOLS = {
|
|
|
229
227
|
text: { weaselTool: "text", kind: "text" }
|
|
230
228
|
};
|
|
231
229
|
var ANNOTATION_TOOLS = [
|
|
232
|
-
{ id: "select", label: "Select", icon:
|
|
233
|
-
{ id: "stroke", label: "Freehand", icon:
|
|
234
|
-
{ id: "line", label: "Line", icon:
|
|
235
|
-
{ id: "arrow", label: "Arrow", icon:
|
|
236
|
-
{ id: "rect", label: "Rectangle", icon:
|
|
237
|
-
{ id: "ellipse", label: "Ellipse", icon:
|
|
238
|
-
{ id: "text", label: "Text", icon:
|
|
230
|
+
{ id: "select", label: "Select", icon: p, group: "annotate" },
|
|
231
|
+
{ id: "stroke", label: "Freehand", icon: u, group: "annotate" },
|
|
232
|
+
{ id: "line", label: "Line", icon: c, group: "annotate" },
|
|
233
|
+
{ id: "arrow", label: "Arrow", icon: n, group: "annotate" },
|
|
234
|
+
{ id: "rect", label: "Rectangle", icon: f, group: "annotate" },
|
|
235
|
+
{ id: "ellipse", label: "Ellipse", icon: r2, group: "annotate" },
|
|
236
|
+
{ id: "text", label: "Text", icon: h, group: "annotate" }
|
|
239
237
|
];
|
|
240
238
|
function annotationToolInfo(id) {
|
|
241
239
|
return id === null ? void 0 : TOOLS[id];
|
|
@@ -337,7 +335,7 @@ function builtinContributions(instrument, ctx, controls) {
|
|
|
337
335
|
id: "zoom-control",
|
|
338
336
|
region: "viewport",
|
|
339
337
|
group: "zoom",
|
|
340
|
-
render: (
|
|
338
|
+
render: (c2) => /* @__PURE__ */ jsx(ZoomControl, { zoom: c2.zoom ?? 1, onZoomChange: c2.setZoom })
|
|
341
339
|
});
|
|
342
340
|
out.push({
|
|
343
341
|
id: "scale",
|
|
@@ -396,16 +394,16 @@ function builtinContributions(instrument, ctx, controls) {
|
|
|
396
394
|
region: "toolbar",
|
|
397
395
|
group: "trial",
|
|
398
396
|
end: true,
|
|
399
|
-
render: (
|
|
400
|
-
|
|
397
|
+
render: (c2) => /* @__PURE__ */ jsx(
|
|
398
|
+
g,
|
|
401
399
|
{
|
|
402
400
|
className: "lk-toolbar__load-select",
|
|
403
401
|
"aria-label": "Load snapshot",
|
|
404
402
|
placeholder: "Load\u2026",
|
|
405
403
|
selectedKey: null,
|
|
406
|
-
options:
|
|
404
|
+
options: c2.savedSnapshots.map((sn) => ({ value: sn.id, label: sn.name })),
|
|
407
405
|
onSelectionChange: (id) => {
|
|
408
|
-
if (id != null)
|
|
406
|
+
if (id != null) c2.loadSnapshot(String(id));
|
|
409
407
|
}
|
|
410
408
|
}
|
|
411
409
|
)
|
|
@@ -467,7 +465,7 @@ function mergeContributions(...bundles) {
|
|
|
467
465
|
return out;
|
|
468
466
|
}
|
|
469
467
|
function suppressContributions(bundle, ids) {
|
|
470
|
-
const present = new Set(bundle.map((
|
|
468
|
+
const present = new Set(bundle.map((c2) => c2.id));
|
|
471
469
|
for (const id of ids) {
|
|
472
470
|
if (!present.has(id)) {
|
|
473
471
|
throw new Error(
|
|
@@ -476,7 +474,7 @@ function suppressContributions(bundle, ids) {
|
|
|
476
474
|
}
|
|
477
475
|
}
|
|
478
476
|
const drop = new Set(ids);
|
|
479
|
-
return bundle.filter((
|
|
477
|
+
return bundle.filter((c2) => !drop.has(c2.id));
|
|
480
478
|
}
|
|
481
479
|
function PaletteRegion({ contributions, ctx }) {
|
|
482
480
|
const { ref, onKeyDown } = useRovingTabIndex("vertical");
|
|
@@ -490,21 +488,21 @@ function PaletteRegion({ contributions, ctx }) {
|
|
|
490
488
|
"aria-label": "Tools",
|
|
491
489
|
"aria-orientation": "vertical",
|
|
492
490
|
onKeyDown,
|
|
493
|
-
children: /* @__PURE__ */ jsx(
|
|
494
|
-
if (
|
|
495
|
-
if (
|
|
496
|
-
const { icon: Icon, label, shortcut, disabled } =
|
|
491
|
+
children: /* @__PURE__ */ jsx(n6, { orientation: "vertical", children: contributions.map((c2) => {
|
|
492
|
+
if (c2.render) return /* @__PURE__ */ jsx("span", { children: c2.render(ctx) }, c2.id);
|
|
493
|
+
if (c2.region !== "palette" || !c2.item) return null;
|
|
494
|
+
const { icon: Icon, label, shortcut, disabled } = c2.item;
|
|
497
495
|
return /* @__PURE__ */ jsx(
|
|
498
496
|
o3,
|
|
499
497
|
{
|
|
500
498
|
icon: /* @__PURE__ */ jsx(Icon, { size: 16 }),
|
|
501
499
|
label,
|
|
502
500
|
shortcut,
|
|
503
|
-
active: ctx.activeToolId ===
|
|
501
|
+
active: ctx.activeToolId === c2.id,
|
|
504
502
|
disabled,
|
|
505
|
-
onClick: () => ctx.setActiveTool(
|
|
503
|
+
onClick: () => ctx.setActiveTool(c2.id)
|
|
506
504
|
},
|
|
507
|
-
|
|
505
|
+
c2.id
|
|
508
506
|
);
|
|
509
507
|
}) })
|
|
510
508
|
}
|
|
@@ -546,37 +544,37 @@ function Section({
|
|
|
546
544
|
}
|
|
547
545
|
function SidebarRegion({ contributions, ctx }) {
|
|
548
546
|
if (contributions.length === 0) return null;
|
|
549
|
-
return /* @__PURE__ */ jsx(Fragment, { children: contributions.map((
|
|
550
|
-
if (
|
|
551
|
-
if (
|
|
552
|
-
if (ctx.undockedPanels.includes(
|
|
553
|
-
const item =
|
|
547
|
+
return /* @__PURE__ */ jsx(Fragment, { children: contributions.map((c2) => {
|
|
548
|
+
if (c2.render) return /* @__PURE__ */ jsx("div", { children: c2.render(ctx) }, c2.id);
|
|
549
|
+
if (c2.region !== "sidebar" || !c2.item) return null;
|
|
550
|
+
if (ctx.undockedPanels.includes(c2.id)) return null;
|
|
551
|
+
const item = c2.item;
|
|
554
552
|
return /* @__PURE__ */ jsx(
|
|
555
553
|
Section,
|
|
556
554
|
{
|
|
557
555
|
title: item.title,
|
|
558
|
-
collapsed: ctx.collapsedSections[
|
|
559
|
-
onCollapsedChange: (next) => ctx.setSectionCollapsed(
|
|
560
|
-
onUndock: item.undockable === false ? void 0 : () => ctx.undockPanel(
|
|
556
|
+
collapsed: ctx.collapsedSections[c2.id] ?? item.defaultCollapsed ?? false,
|
|
557
|
+
onCollapsedChange: (next) => ctx.setSectionCollapsed(c2.id, next),
|
|
558
|
+
onUndock: item.undockable === false ? void 0 : () => ctx.undockPanel(c2.id, item.undockAs ?? "tile"),
|
|
561
559
|
children: item.body
|
|
562
560
|
},
|
|
563
|
-
|
|
561
|
+
c2.id
|
|
564
562
|
);
|
|
565
563
|
}) });
|
|
566
564
|
}
|
|
567
565
|
function StatusRegion({ contributions, ctx }) {
|
|
568
566
|
if (contributions.length === 0) return null;
|
|
569
|
-
return /* @__PURE__ */ jsx(StatusBar, { children: contributions.map((
|
|
570
|
-
if (
|
|
571
|
-
return /* @__PURE__ */ jsx(StatusBar.Section, { end:
|
|
572
|
-
if (
|
|
573
|
-
return /* @__PURE__ */ jsx(StatusBar.Section, { end:
|
|
567
|
+
return /* @__PURE__ */ jsx(StatusBar, { children: contributions.map((c2) => {
|
|
568
|
+
if (c2.render)
|
|
569
|
+
return /* @__PURE__ */ jsx(StatusBar.Section, { end: c2.end, children: c2.render(ctx) }, c2.id);
|
|
570
|
+
if (c2.region !== "status" || !c2.item) return null;
|
|
571
|
+
return /* @__PURE__ */ jsx(StatusBar.Section, { end: c2.end, children: /* @__PURE__ */ jsx("span", { title: c2.item.title, children: c2.item.text }) }, c2.id);
|
|
574
572
|
}) });
|
|
575
573
|
}
|
|
576
|
-
function renderEntry(
|
|
577
|
-
if (
|
|
578
|
-
if (
|
|
579
|
-
const { icon: Icon, label, shortcut, disabled, danger, onActivate } =
|
|
574
|
+
function renderEntry(c2, ctx) {
|
|
575
|
+
if (c2.render) return /* @__PURE__ */ jsx("span", { children: c2.render(ctx) }, c2.id);
|
|
576
|
+
if (c2.region !== "titlebar" || !c2.item) return null;
|
|
577
|
+
const { icon: Icon, label, shortcut, disabled, danger, onActivate } = c2.item;
|
|
580
578
|
return /* @__PURE__ */ jsx(
|
|
581
579
|
"button",
|
|
582
580
|
{
|
|
@@ -590,37 +588,37 @@ function renderEntry(c, ctx) {
|
|
|
590
588
|
onMouseDown: (e) => e.stopPropagation(),
|
|
591
589
|
children: /* @__PURE__ */ jsx(Icon, { size: 14 })
|
|
592
590
|
},
|
|
593
|
-
|
|
591
|
+
c2.id
|
|
594
592
|
);
|
|
595
593
|
}
|
|
596
594
|
function TitleBarRegion({ contributions, ctx, placement = "actions" }) {
|
|
597
595
|
const wanted = placement === "actions";
|
|
598
|
-
const mine = contributions.filter((
|
|
596
|
+
const mine = contributions.filter((c2) => (c2.end ?? false) === wanted);
|
|
599
597
|
if (mine.length === 0) return null;
|
|
600
|
-
return /* @__PURE__ */ jsx("span", { className: wanted ? "lk-trial__titlebar-actions" : "lk-trial__titlebar-lead", children: mine.map((
|
|
598
|
+
return /* @__PURE__ */ jsx("span", { className: wanted ? "lk-trial__titlebar-actions" : "lk-trial__titlebar-lead", children: mine.map((c2) => renderEntry(c2, ctx)) });
|
|
601
599
|
}
|
|
602
600
|
function groupsOf(contributions) {
|
|
603
601
|
const groups = [];
|
|
604
602
|
const byKey = /* @__PURE__ */ new Map();
|
|
605
|
-
for (const
|
|
606
|
-
if (
|
|
607
|
-
groups.push({ key:
|
|
603
|
+
for (const c2 of contributions) {
|
|
604
|
+
if (c2.group == null) {
|
|
605
|
+
groups.push({ key: c2.id, end: c2.end ?? false, entries: [c2] });
|
|
608
606
|
continue;
|
|
609
607
|
}
|
|
610
|
-
let
|
|
611
|
-
if (!
|
|
612
|
-
|
|
613
|
-
byKey.set(
|
|
614
|
-
groups.push(
|
|
608
|
+
let g3 = byKey.get(c2.group);
|
|
609
|
+
if (!g3) {
|
|
610
|
+
g3 = { key: c2.group, end: c2.end ?? false, entries: [] };
|
|
611
|
+
byKey.set(c2.group, g3);
|
|
612
|
+
groups.push(g3);
|
|
615
613
|
}
|
|
616
|
-
|
|
614
|
+
g3.entries.push(c2);
|
|
617
615
|
}
|
|
618
616
|
return groups;
|
|
619
617
|
}
|
|
620
|
-
function renderEntry2(
|
|
621
|
-
if (
|
|
622
|
-
if (
|
|
623
|
-
const { icon: Icon, label, shortcut, disabled, danger, showLabel, pressed, onActivate } =
|
|
618
|
+
function renderEntry2(c2, ctx) {
|
|
619
|
+
if (c2.render) return /* @__PURE__ */ jsx("span", { children: c2.render(ctx) }, c2.id);
|
|
620
|
+
if (c2.region !== "toolbar" || !c2.item) return null;
|
|
621
|
+
const { icon: Icon, label, shortcut, disabled, danger, showLabel, pressed, onActivate } = c2.item;
|
|
624
622
|
return /* @__PURE__ */ jsxs(
|
|
625
623
|
Toolbar.Button,
|
|
626
624
|
{
|
|
@@ -636,13 +634,13 @@ function renderEntry2(c, ctx) {
|
|
|
636
634
|
showLabel ? /* @__PURE__ */ jsx("span", { children: label }) : null
|
|
637
635
|
]
|
|
638
636
|
},
|
|
639
|
-
|
|
637
|
+
c2.id
|
|
640
638
|
);
|
|
641
639
|
}
|
|
642
640
|
function ToolbarRegion({ contributions, ctx }) {
|
|
643
641
|
if (contributions.length === 0) return null;
|
|
644
642
|
const groups = groupsOf(contributions);
|
|
645
|
-
return /* @__PURE__ */ jsx(Toolbar, { "aria-label": "Trial actions", children: groups.map((
|
|
643
|
+
return /* @__PURE__ */ jsx(Toolbar, { "aria-label": "Trial actions", children: groups.map((g3) => /* @__PURE__ */ jsx(Toolbar.Group, { end: g3.end, "aria-label": g3.key, children: g3.entries.map((c2) => renderEntry2(c2, ctx)) }, g3.key)) });
|
|
646
644
|
}
|
|
647
645
|
function ViewportRegion({ contributions, ctx }) {
|
|
648
646
|
const { ref, onKeyDown } = useRovingTabIndex();
|
|
@@ -655,10 +653,10 @@ function ViewportRegion({ contributions, ctx }) {
|
|
|
655
653
|
role: "toolbar",
|
|
656
654
|
"aria-label": "View",
|
|
657
655
|
onKeyDown,
|
|
658
|
-
children: contributions.map((
|
|
659
|
-
if (
|
|
660
|
-
if (
|
|
661
|
-
const { icon: Icon, label, disabled, onActivate } =
|
|
656
|
+
children: contributions.map((c2) => {
|
|
657
|
+
if (c2.render) return /* @__PURE__ */ jsx("span", { children: c2.render(ctx) }, c2.id);
|
|
658
|
+
if (c2.region !== "viewport" || !c2.item) return null;
|
|
659
|
+
const { icon: Icon, label, disabled, onActivate } = c2.item;
|
|
662
660
|
return /* @__PURE__ */ jsx(
|
|
663
661
|
"button",
|
|
664
662
|
{
|
|
@@ -670,7 +668,7 @@ function ViewportRegion({ contributions, ctx }) {
|
|
|
670
668
|
onClick: () => onActivate(ctx),
|
|
671
669
|
children: /* @__PURE__ */ jsx(Icon, { size: 16 })
|
|
672
670
|
},
|
|
673
|
-
|
|
671
|
+
c2.id
|
|
674
672
|
);
|
|
675
673
|
})
|
|
676
674
|
}
|
|
@@ -678,5 +676,5 @@ function ViewportRegion({ contributions, ctx }) {
|
|
|
678
676
|
}
|
|
679
677
|
|
|
680
678
|
export { ANNOTATION_TOOLS, ANNOTATION_WEASEL_TOOLS, AnnotationsContext, ExportMenu, MarkList, PaletteRegion, SidebarRegion, StatusRegion, TitleBarRegion, ToolbarRegion, ViewportRegion, annotationToolInfo, builtinContributions, mergeContributions, suppressContributions, useAnnotations, useAnnotationsOptional };
|
|
681
|
-
//# sourceMappingURL=chunk-
|
|
682
|
-
//# sourceMappingURL=chunk-
|
|
679
|
+
//# sourceMappingURL=chunk-C42T6DJT.js.map
|
|
680
|
+
//# sourceMappingURL=chunk-C42T6DJT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/annotations/AnnotationsContext.ts","../src/annotations/ExportMenu.tsx","../src/annotations/MarkList.tsx","../src/annotations/toolMap.ts","../src/chrome/builtins.tsx","../src/chrome/merge.ts","../src/chrome/regions/PaletteRegion.tsx","../src/chrome/regions/SidebarRegion.tsx","../src/chrome/regions/StatusRegion.tsx","../src/chrome/regions/TitleBarRegion.tsx","../src/chrome/regions/ToolbarRegion.tsx","../src/chrome/regions/ViewportRegion.tsx"],"names":["g","f","jsx","jsxs","u","r","c","n","o","renderEntry"],"mappings":";;;;;;AAIO,IAAM,kBAAA,GAAqB,cAAqC,IAAI;AAO3E,SAAS,eAAe,GAAA,EAAkC;AACxD,EAAA,MAAM,OAAA,GAAU,OAAO,CAAC,CAAA;AACxB,EAAA,oBAAA;AAAA,IACE,WAAA;AAAA,MACE,CAAC,EAAA,KACC,GAAA,EAAK,SAAA,CAAU,MAAM;AACnB,QAAA,OAAA,CAAQ,OAAA,IAAW,CAAA;AACnB,QAAA,EAAA,EAAG;AAAA,MACL,CAAC,MAAM,MAAM;AAAA,MAAC,CAAA,CAAA;AAAA,MAChB,CAAC,GAAG;AAAA,KACN;AAAA,IACA,WAAA,CAAY,MAAM,OAAA,CAAQ,OAAA,EAAS,EAAE,CAAA;AAAA,IACrC,MAAM;AAAA,GACR;AACF;AAMO,SAAS,cAAA,GAAiC;AAC/C,EAAA,MAAM,GAAA,GAAM,WAAW,kBAA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,YACP,QAAA;AAAA,YACA,OAAA,EAAS,MAAM,UAAA,CAAW,GAAG,CAAA;AAAA,YAE7B,QAAA,kBAAAA,GAAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAM,EAAA,EAAI;AAAA,WAAA;AAAA,UARXI,EAAAA,CAAE;AAAA,SAST;AAAA,MAEJ,CAAC;AAAA;AAAA,GACH;AAEJ","file":"chunk-C42T6DJT.js","sourcesContent":["import { createContext, useCallback, useContext, useRef, useSyncExternalStore } from 'react';\nimport type { AnnotationsApi } from './types';\n\n/** Null in a trial whose instrument declares no `annotations`. */\nexport const AnnotationsContext = createContext<AnnotationsApi | null>(null);\n\n/** Re-render the caller whenever any of the store's scenes changes.\n *\n * The API is a stable facade over mutable scenes, so nothing about its\n * identity says a mark was added — a component reading `query()` without this\n * renders one answer and never revises it. */\nfunction useMarkVersion(api: AnnotationsApi | null): void {\n const version = useRef(0);\n useSyncExternalStore(\n useCallback(\n (fn: () => void) =>\n api?.subscribe(() => {\n version.current += 1;\n fn();\n }) ?? (() => {}),\n [api],\n ),\n useCallback(() => version.current, []),\n () => 0,\n );\n}\n\n/** The marks on this trial's targets. Reached through a hook rather than the\n * chrome context, which carries no instrument state — a sidebar panel listing\n * marks pulls it the way `useTrialState()` does. Throws outside a trial whose\n * instrument declares the capability. */\nexport function useAnnotations(): AnnotationsApi {\n const api = useContext(AnnotationsContext);\n useMarkVersion(api);\n if (!api) {\n throw new Error(\n '[labkit] useAnnotations requires an instrument that declares the `annotations` capability',\n );\n }\n return api;\n}\n\n/** The marks on this trial's targets, or null. For chrome that renders in\n * every trial and does something else where there are none. */\nexport function useAnnotationsOptional(): AnnotationsApi | null {\n const api = useContext(AnnotationsContext);\n useMarkVersion(api);\n return api;\n}\n","import { ExportIcon } from '@weasel-js/ui';\nimport { useId, useState } from 'react';\nimport { Callout } from '../passthrough/weasel-ui';\nimport { Toolbar } from '../primitives/Toolbar';\nimport { useAnnotationsOptional } from './AnnotationsContext';\nimport type { CaptureResult } from './types';\n\nconst SCALES = [1, 2, 4] as const;\nconst FORMATS = [\n { id: 'png', label: 'PNG' },\n { id: 'svg', label: 'SVG' },\n] as const;\n\ntype Format = (typeof FORMATS)[number]['id'];\n\nfunction fileName(result: CaptureResult): string {\n return `${result.target.replace(/[^a-z0-9._-]+/gi, '-')}.${result.format}`;\n}\n\n/** A blob the person asked for, handed to the browser's own save flow. The\n * object URL is revoked on the next turn — revoking it synchronously races\n * the navigation the click starts. */\nfunction download(result: CaptureResult): void {\n const url = URL.createObjectURL(result.blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = fileName(result);\n a.click();\n setTimeout(() => URL.revokeObjectURL(url), 0);\n}\n\n/** PNG goes to the clipboard as an image. SVG goes as text: `image/svg+xml`\n * needs Chromium's `web ` prefix and nothing else reads it, while the markup\n * is what a person pasting a vector export actually wants. */\nasync function copy(result: CaptureResult): Promise<void> {\n if (result.format === 'svg') {\n await navigator.clipboard.writeText(await result.blob.text());\n return;\n }\n await navigator.clipboard.write([new ClipboardItem({ 'image/png': result.blob })]);\n}\n\n/**\n * Export a target's picture with its marks on it.\n *\n * A panel rather than a button because a mark belongs to a target: with more\n * than one pane, \"export\" on its own does not say what.\n *\n * Reads the store through the hook the way `<MarkList>` does — the chrome\n * context carries no instrument state and is not the route to it.\n */\nexport function ExportMenu() {\n const marks = useAnnotationsOptional();\n const [anchor, setAnchor] = useState<HTMLSpanElement | null>(null);\n const [open, setOpen] = useState(false);\n const [target, setTarget] = useState<string | null>(null);\n const [format, setFormat] = useState<Format>('png');\n const [scale, setScale] = useState<number>(2);\n const [busy, setBusy] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const titleId = useId();\n\n if (!marks) return null;\n const targets = marks.targets();\n const chosen = target ?? targets[0]?.id ?? null;\n\n const run = async (then: (r: CaptureResult) => void | Promise<void>): Promise<void> => {\n if (!chosen) return;\n setBusy(true);\n setError(null);\n try {\n await then(await marks.capture(chosen, { format, scale }));\n setOpen(false);\n } catch (err) {\n setError(err instanceof Error ? err.message : String(err));\n } finally {\n setBusy(false);\n }\n };\n\n return (\n <span className=\"lk-export\" ref={setAnchor}>\n <Toolbar.Button\n iconOnly\n pressed={open}\n aria-label=\"Export\"\n title=\"Export\"\n onClick={() => setOpen((was) => !was)}\n >\n <ExportIcon size={16} />\n </Toolbar.Button>\n <Callout\n triggerRef={{ current: anchor }}\n isOpen={open}\n onOpenChange={setOpen}\n onDismiss={() => setOpen(false)}\n placement=\"bottom end\"\n aria-labelledby={titleId}\n >\n <div className=\"lk-export__panel\">\n <span className=\"lk-export__title\" id={titleId}>\n Export\n </span>\n\n <label className=\"lk-export__row\">\n <span>Target</span>\n {/* Native controls: role, name and keyboard operability for free,\n and a five-control panel is not the place to rebuild them. */}\n <select\n aria-label=\"Target\"\n value={chosen ?? ''}\n onChange={(e) => setTarget(e.target.value)}\n >\n {targets.map((t) => (\n <option key={t.id} value={t.id}>\n {t.id}\n </option>\n ))}\n </select>\n </label>\n\n {/* A <fieldset>/<legend> cannot do this: a legend is outside its\n fieldset's grid formatting context, so it will not take a grid\n column and every choice row drops below its own label. */}\n <div className=\"lk-export__row\">\n <span>Format</span>\n <span className=\"lk-export__choices\" role=\"radiogroup\" aria-label=\"Format\">\n {FORMATS.map((f) => (\n <label key={f.id}>\n <input\n type=\"radio\"\n name=\"lk-export-format\"\n checked={format === f.id}\n onChange={() => setFormat(f.id)}\n />\n {f.label}\n </label>\n ))}\n </span>\n </div>\n\n <div className=\"lk-export__row\">\n <span>Scale</span>\n <span className=\"lk-export__choices\" role=\"radiogroup\" aria-label=\"Scale\">\n {SCALES.map((s) => (\n <label key={s}>\n <input\n type=\"radio\"\n name=\"lk-export-scale\"\n checked={scale === s}\n onChange={() => setScale(s)}\n />\n {s}×\n </label>\n ))}\n </span>\n </div>\n\n <div className=\"lk-export__actions\">\n <button type=\"button\" disabled={busy || !chosen} onClick={() => run(download)}>\n Download\n </button>\n <button type=\"button\" disabled={busy || !chosen} onClick={() => run(copy)}>\n Copy\n </button>\n </div>\n\n {error ? (\n <p className=\"lk-export__error\" role=\"alert\">\n {error}\n </p>\n ) : null}\n </div>\n </Callout>\n </span>\n );\n}\n","import { Input } from '../passthrough/weasel-ui';\nimport { useAnnotations } from './AnnotationsContext';\nimport type { AnnotationMeaning } from './types';\n\n/** Props for `<MarkList>`. */\nexport interface MarkListProps {\n /** The instrument's vocabulary. Omitted, rows carry no status control —\n * a host that declared none owns what a mark means. */\n meaning?: AnnotationMeaning;\n /** The live config, for answering staleness. */\n config: unknown;\n}\n\n/** Every mark on this trial's targets: what it says, and whether it still\n * describes the picture under it.\n *\n * Reads the store through the hook, which re-renders on every mutation — so a\n * mark drawn on a pane appears here without anything wiring the two. */\nexport function MarkList({ meaning, config }: MarkListProps) {\n const marks = useAnnotations();\n const all = marks.query();\n const statuses = meaning?.statuses ?? [];\n\n if (all.length === 0) {\n return <div className=\"lk-mark-list__empty\">No marks yet</div>;\n }\n\n return (\n <ul className=\"lk-mark-list\">\n {all.map((a) => {\n const stale = marks.isStale(a, config);\n return (\n <li className=\"lk-mark-list__row\" key={a.id}>\n <div className=\"lk-mark-list__head\">\n <span className=\"lk-mark-list__kind\">{a.kind}</span>\n <span className=\"lk-mark-list__target\">{a.target}</span>\n {stale ? <span className=\"lk-mark-list__stale\">stale</span> : null}\n <button\n type=\"button\"\n className=\"lk-mark-list__drop\"\n aria-label={`Remove ${a.kind} on ${a.target}`}\n onClick={() => marks.remove(a.id)}\n >\n ×\n </button>\n </div>\n <Input\n className=\"lk-mark-list__title\"\n aria-label={`Title of ${a.kind} on ${a.target}`}\n value={a.title ?? ''}\n placeholder=\"Untitled\"\n onChange={(next) => marks.update(a.id, { title: next })}\n />\n {statuses.length > 0 ? (\n // A native select: it carries role, name and keyboard operability\n // for free, and a sidebar row is not the place to rebuild them.\n <select\n className=\"lk-mark-list__status\"\n aria-label={`Status of ${a.kind} on ${a.target}`}\n value={a.status ?? ''}\n onChange={(e) => marks.update(a.id, { status: e.target.value })}\n >\n <option value=\"\">—</option>\n {statuses.map((s) => (\n <option key={s.id} value={s.id}>\n {s.label}\n </option>\n ))}\n </select>\n ) : null}\n </li>\n );\n })}\n </ul>\n );\n}\n","import type { BuiltinToolId } from '@weasel-js/core';\nimport {\n ArrowIcon,\n EllipseIcon,\n LineIcon,\n PencilIcon,\n RectIcon,\n SelectIcon,\n TextIcon,\n} from '@weasel-js/ui';\nimport type { TrialTool } from '../tools/types';\nimport type { AnnotationKind } from './types';\n\n/** Which weasel tool an annotation tool drives, and what kind of mark that\n * makes. `select` makes none. */\nexport interface AnnotationToolInfo {\n weaselTool: BuiltinToolId;\n kind?: AnnotationKind;\n}\n\n// `arrow` and `stroke` have no weasel tool of their own, so the kind cannot be\n// read back from the insert — the overlay takes it from the tool id it holds.\nconst TOOLS: Record<string, AnnotationToolInfo> = {\n select: { weaselTool: 'select' },\n stroke: { weaselTool: 'pencil', kind: 'stroke' },\n line: { weaselTool: 'line', kind: 'line' },\n arrow: { weaselTool: 'line', kind: 'arrow' },\n rect: { weaselTool: 'rect', kind: 'rect' },\n ellipse: { weaselTool: 'ellipse', kind: 'ellipse' },\n text: { weaselTool: 'text', kind: 'text' },\n};\n\n/** The palette an instrument gets for declaring `annotations`. Ids share the\n * trial's contribution namespace with `instrument.tools`, and one tool slot\n * holds whichever is active. */\nexport const ANNOTATION_TOOLS: readonly TrialTool[] = [\n { id: 'select', label: 'Select', icon: SelectIcon, group: 'annotate' },\n { id: 'stroke', label: 'Freehand', icon: PencilIcon, group: 'annotate' },\n { id: 'line', label: 'Line', icon: LineIcon, group: 'annotate' },\n { id: 'arrow', label: 'Arrow', icon: ArrowIcon, group: 'annotate' },\n { id: 'rect', label: 'Rectangle', icon: RectIcon, group: 'annotate' },\n { id: 'ellipse', label: 'Ellipse', icon: EllipseIcon, group: 'annotate' },\n { id: 'text', label: 'Text', icon: TextIcon, group: 'annotate' },\n];\n\n/** What `id` drives, or undefined for a tool that is not one of these. */\nexport function annotationToolInfo(id: string | null): AnnotationToolInfo | undefined {\n return id === null ? undefined : TOOLS[id];\n}\n\n/** Every weasel tool the overlay has to mount for this palette to work. */\nexport const ANNOTATION_WEASEL_TOOLS: readonly BuiltinToolId[] = [\n ...new Set(Object.values(TOOLS).map((t) => t.weaselTool)),\n];\n","import {\n CloneIcon,\n CloseIcon,\n FitIcon,\n LoupeIcon,\n RedoIcon,\n ResetIcon,\n SnapshotIcon,\n UndoIcon,\n ZoomInIcon,\n ZoomOutIcon,\n} from '@weasel-js/ui';\nimport { ExportMenu } from '../annotations/ExportMenu';\nimport { MarkList } from '../annotations/MarkList';\nimport { ANNOTATION_TOOLS } from '../annotations/toolMap';\nimport type { ControlRenderer } from '../config/types';\nimport { ControlPanel } from '../controls/ControlPanel';\nimport type { Instrument } from '../instrument/types';\nimport { Select } from '../passthrough/weasel-ui';\nimport { FpsMeter } from '../primitives/FpsMeter';\nimport { ScaleIndicator } from '../primitives/ScaleIndicator';\nimport { ZoomControl } from '../primitives/ZoomControl';\nimport type { TrialChromeContext, TrialContribution } from './types';\n\nconst ZOOM_STEP = 1.25;\n\n/** The property groups inside a contribution are folded under keys prefixed\n * with that contribution's id, so a group called `marks` cannot fold the\n * sidebar section of the same name. `ControlPanel` keys by bare label, so the\n * prefix goes on here and comes off again. */\nfunction groupFolds(\n collapsedSections: Readonly<Record<string, boolean>>,\n id: string,\n): Record<string, boolean> {\n const prefix = `${id}/`;\n const out: Record<string, boolean> = {};\n for (const [key, value] of Object.entries(collapsedSections)) {\n if (key.startsWith(prefix)) out[key.slice(prefix.length)] = value;\n }\n return out;\n}\n\n/**\n * The contributions a trial gets from what its instrument declared. This is\n * the whole \"declaring a capability provides the chrome\" rule — it replaces\n * the presence checks that used to be spread across the runtime.\n */\nexport function builtinContributions(\n instrument: Instrument,\n ctx: TrialChromeContext,\n controls?: Record<string, ControlRenderer>,\n): TrialContribution[] {\n const out: TrialContribution[] = [];\n const zoom = ctx.zoom;\n\n // Weasel history is the undo authority for marks, so declaring `annotations`\n // gets the buttons whether or not the instrument also declares `undo`.\n if (instrument.undo != null || instrument.annotations != null) {\n out.push({\n id: 'undo',\n region: 'toolbar',\n group: 'history',\n item: {\n icon: UndoIcon,\n label: 'Undo',\n shortcut: 'Mod+Z',\n disabled: !ctx.canUndo,\n onActivate: ctx.undo,\n },\n });\n out.push({\n id: 'redo',\n region: 'toolbar',\n group: 'history',\n item: {\n icon: RedoIcon,\n label: 'Redo',\n shortcut: 'Mod+Shift+Z',\n disabled: !ctx.canRedo,\n onActivate: ctx.redo,\n },\n });\n }\n\n // Declaring `annotations` provides the drawing palette, the way declaring\n // `tools` provides the instrument's own; both write the same tool slot.\n // A tool id shares the contribution namespace, so a tool called `close`\n // collides with the built-in close button and throws — and so do two tools\n // of the same name from these two sources.\n const tools = [\n ...(instrument.annotations ? ANNOTATION_TOOLS : []),\n ...(instrument.tools?.tools ?? []),\n ];\n for (const t of tools) {\n out.push({\n id: t.id,\n region: 'palette',\n group: t.group,\n item: { icon: t.icon, label: t.label, shortcut: t.shortcut },\n });\n }\n\n if (instrument.loupe != null) {\n out.push({\n id: 'loupe',\n region: 'toolbar',\n group: 'view',\n item: {\n icon: LoupeIcon,\n label: 'Loupe',\n pressed: ctx.loupeOn,\n onActivate: ctx.toggleLoupe,\n },\n });\n }\n\n // Zoom acts on the view of the trial, so it is a viewport control. A trial\n // holding a non-2D view reports zoom as null and gets none of this.\n if (instrument.canvas != null && zoom !== null) {\n out.push({\n id: 'zoom-out',\n region: 'viewport',\n group: 'zoom',\n item: {\n icon: ZoomOutIcon,\n label: 'Zoom out',\n onActivate: () => ctx.setZoom(zoom / ZOOM_STEP),\n },\n });\n out.push({\n id: 'zoom-in',\n region: 'viewport',\n group: 'zoom',\n item: {\n icon: ZoomInIcon,\n label: 'Zoom in',\n onActivate: () => ctx.setZoom(zoom * ZOOM_STEP),\n },\n });\n out.push({\n id: 'actual-size',\n region: 'viewport',\n group: 'zoom',\n item: { icon: FitIcon, label: 'Actual size', onActivate: () => ctx.setZoom(1) },\n });\n out.push({\n id: 'zoom-control',\n region: 'viewport',\n group: 'zoom',\n render: (c) => <ZoomControl zoom={c.zoom ?? 1} onZoomChange={c.setZoom} />,\n });\n out.push({\n id: 'scale',\n region: 'status',\n group: 'view',\n render: () => <ScaleIndicator />,\n });\n out.push({\n id: 'fps',\n region: 'status',\n group: 'view',\n end: true,\n render: () => <FpsMeter />,\n });\n }\n\n if (instrument.annotations != null) {\n // A popover, so it takes the `render` escape: the panel picks a target,\n // and an icon button cannot ask which one.\n out.push({\n id: 'export',\n region: 'toolbar',\n group: 'trial',\n end: true,\n render: () => <ExportMenu />,\n });\n out.push({\n id: 'marks',\n region: 'sidebar',\n item: {\n title: 'Marks',\n body: <MarkList meaning={instrument.annotations.meaning} config={ctx.config} />,\n },\n });\n }\n\n if (Object.keys(ctx.configSchema.group.children).length > 0) {\n out.push({\n id: 'settings',\n region: 'sidebar',\n item: {\n title: 'Settings',\n body: (\n <ControlPanel\n schema={ctx.configSchema}\n config={ctx.config as Record<string, unknown>}\n setConfig={(key, value) => ctx.setConfig(String(key), value)}\n renderers={controls}\n collapsed={groupFolds(ctx.collapsedSections, 'settings')}\n onCollapse={(label, next) => ctx.setSectionCollapsed(`settings/${label}`, next)}\n />\n ),\n },\n });\n }\n\n if (ctx.savedSnapshots.length > 0) {\n // A picker is not an icon button, so it takes the render escape. Held at\n // `selectedKey={null}` so it stays a \"load one\" action rather than\n // drifting into a display of what was loaded last.\n out.push({\n id: 'snapshot-load',\n region: 'toolbar',\n group: 'trial',\n end: true,\n render: (c) => (\n <Select\n className=\"lk-toolbar__load-select\"\n aria-label=\"Load snapshot\"\n placeholder=\"Load…\"\n selectedKey={null}\n options={c.savedSnapshots.map((sn) => ({ value: sn.id, label: sn.name }))}\n onSelectionChange={(id) => {\n if (id != null) c.loadSnapshot(String(id));\n }}\n />\n ),\n });\n }\n out.push({\n id: 'clone',\n region: 'titlebar',\n end: true,\n item: { icon: CloneIcon, label: 'Clone trial', onActivate: ctx.clone },\n });\n out.push({\n id: 'reset',\n region: 'titlebar',\n end: true,\n item: { icon: ResetIcon, label: 'Reset trial', onActivate: ctx.reset },\n });\n out.push({\n id: 'snapshot',\n region: 'titlebar',\n end: true,\n item: {\n icon: SnapshotIcon,\n label: 'Save snapshot',\n shortcut: 'Mod+S',\n onActivate: () => ctx.saveSnapshot(),\n },\n });\n out.push({\n id: 'close',\n region: 'titlebar',\n end: true,\n item: {\n icon: CloseIcon,\n label: ctx.isLastTrial ? 'Cannot close the last trial' : 'Close trial',\n danger: true,\n disabled: ctx.isLastTrial,\n onActivate: ctx.close,\n },\n });\n\n return out;\n}\n","import type { TrialContribution } from './types';\n\n/**\n * Concatenate contribution bundles into one list, preserving order — order\n * decides how a region lays its contributions out, so it is part of the\n * result, not an accident of it.\n *\n * Throws on a duplicate id rather than dropping one: a contribution silently\n * losing to a later bundle is the failure a registry exists to prevent.\n */\nexport function mergeContributions(\n ...bundles: readonly TrialContribution[][]\n): TrialContribution[] {\n const out: TrialContribution[] = [];\n const seen = new Set<string>();\n for (const bundle of bundles) {\n for (const entry of bundle) {\n if (seen.has(entry.id)) {\n throw new Error(\n `[labkit] mergeContributions: duplicate contribution id \"${entry.id}\". ` +\n 'Two bundles registered the same id; rename one, or suppress the ' +\n 'built-in before adding yours.',\n );\n }\n seen.add(entry.id);\n out.push(entry);\n }\n }\n return out;\n}\n\n/**\n * Drop contributions by id. Throws when an id is not present: a typo that\n * silently suppresses nothing is the same class of bug as a duplicate id\n * silently winning.\n */\nexport function suppressContributions(\n bundle: readonly TrialContribution[],\n ids: readonly string[],\n): TrialContribution[] {\n const present = new Set(bundle.map((c) => c.id));\n for (const id of ids) {\n if (!present.has(id)) {\n throw new Error(\n `[labkit] cannot suppress \"${id}\": no contribution with that id. ` +\n `Present ids: ${[...present].join(', ')}`,\n );\n }\n }\n const drop = new Set(ids);\n return bundle.filter((c) => !drop.has(c.id));\n}\n","import { ToolButton, ToolGroup } from '../../passthrough/weasel-ui';\nimport { useRovingTabIndex } from '../../primitives/useRovingTabIndex';\nimport type { TrialChromeContext, TrialContribution } from '../types';\n\n/** Props for `<PaletteRegion>`. */\nexport interface PaletteRegionProps {\n contributions: readonly TrialContribution[];\n ctx: TrialChromeContext;\n}\n\n/** A trial's tool strip. Selection lives in the trial's or the lab's tool\n * slot; this region only reflects it. */\nexport function PaletteRegion({ contributions, ctx }: PaletteRegionProps) {\n const { ref, onKeyDown } = useRovingTabIndex<HTMLDivElement>('vertical');\n if (contributions.length === 0) return null;\n return (\n <div\n ref={ref}\n className=\"lk-palette-region\"\n role=\"toolbar\"\n aria-label=\"Tools\"\n aria-orientation=\"vertical\"\n onKeyDown={onKeyDown}\n >\n <ToolGroup orientation=\"vertical\">\n {contributions.map((c) => {\n if (c.render) return <span key={c.id}>{c.render(ctx)}</span>;\n if (c.region !== 'palette' || !c.item) return null;\n const { icon: Icon, label, shortcut, disabled } = c.item;\n return (\n <ToolButton\n key={c.id}\n icon={<Icon size={16} />}\n label={label}\n shortcut={shortcut}\n active={ctx.activeToolId === c.id}\n disabled={disabled}\n onClick={() => ctx.setActiveTool(c.id)}\n />\n );\n })}\n </ToolGroup>\n </div>\n );\n}\n","import type { ReactNode } from 'react';\nimport type { SidebarSection, TrialChromeContext, TrialContribution } from '../types';\n\n/** Props for `<SidebarRegion>`. */\nexport interface SidebarRegionProps {\n contributions: readonly TrialContribution[];\n ctx: TrialChromeContext;\n}\n\nfunction Section({\n title,\n collapsed,\n onCollapsedChange,\n onUndock,\n children,\n}: {\n title: string;\n collapsed: boolean;\n onCollapsedChange: (collapsed: boolean) => void;\n onUndock?: () => void;\n children: ReactNode;\n}) {\n return (\n <section className=\"lk-sidebar-section\">\n <div className=\"lk-sidebar-section__bar\">\n <button\n type=\"button\"\n className=\"lk-sidebar-section__head\"\n aria-expanded={!collapsed}\n onClick={() => onCollapsedChange(!collapsed)}\n >\n {title}\n </button>\n {onUndock ? (\n <button\n type=\"button\"\n className=\"lk-sidebar-section__undock\"\n aria-label={`Undock ${title}`}\n title={`Undock ${title}`}\n onClick={onUndock}\n >\n ⧉\n </button>\n ) : null}\n </div>\n {collapsed ? null : <div className=\"lk-sidebar-section__body\">{children}</div>}\n </section>\n );\n}\n\n/** Lays a trial's `sidebar` contributions out as titled, collapsible sections.\n * A section the trial has torn out is not rendered here — `Trial` portals its\n * body into the workspace instead. */\nexport function SidebarRegion({ contributions, ctx }: SidebarRegionProps) {\n if (contributions.length === 0) return null;\n return (\n <>\n {contributions.map((c) => {\n if (c.render) return <div key={c.id}>{c.render(ctx)}</div>;\n if (c.region !== 'sidebar' || !c.item) return null;\n if (ctx.undockedPanels.includes(c.id)) return null;\n const item = c.item as SidebarSection;\n return (\n <Section\n key={c.id}\n title={item.title}\n collapsed={ctx.collapsedSections[c.id] ?? item.defaultCollapsed ?? false}\n onCollapsedChange={(next) => ctx.setSectionCollapsed(c.id, next)}\n onUndock={\n item.undockable === false\n ? undefined\n : () => ctx.undockPanel(c.id, item.undockAs ?? 'tile')\n }\n >\n {item.body}\n </Section>\n );\n })}\n </>\n );\n}\n","import { StatusBar } from '../../primitives/StatusBar';\nimport type { TrialChromeContext, TrialContribution } from '../types';\n\n/** Props for `<StatusRegion>`. */\nexport interface StatusRegionProps {\n contributions: readonly TrialContribution[];\n ctx: TrialChromeContext;\n}\n\n/** Lays a trial's `status` contributions out as readouts. */\nexport function StatusRegion({ contributions, ctx }: StatusRegionProps) {\n if (contributions.length === 0) return null;\n return (\n <StatusBar>\n {contributions.map((c) => {\n if (c.render)\n return (\n <StatusBar.Section key={c.id} end={c.end}>\n {c.render(ctx)}\n </StatusBar.Section>\n );\n if (c.region !== 'status' || !c.item) return null;\n return (\n <StatusBar.Section key={c.id} end={c.end}>\n <span title={c.item.title}>{c.item.text}</span>\n </StatusBar.Section>\n );\n })}\n </StatusBar>\n );\n}\n","import type { ReactNode } from 'react';\nimport type { TrialChromeContext, TrialContribution } from '../types';\n\n/** Which end of the title bar a `<TitleBarRegion>` lays out: `'lead'` renders\n * the contributions that leave `end` unset, before the title; `'actions'`\n * renders the ones that set it, after everything else. */\nexport type TitleBarPlacement = 'lead' | 'actions';\n\n/** Props for `<TitleBarRegion>`. */\nexport interface TitleBarRegionProps {\n contributions: readonly TrialContribution[];\n ctx: TrialChromeContext;\n /** Defaults to `'actions'`, where the built-ins live. */\n placement?: TitleBarPlacement;\n}\n\nfunction renderEntry(c: TrialContribution, ctx: TrialChromeContext): ReactNode {\n if (c.render) return <span key={c.id}>{c.render(ctx)}</span>;\n if (c.region !== 'titlebar' || !c.item) return null;\n const { icon: Icon, label, shortcut, disabled, danger, onActivate } = c.item;\n return (\n <button\n key={c.id}\n type=\"button\"\n className={`lk-titlebar-button${danger ? ' lk-titlebar-button--danger' : ''}`}\n disabled={disabled}\n aria-label={label}\n title={shortcut ? `${label} (${shortcut})` : label}\n onClick={() => onActivate(ctx)}\n // The bar behind these buttons is the window drag surface, so a press\n // that lands here must not also start a drag.\n onPointerDown={(e) => e.stopPropagation()}\n onMouseDown={(e) => e.stopPropagation()}\n >\n <Icon size={14} />\n </button>\n );\n}\n\n/** Lays a trial's `titlebar` contributions out at one end of the bar. */\nexport function TitleBarRegion({ contributions, ctx, placement = 'actions' }: TitleBarRegionProps) {\n const wanted = placement === 'actions';\n const mine = contributions.filter((c) => (c.end ?? false) === wanted);\n if (mine.length === 0) return null;\n return (\n <span className={wanted ? 'lk-trial__titlebar-actions' : 'lk-trial__titlebar-lead'}>\n {mine.map((c) => renderEntry(c, ctx))}\n </span>\n );\n}\n","import type { ReactNode } from 'react';\nimport { Toolbar } from '../../primitives/Toolbar';\nimport type { TrialChromeContext, TrialContribution } from '../types';\n\n/** Props for `<ToolbarRegion>`. */\nexport interface ToolbarRegionProps {\n contributions: readonly TrialContribution[];\n ctx: TrialChromeContext;\n}\n\ninterface Group {\n key: string;\n end: boolean;\n entries: TrialContribution[];\n}\n\n/** Bucket by group, preserving first-appearance order. Ungrouped\n * contributions each become their own bucket so they stay in place. */\nfunction groupsOf(contributions: readonly TrialContribution[]): Group[] {\n const groups: Group[] = [];\n const byKey = new Map<string, Group>();\n for (const c of contributions) {\n if (c.group == null) {\n groups.push({ key: c.id, end: c.end ?? false, entries: [c] });\n continue;\n }\n let g = byKey.get(c.group);\n if (!g) {\n g = { key: c.group, end: c.end ?? false, entries: [] };\n byKey.set(c.group, g);\n groups.push(g);\n }\n g.entries.push(c);\n }\n return groups;\n}\n\nfunction renderEntry(c: TrialContribution, ctx: TrialChromeContext): ReactNode {\n if (c.render) return <span key={c.id}>{c.render(ctx)}</span>;\n if (c.region !== 'toolbar' || !c.item) return null;\n const { icon: Icon, label, shortcut, disabled, danger, showLabel, pressed, onActivate } = c.item;\n return (\n <Toolbar.Button\n key={c.id}\n iconOnly={!showLabel}\n variant={danger ? 'danger' : 'default'}\n disabled={disabled}\n pressed={pressed}\n aria-label={label}\n title={shortcut ? `${label} (${shortcut})` : label}\n onClick={() => onActivate(ctx)}\n >\n <Icon size={16} />\n {showLabel ? <span>{label}</span> : null}\n </Toolbar.Button>\n );\n}\n\n/** Lays a trial's `toolbar` contributions out, grouped by their `group`. */\nexport function ToolbarRegion({ contributions, ctx }: ToolbarRegionProps) {\n if (contributions.length === 0) return null;\n const groups = groupsOf(contributions);\n return (\n <Toolbar aria-label=\"Trial actions\">\n {groups.map((g) => (\n <Toolbar.Group key={g.key} end={g.end} aria-label={g.key}>\n {g.entries.map((c) => renderEntry(c, ctx))}\n </Toolbar.Group>\n ))}\n </Toolbar>\n );\n}\n","import { useRovingTabIndex } from '../../primitives/useRovingTabIndex';\nimport type { TrialChromeContext, TrialContribution } from '../types';\n\n/** Props for `<ViewportRegion>`. */\nexport interface ViewportRegionProps {\n contributions: readonly TrialContribution[];\n ctx: TrialChromeContext;\n}\n\n/**\n * Controls acting on the view of a trial. Anchored inside the content well\n * rather than in the toolbar, which acts on the trial itself.\n */\nexport function ViewportRegion({ contributions, ctx }: ViewportRegionProps) {\n const { ref, onKeyDown } = useRovingTabIndex<HTMLDivElement>();\n if (contributions.length === 0) return null;\n return (\n <div\n ref={ref}\n className=\"lk-viewport-controls\"\n role=\"toolbar\"\n aria-label=\"View\"\n onKeyDown={onKeyDown}\n >\n {contributions.map((c) => {\n if (c.render) return <span key={c.id}>{c.render(ctx)}</span>;\n if (c.region !== 'viewport' || !c.item) return null;\n const { icon: Icon, label, disabled, onActivate } = c.item;\n return (\n <button\n key={c.id}\n type=\"button\"\n className=\"lk-viewport-controls__button\"\n aria-label={label}\n title={label}\n disabled={disabled}\n onClick={() => onActivate(ctx)}\n >\n <Icon size={16} />\n </button>\n );\n })}\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// src/config/path.ts
|
|
2
|
+
function isRecord(value) {
|
|
3
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
|
+
}
|
|
5
|
+
function valueAtPath(config, path) {
|
|
6
|
+
let cur = config;
|
|
7
|
+
for (const segment of path.split(".")) {
|
|
8
|
+
if (!isRecord(cur)) return void 0;
|
|
9
|
+
cur = cur[segment];
|
|
10
|
+
}
|
|
11
|
+
return cur;
|
|
12
|
+
}
|
|
13
|
+
function hasConfigPath(config, path) {
|
|
14
|
+
let cur = config;
|
|
15
|
+
for (const segment of path.split(".")) {
|
|
16
|
+
if (!isRecord(cur) || !(segment in cur)) return false;
|
|
17
|
+
cur = cur[segment];
|
|
18
|
+
}
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
function writeIn(node, segments, value) {
|
|
22
|
+
const [head, ...rest] = segments;
|
|
23
|
+
if (head === void 0) return value;
|
|
24
|
+
const base = isRecord(node) ? node : {};
|
|
25
|
+
return { ...base, [head]: rest.length === 0 ? value : writeIn(base[head], rest, value) };
|
|
26
|
+
}
|
|
27
|
+
function withValueAtPath(config, path, value) {
|
|
28
|
+
return writeIn(config, path.split("."), value);
|
|
29
|
+
}
|
|
30
|
+
function fillConfigDefaults(stored, defaults) {
|
|
31
|
+
if (!isRecord(defaults)) return stored === void 0 ? defaults : stored;
|
|
32
|
+
const base = isRecord(stored) ? stored : {};
|
|
33
|
+
const out = { ...base };
|
|
34
|
+
for (const [key, value] of Object.entries(defaults)) {
|
|
35
|
+
out[key] = fillConfigDefaults(base[key], value);
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
function schemaNodeAtPath(group, path) {
|
|
40
|
+
let node = group;
|
|
41
|
+
for (const segment of path.split(".")) {
|
|
42
|
+
if (node === void 0 || !("children" in node)) return void 0;
|
|
43
|
+
node = node.children[segment];
|
|
44
|
+
}
|
|
45
|
+
return node;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { fillConfigDefaults, hasConfigPath, schemaNodeAtPath, valueAtPath, withValueAtPath };
|
|
49
|
+
//# sourceMappingURL=chunk-E44SU6XS.js.map
|
|
50
|
+
//# sourceMappingURL=chunk-E44SU6XS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/config/path.ts"],"names":[],"mappings":";AAQA,SAAS,SAAS,KAAA,EAAkD;AAClE,EAAA,OAAO,OAAO,UAAU,QAAA,IAAY,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA;AAC5E;AAIO,SAAS,WAAA,CAAY,QAAiB,IAAA,EAAuB;AAClE,EAAA,IAAI,GAAA,GAAM,MAAA;AACV,EAAA,KAAA,MAAW,OAAA,IAAW,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA,EAAG;AACrC,IAAA,IAAI,CAAC,QAAA,CAAS,GAAG,CAAA,EAAG,OAAO,MAAA;AAC3B,IAAA,GAAA,GAAM,IAAI,OAAO,CAAA;AAAA,EACnB;AACA,EAAA,OAAO,GAAA;AACT;AAIO,SAAS,aAAA,CAAc,QAAiB,IAAA,EAAuB;AACpE,EAAA,IAAI,GAAA,GAAM,MAAA;AACV,EAAA,KAAA,MAAW,OAAA,IAAW,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA,EAAG;AACrC,IAAA,IA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,GAAA;AACT;AAIO,SAAS,gBAAA,CAAiB,OAAkB,IAAA,EAAgD;AACjG,EAAA,IAAI,IAAA,GAAyC,KAAA;AAC7C,EAAA,KAAA,MAAW,OAAA,IAAW,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA,EAAG;AACrC,IAAA,IAAI,IAAA,KAAS,MAAA,IAAa,EAAE,UAAA,IAAc,OAAO,OAAO,MAAA;AACxD,IAAA,IAAA,GAAO,IAAA,CAAK,SAAS,OAAO,CAAA;AAAA,EAC9B;AACA,EAAA,OAAO,IAAA;AACT","file":"chunk-E44SU6XS.js","sourcesContent":["import type { PrefGroup, PrefLeaf } from '@weasel-js/ui';\n\n/**\n * Reading and writing a config tree by dotted path. A schema's leaves address\n * their values this way, so a leaf nested under `f.group` and a flat one are\n * reached by exactly the same call.\n */\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** The value at a dotted path. `undefined` when a segment is missing or the\n * walk hits something that is not a record. */\nexport function valueAtPath(config: unknown, path: string): unknown {\n let cur = config;\n for (const segment of path.split('.')) {\n if (!isRecord(cur)) return undefined;\n cur = cur[segment];\n }\n return cur;\n}\n\n/** Whether a dotted path is actually present, which a `undefined` value is\n * not enough to tell you. */\nexport function hasConfigPath(config: unknown, path: string): boolean {\n let cur = config;\n for (const segment of path.split('.')) {\n if (!isRecord(cur) || !(segment in cur)) return false;\n cur = cur[segment];\n }\n return true;\n}\n\nfunction writeIn(node: unknown, segments: readonly string[], value: unknown): unknown {\n const [head, ...rest] = segments;\n if (head === undefined) return value;\n const base = isRecord(node) ? node : {};\n return { ...base, [head]: rest.length === 0 ? value : writeIn(base[head], rest, value) };\n}\n\n/** A copy of `config` with `value` written at a dotted path. Every record on\n * the way down is copied and the input is left alone; a missing — or\n * non-record — intermediate is replaced with the branch the path implies. */\nexport function withValueAtPath<T>(config: T, path: string, value: unknown): T {\n return writeIn(config, path.split('.'), value) as T;\n}\n\n/**\n * `stored` with every gap filled from `defaults`, down the whole tree.\n *\n * This is how a config written before its schema grew a branch still loads:\n * the branch arrives at its defaults instead of `undefined`, and a key the\n * defaults no longer mention is kept rather than dropped, so nothing is lost\n * to a schema change the author has not finished making.\n */\nexport function fillConfigDefaults<T>(stored: unknown, defaults: T): T {\n if (!isRecord(defaults)) return (stored === undefined ? defaults : stored) as T;\n const base = isRecord(stored) ? stored : {};\n const out: Record<string, unknown> = { ...base };\n for (const [key, value] of Object.entries(defaults)) {\n out[key] = fillConfigDefaults(base[key], value);\n }\n return out as T;\n}\n\n/** A node in a resolved schema tree, by dotted path. Structural rather than\n * `isPrefLeaf` so this stays free of a runtime import. */\nexport function schemaNodeAtPath(group: PrefGroup, path: string): PrefLeaf | PrefGroup | undefined {\n let node: PrefLeaf | PrefGroup | undefined = group;\n for (const segment of path.split('.')) {\n if (node === undefined || !('children' in node)) return undefined;\n node = node.children[segment];\n }\n return node;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TrialIdContext } from './chunk-2YILQ7Y5.js';
|
|
2
|
-
import { useVisibleRaf } from './chunk-54ZWZ5FQ.js';
|
|
3
2
|
import { createContext, useContext, useCallback, useRef, useEffect } from 'react';
|
|
3
|
+
import { useVisibleRaf } from '@weasel-js/core';
|
|
4
4
|
|
|
5
5
|
// src/surface/composeRects.ts
|
|
6
6
|
function composeRects(container, tiles) {
|
|
@@ -197,5 +197,5 @@ function useTiledSurface({ onFrame }) {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
export { SurfaceCanvasContext, SurfaceContext, composeRects, rectsEqual, toDeviceRect, useSurface, useSurfaceCanvas, useSurfaceOptional, useSurfaceTile, useTileId, useTiledSurface };
|
|
200
|
-
//# sourceMappingURL=chunk-
|
|
201
|
-
//# sourceMappingURL=chunk-
|
|
200
|
+
//# sourceMappingURL=chunk-FQMJUVHJ.js.map
|
|
201
|
+
//# sourceMappingURL=chunk-FQMJUVHJ.js.map
|