@widgetic/canvas 0.5.39 → 0.5.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/dist/canvas/DomCanvas.svelte +7 -3
- package/dist/canvas/DomCanvas.svelte.d.ts +8 -0
- package/dist/canvas/autosaveScheduler.js +89 -37
- package/dist/canvas/boardFrame.js +1 -1
- package/dist/canvas/boardSurface.js +1 -1
- package/dist/canvas/canvasLogger.js +19 -7
- package/dist/canvas/chromeLayout.d.ts +2 -0
- package/dist/canvas/chromeLayout.js +31 -17
- package/dist/canvas/eventScope.js +14 -10
- package/dist/canvas/host/CanvasHost.d.ts +6 -0
- package/dist/canvas/host/CanvasHost.js +1556 -1255
- package/dist/canvas/host/CanvasHostApi.d.ts +2 -2
- package/dist/canvas/host/CanvasHostApi.js +25 -4
- package/dist/canvas/host/browserServices.js +116 -65
- package/dist/canvas/host/conversion.js +170 -82
- package/dist/canvas/host/hostObject.js +7 -7
- package/dist/canvas/host/pageEvents.js +4 -4
- package/dist/canvas/host/screenRects.js +31 -28
- package/dist/canvas/host/strokeSnap.js +143 -88
- package/dist/canvas/openMarks.js +2 -2
- package/dist/canvas/outsideClickDeselect.js +7 -6
- package/dist/canvas/panZoomPosition.js +2 -2
- package/dist/canvas/preferredTextFont.js +25 -13
- package/dist/canvas/shapes/ShapeLibrary.js +148 -138
- package/dist/canvas/shapes/shapeImageStore.js +3 -3
- package/dist/canvas/shapes/strokeShapeSnap.js +233 -188
- package/dist/canvas/toolbarPosition.js +2 -2
- package/dist/canvas/ui/CanvasContextMenu.svelte +69 -39
- package/dist/canvas/ui/CanvasHint.svelte +17 -4
- package/dist/canvas/ui/CanvasHint.svelte.d.ts +2 -17
- package/dist/canvas/ui/CanvasToolbar.svelte +27 -10
- package/dist/canvas/ui/ColorField.svelte +1 -1
- package/dist/canvas/ui/SelectionPanel.svelte +24 -20
- package/dist/canvas/ui/ShapesMenu.svelte +0 -2
- package/dist/canvas/ui/ToolButton.svelte +11 -3
- package/dist/canvas/ui/ToolButton.svelte.d.ts +2 -0
- package/dist/canvas/ui/WidgetActions.svelte +1 -1
- package/dist/canvas/ui/ZoomControl.svelte +39 -4
- package/dist/canvas/ui/ZoomControl.svelte.d.ts +2 -2
- package/dist/canvas/ui/colorModel.js +32 -21
- package/dist/canvas/ui/colorPickerMessages.js +5 -5
- package/dist/canvas/ui/floatingCard.d.ts +7 -5
- package/dist/canvas/ui/floatingCard.js +23 -21
- package/dist/canvas/ui/floatingLayer.js +6 -5
- package/dist/canvas/ui/keyHints.d.ts +5 -0
- package/dist/canvas/ui/keyHints.js +23 -7
- package/dist/canvas/ui/popoverSide.js +3 -2
- package/dist/canvas/ui/selectionTraits.js +40 -34
- package/dist/canvas/ui/sizeLabelVisibility.d.ts +5 -2
- package/dist/canvas/ui/sizeLabelVisibility.js +7 -6
- package/dist/canvas/ui/widgetSelectionPanel.d.ts +6 -0
- package/dist/canvas/ui/widgetSelectionPanel.js +9 -0
- package/dist/canvas/view/ObjectView.svelte +2 -1
- package/dist/canvas/view/SelectionOverlay.svelte +34 -14
- package/dist/canvas/view/erasingMarks.js +7 -7
- package/dist/canvas/view/geometry.d.ts +14 -4
- package/dist/canvas/view/geometry.js +103 -77
- package/dist/components/preferenceStorage.js +2 -2
- package/dist/engine/EngineCore.d.ts +4 -1
- package/dist/engine/EngineCore.js +801 -695
- package/dist/engine/codec/canvasDocument.js +173 -173
- package/dist/engine/codec/hostReadableKeys.js +1 -1
- package/dist/engine/core/arrange.js +38 -26
- package/dist/engine/core/arrow.d.ts +10 -3
- package/dist/engine/core/arrow.js +96 -75
- package/dist/engine/core/arrowBinding.d.ts +69 -0
- package/dist/engine/core/arrowBinding.js +344 -0
- package/dist/engine/core/arrowBindingRecords.d.ts +43 -0
- package/dist/engine/core/arrowBindingRecords.js +141 -0
- package/dist/engine/core/brush.js +94 -67
- package/dist/engine/core/defaults.js +51 -90
- package/dist/engine/core/freehand.js +163 -147
- package/dist/engine/core/geometry.js +54 -47
- package/dist/engine/core/history.js +50 -33
- package/dist/engine/core/hitTest.d.ts +3 -0
- package/dist/engine/core/hitTest.js +83 -69
- package/dist/engine/core/matrix.js +20 -18
- package/dist/engine/core/pathData.js +210 -183
- package/dist/engine/core/rotationReset.js +6 -5
- package/dist/engine/core/scene.d.ts +3 -0
- package/dist/engine/core/scene.js +192 -129
- package/dist/engine/core/scribble.js +84 -59
- package/dist/engine/core/shapePaths.js +15 -12
- package/dist/engine/core/shapeTools.js +63 -72
- package/dist/engine/core/snapping.js +117 -65
- package/dist/engine/core/style.js +64 -31
- package/dist/engine/core/transform.js +94 -83
- package/dist/engine/core/types.d.ts +29 -0
- package/dist/engine/core/types.js +4 -4
- package/dist/engine/core/viewport.js +36 -23
- package/dist/engine/input/PointerController.js +476 -447
- package/dist/engine/input/arrowHandles.js +12 -12
- package/dist/engine/input/gestures.d.ts +12 -1
- package/dist/engine/input/gestures.js +342 -251
- package/dist/engine/input/hoverCursor.js +1 -1
- package/dist/engine/input/keyboard.d.ts +9 -1
- package/dist/engine/input/keyboard.js +46 -27
- package/dist/engine/input/selectionHandles.js +50 -45
- package/dist/engine/input/types.js +1 -1
- package/dist/engine/render/rasterize.js +158 -86
- package/dist/engine/state.d.ts +6 -1
- package/dist/engine/state.js +17 -5
- package/dist/engine/text/layoutText.js +62 -43
- package/dist/engine/text/textMetrics.js +10 -8
- package/dist/engine/widgets.js +137 -101
- package/dist/fonts/interFont.js +68 -17
- package/dist/fonts/workspaceFonts.js +90 -32
- package/dist/i18n/labels.js +6 -5
- package/dist/i18n/language.js +4 -4
- package/dist/i18n/messages.d.ts +6 -6
- package/dist/i18n/messages.js +7 -7
- package/dist/i18n/shortcuts.d.ts +12 -0
- package/dist/i18n/shortcuts.js +32 -18
- package/dist/settings/workspaceToolSettings.js +48 -32
- package/dist/tools/components/catalog.d.ts +11 -0
- package/dist/tools/components/catalog.js +270 -0
- package/dist/tools/components/grouping.d.ts +9 -0
- package/dist/tools/components/grouping.js +33 -0
- package/dist/tools/definitions.d.ts +19 -0
- package/dist/tools/definitions.js +147 -0
- package/dist/tools/executors.d.ts +7 -0
- package/dist/tools/executors.js +324 -0
- package/dist/tools/hostAdapter.d.ts +14 -0
- package/dist/tools/hostAdapter.js +40 -0
- package/dist/tools/index.d.ts +6 -0
- package/dist/tools/index.js +6 -0
- package/dist/tools/sceneSummary.d.ts +24 -0
- package/dist/tools/sceneSummary.js +170 -0
- package/dist/tools/sketchIntent.d.ts +17 -0
- package/dist/tools/sketchIntent.js +166 -0
- package/dist/tools/types.d.ts +54 -0
- package/dist/tools/types.js +11 -0
- package/package.json +7 -2
|
@@ -12,7 +12,28 @@
|
|
|
12
12
|
* - Everything read is validated and clamped, because a saved canvas is data from a database and from other
|
|
13
13
|
* people's browsers: colours, fonts and addresses that could carry more than a value are replaced by defaults.
|
|
14
14
|
*/
|
|
15
|
+
var __assign = (this && this.__assign) || function () {
|
|
16
|
+
__assign = Object.assign || function(t) {
|
|
17
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
18
|
+
s = arguments[i];
|
|
19
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
20
|
+
t[p] = s[p];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
return __assign.apply(this, arguments);
|
|
25
|
+
};
|
|
26
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
27
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
28
|
+
if (ar || !(i in from)) {
|
|
29
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
30
|
+
ar[i] = from[i];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
34
|
+
};
|
|
15
35
|
import { arrowPointsOfLegacyPath, buildArrow } from '../core/arrow.js';
|
|
36
|
+
import { dropDanglingBindings, withBindings } from '../core/arrowBindingRecords.js';
|
|
16
37
|
import { BRUSH_MAX_POINTS, brushOutlineData } from '../core/brush.js';
|
|
17
38
|
import { createEllipseObject, createGroupObject, createImageObject, createObjectId, createPathObject, createRectObject, createTextObject, createWidgetObject, TEXT_DEFAULTS } from '../core/defaults.js';
|
|
18
39
|
import { clampNumber, roundTo } from '../core/geometry.js';
|
|
@@ -23,18 +44,17 @@ import { CANVAS_DOCUMENT_VERSION, MIN_OBJECT_SIZE } from '../core/types.js';
|
|
|
23
44
|
import { sanitizeViewport } from '../core/viewport.js';
|
|
24
45
|
import { HOST_READABLE_KEYS } from './hostReadableKeys.js';
|
|
25
46
|
/** The most objects a board may hold when it is read; a text with more is cut here and says so. */
|
|
26
|
-
export
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
47
|
+
export var MAX_OBJECTS_PER_DOCUMENT = 20000;
|
|
48
|
+
var MAX_TEXT_LENGTH = 100000;
|
|
49
|
+
var MAX_PATH_DATA_LENGTH = 500000;
|
|
50
|
+
var MAX_COORDINATE = 1000000;
|
|
51
|
+
var MAX_SIZE = 100000;
|
|
31
52
|
// --- Writing -----------------------------------------------------------------------------------
|
|
32
|
-
|
|
33
|
-
|
|
53
|
+
var BOX_KEYS = ['x', 'y', 'width', 'height', 'rotation', 'opacity'];
|
|
54
|
+
var PAINT_KEYS = ['fill', 'fillOpacity', 'stroke', 'strokeWidth', 'strokeStyle'];
|
|
34
55
|
// The words audit reads every string inside a property called `text` as a sentence a person can read; these are the
|
|
35
56
|
// names of fields, so the list of a text object's keys lives in a constant of its own.
|
|
36
|
-
|
|
37
|
-
...BOX_KEYS,
|
|
57
|
+
var TEXT_OBJECT_KEYS = __spreadArray(__spreadArray([], BOX_KEYS, true), [
|
|
38
58
|
'text',
|
|
39
59
|
'color',
|
|
40
60
|
'fontSize',
|
|
@@ -47,40 +67,48 @@ const TEXT_OBJECT_KEYS = [
|
|
|
47
67
|
'padding',
|
|
48
68
|
'backgroundColor',
|
|
49
69
|
'autoWidth'
|
|
50
|
-
];
|
|
51
|
-
|
|
52
|
-
rect: [
|
|
53
|
-
ellipse: [
|
|
54
|
-
path: [
|
|
70
|
+
], false);
|
|
71
|
+
var KEYS_BY_TYPE = {
|
|
72
|
+
rect: __spreadArray(__spreadArray(__spreadArray([], BOX_KEYS, true), PAINT_KEYS, true), ['roundness'], false),
|
|
73
|
+
ellipse: __spreadArray(__spreadArray(__spreadArray([], BOX_KEYS, true), PAINT_KEYS, true), ['aspectLocked'], false),
|
|
74
|
+
path: __spreadArray(__spreadArray(__spreadArray([], BOX_KEYS, true), PAINT_KEYS, true), ['d', 'shape', 'roundness', 'aspectLocked', 'flipX', 'flipY', 'lineCap', 'lineJoin', 'ink', 'arrow'], false),
|
|
55
75
|
text: TEXT_OBJECT_KEYS,
|
|
56
|
-
image: [
|
|
57
|
-
widget: [
|
|
76
|
+
image: __spreadArray(__spreadArray([], BOX_KEYS, true), ['src', 'imageRef', 'fileName', 'naturalWidth', 'naturalHeight'], false),
|
|
77
|
+
widget: __spreadArray(__spreadArray([], BOX_KEYS, true), ['widgetId', 'widgetName', 'isPrimary', 'thumbnail', 'thumbnailRef'], false),
|
|
58
78
|
group: []
|
|
59
79
|
};
|
|
60
80
|
/** The reference and the (possibly inline) bytes of a picture, with the bytes moved to the store when there is one. */
|
|
61
81
|
function externalizeBytes(inline, existingRef, makeRef, store) {
|
|
62
82
|
if (!store || !inline || !inline.startsWith('data:'))
|
|
63
83
|
return { value: inline, ref: existingRef };
|
|
64
|
-
|
|
84
|
+
var ref = existingRef !== null && existingRef !== void 0 ? existingRef : makeRef();
|
|
65
85
|
if (!ref)
|
|
66
86
|
return { value: inline, ref: existingRef };
|
|
67
87
|
store.save(ref, inline);
|
|
68
|
-
return { value: null, ref };
|
|
88
|
+
return { value: null, ref: ref };
|
|
89
|
+
}
|
|
90
|
+
/** A tie of an arrow's end as it is saved: the shape it holds to (`target`) and, for a point of the outline, where on the shape's box. */
|
|
91
|
+
function writeArrowBinding(binding) {
|
|
92
|
+
return binding.kind === 'edge'
|
|
93
|
+
? { target: binding.targetId, kind: 'edge', anchor: [roundTo(binding.anchor.x, 4), roundTo(binding.anchor.y, 4)] }
|
|
94
|
+
: { target: binding.targetId, kind: 'center' };
|
|
69
95
|
}
|
|
70
96
|
function serializeObject(object, options) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
97
|
+
var _a;
|
|
98
|
+
var record = (_a = { id: object.id }, _a[HOST_READABLE_KEYS.objectType] = object.type, _a.parentId = object.parentId, _a);
|
|
99
|
+
var source = object;
|
|
100
|
+
var overrides = {};
|
|
74
101
|
if (object.type === 'widget') {
|
|
75
|
-
|
|
102
|
+
var thumbnail = externalizeBytes(object.thumbnail, object.thumbnailRef, function () { return "widget:".concat(object.widgetId); }, options.imageStore);
|
|
76
103
|
overrides = { thumbnail: thumbnail.value, thumbnailRef: thumbnail.ref };
|
|
77
104
|
}
|
|
78
105
|
else if (object.type === 'image') {
|
|
79
|
-
|
|
106
|
+
var image = externalizeBytes(object.src, object.imageRef, function () { return "shape:".concat(object.id); }, options.imageStore);
|
|
80
107
|
overrides = { src: image.value, imageRef: image.ref };
|
|
81
108
|
}
|
|
82
|
-
for (
|
|
83
|
-
|
|
109
|
+
for (var _i = 0, _b = KEYS_BY_TYPE[object.type]; _i < _b.length; _i++) {
|
|
110
|
+
var key = _b[_i];
|
|
111
|
+
var value = key in overrides ? overrides[key] : source[key];
|
|
84
112
|
record[key] = typeof value === 'number' ? roundTo(value, 3) : value;
|
|
85
113
|
}
|
|
86
114
|
if (object.type === 'widget') {
|
|
@@ -101,8 +129,8 @@ function serializeObject(object, options) {
|
|
|
101
129
|
// An arrow is saved as its two ends and its bend, for the same reason: its head and shaft are drawn from them when it is read.
|
|
102
130
|
if (object.arrow) {
|
|
103
131
|
delete record.d;
|
|
104
|
-
|
|
105
|
-
record.arrow = { start: [roundTo(start.x, 3), roundTo(start.y, 3)], end: [roundTo(end.x, 3), roundTo(end.y, 3)], bend: roundTo(bend, 3) };
|
|
132
|
+
var _c = object.arrow, start = _c.start, end = _c.end, bend = _c.bend, startBinding = _c.startBinding, endBinding = _c.endBinding;
|
|
133
|
+
record.arrow = __assign(__assign({ start: [roundTo(start.x, 3), roundTo(start.y, 3)], end: [roundTo(end.x, 3), roundTo(end.y, 3)], bend: roundTo(bend, 3) }, (startBinding ? { startBinding: writeArrowBinding(startBinding) } : {})), (endBinding ? { endBinding: writeArrowBinding(endBinding) } : {}));
|
|
106
134
|
}
|
|
107
135
|
else
|
|
108
136
|
delete record.arrow;
|
|
@@ -110,23 +138,28 @@ function serializeObject(object, options) {
|
|
|
110
138
|
return record;
|
|
111
139
|
}
|
|
112
140
|
/** The document for a board, as a plain object (the form `serializeCanvasDocument` writes). */
|
|
113
|
-
export function createCanvasDocument(scene, viewport, options
|
|
141
|
+
export function createCanvasDocument(scene, viewport, options) {
|
|
142
|
+
var _a;
|
|
143
|
+
if (options === void 0) { options = {}; }
|
|
114
144
|
return {
|
|
115
145
|
version: CANVAS_DOCUMENT_VERSION,
|
|
116
|
-
savedAt: (options.now
|
|
146
|
+
savedAt: ((_a = options.now) !== null && _a !== void 0 ? _a : new Date()).toISOString(),
|
|
117
147
|
viewport: { x: roundTo(viewport.x, 2), y: roundTo(viewport.y, 2), zoom: roundTo(viewport.zoom, 4) },
|
|
118
|
-
canvas: { objects: scene.map((object)
|
|
148
|
+
canvas: { objects: scene.map(function (object) { return serializeObject(object, options); }) }
|
|
119
149
|
};
|
|
120
150
|
}
|
|
121
151
|
/** The text a board is saved as. */
|
|
122
|
-
export function serializeCanvasDocument(scene, viewport, options
|
|
152
|
+
export function serializeCanvasDocument(scene, viewport, options) {
|
|
153
|
+
if (options === void 0) { options = {}; }
|
|
123
154
|
return JSON.stringify(createCanvasDocument(scene, viewport, options));
|
|
124
155
|
}
|
|
125
156
|
function isRecord(value) {
|
|
126
157
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
127
158
|
}
|
|
128
|
-
function readNumber(value, fallback, minimum
|
|
129
|
-
|
|
159
|
+
function readNumber(value, fallback, minimum, maximum) {
|
|
160
|
+
if (minimum === void 0) { minimum = -Infinity; }
|
|
161
|
+
if (maximum === void 0) { maximum = Infinity; }
|
|
162
|
+
var number = typeof value === 'number' ? value : typeof value === 'string' && value.trim() !== '' ? Number(value) : NaN;
|
|
130
163
|
if (!Number.isFinite(number))
|
|
131
164
|
return fallback;
|
|
132
165
|
return clampNumber(number, minimum, maximum);
|
|
@@ -134,34 +167,36 @@ function readNumber(value, fallback, minimum = -Infinity, maximum = Infinity) {
|
|
|
134
167
|
function readBoolean(value, fallback) {
|
|
135
168
|
return typeof value === 'boolean' ? value : fallback;
|
|
136
169
|
}
|
|
137
|
-
function readString(value, fallback, maximumLength
|
|
170
|
+
function readString(value, fallback, maximumLength) {
|
|
171
|
+
if (maximumLength === void 0) { maximumLength = 1000; }
|
|
138
172
|
return typeof value === 'string' ? value.slice(0, maximumLength) : fallback;
|
|
139
173
|
}
|
|
140
|
-
function readNullableString(value, maximumLength
|
|
174
|
+
function readNullableString(value, maximumLength) {
|
|
175
|
+
if (maximumLength === void 0) { maximumLength = 1000; }
|
|
141
176
|
return typeof value === 'string' && value !== '' ? value.slice(0, maximumLength) : null;
|
|
142
177
|
}
|
|
143
178
|
function readOneOf(value, allowed, fallback) {
|
|
144
179
|
return typeof value === 'string' && allowed.includes(value) ? value : fallback;
|
|
145
180
|
}
|
|
146
181
|
/** A hex, `rgb()`, `hsl()` or named colour: nothing that could carry more than a colour into CSS or SVG. */
|
|
147
|
-
|
|
182
|
+
var COLOR_PATTERN = /^(#[0-9a-f]{3,8}|(?:rgb|hsl)a?\([0-9a-z\s.,%/+-]{1,80}\)|[a-z]{3,30})$/i;
|
|
148
183
|
export function readColor(value, fallback) {
|
|
149
184
|
return typeof value === 'string' && COLOR_PATTERN.test(value.trim()) ? value.trim() : fallback;
|
|
150
185
|
}
|
|
151
|
-
|
|
186
|
+
var FONT_FAMILY_PATTERN = /^[\p{L}\p{N}\s,'"\-_.]{1,200}$/u;
|
|
152
187
|
function readFontFamily(value) {
|
|
153
188
|
return typeof value === 'string' && FONT_FAMILY_PATTERN.test(value) ? value : TEXT_DEFAULTS.fontFamily;
|
|
154
189
|
}
|
|
155
|
-
|
|
190
|
+
var IMAGE_ADDRESS_PATTERN = /^(?:data:image\/[a-z0-9.+-]+[;,]|https?:\/\/|blob:|\/(?!\/))/i;
|
|
156
191
|
/** An image address the browser may load into an `<img>`: inline bytes, http(s), a blob or a path of this site. */
|
|
157
192
|
export function readImageAddress(value) {
|
|
158
193
|
if (typeof value !== 'string' || value === '')
|
|
159
194
|
return null;
|
|
160
195
|
return IMAGE_ADDRESS_PATTERN.test(value) ? value : null;
|
|
161
196
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
197
|
+
var STROKE_STYLES = ['solid', 'dashed', 'dotted'];
|
|
198
|
+
var LINE_CAPS = ['butt', 'round', 'square'];
|
|
199
|
+
var LINE_JOINS = ['miter', 'round', 'bevel'];
|
|
165
200
|
function readBox(raw) {
|
|
166
201
|
return {
|
|
167
202
|
x: readNumber(raw.x, 0, -MAX_COORDINATE, MAX_COORDINATE),
|
|
@@ -181,9 +216,9 @@ function readPaint(raw, defaults) {
|
|
|
181
216
|
strokeStyle: readOneOf(raw.strokeStyle, STROKE_STYLES, 'solid')
|
|
182
217
|
};
|
|
183
218
|
}
|
|
184
|
-
|
|
219
|
+
var PAINT_FALLBACK = { fill: '#ffffff', stroke: '#374151', strokeWidth: 2 };
|
|
185
220
|
function readId(raw, seen) {
|
|
186
|
-
|
|
221
|
+
var id = typeof raw.id === 'string' && raw.id !== '' && raw.id.length <= 128 ? raw.id : createObjectId();
|
|
187
222
|
// Two objects with the same id would be one on the board: the second gets a new one.
|
|
188
223
|
while (seen.has(id))
|
|
189
224
|
id = createObjectId();
|
|
@@ -194,30 +229,19 @@ function readParentId(raw) {
|
|
|
194
229
|
return typeof raw.parentId === 'string' && raw.parentId !== '' && raw.parentId.length <= 128 ? raw.parentId : null;
|
|
195
230
|
}
|
|
196
231
|
function readRect(raw, id) {
|
|
197
|
-
return createRectObject({
|
|
198
|
-
id,
|
|
199
|
-
parentId: readParentId(raw),
|
|
200
|
-
...readBox(raw),
|
|
201
|
-
...readPaint(raw, PAINT_FALLBACK),
|
|
202
|
-
roundness: readNumber(raw.roundness, 0, 0, 100)
|
|
203
|
-
});
|
|
232
|
+
return createRectObject(__assign(__assign(__assign({ id: id, parentId: readParentId(raw) }, readBox(raw)), readPaint(raw, PAINT_FALLBACK)), { roundness: readNumber(raw.roundness, 0, 0, 100) }));
|
|
204
233
|
}
|
|
205
234
|
function readEllipse(raw, id) {
|
|
206
|
-
return createEllipseObject({
|
|
207
|
-
id,
|
|
208
|
-
parentId: readParentId(raw),
|
|
209
|
-
...readBox(raw),
|
|
210
|
-
...readPaint(raw, PAINT_FALLBACK),
|
|
211
|
-
aspectLocked: readBoolean(raw.aspectLocked, false)
|
|
212
|
-
});
|
|
235
|
+
return createEllipseObject(__assign(__assign(__assign({ id: id, parentId: readParentId(raw) }, readBox(raw)), readPaint(raw, PAINT_FALLBACK)), { aspectLocked: readBoolean(raw.aspectLocked, false) }));
|
|
213
236
|
}
|
|
214
|
-
|
|
237
|
+
var BRUSH_PRESSURES = ['pen', 'speed'];
|
|
215
238
|
/** The line of a brush stroke, or null when there is none to draw: points that are not numbers are dropped, and a long line is cut. */
|
|
216
239
|
function readInk(value) {
|
|
217
240
|
if (!isRecord(value) || !Array.isArray(value.points))
|
|
218
241
|
return null;
|
|
219
|
-
|
|
220
|
-
for (
|
|
242
|
+
var points = [];
|
|
243
|
+
for (var _i = 0, _a = value.points.slice(0, BRUSH_MAX_POINTS); _i < _a.length; _i++) {
|
|
244
|
+
var entry = _a[_i];
|
|
221
245
|
if (!Array.isArray(entry) || typeof entry[0] !== 'number' || typeof entry[1] !== 'number')
|
|
222
246
|
continue;
|
|
223
247
|
if (!Number.isFinite(entry[0]) || !Number.isFinite(entry[1]))
|
|
@@ -230,24 +254,43 @@ function readInk(value) {
|
|
|
230
254
|
}
|
|
231
255
|
if (points.length === 0)
|
|
232
256
|
return null;
|
|
233
|
-
return { points, pressure: readOneOf(value.pressure, BRUSH_PRESSURES, 'speed') };
|
|
257
|
+
return { points: points, pressure: readOneOf(value.pressure, BRUSH_PRESSURES, 'speed') };
|
|
234
258
|
}
|
|
235
259
|
/** The two ends and the bend of an arrow, or null when the record has none that can be read. */
|
|
236
260
|
function readArrowSpec(value) {
|
|
237
261
|
if (!isRecord(value))
|
|
238
262
|
return null;
|
|
239
|
-
|
|
263
|
+
var readPoint = function (entry) {
|
|
240
264
|
if (!Array.isArray(entry) || typeof entry[0] !== 'number' || typeof entry[1] !== 'number')
|
|
241
265
|
return null;
|
|
242
266
|
if (!Number.isFinite(entry[0]) || !Number.isFinite(entry[1]))
|
|
243
267
|
return null;
|
|
244
268
|
return { x: clampNumber(entry[0], -MAX_COORDINATE, MAX_COORDINATE), y: clampNumber(entry[1], -MAX_COORDINATE, MAX_COORDINATE) };
|
|
245
269
|
};
|
|
246
|
-
|
|
247
|
-
|
|
270
|
+
var start = readPoint(value.start);
|
|
271
|
+
var end = readPoint(value.end);
|
|
248
272
|
if (!start || !end)
|
|
249
273
|
return null;
|
|
250
|
-
return { start, end, bend: readNumber(value.bend, 0, -2 * MAX_SIZE, 2 * MAX_SIZE) };
|
|
274
|
+
return withBindings({ start: start, end: end, bend: readNumber(value.bend, 0, -2 * MAX_SIZE, 2 * MAX_SIZE) }, { startBinding: readArrowBinding(value.startBinding), endBinding: readArrowBinding(value.endBinding) });
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* What an end of an arrow is tied to, or null when the record says nothing that can be read: a shape (by its id), and for a point of
|
|
278
|
+
* the outline where on the shape's box (0 to 1 across and down). Whether that shape is on the board is checked once the board is read.
|
|
279
|
+
*/
|
|
280
|
+
function readArrowBinding(value) {
|
|
281
|
+
if (!isRecord(value))
|
|
282
|
+
return null;
|
|
283
|
+
var targetId = typeof value.target === 'string' && value.target !== '' && value.target.length <= 128 ? value.target : null;
|
|
284
|
+
if (!targetId)
|
|
285
|
+
return null;
|
|
286
|
+
if (value.kind === 'center')
|
|
287
|
+
return { targetId: targetId, kind: 'center' };
|
|
288
|
+
if (value.kind !== 'edge' || !Array.isArray(value.anchor))
|
|
289
|
+
return null;
|
|
290
|
+
var _a = value.anchor, across = _a[0], down = _a[1];
|
|
291
|
+
if (typeof across !== 'number' || typeof down !== 'number' || !Number.isFinite(across) || !Number.isFinite(down))
|
|
292
|
+
return null;
|
|
293
|
+
return { targetId: targetId, kind: 'edge', anchor: { x: clampNumber(across, 0, 1), y: clampNumber(down, 0, 1) } };
|
|
251
294
|
}
|
|
252
295
|
/**
|
|
253
296
|
* An arrow drawn from its points. They are in the coordinates of the saved box, which is kept as it is when it holds what is drawn
|
|
@@ -255,54 +298,57 @@ function readArrowSpec(value) {
|
|
|
255
298
|
* where it was in the world. An arrow is upright: a turn the record carries is applied to its points.
|
|
256
299
|
*/
|
|
257
300
|
function arrowFromSpec(spec, box, strokeWidth) {
|
|
258
|
-
|
|
301
|
+
var _a, _b;
|
|
302
|
+
var start = spec.start, end = spec.end;
|
|
303
|
+
// What its ends are tied to is not a place on the board: it needs no turn.
|
|
304
|
+
var tiesOfSpec = { startBinding: (_a = spec.startBinding) !== null && _a !== void 0 ? _a : null, endBinding: (_b = spec.endBinding) !== null && _b !== void 0 ? _b : null };
|
|
259
305
|
if (box.rotation !== 0) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
x:
|
|
267
|
-
y:
|
|
268
|
-
});
|
|
306
|
+
var radians = degreesToRadians(box.rotation);
|
|
307
|
+
var cosine_1 = Math.cos(radians);
|
|
308
|
+
var sine_1 = Math.sin(radians);
|
|
309
|
+
var centerX_1 = box.width / 2;
|
|
310
|
+
var centerY_1 = box.height / 2;
|
|
311
|
+
var turn = function (point) { return ({
|
|
312
|
+
x: centerX_1 + (point.x - centerX_1) * cosine_1 - (point.y - centerY_1) * sine_1,
|
|
313
|
+
y: centerY_1 + (point.x - centerX_1) * sine_1 + (point.y - centerY_1) * cosine_1
|
|
314
|
+
}); };
|
|
269
315
|
start = turn(start);
|
|
270
316
|
end = turn(end);
|
|
271
317
|
}
|
|
272
|
-
|
|
273
|
-
|
|
318
|
+
var geometry = buildArrow(start, end, spec.bend, strokeWidth);
|
|
319
|
+
var holdsWhatIsDrawn = box.rotation === 0 &&
|
|
274
320
|
Math.abs(geometry.box.x) <= 0.5 &&
|
|
275
321
|
Math.abs(geometry.box.y) <= 0.5 &&
|
|
276
322
|
Math.abs(geometry.box.width - box.width) <= 0.5 &&
|
|
277
323
|
Math.abs(geometry.box.height - box.height) <= 0.5;
|
|
278
324
|
if (holdsWhatIsDrawn) {
|
|
279
325
|
// In the frame of the points, which is the frame of the saved box: the path comes back in the frame of its own bounds.
|
|
280
|
-
|
|
281
|
-
return { d: serializePathData(commands), arrow: { start, end, bend: geometry.spec.bend }, box };
|
|
326
|
+
var commands = translatePathCommands(geometry.commands, geometry.box.x, geometry.box.y);
|
|
327
|
+
return { d: serializePathData(commands), arrow: withBindings({ start: start, end: end, bend: geometry.spec.bend }, tiesOfSpec), box: box };
|
|
282
328
|
}
|
|
283
329
|
return {
|
|
284
330
|
d: serializePathData(geometry.commands),
|
|
285
|
-
arrow: geometry.spec,
|
|
286
|
-
box: {
|
|
331
|
+
arrow: withBindings(geometry.spec, tiesOfSpec),
|
|
332
|
+
box: __assign(__assign({}, box), { rotation: 0, x: box.x + geometry.box.x, y: box.y + geometry.box.y, width: geometry.box.width, height: geometry.box.height })
|
|
287
333
|
};
|
|
288
334
|
}
|
|
289
335
|
function readPath(raw, id, index, warnings) {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
336
|
+
var paint = readPaint(raw, { fill: 'transparent', stroke: '#1f2937', strokeWidth: 3 });
|
|
337
|
+
var ink = readInk(raw.ink);
|
|
338
|
+
var shape = readNullableString(raw.shape, 100);
|
|
339
|
+
var box = readBox(raw);
|
|
294
340
|
// An arrow has no outline of its own in the file either: it is drawn from its points. A board saved before arrows had points
|
|
295
341
|
// has the outline only, and its arrow is found in that.
|
|
296
|
-
|
|
342
|
+
var arrowSpec = ink ? null : readArrowSpec(raw.arrow);
|
|
297
343
|
if (!ink && !arrowSpec && shape === 'arrow' && typeof raw.d === 'string' && raw.d.length <= MAX_PATH_DATA_LENGTH) {
|
|
298
|
-
|
|
344
|
+
var legacy = arrowPointsOfLegacyPath(parsePathData(raw.d));
|
|
299
345
|
if (legacy)
|
|
300
|
-
arrowSpec = {
|
|
346
|
+
arrowSpec = __assign(__assign({}, legacy), { bend: 0 });
|
|
301
347
|
}
|
|
302
|
-
|
|
303
|
-
|
|
348
|
+
var arrow = null;
|
|
349
|
+
var d;
|
|
304
350
|
if (arrowSpec) {
|
|
305
|
-
|
|
351
|
+
var drawn = arrowFromSpec(arrowSpec, box, paint.strokeWidth);
|
|
306
352
|
d = drawn.d;
|
|
307
353
|
arrow = drawn.arrow;
|
|
308
354
|
box = drawn.box;
|
|
@@ -312,93 +358,45 @@ function readPath(raw, id, index, warnings) {
|
|
|
312
358
|
d = ink ? brushOutlineData(ink, paint.strokeWidth) : typeof raw.d === 'string' ? raw.d : '';
|
|
313
359
|
}
|
|
314
360
|
if (d.length === 0 || d.length > MAX_PATH_DATA_LENGTH || parsePathData(d).length < 2) {
|
|
315
|
-
warnings.push({ code: 'bad-path', index, detail: 'The outline of the shape is missing or cannot be read.' });
|
|
361
|
+
warnings.push({ code: 'bad-path', index: index, detail: 'The outline of the shape is missing or cannot be read.' });
|
|
316
362
|
return null;
|
|
317
363
|
}
|
|
318
|
-
return createPathObject({
|
|
319
|
-
id,
|
|
320
|
-
parentId: readParentId(raw),
|
|
321
|
-
...box,
|
|
322
|
-
...paint,
|
|
323
|
-
d,
|
|
324
|
-
shape,
|
|
325
|
-
roundness: readNumber(raw.roundness, 0, 0, 100),
|
|
326
|
-
aspectLocked: readBoolean(raw.aspectLocked, false),
|
|
327
|
-
flipX: readBoolean(raw.flipX, false),
|
|
328
|
-
flipY: readBoolean(raw.flipY, false),
|
|
329
|
-
lineCap: readOneOf(raw.lineCap, LINE_CAPS, 'round'),
|
|
330
|
-
lineJoin: readOneOf(raw.lineJoin, LINE_JOINS, 'round'),
|
|
331
|
-
ink,
|
|
332
|
-
arrow
|
|
333
|
-
});
|
|
364
|
+
return createPathObject(__assign(__assign(__assign({ id: id, parentId: readParentId(raw) }, box), paint), { d: d, shape: shape, roundness: readNumber(raw.roundness, 0, 0, 100), aspectLocked: readBoolean(raw.aspectLocked, false), flipX: readBoolean(raw.flipX, false), flipY: readBoolean(raw.flipY, false), lineCap: readOneOf(raw.lineCap, LINE_CAPS, 'round'), lineJoin: readOneOf(raw.lineJoin, LINE_JOINS, 'round'), ink: ink, arrow: arrow }));
|
|
334
365
|
}
|
|
335
366
|
function readText(raw, id) {
|
|
336
|
-
return createTextObject({
|
|
337
|
-
id,
|
|
338
|
-
parentId: readParentId(raw),
|
|
339
|
-
...readBox(raw),
|
|
340
|
-
text: readString(raw.text, '', MAX_TEXT_LENGTH),
|
|
341
|
-
color: readColor(raw.color, TEXT_DEFAULTS.color),
|
|
342
|
-
fontSize: readNumber(raw.fontSize, TEXT_DEFAULTS.fontSize, 4, 600),
|
|
343
|
-
fontFamily: readFontFamily(raw.fontFamily),
|
|
344
|
-
fontWeight: readOneOf(raw.fontWeight, ['normal', 'bold'], 'normal'),
|
|
345
|
-
fontStyle: readOneOf(raw.fontStyle, ['normal', 'italic'], 'normal'),
|
|
346
|
-
underline: readBoolean(raw.underline, false),
|
|
347
|
-
align: readOneOf(raw.align, ['left', 'center', 'right'], 'left'),
|
|
348
|
-
lineHeight: readNumber(raw.lineHeight, 1.2, 0.5, 4),
|
|
349
|
-
padding: readNumber(raw.padding, 0, 0, 200),
|
|
350
|
-
backgroundColor: readColor(raw.backgroundColor, 'transparent'),
|
|
351
|
-
autoWidth: readBoolean(raw.autoWidth, true)
|
|
352
|
-
});
|
|
367
|
+
return createTextObject(__assign(__assign({ id: id, parentId: readParentId(raw) }, readBox(raw)), { text: readString(raw.text, '', MAX_TEXT_LENGTH), color: readColor(raw.color, TEXT_DEFAULTS.color), fontSize: readNumber(raw.fontSize, TEXT_DEFAULTS.fontSize, 4, 600), fontFamily: readFontFamily(raw.fontFamily), fontWeight: readOneOf(raw.fontWeight, ['normal', 'bold'], 'normal'), fontStyle: readOneOf(raw.fontStyle, ['normal', 'italic'], 'normal'), underline: readBoolean(raw.underline, false), align: readOneOf(raw.align, ['left', 'center', 'right'], 'left'), lineHeight: readNumber(raw.lineHeight, 1.2, 0.5, 4), padding: readNumber(raw.padding, 0, 0, 200), backgroundColor: readColor(raw.backgroundColor, 'transparent'), autoWidth: readBoolean(raw.autoWidth, true) }));
|
|
353
368
|
}
|
|
354
369
|
function readImage(raw, id) {
|
|
355
|
-
return createImageObject({
|
|
356
|
-
id,
|
|
357
|
-
parentId: readParentId(raw),
|
|
358
|
-
...readBox(raw),
|
|
359
|
-
src: readImageAddress(raw.src),
|
|
360
|
-
imageRef: readNullableString(raw.imageRef, 200),
|
|
361
|
-
fileName: readNullableString(raw.fileName, 300),
|
|
362
|
-
naturalWidth: readNumber(raw.naturalWidth, 0, 0, MAX_SIZE),
|
|
363
|
-
naturalHeight: readNumber(raw.naturalHeight, 0, 0, MAX_SIZE)
|
|
364
|
-
});
|
|
370
|
+
return createImageObject(__assign(__assign({ id: id, parentId: readParentId(raw) }, readBox(raw)), { src: readImageAddress(raw.src), imageRef: readNullableString(raw.imageRef, 200), fileName: readNullableString(raw.fileName, 300), naturalWidth: readNumber(raw.naturalWidth, 0, 0, MAX_SIZE), naturalHeight: readNumber(raw.naturalHeight, 0, 0, MAX_SIZE) }));
|
|
365
371
|
}
|
|
366
372
|
function readWidget(raw, id, index, warnings) {
|
|
373
|
+
var _a;
|
|
367
374
|
// The creator reads `_widgetId`; the canvas's own key is `widgetId`. Either names the widget.
|
|
368
|
-
|
|
375
|
+
var widgetId = (_a = readNullableString(raw.widgetId, 200)) !== null && _a !== void 0 ? _a : readNullableString(raw[HOST_READABLE_KEYS.widgetId], 200);
|
|
369
376
|
if (!widgetId) {
|
|
370
|
-
warnings.push({ code: 'bad-object', index, detail: 'A widget card has no widget id.' });
|
|
377
|
+
warnings.push({ code: 'bad-object', index: index, detail: 'A widget card has no widget id.' });
|
|
371
378
|
return null;
|
|
372
379
|
}
|
|
373
|
-
return createWidgetObject({
|
|
374
|
-
id,
|
|
375
|
-
widgetId,
|
|
376
|
-
parentId: readParentId(raw),
|
|
377
|
-
...readBox(raw),
|
|
378
|
-
widgetName: readNullableString(raw.widgetName, 300),
|
|
379
|
-
isPrimary: readBoolean(raw.isPrimary, false),
|
|
380
|
-
thumbnail: readImageAddress(raw.thumbnail),
|
|
381
|
-
thumbnailRef: readNullableString(raw.thumbnailRef, 200)
|
|
382
|
-
});
|
|
380
|
+
return createWidgetObject(__assign(__assign({ id: id, widgetId: widgetId, parentId: readParentId(raw) }, readBox(raw)), { widgetName: readNullableString(raw.widgetName, 300), isPrimary: readBoolean(raw.isPrimary, false), thumbnail: readImageAddress(raw.thumbnail), thumbnailRef: readNullableString(raw.thumbnailRef, 200) }));
|
|
383
381
|
}
|
|
384
382
|
function readGroup(raw, id) {
|
|
385
|
-
return createGroupObject({ id, parentId: readParentId(raw) });
|
|
383
|
+
return createGroupObject({ id: id, parentId: readParentId(raw) });
|
|
386
384
|
}
|
|
387
385
|
function readObject(raw, index, seen, warnings) {
|
|
388
386
|
if (!isRecord(raw)) {
|
|
389
|
-
warnings.push({ code: 'bad-object', index, detail: 'An entry of the list is not an object.' });
|
|
387
|
+
warnings.push({ code: 'bad-object', index: index, detail: 'An entry of the list is not an object.' });
|
|
390
388
|
return null;
|
|
391
389
|
}
|
|
392
390
|
// Readers outside the canvas treat these as "not there": so does the canvas.
|
|
393
391
|
if (raw[HOST_READABLE_KEYS.visible] === false || raw[HOST_READABLE_KEYS.excludeFromExport] === true)
|
|
394
392
|
return null;
|
|
395
|
-
|
|
396
|
-
|
|
393
|
+
var type = raw[HOST_READABLE_KEYS.objectType];
|
|
394
|
+
var known = ['rect', 'ellipse', 'path', 'text', 'image', 'widget', 'group'];
|
|
397
395
|
if (typeof type !== 'string' || !known.includes(type)) {
|
|
398
|
-
warnings.push({ code: 'unknown-type', index, detail: typeof type === 'string' ? type : String(type) });
|
|
396
|
+
warnings.push({ code: 'unknown-type', index: index, detail: typeof type === 'string' ? type : String(type) });
|
|
399
397
|
return null;
|
|
400
398
|
}
|
|
401
|
-
|
|
399
|
+
var id = readId(raw, seen);
|
|
402
400
|
switch (type) {
|
|
403
401
|
case 'rect':
|
|
404
402
|
return readRect(raw, id);
|
|
@@ -416,27 +414,28 @@ function readObject(raw, index, seen, warnings) {
|
|
|
416
414
|
return readGroup(raw, id);
|
|
417
415
|
}
|
|
418
416
|
}
|
|
419
|
-
|
|
417
|
+
var EMPTY_VIEWPORT = { x: 0, y: 0, zoom: 1 };
|
|
420
418
|
/**
|
|
421
419
|
* Reads a saved canvas: the text `serializeCanvasDocument` wrote, or the same thing already parsed.
|
|
422
420
|
* Never throws.
|
|
423
421
|
*/
|
|
424
422
|
export function parseCanvasDocument(input) {
|
|
425
|
-
|
|
426
|
-
|
|
423
|
+
var _a;
|
|
424
|
+
var warnings = [];
|
|
425
|
+
var nothing = function (status) { return ({
|
|
427
426
|
scene: [],
|
|
428
|
-
viewport: {
|
|
429
|
-
status,
|
|
430
|
-
warnings
|
|
431
|
-
});
|
|
427
|
+
viewport: __assign({}, EMPTY_VIEWPORT),
|
|
428
|
+
status: status,
|
|
429
|
+
warnings: warnings
|
|
430
|
+
}); };
|
|
432
431
|
if (input === null || input === undefined || (typeof input === 'string' && input.trim() === ''))
|
|
433
432
|
return nothing('empty');
|
|
434
|
-
|
|
433
|
+
var document = input;
|
|
435
434
|
if (typeof input === 'string') {
|
|
436
435
|
try {
|
|
437
436
|
document = JSON.parse(input);
|
|
438
437
|
}
|
|
439
|
-
catch {
|
|
438
|
+
catch (_b) {
|
|
440
439
|
warnings.push({ code: 'not-json' });
|
|
441
440
|
return nothing('invalid');
|
|
442
441
|
}
|
|
@@ -446,26 +445,27 @@ export function parseCanvasDocument(input) {
|
|
|
446
445
|
return nothing('invalid');
|
|
447
446
|
}
|
|
448
447
|
if (document.version !== CANVAS_DOCUMENT_VERSION) {
|
|
449
|
-
warnings.push({ code: 'unsupported-version', detail: String(document.version
|
|
448
|
+
warnings.push({ code: 'unsupported-version', detail: String((_a = document.version) !== null && _a !== void 0 ? _a : 'none') });
|
|
450
449
|
return nothing('unsupported');
|
|
451
450
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
451
|
+
var canvas = document.canvas;
|
|
452
|
+
var list = isRecord(canvas) && Array.isArray(canvas.objects) ? canvas.objects : [];
|
|
453
|
+
var limited = list.length > MAX_OBJECTS_PER_DOCUMENT ? list.slice(0, MAX_OBJECTS_PER_DOCUMENT) : list;
|
|
455
454
|
if (limited.length < list.length) {
|
|
456
|
-
warnings.push({ code: 'too-many-objects', detail:
|
|
455
|
+
warnings.push({ code: 'too-many-objects', detail: "".concat(list.length, " objects, the first ").concat(limited.length, " were read.") });
|
|
457
456
|
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
limited.forEach((raw, index)
|
|
461
|
-
|
|
457
|
+
var seen = new Set();
|
|
458
|
+
var objects = [];
|
|
459
|
+
limited.forEach(function (raw, index) {
|
|
460
|
+
var object = readObject(raw, index, seen, warnings);
|
|
462
461
|
if (object)
|
|
463
462
|
objects.push(object);
|
|
464
463
|
});
|
|
465
464
|
return {
|
|
466
|
-
|
|
465
|
+
// An arrow tied to a shape that is not on the board (a text edited by hand, an object that was not understood) is let go.
|
|
466
|
+
scene: dropDanglingBindings(normalizeScene(objects)),
|
|
467
467
|
viewport: sanitizeViewport(document.viewport),
|
|
468
468
|
status: 'ok',
|
|
469
|
-
warnings
|
|
469
|
+
warnings: warnings
|
|
470
470
|
};
|
|
471
471
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* accepts them, and `tests/engine/codec.test.mjs` fails if either changes. Every other key of the format
|
|
10
10
|
* is the canvas's own and can change with a version.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export var HOST_READABLE_KEYS = Object.freeze({
|
|
13
13
|
/** `document.canvas.objects`: always an array. Readers fall back to `document.objects` for a bare list. */
|
|
14
14
|
documentObjects: Object.freeze(['canvas', 'objects']),
|
|
15
15
|
/** The kind of an object: a string. */
|