@snowcone-app/canvas 0.43.0 → 0.43.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/{EditorCanvasImpl-BpudFLkw.js → EditorCanvasImpl-B5IEg9tq.js} +3 -3
- package/dist/{EditorCanvasImpl-BpudFLkw.js.map → EditorCanvasImpl-B5IEg9tq.js.map} +1 -1
- package/dist/{SnowconeCanvas-p9XmnSCK.js → SnowconeCanvas-rAUrO9PR.js} +2 -2
- package/dist/{SnowconeCanvas-p9XmnSCK.js.map → SnowconeCanvas-rAUrO9PR.js.map} +1 -1
- package/dist/design/template-fields.d.ts +5 -0
- package/dist/{embed-DuIOU8mL.js → embed-BXa1jr7S.js} +3 -3
- package/dist/{embed-DuIOU8mL.js.map → embed-BXa1jr7S.js.map} +1 -1
- package/dist/embed.mjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{template-fields-DCZ9TqxY.js → template-fields-ZZEdYB5H.js} +43 -42
- package/dist/{template-fields-DCZ9TqxY.js.map → template-fields-ZZEdYB5H.js.map} +1 -1
- package/example/package.json +1 -1
- package/package.json +3 -3
package/dist/embed.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { C as a, g as t, h as o, K as r, N as i, O as n, P as d, Q as m, R as u, b as l, a as E, j as c, k as p, l as g } from "./useCommands-d5UM6Cnc.js";
|
|
2
|
-
import { E as x, R as C, a as S, b as T, S as P, c as R, d as b, e as B, f as v, g as y, i as F, h as k, p as h, s as D, j as I, k as K, l as L, v as w } from "./embed-
|
|
2
|
+
import { E as x, R as C, a as S, b as T, S as P, c as R, d as b, e as B, f as v, g as y, i as F, h as k, p as h, s as D, j as I, k as K, l as L, v as w } from "./embed-BXa1jr7S.js";
|
|
3
3
|
import { t as M, Y as j } from "./FontAnalyzer-D9R2PYsy.js";
|
|
4
4
|
import { D as N, f as Y, n as _, m as z, b as H } from "./design-builder-C8s1r4MF.js";
|
|
5
|
-
import { D as O, T as Q, r as V, u as q, a as U, b as W, c as X, d as Z, e as $, w as ee } from "./template-fields-
|
|
5
|
+
import { D as O, T as Q, r as V, u as q, a as U, b as W, c as X, d as Z, e as $, w as ee } from "./template-fields-ZZEdYB5H.js";
|
|
6
6
|
import { G as ae, H as te, J as oe, K as re } from "./ExportManager-vAuaoF5Q.js";
|
|
7
7
|
import { s as ne } from "./CanvasStateV1-B51bXTyy.js";
|
|
8
8
|
export {
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { e as u } from "./useCommands-d5UM6Cnc.js";
|
|
2
2
|
import { C as c, f as x, g as I, h as v, b as A, a as g, j as T, k as B, l as P } from "./useCommands-d5UM6Cnc.js";
|
|
3
|
-
import { E as F, S as L, S as _, u as O, a as R } from "./SnowconeCanvas-
|
|
3
|
+
import { E as F, S as L, S as _, u as O, a as R } from "./SnowconeCanvas-rAUrO9PR.js";
|
|
4
4
|
import { b as m, e as d } from "./design-builder-C8s1r4MF.js";
|
|
5
5
|
import { C as z, D as w, f as K, s as D } from "./design-builder-C8s1r4MF.js";
|
|
6
|
-
import { T as V, r as b, u as h, a as G, b as H, c as U, d as Y, e as Z, w as j } from "./template-fields-
|
|
6
|
+
import { T as V, r as b, u as h, a as G, b as H, c as U, d as Y, e as Z, w as j } from "./template-fields-ZZEdYB5H.js";
|
|
7
7
|
import { A as J, C as q, E as Q, M as W, P as X, r as $, v as ee } from "./validation-C8qNtk6j.js";
|
|
8
8
|
import { G as ae, H as te, J as oe, K as re } from "./ExportManager-vAuaoF5Q.js";
|
|
9
9
|
import { c as ie, e as ue } from "./compose-DtQL_oit.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as v, p as V, T, I as M, z as st } from "./FontAnalyzer-D9R2PYsy.js";
|
|
2
2
|
import { k as G, b as ot, m as it, u as O, a as B, n as rt } from "./design-builder-C8s1r4MF.js";
|
|
3
3
|
import { toOptionAttributes as at, toCombinations as ct, getMissingSelections as lt, validateProductSelection as mt, findBestCombination as F, computeDisabledChoices as ft } from "@snowcone-app/sdk";
|
|
4
|
-
import { useEffect as ut, useContext as Z, useId as dt, useLayoutEffect as ht, useRef as C, useMemo as
|
|
4
|
+
import { useEffect as ut, useContext as Z, useId as dt, useLayoutEffect as ht, useRef as C, useMemo as k, useCallback as A, useState as q } from "react";
|
|
5
5
|
import { E as tt, U as gt } from "./useCommands-d5UM6Cnc.js";
|
|
6
|
-
import { b as pt, o as $, c as
|
|
6
|
+
import { b as pt, o as $, c as m, e as bt, l as h, n as yt, u as z, f as vt } from "./CanvasStateV1-B51bXTyy.js";
|
|
7
7
|
function R(s) {
|
|
8
8
|
return s.text;
|
|
9
9
|
}
|
|
@@ -260,7 +260,7 @@ function Q(s) {
|
|
|
260
260
|
function Ot(s, t, e) {
|
|
261
261
|
const o = `[${X[s]}]`, n = `the binding is dead (isConnected: false, ${xt[s]} is a no-op)`, i = Ct[s], a = e.getAllByName(t);
|
|
262
262
|
if (a.length > 0) {
|
|
263
|
-
const l = [...new Set(a.map(Q))],
|
|
263
|
+
const l = [...new Set(a.map(Q))], f = i === "text" ? "image" : "text", N = l.length === 1 && l[0] === f ? ` Bind it with ${X[f]}("${t}") instead.` : "";
|
|
264
264
|
return `${o} the layer named "${t}" is ${l.join("/")}, not ${i} — ${n}.${N}`;
|
|
265
265
|
}
|
|
266
266
|
const r = e.getAll().filter((l) => l.name).map((l) => `"${l.name}" (${Q(l)})`), c = r.length ? `Named layers on this canvas: ${r.join(", ")}. Check the name for a typo.` : `No element on this canvas has a name — name one via design().${i}(…, { name: '${t}' }) or the element's \`name\` property.`;
|
|
@@ -305,11 +305,11 @@ function P(s, t, e) {
|
|
|
305
305
|
if (r.length > 0) {
|
|
306
306
|
const c = e.getAllByName(n);
|
|
307
307
|
if (c.length === 0) {
|
|
308
|
-
const l = r.map((
|
|
308
|
+
const l = r.map((f) => ({ name: f.name, kind: L(f) })).filter((f) => !!f.name && f.kind !== null);
|
|
309
309
|
throw new v(
|
|
310
310
|
"E_LAYER_NOT_FOUND",
|
|
311
|
-
`no layer "${n}" in this Root's document — the token was minted from a different design than the one passed to <Editor.Root design={…}>, or the layer was deleted. Bindable layers here: ${JSON.stringify(l.map((
|
|
312
|
-
{ layerName: n, validNames: l.map((
|
|
311
|
+
`no layer "${n}" in this Root's document — the token was minted from a different design than the one passed to <Editor.Root design={…}>, or the layer was deleted. Bindable layers here: ${JSON.stringify(l.map((f) => f.name))}.`,
|
|
312
|
+
{ layerName: n, validNames: l.map((f) => f.name), docSlug: "embed-mode" }
|
|
313
313
|
);
|
|
314
314
|
}
|
|
315
315
|
if (!c.some((l) => L(l) === t)) {
|
|
@@ -330,7 +330,7 @@ const Dt = () => {
|
|
|
330
330
|
function Ht(s) {
|
|
331
331
|
const { elementStore: t } = O();
|
|
332
332
|
_("useTextBinding()");
|
|
333
|
-
const e = P(s, "text", t), { executeElementUpdate: o } = B(), n =
|
|
333
|
+
const e = P(s, "text", t), { executeElementUpdate: o } = B(), n = k(() => t.getAllByName(e).filter((r) => r instanceof T), [t, e]), i = A(
|
|
334
334
|
(a) => {
|
|
335
335
|
for (const r of n) {
|
|
336
336
|
const c = r.clone();
|
|
@@ -375,7 +375,7 @@ function Bt(s, t, e) {
|
|
|
375
375
|
}
|
|
376
376
|
function Vt(s, t) {
|
|
377
377
|
_("useImageBinding()");
|
|
378
|
-
const e = (t == null ? void 0 : t.fit) ?? "cover", { elementStore: o, setElements: n } = O(), i = P(s, "image", o), { executeElementUpdate: a } = B(), r =
|
|
378
|
+
const e = (t == null ? void 0 : t.fit) ?? "cover", { elementStore: o, setElements: n } = O(), i = P(s, "image", o), { executeElementUpdate: a } = B(), r = k(() => o.getAllByName(i).filter((b) => b instanceof M), [o, i]), c = C(/* @__PURE__ */ new Map());
|
|
379
379
|
for (const d of r)
|
|
380
380
|
if (!c.current.has(d.id)) {
|
|
381
381
|
const b = d.transformData;
|
|
@@ -386,13 +386,13 @@ function Vt(s, t) {
|
|
|
386
386
|
}
|
|
387
387
|
const l = C(r);
|
|
388
388
|
l.current = r;
|
|
389
|
-
const
|
|
390
|
-
|
|
389
|
+
const f = C(a);
|
|
390
|
+
f.current = a;
|
|
391
391
|
const N = C(n);
|
|
392
392
|
N.current = n;
|
|
393
|
-
const S =
|
|
393
|
+
const S = A(
|
|
394
394
|
(d) => {
|
|
395
|
-
const b = l.current, W =
|
|
395
|
+
const b = l.current, W = f.current;
|
|
396
396
|
for (const D of b) {
|
|
397
397
|
const j = c.current.get(D.id);
|
|
398
398
|
if (!j) continue;
|
|
@@ -417,7 +417,7 @@ function Vt(s, t) {
|
|
|
417
417
|
isConnected: !0
|
|
418
418
|
};
|
|
419
419
|
}
|
|
420
|
-
const
|
|
420
|
+
const kt = [];
|
|
421
421
|
function I(s) {
|
|
422
422
|
let t = s.trim().toUpperCase();
|
|
423
423
|
return t.length === 4 && t.startsWith("#") && (t = "#" + t[1] + t[1] + t[2] + t[2] + t[3] + t[3]), t;
|
|
@@ -430,7 +430,7 @@ function et(s, t) {
|
|
|
430
430
|
const e = s;
|
|
431
431
|
return y(e.color, t) || y((o = e.transformData) == null ? void 0 : o.fillColor, t) || y((n = e.transformData) == null ? void 0 : n.strokeColor, t) || ((i = e.stroke) == null ? void 0 : i.enabled) === !0 && y(e.stroke.color, t);
|
|
432
432
|
}
|
|
433
|
-
function
|
|
433
|
+
function At(s, t, e) {
|
|
434
434
|
var a, r, c;
|
|
435
435
|
if (!et(s, t)) return null;
|
|
436
436
|
const o = s.clone(), n = s, i = o;
|
|
@@ -441,15 +441,15 @@ function Gt(s) {
|
|
|
441
441
|
_("useColorBinding()");
|
|
442
442
|
const [n, i] = q(() => I(t)), [a, r] = q(t);
|
|
443
443
|
t !== a && (r(t), i(I(t)));
|
|
444
|
-
const c =
|
|
445
|
-
() => e.getAll().filter((
|
|
444
|
+
const c = k(
|
|
445
|
+
() => e.getAll().filter((f) => et(f, n)),
|
|
446
446
|
[e, n]
|
|
447
|
-
), l =
|
|
448
|
-
(
|
|
449
|
-
const N = I(
|
|
447
|
+
), l = A(
|
|
448
|
+
(f) => {
|
|
449
|
+
const N = I(f);
|
|
450
450
|
if (N !== n) {
|
|
451
451
|
for (const S of e.getAll()) {
|
|
452
|
-
const d =
|
|
452
|
+
const d = At(S, n, f);
|
|
453
453
|
d && o(S, d);
|
|
454
454
|
}
|
|
455
455
|
i(N);
|
|
@@ -457,14 +457,14 @@ function Gt(s) {
|
|
|
457
457
|
},
|
|
458
458
|
[e, n, o]
|
|
459
459
|
);
|
|
460
|
-
return c.length === 0 ? { color: n, setColor: l, elements:
|
|
460
|
+
return c.length === 0 ? { color: n, setColor: l, elements: kt, isConnected: !1 } : { color: n, setColor: l, elements: c, isConnected: !0 };
|
|
461
461
|
}
|
|
462
462
|
const _t = () => {
|
|
463
463
|
}, wt = [];
|
|
464
464
|
function qt(s) {
|
|
465
465
|
const { elementStore: t } = O();
|
|
466
466
|
_("useFontBinding()");
|
|
467
|
-
const e = P(s, "text", t), { executeElementUpdate: o } = B(), n =
|
|
467
|
+
const e = P(s, "text", t), { executeElementUpdate: o } = B(), n = k(() => t.getAllByName(e).filter((r) => r instanceof T), [t, e]), i = A(
|
|
468
468
|
(a) => {
|
|
469
469
|
gt.loadGoogleFontByName(a);
|
|
470
470
|
for (const r of n) {
|
|
@@ -491,39 +491,40 @@ function zt(s) {
|
|
|
491
491
|
const nt = "personalization", Ft = pt("type", [
|
|
492
492
|
$({
|
|
493
493
|
type: h("text"),
|
|
494
|
-
name:
|
|
495
|
-
label:
|
|
496
|
-
placeholder:
|
|
494
|
+
name: m().min(1),
|
|
495
|
+
label: m(),
|
|
496
|
+
placeholder: m().optional(),
|
|
497
497
|
maxLength: yt().int().positive().optional(),
|
|
498
498
|
fit: h("shrink").optional(),
|
|
499
499
|
sample: bt().optional(),
|
|
500
|
-
|
|
501
|
-
|
|
500
|
+
stack: m().min(1).optional(),
|
|
501
|
+
artboard: m().min(1).optional(),
|
|
502
|
+
group: m().optional()
|
|
502
503
|
}),
|
|
503
504
|
$({
|
|
504
505
|
type: h("image"),
|
|
505
|
-
name:
|
|
506
|
-
label:
|
|
507
|
-
placeholder:
|
|
506
|
+
name: m().min(1),
|
|
507
|
+
label: m(),
|
|
508
|
+
placeholder: m().optional(),
|
|
508
509
|
fit: z([h("cover"), h("contain")]).optional(),
|
|
509
|
-
artboard:
|
|
510
|
-
group:
|
|
510
|
+
artboard: m().min(1).optional(),
|
|
511
|
+
group: m().optional()
|
|
511
512
|
}),
|
|
512
513
|
$({
|
|
513
514
|
type: h("color"),
|
|
514
|
-
color:
|
|
515
|
-
label:
|
|
516
|
-
artboard:
|
|
517
|
-
group:
|
|
515
|
+
color: m().min(1),
|
|
516
|
+
label: m(),
|
|
517
|
+
artboard: m().min(1).optional(),
|
|
518
|
+
group: m().optional()
|
|
518
519
|
}),
|
|
519
520
|
$({
|
|
520
521
|
type: h("select"),
|
|
521
|
-
name:
|
|
522
|
-
label:
|
|
522
|
+
name: m().min(1),
|
|
523
|
+
label: m(),
|
|
523
524
|
property: z([h("text"), h("imageUrl"), h("fontFamily")]),
|
|
524
|
-
options: vt($({ label:
|
|
525
|
-
artboard:
|
|
526
|
-
group:
|
|
525
|
+
options: vt($({ label: m(), value: m() })).min(1),
|
|
526
|
+
artboard: m().min(1).optional(),
|
|
527
|
+
group: m().optional()
|
|
527
528
|
})
|
|
528
529
|
]);
|
|
529
530
|
function Jt(s) {
|
|
@@ -555,4 +556,4 @@ export {
|
|
|
555
556
|
Gt as u,
|
|
556
557
|
Xt as w
|
|
557
558
|
};
|
|
558
|
-
//# sourceMappingURL=template-fields-
|
|
559
|
+
//# sourceMappingURL=template-fields-ZZEdYB5H.js.map
|