@hankchen/canvas-editor-vue 0.1.2 → 0.1.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/dist/{canvas-CSdXMg6S.js → canvas-DP-pVLyA.js} +580 -531
- package/dist/canvas.js +1 -1
- package/dist/createLucideIcon-SCvtEGVf.js +96 -0
- package/dist/dist-DGtNmLwo.js +341 -0
- package/dist/index.js +8 -8
- package/dist/{layer-panel-BM-nX_OX.js → layer-panel-CXIkRodC.js} +229 -112
- package/dist/layer-panel.js +1 -1
- package/dist/{property-panel-Cw6T9dAQ.js → property-panel-CigAECN_.js} +406 -353
- package/dist/property-panel.js +1 -1
- package/package.json +1 -1
- package/dist/dist-B6-i-hhY.js +0 -184
package/dist/property-panel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, i, l as a, m as o, n as s, o as c, p as l, r as u, s as d, t as f, u as p } from "./property-panel-
|
|
1
|
+
import { a as e, c as t, d as n, f as r, i, l as a, m as o, n as s, o as c, p as l, r as u, s as d, t as f, u as p } from "./property-panel-CigAECN_.js";
|
|
2
2
|
export { a as CANVAS_FIELD_SECTIONS, p as FIELD_SECTIONS_BY_TYPE, d as FONT_PICKER_KEY, e as IMAGE_UPLOAD_KEY, s as PropertyField, f as PropertyPanel, i as controlRegistry, n as fieldSectionsForPath, r as fieldSectionsForType, t as injectFontPicker, c as injectImageUpload, l as layerRoleAt, o as readField, u as usePropertyPanel };
|
package/package.json
CHANGED
package/dist/dist-B6-i-hhY.js
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/@hankchen+canvas@0.1.0/node_modules/@hankchen/canvas/dist/index.js
|
|
2
|
-
var e = [
|
|
3
|
-
"top-left",
|
|
4
|
-
"top",
|
|
5
|
-
"top-right",
|
|
6
|
-
"left",
|
|
7
|
-
"center",
|
|
8
|
-
"right",
|
|
9
|
-
"bottom-left",
|
|
10
|
-
"bottom",
|
|
11
|
-
"bottom-right"
|
|
12
|
-
], t = [
|
|
13
|
-
"left",
|
|
14
|
-
"center",
|
|
15
|
-
"right"
|
|
16
|
-
], n = [
|
|
17
|
-
"top",
|
|
18
|
-
"center",
|
|
19
|
-
"bottom"
|
|
20
|
-
], r = /* @__PURE__ */ ",(。(、(;(:(!(?(」(』()(】(》(〉(…(—(~(·(!(?(%(,(.(;(:()(](}".split("("), i = [
|
|
21
|
-
"「",
|
|
22
|
-
"『",
|
|
23
|
-
"(",
|
|
24
|
-
"【",
|
|
25
|
-
"《",
|
|
26
|
-
"〈",
|
|
27
|
-
"“",
|
|
28
|
-
"‘",
|
|
29
|
-
"(",
|
|
30
|
-
"[",
|
|
31
|
-
"{"
|
|
32
|
-
], a = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
33
|
-
function o(e) {
|
|
34
|
-
return e === "" ? [] : Array.from(a.segment(e), (e) => e.segment);
|
|
35
|
-
}
|
|
36
|
-
var s = .55;
|
|
37
|
-
function c(e) {
|
|
38
|
-
return e.length === 1 && e >= " " && e <= "~";
|
|
39
|
-
}
|
|
40
|
-
function l(e) {
|
|
41
|
-
return { measure(t) {
|
|
42
|
-
let n = 0;
|
|
43
|
-
for (let e of t) n += c(e) ? s : 1;
|
|
44
|
-
return n * e;
|
|
45
|
-
} };
|
|
46
|
-
}
|
|
47
|
-
var u = (e, t) => l(t);
|
|
48
|
-
function d(e) {
|
|
49
|
-
return e.join("");
|
|
50
|
-
}
|
|
51
|
-
function f(e) {
|
|
52
|
-
return e === " " || e === " ";
|
|
53
|
-
}
|
|
54
|
-
function p(e) {
|
|
55
|
-
return r.includes(e);
|
|
56
|
-
}
|
|
57
|
-
function m(e) {
|
|
58
|
-
return i.includes(e);
|
|
59
|
-
}
|
|
60
|
-
function h() {
|
|
61
|
-
return (e, t, n) => {
|
|
62
|
-
if (e === "") return [];
|
|
63
|
-
let r = [];
|
|
64
|
-
for (let i of e.split("\n")) {
|
|
65
|
-
let e = o(i);
|
|
66
|
-
if (e.length === 0) {
|
|
67
|
-
r.push("");
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
let a = [];
|
|
71
|
-
for (let i of e) {
|
|
72
|
-
if (a.length === 0 || n.measure(d(a) + i) <= t) {
|
|
73
|
-
a.push(i);
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
let e = g(a, i);
|
|
77
|
-
e.line.length > 0 && r.push(d(e.line)), a = e.rest;
|
|
78
|
-
}
|
|
79
|
-
a.length > 0 && r.push(d(a));
|
|
80
|
-
}
|
|
81
|
-
return r;
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
function g(e, t) {
|
|
85
|
-
let n = e, r = [t], i = _(e);
|
|
86
|
-
if (i !== -1) {
|
|
87
|
-
let a = +(e[i] === "-"), o = e.slice(0, i + a), s = e.slice(i + 1);
|
|
88
|
-
o.length > 0 && (n = o, r = [...s, t]);
|
|
89
|
-
}
|
|
90
|
-
return n = y(n), r = b(r), v(n, r);
|
|
91
|
-
}
|
|
92
|
-
function _(e) {
|
|
93
|
-
for (let t = e.length - 1; t > 0; t--) {
|
|
94
|
-
let n = e[t];
|
|
95
|
-
if (n === " " || n === "-") return t;
|
|
96
|
-
}
|
|
97
|
-
return -1;
|
|
98
|
-
}
|
|
99
|
-
function v(e, t) {
|
|
100
|
-
for (; t.length > 0 && p(t[0]);) e = [...e, t[0]], t = t.slice(1);
|
|
101
|
-
for (; e.length > 0 && m(e[e.length - 1]);) t = [e[e.length - 1], ...t], e = e.slice(0, -1);
|
|
102
|
-
return {
|
|
103
|
-
line: e,
|
|
104
|
-
rest: t
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
function y(e) {
|
|
108
|
-
for (; e.length > 0 && f(e[e.length - 1]);) e = e.slice(0, -1);
|
|
109
|
-
return e;
|
|
110
|
-
}
|
|
111
|
-
function b(e) {
|
|
112
|
-
for (; e.length > 0 && f(e[0]);) e = e.slice(1);
|
|
113
|
-
return e;
|
|
114
|
-
}
|
|
115
|
-
var x = h();
|
|
116
|
-
function S(e) {
|
|
117
|
-
return {
|
|
118
|
-
lineBreaker: e?.lineBreaker ?? x,
|
|
119
|
-
measurerFactory: e?.measurerFactory ?? u
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
function C(e) {
|
|
123
|
-
return e === 0 ? 0 : e;
|
|
124
|
-
}
|
|
125
|
-
function w(e) {
|
|
126
|
-
return C(Math.trunc(e));
|
|
127
|
-
}
|
|
128
|
-
function T(e, t) {
|
|
129
|
-
switch (e.type) {
|
|
130
|
-
case "TextLayer": {
|
|
131
|
-
if (!e.shape.autoWidth) return e.shape.width;
|
|
132
|
-
let { measurerFactory: n } = S(t), r = n(e.font, e.fontSize), i = 0;
|
|
133
|
-
for (let t of e.text.split("\n")) i = Math.max(i, r.measure(t));
|
|
134
|
-
return w(Math.ceil(i)) + w(e.shape.padding.left + e.shape.padding.right);
|
|
135
|
-
}
|
|
136
|
-
default: return e.shape.width;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function E(e) {
|
|
140
|
-
return Math.ceil(e.fontSize * e.shape.lineHeight);
|
|
141
|
-
}
|
|
142
|
-
function D(e, t) {
|
|
143
|
-
if (!e.autowrap) return [e.text];
|
|
144
|
-
let { lineBreaker: n, measurerFactory: r } = S(t);
|
|
145
|
-
return n(e.text, k(e, t), r(e.font, e.fontSize));
|
|
146
|
-
}
|
|
147
|
-
function O(e, t) {
|
|
148
|
-
switch (e.type) {
|
|
149
|
-
case "TextLayer": {
|
|
150
|
-
if (!e.shape.autoHeight) return e.shape.height;
|
|
151
|
-
let n = w(e.shape.padding.top + e.shape.padding.bottom);
|
|
152
|
-
return e.autowrap ? E(e) * D(e, t).length + n : e.text === "" ? n : E(e) + n;
|
|
153
|
-
}
|
|
154
|
-
case "QrCodeLayer": return !e.shape.autoHeight && e.shape.height > 0 ? e.shape.height : T(e, t);
|
|
155
|
-
default: return e.shape.height;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
function k(e, t) {
|
|
159
|
-
return w(T(e, t) - e.shape.padding.left - e.shape.padding.right);
|
|
160
|
-
}
|
|
161
|
-
function A(e, t) {
|
|
162
|
-
return w(O(e, t) - e.shape.padding.top - e.shape.padding.bottom);
|
|
163
|
-
}
|
|
164
|
-
function j(e, t, n, r, i) {
|
|
165
|
-
return {
|
|
166
|
-
x: e === "top-right" || e === "right" || e === "bottom-right" ? t - r : e === "top" || e === "center" || e === "bottom" ? w((t - r) / 2) : 0,
|
|
167
|
-
y: e === "bottom-left" || e === "bottom" || e === "bottom-right" ? n - i : e === "left" || e === "center" || e === "right" ? w((n - i) / 2) : 0
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
function M(e, t, n, r, i, a) {
|
|
171
|
-
let o = T(e, a), s = O(e, a), c = j(e.position.anchor, r, i, o, s), l = t + c.x + e.position.x, u = n + c.y + e.position.y;
|
|
172
|
-
return {
|
|
173
|
-
x: l,
|
|
174
|
-
y: u,
|
|
175
|
-
width: o,
|
|
176
|
-
height: s,
|
|
177
|
-
contentX: l + e.shape.padding.left,
|
|
178
|
-
contentY: u + e.shape.padding.top,
|
|
179
|
-
contentWidth: k(e, a),
|
|
180
|
-
contentHeight: A(e, a)
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
//#endregion
|
|
184
|
-
export { k as a, A as i, t as n, M as o, n as r, e as t };
|