orio-ui 1.20.0 → 1.23.3
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 +12 -5
- package/dist/module.json +1 -1
- package/dist/module.mjs +5 -2
- package/dist/runtime/canvas.d.ts +21 -0
- package/dist/runtime/canvas.js +52 -0
- package/dist/runtime/components/Canvas/REQUIREMENTS.md +174 -0
- package/dist/runtime/components/Canvas/components/Stage.d.vue.ts +3 -0
- package/dist/runtime/components/Canvas/components/Stage.vue +150 -0
- package/dist/runtime/components/Canvas/components/Stage.vue.d.ts +3 -0
- package/dist/runtime/components/Canvas/components/ToolButton.d.vue.ts +24 -0
- package/dist/runtime/components/Canvas/components/ToolButton.vue +62 -0
- package/dist/runtime/components/Canvas/components/ToolButton.vue.d.ts +24 -0
- package/dist/runtime/components/Canvas/components/Toolbar.d.vue.ts +24 -0
- package/dist/runtime/components/Canvas/components/Toolbar.vue +48 -0
- package/dist/runtime/components/Canvas/components/Toolbar.vue.d.ts +24 -0
- package/dist/runtime/components/Canvas/composables/useCanvasHistory.d.ts +17 -0
- package/dist/runtime/components/Canvas/composables/useCanvasHistory.js +76 -0
- package/dist/runtime/components/Canvas/composables/useCanvasNodes.d.ts +13 -0
- package/dist/runtime/components/Canvas/composables/useCanvasNodes.js +60 -0
- package/dist/runtime/components/Canvas/composables/useCanvasSetup.d.ts +5 -0
- package/dist/runtime/components/Canvas/composables/useCanvasSetup.js +19 -0
- package/dist/runtime/components/Canvas/context.d.ts +47 -0
- package/dist/runtime/components/Canvas/context.js +11 -0
- package/dist/runtime/components/Canvas/index.d.vue.ts +80 -0
- package/dist/runtime/components/Canvas/index.vue +225 -0
- package/dist/runtime/components/Canvas/index.vue.d.ts +80 -0
- package/dist/runtime/components/Canvas/registry.d.ts +1 -0
- package/dist/runtime/components/Canvas/registry.js +2 -0
- package/dist/runtime/components/Canvas/tools/ColorPickerWidget.d.vue.ts +7 -0
- package/dist/runtime/components/Canvas/tools/ColorPickerWidget.vue +32 -0
- package/dist/runtime/components/Canvas/tools/ColorPickerWidget.vue.d.ts +7 -0
- package/dist/runtime/components/Canvas/tools/clearTool.d.ts +1 -0
- package/dist/runtime/components/Canvas/tools/clearTool.js +16 -0
- package/dist/runtime/components/Canvas/tools/colorPickerTool.d.ts +6 -0
- package/dist/runtime/components/Canvas/tools/colorPickerTool.js +15 -0
- package/dist/runtime/components/Canvas/tools/drawTool.d.ts +16 -0
- package/dist/runtime/components/Canvas/tools/drawTool.js +92 -0
- package/dist/runtime/components/Canvas/tools/eraseTool.d.ts +5 -0
- package/dist/runtime/components/Canvas/tools/eraseTool.js +62 -0
- package/dist/runtime/components/Canvas/tools/exportTool.d.ts +65 -0
- package/dist/runtime/components/Canvas/tools/exportTool.js +136 -0
- package/dist/runtime/components/Canvas/tools/highlightTool.d.ts +11 -0
- package/dist/runtime/components/Canvas/tools/highlightTool.js +51 -0
- package/dist/runtime/components/Canvas/tools/hitTest.d.ts +20 -0
- package/dist/runtime/components/Canvas/tools/hitTest.js +111 -0
- package/dist/runtime/components/Canvas/tools/imageTool.d.ts +18 -0
- package/dist/runtime/components/Canvas/tools/imageTool.js +163 -0
- package/dist/runtime/components/Canvas/tools/moveTool.d.ts +5 -0
- package/dist/runtime/components/Canvas/tools/moveTool.js +94 -0
- package/dist/runtime/components/Canvas/tools/redoTool.d.ts +1 -0
- package/dist/runtime/components/Canvas/tools/redoTool.js +17 -0
- package/dist/runtime/components/Canvas/tools/resizeTool.d.ts +7 -0
- package/dist/runtime/components/Canvas/tools/resizeTool.js +132 -0
- package/dist/runtime/components/Canvas/tools/rotateTool.d.ts +5 -0
- package/dist/runtime/components/Canvas/tools/rotateTool.js +109 -0
- package/dist/runtime/components/Canvas/tools/textTool.d.ts +14 -0
- package/dist/runtime/components/Canvas/tools/textTool.js +99 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Clear.d.vue.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Clear.vue +12 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Clear.vue.d.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Draw.d.vue.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Draw.vue +12 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Draw.vue.d.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Erase.d.vue.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Erase.vue +12 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Erase.vue.d.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Export.d.vue.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Export.vue +13 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Export.vue.d.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Highlight.d.vue.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Highlight.vue +12 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Highlight.vue.d.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Image.d.vue.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Image.vue +13 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Image.vue.d.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Move.d.vue.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Move.vue +13 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Move.vue.d.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Redo.d.vue.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Redo.vue +13 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Redo.vue.d.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Resize.d.vue.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Resize.vue +13 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Resize.vue.d.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Rotate.d.vue.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Rotate.vue +13 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Rotate.vue.d.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Text.d.vue.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Text.vue +13 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Text.vue.d.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Transform.d.vue.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Transform.vue +14 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Transform.vue.d.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Undo.d.vue.ts +3 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Undo.vue +13 -0
- package/dist/runtime/components/Canvas/tools/tooltips/Undo.vue.d.ts +3 -0
- package/dist/runtime/components/Canvas/tools/transformHandles.d.ts +74 -0
- package/dist/runtime/components/Canvas/tools/transformHandles.js +191 -0
- package/dist/runtime/components/Canvas/tools/transformTool.d.ts +7 -0
- package/dist/runtime/components/Canvas/tools/transformTool.js +210 -0
- package/dist/runtime/components/Canvas/tools/undoTool.d.ts +1 -0
- package/dist/runtime/components/Canvas/tools/undoTool.js +17 -0
- package/dist/runtime/components/Canvas/types.d.ts +125 -0
- package/dist/runtime/components/Canvas/types.js +3 -0
- package/dist/runtime/components/ControlElement.vue +5 -1
- package/dist/runtime/components/DateRangePicker.vue +16 -4
- package/dist/runtime/components/Icon.vue +2 -2
- package/dist/runtime/components/LocaleSwitcher.d.vue.ts +13 -0
- package/dist/runtime/components/LocaleSwitcher.vue +43 -0
- package/dist/runtime/components/LocaleSwitcher.vue.d.ts +13 -0
- package/dist/runtime/components/Selector.vue +14 -5
- package/dist/runtime/components/Tooltip.vue +17 -7
- package/dist/runtime/components/ZoomableContainer.d.vue.ts +48 -0
- package/dist/runtime/components/ZoomableContainer.vue +238 -0
- package/dist/runtime/components/ZoomableContainer.vue.d.ts +48 -0
- package/dist/runtime/components/gallery/Carousel.vue +1 -1
- package/dist/runtime/components/gallery/CarouselPreview.d.vue.ts +31 -0
- package/dist/runtime/components/gallery/CarouselPreview.vue +64 -0
- package/dist/runtime/components/gallery/CarouselPreview.vue.d.ts +31 -0
- package/dist/runtime/components/view/Dates.vue +5 -3
- package/dist/runtime/components/view/KeyBinds.d.vue.ts +7 -0
- package/dist/runtime/components/view/KeyBinds.vue +36 -0
- package/dist/runtime/components/view/KeyBinds.vue.d.ts +7 -0
- package/dist/runtime/components/view/Text.vue +4 -4
- package/dist/runtime/composables/useInertia.d.ts +10 -0
- package/dist/runtime/composables/useInertia.js +49 -0
- package/dist/runtime/composables/usePinchZoom.d.ts +13 -0
- package/dist/runtime/composables/usePinchZoom.js +66 -0
- package/dist/runtime/composables/useValidation.js +11 -1
- package/dist/runtime/i18n/en.json +20 -0
- package/dist/runtime/i18n/index.d.ts +11 -0
- package/dist/runtime/i18n/index.js +19 -0
- package/dist/runtime/i18n/uk.json +20 -0
- package/dist/runtime/index.d.ts +5 -0
- package/dist/runtime/index.js +16 -0
- package/dist/runtime/plugins/i18n.d.ts +2 -0
- package/dist/runtime/plugins/i18n.js +18 -0
- package/dist/runtime/utils/icon-registry.js +13 -1
- package/package.json +9 -4
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { defineCanvasTool } from "../types.js";
|
|
2
|
+
import TextTooltip from "./tooltips/Text.vue";
|
|
3
|
+
export function textTool(options = {}) {
|
|
4
|
+
return defineCanvasTool({
|
|
5
|
+
id: "text",
|
|
6
|
+
label: "Text",
|
|
7
|
+
icon: "text",
|
|
8
|
+
cursor: "text",
|
|
9
|
+
tooltip: TextTooltip,
|
|
10
|
+
defaultOptions: {
|
|
11
|
+
fontSize: 24,
|
|
12
|
+
fontFamily: "system-ui, sans-serif",
|
|
13
|
+
color: "#111111",
|
|
14
|
+
weight: "normal",
|
|
15
|
+
...options
|
|
16
|
+
},
|
|
17
|
+
onPointerDown(e, api) {
|
|
18
|
+
const stage = api.stageEl();
|
|
19
|
+
if (!stage) return;
|
|
20
|
+
if (e.originalEvent.target?.closest?.(
|
|
21
|
+
".canvas-text-editor"
|
|
22
|
+
)) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const input = document.createElement("input");
|
|
26
|
+
input.type = "text";
|
|
27
|
+
input.className = "canvas-text-editor";
|
|
28
|
+
input.style.position = "absolute";
|
|
29
|
+
input.style.left = `${e.x}px`;
|
|
30
|
+
input.style.top = `${e.y}px`;
|
|
31
|
+
input.style.transform = "translateY(-50%)";
|
|
32
|
+
input.style.font = `${api.options.weight} ${api.options.fontSize}px ${api.options.fontFamily}`;
|
|
33
|
+
input.style.color = api.options.color;
|
|
34
|
+
input.style.background = "transparent";
|
|
35
|
+
input.style.border = "1px dashed currentColor";
|
|
36
|
+
input.style.outline = "none";
|
|
37
|
+
input.style.padding = "0 2px";
|
|
38
|
+
input.style.minWidth = "1ch";
|
|
39
|
+
input.style.zIndex = "10";
|
|
40
|
+
const snapshot = { ...api.options };
|
|
41
|
+
stage.appendChild(input);
|
|
42
|
+
requestAnimationFrame(() => input.focus());
|
|
43
|
+
let committed = false;
|
|
44
|
+
const commit = () => {
|
|
45
|
+
if (committed) return;
|
|
46
|
+
committed = true;
|
|
47
|
+
const text = input.value;
|
|
48
|
+
input.remove();
|
|
49
|
+
if (!text.trim()) return;
|
|
50
|
+
api.addNode({
|
|
51
|
+
type: "text",
|
|
52
|
+
x: e.x,
|
|
53
|
+
y: e.y,
|
|
54
|
+
data: {
|
|
55
|
+
text,
|
|
56
|
+
fontSize: snapshot.fontSize,
|
|
57
|
+
fontFamily: snapshot.fontFamily,
|
|
58
|
+
color: snapshot.color,
|
|
59
|
+
weight: snapshot.weight
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
api.requestRender();
|
|
63
|
+
};
|
|
64
|
+
const cancel = () => {
|
|
65
|
+
if (committed) return;
|
|
66
|
+
committed = true;
|
|
67
|
+
input.remove();
|
|
68
|
+
};
|
|
69
|
+
input.addEventListener("blur", commit);
|
|
70
|
+
input.addEventListener("keydown", (ev) => {
|
|
71
|
+
if (ev.key === "Enter") {
|
|
72
|
+
ev.preventDefault();
|
|
73
|
+
input.blur();
|
|
74
|
+
} else if (ev.key === "Escape") {
|
|
75
|
+
ev.preventDefault();
|
|
76
|
+
input.removeEventListener("blur", commit);
|
|
77
|
+
cancel();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
hitTest(node, point, radius) {
|
|
82
|
+
const { text, fontSize } = node.data;
|
|
83
|
+
if (!text) return false;
|
|
84
|
+
const estimatedWidth = text.length * fontSize * 0.6;
|
|
85
|
+
const halfHeight = fontSize / 2;
|
|
86
|
+
return point.x + radius >= node.x && point.x - radius <= node.x + estimatedWidth && point.y + radius >= node.y - halfHeight && point.y - radius <= node.y + halfHeight;
|
|
87
|
+
},
|
|
88
|
+
render(ctx, node) {
|
|
89
|
+
const { text, fontSize, fontFamily, color, weight } = node.data;
|
|
90
|
+
if (!text) return;
|
|
91
|
+
ctx.save();
|
|
92
|
+
ctx.font = `${weight} ${fontSize}px ${fontFamily}`;
|
|
93
|
+
ctx.fillStyle = color;
|
|
94
|
+
ctx.textBaseline = "middle";
|
|
95
|
+
ctx.fillText(text, node.x, node.y);
|
|
96
|
+
ctx.restore();
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tool-tip">
|
|
3
|
+
<orio-view-text type="title" size="medium">Clear</orio-view-text>
|
|
4
|
+
<orio-view-text type="subtitle" size="small">
|
|
5
|
+
Remove all nodes from the canvas.
|
|
6
|
+
</orio-view-text>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<style scoped>
|
|
11
|
+
.tool-tip{--view-text-color:#fff;display:flex;flex-direction:column;gap:.25rem;max-width:200px;white-space:normal}
|
|
12
|
+
</style>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tool-tip">
|
|
3
|
+
<orio-view-text type="title" size="medium">Draw</orio-view-text>
|
|
4
|
+
<orio-view-text type="subtitle" size="small">
|
|
5
|
+
Freehand pen. Click and drag to draw strokes.
|
|
6
|
+
</orio-view-text>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<style scoped>
|
|
11
|
+
.tool-tip{--view-text-color:#fff;display:flex;flex-direction:column;gap:.25rem;max-width:200px;white-space:normal}
|
|
12
|
+
</style>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tool-tip">
|
|
3
|
+
<orio-view-text type="title" size="medium">Eraser</orio-view-text>
|
|
4
|
+
<orio-view-text type="subtitle" size="small">
|
|
5
|
+
Drag over elements to remove them. Frozen nodes are protected.
|
|
6
|
+
</orio-view-text>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<style scoped>
|
|
11
|
+
.tool-tip{--view-text-color:#fff;display:flex;flex-direction:column;gap:.25rem;max-width:220px;white-space:normal}
|
|
12
|
+
</style>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tool-tip">
|
|
3
|
+
<orio-view-text type="title" size="medium">Export</orio-view-text>
|
|
4
|
+
<orio-view-text type="subtitle" size="small">
|
|
5
|
+
Download the canvas as PNG, JPEG, or WebP. Configure format and filename
|
|
6
|
+
via the tool's options.
|
|
7
|
+
</orio-view-text>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<style scoped>
|
|
12
|
+
.tool-tip{--view-text-color:#fff;display:flex;flex-direction:column;gap:.25rem;max-width:240px;white-space:normal}
|
|
13
|
+
</style>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tool-tip">
|
|
3
|
+
<orio-view-text type="title" size="medium">Highlight</orio-view-text>
|
|
4
|
+
<orio-view-text type="subtitle" size="small">
|
|
5
|
+
Hover over nodes to inspect their bounding box.
|
|
6
|
+
</orio-view-text>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<style scoped>
|
|
11
|
+
.tool-tip{--view-text-color:#fff;display:flex;flex-direction:column;gap:.25rem;max-width:200px;white-space:normal}
|
|
12
|
+
</style>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tool-tip">
|
|
3
|
+
<orio-view-text type="title" size="medium">Upload image</orio-view-text>
|
|
4
|
+
<orio-view-text type="subtitle" size="small">
|
|
5
|
+
Insert a PNG, JPEG, WebP, GIF, SVG, AVIF, or BMP file. Resize and rotate
|
|
6
|
+
with the Transform tool.
|
|
7
|
+
</orio-view-text>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<style scoped>
|
|
12
|
+
.tool-tip{--view-text-color:#fff;display:flex;flex-direction:column;gap:.25rem;max-width:240px;white-space:normal}
|
|
13
|
+
</style>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tool-tip">
|
|
3
|
+
<orio-view-text type="title" size="medium">Move</orio-view-text>
|
|
4
|
+
<orio-view-text type="subtitle" size="small">
|
|
5
|
+
Click and drag to reposition nodes.
|
|
6
|
+
</orio-view-text>
|
|
7
|
+
<orio-view-key-binds bind="`]` bring forward · `[` send backward" />
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<style scoped>
|
|
12
|
+
.tool-tip{--view-text-color:#fff;display:flex;flex-direction:column;gap:.25rem;max-width:220px;white-space:normal}
|
|
13
|
+
</style>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tool-tip">
|
|
3
|
+
<orio-view-text type="title" size="medium">Redo</orio-view-text>
|
|
4
|
+
<orio-view-text type="subtitle" size="small">
|
|
5
|
+
Restore the last undone action.
|
|
6
|
+
</orio-view-text>
|
|
7
|
+
<orio-view-key-binds bind="`Ctrl`/`Cmd` + `Shift` + `Z`" />
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<style scoped>
|
|
12
|
+
.tool-tip{--view-text-color:#fff;display:flex;flex-direction:column;gap:.25rem;max-width:200px;white-space:normal}
|
|
13
|
+
</style>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tool-tip">
|
|
3
|
+
<orio-view-text type="title" size="medium">Resize</orio-view-text>
|
|
4
|
+
<orio-view-text type="subtitle" size="small">
|
|
5
|
+
Click a node to select, then drag a handle to resize.
|
|
6
|
+
</orio-view-text>
|
|
7
|
+
<orio-view-key-binds bind="`Esc` deselect" />
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<style scoped>
|
|
12
|
+
.tool-tip{--view-text-color:#fff;display:flex;flex-direction:column;gap:.25rem;max-width:220px;white-space:normal}
|
|
13
|
+
</style>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tool-tip">
|
|
3
|
+
<orio-view-text type="title" size="medium">Rotate</orio-view-text>
|
|
4
|
+
<orio-view-text type="subtitle" size="small">
|
|
5
|
+
Click a node to select, then drag the top circle to rotate.
|
|
6
|
+
</orio-view-text>
|
|
7
|
+
<orio-view-key-binds bind="`Esc` deselect" />
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<style scoped>
|
|
12
|
+
.tool-tip{--view-text-color:#fff;display:flex;flex-direction:column;gap:.25rem;max-width:220px;white-space:normal}
|
|
13
|
+
</style>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tool-tip">
|
|
3
|
+
<orio-view-text type="title" size="medium">Text</orio-view-text>
|
|
4
|
+
<orio-view-text type="subtitle" size="small">
|
|
5
|
+
Click anywhere to place text.
|
|
6
|
+
</orio-view-text>
|
|
7
|
+
<orio-view-key-binds bind="`Enter` commit · `Esc` cancel" />
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<style scoped>
|
|
12
|
+
.tool-tip{--view-text-color:#fff;display:flex;flex-direction:column;gap:.25rem;max-width:220px;white-space:normal}
|
|
13
|
+
</style>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tool-tip">
|
|
3
|
+
<orio-view-text type="title" size="medium">Transform</orio-view-text>
|
|
4
|
+
<orio-view-text type="subtitle" size="small">
|
|
5
|
+
Click a node to select. Drag corners to resize, the top circle to rotate,
|
|
6
|
+
or the body to move.
|
|
7
|
+
</orio-view-text>
|
|
8
|
+
<orio-view-key-binds bind="`Esc` deselect" />
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<style scoped>
|
|
13
|
+
.tool-tip{--view-text-color:#fff;display:flex;flex-direction:column;gap:.25rem;max-width:220px;white-space:normal}
|
|
14
|
+
</style>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tool-tip">
|
|
3
|
+
<orio-view-text type="title" size="medium">Undo</orio-view-text>
|
|
4
|
+
<orio-view-text type="subtitle" size="small">
|
|
5
|
+
Revert the last action.
|
|
6
|
+
</orio-view-text>
|
|
7
|
+
<orio-view-key-binds bind="`Ctrl`/`Cmd` + `Z`" />
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<style scoped>
|
|
12
|
+
.tool-tip{--view-text-color:#fff;display:flex;flex-direction:column;gap:.25rem;max-width:200px;white-space:normal}
|
|
13
|
+
</style>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { CanvasNode, CanvasPoint } from "../types.js";
|
|
2
|
+
export type ResizeHandle = "n" | "s" | "e" | "w" | "nw" | "ne" | "sw" | "se";
|
|
3
|
+
export type Handle = ResizeHandle | "rotate";
|
|
4
|
+
export interface Bounds {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
export interface HandleStyle {
|
|
11
|
+
size: number;
|
|
12
|
+
fill: string;
|
|
13
|
+
stroke: string;
|
|
14
|
+
lineWidth: number;
|
|
15
|
+
rotateOffset: number;
|
|
16
|
+
}
|
|
17
|
+
/** Cursor for each resize handle (CSS values). */
|
|
18
|
+
export declare const HANDLE_CURSORS: Record<ResizeHandle, string>;
|
|
19
|
+
/** Map a resize handle through node rotation so cursors match the visual. */
|
|
20
|
+
export declare function cursorForHandle(handle: Handle, rotation?: number): string;
|
|
21
|
+
/** Resize handle anchor positions in node-local (un-rotated) space. */
|
|
22
|
+
export declare function getResizeHandles(b: Bounds): Record<ResizeHandle, CanvasPoint>;
|
|
23
|
+
/** Rotation handle anchor — sits above the top-center of the bounds. */
|
|
24
|
+
export declare function getRotationHandle(b: Bounds, offset?: number): CanvasPoint;
|
|
25
|
+
/**
|
|
26
|
+
* Hit-test the handles of a (possibly rotated) node.
|
|
27
|
+
*
|
|
28
|
+
* @returns the matched handle name or `null` if the point is outside all handles.
|
|
29
|
+
*/
|
|
30
|
+
export declare function hitHandle(node: CanvasNode, point: CanvasPoint, opts?: {
|
|
31
|
+
style?: Partial<HandleStyle>;
|
|
32
|
+
/** Restrict which handles can be hit (e.g. resize-only tools). */
|
|
33
|
+
handles?: Handle[];
|
|
34
|
+
}): Handle | null;
|
|
35
|
+
/** Render resize handles on a node's bounding rect, applying rotation. */
|
|
36
|
+
export declare function renderResizeHandles(ctx: CanvasRenderingContext2D, node: CanvasNode, opts?: {
|
|
37
|
+
style?: Partial<HandleStyle>;
|
|
38
|
+
handles?: ResizeHandle[];
|
|
39
|
+
hovered?: ResizeHandle | null;
|
|
40
|
+
}): void;
|
|
41
|
+
/** Render rotation handle (line + circle) above the node, applying rotation. */
|
|
42
|
+
export declare function renderRotationHandle(ctx: CanvasRenderingContext2D, node: CanvasNode, opts?: {
|
|
43
|
+
style?: Partial<HandleStyle>;
|
|
44
|
+
hovered?: boolean;
|
|
45
|
+
}): void;
|
|
46
|
+
/** Wrap a delta into (-π, π] so multi-turn drags don't jump at atan2's boundary. */
|
|
47
|
+
export declare function normalizeAngleDelta(delta: number): number;
|
|
48
|
+
/**
|
|
49
|
+
* Compute a node's rotation given a pointer position. The rotation is the
|
|
50
|
+
* angle from the node's bounds-center to `point`, with 0 meaning the
|
|
51
|
+
* rotation handle pointing straight up.
|
|
52
|
+
*/
|
|
53
|
+
export declare function rotationFromPoint(node: CanvasNode, point: CanvasPoint): number;
|
|
54
|
+
export interface ResizeContext {
|
|
55
|
+
/** Node snapshot taken at pointer-down. */
|
|
56
|
+
original: CanvasNode;
|
|
57
|
+
/** Bounds of `original`. */
|
|
58
|
+
originalBounds: Bounds;
|
|
59
|
+
/** Pointer in canvas-space at pointer-down (already in local coords). */
|
|
60
|
+
startLocal: CanvasPoint;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Compute a patch that resizes `ctx.original` so the dragged handle lines up
|
|
64
|
+
* with the current pointer.
|
|
65
|
+
*
|
|
66
|
+
* - For width/height nodes: patches `x`, `y`, `width`, `height`.
|
|
67
|
+
* - For draw nodes (with `data.points`): scales each point relative to the
|
|
68
|
+
* original bounds.
|
|
69
|
+
* - For text nodes (with `data.fontSize`): uniform scale via `fontSize`,
|
|
70
|
+
* only on corner handles.
|
|
71
|
+
*/
|
|
72
|
+
export declare function computeResizePatch(handle: ResizeHandle, pointerLocal: CanvasPoint, ctx: ResizeContext, opts?: {
|
|
73
|
+
minSize?: number;
|
|
74
|
+
}): Partial<Omit<CanvasNode, "id">> | null;
|