@snowcone-app/canvas 0.21.1 → 0.21.2
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/{CanvasRenderer-CwiYq8qg.js → CanvasRenderer-B0szG0Us.js} +45 -44
- package/dist/{CanvasRenderer-CwiYq8qg.js.map → CanvasRenderer-B0szG0Us.js.map} +1 -1
- package/dist/{CanvasStateV1-BFabcAKC.js → CanvasStateV1-DmZ1Qvvn.js} +38 -38
- package/dist/{CanvasStateV1-BFabcAKC.js.map → CanvasStateV1-DmZ1Qvvn.js.map} +1 -1
- package/dist/{ContextualToolbars--vTtorNg.js → ContextualToolbars-BYnovWnN.js} +1372 -1422
- package/dist/ContextualToolbars-BYnovWnN.js.map +1 -0
- package/dist/{EditorCanvasImpl-2ZgIUVpK.js → EditorCanvasImpl-BmLHjXe7.js} +8 -8
- package/dist/{EditorCanvasImpl-2ZgIUVpK.js.map → EditorCanvasImpl-BmLHjXe7.js.map} +1 -1
- package/dist/{ExportManager-DK7CdI-G.js → ExportManager-DoU4VK6h.js} +603 -498
- package/dist/ExportManager-DoU4VK6h.js.map +1 -0
- package/dist/{FontAnalyzer-BpsTYowD.js → FontAnalyzer-CwIpgTGd.js} +309 -299
- package/dist/{FontAnalyzer-BpsTYowD.js.map → FontAnalyzer-CwIpgTGd.js.map} +1 -1
- package/dist/{SnowconeCanvas-DqZicdxK.js → SnowconeCanvas-Bj2773ym.js} +9 -9
- package/dist/{SnowconeCanvas-DqZicdxK.js.map → SnowconeCanvas-Bj2773ym.js.map} +1 -1
- package/dist/{UnifiedFontService-B1PGVu8O.js → UnifiedFontService-C8gaspRD.js} +812 -816
- package/dist/UnifiedFontService-C8gaspRD.js.map +1 -0
- package/dist/advanced.mjs +13 -13
- package/dist/{design-builder-CPF60RU2.js → design-builder-CT4DHIPe.js} +2 -2
- package/dist/{design-builder-CPF60RU2.js.map → design-builder-CT4DHIPe.js.map} +1 -1
- package/dist/{editorErrors-CK1RISFa.js → editorErrors-B2mb1sVN.js} +2 -2
- package/dist/{editorErrors-CK1RISFa.js.map → editorErrors-B2mb1sVN.js.map} +1 -1
- package/dist/{embed-2tp6Ue90.js → embed-pM7ZkFuz.js} +10 -10
- package/dist/{embed-2tp6Ue90.js.map → embed-pM7ZkFuz.js.map} +1 -1
- package/dist/embed.mjs +6 -6
- package/dist/index.mjs +8 -8
- package/dist/internals.mjs +11 -11
- package/dist/rendering/element-painters.d.ts +4 -2
- package/dist/{template-fields-FgImixyv.js → template-fields-BsnHMf1i.js} +6 -6
- package/dist/{template-fields-FgImixyv.js.map → template-fields-BsnHMf1i.js.map} +1 -1
- package/dist/testing.mjs +4 -4
- package/dist/{usePieceGuideBundle-Ctnu5k2D.js → usePieceGuideBundle-CbJJg66S.js} +2 -2
- package/dist/{usePieceGuideBundle-Ctnu5k2D.js.map → usePieceGuideBundle-CbJJg66S.js.map} +1 -1
- package/dist/{validation-3YEMnKLB.js → validation-DdVeWnlo.js} +9 -9
- package/dist/{validation-3YEMnKLB.js.map → validation-DdVeWnlo.js.map} +1 -1
- package/example/package.json +1 -1
- package/package.json +3 -2
- package/dist/ContextualToolbars--vTtorNg.js.map +0 -1
- package/dist/ExportManager-DK7CdI-G.js.map +0 -1
- package/dist/UnifiedFontService-B1PGVu8O.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as ee, X as ne,
|
|
2
|
-
import { T as Bt, a as Me,
|
|
1
|
+
import { V as ee, X as ne, ar as tt, Y as zt, aE as se, aC as oe, av as Vt, aB as ie, au as ht, aF as ae, aG as Ft, aH as re, aI as le, c as $t, G as he, I as jt, P as ce, S as de, T as fe, aJ as ge, aK as ue, aL as pe, aM as ye, a3 as qt, $ as Ut, a5 as ft, a0 as Zt, a1 as Ht, a4 as be, a7 as Se, aN as Ot, aO as me, aP as Te, aQ as ve, aR as we, aS as Ce, aT as Q } from "./FontAnalyzer-CwIpgTGd.js";
|
|
2
|
+
import { T as Bt, a as Me, u as xe, K as Re, z as kt, L as Gt, M as ke, N as Pe, O as Ae } from "./ExportManager-DoU4VK6h.js";
|
|
3
3
|
const it = {
|
|
4
4
|
// Canvas-specific
|
|
5
5
|
canvas: {
|
|
@@ -14,30 +14,30 @@ const it = {
|
|
|
14
14
|
spacingLabelFontSize: 11,
|
|
15
15
|
spacingLabelFontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
16
16
|
}
|
|
17
|
-
},
|
|
17
|
+
}, Ee = 2, Mt = 6, Ie = 16, He = 5, Be = 5, Jt = 0.5;
|
|
18
18
|
function Yt(C) {
|
|
19
|
-
return
|
|
19
|
+
return Ee / C;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function Ye(C) {
|
|
22
22
|
return Mt / C;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return
|
|
24
|
+
function Le(C) {
|
|
25
|
+
return Ie / C;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return [
|
|
27
|
+
function Xe(C) {
|
|
28
|
+
return [He / C, Be / C];
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function We(C, t, e, o) {
|
|
31
31
|
C.save();
|
|
32
32
|
const n = Jt / o;
|
|
33
33
|
C.translate(t, e), C.scale(n, n), C.strokeStyle = "#000", C.lineWidth = 1.5, C.lineCap = "round", C.lineJoin = "round", C.translate(-12, -12), C.beginPath(), C.moveTo(21, 12), C.arc(12, 12, 9, 0, -Math.PI / 2, !0), C.bezierCurveTo(3.5, 4.5, 4, 6, 3, 8), C.stroke(), C.beginPath(), C.moveTo(3, 3), C.lineTo(3, 8), C.lineTo(8, 8), C.stroke(), C.beginPath(), C.moveTo(3, 12), C.arc(12, 12, 9, Math.PI, Math.PI / 2, !0), C.bezierCurveTo(20.5, 19.5, 20, 18, 21, 16), C.stroke(), C.beginPath(), C.moveTo(16, 16), C.lineTo(21, 16), C.lineTo(21, 21), C.stroke(), C.restore();
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
const i =
|
|
37
|
-
C.save(), C.fillStyle = "#fff", C.strokeStyle = n, C.lineWidth = s ? Yt(o) * 1.25 : Yt(o), C.beginPath(), C.arc(t, e, i, 0, Math.PI * 2), C.fill(), C.stroke(),
|
|
35
|
+
function Ne(C, t, e, o = 1, n = "#3b82f6", s = !1) {
|
|
36
|
+
const i = Le(o);
|
|
37
|
+
C.save(), C.fillStyle = "#fff", C.strokeStyle = n, C.lineWidth = s ? Yt(o) * 1.25 : Yt(o), C.beginPath(), C.arc(t, e, i, 0, Math.PI * 2), C.fill(), C.stroke(), We(C, t, e, o), C.restore();
|
|
38
38
|
}
|
|
39
39
|
const Xt = Mt * 2;
|
|
40
|
-
class
|
|
40
|
+
class Ke {
|
|
41
41
|
constructor() {
|
|
42
42
|
this.resizeHandles = [], this.rotationHandle = null, this.elementRotation = 0, this.rotationAnchor = { x: 0, y: 0 };
|
|
43
43
|
}
|
|
@@ -153,7 +153,7 @@ class Ne {
|
|
|
153
153
|
);
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
class
|
|
156
|
+
class De {
|
|
157
157
|
/**
|
|
158
158
|
* Calculate new dimensions and position for a resize operation
|
|
159
159
|
*/
|
|
@@ -275,7 +275,7 @@ class We {
|
|
|
275
275
|
return n;
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
-
class
|
|
278
|
+
class _e {
|
|
279
279
|
constructor() {
|
|
280
280
|
this.hooks = {
|
|
281
281
|
beforeResize: [],
|
|
@@ -330,7 +330,7 @@ class De {
|
|
|
330
330
|
*/
|
|
331
331
|
executeResize(t) {
|
|
332
332
|
const e = this.runHooks("beforeResize", t);
|
|
333
|
-
let o =
|
|
333
|
+
let o = De.calculateResize({
|
|
334
334
|
...e,
|
|
335
335
|
snapSystem: t.snapSystem
|
|
336
336
|
});
|
|
@@ -345,8 +345,8 @@ class De {
|
|
|
345
345
|
return this.runHooks("afterPositionUpdate", o).position;
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
|
-
const
|
|
349
|
-
class
|
|
348
|
+
const $e = new _e();
|
|
349
|
+
class je {
|
|
350
350
|
constructor(t = null) {
|
|
351
351
|
this.state = "IDLE", this.context = {
|
|
352
352
|
mode: null,
|
|
@@ -882,7 +882,7 @@ function Pt(C, t) {
|
|
|
882
882
|
const e = C.transformData;
|
|
883
883
|
return e && "height" in e ? (e.height = t, !0) : !1;
|
|
884
884
|
}
|
|
885
|
-
class
|
|
885
|
+
class qe {
|
|
886
886
|
constructor(t = {}) {
|
|
887
887
|
this._extraSnapRects = [], this.snapThreshold = t.snapThreshold || it.canvas.snapThreshold, this.enabled = t.enabled !== !1, this.showGuides = t.showGuides !== !1, this.guides = [], this.activeSnaps = {
|
|
888
888
|
x: null,
|
|
@@ -1512,7 +1512,7 @@ class je {
|
|
|
1512
1512
|
return t;
|
|
1513
1513
|
}
|
|
1514
1514
|
}
|
|
1515
|
-
class
|
|
1515
|
+
class Ue {
|
|
1516
1516
|
constructor(t = {}) {
|
|
1517
1517
|
this.lastSnapTarget = null, this.detectionThreshold = t.detectionThreshold || 100, this.minDistance = t.minDistance || 10, this.enabled = t.enabled !== !1, this.showLabels = t.showLabels !== !1, this.indicators = [];
|
|
1518
1518
|
}
|
|
@@ -1944,7 +1944,7 @@ class qe {
|
|
|
1944
1944
|
}
|
|
1945
1945
|
}
|
|
1946
1946
|
}
|
|
1947
|
-
const Lt = $t("ArtboardRenderer"),
|
|
1947
|
+
const Lt = $t("ArtboardRenderer"), ze = {
|
|
1948
1948
|
showLabel: !0,
|
|
1949
1949
|
showBorder: !0,
|
|
1950
1950
|
borderColor: "",
|
|
@@ -1964,7 +1964,7 @@ const Lt = $t("ArtboardRenderer"), _e = {
|
|
|
1964
1964
|
};
|
|
1965
1965
|
class Qt {
|
|
1966
1966
|
constructor(t = {}) {
|
|
1967
|
-
this.options = { ...
|
|
1967
|
+
this.options = { ...ze, ...t };
|
|
1968
1968
|
}
|
|
1969
1969
|
/**
|
|
1970
1970
|
* Render an artboard
|
|
@@ -2155,19 +2155,19 @@ class Qt {
|
|
|
2155
2155
|
return !!(this.options.showPreviewBackground && t.previewBackgroundColor && t.previewBackgroundColor !== "transparent");
|
|
2156
2156
|
}
|
|
2157
2157
|
}
|
|
2158
|
-
function
|
|
2158
|
+
function Ze(C) {
|
|
2159
2159
|
return C instanceof fe;
|
|
2160
2160
|
}
|
|
2161
|
-
function
|
|
2161
|
+
function Ve(C) {
|
|
2162
2162
|
return C instanceof jt;
|
|
2163
2163
|
}
|
|
2164
2164
|
function Wt(C) {
|
|
2165
2165
|
return C instanceof he;
|
|
2166
2166
|
}
|
|
2167
|
-
function
|
|
2167
|
+
function Je(C) {
|
|
2168
2168
|
return C instanceof de;
|
|
2169
2169
|
}
|
|
2170
|
-
function
|
|
2170
|
+
function Qe(C) {
|
|
2171
2171
|
return C instanceof ce;
|
|
2172
2172
|
}
|
|
2173
2173
|
class mt {
|
|
@@ -2951,7 +2951,8 @@ class Dt {
|
|
|
2951
2951
|
}
|
|
2952
2952
|
}
|
|
2953
2953
|
}
|
|
2954
|
-
|
|
2954
|
+
Ae();
|
|
2955
|
+
const Fe = $t("CanvasRenderer"), K = class K {
|
|
2955
2956
|
/**
|
|
2956
2957
|
* Get a pooled offscreen canvas for clipping content, only recreating
|
|
2957
2958
|
* when dimensions change. Eliminates per-frame canvas allocation.
|
|
@@ -2975,7 +2976,7 @@ const Ve = $t("CanvasRenderer"), K = class K {
|
|
|
2975
2976
|
e.render(t, o, n);
|
|
2976
2977
|
} catch (s) {
|
|
2977
2978
|
const i = s instanceof Error ? s : new Error(String(s));
|
|
2978
|
-
|
|
2979
|
+
Fe.error(`Failed to render element ${e.id}:`, i), K.onRenderError && K.onRenderError({
|
|
2979
2980
|
category: "render",
|
|
2980
2981
|
message: `Failed to render element: ${i.message}`,
|
|
2981
2982
|
originalError: i,
|
|
@@ -3350,7 +3351,7 @@ const Ve = $t("CanvasRenderer"), K = class K {
|
|
|
3350
3351
|
const m = t.getTransform().a / b, T = g.x * b * m, v = g.y * b * m;
|
|
3351
3352
|
t.setTransform(m, 0, 0, m, T, v);
|
|
3352
3353
|
}
|
|
3353
|
-
if (e &&
|
|
3354
|
+
if (e && Ve(e) && e.isCropping)
|
|
3354
3355
|
o && Dt.renderCropBoxLayer(t, e, o, b);
|
|
3355
3356
|
else if (!l && n && mt.renderSelectionLayer(t, e, n, b), o && n && mt.renderPositionSizeInfo(t, e, o, n, b), !l && o && n && mt.renderHandlesLayer(
|
|
3356
3357
|
t,
|
|
@@ -3376,22 +3377,22 @@ const Ve = $t("CanvasRenderer"), K = class K {
|
|
|
3376
3377
|
K._contentCanvas = null, K._contentCanvasSize = { width: 0, height: 0 }, K._maskCanvas = null, K._maskCanvasSize = { width: 0, height: 0 }, K._cachedElementsRef = null, K._cachedElementConfigs = null, K._cachedElementMap = null, K._knockoutRenderedIds = /* @__PURE__ */ new Set(), K.onRenderError = null;
|
|
3377
3378
|
let Kt = K;
|
|
3378
3379
|
export {
|
|
3379
|
-
|
|
3380
|
+
qe as A,
|
|
3380
3381
|
Kt as C,
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3382
|
+
je as I,
|
|
3383
|
+
_e as R,
|
|
3384
|
+
Ue as S,
|
|
3385
|
+
Ke as T,
|
|
3386
|
+
Ve as a,
|
|
3387
|
+
Qe as b,
|
|
3388
|
+
Je as c,
|
|
3389
|
+
Ze as d,
|
|
3389
3390
|
Qt as e,
|
|
3390
|
-
|
|
3391
|
+
Xe as f,
|
|
3391
3392
|
Yt as g,
|
|
3392
|
-
|
|
3393
|
+
Ye as h,
|
|
3393
3394
|
Wt as i,
|
|
3394
|
-
|
|
3395
|
-
|
|
3395
|
+
$e as j,
|
|
3396
|
+
Ne as r
|
|
3396
3397
|
};
|
|
3397
|
-
//# sourceMappingURL=CanvasRenderer-
|
|
3398
|
+
//# sourceMappingURL=CanvasRenderer-B0szG0Us.js.map
|