@weasel-js/core 1.5.1 → 1.5.2
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/CHANGELOG.md +138 -0
- package/dist/{chunk-P6MGECVO.js → chunk-44EWMJV2.js} +3 -3
- package/dist/{chunk-P6MGECVO.js.map → chunk-44EWMJV2.js.map} +1 -1
- package/dist/{chunk-XXQ6FLCJ.js → chunk-H6N2JSZ3.js} +3 -3
- package/dist/{chunk-XXQ6FLCJ.js.map → chunk-H6N2JSZ3.js.map} +1 -1
- package/dist/{chunk-HAGOFNP5.js → chunk-HPFJUUTF.js} +25 -20
- package/dist/chunk-HPFJUUTF.js.map +1 -0
- package/dist/{chunk-3LPQ2XZG.js → chunk-L5YNZYEG.js} +8 -13
- package/dist/chunk-L5YNZYEG.js.map +1 -0
- package/dist/{chunk-LXJDWBEL.js → chunk-PNNZSYRD.js} +2 -2
- package/dist/{chunk-LXJDWBEL.js.map → chunk-PNNZSYRD.js.map} +1 -1
- package/dist/{chunk-GREL4MVO.js → chunk-QEZL53V6.js} +308 -186
- package/dist/chunk-QEZL53V6.js.map +1 -0
- package/dist/{depSchema-BubKMv-2.d.ts → depSchema-FKQBEfg7.d.ts} +53 -51
- package/dist/{grid-Z_Af3vTl.d.ts → grid-CuxXjaQV.d.ts} +21 -5
- package/dist/index.d.ts +146 -39
- package/dist/index.js +6 -6
- package/dist/insert.js +2 -2
- package/dist/{math-E3rZn4bR.d.ts → math-CeGmGPy8.d.ts} +4 -19
- package/dist/math.d.ts +2 -2
- package/dist/math.js +2 -2
- package/dist/move.d.ts +2 -2
- package/dist/move.js +3 -3
- package/dist/renderer.d.ts +4 -4
- package/dist/renderer.js +6 -6
- package/dist/resize.js +3 -3
- package/package.json +10 -10
- package/dist/chunk-3LPQ2XZG.js.map +0 -1
- package/dist/chunk-GREL4MVO.js.map +0 -1
- package/dist/chunk-HAGOFNP5.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { rotatePoint, aabbCenter, extractPolylines, createSimulation } from './chunk-
|
|
2
|
-
import { createReparentOp, createTransformOp, snap } from './chunk-
|
|
3
|
-
import { fixedCornerOf, DEFAULT_RESIZE_BEHAVIORS, CORNER_ANCHORS, cornerPoint } from './chunk-
|
|
4
|
-
import { resolveUnit, ANGLE_RADIANS, withinPxRadius, scaleDelta, pxExtent, withinPxBox, pointToGridCell } from './chunk-
|
|
5
|
-
import { unionBounds, visualBoundsViaDescriptor, translatePoseViaDescriptor, poseDescriptorForNode, unionAABB, AUTO_POSE_DESCRIPTOR, remapRotatedLeaf, PATH_Z, PATH_Q, PATH_C, PATH_L, PATH_M, polylineFromPoints, starPath, regularPolygonPath, linePath, ellipsePath, rectPath, polygonFromPoints, PathBuilder, boundsOfPath, pointInPath, isPathLike, strokeHitTest, isRectPose, transformPath, translatePath, DEFAULT_FLATTEN_TOLERANCE, flattenQuadratic, flattenCubic, flattenCubicWithArcLen, flattenQuadraticWithArcLen, RECT_POSE_DESCRIPTOR, aabbIntersectsRect } from './chunk-
|
|
1
|
+
import { rotatePoint, aabbCenter, extractPolylines, createSimulation } from './chunk-PNNZSYRD.js';
|
|
2
|
+
import { createReparentOp, createTransformOp, snap } from './chunk-44EWMJV2.js';
|
|
3
|
+
import { fixedCornerOf, DEFAULT_RESIZE_BEHAVIORS, CORNER_ANCHORS, cornerPoint } from './chunk-H6N2JSZ3.js';
|
|
4
|
+
import { unitScale, formatUnit, resolveUnit, ANGLE_RADIANS, withinPxRadius, scaleDelta, pxExtent, withinPxBox, pointToGridCell } from './chunk-HPFJUUTF.js';
|
|
5
|
+
import { unionBounds, visualBoundsViaDescriptor, translatePoseViaDescriptor, poseDescriptorForNode, unionAABB, AUTO_POSE_DESCRIPTOR, remapRotatedLeaf, PATH_Z, PATH_Q, PATH_C, PATH_L, PATH_M, polylineFromPoints, starPath, regularPolygonPath, linePath, ellipsePath, rectPath, polygonFromPoints, PathBuilder, boundsOfPath, pointInPath, isPathLike, strokeHitTest, isRectPose, transformPath, translatePath, DEFAULT_FLATTEN_TOLERANCE, flattenQuadratic, flattenCubic, flattenCubicWithArcLen, flattenQuadraticWithArcLen, RECT_POSE_DESCRIPTOR, aabbIntersectsRect } from './chunk-L5YNZYEG.js';
|
|
6
6
|
import { dispatchApplyBatch, dlog, dwarn, usePointerContext, PointerContextProvider, extractWeaselClipboardFromSvg, parseWeaselClipboardText, materializePaste, WEASEL_CLIPBOARD_MIME, WEASEL_CLIPBOARD_MIME_WEB, sniffWeaselClipboardText, applyOpsTo } from './chunk-T3UQ3F6R.js';
|
|
7
7
|
import { createSetSelectionOp } from './chunk-DOBSZOPR.js';
|
|
8
8
|
import { registerOpFactory, createInsertOp, createDeleteOp, rebuildOp } from './chunk-4RJP2N2L.js';
|
|
@@ -10,8 +10,8 @@ import { getTexture, chunks, dots, crosshatch, hatch } from './chunk-BJN5ZRIJ.js
|
|
|
10
10
|
import { createContext, createElement, forwardRef, useMemo, useRef, useCallback, useState, useLayoutEffect, useEffect, useImperativeHandle, useSyncExternalStore, useContext, useId, useReducer } from 'react';
|
|
11
11
|
import { GLYPH_COVERAGE_GLSL, subscribeGlyphReady, DEFAULT_BAKE_BUDGET, markAllFontsNotUploaded, resetBakeBudget, syncDynamicPageTexture, ensureFontTexture, dynamicPageTextureId, textureCacheKey, GLYPH_MODE_R8, GLYPH_MODE_MSDF } from '@weasel-js/font';
|
|
12
12
|
export { canQueryLocalFonts, canQueryLocalFonts as canQueryLocalFonts2, enableLocalFontOutlines, enableLocalFontOutlines as enableLocalFontOutlines2, hasFontOutlines, hasFontOutlines as hasFontOutlines2, isCanvasFont, isCanvasFont as isCanvasFont2, listFontOutlines, listFontOutlines as listFontOutlines2, outlineStatus, outlineStatus as outlineStatus2, registerCanvasFont, registerCanvasFont as registerCanvasFont2, registerFont, registerFont as registerFont2, registerFontOutlines, registerFontOutlines as registerFontOutlines2, subscribeGlyphReady, subscribeGlyphReady as subscribeGlyphReady2, unregisterCanvasFont, unregisterCanvasFont as unregisterCanvasFont2, unregisterFontOutlines, unregisterFontOutlines as unregisterFontOutlines2 } from '@weasel-js/font';
|
|
13
|
-
import { dashForStrokeStyle, strokeDashStyleOf, resolveScreenLength, alignedStrokeRect, lerpColorArray,
|
|
14
|
-
export { STROKE_DASH_RATIOS, alignedStrokeRect, dashForStrokeStyle, lerpColorArray, lerpOklab, lerpOklch, oklabToOklch, oklabToSrgbU8, oklchToOklab, resolveScreenLength, srgbU8ToOklab, strokeDashStyleOf } from '@weasel-js/paint';
|
|
13
|
+
import { dashForStrokeStyle, strokeDashStyleOf, resolveScreenLength, alignedStrokeRect, lerpColorArray, srgbFloatToOklab, oklabToOklch, oklchToOklab, oklabToSrgbU8 } from '@weasel-js/paint';
|
|
14
|
+
export { STROKE_DASH_RATIOS, alignedStrokeRect, dashForStrokeStyle, hexToOklchDeg, lerpColorArray, lerpOklab, lerpOklch, oklabToOklch, oklabToSrgbU8, oklchDegToHex, oklchToOklab, resolveScreenLength, srgbFloatToOklab, srgbU8ToOklab, strokeDashStyleOf } from '@weasel-js/paint';
|
|
15
15
|
import { boxToBox, forEachSegment, multiply as multiply$1, rotate, translate as translate$1, rectToContour, invert as invert$1, clampRectWithin, applyToPoint, rotateAboutPoint, cubicEvalAt, pointInPolygon, segmentsCross, pathCommandCoordCount, pointSegmentDist2, elevateQuadraticToCubic } from '@weasel-js/geom';
|
|
16
16
|
import { resolveTextStyle, resolveAlign, resolveRuns, cachedLayoutRuns, verticalAlignOffset, textPoseLayoutInput, runsToPlainText, layoutTextPose, fontString, textLineBoxes } from '@weasel-js/text';
|
|
17
17
|
export { DEFAULT_TEXT_STYLE, MARKDOWN_RUN_GRAMMAR, SCRIPT_METRICS, cachedLayoutRuns, createMarkdownRenderer, fontString, layoutMarkdown, layoutRuns, layoutTextPose, markdownToRuns, measureText, measureTextBounds, measuredWidth, resolveAlign, resolveRuns, resolveTextStyle, runsToMarkdown, runsToPlainText, textLineBoxes, textPoseLayoutInput, toRuns, verticalAlignOffset } from '@weasel-js/text';
|
|
@@ -29,7 +29,7 @@ import { createHistory } from '@weasel-js/history';
|
|
|
29
29
|
export * from '@weasel-js/history';
|
|
30
30
|
|
|
31
31
|
// src/version.ts
|
|
32
|
-
var VERSION = "1.5.
|
|
32
|
+
var VERSION = "1.5.2" ;
|
|
33
33
|
|
|
34
34
|
// src/features/grid/roundToCell.ts
|
|
35
35
|
function roundToCell(value, cellSize) {
|
|
@@ -1517,9 +1517,15 @@ function scaled(m, sx, sy) {
|
|
|
1517
1517
|
const s = create(sx, 0, 0, sy, 0, 0);
|
|
1518
1518
|
return multiply(m, s);
|
|
1519
1519
|
}
|
|
1520
|
+
function toAffine(m) {
|
|
1521
|
+
return [m[0], m[1], m[3], m[4], m[6], m[7]];
|
|
1522
|
+
}
|
|
1523
|
+
function fromAffine(a) {
|
|
1524
|
+
return create(a[0], a[1], a[2], a[3], a[4], a[5]);
|
|
1525
|
+
}
|
|
1520
1526
|
function invert(m) {
|
|
1521
|
-
const inv = invert$1(
|
|
1522
|
-
return inv &&
|
|
1527
|
+
const inv = invert$1(toAffine(m));
|
|
1528
|
+
return inv && fromAffine(inv);
|
|
1523
1529
|
}
|
|
1524
1530
|
function apply(m, x, y) {
|
|
1525
1531
|
const a = m[0], b = m[1];
|
|
@@ -1548,6 +1554,8 @@ function meanScaleOf(m) {
|
|
|
1548
1554
|
}
|
|
1549
1555
|
var mat3 = {
|
|
1550
1556
|
identity,
|
|
1557
|
+
toAffine,
|
|
1558
|
+
fromAffine,
|
|
1551
1559
|
multiply,
|
|
1552
1560
|
translated,
|
|
1553
1561
|
scaled,
|
|
@@ -5835,32 +5843,32 @@ function drawLayers(layers, data, visibility, order, view, dims, cache7, onLayer
|
|
|
5835
5843
|
}
|
|
5836
5844
|
const groupOf = groupMembership(groups, layerById.keys());
|
|
5837
5845
|
const bracketed = /* @__PURE__ */ new Set();
|
|
5838
|
-
let
|
|
5846
|
+
let run2 = null;
|
|
5839
5847
|
const closeRun = () => {
|
|
5840
|
-
if (!
|
|
5841
|
-
for (const c of wrapGroup(
|
|
5842
|
-
|
|
5848
|
+
if (!run2) return;
|
|
5849
|
+
for (const c of wrapGroup(run2.group, run2.children, v, dims)) out.push(c);
|
|
5850
|
+
run2 = null;
|
|
5843
5851
|
};
|
|
5844
5852
|
for (const layer of sequence) {
|
|
5845
5853
|
if (!isLayerVisible(layer, visibility)) continue;
|
|
5846
5854
|
const cmds = drawOneLayer(layer, data, v, dims, cache7, onLayerError);
|
|
5847
5855
|
if (cmds.length === 0) continue;
|
|
5848
5856
|
const group = groupOf?.get(layer.id);
|
|
5849
|
-
if (
|
|
5857
|
+
if (run2 && run2.group !== group) closeRun();
|
|
5850
5858
|
if (!group) {
|
|
5851
5859
|
for (const c of cmds) out.push(c);
|
|
5852
5860
|
continue;
|
|
5853
5861
|
}
|
|
5854
|
-
if (!
|
|
5862
|
+
if (!run2) {
|
|
5855
5863
|
if (bracketed.has(group)) {
|
|
5856
5864
|
console.warn(
|
|
5857
5865
|
`[weasel] layer group "${group.id}" is not one run \u2014 another layer is drawn between its members, so it composites as more than one pass over more than one buffer. Move its members together in the layer order.`
|
|
5858
5866
|
);
|
|
5859
5867
|
}
|
|
5860
5868
|
bracketed.add(group);
|
|
5861
|
-
|
|
5869
|
+
run2 = { group, children: [] };
|
|
5862
5870
|
}
|
|
5863
|
-
for (const c of cmds)
|
|
5871
|
+
for (const c of cmds) run2.children.push(c);
|
|
5864
5872
|
}
|
|
5865
5873
|
closeRun();
|
|
5866
5874
|
return out;
|
|
@@ -6744,6 +6752,88 @@ function worldPoseLookup(adapter, compose2) {
|
|
|
6744
6752
|
};
|
|
6745
6753
|
}
|
|
6746
6754
|
|
|
6755
|
+
// src/core/scene/poseSnapshot.ts
|
|
6756
|
+
var DEPTH = 4;
|
|
6757
|
+
function isPlainObject(v) {
|
|
6758
|
+
if (typeof v !== "object" || v === null) return false;
|
|
6759
|
+
const proto = Object.getPrototypeOf(v);
|
|
6760
|
+
return proto === Object.prototype || proto === null;
|
|
6761
|
+
}
|
|
6762
|
+
function isTypedArray(v) {
|
|
6763
|
+
return ArrayBuffer.isView(v) && !(v instanceof DataView);
|
|
6764
|
+
}
|
|
6765
|
+
function snapshotPose(value, depth = DEPTH) {
|
|
6766
|
+
if (depth <= 0) return value;
|
|
6767
|
+
if (Array.isArray(value)) {
|
|
6768
|
+
return value.map((v) => snapshotPose(v, depth - 1));
|
|
6769
|
+
}
|
|
6770
|
+
if (isTypedArray(value)) return value.slice();
|
|
6771
|
+
if (isPlainObject(value)) {
|
|
6772
|
+
const out = { ...value };
|
|
6773
|
+
for (const key in out) {
|
|
6774
|
+
const field = out[key];
|
|
6775
|
+
if (typeof field === "object" && field !== null) out[key] = snapshotPose(field, depth - 1);
|
|
6776
|
+
}
|
|
6777
|
+
return out;
|
|
6778
|
+
}
|
|
6779
|
+
return value;
|
|
6780
|
+
}
|
|
6781
|
+
function samePoseValue(snapshot, value, depth = DEPTH) {
|
|
6782
|
+
if (snapshot === value) return true;
|
|
6783
|
+
if (typeof snapshot !== "object" || snapshot === null || typeof value !== "object" || value === null) return Object.is(snapshot, value);
|
|
6784
|
+
if (depth <= 0) return false;
|
|
6785
|
+
const proto = Object.getPrototypeOf(snapshot);
|
|
6786
|
+
if (proto === Object.prototype || proto === null) {
|
|
6787
|
+
const other = Object.getPrototypeOf(value);
|
|
6788
|
+
if (other !== Object.prototype && other !== null) return false;
|
|
6789
|
+
const a = snapshot;
|
|
6790
|
+
const b = value;
|
|
6791
|
+
let count = 0;
|
|
6792
|
+
for (const key in a) {
|
|
6793
|
+
count++;
|
|
6794
|
+
const left = a[key];
|
|
6795
|
+
const right = b[key];
|
|
6796
|
+
if (left === right) {
|
|
6797
|
+
if (right === void 0 && !(key in b)) return false;
|
|
6798
|
+
continue;
|
|
6799
|
+
}
|
|
6800
|
+
if (!samePoseValue(left, right, depth - 1)) return false;
|
|
6801
|
+
}
|
|
6802
|
+
for (const _key in b) if (--count < 0) return false;
|
|
6803
|
+
return true;
|
|
6804
|
+
}
|
|
6805
|
+
if (Array.isArray(snapshot) || isTypedArray(snapshot)) {
|
|
6806
|
+
const a = snapshot;
|
|
6807
|
+
if (!(Array.isArray(value) || isTypedArray(value))) return false;
|
|
6808
|
+
const b = value;
|
|
6809
|
+
if (a.length !== b.length) return false;
|
|
6810
|
+
for (let i = 0; i < a.length; i++) {
|
|
6811
|
+
if (!samePoseValue(a[i], b[i], depth - 1)) return false;
|
|
6812
|
+
}
|
|
6813
|
+
return true;
|
|
6814
|
+
}
|
|
6815
|
+
return false;
|
|
6816
|
+
}
|
|
6817
|
+
|
|
6818
|
+
// src/core/scene/depMemo.ts
|
|
6819
|
+
function recordDeps(into, deps) {
|
|
6820
|
+
into.nodes.length = 0;
|
|
6821
|
+
into.poses.length = 0;
|
|
6822
|
+
for (const dep of deps) {
|
|
6823
|
+
into.nodes.push(dep?.node);
|
|
6824
|
+
into.poses.push(dep === void 0 ? void 0 : snapshotPose(dep.pose));
|
|
6825
|
+
}
|
|
6826
|
+
}
|
|
6827
|
+
function sameDeps2(record, ids, depOf2) {
|
|
6828
|
+
if (record.nodes.length !== ids.length) return false;
|
|
6829
|
+
for (let i = 0; i < ids.length; i++) {
|
|
6830
|
+
const dep = depOf2(ids[i]);
|
|
6831
|
+
if (record.nodes[i] !== (dep === void 0 ? void 0 : dep.node)) return false;
|
|
6832
|
+
if (dep !== void 0 && !samePoseValue(record.poses[i], dep.pose)) return false;
|
|
6833
|
+
}
|
|
6834
|
+
return true;
|
|
6835
|
+
}
|
|
6836
|
+
|
|
6747
6837
|
// src/core/scene/dependents.ts
|
|
6748
6838
|
var NONE = Object.freeze([]);
|
|
6749
6839
|
function dependencyIdsOf(node, childrenOf) {
|
|
@@ -6817,69 +6907,6 @@ function sameDependsOn(a, b) {
|
|
|
6817
6907
|
return true;
|
|
6818
6908
|
}
|
|
6819
6909
|
|
|
6820
|
-
// src/core/scene/poseSnapshot.ts
|
|
6821
|
-
var DEPTH = 4;
|
|
6822
|
-
function isPlainObject(v) {
|
|
6823
|
-
if (typeof v !== "object" || v === null) return false;
|
|
6824
|
-
const proto = Object.getPrototypeOf(v);
|
|
6825
|
-
return proto === Object.prototype || proto === null;
|
|
6826
|
-
}
|
|
6827
|
-
function isTypedArray(v) {
|
|
6828
|
-
return ArrayBuffer.isView(v) && !(v instanceof DataView);
|
|
6829
|
-
}
|
|
6830
|
-
function snapshotPose(value, depth = DEPTH) {
|
|
6831
|
-
if (depth <= 0) return value;
|
|
6832
|
-
if (Array.isArray(value)) {
|
|
6833
|
-
return value.map((v) => snapshotPose(v, depth - 1));
|
|
6834
|
-
}
|
|
6835
|
-
if (isTypedArray(value)) return value.slice();
|
|
6836
|
-
if (isPlainObject(value)) {
|
|
6837
|
-
const out = { ...value };
|
|
6838
|
-
for (const key in out) {
|
|
6839
|
-
const field = out[key];
|
|
6840
|
-
if (typeof field === "object" && field !== null) out[key] = snapshotPose(field, depth - 1);
|
|
6841
|
-
}
|
|
6842
|
-
return out;
|
|
6843
|
-
}
|
|
6844
|
-
return value;
|
|
6845
|
-
}
|
|
6846
|
-
function samePoseValue(snapshot, value, depth = DEPTH) {
|
|
6847
|
-
if (snapshot === value) return true;
|
|
6848
|
-
if (typeof snapshot !== "object" || snapshot === null || typeof value !== "object" || value === null) return Object.is(snapshot, value);
|
|
6849
|
-
if (depth <= 0) return false;
|
|
6850
|
-
const proto = Object.getPrototypeOf(snapshot);
|
|
6851
|
-
if (proto === Object.prototype || proto === null) {
|
|
6852
|
-
const other = Object.getPrototypeOf(value);
|
|
6853
|
-
if (other !== Object.prototype && other !== null) return false;
|
|
6854
|
-
const a = snapshot;
|
|
6855
|
-
const b = value;
|
|
6856
|
-
let count = 0;
|
|
6857
|
-
for (const key in a) {
|
|
6858
|
-
count++;
|
|
6859
|
-
const left = a[key];
|
|
6860
|
-
const right = b[key];
|
|
6861
|
-
if (left === right) {
|
|
6862
|
-
if (right === void 0 && !(key in b)) return false;
|
|
6863
|
-
continue;
|
|
6864
|
-
}
|
|
6865
|
-
if (!samePoseValue(left, right, depth - 1)) return false;
|
|
6866
|
-
}
|
|
6867
|
-
for (const _key in b) if (--count < 0) return false;
|
|
6868
|
-
return true;
|
|
6869
|
-
}
|
|
6870
|
-
if (Array.isArray(snapshot) || isTypedArray(snapshot)) {
|
|
6871
|
-
const a = snapshot;
|
|
6872
|
-
if (!(Array.isArray(value) || isTypedArray(value))) return false;
|
|
6873
|
-
const b = value;
|
|
6874
|
-
if (a.length !== b.length) return false;
|
|
6875
|
-
for (let i = 0; i < a.length; i++) {
|
|
6876
|
-
if (!samePoseValue(a[i], b[i], depth - 1)) return false;
|
|
6877
|
-
}
|
|
6878
|
-
return true;
|
|
6879
|
-
}
|
|
6880
|
-
return false;
|
|
6881
|
-
}
|
|
6882
|
-
|
|
6883
6910
|
// src/core/scene/derivedPath.ts
|
|
6884
6911
|
var SLOT = "kit:derivedPath";
|
|
6885
6912
|
var resolving = /* @__PURE__ */ new Set();
|
|
@@ -6901,7 +6928,7 @@ function resolveDerivedPath(node, depOf2, childrenOf, memoSlot = SLOT) {
|
|
|
6901
6928
|
computed = true;
|
|
6902
6929
|
return draw(node, derivePath, ids.map(depOf2), { nodes: [], poses: [], path: null });
|
|
6903
6930
|
});
|
|
6904
|
-
if (!computed && !
|
|
6931
|
+
if (!computed && !sameDeps2(record, ids, depOf2)) {
|
|
6905
6932
|
draw(node, derivePath, ids.map(depOf2), record);
|
|
6906
6933
|
}
|
|
6907
6934
|
if (cycleHits !== hitsBefore) dropPoseKeyedMemoSlots(node);
|
|
@@ -6912,23 +6939,9 @@ function resolveDerivedPath(node, depOf2, childrenOf, memoSlot = SLOT) {
|
|
|
6912
6939
|
}
|
|
6913
6940
|
function draw(node, derivePath, deps, into) {
|
|
6914
6941
|
into.path = derivePath(node, deps);
|
|
6915
|
-
into
|
|
6916
|
-
into.poses.length = 0;
|
|
6917
|
-
for (const dep of deps) {
|
|
6918
|
-
into.nodes.push(dep?.node);
|
|
6919
|
-
into.poses.push(dep === void 0 ? void 0 : snapshotPose(dep.pose));
|
|
6920
|
-
}
|
|
6942
|
+
recordDeps(into, deps);
|
|
6921
6943
|
return into;
|
|
6922
6944
|
}
|
|
6923
|
-
function matches(record, ids, depOf2) {
|
|
6924
|
-
if (record.nodes.length !== ids.length) return false;
|
|
6925
|
-
for (let i = 0; i < ids.length; i++) {
|
|
6926
|
-
const dep = depOf2(ids[i]);
|
|
6927
|
-
if (record.nodes[i] !== (dep === void 0 ? void 0 : dep.node)) return false;
|
|
6928
|
-
if (dep !== void 0 && !samePoseValue(record.poses[i], dep.pose)) return false;
|
|
6929
|
-
}
|
|
6930
|
-
return true;
|
|
6931
|
-
}
|
|
6932
6945
|
|
|
6933
6946
|
// src/core/scene/effectivePose.ts
|
|
6934
6947
|
var POSE_SLOT = {
|
|
@@ -6956,18 +6969,26 @@ function derivedPoseIn(source, node, reading) {
|
|
|
6956
6969
|
resolving2.add(node.id);
|
|
6957
6970
|
const hitsBefore = cycleHits2;
|
|
6958
6971
|
try {
|
|
6959
|
-
const
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
);
|
|
6972
|
+
const depOf2 = (id) => depIn(source, id, reading);
|
|
6973
|
+
let computed = false;
|
|
6974
|
+
const record = nodeMemo(node, POSE_SLOT[reading], node.pose, () => {
|
|
6975
|
+
computed = true;
|
|
6976
|
+
return run(node, derive, ids.map(depOf2), { nodes: [], poses: [], value: null });
|
|
6977
|
+
});
|
|
6978
|
+
if (!computed && !sameDeps2(record, ids, depOf2)) {
|
|
6979
|
+
run(node, derive, ids.map(depOf2), record);
|
|
6980
|
+
}
|
|
6965
6981
|
if (cycleHits2 !== hitsBefore) dropPoseKeyedMemoSlots(node);
|
|
6966
|
-
return value;
|
|
6982
|
+
return record.value;
|
|
6967
6983
|
} finally {
|
|
6968
6984
|
resolving2.delete(node.id);
|
|
6969
6985
|
}
|
|
6970
6986
|
}
|
|
6987
|
+
function run(node, derive, deps, into) {
|
|
6988
|
+
into.value = derive(node, deps);
|
|
6989
|
+
recordDeps(into, deps);
|
|
6990
|
+
return into;
|
|
6991
|
+
}
|
|
6971
6992
|
function derivedDepOf(source, id) {
|
|
6972
6993
|
return depIn(source, id, "effective");
|
|
6973
6994
|
}
|
|
@@ -9618,6 +9639,14 @@ function createVelocityTracker() {
|
|
|
9618
9639
|
}
|
|
9619
9640
|
|
|
9620
9641
|
// src/interactions/actions/defaults/viewportDragPan.ts
|
|
9642
|
+
function screenDeltaFromWorld(drag, scratch) {
|
|
9643
|
+
const v0 = scratch.startView;
|
|
9644
|
+
const now = scratch.view.get();
|
|
9645
|
+
return {
|
|
9646
|
+
x: (drag.current.x - now.x - (drag.start.x - v0.x)) * v0.scale.x,
|
|
9647
|
+
y: (drag.current.y - now.y - (drag.start.y - v0.y)) * v0.scale.y
|
|
9648
|
+
};
|
|
9649
|
+
}
|
|
9621
9650
|
var viewportDragPanAction = {
|
|
9622
9651
|
id: "viewport.dragPan",
|
|
9623
9652
|
label: "Drag to pan viewport",
|
|
@@ -9655,7 +9684,7 @@ var viewportDragPanAction = {
|
|
|
9655
9684
|
kind: "pan",
|
|
9656
9685
|
onMove(moveCtx) {
|
|
9657
9686
|
if (!moveCtx.drag) return;
|
|
9658
|
-
const screen = moveCtx.drag.screenDelta ?? moveCtx.drag
|
|
9687
|
+
const screen = moveCtx.drag.screenDelta ?? screenDeltaFromWorld(moveCtx.drag, scratch);
|
|
9659
9688
|
const screenDx = scratch.axis === "y" ? 0 : screen.x;
|
|
9660
9689
|
const screenDy = scratch.axis === "x" ? 0 : screen.y;
|
|
9661
9690
|
if (scratch.tracker) {
|
|
@@ -14890,22 +14919,34 @@ function useKeybindings(tools, options = {}) {
|
|
|
14890
14919
|
|
|
14891
14920
|
// src/tools/prefs.ts
|
|
14892
14921
|
function prefUnit(system, display, opts) {
|
|
14893
|
-
|
|
14894
|
-
|
|
14895
|
-
|
|
14896
|
-
|
|
14897
|
-
|
|
14898
|
-
);
|
|
14922
|
+
let self;
|
|
14923
|
+
try {
|
|
14924
|
+
self = unitScale(system, display);
|
|
14925
|
+
} catch (e) {
|
|
14926
|
+
throw new Error(`prefUnit: ${e instanceof Error ? e.message : String(e)}`);
|
|
14899
14927
|
}
|
|
14900
14928
|
const scale = opts?.precision === void 0 ? void 0 : 10 ** opts.precision;
|
|
14901
14929
|
const suffix = opts?.suffix ?? display;
|
|
14902
14930
|
const accepts = { [suffix]: 1 };
|
|
14903
|
-
for (const
|
|
14931
|
+
for (const name of Object.keys(system.units)) {
|
|
14932
|
+
const other = unitScale(system, name);
|
|
14933
|
+
const factor = other.factor / self.factor;
|
|
14934
|
+
const offset = (other.offset - self.offset) / self.factor;
|
|
14935
|
+
accepts[name] = offset === 0 ? factor : { factor, offset };
|
|
14936
|
+
}
|
|
14937
|
+
const toDisplay = (stored) => {
|
|
14938
|
+
const shown = (stored - self.offset) / self.factor;
|
|
14939
|
+
return scale === void 0 ? shown : Math.round(shown * scale) / scale;
|
|
14940
|
+
};
|
|
14904
14941
|
return {
|
|
14905
|
-
toDisplay
|
|
14906
|
-
fromDisplay: (shown) => shown * factor,
|
|
14942
|
+
toDisplay,
|
|
14943
|
+
fromDisplay: (shown) => shown * self.factor + self.offset,
|
|
14907
14944
|
suffix,
|
|
14908
|
-
accepts
|
|
14945
|
+
accepts,
|
|
14946
|
+
format: (stored) => `${formatUnit(stored, display, system, {
|
|
14947
|
+
precision: opts?.precision ?? 2,
|
|
14948
|
+
suffix: false
|
|
14949
|
+
})}${suffix}`
|
|
14909
14950
|
};
|
|
14910
14951
|
}
|
|
14911
14952
|
var TOOL_PREF_KINDS = {
|
|
@@ -16683,6 +16724,84 @@ function useTextTool() {
|
|
|
16683
16724
|
[]
|
|
16684
16725
|
);
|
|
16685
16726
|
}
|
|
16727
|
+
var PERCENT = {
|
|
16728
|
+
toDisplay: (v) => Math.round(v * 1e3) / 10,
|
|
16729
|
+
// Rounded rather than divided: 33.3 / 100 is 0.33299999999999996, and that
|
|
16730
|
+
// dust would be written into the document and shown back on the next read.
|
|
16731
|
+
fromDisplay: (v) => Math.round(v * 1e3) / 1e5,
|
|
16732
|
+
suffix: "%"
|
|
16733
|
+
};
|
|
16734
|
+
var flag = (name, icon) => ({
|
|
16735
|
+
kind: "boolean",
|
|
16736
|
+
name,
|
|
16737
|
+
description: `${name} for the characters in the range.`,
|
|
16738
|
+
icon,
|
|
16739
|
+
control: "toggle",
|
|
16740
|
+
pair: "Character style",
|
|
16741
|
+
default: false
|
|
16742
|
+
});
|
|
16743
|
+
useTextTool.options = {
|
|
16744
|
+
name: "Text",
|
|
16745
|
+
description: "Character styling for the selected range.",
|
|
16746
|
+
children: {
|
|
16747
|
+
bold: flag("Bold", "bold"),
|
|
16748
|
+
italic: flag("Italic", "italic"),
|
|
16749
|
+
underline: flag("Underline", "underline"),
|
|
16750
|
+
strikethrough: flag("Strikethrough", "strikethrough"),
|
|
16751
|
+
overline: flag("Overline", "overline"),
|
|
16752
|
+
// Its own kind rather than an enum: the two values are exclusive *and*
|
|
16753
|
+
// absent is a third state an enum cannot name, so clicking the lit
|
|
16754
|
+
// segment has to clear it. The host draws it and owns that rule.
|
|
16755
|
+
script: {
|
|
16756
|
+
kind: "script",
|
|
16757
|
+
name: "Script",
|
|
16758
|
+
description: "Raise or lower the range off the baseline, at a smaller size.",
|
|
16759
|
+
default: void 0
|
|
16760
|
+
},
|
|
16761
|
+
fontFamily: {
|
|
16762
|
+
kind: "font-family",
|
|
16763
|
+
name: "Font",
|
|
16764
|
+
description: "Typeface for the range.",
|
|
16765
|
+
default: void 0
|
|
16766
|
+
},
|
|
16767
|
+
fontSize: { kind: "number", name: "Size", description: "Type size.", min: 1, step: 1, default: 16 },
|
|
16768
|
+
letterSpacing: {
|
|
16769
|
+
kind: "number",
|
|
16770
|
+
name: "Tracking",
|
|
16771
|
+
// The typographic term, short enough for a strip; `name` stays the
|
|
16772
|
+
// accessible one.
|
|
16773
|
+
short: "VA",
|
|
16774
|
+
description: "Space added between characters.",
|
|
16775
|
+
step: 0.1,
|
|
16776
|
+
default: 0
|
|
16777
|
+
},
|
|
16778
|
+
baselineShift: {
|
|
16779
|
+
kind: "number",
|
|
16780
|
+
name: "Baseline shift",
|
|
16781
|
+
short: "Shift",
|
|
16782
|
+
description: "Raise or lower the range, in ems of the inherited size.",
|
|
16783
|
+
step: 1e-3,
|
|
16784
|
+
unit: PERCENT,
|
|
16785
|
+
default: 0
|
|
16786
|
+
},
|
|
16787
|
+
fontScale: {
|
|
16788
|
+
kind: "number",
|
|
16789
|
+
name: "Scale",
|
|
16790
|
+
description: "Size of the range against the inherited size.",
|
|
16791
|
+
min: 0.01,
|
|
16792
|
+
step: 1e-3,
|
|
16793
|
+
unit: PERCENT,
|
|
16794
|
+
default: 1
|
|
16795
|
+
},
|
|
16796
|
+
fill: {
|
|
16797
|
+
kind: "color",
|
|
16798
|
+
name: "Color",
|
|
16799
|
+
description: "Ink for the range.",
|
|
16800
|
+
alpha: true,
|
|
16801
|
+
default: "#000000"
|
|
16802
|
+
}
|
|
16803
|
+
}
|
|
16804
|
+
};
|
|
16686
16805
|
|
|
16687
16806
|
// src/features/paths/nearestAnchor.ts
|
|
16688
16807
|
function nearestPathAnchor(paths, point, px, scale, accept) {
|
|
@@ -27336,20 +27455,20 @@ function styleEquals(a, b) {
|
|
|
27336
27455
|
return a.bold === b.bold && a.italic === b.italic && a.underline === b.underline && a.strikethrough === b.strikethrough && a.overline === b.overline && a.fontSize === b.fontSize && a.fontFamily === b.fontFamily && a.color === b.color && a.letterSpacing === b.letterSpacing && a.script === b.script && a.baselineShift === b.baselineShift && a.fontScale === b.fontScale;
|
|
27337
27456
|
}
|
|
27338
27457
|
function toRun(text, style) {
|
|
27339
|
-
const
|
|
27340
|
-
if (style.bold)
|
|
27341
|
-
if (style.italic)
|
|
27342
|
-
if (style.fontSize != null)
|
|
27343
|
-
if (style.fontFamily != null)
|
|
27344
|
-
if (style.color != null)
|
|
27345
|
-
if (style.letterSpacing != null)
|
|
27346
|
-
if (style.underline)
|
|
27347
|
-
if (style.strikethrough)
|
|
27348
|
-
if (style.overline)
|
|
27349
|
-
if (style.script != null)
|
|
27350
|
-
if (style.baselineShift != null)
|
|
27351
|
-
if (style.fontScale != null)
|
|
27352
|
-
return
|
|
27458
|
+
const run2 = { text };
|
|
27459
|
+
if (style.bold) run2.bold = true;
|
|
27460
|
+
if (style.italic) run2.italic = true;
|
|
27461
|
+
if (style.fontSize != null) run2.fontSize = style.fontSize;
|
|
27462
|
+
if (style.fontFamily != null) run2.fontFamily = style.fontFamily;
|
|
27463
|
+
if (style.color != null) run2.fill = { fill: "solid", color: style.color };
|
|
27464
|
+
if (style.letterSpacing != null) run2.letterSpacing = style.letterSpacing;
|
|
27465
|
+
if (style.underline) run2.underline = true;
|
|
27466
|
+
if (style.strikethrough) run2.strikethrough = true;
|
|
27467
|
+
if (style.overline) run2.overline = true;
|
|
27468
|
+
if (style.script != null) run2.script = style.script;
|
|
27469
|
+
if (style.baselineShift != null) run2.baselineShift = style.baselineShift;
|
|
27470
|
+
if (style.fontScale != null) run2.fontScale = style.fontScale;
|
|
27471
|
+
return run2;
|
|
27353
27472
|
}
|
|
27354
27473
|
function domToRuns(parent) {
|
|
27355
27474
|
const fragments = [];
|
|
@@ -27391,27 +27510,27 @@ function domToRuns(parent) {
|
|
|
27391
27510
|
}
|
|
27392
27511
|
function runsToDom(runs, parent) {
|
|
27393
27512
|
parent.replaceChildren();
|
|
27394
|
-
for (const
|
|
27513
|
+
for (const run2 of runs) {
|
|
27395
27514
|
const span = document.createElement("span");
|
|
27396
27515
|
span.setAttribute("data-run", "");
|
|
27397
|
-
span.textContent =
|
|
27398
|
-
if (
|
|
27399
|
-
if (
|
|
27400
|
-
if (
|
|
27401
|
-
else if (
|
|
27402
|
-
if (
|
|
27403
|
-
const color = solidColor(
|
|
27516
|
+
span.textContent = run2.text;
|
|
27517
|
+
if (run2.bold) span.style.fontWeight = "700";
|
|
27518
|
+
if (run2.italic) span.style.fontStyle = "italic";
|
|
27519
|
+
if (run2.fontSize != null) span.style.fontSize = `${run2.fontSize}px`;
|
|
27520
|
+
else if (run2.fontScale != null) span.style.fontSize = `${run2.fontScale * 100}%`;
|
|
27521
|
+
if (run2.fontFamily != null) span.style.fontFamily = run2.fontFamily;
|
|
27522
|
+
const color = solidColor(run2.fill);
|
|
27404
27523
|
if (color != null) span.style.color = color;
|
|
27405
27524
|
const decorations = [];
|
|
27406
|
-
if (
|
|
27407
|
-
if (
|
|
27408
|
-
if (
|
|
27525
|
+
if (run2.underline) decorations.push("underline");
|
|
27526
|
+
if (run2.strikethrough) decorations.push("line-through");
|
|
27527
|
+
if (run2.overline) decorations.push("overline");
|
|
27409
27528
|
if (decorations.length > 0) span.style.textDecoration = decorations.join(" ");
|
|
27410
|
-
if (
|
|
27411
|
-
if (
|
|
27412
|
-
span.setAttribute("data-baseline-shift", String(
|
|
27529
|
+
if (run2.script != null) span.style.verticalAlign = run2.script;
|
|
27530
|
+
if (run2.baselineShift != null) {
|
|
27531
|
+
span.setAttribute("data-baseline-shift", String(run2.baselineShift));
|
|
27413
27532
|
}
|
|
27414
|
-
if (
|
|
27533
|
+
if (run2.letterSpacing != null) span.style.letterSpacing = `${run2.letterSpacing}px`;
|
|
27415
27534
|
parent.appendChild(span);
|
|
27416
27535
|
}
|
|
27417
27536
|
}
|
|
@@ -27495,8 +27614,8 @@ function deepEqual(a, b) {
|
|
|
27495
27614
|
}
|
|
27496
27615
|
return false;
|
|
27497
27616
|
}
|
|
27498
|
-
function valueAt(
|
|
27499
|
-
const value =
|
|
27617
|
+
function valueAt(run2, key) {
|
|
27618
|
+
const value = run2[key];
|
|
27500
27619
|
if (FLAG_KEYS.has(key)) return value ?? false;
|
|
27501
27620
|
return value;
|
|
27502
27621
|
}
|
|
@@ -27509,7 +27628,7 @@ function sameStyle(a, b) {
|
|
|
27509
27628
|
}
|
|
27510
27629
|
function totalLength(runs) {
|
|
27511
27630
|
let n = 0;
|
|
27512
|
-
for (const
|
|
27631
|
+
for (const run2 of runs) n += run2.text.length;
|
|
27513
27632
|
return n;
|
|
27514
27633
|
}
|
|
27515
27634
|
function styleAtRange(runs, start, end) {
|
|
@@ -27520,14 +27639,14 @@ function styleAtRange(runs, start, end) {
|
|
|
27520
27639
|
const mixed = /* @__PURE__ */ new Set();
|
|
27521
27640
|
let seen = false;
|
|
27522
27641
|
let pos = 0;
|
|
27523
|
-
for (const
|
|
27524
|
-
const runEnd = pos +
|
|
27642
|
+
for (const run2 of runs) {
|
|
27643
|
+
const runEnd = pos + run2.text.length;
|
|
27525
27644
|
const a = Math.max(pos, lo);
|
|
27526
27645
|
const b = Math.min(runEnd, hi);
|
|
27527
27646
|
pos = runEnd;
|
|
27528
27647
|
if (!(a < b)) continue;
|
|
27529
27648
|
for (const key of STYLE_KEYS) {
|
|
27530
|
-
const value = valueAt(
|
|
27649
|
+
const value = valueAt(run2, key);
|
|
27531
27650
|
if (!seen) first.set(key, value);
|
|
27532
27651
|
else if (!mixed.has(key) && !sameValue(key, first.get(key), value)) {
|
|
27533
27652
|
mixed.add(key);
|
|
@@ -27548,14 +27667,14 @@ function styleAtRange(runs, start, end) {
|
|
|
27548
27667
|
}
|
|
27549
27668
|
function runsCarryStyling(runs) {
|
|
27550
27669
|
return runs.some(
|
|
27551
|
-
(
|
|
27552
|
-
const value =
|
|
27670
|
+
(run2) => STYLE_KEYS.some((key) => {
|
|
27671
|
+
const value = run2[key];
|
|
27553
27672
|
return value !== void 0 && value !== false;
|
|
27554
27673
|
})
|
|
27555
27674
|
);
|
|
27556
27675
|
}
|
|
27557
|
-
function patchRun(
|
|
27558
|
-
const next = { ...
|
|
27676
|
+
function patchRun(run2, patch) {
|
|
27677
|
+
const next = { ...run2 };
|
|
27559
27678
|
for (const key of STYLE_KEYS) {
|
|
27560
27679
|
if (!(key in patch)) continue;
|
|
27561
27680
|
const value = patch[key];
|
|
@@ -27566,11 +27685,11 @@ function patchRun(run, patch) {
|
|
|
27566
27685
|
}
|
|
27567
27686
|
function coalesceRuns(runs) {
|
|
27568
27687
|
const out = [];
|
|
27569
|
-
for (const
|
|
27570
|
-
if (
|
|
27688
|
+
for (const run2 of runs) {
|
|
27689
|
+
if (run2.text.length === 0) continue;
|
|
27571
27690
|
const prev = out[out.length - 1];
|
|
27572
|
-
if (prev && sameStyle(prev,
|
|
27573
|
-
else out.push({ ...
|
|
27691
|
+
if (prev && sameStyle(prev, run2)) prev.text += run2.text;
|
|
27692
|
+
else out.push({ ...run2 });
|
|
27574
27693
|
}
|
|
27575
27694
|
return out;
|
|
27576
27695
|
}
|
|
@@ -27580,16 +27699,16 @@ function applyStyleToRange(runs, start, end, patch) {
|
|
|
27580
27699
|
if (!(lo < hi)) return coalesceRuns(runs);
|
|
27581
27700
|
const out = [];
|
|
27582
27701
|
let pos = 0;
|
|
27583
|
-
for (const
|
|
27584
|
-
const runEnd = pos +
|
|
27702
|
+
for (const run2 of runs) {
|
|
27703
|
+
const runEnd = pos + run2.text.length;
|
|
27585
27704
|
const a = Math.max(pos, lo);
|
|
27586
27705
|
const b = Math.min(runEnd, hi);
|
|
27587
27706
|
if (a < b) {
|
|
27588
|
-
if (pos < a) out.push({ ...
|
|
27589
|
-
out.push(patchRun({ ...
|
|
27590
|
-
if (b < runEnd) out.push({ ...
|
|
27707
|
+
if (pos < a) out.push({ ...run2, text: run2.text.slice(0, a - pos) });
|
|
27708
|
+
out.push(patchRun({ ...run2, text: run2.text.slice(a - pos, b - pos) }, patch));
|
|
27709
|
+
if (b < runEnd) out.push({ ...run2, text: run2.text.slice(b - pos) });
|
|
27591
27710
|
} else {
|
|
27592
|
-
out.push({ ...
|
|
27711
|
+
out.push({ ...run2 });
|
|
27593
27712
|
}
|
|
27594
27713
|
pos = runEnd;
|
|
27595
27714
|
}
|
|
@@ -27685,7 +27804,7 @@ function patchForToggle(current, toggle, nodeStyle) {
|
|
|
27685
27804
|
function styleAtCaret(runs, at) {
|
|
27686
27805
|
return at > 0 ? styleAtRange(runs, at - 1, at) : styleAtRange(runs, 0, 1);
|
|
27687
27806
|
}
|
|
27688
|
-
function spliceRunAt(runs, at,
|
|
27807
|
+
function spliceRunAt(runs, at, run2) {
|
|
27689
27808
|
const out = [];
|
|
27690
27809
|
let pos = 0;
|
|
27691
27810
|
let placed2 = false;
|
|
@@ -27694,7 +27813,7 @@ function spliceRunAt(runs, at, run) {
|
|
|
27694
27813
|
if (!placed2 && at <= end) {
|
|
27695
27814
|
const k = at - pos;
|
|
27696
27815
|
if (k > 0) out.push({ ...r, text: r.text.slice(0, k) });
|
|
27697
|
-
out.push(
|
|
27816
|
+
out.push(run2);
|
|
27698
27817
|
if (k < r.text.length) out.push({ ...r, text: r.text.slice(k) });
|
|
27699
27818
|
placed2 = true;
|
|
27700
27819
|
} else {
|
|
@@ -27702,7 +27821,7 @@ function spliceRunAt(runs, at, run) {
|
|
|
27702
27821
|
}
|
|
27703
27822
|
pos = end;
|
|
27704
27823
|
}
|
|
27705
|
-
if (!placed2) out.push(
|
|
27824
|
+
if (!placed2) out.push(run2);
|
|
27706
27825
|
return applyStyleToRange(out, 0, 0, {});
|
|
27707
27826
|
}
|
|
27708
27827
|
function restoreOverlayFocus(overlay, range) {
|
|
@@ -28326,8 +28445,8 @@ function effectiveRangeStyle(range, style, paint) {
|
|
|
28326
28445
|
if (resolved.fill !== null) out.fill = resolved.fill;
|
|
28327
28446
|
for (const key of FLAGS) {
|
|
28328
28447
|
const on = nodeHasFlag(node, key);
|
|
28329
|
-
const
|
|
28330
|
-
out[key] = on ||
|
|
28448
|
+
const run2 = range?.[key];
|
|
28449
|
+
out[key] = on || run2 === void 0 ? on : run2;
|
|
28331
28450
|
}
|
|
28332
28451
|
if (range === null) return out;
|
|
28333
28452
|
for (const key of OVERRIDES) {
|
|
@@ -28567,7 +28686,7 @@ function asMesh(fill) {
|
|
|
28567
28686
|
}
|
|
28568
28687
|
function shifted(color, dL, cScale, dHueDeg) {
|
|
28569
28688
|
const [r, g, b, a] = resolveColor(color);
|
|
28570
|
-
const [L, A, B] =
|
|
28689
|
+
const [L, A, B] = srgbFloatToOklab(r, g, b);
|
|
28571
28690
|
const [, C, h] = oklabToOklch(L, A, B);
|
|
28572
28691
|
const [nL, nA, nB] = oklchToOklab(
|
|
28573
28692
|
Math.min(1, Math.max(0, L + dL)),
|
|
@@ -30541,19 +30660,19 @@ var isDev2 = typeof import.meta !== "undefined" && import.meta.env?.DEV;
|
|
|
30541
30660
|
function useBooleans(adapter, _options = {}) {
|
|
30542
30661
|
const adapterRef = useRef(adapter);
|
|
30543
30662
|
adapterRef.current = adapter;
|
|
30544
|
-
const
|
|
30663
|
+
const run2 = useCallback((op) => {
|
|
30545
30664
|
const result = applyBooleanOp(adapterRef.current, op);
|
|
30546
30665
|
if (isDev2 && result.kind === "noop" && result.reason === "too-few-for-subtract") {
|
|
30547
30666
|
console.warn("[useBooleans] subtract requires at least 2 selected paths");
|
|
30548
30667
|
}
|
|
30549
30668
|
}, []);
|
|
30550
30669
|
return {
|
|
30551
|
-
union: useCallback(() =>
|
|
30552
|
-
intersect: useCallback(() =>
|
|
30553
|
-
subtract: useCallback(() =>
|
|
30554
|
-
exclude: useCallback(() =>
|
|
30555
|
-
divide: useCallback(() =>
|
|
30556
|
-
crop: useCallback(() =>
|
|
30670
|
+
union: useCallback(() => run2("union"), [run2]),
|
|
30671
|
+
intersect: useCallback(() => run2("intersect"), [run2]),
|
|
30672
|
+
subtract: useCallback(() => run2("subtract"), [run2]),
|
|
30673
|
+
exclude: useCallback(() => run2("exclude"), [run2]),
|
|
30674
|
+
divide: useCallback(() => run2("divide"), [run2]),
|
|
30675
|
+
crop: useCallback(() => run2("crop"), [run2])
|
|
30557
30676
|
};
|
|
30558
30677
|
}
|
|
30559
30678
|
function useBooleansAdapter(adapter) {
|
|
@@ -31244,9 +31363,6 @@ function cellRectAt(bounds, cols, rows, gap, col, row) {
|
|
|
31244
31363
|
height: ch
|
|
31245
31364
|
};
|
|
31246
31365
|
}
|
|
31247
|
-
function sortedChildIds(children) {
|
|
31248
|
-
return children.map((c) => c.id).sort();
|
|
31249
|
-
}
|
|
31250
31366
|
function tileGrid(opts) {
|
|
31251
31367
|
const { cols, rows } = opts;
|
|
31252
31368
|
const gap = opts.gap ?? 0;
|
|
@@ -31297,12 +31413,18 @@ function tileGrid(opts) {
|
|
|
31297
31413
|
snap: snap2,
|
|
31298
31414
|
childPoses(container, children) {
|
|
31299
31415
|
const out = /* @__PURE__ */ new Map();
|
|
31300
|
-
const
|
|
31301
|
-
|
|
31302
|
-
|
|
31416
|
+
const ordered = children.map((c) => ({ c, cell: cellIndexOf(container.bounds, c.pose) })).sort((a, b) => {
|
|
31417
|
+
if (a.cell !== b.cell) {
|
|
31418
|
+
if (a.cell === null) return 1;
|
|
31419
|
+
if (b.cell === null) return -1;
|
|
31420
|
+
return a.cell - b.cell;
|
|
31421
|
+
}
|
|
31422
|
+
return a.c.id < b.c.id ? -1 : a.c.id > b.c.id ? 1 : 0;
|
|
31423
|
+
});
|
|
31424
|
+
for (let i = 0; i < ordered.length && i < capacity; i++) {
|
|
31303
31425
|
const col = i % cols;
|
|
31304
31426
|
const row = Math.floor(i / cols);
|
|
31305
|
-
out.set(
|
|
31427
|
+
out.set(ordered[i].c.id, cellPose(container.bounds, col, row, ordered[i].c.pose));
|
|
31306
31428
|
}
|
|
31307
31429
|
return out;
|
|
31308
31430
|
},
|
|
@@ -31439,5 +31561,5 @@ function snapPoint(opts) {
|
|
|
31439
31561
|
}
|
|
31440
31562
|
|
|
31441
31563
|
export { ANCHOR_HIT_BASE_PX, ActionsProviderIfRoot, ArrowIcon, BUILTIN_MARKERS, BUNDLE_TOOLS, CURVE_REPS, CanvasView, ColorOverrideRegistry, CropIcon, CursorCoordsHud, DEFAULT_DEBUG_STROKES, DEFAULT_DEBUG_THEME, DEFAULT_FILL_COLOR, DEFAULT_HANDLE_SIZE2 as DEFAULT_HANDLE_SIZE, DEFAULT_MAX_ZOOM, DEFAULT_MIN_ZOOM, DEFAULT_PALETTE, DEFAULT_ROTATION_HANDLE_DISTANCE, DEFAULT_SHAPE_FILL, DEFAULT_STROKE_COLOR, DepRegistryProviderIfRoot, DeviceProfileProvider, DivideIcon, EASINGS, EFFECT_KIT_UNIFORMS, EFFECT_VERT_SRC, EllipseIcon, ExcludeIcon, EyedropperIcon, FALLBACK_FIT_VIEW, GHOST_STROKE, HANDLE_BASE_PX, HandIcon, IDENTITY_COLOR_MATRIX, IDENTITY_JOINT, IDENTITY_POSE_COMPOSITION, ImageIcon, IntersectIcon, KIT_SHAPE_KINDS, KIT_STANDARD_ACTION_IDS, LassoIcon, LineIcon, MESH_BAKE_SIZE, MESH_GRADIENT_KIND, MIXED, MOVE_ANCHORS, MinimapCanvas, OUTLINE_MIN_SCREEN_PX, PAINTED_CURSOR_LAYER_ID, PATH_ANCHOR_CHROME_ID, PenIcon, PencilIcon, PickHud, PointerProviderIfRoot, PolygonIcon, RECT_POSE_COMPOSITION, RIGID_POSE_COMPOSITION, ROTATION_HANDLE_BASE_PX, RectIcon, SPRING_PRESETS, SPRITE_STRIDE, SceneCanvas, SceneViewCanvas, SelectIcon, SelectionContextProvider, SelectionContextProviderIfRoot, ShaderCompileError, StarIcon, SubtractIcon, TOOL_PREF_KINDS, TextIcon, UNION_OF_CHILDREN, UnionIcon, UnknownIcon, VERSION, VIEW_ANIMATION_KEY, WHEEL_ZOOM_STEP, WeaselProvider, WeaselRenderer, ZOOM_FLOOR, _resetMarkersForTests, _resetPaintKindsForTests, actionIs, actionShortcuts, alignDeltaFor, alignInsertBehavior, alignMoveBehavior, alignResizeBehavior, always, and, animateLifecycle, animateOnSetPose, annulusSemiAxes, applyBooleanOp, applyStyleToRange, areaSelectAction, arrayAdapter, asNodeId, asPaint, bakeMesh, bezierCubic, bezierQuadratic, bindRig, blendPoses, blur, buildChromeCtx, buildGradientRamp, buildSceneViewCommands, canBringForward, canHover, canSendBackward, capabilityAll, capabilityIn, capabilityIs, capabilityNot, caretIndexAt, cellAt, charOffsetToDomPosition, circlePath, clampView, clearSelectionAction, clipboardCopyAction, clipboardCutAction, cloneAction, coarsePointer, composeAffordanceLayer, composePath, composeRectPose, composeRigidPose, composeSelectionPose, composeWorldPose, computeFitView, computeFitViewport, computeIndicatorCommand, computeWheelAction, cond, constrainTo45, containedThenNearest, cornerWeights, countPathAnchors, createCellHighlightLayer, createChildrenLayer, createCornerResizeAffordance, createDebugOverlayLayer, createDebugSink, createGridLayer, createGuidesLayer, createHistory2 as createHistory, createKeyState, createMoveToIndexOp, createNodeProperties, createNodeRouting, createPaintedCursorLayer, createParallaxLayer, createPathAnchorAffordances, createPathEditingOverlayLayer, createPathLayer, createPenPreviewLayer, createPoseFeed, createPoseOverrides, createReorderOp, createRotationAffordance, createScene, createSelectionHandlesLayer, createSelectionOutlineLayer, createSelectionOverlayLayer, createSetDataOp, createSetLayerOp, createSetPathOp, createSetTextOp, createSlew, createTextLayer, createTiledLayer, createVelocityTracker, createViewResolver, createViewportLayer, cubicBezierEasing, cullDrawCommands, cycleVertexColors, decomposePath, decomposeRectPose, decomposeRigidPose, defaultCommitAdapter, defaultDrawOne, defaultLabelTextRenderer, defaultNodeProperties, defaultNodeRouting, defaultVisibilityRules, defineTool, defineViewportTool, deriveAlignmentGuides, deriveParallaxView, derivedDepOf, derivedPose, documentPose, domPositionToCharOffset, domToRuns, drawLayers, drawOneLayer, easeIn, easeInBack, easeInBounce, easeInCirc, easeInCubic, easeInElastic, easeInExpo, easeInOut, easeInOutBack, easeInOutBounce, easeInOutCirc, easeInOutCubic, easeInOutElastic, easeInOutExpo, easeInOutQuad, easeInOutQuart, easeInOutQuint, easeInOutSine, easeInQuad, easeInQuart, easeInQuint, easeInSine, easeOut, easeOutBack, easeOutBounce, easeOutCirc, easeOutCubic, easeOutElastic, easeOutExpo, easeOutQuad, easeOutQuart, easeOutQuint, easeOutSine, editAnchorsAction, effectivePose, effectiveRangeStyle, enterTextEditAction, enumerateAnchors, evalPatch, fillInPoseFrame, fillToBoundsFrame, findNodeShape, findShapeInk, findShapeSilhouette, fitTextPose, fitToBounds, fitViewToBounds, fitZoom, flattenPreviews, focused, forEachCoalesced, frameRect, freeform, gateLayer, gesturing, getAlpha01, getImageBitmap, getMarker, getNodeShapes, getPaintKind, getStylusData, gradientForBounds, gradientGeometry, hexToRgba, hitAffordanceRegions, hitAnchor, hitRotationHandle, hostAnchorCss, hostAnchorRect, hovering, hoveringSelected, imageStatus, inferredNodeProperties, inferredNodeRouting, insertAction, insertPreviewExtent, interpolateView, isBuiltinToolPref, isGradientFill, isLayerPainted, isLayerVisible, isMeshGradientFill, isPatternSpec, isTensorPatch, isValidPatch, keySpecShortcut, lassoSelectAction, linear, listMarkers, listPaintKinds, makePinchZoomAction, makeViewportWheelPanAction, makeViewportZoomAction, markerDrawCommands, markerInset, markerKeyOf, markerSites, mat3, matchAlignment, meanScale, mergeAlphaFromPrev, meshBounds, meshGradientXml, modeIn, modeIs, modeNot, modifierHeld, momentum, moveAction, multiActive, nearest, nearestWithin, nestedHitTester, never, nodeHasFlag, none, normalizeHex, normalizeView, normalizeZoom, not, nurbs, openFilePicker, or, paintAlpha, paintKindOf, paintWithAlpha, paintWithColor, parseColor, parseColorToRgba255, parseDebugFlags, patchBounds, patchCorner, pathContainsPoint, pathContainsPolygon, pathContainsRect, pathDistanceToPoint, pathDivide, pathExclude, pathFromD, pathInPoseFrame, pathInWorld, pathIntersect, pathIntersectsPolygon, pathIntersectsRect, pathOriginProjection, pathSubtract, pathToAnchors, pathUnion, pickTopMostHit, pinchZoomAction, planPixelRender, pointInTextPose, poseRotationOf, prefUnit, pressureToWidth, rainbowVertexColors, rebaseLocalPose, rectMarkerPath, registerContentHandler, registerEffect, registerMarker, registerNodeShape, registerPaintKind, registerProgram, renderLabel, renderSceneToCanvas, renderSceneToPixels, resizeAction, resolveColor, resolveEasing, resolveFillPattern, resolveMarkerSize, resolveOverlays, resolvePatternSpec, resolvePreviews, resolveSkeleton, resolveStrokeWidth, resolveVisibility, rgbaToHex, rigidRigApply, rotateAction, rotateAroundAABBCenter, rotatePathAround, rotationDegreesUnit, rotationHandle, roundRectPath, roundToCell, runsToDom, sampleGradientStops, sampleTrack, sceneFromJSON, sceneNodeClientRect, sceneSelectionStore, sceneToAdapter, screenToWorld, seedMeshPatch, selectFromLasso, selectionAtLeast, selectionEmpty, selectionIs, setFlagOverRange, shapeCoversPoint, slewToward, sliceAction, snapPoint, solid, solidVertexColors, spiro, splitPathByLine, splitSubpaths, springPose, springVertexColors, squarePath, staggerVertexColors, startThresholdDrag, strokeInsets, strokeOf, strokeWith, styleAtRange, subscribeImageReady, tessellate, tessellateStroke, textCommand, textCommandFromPose, textCommandFromRuns, tileGrid, tiledProject, toHex8, translateRectPose, trimPolyline, tweenPose, tweenVertexColors, unionBoundsPath, unionOfChildren, unionOfChildrenVia, useAlign, useAnimator, useArrayAdapter, useAutoCenter, useBooleans, useBooleansAdapter, useCanvasFocus, useCanvasSize, useDecayLoop, useDeviceProfile, useDistribute, useDragGesture, useDragHandle, useDragRadial, useDragRect, useDropZone, useEllipseTool, useEyedropperTool, useGridCellHover, useGuides, useHandTool, useHandleDrag, useHostAnchor, useHoverTracking, useImageTool, useKeyState, useKeybindings, useLassoTool, useLineTool, useNodeOverlayFrame, usePenTool, usePencilTool, usePinchGesture, usePointerStylus, usePolygonTool, usePoseCompositionDepSource, usePoseDescriptorDepSource, usePoseRun, usePublishSelection, useRectTool, useResizePolicy, useRig, useScene, useSceneAdapter, useSceneTextEdit, useSelectTool, useSelection, useSelectionContext, useSimulation, useSliceDep, useStandardActions, useStarTool, useTextEdit, useTextTool, useTools, useVelocityTracker, useViewAnimation, useViewAnimationOn, useVisibleRaf, viewToMat3, viewToTransform, viewZoom, viewportDragPanAction, viewportWheelPanAction, viewportZoomAction, viewportsAt, vignette, wheelPan, wheelZoom, wheelZoomFactor, when, withAlpha01, withCoord, withGradientKind, worldEditToStorage, worldPoseLookup, worldToScreen, zoomAt, zoomAtLeast };
|
|
31442
|
-
//# sourceMappingURL=chunk-
|
|
31443
|
-
//# sourceMappingURL=chunk-
|
|
31564
|
+
//# sourceMappingURL=chunk-QEZL53V6.js.map
|
|
31565
|
+
//# sourceMappingURL=chunk-QEZL53V6.js.map
|