@weasel-js/ui-canvas 1.19.1 → 2.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.
- package/dist/chunks/{CharacterOptions-BcT_lWjg.js → CharacterOptions-CSqKZvwS.js} +23 -12
- package/dist/chunks/CharacterOptions-CSqKZvwS.js.map +1 -0
- package/dist/chunks/{PlotDataPanel-DUNod3NJ.js → PlotDataPanel-uHdh4X0l.js} +12 -6
- package/dist/chunks/PlotDataPanel-uHdh4X0l.js.map +1 -0
- package/dist/chunks/Rulers-hkPFdPkH.js.map +1 -1
- package/dist/chunks/{SceneGradientHandles-CHNSWx7U.js → SceneGradientHandles-CcXyTVav.js} +11 -8
- package/dist/chunks/SceneGradientHandles-CcXyTVav.js.map +1 -0
- package/dist/chunks/{SceneLayerList-DCYwqZkF.js → SceneLayerList-D2yc3eIk.js} +16 -13
- package/dist/chunks/SceneLayerList-D2yc3eIk.js.map +1 -0
- package/dist/chunks/{SelectionPanel-n-dIMvQ2.js → SelectionPanel-Dz6_c0rd.js} +12 -15
- package/dist/chunks/SelectionPanel-Dz6_c0rd.js.map +1 -0
- package/dist/components/PlotDataPanel/PlotDataPanel.d.ts +19 -0
- package/dist/components/PlotDataPanel/PlotDataPanel.d.ts.map +1 -0
- package/dist/components/PlotDataPanel/PlotTableView.d.ts +14 -0
- package/dist/components/PlotDataPanel/PlotTableView.d.ts.map +1 -0
- package/dist/components/PlotDataPanel/index.d.ts +5 -0
- package/dist/components/PlotDataPanel/index.d.ts.map +1 -0
- package/dist/components/PlotDataPanel/index.js +1 -1
- package/dist/components/PlotDataPanel/rowIds.d.ts +17 -0
- package/dist/components/PlotDataPanel/rowIds.d.ts.map +1 -0
- package/dist/components/PlotDataPanel/valueControl.d.ts +13 -0
- package/dist/components/PlotDataPanel/valueControl.d.ts.map +1 -0
- package/dist/components/Rulers/Rulers.d.ts +18 -0
- package/dist/components/Rulers/Rulers.d.ts.map +1 -0
- package/dist/components/Rulers/index.d.ts +3 -0
- package/dist/components/Rulers/index.d.ts.map +1 -0
- package/dist/components/SceneGradientHandles/SceneGradientHandles.d.ts +41 -0
- package/dist/components/SceneGradientHandles/SceneGradientHandles.d.ts.map +1 -0
- package/dist/components/SceneGradientHandles/index.d.ts +2 -0
- package/dist/components/SceneGradientHandles/index.d.ts.map +1 -0
- package/dist/components/SceneGradientHandles/index.js +1 -1
- package/dist/components/SceneLayerList/index.d.ts +2 -0
- package/dist/components/SceneLayerList/index.d.ts.map +1 -0
- package/dist/components/SceneLayerList/index.js +1 -1
- package/dist/components/SceneLayerList/useSceneLayerList.d.ts +47 -0
- package/dist/components/SceneLayerList/useSceneLayerList.d.ts.map +1 -0
- package/dist/components/inspector/AnchorFields/AnchorFields.d.ts +34 -0
- package/dist/components/inspector/AnchorFields/AnchorFields.d.ts.map +1 -0
- package/dist/components/inspector/AnchorFields/index.d.ts +2 -0
- package/dist/components/inspector/AnchorFields/index.d.ts.map +1 -0
- package/dist/components/inspector/CharacterOptions/CharacterOptions.d.ts +27 -0
- package/dist/components/inspector/CharacterOptions/CharacterOptions.d.ts.map +1 -0
- package/dist/components/inspector/CharacterOptions/characterSchema.d.ts +169 -0
- package/dist/components/inspector/CharacterOptions/characterSchema.d.ts.map +1 -0
- package/dist/components/inspector/CharacterOptions/index.d.ts +4 -0
- package/dist/components/inspector/CharacterOptions/index.d.ts.map +1 -0
- package/dist/components/inspector/CharacterOptions/index.js +1 -1
- package/dist/components/inspector/SelectionPanel/SelectionPanel.d.ts +80 -0
- package/dist/components/inspector/SelectionPanel/SelectionPanel.d.ts.map +1 -0
- package/dist/components/inspector/SelectionPanel/commitLeaf.d.ts +23 -0
- package/dist/components/inspector/SelectionPanel/commitLeaf.d.ts.map +1 -0
- package/dist/components/inspector/SelectionPanel/declaredFields.d.ts +19 -0
- package/dist/components/inspector/SelectionPanel/declaredFields.d.ts.map +1 -0
- package/dist/components/inspector/SelectionPanel/index.d.ts +3 -0
- package/dist/components/inspector/SelectionPanel/index.d.ts.map +1 -0
- package/dist/components/inspector/SelectionPanel/index.js +2 -2
- package/dist/components/inspector/SelectionPanel/nodeModel.d.ts +14 -0
- package/dist/components/inspector/SelectionPanel/nodeModel.d.ts.map +1 -0
- package/dist/components/inspector/SelectionPanel/scopes.d.ts +7 -0
- package/dist/components/inspector/SelectionPanel/scopes.d.ts.map +1 -0
- package/dist/icons.gen.d.ts +3 -0
- package/dist/icons.gen.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -6
- package/dist/kitIcons.d.ts +4 -0
- package/dist/kitIcons.d.ts.map +1 -0
- package/package.json +20 -18
- package/dist/chunks/CharacterOptions-BcT_lWjg.js.map +0 -1
- package/dist/chunks/PlotDataPanel-DUNod3NJ.js.map +0 -1
- package/dist/chunks/SceneGradientHandles-CHNSWx7U.js.map +0 -1
- package/dist/chunks/SceneLayerList-DCYwqZkF.js.map +0 -1
- package/dist/chunks/SelectionPanel-n-dIMvQ2.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { isSolidPaint, resolveFill, resolveScreenLength } from "@weasel-js/paint";
|
|
2
|
+
import { isSolidPaint, paintWithColor, resolveFill, resolveScreenLength, rgbaToHex, tryParseColor } from "@weasel-js/paint";
|
|
3
3
|
import { MIXED } from "@weasel-js/registry";
|
|
4
4
|
import { SCRIPT_METRICS, numericWeight, scriptMetricsFor } from "@weasel-js/text";
|
|
5
5
|
import { ToolOptionsBar } from "@weasel-js/ui/components/ToolOptionsBar";
|
|
@@ -11,7 +11,7 @@ import { ToolOptionsBar } from "@weasel-js/ui/components/ToolOptionsBar";
|
|
|
11
11
|
* superscript's 58.3% as 60% and commit that on the next edit. */
|
|
12
12
|
var PERCENT = {
|
|
13
13
|
scale: .01,
|
|
14
|
-
|
|
14
|
+
places: 1,
|
|
15
15
|
suffix: "%"
|
|
16
16
|
};
|
|
17
17
|
/** A run flag: on or off per character, drawn as one segment of a bar. */
|
|
@@ -200,27 +200,30 @@ function isCharacterChrome(el) {
|
|
|
200
200
|
}
|
|
201
201
|
/**
|
|
202
202
|
* The strip of character controls for a text edit in progress. Wire it to
|
|
203
|
-
* `useTextEdit`: `
|
|
203
|
+
* `useTextEdit`: `value` takes `effectiveStyle`, `onChange` takes
|
|
204
204
|
* `applyStyleToSelection`, and {@link isCharacterChrome} goes in as
|
|
205
205
|
* `isEditorChrome`.
|
|
206
206
|
*/
|
|
207
|
-
function CharacterOptions({
|
|
208
|
-
const editing =
|
|
207
|
+
function CharacterOptions({ value, onChange, children, className }) {
|
|
208
|
+
const editing = value != null;
|
|
209
209
|
return /* @__PURE__ */ jsx(ToolOptionsBar, {
|
|
210
210
|
className: className ? `${CHROME_CLASS} ${className}` : CHROME_CLASS,
|
|
211
211
|
label: editing ? "Text" : void 0,
|
|
212
212
|
schema: editing ? CHARACTER_OPTIONS : void 0,
|
|
213
|
-
values: editing ? characterValues(
|
|
214
|
-
mixed: editing ? characterMixed(
|
|
215
|
-
onChange: (path,
|
|
213
|
+
values: editing ? characterValues(value) : void 0,
|
|
214
|
+
mixed: editing ? characterMixed(value) : void 0,
|
|
215
|
+
onChange: (path, next) => onChange(characterPatch(path, next, value)),
|
|
216
216
|
children
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
219
|
/** One control's edit as a run patch. Only `fill` needs shaping: the schema
|
|
220
220
|
* draws a color and a chip for none, and a run's fill is a record holding
|
|
221
221
|
* a `Paint`, or `null`. Turning the chip off fills with the color the field shows beside it. */
|
|
222
|
-
function characterPatch(path, value) {
|
|
223
|
-
if (path === "fill")
|
|
222
|
+
function characterPatch(path, value, style) {
|
|
223
|
+
if (path === "fill") {
|
|
224
|
+
const prev = style?.fill === MIXED ? void 0 : resolveFill(style?.fill)?.paint;
|
|
225
|
+
return { fill: { paint: paintWithColor(isSolidPaint(prev) ? prev : void 0, value) } };
|
|
226
|
+
}
|
|
224
227
|
if (path === "noFill") return { fill: value === true ? null : { paint: { color: CHARACTER_OPTIONS.children.fill.default } } };
|
|
225
228
|
return { [path]: value };
|
|
226
229
|
}
|
|
@@ -274,11 +277,19 @@ function pick(style) {
|
|
|
274
277
|
function solidFill(fill) {
|
|
275
278
|
if (fill === MIXED) return void 0;
|
|
276
279
|
const paint = resolveFill(fill)?.paint;
|
|
277
|
-
|
|
280
|
+
if (!isSolidPaint(paint)) return void 0;
|
|
281
|
+
if (paint.opacity === void 0 || paint.opacity === 1) return paint.color;
|
|
282
|
+
const rgba = tryParseColor(paint.color);
|
|
283
|
+
return rgba === null ? paint.color : rgbaToHex([
|
|
284
|
+
rgba[0],
|
|
285
|
+
rgba[1],
|
|
286
|
+
rgba[2],
|
|
287
|
+
rgba[3] * paint.opacity
|
|
288
|
+
]);
|
|
278
289
|
}
|
|
279
290
|
function worldSize(v) {
|
|
280
291
|
return v === void 0 || v === MIXED ? void 0 : resolveScreenLength(v, 1);
|
|
281
292
|
}
|
|
282
293
|
|
|
283
294
|
export { isCharacterChrome as n, CHARACTER_OPTIONS as r, CharacterOptions as t };
|
|
284
|
-
//# sourceMappingURL=CharacterOptions-
|
|
295
|
+
//# sourceMappingURL=CharacterOptions-CSqKZvwS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CharacterOptions-CSqKZvwS.js","names":[],"sources":["../../src/components/inspector/CharacterOptions/characterSchema.ts","../../src/components/inspector/CharacterOptions/CharacterOptions.tsx"],"sourcesContent":["/** The schema {@link CharacterOptions} draws: one control per `StyledRun` field a range takes. */\nimport type { IconRef } from '@weasel-js/icons';\nimport type { PrefGroup } from '@weasel-js/prefs';\nimport { icon } from '../../../icons.gen';\n\n/** Both script primitives are fractions of the inherited size, so both read\n * as percentages. A tenth of a point shows because the field snaps the\n * *displayed* value to its step, and a coarser one would render a\n * superscript's 58.3% as 60% and commit that on the next edit. */\nconst PERCENT = { scale: 0.01, places: 1, suffix: '%' };\n\n/** A run flag: on or off per character, drawn as one segment of a bar. */\nconst flag = (name: string, glyph: IconRef) =>\n ({\n kind: 'boolean',\n name,\n description: `${name} for the characters in the range.`,\n icon: glyph,\n control: 'toggle',\n default: false,\n }) as const;\n\n/**\n * The character controls for a caret range — the character half of text\n * styling, against the node-level Character group a selection shows.\n *\n * Keyed by {@link StyledRun} field, so a host reads values out of a\n * `RangeStyle` and writes a `RunStylePatch` back with no name mapping of its\n * own. `script` is a preset over `baselineShift` and `fontScale`, so all three\n * are here and naming either primitive overrides that half. `noFill` is the one\n * key that is not a field: on, it is `fill: null`.\n */\nexport const CHARACTER_OPTIONS = {\n name: 'Text',\n description: 'Character styling for the selected range.',\n children: {\n bold: {\n ...flag('Bold', icon('core:bold')),\n pair: { with: ['italic', 'underline', 'strikethrough', 'overline'], label: 'Character style' },\n },\n italic: flag('Italic', icon('core:italic')),\n underline: flag('Underline', icon('core:underline')),\n strikethrough: flag('Strikethrough', icon('core:strikethrough')),\n overline: flag('Overline', icon('core:overline')),\n // Clearable: the two values are exclusive *and* absent is a third state,\n // so clicking the lit segment turns the script off.\n script: {\n kind: 'enum',\n name: 'Script',\n description: 'Raise or lower the range off the baseline, at a smaller size.',\n control: 'toggle',\n clearable: true,\n default: undefined,\n options: [\n { value: 'super', label: 'Superscript', icon: icon('core:superscript') },\n { value: 'sub', label: 'Subscript', icon: icon('core:subscript') },\n ],\n },\n textTransform: {\n kind: 'enum',\n name: 'Case',\n description: 'Draw the range in capitals, lowercase or title case. The text itself is unchanged.',\n control: 'toggle',\n default: 'none',\n options: [{ value: 'none', label: 'None', short: ['–'] }, { value: 'uppercase', label: 'Uppercase', short: ['AA'] }, { value: 'lowercase', label: 'Lowercase', short: ['aa'] }, { value: 'capitalize', label: 'Capitalize', short: ['Aa'] }],\n },\n fontVariantCaps: {\n kind: 'enum',\n name: 'Small caps',\n description: 'Draw lowercase letters in the range as smaller capitals. The text itself is unchanged.',\n control: 'toggle',\n default: 'normal',\n options: [{ value: 'normal', label: 'Normal', short: ['–'] }, { value: 'small-caps', label: 'Small caps', short: ['Sc'] }],\n },\n fontFamily: {\n kind: 'font-family',\n name: 'Font',\n description: 'Typeface for the range.',\n default: undefined,\n },\n // Listed from the weights the range's family has registered. Bold is a\n // preset over it: toggling Bold clears it, picking one clears Bold.\n fontWeight: {\n kind: 'font-weight',\n name: 'Weight',\n description: 'Weight of the range, from the faces its family has.',\n default: undefined,\n },\n fontSize: { kind: 'number', name: 'Size', description: 'Type size.', min: 1, step: 1, default: 16 },\n letterSpacing: {\n kind: 'number',\n name: 'Tracking',\n // The typographic term, short enough for a strip; `name` stays the\n // accessible one.\n short: ['VA'],\n description: 'Space added between characters.',\n step: 0.1,\n default: 0,\n },\n baselineShift: {\n kind: 'number',\n name: 'Baseline shift',\n short: ['Shift'],\n description: 'Raise or lower the range, in ems of the inherited size.',\n step: 0.001,\n unit: PERCENT,\n default: 0,\n },\n fontScale: {\n kind: 'number',\n name: 'Scale',\n description: 'Size of the range against the inherited size.',\n min: 0.01,\n step: 0.001,\n unit: PERCENT,\n default: 1,\n },\n fill: {\n kind: 'color',\n name: 'Color',\n description: 'Ink for the range.',\n alpha: true,\n default: '#000000',\n },\n noFill: {\n kind: 'boolean',\n name: 'No fill',\n description: 'Draw the range with no fill.',\n icon: icon('paint-kinds:none'),\n control: 'toggle',\n default: false,\n },\n },\n} satisfies PrefGroup;\n","/**\n * Character controls for a text edit in progress: the adapter between the\n * `CHARACTER_OPTIONS` schema and a range — a `RangeStyle` in, a\n * `RunStylePatch` out. Whether the patch lands on the runs under a selection\n * or is armed for the next character typed at a collapsed caret is the caller's.\n *\n * `MIXED` becomes a path in the bar's `mixed` set, so each control shows its\n * own indeterminate presentation.\n */\nimport {\n isSolidPaint, paintWithColor, resolveFill, resolveScreenLength, rgbaToHex, tryParseColor, type ScreenLength,\n} from '@weasel-js/paint';\nimport { MIXED } from '@weasel-js/registry';\nimport { numericWeight, SCRIPT_METRICS, scriptMetricsFor } from '@weasel-js/text';\nimport { CHARACTER_OPTIONS } from './characterSchema';\nimport type { RangeStyle, RunStylePatch, StyledRun } from '@weasel-js/text';\nimport { ToolOptionsBar } from '@weasel-js/ui/components/ToolOptionsBar';\nimport type { ReactNode } from 'react';\n\n/** Props for {@link CharacterOptions}. */\nexport interface CharacterOptionsProps {\n /** Styling to display. `MIXED` at a key means the sources disagree there.\n * Absent or `null` renders no bar, unless `children` gives it a tenant. */\n value?: RangeStyle | null;\n /** Apply a styling change. One call per completed edit. */\n onChange: (patch: RunStylePatch) => void;\n /** Tenants of the bar that are not character styling, e.g. loupe controls. */\n children?: ReactNode;\n className?: string;\n}\n\nconst CHROME_CLASS = 'wzl-character-options';\n\n/**\n * Is `el` part of a `CharacterOptions` bar, or of a kit popover one of its\n * controls opened? Pass it as `useTextEdit`'s `isEditorChrome`, so using the\n * bar does not end the edit it styles.\n */\nexport function isCharacterChrome(el: Element): boolean {\n // A popover renders in a portal under <body>, outside the bar's subtree.\n return el.closest(`.${CHROME_CLASS}, [data-weasel-overlay]`) !== null;\n}\n\n/** The keys the schema draws, in the order it declares them. */\ntype StyleKey = keyof typeof CHARACTER_OPTIONS.children;\n\n/**\n * The strip of character controls for a text edit in progress. Wire it to\n * `useTextEdit`: `value` takes `effectiveStyle`, `onChange` takes\n * `applyStyleToSelection`, and {@link isCharacterChrome} goes in as\n * `isEditorChrome`.\n */\nexport function CharacterOptions({ value, onChange, children, className }: CharacterOptionsProps) {\n const editing = value != null;\n return (\n <ToolOptionsBar\n className={className ? `${CHROME_CLASS} ${className}` : CHROME_CLASS}\n label={editing ? 'Text' : undefined}\n schema={editing ? CHARACTER_OPTIONS : undefined}\n values={editing ? characterValues(value) : undefined}\n mixed={editing ? characterMixed(value) : undefined}\n onChange={(path, next) => onChange(characterPatch(path, next, value))}\n >\n {children}\n </ToolOptionsBar>\n );\n}\n\n/** One control's edit as a run patch. Only `fill` needs shaping: the schema\n * draws a color and a chip for none, and a run's fill is a record holding\n * a `Paint`, or `null`. Turning the chip off fills with the color the field shows beside it. */\nfunction characterPatch(path: string, value: unknown, style: RangeStyle | null | undefined): RunStylePatch {\n if (path === 'fill') {\n const prev = style?.fill === MIXED ? undefined : resolveFill(style?.fill)?.paint;\n return { fill: { paint: paintWithColor(isSolidPaint(prev) ? prev : undefined, value as string) } satisfies StyledRun['fill'] };\n }\n if (path === 'noFill') {\n return { fill: value === true ? null : { paint: { color: CHARACTER_OPTIONS.children.fill.default } } };\n }\n return { [path]: value } as RunStylePatch;\n}\n\n/**\n * A range's styling as the bar's value map.\n *\n * Sizes are `ScreenLength`, and the strip edits world units, so a `{ px }`\n * size shows its pixel count and commits back as a plain number — editing one\n * converts it. `script` is a preset over `baselineShift` / `fontScale`, so a\n * range that names it and not them shows the preset's shift and scale, as\n * `resolveRuns` does.\n */\nfunction characterValues(style: RangeStyle): Record<string, unknown> {\n const script = style.script;\n const preset = script === 'super' || script === 'sub' ? scriptPresets(style)[script] : undefined;\n return {\n ...pick(style),\n fontSize: worldSize(style.fontSize),\n letterSpacing: worldSize(style.letterSpacing),\n baselineShift: style.baselineShift ?? preset?.shift,\n fontScale: style.fontScale ?? preset?.size,\n fill: solidFill(style.fill),\n noFill: style.fill !== MIXED && resolveFill(style.fill) === null,\n };\n}\n\n/** The presets the range's face gives `script` — the kit defaults when the\n * range spans more than one family, since no single face then applies. */\nfunction scriptPresets(style: RangeStyle): typeof SCRIPT_METRICS {\n if (typeof style.fontFamily !== 'string') return SCRIPT_METRICS;\n const weight = style.fontWeight !== undefined && style.fontWeight !== MIXED\n ? numericWeight(style.fontWeight)\n : style.bold === true ? 700 : 400;\n return scriptMetricsFor(style.fontFamily, weight, style.italic === true ? 'italic' : 'normal');\n}\n\n/** The paths whose sources disagree — every `MIXED` key, plus a fill with no\n * single color to show. */\nfunction characterMixed(style: RangeStyle): Set<string> {\n const out = new Set<string>();\n for (const key of Object.keys(CHARACTER_OPTIONS.children) as StyleKey[]) {\n if (style[key as keyof RangeStyle] === MIXED) out.add(key);\n }\n // A gradient or pattern fill gets the same indeterminate treatment as a\n // mixed range, rather than a swatch claiming the text is some solid color.\n // The tag is checked as well as the key: a tile paint carries a `color` too.\n const fill = style.fill;\n if (fill !== MIXED && resolveFill(fill) !== null && solidFill(fill) === undefined) out.add('fill');\n return out;\n}\n\n/** Every key the schema draws that the range carries as-is. */\nfunction pick(style: RangeStyle): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const key of Object.keys(CHARACTER_OPTIONS.children) as StyleKey[]) {\n const v = style[key as keyof RangeStyle];\n if (v !== undefined && v !== MIXED) out[key] = v;\n }\n return out;\n}\n\nfunction solidFill(fill: RangeStyle['fill']): string | undefined {\n if (fill === MIXED) return undefined;\n const paint = resolveFill(fill)?.paint;\n if (!isSolidPaint(paint)) return undefined;\n if (paint.opacity === undefined || paint.opacity === 1) return paint.color;\n // The swatch has one alpha to show: the color's own times the paint's opacity.\n const rgba = tryParseColor(paint.color);\n return rgba === null ? paint.color : rgbaToHex([rgba[0], rgba[1], rgba[2], rgba[3] * paint.opacity]);\n}\n\nfunction worldSize(v: ScreenLength | typeof MIXED | undefined): number | undefined {\n return v === undefined || v === MIXED ? undefined : resolveScreenLength(v, 1);\n}\n"],"mappings":";;;;;;;;;;;AASA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU;AAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA;AAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA;AAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA;AAAI,CAAA;;AAGtD,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA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CAAA,CAAA,CAAU,CAAA,CAAA,CAAgE;AACjF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoB,CAAA,CAAA,CAAG,CAAC,CAAA;AAC9E"}
|
|
@@ -216,16 +216,22 @@ function PlotTableView({ data, table, scope, edit }) {
|
|
|
216
216
|
* per table whose rows can be added, removed, reordered, and opened onto the tables they hold.
|
|
217
217
|
*/
|
|
218
218
|
function PlotDataPanel({ data, onChange, title = "Data", className }) {
|
|
219
|
-
const [
|
|
219
|
+
const [failed, setFailed] = useState(null);
|
|
220
|
+
const error = failed?.data === data ? failed.message : null;
|
|
220
221
|
const schema = plotSchemaOf(data);
|
|
221
222
|
const edit = (change, label) => {
|
|
223
|
+
let next;
|
|
222
224
|
try {
|
|
223
|
-
|
|
224
|
-
setError(null);
|
|
225
|
-
if (next !== data) onChange(next, label);
|
|
225
|
+
next = change(data);
|
|
226
226
|
} catch (e) {
|
|
227
|
-
|
|
227
|
+
setFailed({
|
|
228
|
+
data,
|
|
229
|
+
message: e instanceof Error ? e.message : String(e)
|
|
230
|
+
});
|
|
231
|
+
return;
|
|
228
232
|
}
|
|
233
|
+
setFailed(null);
|
|
234
|
+
if (next !== data) onChange(next, label);
|
|
229
235
|
};
|
|
230
236
|
const fields = schema.fields.filter((f) => f.applies?.(data) !== false);
|
|
231
237
|
return /* @__PURE__ */ jsxs(PropertyPanel, {
|
|
@@ -254,4 +260,4 @@ function PlotDataPanel({ data, onChange, title = "Data", className }) {
|
|
|
254
260
|
}
|
|
255
261
|
|
|
256
262
|
export { PlotTableView as n, PlotDataPanel as t };
|
|
257
|
-
//# sourceMappingURL=PlotDataPanel-
|
|
263
|
+
//# sourceMappingURL=PlotDataPanel-uHdh4X0l.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlotDataPanel-uHdh4X0l.js","names":["s"],"sources":["../../src/components/PlotDataPanel/valueControl.ts","../../src/components/PlotDataPanel/rowIds.ts","../../src/components/PlotDataPanel/PlotTableView.tsx","../../src/components/PlotDataPanel/PlotDataPanel.tsx"],"sourcesContent":["/** A plot schema field or cell as the props of the params control that edits it. */\nimport type { PlotValue, PlotValueType } from '@weasel-js/plot';\nimport type { PropertyControlProps } from '@weasel-js/ui/components/Properties';\n\n/** What a field or cell is, for its control: its type, whether it can be unset or only read, and its value. */\nexport interface ValueSpec {\n type: PlotValueType;\n value: PlotValue;\n optional?: boolean;\n readOnly?: boolean;\n}\n\n/** The props of the control for `spec`, reporting each committed value through `set`. */\nexport function valueControl(spec: ValueSpec, name: string, set: (value: PlotValue) => void): PropertyControlProps {\n const { type, value, optional, readOnly } = spec;\n const clear = optional ? () => set(undefined) : undefined;\n switch (type.kind) {\n case 'number':\n return {\n kind: 'number', name, readOnly, value: typeof value === 'number' ? value : undefined,\n min: type.min, max: type.max, step: type.step, onChange: set, onClear: clear,\n };\n case 'boolean':\n return { kind: 'boolean', name, readOnly, value: value === true, onChange: set };\n case 'enum':\n return {\n kind: 'enum', name, readOnly, value: typeof value === 'string' ? value : undefined,\n options: type.options.map((o) => ({ value: o, label: o })), onChange: set, onClear: clear,\n };\n case 'color':\n return { kind: 'color', name, readOnly, value: typeof value === 'string' ? value : undefined, onChange: set };\n case 'string':\n return {\n kind: 'string', name, readOnly, value: typeof value === 'string' ? value : undefined, placeholder: type.placeholder,\n onChange: (next) => set(next === '' && optional ? undefined : next),\n };\n }\n}\n","import type { PlotData } from '@weasel-js/plot';\nimport { useRef } from 'react';\n\n/** What an edit does to the rows' order: the ids before it, to the ids after. */\nexport type RowShift = (ids: readonly string[], fresh: () => string) => string[];\n\nexport const insertedAt = (at: number): RowShift => (ids, fresh) => [...ids.slice(0, at), fresh(), ...ids.slice(at)];\nexport const removedAt = (at: number): RowShift => (ids) => ids.filter((_, i) => i !== at);\nexport const movedTo = (from: number, to: number): RowShift => (ids) => {\n const next = ids.filter((_, i) => i !== from);\n next.splice(to, 0, ids[from]!);\n return next;\n};\n\n/**\n * An id for each of a table's `count` rows that stays with its item through the panel's own inserts, removals and\n * moves, so what a row holds open follows the item rather than its slot. `track` wraps an edit with what it does to\n * the order; the order shifts only once `data` comes back as that edit made it, so an edit the host drops shifts\n * nothing. A change from elsewhere keeps the ids by position.\n */\nexport function useRowIds(data: PlotData, count: number): {\n ids: readonly string[];\n track: (change: (d: PlotData) => PlotData, shift: RowShift) => (d: PlotData) => PlotData;\n} {\n const state = useRef({ ids: [] as string[], made: 0, seen: undefined as PlotData | undefined, pending: [] as { made: PlotData; shift: RowShift }[] });\n const s = state.current;\n const fresh = (): string => `row-${s.made++}`;\n if (s.seen !== data) {\n const mine = s.pending.find((p) => p.made === data);\n if (mine) s.ids = mine.shift(s.ids, fresh);\n s.pending = [];\n s.seen = data;\n }\n if (s.ids.length !== count) s.ids = Array.from({ length: count }, (_, i) => s.ids[i] ?? fresh());\n return {\n ids: s.ids,\n track: (change, shift) => (d) => {\n const made = change(d);\n s.pending.push({ made, shift });\n return made;\n },\n };\n}\n","import type { PlotData, PlotScope, PlotTable, PlotValue } from '@weasel-js/plot';\nimport type { ReactElement } from 'react';\nimport { Button, CLOSE_BUTTON_PROPS } from '@weasel-js/ui/components/Button';\nimport { DataGrid, type DataGridColumn } from '@weasel-js/ui/components/DataGrid';\nimport { PropertyControl } from '@weasel-js/ui/components/Properties';\nimport s from './PlotDataPanel.module.css';\nimport { valueControl } from './valueControl';\nimport { insertedAt, movedTo, removedAt, useRowIds } from './rowIds';\n\n/** Props for {@link PlotTableView}. */\nexport interface PlotTableViewProps {\n data: PlotData;\n table: PlotTable;\n scope: PlotScope;\n /** Proposes `next` as the chart's data, an edit named `label`. */\n edit: (next: (data: PlotData) => PlotData, label: string) => void;\n}\n\ninterface Row { id: string; index: number }\n\n/** One table of a plot schema as a grid of controls: a row per item, which can be added, removed, dragged into\n * another order, and opened onto the tables it holds. */\nexport function PlotTableView({ data, table, scope, edit }: PlotTableViewProps): ReactElement {\n const count = table.count(data, scope);\n const { ids, track } = useRowIds(data, count);\n const rows: Row[] = ids.map((id, index) => ({ id, index }));\n const rowName = (r: number) => table.rowLabel?.(data, scope, r) || `${table.item} ${r + 1}`;\n const columns: DataGridColumn<Row>[] = table.columns(data, scope).map((column) => ({\n id: column.key,\n header: column.label,\n sortable: false,\n numeric: column.type.kind === 'number',\n render: ({ index }) => {\n if (column.applies?.(data, scope, index) === false) return null;\n const spec = { ...column, value: column.get(data, scope, index) };\n const set = (value: PlotValue) => edit((d) => column.set(d, scope, index, value), `Edit ${column.label.toLowerCase()}`);\n return <PropertyControl {...valueControl(spec, `${column.label} of ${rowName(index)}`, set)} className={s.cell} />;\n },\n }));\n const { insert, remove } = table;\n if (insert || remove) {\n columns.push({\n id: '__row', header: '', sortable: false,\n render: ({ index }) => (\n <span className={s.rowActions}>\n {insert && (\n <Button\n size=\"sm\" variant=\"ghost\" aria-label={`Insert ${table.item} after ${rowName(index)}`}\n onClick={() => edit(track((d) => insert(d, scope, index + 1), insertedAt(index + 1)), `Add ${table.item}`)}\n >\n +\n </Button>\n )}\n {remove && (\n <Button {...CLOSE_BUTTON_PROPS} aria-label={`Remove ${rowName(index)}`} onClick={() => edit(track((d) => remove(d, scope, index), removedAt(index)), `Remove ${table.item}`)} />\n )}\n </span>\n ),\n });\n }\n const move = table.move;\n const children = table.children;\n return (\n <div className={s.table}>\n {scope.length > 0 && <div className={s.heading}>{table.label}</div>}\n <DataGrid<Row>\n rows={rows}\n columns={columns}\n rowLabel={(r) => rowName(r.index)}\n empty={`No ${table.label.toLowerCase()}`}\n onReorder={move && ((moved, target) => {\n const from = rows.findIndex((r) => r.id === moved[0]);\n const to = target > from ? target - 1 : target;\n if (from >= 0 && to !== from) edit(track((d) => move(d, scope, from, to), movedTo(from, to)), `Reorder ${table.label.toLowerCase()}`);\n })}\n renderDetail={children && (({ index }) => (\n <div className={s.nested}>\n {children.map((child) => (\n <PlotTableView key={child.key} data={data} table={child} scope={[...scope, index]} edit={edit} />\n ))}\n </div>\n ))}\n />\n {insert && (\n <Button size=\"sm\" variant=\"ghost\" className={s.add} onClick={() => edit(track((d) => insert(d, scope, table.count(d, scope)), insertedAt(count)), `Add ${table.item}`)}>\n {`Add ${table.item}`}\n </Button>\n )}\n </div>\n );\n}\n","import { plotSchemaOf, type PlotData, type PlotValue } from '@weasel-js/plot';\nimport { useState, type ReactElement } from 'react';\nimport { PropertyField, PropertyList, PropertyNote, PropertyPanel, Subpanel } from '@weasel-js/ui/components/Properties';\nimport { PlotTableView } from './PlotTableView';\nimport { valueControl } from './valueControl';\n\n/** Props for {@link PlotDataPanel}. */\nexport interface PlotDataPanelProps {\n /** The chart, any kind. */\n data: PlotData;\n /** The chart as an edit leaves it, and a name for the edit, for an undo entry. The panel holds no copy: show the\n * change by passing it back as `data`. */\n onChange: (next: PlotData, label: string) => void;\n /** Default `'Data'`. */\n title?: string;\n className?: string;\n}\n\n/**\n * Authors a chart's data, whatever its kind, from the kind's schema (`plotSchemaOf`): a row per field, and a grid\n * per table whose rows can be added, removed, reordered, and opened onto the tables they hold.\n */\nexport function PlotDataPanel({ data, onChange, title = 'Data', className }: PlotDataPanelProps): ReactElement {\n // An edit's error belongs to the chart it failed on; a chart passed in from elsewhere drops it.\n const [failed, setFailed] = useState<{ data: PlotData; message: string } | null>(null);\n const error = failed?.data === data ? failed.message : null;\n const schema = plotSchemaOf(data);\n const edit = (change: (d: PlotData) => PlotData, label: string) => {\n let next: PlotData;\n try {\n next = change(data);\n } catch (e) {\n setFailed({ data, message: e instanceof Error ? e.message : String(e) });\n return;\n }\n setFailed(null);\n if (next !== data) onChange(next, label);\n };\n const fields = schema.fields.filter((f) => f.applies?.(data) !== false);\n return (\n <PropertyPanel title={title} className={className}>\n <PropertyList>\n {fields.map((field) => {\n const set = (value: PlotValue) => edit((d) => field.set(d, value), `Edit ${field.label.toLowerCase()}`);\n const control = valueControl({ ...field, value: field.get(data) }, field.label, set);\n return <PropertyField key={field.key} label={field.label} {...control} />;\n })}\n {error !== null && <PropertyNote>{error}</PropertyNote>}\n </PropertyList>\n {schema.tables.map((table) => (\n <Subpanel key={table.key} title={table.label}>\n <PlotTableView data={data} table={table} scope={[]} edit={edit} />\n </Subpanel>\n ))}\n </PropertyPanel>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAaA,SAAgB,aAAa,MAAiB,MAAc,KAAuD;CACjH,MAAM,EAAE,MAAM,OAAO,UAAU,aAAa;CAC5C,MAAM,QAAQ,iBAAiB,IAAI,MAAS,IAAI;CAChD,QAAQ,KAAK,MAAb;EACE,KAAK,UACH,OAAO;GACL,MAAM;GAAU;GAAM;GAAU,OAAO,OAAO,UAAU,WAAW,QAAQ;GAC3E,KAAK,KAAK;GAAK,KAAK,KAAK;GAAK,MAAM,KAAK;GAAM,UAAU;GAAK,SAAS;EACzE;EACF,KAAK,WACH,OAAO;GAAE,MAAM;GAAW;GAAM;GAAU,OAAO,UAAU;GAAM,UAAU;EAAI;EACjF,KAAK,QACH,OAAO;GACL,MAAM;GAAQ;GAAM;GAAU,OAAO,OAAO,UAAU,WAAW,QAAQ;GACzE,SAAS,KAAK,QAAQ,KAAK,OAAO;IAAE,OAAO;IAAG,OAAO;GAAE,EAAE;GAAG,UAAU;GAAK,SAAS;EACtF;EACF,KAAK,SACH,OAAO;GAAE,MAAM;GAAS;GAAM;GAAU,OAAO,OAAO,UAAU,WAAW,QAAQ;GAAW,UAAU;EAAI;EAC9G,KAAK,UACH,OAAO;G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":3,"file":"Rulers-hkPFdPkH.js","names":["s"],"sources":["../../src/components/Rulers/Rulers.
|
|
1
|
+
{"version":3,"file":"Rulers-hkPFdPkH.js","names":["s"],"sources":["../../src/components/Rulers/Rulers.tsx"],"sourcesContent":["import { useSyncExternalStore, type ReactElement } from 'react';\nimport type { RulerTicks, Rulers as RulersModel } from '@weasel-js/guides';\nimport s from './Rulers.module.css';\n\n/** Props for {@link Rulers}. */\nexport interface RulersProps {\n /** What `createRulers` returned; its contribution installed on the canvas. */\n rulers: RulersModel;\n /** Additional class for the root, which covers its positioned container. */\n className?: string;\n}\n\nconst MINOR = 0.35;\nconst crisp = (n: number): number => Math.round(n) + 0.5;\n\n/** One ruler's tick marks as path data: each tick crosses the strip from its\n * inner edge, a labeled one all the way. */\nfunction tickPath(ticks: RulerTicks, size: number, across: 'x' | 'y'): string {\n return ticks.ticks.map(({ at, major }) => {\n const a = crisp(at);\n const from = major ? 0 : size * (1 - MINOR);\n return across === 'y' ? `M${a} ${from}V${size}` : `M${from} ${a}H${size}`;\n }).join('');\n}\n\n/**\n * Rulers along the top and left of a canvas, with a box in the corner naming\n * the unit they read in: the chrome half of `createRulers` from\n * `@weasel-js/guides`, whose contribution follows the view and takes the drags\n * that place guides. Place it in the canvas's positioned container; it covers\n * it and passes every pointer event through to the canvas below.\n */\nexport function Rulers({ rulers, className }: RulersProps): ReactElement | null {\n const state = useSyncExternalStore(rulers.subscribe, rulers.get, rulers.get);\n const layout = rulers.layout();\n if (layout === null) return null;\n const { size } = rulers;\n const { width, height } = state;\n const { top, left, pointer } = layout;\n const mid = size / 2;\n return (\n <div className={[s.rulers, className].filter(Boolean).join(' ')} aria-hidden=\"true\" data-unit={top.unit}>\n <svg className={s.strip} width={width} height={size}>\n <path className={s.ticks} d={tickPath(top, size, 'y')} />\n {top.ticks.map((t) => t.label === undefined ? null : (\n <text key={t.at} className={s.label} x={t.at + 3} y={mid * 0.8}>{t.label}</text>\n ))}\n {pointer && <line className={s.pointer} x1={crisp(pointer.x)} x2={crisp(pointer.x)} y1={0} y2={size} />}\n <line className={s.edge} x1={0} x2={width} y1={size - 0.5} y2={size - 0.5} />\n </svg>\n <svg className={s.strip} width={size} height={height}>\n <path className={s.ticks} d={tickPath(left, size, 'x')} />\n {left.ticks.map((t) => t.label === undefined ? null : (\n <text key={t.at} className={s.label} x={mid * 0.8} y={t.at + 3} textAnchor=\"end\" transform={`rotate(-90 ${mid * 0.8} ${t.at + 3})`}>{t.label}</text>\n ))}\n {pointer && <line className={s.pointer} x1={0} x2={size} y1={crisp(pointer.y)} y2={crisp(pointer.y)} />}\n <line className={s.edge} x1={size - 0.5} x2={size - 0.5} y1={0} y2={height} />\n </svg>\n <svg className={s.strip} width={size} height={size}>\n <text className={s.unit} x={mid} y={mid}>{top.unit}</text>\n <path className={s.edge} d={`M0 ${size - 0.5}H${size - 0.5}V0`} />\n </svg>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAaA,IAAM,SAAS,MAAsB,KAAK,MAAM,CAAC,IAAI;;;AAIrD,SAAS,SAAS,OAAmB,MAAc,QAA2B;CAC5E,OAAO,MAAM,MAAM,KAAK,EAAE,IAAI,YAAY;EACxC,MAAM,IAAI,MAAM,EAAE;EAClB,MAAM,OAAO,QAAQ,IAAI,OAAQ;EACjC,OAAO,WAAW,MAAM,IAAI,EAAE,GAAG,KAAK,GAAG,SAAS,IAAI,KAAK,GAAG,EAAE,GAAG;CACrE,CAAC,CAAC,CAAC,KAAK,EAAE;AACZ;;;;;;;;AASA,SAAgB,OAAO,EAAE,QAAQ,aAA+C;CAC9E,MAAM,QAAQ,qBAAqB,OAAO,WAAW,OAAO,KAAK,OAAO,GAAG;CAC3E,MAAM,SAAS,OAAO,OAAO;CAC7B,IAAI,WAAW,MAAM,OAAO;CAC5B,MAAM,EAAE,SAAS;CACjB,MAAM,EAAE,OAAO,WAAW;CAC1B,MAAM,EAAE,KAAK,MAAM,YAAY;CAC/B,MAAM,MAAM,OAAO;CAC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M,IAAI,MAAM,QAAQ,CAAC;MAAG,IAAI,MAAM,QAAQ,CAAC;KAAI,CAAA;KACtG,oBAAC,QAAD;MAAM,WAAWA,sBAAE;MAAM,IAAI,OAAO;MAAK,IAAI,OAAO;MAAK,IAAI;MAAG,IAAI;KAAS,CAAA;IAC1E;;GACL,qBAAC,OAAD;IAAK,WAAWA,sBAAE;IAAO,OAAO;IAAM,QAAQ;IAA9C,UAAA,CACE,oBAAC,QAAD;KAAM,WAAWA,sBAAE;KAAM,GAAG;KAAK,GAAG;KAAM,UAAA,IAAI;IAAW,CAAA,GACzD,oBAAC,QAAD;KAAM,WAAWA,sBAAE;KAAM,GAAG,MAAM,OAAO,GAAI,GAAG,OAAO,GAAI;IAAM,CAAA,CAC9D;;EACF;;AAET"}
|
|
@@ -2,7 +2,7 @@ import { useLayoutEffect, useRef } from "react";
|
|
|
2
2
|
import { useNodeOverlayFrame } from "@weasel-js/core";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { isGradientPaint, resolveFill, resolveStroke } from "@weasel-js/paint";
|
|
5
|
-
import {
|
|
5
|
+
import { paintToBoundsUnits, paintToLocalUnits } from "@weasel-js/renderer";
|
|
6
6
|
import { useOngoingAction } from "@weasel-js/routing/react";
|
|
7
7
|
import { isMeshGradientPaint } from "@weasel-js/renderer/mesh";
|
|
8
8
|
import { MeshHandles } from "@weasel-js/ui/components/MeshEditor";
|
|
@@ -14,7 +14,7 @@ import "@weasel-js/paint-kinds/mesh";
|
|
|
14
14
|
* Scene-aware paint handles: on-canvas geometry handles for the gradient in
|
|
15
15
|
* one node's `fill` or `stroke` — `GradientHandles` for the three ramps,
|
|
16
16
|
* `MeshHandles` for a mesh — committed through the `setFill` / `setStroke`
|
|
17
|
-
* actions as a single undo entry per drag. A canceled drag cancels the action,
|
|
17
|
+
* actions, on `nodeId` alone, as a single undo entry per drag. A canceled drag cancels the action,
|
|
18
18
|
* and so does unmounting the overlay while a handle is held.
|
|
19
19
|
*
|
|
20
20
|
* Renders nothing unless the targeted slot holds a gradient or a mesh. The
|
|
@@ -38,9 +38,12 @@ function SceneGradientHandles(props) {
|
|
|
38
38
|
if (!frame || !paint) return null;
|
|
39
39
|
const dispatch = (next, phase) => {
|
|
40
40
|
if (gone.current) return;
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
const params = {
|
|
42
|
+
paint: paintToBoundsUnits(next, frame.box),
|
|
43
|
+
ids: [nodeId]
|
|
44
|
+
};
|
|
45
|
+
if (phase === "commit") edit.commit(params);
|
|
46
|
+
else edit.input(params);
|
|
44
47
|
};
|
|
45
48
|
const common = {
|
|
46
49
|
toScreen: frame.toScreen,
|
|
@@ -53,11 +56,11 @@ function SceneGradientHandles(props) {
|
|
|
53
56
|
onCancel: () => edit.cancel()
|
|
54
57
|
};
|
|
55
58
|
if (isGradientPaint(paint)) return /* @__PURE__ */ jsx(GradientHandles, {
|
|
56
|
-
value:
|
|
59
|
+
value: paintToLocalUnits(paint, frame.box),
|
|
57
60
|
...common
|
|
58
61
|
});
|
|
59
62
|
if (isMeshGradientPaint(paint)) {
|
|
60
|
-
const resolved =
|
|
63
|
+
const resolved = paintToLocalUnits(paint, frame.box);
|
|
61
64
|
if (resolved.units === "bounds") return null;
|
|
62
65
|
return /* @__PURE__ */ jsx(MeshHandles, {
|
|
63
66
|
value: resolved,
|
|
@@ -74,4 +77,4 @@ function paintOf(scene, nodeId, slot) {
|
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
export { SceneGradientHandles as t };
|
|
77
|
-
//# sourceMappingURL=SceneGradientHandles-
|
|
80
|
+
//# sourceMappingURL=SceneGradientHandles-CcXyTVav.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SceneGradientHandles-CcXyTVav.js","names":[],"sources":["../../src/components/SceneGradientHandles/SceneGradientHandles.tsx"],"sourcesContent":["import { useLayoutEffect, useRef, type ReactElement, type RefObject } from 'react';\nimport { paintToLocalUnits, paintToBoundsUnits } from '@weasel-js/renderer';\nimport { isGradientPaint, resolveFill, resolveStroke, type Paint, type GradientPaint, type Stroke, type Fill, type Inherit } from '@weasel-js/paint';\nimport { useOngoingAction } from '@weasel-js/routing/react';\nimport type { View } from '@weasel-js/geom';\nimport { isMeshGradientPaint, type MeshGradientPaint } from '@weasel-js/renderer/mesh';\nimport {\n useNodeOverlayFrame,\n type RectPose,\n type Scene,\n} from '@weasel-js/core';\nimport { MeshHandles } from '@weasel-js/ui/components/MeshEditor';\nimport { GradientHandles } from '@weasel-js/ui/components/GradientEditor';\nimport type { PaintSlot } from '@weasel-js/paint';\nimport '@weasel-js/paint-kinds/mesh';\n\n/** What `SceneGradientHandles` reads off a node. Every field is optional, so\n * any richer app data shape satisfies it. */\nexport interface PaintedNodeData {\n fill?: Fill | Inherit | null;\n stroke?: Stroke | Inherit | null;\n}\n\n/** Props for {@link SceneGradientHandles}. */\nexport interface SceneGradientHandlesProps<\n TData extends PaintedNodeData,\n TLayer extends string,\n TPose extends RectPose,\n> {\n scene: Scene<TData, TLayer, TPose>;\n /** The element the overlay is positioned in. Must be the canvas's own box,\n * or the handles land somewhere other than the paint. */\n containerRef: RefObject<HTMLElement | null>;\n /** The node whose paint is being edited, and the one a drag writes to, whatever the selection holds. */\n nodeId: string | null | undefined;\n /** Which of the node's two paints these handles move. */\n slot: PaintSlot;\n /** Current viewport; a thunk is re-read per projection. See\n * `useNodeOverlayFrame`. */\n view?: View | (() => View);\n className?: string;\n}\n\n/**\n * Scene-aware paint handles: on-canvas geometry handles for the gradient in\n * one node's `fill` or `stroke` — `GradientHandles` for the three ramps,\n * `MeshHandles` for a mesh — committed through the `setFill` / `setStroke`\n * actions, on `nodeId` alone, as a single undo entry per drag. A canceled drag cancels the action,\n * and so does unmounting the overlay while a handle is held.\n *\n * Renders nothing unless the targeted slot holds a gradient or a mesh. The\n * node stores its gradient in `units: 'bounds'`, fractions of its own box; the\n * handles get it resolved onto the box and every edit is normalized back on\n * the way out.\n */\nexport function SceneGradientHandles<\n TData extends PaintedNodeData,\n TLayer extends string,\n TPose extends RectPose,\n>(props: SceneGradientHandlesProps<TData, TLayer, TPose>): ReactElement | null {\n const { scene, containerRef, nodeId, slot, view, className } = props;\n const frame = useNodeOverlayFrame(scene, containerRef, nodeId, { view });\n const edit = useOngoingAction(slot === 'fill' ? 'setFill' : 'setStroke');\n // An edit is open here only while a handle is held, so one still open at unmount is a drag cut short, and\n // that is a cancel. `useOngoingAction` would commit it in its own cleanup, which this layout cleanup runs\n // ahead of; the handle's unmount cancel comes after both and must not open a second edit to cancel.\n const gone = useRef(false);\n useLayoutEffect(() => {\n gone.current = false;\n return () => {\n gone.current = true;\n edit.cancel();\n };\n }, [edit]);\n\n const paint = frame ? paintOf(scene, nodeId, slot) : null;\n if (!frame || !paint) return null;\n\n const dispatch = (next: Paint, phase: 'input' | 'commit'): void => {\n if (gone.current) return;\n const params = { paint: paintToBoundsUnits(next, frame.box), ids: [nodeId!] };\n if (phase === 'commit') edit.commit(params);\n else edit.input(params);\n };\n const common = {\n toScreen: frame.toScreen,\n toLocal: frame.toLocal,\n width: frame.width,\n height: frame.height,\n className,\n onInput: (next: Paint) => dispatch(next, 'input'),\n onChange: (next: Paint) => dispatch(next, 'commit'),\n onCancel: () => edit.cancel(),\n };\n\n if (isGradientPaint(paint)) {\n return <GradientHandles value={paintToLocalUnits(paint, frame.box) as GradientPaint} {...common} />;\n }\n if (isMeshGradientPaint(paint)) {\n const resolved = paintToLocalUnits(paint, frame.box) as unknown as MeshGradientPaint;\n // Still in the bounds frame means the mesh kind has not loaded, and\n // handles drawn now would sit in fractions of the box.\n if (resolved.units === 'bounds') return null;\n return <MeshHandles value={resolved} {...common} />;\n }\n return null;\n}\n\nfunction paintOf<TData extends PaintedNodeData, TLayer extends string, TPose extends RectPose>(\n scene: Scene<TData, TLayer, TPose>,\n nodeId: string | null | undefined,\n slot: PaintSlot,\n): Paint | null | undefined {\n if (nodeId == null) return undefined;\n const data = (scene.nodes as ReadonlyMap<string, { data: TData }>).get(nodeId)?.data;\n if (!data) return undefined;\n // An inherited paint is its container's, and is edited there.\n return slot === 'fill' ? resolveFill(data.fill)?.paint : resolveStroke(data.stroke)?.paint;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuDA,SAAgB,qBAId,OAA6E;CAC7E,MAAM,EAAE,OAAO,cAAc,QAAQ,MAAM,MAAM,cAAc;CAC/D,MAAM,QAAQ,oBAAoB,OAAO,cAAc,QAAQ,EAAE,KAAK,CAAC;CACvE,MAAM,OAAO,iBAAiB,SAAS,SAAS,YAAY,WAAW;CAIvE,MAAM,OAAO,OAAO,KAAK;CACzB,sBAAsB;EACpB,KAAK,UAAU;EACf,aAAa;GACX,KAAK,UAAU;GACf,KAAK,OAAO;EACd;CACF,GAAG,CAAC,IAAI,CAAC;CAET,MAAM,QAAQ,QAAQ,QAAQ,OAAO,QAAQ,IAAI,IAAI;CACrD,IAAI,CAAC,SAAS,CAAC,OAAO,OAAO;CAE7B,MAAM,YAAY,MAAa,UAAoC;EACjE,IAAI,KAAK,SAAS;EAClB,MAAM,SAAS;GAAE,OAAO,mBAAmB,MAAM,MAAM,GAAG;GAAG,KAAK,CAAC,MAAO;EAAE;EAC5E,IAAI,UAAU,UAAU,KAAK,OAAO,MAAM;OACrC,KAAK,MAAM,MAAM;CACxB;CACA,MAAM,SAAS;EACb,UAAU,MAAM;EAChB,SAAS,MAAM;EACf,OAAO,MAAM;EACb,QAAQ,MAAM;EACd;EACA,UAAU,SAAgB,SAAS,MAAM,OAAO;EAChD,WAAW,SAAgB,SAAS,MAAM,QAAQ;EAClD,gBAAgB,KAAK,OAAO;CAC9B;CAEA,IAAI,gBAAgB,KAAK,GACvB,OAAO,oBAAC,iBAAD;EAAiB,OAAO,kBAAkB,OAAO,MAAM,GAAG;EAAoB,GAAI;CAAS,CAAA;CAEpG,IAAI,oBAAoB,KAAK,GAAG;EAC9B,MAAM,WAAW,kBAAkB,OAAO,MAAM,GAAG;EAGnD,IAAI,SAAS,UAAU,UAAU,OAAO;EACxC,OAAO,oBAAC,aAAD;GAAa,OAAO;GAAU,GAAI;EAAS,CAAA;CACpD;CACA,OAAO;AACT;AAEA,SAAS,QACP,OACA,QACA,MAC0B;CAC1B,IAAI,UAAU,MAAM,OAAO;CAC3B,MAAM,OAAQ,MAAM,MAA+C,IAAI,MAAM,CAAC,EAAE;CAChF,IAAI,CAAC,MAAM,OAAO;CAElB,OAAO,SAAS,SAAS,YAAY,KAAK,IAAI,CAAC,EAAE,QAAQ,cAAc,KAAK,MAAM,CAAC,EAAE;AACvF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { asNodeId,
|
|
1
|
+
import { asNodeId, defaultCommitAdapter, dispatchApplyBatch, isAnnotationLayer, pageIdOf, pageName, pageRunOf, placedPagesOf, withoutPageStructure } from "@weasel-js/core";
|
|
2
|
+
import * as coreOps from "@weasel-js/core/ops";
|
|
2
3
|
|
|
3
4
|
// src/components/SceneLayerList/useSceneLayerList.ts
|
|
4
5
|
/** The id prefix of an annotation layer's own row, which holds its nodes. */
|
|
@@ -65,7 +66,7 @@ function useSceneLayerList(args) {
|
|
|
65
66
|
const kids = scene.childrenOf(id);
|
|
66
67
|
if (id === run) return build(kids, extra);
|
|
67
68
|
const children = kids.length > 0 ? { children: build(kids, extra) } : {};
|
|
68
|
-
const page = node.page === void 0 ? void 0 : pages.get(
|
|
69
|
+
const page = node.page === void 0 ? void 0 : pages.get(pageIdOf(scene, id));
|
|
69
70
|
if (page !== void 0) return [{
|
|
70
71
|
id,
|
|
71
72
|
label: pageName(page, page.index),
|
|
@@ -104,11 +105,13 @@ function useSceneLayerList(args) {
|
|
|
104
105
|
selectedIds: [...selection.current.map(String), ...picked !== null ? [picked] : []],
|
|
105
106
|
onSelectionChange: (ids) => {
|
|
106
107
|
const notes = ids.filter(isAnnotation);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
const added = notes.filter((id) => id !== picked).at(-1);
|
|
109
|
+
if (annotations) {
|
|
110
|
+
const next = added ?? (picked !== null && notes.includes(picked) ? picked : null);
|
|
111
|
+
if (next !== picked) annotations.pick(next);
|
|
110
112
|
}
|
|
111
|
-
|
|
113
|
+
if (added !== void 0) return;
|
|
114
|
+
selection.set([...withoutPageStructure(scene, ids.filter((id) => !isAnnotation(id) && !id.startsWith("annotation-layer:")).map(asNodeId))]);
|
|
112
115
|
},
|
|
113
116
|
canMove: ({ ids, parentId }) => {
|
|
114
117
|
if (ids.some((id) => id.startsWith("annotation-layer:"))) return false;
|
|
@@ -126,19 +129,19 @@ function useSceneLayerList(args) {
|
|
|
126
129
|
const to = back < shown.length ? left.indexOf(shown[back]) : shown.length > 0 ? left.indexOf(shown.at(-1)) + 1 : left.length;
|
|
127
130
|
const joining = [...ids].reverse().flatMap((id) => {
|
|
128
131
|
const from = scene.get(asNodeId(id))?.parent ?? null;
|
|
129
|
-
return from === parent ? [] : [
|
|
132
|
+
return from === parent ? [] : [coreOps.reparent({
|
|
130
133
|
id,
|
|
131
134
|
fromParentId: from,
|
|
132
135
|
toParentId: parent
|
|
133
136
|
})];
|
|
134
137
|
});
|
|
135
|
-
commit([...joining,
|
|
138
|
+
commit([...joining, coreOps.moveToIndex({
|
|
136
139
|
ids,
|
|
137
140
|
parentId: parent,
|
|
138
141
|
index: to
|
|
139
142
|
})], label);
|
|
140
143
|
},
|
|
141
|
-
onVisibilityChange: (changes) => commitToggle(commit, changes, (layer, on) => scene.setLayerVisible(layer, on), (id, on) =>
|
|
144
|
+
onVisibilityChange: (changes) => commitToggle(commit, changes, (layer, on) => scene.setLayerVisible(layer, on), (id, on) => coreOps.setHidden({
|
|
142
145
|
id,
|
|
143
146
|
from: scene.get(asNodeId(id))?.hidden === true,
|
|
144
147
|
to: !on
|
|
@@ -147,7 +150,7 @@ function useSceneLayerList(args) {
|
|
|
147
150
|
"Hide",
|
|
148
151
|
"Show Only"
|
|
149
152
|
]),
|
|
150
|
-
onLockChange: (changes) => commitToggle(commit, changes, (layer, on) => scene.setLayerLocked(layer, on), (id, on) =>
|
|
153
|
+
onLockChange: (changes) => commitToggle(commit, changes, (layer, on) => scene.setLayerLocked(layer, on), (id, on) => coreOps.setLocked({
|
|
151
154
|
id,
|
|
152
155
|
from: scene.get(asNodeId(id))?.locked === true,
|
|
153
156
|
to: on
|
|
@@ -158,7 +161,7 @@ function useSceneLayerList(args) {
|
|
|
158
161
|
]),
|
|
159
162
|
...rename ? { onRename: (id, to) => {
|
|
160
163
|
const node = scene.get(asNodeId(id));
|
|
161
|
-
if (node) commit([
|
|
164
|
+
if (node) commit([coreOps.setData({
|
|
162
165
|
id,
|
|
163
166
|
from: node.data,
|
|
164
167
|
to: rename(node, to)
|
|
@@ -168,7 +171,7 @@ function useSceneLayerList(args) {
|
|
|
168
171
|
const node = scene.get(asNodeId(id));
|
|
169
172
|
if (!node || !isAnnotation(id)) return;
|
|
170
173
|
const siblings = node.parent === null ? scene.roots : scene.childrenOf(node.parent);
|
|
171
|
-
commit([
|
|
174
|
+
commit([coreOps.delete({
|
|
172
175
|
node,
|
|
173
176
|
index: siblings.indexOf(node.id),
|
|
174
177
|
label: "Delete"
|
|
@@ -179,4 +182,4 @@ function useSceneLayerList(args) {
|
|
|
179
182
|
}
|
|
180
183
|
|
|
181
184
|
export { useSceneLayerList as n, ANNOTATION_LAYER_ROW as t };
|
|
182
|
-
//# sourceMappingURL=SceneLayerList-
|
|
185
|
+
//# sourceMappingURL=SceneLayerList-D2yc3eIk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SceneLayerList-D2yc3eIk.js","names":[],"sources":["../../src/components/SceneLayerList/useSceneLayerList.ts"],"sourcesContent":["import {\n asNodeId,\n defaultCommitAdapter, dispatchApplyBatch, isAnnotationLayer, pageName, pageIdOf, pageRunOf, placedPagesOf,\n withoutPageStructure,\n} from '@weasel-js/core';\nimport type { NodeId, SelectionApi } from '@weasel-js/routing';\nimport type { Op } from '@weasel-js/history';\nimport type { Scene, SceneNode } from '@weasel-js/core';\nimport type { LayerListItem, LayerListProps } from '@weasel-js/ui/components/LayerList';\nimport * as coreOps from '@weasel-js/core/ops';\n\n/** The id prefix of an annotation layer's own row, which holds its nodes. */\nexport const ANNOTATION_LAYER_ROW = 'annotation-layer:';\n\n/** The annotation layer whose row `row` is, if it is one. */\nconst annotationLayerOf = (row: string | null): string | null =>\n row?.startsWith(ANNOTATION_LAYER_ROW) ? row.slice(ANNOTATION_LAYER_ROW.length) : null;\n\n/** How a {@link useSceneLayerList} list shows annotation layers. */\nexport interface SceneLayerListAnnotations {\n /** The picked annotation node, which reads as a selected row. */\n picked: string | null;\n /** Selecting an annotation row picks it, leaving the content selection as it was; a selection holding no annotation picks `null`. */\n pick(id: string | null): void;\n /** The row label for annotation layer `layer`. Default: its id. */\n labelOf?(layer: string): string;\n}\n\n/** Arguments for {@link useSceneLayerList}. */\nexport interface UseSceneLayerListOptions<TData, TLayer extends string, TPose> {\n scene: Scene<TData, TLayer, TPose>;\n selection: SelectionApi;\n /** What the reorder op is dispatched against. Default: the scene itself, as one history entry. */\n adapter?: object;\n /** A row's content for a node: its label, a leading swatch or icon. Its\n * `visible` and `locked` come from the node's own flags. */\n itemFor: (node: SceneNode<TData, TLayer, TPose>) => Omit<LayerListItem, 'id' | 'children'>;\n /** The data a rename to `label` writes, which makes rows renamable. The\n * scene has no name of its own, so where one lives is the consumer's call. */\n rename?: (node: SceneNode<TData, TLayer, TPose>, label: string) => TData;\n /** Label of the reorder's history entry. Default `'Reorder'`. */\n label?: string;\n /** Given, each annotation layer (`isAnnotationLayer`) gets a row holding its\n * nodes, marked not printed: the layer can be hidden and locked, its nodes\n * picked and removed. Absent, annotations are left out of the list — the canvas still\n * draws them. */\n annotations?: SceneLayerListAnnotations;\n}\n\n/** Commits a toggle's `changes` as one history entry. An annotation layer's row toggles the layer through\n * `layerTo`, since a layer is no node and has no op. */\nfunction commitToggle<TLayer extends string>(\n commit: (ops: Op[], entry: string) => void,\n changes: Readonly<Record<string, boolean>>,\n layerTo: (layer: TLayer, on: boolean) => void,\n opOf: (id: string, on: boolean) => Op,\n [on, off, mixed]: readonly [string, string, string],\n): void {\n const ops = Object.entries(changes).flatMap(([id, to]) => {\n if (!id.startsWith(ANNOTATION_LAYER_ROW)) return [opOf(id, to)];\n layerTo(id.slice(ANNOTATION_LAYER_ROW.length) as TLayer, to);\n return [];\n });\n if (ops.length === 0) return;\n // The entry names the direction every row went, or `mixed` for an Alt-click that went both ways.\n const values = Object.values(changes);\n commit(ops, values.every(Boolean) ? on : values.some(Boolean) ? mixed : off);\n}\n\n/**\n * How many of `shown`, the siblings under `parent` a drag left behind, lie behind a drop at gap `at` of the list's\n * top level, where the page run's children are listed beside the other roots. A sibling is behind when its front-most\n * row there is at or past the gap; the run, whose rows are its children's, counts by the first of them.\n */\nfunction behindTopGap(\n childrenOf: (id: NodeId) => readonly NodeId[],\n roots: readonly NodeId[],\n run: NodeId | null,\n moved: ReadonlySet<string>,\n parent: string | null,\n shown: readonly NodeId[],\n at: number,\n): number {\n const owners: (NodeId | undefined)[] = [];\n for (const root of [...roots].reverse()) {\n if (root !== run) {\n if (!moved.has(root)) owners.push(parent === null ? root : undefined);\n continue;\n }\n for (const kid of [...childrenOf(root)].reverse()) {\n if (!moved.has(kid)) owners.push(parent === null ? root : parent === run ? kid : undefined);\n }\n }\n return shown.filter((id) => {\n const first = owners.indexOf(id);\n return first < 0 || first >= at;\n }).length;\n}\n\n/** The `<LayerList>` props `useSceneLayerList` answers. */\nexport type SceneLayerListProps = Required<Pick<LayerListProps, 'items' | 'selectedIds' | 'onSelectionChange' | 'onReorder' | 'canMove' | 'onVisibilityChange' | 'onLockChange'>>\n & Pick<LayerListProps, 'onRemove' | 'onRename'>;\n\n/**\n * The props that put a scene in a `<LayerList>`: a row per node, a container's\n * children nested under it, the front-most at the top, selection read from and\n * written to `selection`, a drag — among siblings or into another container —\n * dispatched as a `MoveToIndexOp`, and each row's visibility and lock toggling\n * the node's own (`setHidden` / `setLocked` ops), each click one undo step, an Alt-click's batch included.\n * Annotation layers are left out unless `annotations` says how to show them;\n * shown, an annotation moves only within its own layer's row.\n */\nexport function useSceneLayerList<TData, TLayer extends string, TPose>(\n args: UseSceneLayerListOptions<TData, TLayer, TPose>,\n): SceneLayerListProps {\n const { scene, selection, adapter, itemFor, rename, label = 'Reorder', annotations } = args;\n const annotationLayers = scene.layers.filter(isAnnotationLayer);\n const onAnnotation = new Set<string>(annotationLayers.map((l) => l.id));\n const isAnnotation = (id: string) => {\n const layer = scene.get(asNodeId(id))?.layer;\n return layer !== undefined && onAnnotation.has(layer);\n };\n const commit = (ops: Op[], entry: string) => {\n if (adapter) dispatchApplyBatch(adapter, ops, entry);\n else scene.applyBatch(ops, entry, defaultCommitAdapter(scene, selection.adapterMethods));\n };\n\n // A scene orders children back to front and the list front to back. Rebuilt\n // every render: the scene keeps its identity across a reorder, so a memo keyed\n // on it would serve the order from before. The page run lists as what it holds,\n // and a page as a fixed row of what is on it: pages are edited through the page API.\n const run = pageRunOf(scene);\n const pages = new Map(placedPagesOf(scene).map((page) => [page.id, page]));\n const build = (ids: readonly NodeId[], extra: Partial<LayerListItem>): LayerListItem[] =>\n [...ids].reverse().flatMap((id) => {\n const node = scene.get(id);\n if (!node) return [];\n const kids = scene.childrenOf(id);\n if (id === run) return build(kids, extra);\n const children = kids.length > 0 ? { children: build(kids, extra) } : {};\n const page = node.page === undefined ? undefined : pages.get(pageIdOf(scene, id)!);\n if (page !== undefined) return [{ id, label: pageName(page, page.index), fixed: true, ...children }];\n return [{\n ...itemFor(node), ...extra, id, visible: node.hidden !== true, locked: node.locked === true, ...children,\n }];\n });\n\n // The list's top level holds the run's children and the scene's own roots alike. A drag that stays there\n // keeps its parent; one brought up from inside a container goes to the run, or with the pasteboard on, the root.\n const topParent = (ids: readonly string[]): NodeId | null => {\n const from = scene.get(asNodeId(ids[0]!))?.parent ?? null;\n if (from === null || from === run) return from;\n if (run === null) return null;\n return scene.get(run)!.pageRun!.pasteboard === true ? null : run;\n };\n\n const content = build(scene.roots.filter((id) => !isAnnotation(id)), annotations ? { removable: false } : {});\n const annotationRows: LayerListItem[] = annotations\n ? [...annotationLayers].reverse().map((layer) => ({\n id: `${ANNOTATION_LAYER_ROW}${layer.id}`,\n label: annotations.labelOf?.(layer.id) ?? layer.id,\n nonPrinting: true,\n visible: layer.visible,\n locked: layer.locked,\n removable: false,\n renamable: false,\n children: build(scene.roots.filter((id) => scene.get(id)?.layer === layer.id), { nonPrinting: true }),\n }))\n : [];\n const picked = annotations?.picked ?? null;\n\n return {\n items: [...annotationRows, ...content],\n selectedIds: [...selection.current.map(String), ...(picked !== null ? [picked] : [])],\n onSelectionChange: (ids) => {\n const notes = ids.filter(isAnnotation);\n const added = notes.filter((id) => id !== picked).at(-1);\n if (annotations) {\n const next = added ?? (picked !== null && notes.includes(picked) ? picked : null);\n if (next !== picked) annotations.pick(next);\n }\n // A click that picks an annotation leaves the content selection as it was.\n if (added !== undefined) return;\n selection.set([...withoutPageStructure(scene, ids.filter((id) => !isAnnotation(id) && !id.startsWith(ANNOTATION_LAYER_ROW)).map(asNodeId))]);\n },\n canMove: ({ ids, parentId }) => {\n if (ids.some((id) => id.startsWith(ANNOTATION_LAYER_ROW))) return false;\n const into = annotationLayerOf(parentId);\n return ids.every((id) => (isAnnotation(id) ? scene.get(asNodeId(id))?.layer === into : into === null));\n },\n onReorder: ({ ids, parentId, index }) => {\n // An annotation layer's row holds roots on that layer; it is no node of the scene.\n const layer = annotationLayerOf(parentId);\n const parent = layer !== null ? null : (parentId ?? topParent(ids));\n const moved = new Set(ids);\n const left = (parent === null ? scene.roots : scene.childrenOf(asNodeId(parent))).filter((id) => !moved.has(id));\n // `index` counts from the front among the rows the drag left behind, the annotation rows heading the top\n // level among them; the rows shown stand for the siblings of the list's own level.\n const shown = left.filter((id) => (layer !== null ? scene.get(id)?.layer === layer : !isAnnotation(id)));\n const at = parentId === null ? Math.max(0, index - annotationRows.length) : index;\n const back = parentId === null && layer === null\n ? behindTopGap((id) => scene.childrenOf(id), scene.roots.filter((id) => !isAnnotation(id)), run, moved, parent, shown, at)\n : Math.max(0, shown.length - at);\n const to = back < shown.length ? left.indexOf(shown[back]!) : shown.length > 0 ? left.indexOf(shown.at(-1)!) + 1 : left.length;\n // A node from another container joins this one first, back to front as the scene orders children.\n const joining = [...ids].reverse().flatMap((id) => {\n const from = scene.get(asNodeId(id))?.parent ?? null;\n return from === parent ? [] : [coreOps.reparent({ id, fromParentId: from, toParentId: parent })];\n });\n commit([...joining, coreOps.moveToIndex({ ids, parentId: parent, index: to })], label);\n },\n onVisibilityChange: (changes) => commitToggle(commit, changes, (layer: TLayer, on) => scene.setLayerVisible(layer, on),\n (id, on) => coreOps.setHidden({ id, from: scene.get(asNodeId(id))?.hidden === true, to: !on }), ['Show', 'Hide', 'Show Only']),\n onLockChange: (changes) => commitToggle(commit, changes, (layer: TLayer, on) => scene.setLayerLocked(layer, on),\n (id, on) => coreOps.setLocked({ id, from: scene.get(asNodeId(id))?.locked === true, to: on }), ['Lock', 'Unlock', 'Lock Only']),\n ...(rename ? {\n onRename: (id: string, to: string) => {\n const node = scene.get(asNodeId(id));\n if (node) commit([coreOps.setData({ id, from: node.data, to: rename(node, to) })], 'Rename');\n },\n } : {}),\n ...(annotations ? {\n onRemove: (id: string) => {\n const node = scene.get(asNodeId(id));\n if (!node || !isAnnotation(id)) return;\n const siblings = node.parent === null ? scene.roots : scene.childrenOf(node.parent);\n commit([coreOps.delete({ node, index: siblings.indexOf(node.id), label: 'Delete' })], 'Delete');\n if (annotations.picked === id) annotations.pick(null);\n },\n } : {}),\n };\n}\n"],"mappings":";;;;;AAYA,IAAa,uBAAuB;;AAGpC,IAAM,qBAAqB,QACzB,KAAK,8BAA+B,IAAI,IAAI,MAAM,EAA2B,IAAI;;;AAmCnF,SAAS,aACP,QACA,SACA,SACA,MACA,CAAC,IAAI,KAAK,QACJ;CACN,MAAM,MAAM,OAAO,QAAQ,OAAO,CA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YAAY,KAAK,IAAI;EACtD,EACF,IAAI,CAAC;CACP;AACF"}
|
|
@@ -3,7 +3,7 @@ import { asNodeId, nodeTraitsOf, paintAbove, routeKind, sceneSharedUnitScopes }
|
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { compositeKey, isDev } from "@weasel-js/registry";
|
|
5
5
|
import { useLatest } from "@weasel-js/react";
|
|
6
|
-
import { prefHoldsValue,
|
|
6
|
+
import { prefHoldsValue, prefLeafInUnitScopes, prefStoredReset } from "@weasel-js/prefs";
|
|
7
7
|
import { PanelMarksContext, boundAt, conditionedSections, isPanelSection, kindBreakdown, nodeLeafValue, panelEntryOf, panelMarkedPaths, panelRowsOf, panelSections, panelSource, setAtPath, sharedValue } from "@weasel-js/ui/components/PanelCells";
|
|
8
8
|
import { PrefsSource } from "@weasel-js/ui/components/PrefsSource";
|
|
9
9
|
import { prefFieldChoices, useParamsPolicy, useSelectedRow } from "@weasel-js/ui/components/Prefs";
|
|
@@ -25,11 +25,6 @@ function nodeRoot(node, head) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// src/components/inspector/SelectionPanel/nodeModel.ts
|
|
28
|
-
/** A node's routing kind under `routing`, as a canvas given the same table names it. A
|
|
29
|
-
* container is `'group'` only when the table carries `groupNodeRouting`. */
|
|
30
|
-
function classifyKind(node, routing) {
|
|
31
|
-
return routeKind(routing, node.data, node);
|
|
32
|
-
}
|
|
33
28
|
/** Read a node value at a dotted path of any depth (`pose.x`,
|
|
34
29
|
* `data.style.fontSize`, `data.style.fill.paint.color`), or at a field the
|
|
35
30
|
* node declares for its children (`clip`, `units.unit`). Returns `undefined`
|
|
@@ -46,9 +41,9 @@ function nodeValueAt(node, path) {
|
|
|
46
41
|
}
|
|
47
42
|
return cursor;
|
|
48
43
|
}
|
|
49
|
-
/**
|
|
44
|
+
/** A path's value shared across nodes, or `MIXED`. A node
|
|
50
45
|
* holding nothing there reads as `absent`. */
|
|
51
|
-
function
|
|
46
|
+
function sharedNodeValue(nodes, path, absent) {
|
|
52
47
|
return sharedValue(nodes.map((node) => {
|
|
53
48
|
const held = nodeValueAt(node, path);
|
|
54
49
|
return held === void 0 ? absent : held;
|
|
@@ -157,6 +152,7 @@ function leafWrites(scene, settleOf = NO_SETTLE) {
|
|
|
157
152
|
for (const leaf of due) writeLeaf(scene, ids, leaf, () => prefStoredReset(leaf.leaf), settleOf);
|
|
158
153
|
});
|
|
159
154
|
},
|
|
155
|
+
cancel: restore,
|
|
160
156
|
commit: (selection, leaf, next) => {
|
|
161
157
|
restore(leaf);
|
|
162
158
|
commitLeaf(scene, selection, leaf, next, settleOf);
|
|
@@ -202,7 +198,7 @@ function sectionsInScopes(sections, scene, nodes, root) {
|
|
|
202
198
|
...item,
|
|
203
199
|
leaves: item.leaves.map((l) => ({
|
|
204
200
|
...l,
|
|
205
|
-
leaf:
|
|
201
|
+
leaf: prefLeafInUnitScopes(l.leaf, chain)
|
|
206
202
|
}))
|
|
207
203
|
};
|
|
208
204
|
return sections.map((section) => within(section));
|
|
@@ -244,9 +240,9 @@ function SelectionPanel(props) {
|
|
|
244
240
|
properties,
|
|
245
241
|
routing
|
|
246
242
|
});
|
|
247
|
-
const writes = useMemo(() => leafWrites(scene, (node) => panelEntryOf(traits.current.properties,
|
|
243
|
+
const writes = useMemo(() => leafWrites(scene, (node) => panelEntryOf(traits.current.properties, routeKind(traits.current.routing, node.data, node))?.settle), [scene, traits]);
|
|
248
244
|
const nodes = selection.current.map((id) => scene.get(asNodeId(id))).filter((n) => n != null);
|
|
249
|
-
const kinds = nodes.map((n) =>
|
|
245
|
+
const kinds = nodes.map((n) => routeKind(routing, n.data, n));
|
|
250
246
|
const records = nodes.map((n) => nodeRecord(n, (node) => paintAbove(scene, node)));
|
|
251
247
|
const selectionKey = compositeKey(nodes.map((n) => n.id));
|
|
252
248
|
const scope = conditionedSections(kinds, properties, records, renderers?.alias !== void 0, props.markHidden === true, props.over);
|
|
@@ -258,13 +254,13 @@ function SelectionPanel(props) {
|
|
|
258
254
|
name: "",
|
|
259
255
|
members: Object.fromEntries(leaves)
|
|
260
256
|
});
|
|
261
|
-
const shown = panelMarkedPaths(sections, props.
|
|
257
|
+
const shown = panelMarkedPaths(sections, props.marked ?? NO_MARKS, renderers);
|
|
262
258
|
const marks = {
|
|
263
259
|
selected: shown,
|
|
264
260
|
lead: shown.at(-1) ?? null,
|
|
265
261
|
...props.markHidden ? { hidden: scope.hidden } : {}
|
|
266
262
|
};
|
|
267
|
-
const rowSelection = useSelectedRow(props.
|
|
263
|
+
const rowSelection = useSelectedRow(props.marked ?? NO_MARKS, marks.lead ?? null, props.onMark);
|
|
268
264
|
const { settles, textWaitMs } = useParamsPolicy("panel");
|
|
269
265
|
if (nodes.length === 0) return /* @__PURE__ */ jsx("div", {
|
|
270
266
|
className: [SelectionPanel_module_default.root, className].filter(Boolean).join(" "),
|
|
@@ -275,6 +271,7 @@ function SelectionPanel(props) {
|
|
|
275
271
|
renderers,
|
|
276
272
|
commit: (leaf, next) => writes.commit(selection, leaf, next),
|
|
277
273
|
draft: (leaf, next) => writes.draft(selection, leaf, next),
|
|
274
|
+
cancel: (leaf) => writes.cancel?.(leaf),
|
|
278
275
|
source: panelSource({
|
|
279
276
|
records,
|
|
280
277
|
leaves: panelLeaves,
|
|
@@ -319,5 +316,5 @@ function SelectionPanel(props) {
|
|
|
319
316
|
});
|
|
320
317
|
}
|
|
321
318
|
|
|
322
|
-
export { nodeValueAt as
|
|
323
|
-
//# sourceMappingURL=SelectionPanel-
|
|
319
|
+
export { nodeValueAt as n, sharedNodeValue as r, SelectionPanel as t };
|
|
320
|
+
//# sourceMappingURL=SelectionPanel-Dz6_c0rd.js.map
|