@algorisys/yappydraw 0.8.278 → 0.8.283
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 +2 -2
- package/chunks/{AllPackages-DytsA6Gg.js → AllPackages-NXu9X6xl.js} +5 -5
- package/chunks/{BaseConfiguration-B0Un-ANd.js → BaseConfiguration-Cn1Beeg_.js} +3 -3
- package/chunks/{Entities-XwxJEcR3.js → Entities-DNDwR9nR.js} +1 -1
- package/chunks/{Factory-B4kWsy6c.js → Factory-hCmMrRZd.js} +8 -8
- package/chunks/{InputJax-DQpRzuU2.js → InputJax-BnvzjXPP.js} +1 -1
- package/chunks/PrioritizedList-CopFulOu.js +35 -0
- package/chunks/{TeXAtom-COgv6VHH.js → TeXAtom-i5HZ7jSY.js} +25 -25
- package/chunks/__vite-browser-external-BsdCVVos.js +110 -0
- package/chunks/_commonjsHelpers-DaMA6jEr.js +8 -0
- package/chunks/{canva-ai-7n8RQQlp.js → canva-ai-6uxuZ0PT.js} +8 -8
- package/chunks/{choice-dialog-state-DzWAU-Fv.js → choice-dialog-state-CTLAD7og.js} +1 -1
- package/chunks/{design-generator-AHGi1XTI.js → design-generator-l8Wo9SER.js} +1 -1
- package/chunks/{drawing-engine-DfKBHdTi.js → drawing-engine-BTqPTS30.js} +1 -1
- package/chunks/{drawings-store-Cyv-1e1L.js → drawings-store-B0h0XeLH.js} +19 -19
- package/chunks/{ds-operations-C9fmILbu.js → ds-operations-CvCIeybe.js} +1 -1
- package/chunks/{export-game-C1SNNfRf.js → export-game-CQ9VCQV9.js} +1 -1
- package/chunks/{game-runtime-ztkqHa3o.js → game-runtime-DGFlcZcF.js} +76 -76
- package/chunks/{html-CEj6ZeJc.js → html-BBKfobGE.js} +56 -55
- package/chunks/html2canvas.esm-BWVIUcAF.js +4802 -0
- package/chunks/{index-vjDu6_KH.js → index-D1ifHWAi.js} +15983 -12966
- package/chunks/index.es-Cmz4JyRm.js +6665 -0
- package/chunks/jspdf.es.min-rJE95jGX.js +9859 -0
- package/chunks/lcms-Car3bVu8.js +949 -0
- package/chunks/lcms-tShoQ1hy.js +4 -0
- package/chunks/{liteAdaptor-BZby1Qz2.js → liteAdaptor-DFCyQb98.js} +2 -2
- package/chunks/{lucide-solid-UJTMB-sy.js → lucide-solid-PB_pG8LH.js} +1 -1
- package/chunks/{markdown-to-slides-CKGVwM_7.js → markdown-to-slides-Ci06cYoT.js} +16 -16
- package/chunks/{mathjax-CnUrFnFS.js → mathjax-BPYOiwki.js} +1 -1
- package/chunks/{mathjax-D6cR72fZ.js → mathjax-BYK64638.js} +2 -2
- package/chunks/{morph-animator-D7JpZIyR.js → morph-animator-nKcVAyGw.js} +1 -1
- package/chunks/{onboarding-tour-DsN4nEFc.js → onboarding-tour-F8YlLQgf.js} +32 -32
- package/chunks/pdf-cmyk-CqVZV2FF.js +339 -0
- package/chunks/pdf-vector-hLlPZeLt.js +200 -0
- package/chunks/pdf-x-DBYFVbAz.js +220 -0
- package/chunks/purify.es-C2Qa7b4C.js +906 -0
- package/chunks/{search-qTCHUaUH.js → search-Nvw1qYCe.js} +2 -2
- package/chunks/{slide-generator-CoHxujzf.js → slide-generator-BwaWABSo.js} +8 -8
- package/chunks/{svg-B2urwbCV.js → svg-CGqKTjgw.js} +3 -3
- package/chunks/svg2pdf.es.min-BVaMJ-wC.js +2452 -0
- package/chunks/{tex-BTCIQDRb.js → tex-Cc_XKudY.js} +4 -4
- package/chunks/{turntable-ai-BEZd382K.js → turntable-ai-DyxE4d5_.js} +1 -1
- package/chunks/{yappy-NspTXSPk.css → yappy-FCQs01wv.css} +1 -1
- package/package.json +1 -1
- package/yappy.js +5 -5
- package/chunks/PrioritizedList-TjDg4i-s.js +0 -39
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Or with no install, from a CDN:
|
|
|
20
20
|
|
|
21
21
|
```html
|
|
22
22
|
<script type="module">
|
|
23
|
-
import { Yappy, mount } from 'https://cdn.jsdelivr.net/npm/@algorisys/yappydraw@0.8.
|
|
23
|
+
import { Yappy, mount } from 'https://cdn.jsdelivr.net/npm/@algorisys/yappydraw@0.8.283/yappy.js'
|
|
24
24
|
</script>
|
|
25
25
|
```
|
|
26
26
|
|
|
@@ -42,4 +42,4 @@ Or with no install, from a CDN:
|
|
|
42
42
|
- **Licence: AGPL-3.0-only**, as the rest of YappyDraw. Check that it suits your project before
|
|
43
43
|
bundling it into software you distribute or run as a network service.
|
|
44
44
|
|
|
45
|
-
Source: [algorisys-oss/yappydraw @ v0.8.
|
|
45
|
+
Source: [algorisys-oss/yappydraw @ v0.8.283](https://github.com/algorisys-oss/yappydraw/tree/v0.8.283).
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { g as dn } from "./
|
|
2
|
-
import { e as R, a as rt, g as F, h as st, i as jt, j as V, r as W, b as U, k as tt, l as St, m as me, d as _e, f as Qr, n as Kr, o as ye, p as mn, c as hn } from "./BaseConfiguration-
|
|
3
|
-
import {
|
|
1
|
+
import { g as dn } from "./_commonjsHelpers-DaMA6jEr.js";
|
|
2
|
+
import { e as R, a as rt, g as F, h as st, i as jt, j as V, r as W, b as U, k as tt, l as St, m as me, d as _e, f as Qr, n as Kr, o as ye, p as mn, c as hn } from "./BaseConfiguration-Cn1Beeg_.js";
|
|
3
|
+
import { b as bt } from "./Factory-hCmMrRZd.js";
|
|
4
4
|
import { r as Se } from "./lengths-DNFHULBn.js";
|
|
5
5
|
import { r as he } from "./Options-BStFr0zv.js";
|
|
6
|
-
import { a as vn } from "./mathjax-
|
|
7
|
-
import { r as pn } from "./Entities-
|
|
6
|
+
import { a as vn } from "./mathjax-BPYOiwki.js";
|
|
7
|
+
import { r as pn } from "./Entities-DNDwR9nR.js";
|
|
8
8
|
function gn(v, C) {
|
|
9
9
|
for (var g = 0; g < C.length; g++) {
|
|
10
10
|
const y = C[g];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as At, e as oe, c as ue, r as Zt, f as se } from "./Factory-hCmMrRZd.js";
|
|
2
2
|
import { r as wt } from "./Options-BStFr0zv.js";
|
|
3
|
-
import { r as Qt } from "./PrioritizedList-
|
|
4
|
-
import { r as Mt } from "./Entities-
|
|
3
|
+
import { r as Qt } from "./PrioritizedList-CopFulOu.js";
|
|
4
|
+
import { r as Mt } from "./Entities-DNDwR9nR.js";
|
|
5
5
|
import { r as te } from "./lengths-DNFHULBn.js";
|
|
6
6
|
var ct = {}, kt;
|
|
7
7
|
function pt() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as x } from "./PrioritizedList-
|
|
1
|
+
import { r as x } from "./PrioritizedList-CopFulOu.js";
|
|
2
2
|
var o = {}, K;
|
|
3
3
|
function Ou() {
|
|
4
4
|
if (K) return o;
|
|
@@ -2758,11 +2758,11 @@ function au() {
|
|
|
2758
2758
|
return X.AbstractFactory = L, X;
|
|
2759
2759
|
}
|
|
2760
2760
|
export {
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2761
|
+
uu as a,
|
|
2762
|
+
Y as b,
|
|
2763
|
+
au as c,
|
|
2764
|
+
tu as d,
|
|
2765
|
+
Eu as e,
|
|
2766
|
+
iu as f,
|
|
2767
|
+
Ou as r
|
|
2768
2768
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var r = {}, o;
|
|
2
|
+
function u() {
|
|
3
|
+
if (o) return r;
|
|
4
|
+
o = 1, Object.defineProperty(r, "__esModule", { value: !0 }), r.PrioritizedList = void 0;
|
|
5
|
+
var n = (function() {
|
|
6
|
+
function e() {
|
|
7
|
+
this.items = [], this.items = [];
|
|
8
|
+
}
|
|
9
|
+
return e.prototype[Symbol.iterator] = function() {
|
|
10
|
+
var t = 0, i = this.items;
|
|
11
|
+
return {
|
|
12
|
+
next: function() {
|
|
13
|
+
return { value: i[t++], done: t > i.length };
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}, e.prototype.add = function(t, i) {
|
|
17
|
+
i === void 0 && (i = e.DEFAULTPRIORITY);
|
|
18
|
+
var s = this.items.length;
|
|
19
|
+
do
|
|
20
|
+
s--;
|
|
21
|
+
while (s >= 0 && i < this.items[s].priority);
|
|
22
|
+
return this.items.splice(s + 1, 0, { item: t, priority: i }), t;
|
|
23
|
+
}, e.prototype.remove = function(t) {
|
|
24
|
+
var i = this.items.length;
|
|
25
|
+
do
|
|
26
|
+
i--;
|
|
27
|
+
while (i >= 0 && this.items[i].item !== t);
|
|
28
|
+
i >= 0 && this.items.splice(i, 1);
|
|
29
|
+
}, e.DEFAULTPRIORITY = 5, e;
|
|
30
|
+
})();
|
|
31
|
+
return r.PrioritizedList = n, r;
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
u as r
|
|
35
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as wt } from "./Options-BStFr0zv.js";
|
|
2
|
-
import {
|
|
2
|
+
import { r as Nt, b as g, a as xt, d as Pt, e as At } from "./Factory-hCmMrRZd.js";
|
|
3
3
|
var V = {}, Y;
|
|
4
4
|
function Et() {
|
|
5
5
|
if (Y) return V;
|
|
@@ -2146,30 +2146,30 @@ function re() {
|
|
|
2146
2146
|
return $.TeXAtom = i, i.prototype.adjustTeXclass = f.MmlMo.prototype.adjustTeXclass, $;
|
|
2147
2147
|
}
|
|
2148
2148
|
export {
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2149
|
+
Xt as a,
|
|
2150
|
+
It as b,
|
|
2151
|
+
Lt as c,
|
|
2152
|
+
Bt as d,
|
|
2153
2153
|
Rt as e,
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2154
|
+
qt as f,
|
|
2155
|
+
zt as g,
|
|
2156
|
+
Ht as h,
|
|
2157
|
+
Jt as i,
|
|
2158
|
+
Dt as j,
|
|
2159
|
+
Ft as k,
|
|
2160
|
+
Kt as l,
|
|
2161
|
+
$t as m,
|
|
2162
|
+
Zt as n,
|
|
2163
|
+
Yt as o,
|
|
2164
|
+
St as p,
|
|
2165
|
+
Ut as q,
|
|
2166
|
+
kt as r,
|
|
2167
|
+
Gt as s,
|
|
2168
|
+
Qt as t,
|
|
2169
|
+
Vt as u,
|
|
2170
|
+
Wt as v,
|
|
2171
|
+
ee as w,
|
|
2172
2172
|
te as x,
|
|
2173
|
-
|
|
2174
|
-
|
|
2173
|
+
re as y,
|
|
2174
|
+
Et as z
|
|
2175
2175
|
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
const b = {
|
|
2
|
+
fogra39: {
|
|
3
|
+
id: "fogra39",
|
|
4
|
+
file: "fogra39-coated.icc",
|
|
5
|
+
label: "FOGRA39 — coated paper (Europe, ISO Coated v2)",
|
|
6
|
+
outputConditionIdentifier: "FOGRA39",
|
|
7
|
+
outputCondition: "Offset commercial and specialty printing according to ISO 12647-2:2004 / Amd 1, paper type 1 or 2 (gloss or matte coated offset), 115 g/m2, screen ruling 60/cm"
|
|
8
|
+
},
|
|
9
|
+
gracol: {
|
|
10
|
+
id: "gracol",
|
|
11
|
+
file: "gracol-tr006-coated.icc",
|
|
12
|
+
label: "GRACoL — coated paper (US, CGATS TR 006)",
|
|
13
|
+
outputConditionIdentifier: "CGATS TR 006",
|
|
14
|
+
outputCondition: "Commercial offset lithography on grade 1 paper (GRACoL), CGATS TR 006"
|
|
15
|
+
}
|
|
16
|
+
}, I = "fogra39", G = (r) => Math.round(r * 10) / 10, C = (r, o, e) => Math.min(e, Math.max(o, r));
|
|
17
|
+
function F(r, o, e, s) {
|
|
18
|
+
const f = r.cmsOpenProfileFromMem(s, s.byteLength);
|
|
19
|
+
if (!f) throw new Error(`Could not open ICC profile ${e.file}`);
|
|
20
|
+
if (r.cmsGetColorSpaceASCII(f) !== "CMYK") throw new Error(`${e.file} is not a CMYK profile`);
|
|
21
|
+
const u = r.cmsCreate_sRGBProfile(), g = o.FLOAT_SH(1) | o.COLORSPACE_SH(o.PT_RGB) | o.CHANNELS_SH(3) | o.BYTES_SH(4), p = o.FLOAT_SH(1) | o.COLORSPACE_SH(o.PT_CMYK) | o.CHANNELS_SH(4) | o.BYTES_SH(4), _ = o.INTENT_RELATIVE_COLORIMETRIC, h = o.cmsFLAGS_BLACKPOINTCOMPENSATION, A = r.cmsCreateTransform(u, g, f, p, _, h), R = r.cmsCreateTransform(f, p, u, g, _, h), S = r.cmsCreateTransform(u, o.TYPE_RGB_8, f, o.TYPE_CMYK_8, _, h), w = r.cmsCreateTransform(f, o.TYPE_CMYK_8, u, o.TYPE_RGB_8, _, h);
|
|
22
|
+
if (!A || !R || !S || !w) throw new Error("Could not create the colour transforms");
|
|
23
|
+
const M = /* @__PURE__ */ new Map(), O = (t) => {
|
|
24
|
+
const [a, n, i] = t.map((y) => C(Math.round(y), 0, 255));
|
|
25
|
+
if (a === 0 && n === 0 && i === 0) return [0, 0, 0, 100];
|
|
26
|
+
const l = a << 16 | n << 8 | i, m = M.get(l);
|
|
27
|
+
if (m) return [...m];
|
|
28
|
+
const c = r.cmsDoTransform(A, new Float32Array([a / 255, n / 255, i / 255]), 1), T = [0, 1, 2, 3].map((y) => C(G(c[y]), 0, 100));
|
|
29
|
+
return M.set(l, T), [...T];
|
|
30
|
+
}, P = (t) => {
|
|
31
|
+
const a = r.cmsDoTransform(R, new Float32Array(t.map((n) => C(n, 0, 100))), 1);
|
|
32
|
+
return [0, 1, 2].map((n) => C(Math.round(a[n] * 255), 0, 255));
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
profile: e,
|
|
36
|
+
profileBytes: s,
|
|
37
|
+
rgbToCmyk: O,
|
|
38
|
+
cmykToRgb: P,
|
|
39
|
+
proof: (t) => P(O(t)),
|
|
40
|
+
imageToCmyk: (t) => {
|
|
41
|
+
const a = t.length >> 2, n = new Uint8Array(a * 3);
|
|
42
|
+
let i = !0;
|
|
43
|
+
const l = new Uint8Array(a);
|
|
44
|
+
for (let c = 0; c < a; c++) {
|
|
45
|
+
n[c * 3] = t[c * 4], n[c * 3 + 1] = t[c * 4 + 1], n[c * 3 + 2] = t[c * 4 + 2];
|
|
46
|
+
const T = t[c * 4 + 3];
|
|
47
|
+
l[c] = T, T !== 255 && (i = !1);
|
|
48
|
+
}
|
|
49
|
+
return { cmyk: r.cmsDoTransform(S, n, a).subarray(0, a * 4), alpha: i ? null : l };
|
|
50
|
+
},
|
|
51
|
+
proofLut: (t) => {
|
|
52
|
+
if (!(t >= 2 && t <= 65)) throw new Error("proofLut: n must be 2–65");
|
|
53
|
+
const a = new Uint8Array(t * t * t * 3);
|
|
54
|
+
let n = 0;
|
|
55
|
+
for (let l = 0; l < t; l++) for (let m = 0; m < t; m++) for (let c = 0; c < t; c++)
|
|
56
|
+
a[n++] = Math.round(c * 255 / (t - 1)), a[n++] = Math.round(m * 255 / (t - 1)), a[n++] = Math.round(l * 255 / (t - 1));
|
|
57
|
+
const i = r.cmsDoTransform(S, a, t * t * t).slice(0, t * t * t * 4);
|
|
58
|
+
return i.set([0, 0, 0, 255], 0), r.cmsDoTransform(w, i, t * t * t).slice(0, t * t * t * 3);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function k(r) {
|
|
63
|
+
const o = r.trim().toLowerCase();
|
|
64
|
+
let e = o.match(/^#([0-9a-f]{3})$/);
|
|
65
|
+
return e ? [...e[1]].map((s) => parseInt(s + s, 16)) : (e = o.match(/^#([0-9a-f]{6})([0-9a-f]{2})?$/), e ? [0, 2, 4].map((s) => parseInt(e[1].slice(s, s + 2), 16)) : (e = o.match(/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/), e ? [e[1], e[2], e[3]].map((s) => C(Math.round(parseFloat(s)), 0, 255)) : null));
|
|
66
|
+
}
|
|
67
|
+
const Y = (r) => "#" + r.map((o) => C(Math.round(o), 0, 255).toString(16).padStart(2, "0")).join(""), E = /* @__PURE__ */ new Map();
|
|
68
|
+
let d = null;
|
|
69
|
+
const H = () => (d || (d = (async () => {
|
|
70
|
+
const [r, o] = await Promise.all([
|
|
71
|
+
import("./lcms-Car3bVu8.js"),
|
|
72
|
+
import("./lcms-tShoQ1hy.js")
|
|
73
|
+
]);
|
|
74
|
+
return { lcms: await r.instantiate({ locateFile: () => o.default }), L: r };
|
|
75
|
+
})(), d.catch(() => {
|
|
76
|
+
d = null;
|
|
77
|
+
})), d);
|
|
78
|
+
function N(r = I) {
|
|
79
|
+
let o = E.get(r);
|
|
80
|
+
if (!o) {
|
|
81
|
+
const e = b[r];
|
|
82
|
+
o = (async () => {
|
|
83
|
+
const [{ lcms: f, L: u }, g] = await Promise.all([
|
|
84
|
+
H(),
|
|
85
|
+
fetch(`/icc/${e.file}`).then((p) => {
|
|
86
|
+
if (!p.ok) throw new Error(`Profile fetch failed: ${e.file} (${p.status})`);
|
|
87
|
+
return p.arrayBuffer();
|
|
88
|
+
})
|
|
89
|
+
]);
|
|
90
|
+
return F(f, u, e, new Uint8Array(g));
|
|
91
|
+
})(), E.set(r, o), o.catch(() => E.delete(r));
|
|
92
|
+
}
|
|
93
|
+
return o;
|
|
94
|
+
}
|
|
95
|
+
const B = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
96
|
+
__proto__: null,
|
|
97
|
+
DEFAULT_PRINT_PROFILE: I,
|
|
98
|
+
PRINT_PROFILES: b,
|
|
99
|
+
createColorEngine: F,
|
|
100
|
+
loadColorEngine: N,
|
|
101
|
+
parseRgb: k,
|
|
102
|
+
rgbToHex: Y
|
|
103
|
+
}, Symbol.toStringTag, { value: "Module" })), $ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
104
|
+
__proto__: null
|
|
105
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
106
|
+
export {
|
|
107
|
+
$ as _,
|
|
108
|
+
B as c,
|
|
109
|
+
k as p
|
|
110
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var o = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2
|
+
function l(e) {
|
|
3
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4
|
+
}
|
|
5
|
+
export {
|
|
6
|
+
o as c,
|
|
7
|
+
l as g
|
|
8
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { g as w, a as P, b as E, c as T } from "./ai-providers-CycU8sO1.js";
|
|
2
|
-
import { s as u, b as r, p as y, u as b,
|
|
2
|
+
import { s as u, b as r, p as y, u as b, C as B, g as v, f as j } from "./index-D1ifHWAi.js";
|
|
3
3
|
const z = {
|
|
4
4
|
rewrite: "Rewrite this text to be clearer and more engaging while keeping its meaning and rough length.",
|
|
5
5
|
shorten: "Shorten this text to roughly half its length while keeping the key message.",
|
|
6
6
|
expand: "Expand this text with one or two extra sentences of relevant detail.",
|
|
7
7
|
fix: "Fix any spelling and grammar mistakes. Change nothing else."
|
|
8
8
|
};
|
|
9
|
-
async function
|
|
9
|
+
async function _(p, s = "rewrite", i) {
|
|
10
10
|
const { provider: e, model: t, apiKey: a } = E();
|
|
11
11
|
if (!a)
|
|
12
12
|
return r("Add an API key in AI Settings first", "error"), 0;
|
|
@@ -38,7 +38,7 @@ ${g.text}`,
|
|
|
38
38
|
}
|
|
39
39
|
return l > 0 ? r(`Magic Write updated ${l} text element${l === 1 ? "" : "s"}`, "success") : c || B(), l;
|
|
40
40
|
}
|
|
41
|
-
async function
|
|
41
|
+
async function S(p, s, i) {
|
|
42
42
|
const e = w("openai");
|
|
43
43
|
if (!e) return { dataURL: null, error: "Add an OpenAI API key in AI Settings first" };
|
|
44
44
|
try {
|
|
@@ -104,9 +104,9 @@ function D(p, s, i, e) {
|
|
|
104
104
|
async function K(p, s = {}) {
|
|
105
105
|
const i = s.size || "1024x1024", e = P("openai"), t = i === "1536x1024" ? "1792x1024" : i === "1024x1536" ? "1024x1792" : "1024x1024";
|
|
106
106
|
r("Generating image…", "loading");
|
|
107
|
-
let a = await
|
|
107
|
+
let a = await S(p, e.startsWith("dall-e") ? t : i, e);
|
|
108
108
|
if (!a.dataURL && e !== "dall-e-3") {
|
|
109
|
-
const l = await
|
|
109
|
+
const l = await S(p, t, "dall-e-3");
|
|
110
110
|
l.dataURL && (a = l);
|
|
111
111
|
}
|
|
112
112
|
if (!a.dataURL)
|
|
@@ -215,14 +215,14 @@ async function Y(p, s = {}) {
|
|
|
215
215
|
"prompt",
|
|
216
216
|
(s.prompt?.trim() ? `${s.prompt.trim()}. ` : "") + "Extend the existing image seamlessly into the transparent areas, continuing its scene, lighting, style, and perspective. Keep the original (non-transparent) pixels unchanged."
|
|
217
217
|
), f.append("size", "auto");
|
|
218
|
-
const { b64: L, error:
|
|
218
|
+
const { b64: L, error: $ } = await x(f, t);
|
|
219
219
|
return L ? (y(), b(e.id, {
|
|
220
220
|
dataURL: `data:image/png;base64,${L}`,
|
|
221
221
|
x: e.x - e.width * a,
|
|
222
222
|
y: e.y - e.height * o,
|
|
223
223
|
width: e.width * (1 + a + n),
|
|
224
224
|
height: e.height * (1 + o + l)
|
|
225
|
-
}), r("Magic Expand applied", "success"), !0) : (r(
|
|
225
|
+
}), r("Magic Expand applied", "success"), !0) : (r($ || "Magic Expand failed", "error"), !1);
|
|
226
226
|
} catch (c) {
|
|
227
227
|
return r(`Magic Expand failed: ${c?.message || c}`, "error"), !1;
|
|
228
228
|
}
|
|
@@ -279,7 +279,7 @@ export {
|
|
|
279
279
|
Y as expandImage,
|
|
280
280
|
K as generateImage,
|
|
281
281
|
W as magicEditImage,
|
|
282
|
-
|
|
282
|
+
_ as magicWrite,
|
|
283
283
|
H as removeBackground,
|
|
284
284
|
J as replaceBackground
|
|
285
285
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { b as x, c as S } from "./ai-providers-CycU8sO1.js";
|
|
2
|
-
import { b as u,
|
|
2
|
+
import { b as u, E as A, s as C, g as y, z as M, f as D } from "./index-D1ifHWAi.js";
|
|
3
3
|
const P = 'You are a senior graphic designer. Reply with ONLY a JSON object, no markdown fences, matching exactly: {"headline": string (max 6 words), "subhead": string (max 12 words), "bullets": string[] (0-4 short items), "cta": string (max 5 words, optional), "palette": {"background": hex, "primary": hex, "accent": hex, "text": hex}}. The palette must be harmonious with strong text/background contrast.';
|
|
4
4
|
function $(r) {
|
|
5
5
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { l as w, g as v, c as g } from "./ai-providers-CycU8sO1.js";
|
|
2
2
|
import { a as x } from "./image-utils-CJQBaGoQ.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ac as A, ad as N } from "./index-D1ifHWAi.js";
|
|
4
4
|
function y() {
|
|
5
5
|
return `You are a diagram generation assistant for YappyDraw. You output ONLY valid JSON DSL — no markdown fences, no explanation, no commentary. Just the raw JSON object.
|
|
6
6
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { k as I, l as u, m as l, n as m, o as S, q as U, r as w, D as E, b as N, v as y, w as O, x as p, y as T, A as C, B as G } from "./index-D1ifHWAi.js";
|
|
2
2
|
const f = "yappy:drawings:index", c = (t) => `yappy:drawing:${t}`;
|
|
3
3
|
function $() {
|
|
4
4
|
return `d-${typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.floor(Math.random() * 1e9)}`}`;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function k(t) {
|
|
7
7
|
const n = t;
|
|
8
8
|
return !!n.gameScript?.trim() || n.gameAuthoringMode === "code" || (n.sceneBehaviors?.length ?? 0) > 0 || n.blueprints && Object.keys(n.blueprints).length > 0 || Array.isArray(t.elements) && t.elements.some((a) => (a.behaviors?.length ?? 0) > 0);
|
|
9
9
|
}
|
|
10
|
-
class
|
|
10
|
+
class j extends Error {
|
|
11
11
|
constructor() {
|
|
12
12
|
super("Local storage is unavailable — the drawing was not saved to disk."), this.name = "StorageUnavailableError";
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
async function
|
|
15
|
+
async function J() {
|
|
16
16
|
return await m(f), S() === null;
|
|
17
17
|
}
|
|
18
18
|
async function o() {
|
|
@@ -23,9 +23,9 @@ async function g(t) {
|
|
|
23
23
|
}
|
|
24
24
|
async function b(t, n = {}) {
|
|
25
25
|
G();
|
|
26
|
-
const a = JSON.stringify(t), r = (/* @__PURE__ */ new Date()).toISOString(), i = await o(), e = n.id ? i.find((d) => d.id === n.id) : void 0, s = e?.id ?? n.id ?? $(),
|
|
26
|
+
const a = JSON.stringify(t), r = (/* @__PURE__ */ new Date()).toISOString(), i = await o(), e = n.id ? i.find((d) => d.id === n.id) : void 0, s = e?.id ?? n.id ?? $(), x = (n.name ?? t.metadata?.name ?? e?.name ?? "Untitled").trim() || "Untitled", h = {
|
|
27
27
|
id: s,
|
|
28
|
-
name:
|
|
28
|
+
name: x,
|
|
29
29
|
createdAt: e?.createdAt ?? r,
|
|
30
30
|
updatedAt: r,
|
|
31
31
|
docType: t.metadata?.docType ?? e?.docType,
|
|
@@ -33,12 +33,12 @@ async function b(t, n = {}) {
|
|
|
33
33
|
pageCount: Array.isArray(t.slides) ? t.slides.length : 0,
|
|
34
34
|
sizeBytes: a.length,
|
|
35
35
|
thumb: n.thumb ?? e?.thumb,
|
|
36
|
-
isGame:
|
|
37
|
-
},
|
|
38
|
-
if (await g(v), !
|
|
36
|
+
isGame: k(t)
|
|
37
|
+
}, A = await y(c(s), a), v = [h, ...i.filter((d) => d.id !== s)];
|
|
38
|
+
if (await g(v), !A) throw new j();
|
|
39
39
|
return h;
|
|
40
40
|
}
|
|
41
|
-
async function
|
|
41
|
+
async function M(t = {}) {
|
|
42
42
|
const n = O(), a = t.name ?? p();
|
|
43
43
|
a && a !== p() && w(a);
|
|
44
44
|
let r;
|
|
@@ -49,7 +49,7 @@ async function B(t = {}) {
|
|
|
49
49
|
const i = t.forceNew ? void 0 : u() ?? void 0, e = await b(n, { id: i, name: a, thumb: r });
|
|
50
50
|
return l(e.id), C(), e;
|
|
51
51
|
}
|
|
52
|
-
async function
|
|
52
|
+
async function q() {
|
|
53
53
|
return o();
|
|
54
54
|
}
|
|
55
55
|
async function D(t) {
|
|
@@ -61,7 +61,7 @@ async function D(t) {
|
|
|
61
61
|
return null;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
async function
|
|
64
|
+
async function K(t) {
|
|
65
65
|
const n = await D(t);
|
|
66
66
|
if (!n) return !1;
|
|
67
67
|
try {
|
|
@@ -89,21 +89,21 @@ async function _(t) {
|
|
|
89
89
|
const n = await o();
|
|
90
90
|
await g(n.filter((a) => a.id !== t)), await I(c(t)), u() === t && l(null);
|
|
91
91
|
}
|
|
92
|
-
async function
|
|
92
|
+
async function z() {
|
|
93
93
|
return (await o()).length;
|
|
94
94
|
}
|
|
95
95
|
export {
|
|
96
|
-
|
|
96
|
+
j as StorageUnavailableError,
|
|
97
97
|
u as activeDrawingId,
|
|
98
|
-
|
|
98
|
+
z as countDrawings,
|
|
99
99
|
_ as deleteDrawing,
|
|
100
100
|
Y as duplicateDrawing,
|
|
101
|
-
|
|
101
|
+
J as galleryReadable,
|
|
102
102
|
D as getDrawingDoc,
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
q as listDrawings,
|
|
104
|
+
K as openDrawing,
|
|
105
105
|
R as renameDrawing,
|
|
106
|
-
|
|
106
|
+
M as saveCurrentToGallery,
|
|
107
107
|
b as saveDrawingDoc,
|
|
108
108
|
l as setActiveDrawingId
|
|
109
109
|
};
|