@pixerate/editor 0.149.0 → 0.150.1
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/agent/index.cjs +7 -5
- package/dist/agent/index.js +5 -3
- package/dist/animation/index.cjs +4 -2
- package/dist/animation/index.js +3 -1
- package/dist/chart/index.cjs +7 -7
- package/dist/chart/index.js +1 -1
- package/dist/{chunk-3EVMUYF4.js → chunk-6DXDUVSL.js} +1 -1
- package/dist/{chunk-ZCFHPORF.cjs → chunk-ERAGQL2N.cjs} +2 -2
- package/dist/{chunk-FR7GHH2K.cjs → chunk-GMWNBSBS.cjs} +3 -3
- package/dist/{chunk-OOV64UEB.js → chunk-KMU6QJB7.js} +1 -1
- package/dist/{chunk-PEEP2YR7.js → chunk-O2ANJFUF.js} +23 -1
- package/dist/{chunk-QCEQIRJQ.cjs → chunk-PI45JMP7.cjs} +163 -136
- package/dist/{chunk-UJGAA6AK.cjs → chunk-SWTUM32H.cjs} +23 -1
- package/dist/{chunk-ZQUANEK4.js → chunk-Y64YPIFT.js} +28 -1
- package/dist/commands/index.cjs +3 -3
- package/dist/commands/index.js +2 -2
- package/dist/diagram/index.cjs +7 -7
- package/dist/diagram/index.js +1 -1
- package/dist/image-editor/canvas-viewport.d.cts +52 -0
- package/dist/image-editor/canvas-viewport.d.ts +52 -0
- package/dist/image-editor/index.cjs +687 -596
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +120 -29
- package/dist/image-editor/layers/ops.d.cts +21 -3
- package/dist/image-editor/layers/ops.d.ts +21 -3
- package/dist/image-editor/playback.d.cts +20 -1
- package/dist/image-editor/playback.d.ts +20 -1
- package/dist/image-editor/renderer.d.cts +7 -0
- package/dist/image-editor/renderer.d.ts +7 -0
- package/dist/paint-editor/index.cjs +12 -12
- package/dist/paint-editor/index.js +2 -2
- package/dist/tools/index.cjs +6 -4
- package/dist/tools/index.js +5 -3
- package/dist/tools/presence.d.cts +17 -0
- package/dist/tools/presence.d.ts +17 -0
- package/package.json +2 -2
- package/skills/pixerate-image-editor/SKILL.md +6 -6
|
@@ -84,6 +84,28 @@ var PerformanceQueue = (_class2 = class {
|
|
|
84
84
|
return run;
|
|
85
85
|
}
|
|
86
86
|
}, _class2);
|
|
87
|
+
function trackPresenceDrag(handlers) {
|
|
88
|
+
let start = null;
|
|
89
|
+
return (state) => {
|
|
90
|
+
const actor = start ? state.actors.find((a) => a.id === start.id) : state.actors.find((a) => a.pressed);
|
|
91
|
+
if (!start) {
|
|
92
|
+
if (!actor) return;
|
|
93
|
+
start = { id: actor.id, x: actor.x, y: actor.y };
|
|
94
|
+
}
|
|
95
|
+
if (!actor || !actor.pressed) {
|
|
96
|
+
start = null;
|
|
97
|
+
handlers.onEnd();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
handlers.onDrag({
|
|
101
|
+
x: Math.min(start.x, actor.x),
|
|
102
|
+
y: Math.min(start.y, actor.y),
|
|
103
|
+
width: Math.abs(actor.x - start.x),
|
|
104
|
+
height: Math.abs(actor.y - start.y)
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
87
109
|
|
|
88
110
|
|
|
89
111
|
|
|
@@ -92,4 +114,4 @@ var PerformanceQueue = (_class2 = class {
|
|
|
92
114
|
|
|
93
115
|
|
|
94
116
|
|
|
95
|
-
exports.PRESENCE_COLORS = PRESENCE_COLORS; exports.PresenceStore = PresenceStore; exports.realPresenceClock = realPresenceClock; exports.createInstantPresenceClock = createInstantPresenceClock; exports.tweenPresenceCursor = tweenPresenceCursor; exports.PerformanceQueue = PerformanceQueue;
|
|
117
|
+
exports.PRESENCE_COLORS = PRESENCE_COLORS; exports.PresenceStore = PresenceStore; exports.realPresenceClock = realPresenceClock; exports.createInstantPresenceClock = createInstantPresenceClock; exports.tweenPresenceCursor = tweenPresenceCursor; exports.PerformanceQueue = PerformanceQueue; exports.trackPresenceDrag = trackPresenceDrag;
|
|
@@ -2901,11 +2901,34 @@ function combineCoverage(a, b, op, n) {
|
|
|
2901
2901
|
|
|
2902
2902
|
// src/image-editor/layers/ops.ts
|
|
2903
2903
|
var LayerOperationError = class extends Error {
|
|
2904
|
-
|
|
2904
|
+
userMessage;
|
|
2905
|
+
constructor(message, userMessage) {
|
|
2905
2906
|
super(message);
|
|
2906
2907
|
this.name = "LayerOperationError";
|
|
2908
|
+
if (userMessage) this.userMessage = userMessage;
|
|
2907
2909
|
}
|
|
2908
2910
|
};
|
|
2911
|
+
function userErrorMessage(err) {
|
|
2912
|
+
if (err instanceof LayerOperationError && err.userMessage) return err.userMessage;
|
|
2913
|
+
return err instanceof Error ? err.message : String(err);
|
|
2914
|
+
}
|
|
2915
|
+
function isPaintableLayer(layer) {
|
|
2916
|
+
return layer.type === "pixel" && layer.visible && !isLayerLocked(layer, "pixels");
|
|
2917
|
+
}
|
|
2918
|
+
function defaultActiveLayerId(layers) {
|
|
2919
|
+
const pixels = flattenLayers(layers).filter((l) => l.type === "pixel");
|
|
2920
|
+
for (let i = pixels.length - 1; i >= 0; i--) if (isPaintableLayer(pixels[i])) return pixels[i].id;
|
|
2921
|
+
return pixels[pixels.length - 1]?.id ?? null;
|
|
2922
|
+
}
|
|
2923
|
+
function activeLayerAfterRemoval(prev, next, removedId) {
|
|
2924
|
+
const before = flattenLayers(prev);
|
|
2925
|
+
const at = before.findIndex((l) => l.id === removedId);
|
|
2926
|
+
for (let i = at - 1; i >= 0; i--) {
|
|
2927
|
+
const loc = findLayer(next, before[i].id);
|
|
2928
|
+
if (loc && isPaintableLayer(loc.layer)) return loc.layer.id;
|
|
2929
|
+
}
|
|
2930
|
+
return defaultActiveLayerId(next);
|
|
2931
|
+
}
|
|
2909
2932
|
var fail = (message) => {
|
|
2910
2933
|
throw new LayerOperationError(message);
|
|
2911
2934
|
};
|
|
@@ -11612,6 +11635,10 @@ export {
|
|
|
11612
11635
|
flattenPath,
|
|
11613
11636
|
rasterizeCoverage,
|
|
11614
11637
|
LayerOperationError,
|
|
11638
|
+
userErrorMessage,
|
|
11639
|
+
isPaintableLayer,
|
|
11640
|
+
defaultActiveLayerId,
|
|
11641
|
+
activeLayerAfterRemoval,
|
|
11615
11642
|
requireLayer,
|
|
11616
11643
|
requireUnlocked,
|
|
11617
11644
|
placeLayer,
|
package/dist/commands/index.cjs
CHANGED
|
@@ -29,8 +29,8 @@ var _chunkGLQQ2VILcjs = require('../chunk-GLQQ2VIL.cjs');
|
|
|
29
29
|
var _chunk4EFNS2HVcjs = require('../chunk-4EFNS2HV.cjs');
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
33
|
-
require('../chunk-
|
|
32
|
+
var _chunkGMWNBSBScjs = require('../chunk-GMWNBSBS.cjs');
|
|
33
|
+
require('../chunk-SWTUM32H.cjs');
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
var _chunkWOFXZ3XUcjs = require('../chunk-WOFXZ3XU.cjs');
|
|
@@ -608,7 +608,7 @@ function createCommandToolProvider(registry, options = {}) {
|
|
|
608
608
|
const surface = _nullishCoalesce(_nullishCoalesce(spec.playbackSurface, () => ( spec.scope)), () => ( (id.includes(".") ? id.slice(0, id.indexOf(".")) : void 0)));
|
|
609
609
|
const planned = _optionalChain([spec, 'access', _24 => _24.plan, 'optionalCall', _25 => _25(context(), _nullishCoalesce(params, () => ( {})))]);
|
|
610
610
|
const own = !planned ? [] : Array.isArray(planned) ? planned : planned.steps;
|
|
611
|
-
const steps = own.length ? own :
|
|
611
|
+
const steps = own.length ? own : _chunkGMWNBSBScjs.derivePlaybackSteps.call(void 0, params);
|
|
612
612
|
return {
|
|
613
613
|
steps,
|
|
614
614
|
...surface ? { surface } : {},
|
package/dist/commands/index.js
CHANGED
|
@@ -29,8 +29,8 @@ import {
|
|
|
29
29
|
} from "../chunk-7KZ2HKKC.js";
|
|
30
30
|
import {
|
|
31
31
|
derivePlaybackSteps
|
|
32
|
-
} from "../chunk-
|
|
33
|
-
import "../chunk-
|
|
32
|
+
} from "../chunk-6DXDUVSL.js";
|
|
33
|
+
import "../chunk-O2ANJFUF.js";
|
|
34
34
|
import {
|
|
35
35
|
validateJsonSchema
|
|
36
36
|
} from "../chunk-V2ZCJRDM.js";
|
package/dist/diagram/index.cjs
CHANGED
|
@@ -128,7 +128,7 @@ require('../chunk-2BSBFBOA.cjs');
|
|
|
128
128
|
|
|
129
129
|
|
|
130
130
|
|
|
131
|
-
var
|
|
131
|
+
var _chunkSWTUM32Hcjs = require('../chunk-SWTUM32H.cjs');
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
var _chunkFJ2MSI43cjs = require('../chunk-FJ2MSI43.cjs');
|
|
@@ -2313,8 +2313,8 @@ var DiagramDirector = class {
|
|
|
2313
2313
|
this.controller = controller;
|
|
2314
2314
|
this.options = options;
|
|
2315
2315
|
this.presence = presence;
|
|
2316
|
-
this.clock = _nullishCoalesce(options.clock, () => (
|
|
2317
|
-
this.queue = new (0,
|
|
2316
|
+
this.clock = _nullishCoalesce(options.clock, () => ( _chunkSWTUM32Hcjs.realPresenceClock));
|
|
2317
|
+
this.queue = new (0, _chunkSWTUM32Hcjs.PerformanceQueue)(presence, {
|
|
2318
2318
|
clock: this.clock,
|
|
2319
2319
|
linger: options.linger,
|
|
2320
2320
|
beginGesture: (key) => controller.beginGesture(key),
|
|
@@ -2373,7 +2373,7 @@ var DiagramDirector = class {
|
|
|
2373
2373
|
const fresh = changedItems(before, result.document.graph);
|
|
2374
2374
|
const target = fresh.length ? center(this.options.placement(), fresh[fresh.length - 1]) : null;
|
|
2375
2375
|
const actorNow = this.presence.get(actor.id);
|
|
2376
|
-
if (target && actorNow) await
|
|
2376
|
+
if (target && actorNow) await _chunkSWTUM32Hcjs.tweenPresenceCursor.call(void 0, this.presence, this.clock, actor.id, actorNow, target, pause);
|
|
2377
2377
|
else await this.clock.wait(pause);
|
|
2378
2378
|
}
|
|
2379
2379
|
return { ok: true, document: this.controller.getDocument() };
|
|
@@ -2410,7 +2410,7 @@ var DiagramDirector = class {
|
|
|
2410
2410
|
return null;
|
|
2411
2411
|
}
|
|
2412
2412
|
case "move":
|
|
2413
|
-
await
|
|
2413
|
+
await _chunkSWTUM32Hcjs.tweenPresenceCursor.call(void 0, this.presence, this.clock, id, where(), step.to, step.ms);
|
|
2414
2414
|
return null;
|
|
2415
2415
|
case "press":
|
|
2416
2416
|
this.presence.set({ id, pressed: true });
|
|
@@ -2421,7 +2421,7 @@ var DiagramDirector = class {
|
|
|
2421
2421
|
case "drag": {
|
|
2422
2422
|
const start = this.options.placement().positions[step.id];
|
|
2423
2423
|
let problem = null;
|
|
2424
|
-
await
|
|
2424
|
+
await _chunkSWTUM32Hcjs.tweenPresenceCursor.call(void 0, this.presence, this.clock, id, where(), step.to, step.ms, (e) => {
|
|
2425
2425
|
if (problem || !start) return;
|
|
2426
2426
|
const position = [start[0] + (step.position[0] - start[0]) * e, start[1] + (step.position[1] - start[1]) * e];
|
|
2427
2427
|
const result = this.controller.apply({ type: "moveNodes", moves: [{ id: step.id, position }] }, label);
|
|
@@ -2610,4 +2610,4 @@ function planDiagramEdits(source, place, ops, speed = 1) {
|
|
|
2610
2610
|
|
|
2611
2611
|
|
|
2612
2612
|
|
|
2613
|
-
exports.ARCH_METRICS = _chunkZVNAMTFOcjs.ARCH_METRICS; exports.C4_METRICS = _chunkZVNAMTFOcjs.C4_METRICS; exports.CLASS_RELATIONS = _chunkZVNAMTFOcjs.CLASS_RELATIONS; exports.DIRECTIONS = DIRECTIONS; exports.DiagramController = DiagramController; exports.DiagramDirector = DiagramDirector; exports.EDITABLE_DIAGRAM_FAMILIES = EDITABLE_DIAGRAM_FAMILIES; exports.ER_CARDINALITIES = _chunkZVNAMTFOcjs.ER_CARDINALITIES; exports.ER_PATTERNS = _chunkZVNAMTFOcjs.ER_PATTERNS; exports.FAMILY_BLANKS = FAMILY_BLANKS; exports.FAMILY_DESCRIPTIONS = FAMILY_DESCRIPTIONS; exports.FAMILY_TEMPLATES = FAMILY_TEMPLATES; exports.FAMILY_TITLES = FAMILY_TITLES; exports.FLOWCHART_SHAPES = _chunkZVNAMTFOcjs.FLOWCHART_SHAPES; exports.GANTT_CONFIG_KEYS = _chunkZVNAMTFOcjs.GANTT_CONFIG_KEYS; exports.GANTT_METRICS = _chunkZVNAMTFOcjs.GANTT_METRICS; exports.GANTT_TAGS = _chunkZVNAMTFOcjs.GANTT_TAGS; exports.META_COMMENT_PREFIX = _chunkZVNAMTFOcjs.META_COMMENT_PREFIX; exports.META_FRONTMATTER_KEY = _chunkZVNAMTFOcjs.META_FRONTMATTER_KEY; exports.POINT_BOX = _chunkZVNAMTFOcjs.POINT_BOX; exports.PRESENCE_COLORS =
|
|
2613
|
+
exports.ARCH_METRICS = _chunkZVNAMTFOcjs.ARCH_METRICS; exports.C4_METRICS = _chunkZVNAMTFOcjs.C4_METRICS; exports.CLASS_RELATIONS = _chunkZVNAMTFOcjs.CLASS_RELATIONS; exports.DIRECTIONS = DIRECTIONS; exports.DiagramController = DiagramController; exports.DiagramDirector = DiagramDirector; exports.EDITABLE_DIAGRAM_FAMILIES = EDITABLE_DIAGRAM_FAMILIES; exports.ER_CARDINALITIES = _chunkZVNAMTFOcjs.ER_CARDINALITIES; exports.ER_PATTERNS = _chunkZVNAMTFOcjs.ER_PATTERNS; exports.FAMILY_BLANKS = FAMILY_BLANKS; exports.FAMILY_DESCRIPTIONS = FAMILY_DESCRIPTIONS; exports.FAMILY_TEMPLATES = FAMILY_TEMPLATES; exports.FAMILY_TITLES = FAMILY_TITLES; exports.FLOWCHART_SHAPES = _chunkZVNAMTFOcjs.FLOWCHART_SHAPES; exports.GANTT_CONFIG_KEYS = _chunkZVNAMTFOcjs.GANTT_CONFIG_KEYS; exports.GANTT_METRICS = _chunkZVNAMTFOcjs.GANTT_METRICS; exports.GANTT_TAGS = _chunkZVNAMTFOcjs.GANTT_TAGS; exports.META_COMMENT_PREFIX = _chunkZVNAMTFOcjs.META_COMMENT_PREFIX; exports.META_FRONTMATTER_KEY = _chunkZVNAMTFOcjs.META_FRONTMATTER_KEY; exports.POINT_BOX = _chunkZVNAMTFOcjs.POINT_BOX; exports.PRESENCE_COLORS = _chunkSWTUM32Hcjs.PRESENCE_COLORS; exports.PerformanceQueue = _chunkSWTUM32Hcjs.PerformanceQueue; exports.PresenceStore = _chunkSWTUM32Hcjs.PresenceStore; exports.QUADRANT_METRICS = _chunkZVNAMTFOcjs.QUADRANT_METRICS; exports.RADAR_CHART_BOX = _chunkZVNAMTFOcjs.RADAR_CHART_BOX; exports.SEQUENCE_METRICS = _chunkZVNAMTFOcjs.SEQUENCE_METRICS; exports.STATE_SHAPES = _chunkZVNAMTFOcjs.STATE_SHAPES; exports.XY_CHART_BOX = _chunkZVNAMTFOcjs.XY_CHART_BOX; exports.afterIds = _chunkZVNAMTFOcjs.afterIds; exports.applyEdit = _chunkZVNAMTFOcjs.applyEdit; exports.applyEdits = _chunkZVNAMTFOcjs.applyEdits; exports.applyStatementEdit = _chunkZVNAMTFOcjs.applyStatementEdit; exports.architectureAdapter = _chunkZVNAMTFOcjs.architectureAdapter; exports.architectureArrow = _chunkZVNAMTFOcjs.architectureArrow; exports.architectureEdgeRoute = _chunkZVNAMTFOcjs.architectureEdgeRoute; exports.architectureGrammar = _chunkZVNAMTFOcjs.architectureGrammar; exports.architectureLayout = _chunkZVNAMTFOcjs.architectureLayout; exports.architectureUI = architectureUI; exports.c4Adapter = _chunkZVNAMTFOcjs.c4Adapter; exports.c4ArrowHead = _chunkZVNAMTFOcjs.c4ArrowHead; exports.c4BoundaryText = _chunkZVNAMTFOcjs.c4BoundaryText; exports.c4ElementGeometry = _chunkZVNAMTFOcjs.c4ElementGeometry; exports.c4ElementType = _chunkZVNAMTFOcjs.c4ElementType; exports.c4Grammar = _chunkZVNAMTFOcjs.c4Grammar; exports.c4Layout = _chunkZVNAMTFOcjs.c4Layout; exports.c4RelGeometry = _chunkZVNAMTFOcjs.c4RelGeometry; exports.c4Stereotype = _chunkZVNAMTFOcjs.c4Stereotype; exports.c4UI = c4UI; exports.canonicalShape = _chunkZVNAMTFOcjs.canonicalShape; exports.changedItems = changedItems; exports.checkFieldData = checkFieldData; exports.classGrammar = _chunkZVNAMTFOcjs.classGrammar; exports.classUI = classUI; exports.createDiagramEditorDocument = createDiagramEditorDocument; exports.createDiagramToolProvider = createDiagramToolProvider; exports.createInstantPresenceClock = _chunkSWTUM32Hcjs.createInstantPresenceClock; exports.createLineAdapter = _chunkZVNAMTFOcjs.createLineAdapter; exports.createPassthroughAdapter = _chunkZVNAMTFOcjs.createPassthroughAdapter; exports.createStatementAdapter = _chunkZVNAMTFOcjs.createStatementAdapter; exports.describeDiagram = describeDiagram; exports.describeFields = describeFields; exports.detectFamily = _chunkZVNAMTFOcjs.detectFamily; exports.detectFamilyFromHeader = _chunkZVNAMTFOcjs.detectFamilyFromHeader; exports.diagramShapes = diagramShapes; exports.diagramSupportsDirection = diagramSupportsDirection; exports.diagramSupportsGroups = diagramSupportsGroups; exports.draftFrames = draftFrames; exports.dropMetaKeys = _chunkZVNAMTFOcjs.dropMetaKeys; exports.emptyMeta = _chunkZVNAMTFOcjs.emptyMeta; exports.erGrammar = _chunkZVNAMTFOcjs.erGrammar; exports.erUI = erUI; exports.familyUI = familyUI; exports.filterInPlace = _chunkZVNAMTFOcjs.filterInPlace; exports.findMermaidSources = findMermaidSources; exports.flowchartAdapter = _chunkZVNAMTFOcjs.flowchartAdapter; exports.flowchartUI = flowchartUI; exports.formatAxis = _chunkZVNAMTFOcjs.formatAxis; exports.formatChain = _chunkZVNAMTFOcjs.formatChain; exports.formatGanttDate = _chunkZVNAMTFOcjs.formatGanttDate; exports.formatLink = _chunkZVNAMTFOcjs.formatLink; exports.formatNode = _chunkZVNAMTFOcjs.formatNode; exports.ganttAdapter = _chunkZVNAMTFOcjs.ganttAdapter; exports.ganttGeometry = _chunkZVNAMTFOcjs.ganttGeometry; exports.ganttGrammar = _chunkZVNAMTFOcjs.ganttGrammar; exports.ganttUI = ganttUI; exports.getDiagramAdapter = _chunkZVNAMTFOcjs.getDiagramAdapter; exports.getFamilyLayout = _chunkZVNAMTFOcjs.getFamilyLayout; exports.gitGraphAdapter = _chunkZVNAMTFOcjs.gitGraphAdapter; exports.gitGraphGrammar = _chunkZVNAMTFOcjs.gitGraphGrammar; exports.gitGraphUI = gitGraphUI; exports.indentOf = _chunkZVNAMTFOcjs.indentOf; exports.isMetaEmpty = _chunkZVNAMTFOcjs.isMetaEmpty; exports.journeyAdapter = _chunkZVNAMTFOcjs.journeyAdapter; exports.journeyGrammar = _chunkZVNAMTFOcjs.journeyGrammar; exports.journeyLayout = _chunkZVNAMTFOcjs.journeyLayout; exports.journeyUI = journeyUI; exports.mergeMeta = _chunkZVNAMTFOcjs.mergeMeta; exports.mindmapAdapter = _chunkZVNAMTFOcjs.mindmapAdapter; exports.mindmapGrammar = _chunkZVNAMTFOcjs.mindmapGrammar; exports.mindmapUI = mindmapUI; exports.parseAttributes = _chunkZVNAMTFOcjs.parseAttributes; exports.parseChain = _chunkZVNAMTFOcjs.parseChain; exports.parseFlowchartSource = _chunkZVNAMTFOcjs.parseFlowchartSource; exports.parseGanttDate = _chunkZVNAMTFOcjs.parseGanttDate; exports.parseLink = _chunkZVNAMTFOcjs.parseLink; exports.parseMembers = _chunkZVNAMTFOcjs.parseMembers; exports.parseMermaid = _chunkZVNAMTFOcjs.parseMermaid; exports.parseSankey = parseSankey; exports.parseStatement = _chunkZVNAMTFOcjs.parseStatement; exports.parseStatementDocument = _chunkZVNAMTFOcjs.parseStatementDocument; exports.parseTreemap = parseTreemap; exports.pickFieldData = pickFieldData; exports.pieAdapter = _chunkZVNAMTFOcjs.pieAdapter; exports.pieGrammar = _chunkZVNAMTFOcjs.pieGrammar; exports.pieUI = pieUI; exports.planDiagramEdit = planDiagramEdit; exports.planDiagramEdits = planDiagramEdits; exports.pointCentre = _chunkZVNAMTFOcjs.pointCentre; exports.pointPosition = _chunkZVNAMTFOcjs.pointPosition; exports.positionToData = _chunkZVNAMTFOcjs.positionToData; exports.quadrantAdapter = _chunkZVNAMTFOcjs.quadrantAdapter; exports.quadrantGeometry = _chunkZVNAMTFOcjs.quadrantGeometry; exports.quadrantGrammar = _chunkZVNAMTFOcjs.quadrantGrammar; exports.quadrantSpace = _chunkZVNAMTFOcjs.quadrantSpace; exports.quadrantUI = quadrantUI; exports.quote = _chunkZVNAMTFOcjs.quote; exports.quoteLabelIfNeeded = _chunkZVNAMTFOcjs.quoteLabelIfNeeded; exports.radarAdapter = _chunkZVNAMTFOcjs.radarAdapter; exports.radarGrammar = _chunkZVNAMTFOcjs.radarGrammar; exports.radarUI = radarUI; exports.realPresenceClock = _chunkSWTUM32Hcjs.realPresenceClock; exports.registerDiagramAdapter = _chunkZVNAMTFOcjs.registerDiagramAdapter; exports.registerFamilyLayout = _chunkZVNAMTFOcjs.registerFamilyLayout; exports.relationFor = _chunkZVNAMTFOcjs.relationFor; exports.renameMetaKey = _chunkZVNAMTFOcjs.renameMetaKey; exports.resolveShape = _chunkZVNAMTFOcjs.resolveShape; exports.sequenceAdapter = _chunkZVNAMTFOcjs.sequenceAdapter; exports.sequenceGeometry = _chunkZVNAMTFOcjs.sequenceGeometry; exports.sequenceGrammar = _chunkZVNAMTFOcjs.sequenceGrammar; exports.sequenceUI = sequenceUI; exports.serializeMermaid = _chunkZVNAMTFOcjs.serializeMermaid; exports.serializeMeta = _chunkZVNAMTFOcjs.serializeMeta; exports.serializeStatementDocument = _chunkZVNAMTFOcjs.serializeStatementDocument; exports.serviceLabelLines = _chunkZVNAMTFOcjs.serviceLabelLines; exports.sharedFrameLayout = _chunkZVNAMTFOcjs.sharedFrameLayout; exports.slugId = _chunkZVNAMTFOcjs.slugId; exports.spaceInput = _chunkZVNAMTFOcjs.spaceInput; exports.splitOutsideQuotes = _chunkZVNAMTFOcjs.splitOutsideQuotes; exports.splitSource = _chunkZVNAMTFOcjs.splitSource; exports.splitStatements = _chunkZVNAMTFOcjs.splitStatements; exports.stateGrammar = _chunkZVNAMTFOcjs.stateGrammar; exports.stateUI = stateUI; exports.supportTierOf = _chunkZVNAMTFOcjs.supportTierOf; exports.timelineAdapter = _chunkZVNAMTFOcjs.timelineAdapter; exports.timelineGrammar = _chunkZVNAMTFOcjs.timelineGrammar; exports.timelineLayout = _chunkZVNAMTFOcjs.timelineLayout; exports.timelineUI = timelineUI; exports.treemapValue = treemapValue; exports.uniqueId = _chunkZVNAMTFOcjs.uniqueId; exports.unquote = _chunkZVNAMTFOcjs.unquote; exports.validateDiagramEdit = validateDiagramEdit; exports.xyChartAdapter = _chunkZVNAMTFOcjs.xyChartAdapter; exports.xyChartGrammar = _chunkZVNAMTFOcjs.xyChartGrammar; exports.xyChartUI = xyChartUI;
|
package/dist/diagram/index.js
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sizing an on-screen editor canvas: its layout size in CSS pixels (what the projection, overlays
|
|
3
|
+
* and pointer mapping use) and how many backing-store pixels each CSS pixel needs to look sharp.
|
|
4
|
+
*/
|
|
5
|
+
/** What `measureCanvasViewport` reads from the element that holds the canvas. */
|
|
6
|
+
export interface MeasurableElement {
|
|
7
|
+
readonly clientWidth: number;
|
|
8
|
+
readonly clientHeight: number;
|
|
9
|
+
/** Layout size including borders, compared with the on-screen box to find the CSS transform scale. */
|
|
10
|
+
readonly offsetWidth?: number;
|
|
11
|
+
readonly offsetHeight?: number;
|
|
12
|
+
getBoundingClientRect(): {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface CanvasViewport {
|
|
18
|
+
/** Layout width in CSS pixels (pass as `RenderOptions.viewportWidth`). */
|
|
19
|
+
width: number;
|
|
20
|
+
/** Layout height in CSS pixels (pass as `RenderOptions.viewportHeight`). */
|
|
21
|
+
height: number;
|
|
22
|
+
/** Backing-store pixels per CSS pixel (pass as `RenderOptions.pixelRatio`). */
|
|
23
|
+
pixelRatio: number;
|
|
24
|
+
}
|
|
25
|
+
/** The size `measureCanvasViewport` gives an element without layout (e.g. before it is shown, or in jsdom). */
|
|
26
|
+
export declare const DEFAULT_CANVAS_VIEWPORT: Readonly<{
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
}>;
|
|
30
|
+
/** The longest side a viewport backing store may reach; the pixel ratio is lowered to fit. */
|
|
31
|
+
export declare const MAX_CANVAS_BACKING_SIDE = 8192;
|
|
32
|
+
/**
|
|
33
|
+
* Measures the element a viewport canvas fills. `clientWidth` / `clientHeight` give the layout size
|
|
34
|
+
* (they ignore CSS transforms); `getBoundingClientRect()` gives the size on screen. Their ratio is
|
|
35
|
+
* the scale of any transform on the element or its ancestors, so the pixel ratio is
|
|
36
|
+
* `devicePixelRatio × that scale`: a 220px node scaled to 500px on a 2× screen gets ~4.5 backing
|
|
37
|
+
* pixels per CSS pixel instead of being stretched. `fallback` is the size of an element without
|
|
38
|
+
* layout (default `DEFAULT_CANVAS_VIEWPORT`).
|
|
39
|
+
*/
|
|
40
|
+
export declare function measureCanvasViewport(el: MeasurableElement, devicePixelRatio?: number, fallback?: {
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
}): CanvasViewport;
|
|
44
|
+
/** Whether two measurements need different backing stores. */
|
|
45
|
+
export declare function sameCanvasViewport(a: CanvasViewport, b: CanvasViewport): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Calls `onChange` when the element's viewport measurement changes: on resize (a
|
|
48
|
+
* `ResizeObserver`), on window resize (browser zoom, moving to another screen) and after any CSS
|
|
49
|
+
* transition or animation ends (a host scaling the element with a transform, which resizes nothing).
|
|
50
|
+
* Returns a function that stops watching.
|
|
51
|
+
*/
|
|
52
|
+
export declare function watchCanvasViewport(el: MeasurableElement & Partial<Element>, onChange: (viewport: CanvasViewport) => void): () => void;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sizing an on-screen editor canvas: its layout size in CSS pixels (what the projection, overlays
|
|
3
|
+
* and pointer mapping use) and how many backing-store pixels each CSS pixel needs to look sharp.
|
|
4
|
+
*/
|
|
5
|
+
/** What `measureCanvasViewport` reads from the element that holds the canvas. */
|
|
6
|
+
export interface MeasurableElement {
|
|
7
|
+
readonly clientWidth: number;
|
|
8
|
+
readonly clientHeight: number;
|
|
9
|
+
/** Layout size including borders, compared with the on-screen box to find the CSS transform scale. */
|
|
10
|
+
readonly offsetWidth?: number;
|
|
11
|
+
readonly offsetHeight?: number;
|
|
12
|
+
getBoundingClientRect(): {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface CanvasViewport {
|
|
18
|
+
/** Layout width in CSS pixels (pass as `RenderOptions.viewportWidth`). */
|
|
19
|
+
width: number;
|
|
20
|
+
/** Layout height in CSS pixels (pass as `RenderOptions.viewportHeight`). */
|
|
21
|
+
height: number;
|
|
22
|
+
/** Backing-store pixels per CSS pixel (pass as `RenderOptions.pixelRatio`). */
|
|
23
|
+
pixelRatio: number;
|
|
24
|
+
}
|
|
25
|
+
/** The size `measureCanvasViewport` gives an element without layout (e.g. before it is shown, or in jsdom). */
|
|
26
|
+
export declare const DEFAULT_CANVAS_VIEWPORT: Readonly<{
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
}>;
|
|
30
|
+
/** The longest side a viewport backing store may reach; the pixel ratio is lowered to fit. */
|
|
31
|
+
export declare const MAX_CANVAS_BACKING_SIDE = 8192;
|
|
32
|
+
/**
|
|
33
|
+
* Measures the element a viewport canvas fills. `clientWidth` / `clientHeight` give the layout size
|
|
34
|
+
* (they ignore CSS transforms); `getBoundingClientRect()` gives the size on screen. Their ratio is
|
|
35
|
+
* the scale of any transform on the element or its ancestors, so the pixel ratio is
|
|
36
|
+
* `devicePixelRatio × that scale`: a 220px node scaled to 500px on a 2× screen gets ~4.5 backing
|
|
37
|
+
* pixels per CSS pixel instead of being stretched. `fallback` is the size of an element without
|
|
38
|
+
* layout (default `DEFAULT_CANVAS_VIEWPORT`).
|
|
39
|
+
*/
|
|
40
|
+
export declare function measureCanvasViewport(el: MeasurableElement, devicePixelRatio?: number, fallback?: {
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
}): CanvasViewport;
|
|
44
|
+
/** Whether two measurements need different backing stores. */
|
|
45
|
+
export declare function sameCanvasViewport(a: CanvasViewport, b: CanvasViewport): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Calls `onChange` when the element's viewport measurement changes: on resize (a
|
|
48
|
+
* `ResizeObserver`), on window resize (browser zoom, moving to another screen) and after any CSS
|
|
49
|
+
* transition or animation ends (a host scaling the element with a transform, which resizes nothing).
|
|
50
|
+
* Returns a function that stops watching.
|
|
51
|
+
*/
|
|
52
|
+
export declare function watchCanvasViewport(el: MeasurableElement & Partial<Element>, onChange: (viewport: CanvasViewport) => void): () => void;
|