@widgetic/canvas 0.5.41 → 0.5.43
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 +1 -0
- package/dist/canvas/DomCanvas.svelte +49 -20
- package/dist/canvas/DomCanvas.svelte.d.ts +13 -7
- package/dist/canvas/autosaveScheduler.js +37 -89
- package/dist/canvas/boardFrame.js +1 -1
- package/dist/canvas/boardSurface.js +1 -1
- package/dist/canvas/canvasLogger.js +7 -19
- package/dist/canvas/chromeLayout.d.ts +14 -3
- package/dist/canvas/chromeLayout.js +30 -20
- package/dist/canvas/eventScope.js +10 -14
- package/dist/canvas/host/CanvasHost.d.ts +47 -5
- package/dist/canvas/host/CanvasHost.js +1481 -1566
- package/dist/canvas/host/CanvasHostApi.js +4 -19
- package/dist/canvas/host/browserServices.js +65 -116
- package/dist/canvas/host/conversion.js +82 -170
- package/dist/canvas/host/hostObject.js +7 -7
- package/dist/canvas/host/nearCards.d.ts +33 -0
- package/dist/canvas/host/nearCards.js +78 -0
- package/dist/canvas/host/pageEvents.d.ts +16 -4
- package/dist/canvas/host/pageEvents.js +17 -8
- package/dist/canvas/host/pictureSaves.d.ts +33 -0
- package/dist/canvas/host/pictureSaves.js +42 -0
- package/dist/canvas/host/screenRects.d.ts +5 -0
- package/dist/canvas/host/screenRects.js +28 -31
- package/dist/canvas/host/storedPictures.d.ts +88 -0
- package/dist/canvas/host/storedPictures.js +288 -0
- package/dist/canvas/host/strokeSnap.js +88 -143
- package/dist/canvas/index.d.ts +1 -1
- package/dist/canvas/index.js +1 -1
- package/dist/canvas/openMarks.js +2 -2
- package/dist/canvas/outsideClickDeselect.js +6 -7
- package/dist/canvas/panZoomPosition.js +2 -2
- package/dist/canvas/preferredTextFont.js +13 -25
- package/dist/canvas/shapes/ShapeLibrary.js +138 -148
- package/dist/canvas/shapes/shapeImageStore.d.ts +45 -2
- package/dist/canvas/shapes/shapeImageStore.js +10 -3
- package/dist/canvas/shapes/strokeShapeSnap.js +188 -233
- package/dist/canvas/toolbarPosition.d.ts +2 -2
- package/dist/canvas/toolbarPosition.js +4 -4
- package/dist/canvas/ui/SelectionPanel.svelte +28 -5
- package/dist/canvas/ui/SelectionPanel.svelte.d.ts +7 -0
- package/dist/canvas/ui/SelectorIndicator.svelte +81 -0
- package/dist/canvas/ui/SelectorIndicator.svelte.d.ts +11 -0
- package/dist/canvas/ui/ToolButton.svelte +8 -2
- package/dist/canvas/ui/colorModel.js +21 -32
- package/dist/canvas/ui/colorPickerMessages.js +5 -5
- package/dist/canvas/ui/floatingCard.d.ts +2 -2
- package/dist/canvas/ui/floatingCard.js +20 -20
- package/dist/canvas/ui/floatingLayer.d.ts +13 -2
- package/dist/canvas/ui/floatingLayer.js +18 -7
- package/dist/canvas/ui/keyHints.js +9 -11
- package/dist/canvas/ui/popoverSide.js +2 -3
- package/dist/canvas/ui/selectionTraits.js +34 -40
- package/dist/canvas/view/CanvasStage.svelte +101 -67
- package/dist/canvas/view/LeftToRightScope.svelte +21 -0
- package/dist/canvas/view/LeftToRightScope.svelte.d.ts +7 -0
- package/dist/canvas/view/ObjectView.svelte +15 -10
- package/dist/canvas/view/ObjectView.svelte.d.ts +1 -1
- package/dist/canvas/view/erasingMarks.js +7 -7
- package/dist/canvas/view/geometry.js +71 -90
- package/dist/canvas/view/liftedScene.d.ts +31 -0
- package/dist/canvas/view/liftedScene.js +146 -0
- package/dist/canvas/view/mountedScene.d.ts +71 -0
- package/dist/canvas/view/mountedScene.js +363 -0
- package/dist/components/preferenceStorage.js +2 -2
- package/dist/engine/EngineCore.d.ts +15 -1
- package/dist/engine/EngineCore.js +724 -797
- package/dist/engine/codec/canvasDocument.d.ts +5 -0
- package/dist/engine/codec/canvasDocument.js +212 -149
- package/dist/engine/codec/hostReadableKeys.js +1 -1
- package/dist/engine/core/arrange.js +26 -38
- package/dist/engine/core/arrow.js +76 -89
- package/dist/engine/core/arrowBinding.js +98 -116
- package/dist/engine/core/arrowBindingRecords.js +23 -38
- package/dist/engine/core/brush.js +67 -94
- package/dist/engine/core/defaults.js +90 -51
- package/dist/engine/core/freehand.js +147 -163
- package/dist/engine/core/geometry.js +47 -54
- package/dist/engine/core/history.d.ts +6 -0
- package/dist/engine/core/history.js +49 -50
- package/dist/engine/core/hitTest.js +68 -81
- package/dist/engine/core/matrix.js +18 -20
- package/dist/engine/core/pathData.js +183 -210
- package/dist/engine/core/rotationReset.js +5 -6
- package/dist/engine/core/scene.d.ts +10 -0
- package/dist/engine/core/scene.js +153 -187
- package/dist/engine/core/scribble.js +59 -84
- package/dist/engine/core/shapePaths.js +12 -15
- package/dist/engine/core/shapeTools.js +72 -63
- package/dist/engine/core/snapping.js +65 -117
- package/dist/engine/core/style.js +31 -64
- package/dist/engine/core/transform.js +83 -94
- package/dist/engine/core/types.d.ts +8 -2
- package/dist/engine/core/types.js +4 -4
- package/dist/engine/core/viewport.js +23 -36
- package/dist/engine/input/PointerController.js +467 -474
- package/dist/engine/input/arrowHandles.js +12 -12
- package/dist/engine/input/gestures.js +265 -309
- package/dist/engine/input/hoverCursor.js +1 -1
- package/dist/engine/input/keyboard.js +27 -30
- package/dist/engine/input/selectionHandles.js +45 -50
- package/dist/engine/input/types.js +1 -1
- package/dist/engine/render/rasterize.js +86 -158
- package/dist/engine/state.d.ts +20 -0
- package/dist/engine/state.js +5 -15
- package/dist/engine/text/layoutText.js +43 -62
- package/dist/engine/text/textMetrics.js +8 -10
- package/dist/engine/widgets.js +101 -137
- package/dist/fonts/interFont.d.ts +10 -1
- package/dist/fonts/interFont.js +47 -75
- package/dist/fonts/workspaceFonts.js +32 -90
- package/dist/i18n/labels.js +4 -4
- package/dist/i18n/language.d.ts +3 -3
- package/dist/i18n/language.js +4 -4
- package/dist/i18n/messages.d.ts +8 -1
- package/dist/i18n/messages.js +10 -2
- package/dist/i18n/shortcuts.js +14 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/settings/workspaceToolSettings.js +32 -48
- package/dist/tools/components/catalog.js +64 -74
- package/dist/tools/components/grouping.js +6 -28
- package/dist/tools/definitions.js +5 -5
- package/dist/tools/executors.js +105 -141
- package/dist/tools/hostAdapter.js +11 -13
- package/dist/tools/sceneSummary.js +43 -57
- package/dist/tools/sketchIntent.js +13 -21
- package/dist/tools/types.js +1 -1
- package/package.json +1 -1
- package/dist/canvas/ui/SelectorBar.svelte +0 -84
- package/dist/canvas/ui/SelectorBar.svelte.d.ts +0 -12
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { CHROME_ANCHORS, normalizeAnchor } from './chromeLayout.js';
|
|
10
10
|
/** The places the zoom control can stand: `TL TC TR` (top), `CL CR` (the sides) and `BL BC BR` (bottom). */
|
|
11
|
-
export
|
|
12
|
-
export
|
|
11
|
+
export const PAN_ZOOM_POSITIONS = CHROME_ANCHORS;
|
|
12
|
+
export const DEFAULT_PAN_ZOOM_POSITION = 'BL';
|
|
13
13
|
/** The position to use for what a page passed: anything that is not one of the eight is the default. */
|
|
14
14
|
export function normalizePanZoomPosition(value) {
|
|
15
15
|
return normalizeAnchor(value, DEFAULT_PAN_ZOOM_POSITION);
|
|
@@ -2,18 +2,9 @@
|
|
|
2
2
|
* The font family a person chose for a text, kept in the canvas's preference store (the browser's `localStorage`, or the
|
|
3
3
|
* store a partner page installed with `setCanvasPreferenceStorage`), so that the next text they place starts with it.
|
|
4
4
|
*/
|
|
5
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
6
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
7
|
-
if (ar || !(i in from)) {
|
|
8
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
9
|
-
ar[i] = from[i];
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
13
|
-
};
|
|
14
5
|
import { getCanvasPreferenceStorage } from '../components/preferenceStorage.js';
|
|
15
6
|
/** The font families the selection panel offers for a text, in the order of its list. */
|
|
16
|
-
export
|
|
7
|
+
export const TEXT_FONT_FAMILIES = [
|
|
17
8
|
'Inter',
|
|
18
9
|
'Comic Sans MS',
|
|
19
10
|
'Arial',
|
|
@@ -25,50 +16,47 @@ export var TEXT_FONT_FAMILIES = [
|
|
|
25
16
|
'Impact'
|
|
26
17
|
];
|
|
27
18
|
/** Families added from the workspace brand kit (not persisted in this list; merged in the panel). */
|
|
28
|
-
|
|
19
|
+
let workspaceFontFamilies = [];
|
|
29
20
|
export function setWorkspaceFontFamilies(families) {
|
|
30
|
-
workspaceFontFamilies =
|
|
21
|
+
workspaceFontFamilies = [...new Set(families.filter(Boolean))];
|
|
31
22
|
}
|
|
32
23
|
export function fontFamiliesForPicker() {
|
|
33
|
-
|
|
34
|
-
for (
|
|
35
|
-
var family = workspaceFontFamilies_1[_i];
|
|
24
|
+
const merged = [...TEXT_FONT_FAMILIES];
|
|
25
|
+
for (const family of workspaceFontFamilies) {
|
|
36
26
|
if (!merged.includes(family))
|
|
37
27
|
merged.push(family);
|
|
38
28
|
}
|
|
39
29
|
return merged;
|
|
40
30
|
}
|
|
41
31
|
/** Inter + Comic Sans for the picker’s “Default fonts” group. */
|
|
42
|
-
export
|
|
32
|
+
export const PRIMARY_CANVAS_FONT_FAMILIES = ['Inter', 'Comic Sans MS'];
|
|
43
33
|
export function builtInFontFamiliesForPicker() {
|
|
44
|
-
return TEXT_FONT_FAMILIES.filter(
|
|
34
|
+
return TEXT_FONT_FAMILIES.filter((family) => !PRIMARY_CANVAS_FONT_FAMILIES.includes(family));
|
|
45
35
|
}
|
|
46
36
|
export function workspaceFontFamiliesForPicker() {
|
|
47
|
-
return
|
|
37
|
+
return [...workspaceFontFamilies];
|
|
48
38
|
}
|
|
49
39
|
/** The key the choice is kept under. */
|
|
50
|
-
export
|
|
40
|
+
export const PREFERRED_TEXT_FONT_STORAGE_KEY = 'widgetic-canvas:preferred-text-font';
|
|
51
41
|
/** The font family kept from an earlier choice, or null when none was made (or the store refuses, or the name is no longer offered). */
|
|
52
42
|
export function readPreferredTextFontFamily() {
|
|
53
|
-
var _a;
|
|
54
43
|
try {
|
|
55
|
-
|
|
44
|
+
const stored = getCanvasPreferenceStorage()?.getItem(PREFERRED_TEXT_FONT_STORAGE_KEY);
|
|
56
45
|
return stored && fontFamiliesForPicker().includes(stored) ? stored : null;
|
|
57
46
|
}
|
|
58
|
-
catch
|
|
47
|
+
catch {
|
|
59
48
|
// A store that blocks reading is the same as a store with nothing in it.
|
|
60
49
|
return null;
|
|
61
50
|
}
|
|
62
51
|
}
|
|
63
52
|
/** Keeps the choice for the next text. A store that refuses the write is not an error: the choice then lasts until the page closes. */
|
|
64
53
|
export function writePreferredTextFontFamily(fontFamily) {
|
|
65
|
-
var _a;
|
|
66
54
|
if (!fontFamiliesForPicker().includes(fontFamily))
|
|
67
55
|
return;
|
|
68
56
|
try {
|
|
69
|
-
|
|
57
|
+
getCanvasPreferenceStorage()?.setItem(PREFERRED_TEXT_FONT_STORAGE_KEY, fontFamily);
|
|
70
58
|
}
|
|
71
|
-
catch
|
|
59
|
+
catch {
|
|
72
60
|
// Nothing to do: the engine still holds the choice for this session.
|
|
73
61
|
}
|
|
74
62
|
}
|