ryugi-artifacts 1.44.2 → 1.45.0
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/cli.cjs +3 -3
- package/dist/server.cjs +15 -7
- package/dist/viewer/ArtboardLayout-CEMDFlf8.js +4 -0
- package/dist/viewer/{Canvas-BGsWPJ-x.js → Canvas-rA-WWhK0.js} +1 -1
- package/dist/viewer/{PreviewLayout-C8gcd1VB.js → PreviewLayout-D1TSafCI.js} +2 -2
- package/dist/viewer/index.js +2 -2
- package/dist/viewer/preview.html +2 -2
- package/dist/viewer/preview.js +1 -1
- package/dist/viewer/view-D7nULBen.js +1 -0
- package/dist/viewer-lib/{Canvas-CNqEckLj.js → Canvas-OcYUm3tP.js} +1 -1
- package/dist/viewer-lib/{PreviewView-BD64tt21.js → PreviewView-Clnb4pmR.js} +55 -45
- package/dist/viewer-lib/core.js +2 -2
- package/dist/viewer-lib/index.js +1259 -1229
- package/dist/viewer-lib/types/src/viewer/hooks/useBoardTiers.d.ts +2 -1
- package/dist/viewer-lib/types/src/viewer/layouts/PhoneArtboard.d.ts +2 -1
- package/dist/viewer-lib/types/src/viewer/lib/board-tiers.d.ts +5 -3
- package/dist/viewer-lib/types/src/viewer/lib/hover-dwell.d.ts +1 -1
- package/dist/viewer-lib/types/src/viewer/lib/live-limit.d.ts +33 -0
- package/dist/viewer-lib/types/src/viewer/lib/tier-controller.d.ts +1 -0
- package/package.json +1 -1
- package/dist/viewer/ArtboardLayout-1sSly5VR.js +0 -4
- package/dist/viewer/view-V7XcFKme.js +0 -1
|
@@ -27,7 +27,7 @@ var f = [
|
|
|
27
27
|
"html",
|
|
28
28
|
"image",
|
|
29
29
|
"video"
|
|
30
|
-
], m = (e) => e.type === "image" || e.type === "video", h = "[a-z0-9][a-z0-9-]*", g = "(?:[\\w-]{21}|[a-f0-9]{32})", _ = `(?:${h}|${g})`, v = RegExp(`^${h}$`), y = RegExp(`^${g}$`), b = (e) => v.test(e), x = (e) => y.test(e),
|
|
30
|
+
], m = (e) => e.type === "image" || e.type === "video", h = "[a-z0-9][a-z0-9-]*", g = "(?:[\\w-]{21}|[a-f0-9]{32})", _ = `(?:${h}|${g})`, v = RegExp(`^${h}$`), y = RegExp(`^${g}$`), b = (e) => v.test(e), x = (e) => y.test(e), ee = (e) => v.test(e) || y.test(e), S = (e) => f.includes(e), C = class extends n {
|
|
31
31
|
state = {
|
|
32
32
|
error: null,
|
|
33
33
|
resetKey: this.props.resetKey
|
|
@@ -47,17 +47,17 @@ var f = [
|
|
|
47
47
|
children: t("chrome.canvasFailed", { message: this.state.error.message })
|
|
48
48
|
}) : this.props.children;
|
|
49
49
|
}
|
|
50
|
-
},
|
|
51
|
-
function
|
|
52
|
-
return /* @__PURE__ */ l(
|
|
50
|
+
}, w = i(null);
|
|
51
|
+
function T({ pageWindow: e, children: t }) {
|
|
52
|
+
return /* @__PURE__ */ l(w.Provider, {
|
|
53
53
|
value: e ?? null,
|
|
54
54
|
children: t
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
var
|
|
57
|
+
var E = () => o(w) ?? window;
|
|
58
58
|
//#endregion
|
|
59
59
|
//#region src/viewer/hooks/useSystemTheme.ts
|
|
60
|
-
function
|
|
60
|
+
function D() {
|
|
61
61
|
s(() => {
|
|
62
62
|
let e = window.matchMedia("(prefers-color-scheme: dark)"), t = () => u({ appearance: e.matches ? "dark" : "light" });
|
|
63
63
|
return t(), e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
@@ -65,47 +65,47 @@ function O() {
|
|
|
65
65
|
}
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region src/viewer/lib/view.ts
|
|
68
|
-
var
|
|
68
|
+
var te = .02, O = .9, k = (e) => Math.min(4, Math.max(te, e)), A = (e) => ({
|
|
69
69
|
minX: e.x,
|
|
70
70
|
minY: e.y,
|
|
71
71
|
maxX: e.x + e.w,
|
|
72
72
|
maxY: e.y + e.h
|
|
73
73
|
});
|
|
74
|
-
function
|
|
75
|
-
let r = Math.max(1, t.width - n.left - n.right), i = Math.max(1, t.height - n.top - n.bottom), a = Math.max(1, e.maxX - e.minX), o = Math.max(1, e.maxY - e.minY), s =
|
|
74
|
+
function j(e, t, n) {
|
|
75
|
+
let r = Math.max(1, t.width - n.left - n.right), i = Math.max(1, t.height - n.top - n.bottom), a = Math.max(1, e.maxX - e.minX), o = Math.max(1, e.maxY - e.minY), s = k(Math.min(1, Math.min(r / a, i / o) * O));
|
|
76
76
|
return {
|
|
77
77
|
k: s,
|
|
78
78
|
x: n.left + (r - a * s) / 2 - e.minX * s,
|
|
79
79
|
y: n.top + (i - o * s) / 2 - e.minY * s
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
let i =
|
|
82
|
+
function M(e, t, n, r) {
|
|
83
|
+
let i = k(e.k * t), a = i / e.k;
|
|
84
84
|
return {
|
|
85
85
|
k: i,
|
|
86
86
|
x: n - (n - e.x) * a,
|
|
87
87
|
y: r - (r - e.y) * a
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function N(e, t, n) {
|
|
91
91
|
let r = ([e, t]) => Math.max(1, Math.hypot(t.x - e.x, t.y - e.y)), i = ([e, t]) => ({
|
|
92
92
|
x: (e.x + t.x) / 2,
|
|
93
93
|
y: (e.y + t.y) / 2
|
|
94
|
-
}), a =
|
|
94
|
+
}), a = k(e.k * (r(n) / r(t))), o = a / e.k, s = i(t), c = i(n);
|
|
95
95
|
return {
|
|
96
96
|
k: a,
|
|
97
97
|
x: c.x - (s.x - e.x) * o,
|
|
98
98
|
y: c.y - (s.y - e.y) * o
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
function
|
|
102
|
-
return
|
|
101
|
+
function P(e, t, n, r) {
|
|
102
|
+
return M(e, t / e.k, n, r);
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function F(e, t, n) {
|
|
105
105
|
let r = e.boards[n];
|
|
106
106
|
if (r) return {
|
|
107
107
|
page: r.page,
|
|
108
|
-
bounds:
|
|
108
|
+
bounds: A({
|
|
109
109
|
...r,
|
|
110
110
|
y: r.y - 48,
|
|
111
111
|
h: r.h + 48
|
|
@@ -115,12 +115,12 @@ function L(e, t, n) {
|
|
|
115
115
|
let t = r.groups[n] ?? r.notes[n];
|
|
116
116
|
if (t) return {
|
|
117
117
|
page: e,
|
|
118
|
-
bounds:
|
|
118
|
+
bounds: A(t)
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
return null;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function I(e, t) {
|
|
124
124
|
let n = e.w * t.k;
|
|
125
125
|
return n < 48 ? null : {
|
|
126
126
|
left: t.x + e.x * t.k,
|
|
@@ -128,34 +128,34 @@ function R(e, t) {
|
|
|
128
128
|
width: n
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
|
-
var
|
|
131
|
+
var L = {
|
|
132
132
|
base: 27,
|
|
133
133
|
follow: .7,
|
|
134
134
|
min: 4,
|
|
135
135
|
hideBelow: .05,
|
|
136
136
|
cap: !0
|
|
137
|
-
},
|
|
137
|
+
}, R = {
|
|
138
138
|
base: 23,
|
|
139
139
|
follow: .85,
|
|
140
140
|
min: 0,
|
|
141
141
|
hideBelow: .11,
|
|
142
142
|
cap: !0
|
|
143
|
-
},
|
|
143
|
+
}, z = {
|
|
144
144
|
follow: 1,
|
|
145
145
|
min: 24,
|
|
146
146
|
hideBelow: 0,
|
|
147
147
|
cap: !1
|
|
148
148
|
};
|
|
149
|
-
function
|
|
149
|
+
function B(e, t) {
|
|
150
150
|
if (t < e.hideBelow) return null;
|
|
151
151
|
let n = e.base * t ** e.follow;
|
|
152
152
|
return Math.max(e.cap ? Math.min(n, e.base) : n, e.min);
|
|
153
153
|
}
|
|
154
|
-
var
|
|
155
|
-
...
|
|
154
|
+
var V = (e, t) => B({
|
|
155
|
+
...z,
|
|
156
156
|
base: e
|
|
157
157
|
}, t) / (e * t);
|
|
158
|
-
function
|
|
158
|
+
function H(e, t, n, r) {
|
|
159
159
|
let i = (e, t, n) => 3 * t * e * (1 - e) ** 2 + 3 * n * e ** 2 * (1 - e) + e ** 3, a = (e, t, n) => 3 * t * (1 - e) ** 2 + 6 * (n - t) * e * (1 - e) + 3 * (1 - n) * e ** 2;
|
|
160
160
|
return (o) => {
|
|
161
161
|
if (o <= 0 || o >= 1) return Math.min(1, Math.max(0, o));
|
|
@@ -168,11 +168,21 @@ function W(e, t, n, r) {
|
|
|
168
168
|
return i(s, t, r);
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
var
|
|
171
|
+
var U = (e, t, n) => ({
|
|
172
172
|
x: e.x + (t.x - e.x) * n,
|
|
173
173
|
y: e.y + (t.y - e.y) * n,
|
|
174
174
|
k: e.k + (t.k - e.k) * n
|
|
175
|
-
}),
|
|
175
|
+
}), W = {
|
|
176
|
+
width: 1440,
|
|
177
|
+
height: 900
|
|
178
|
+
};
|
|
179
|
+
function G({ device: e = {}, viewport: t }) {
|
|
180
|
+
let { cores: n, memoryGB: r } = e, i = Math.min(Math.max(t.width * t.height / (W.width * W.height), .75), 1.75), a = r !== void 0 && r <= 4 ? .5 : 1, o = n !== void 0 && n <= 4 ? .7 : 1, s = n !== void 0 && n >= 12 ? 1.2 : 1;
|
|
181
|
+
return Math.min(Math.max(Math.round(24 * i * a * o * s), 8), 32);
|
|
182
|
+
}
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/viewer/lib/board-tiers.ts
|
|
185
|
+
var K = [
|
|
176
186
|
.125,
|
|
177
187
|
.25,
|
|
178
188
|
.5,
|
|
@@ -187,8 +197,8 @@ var G = (e, t, n) => ({
|
|
|
187
197
|
bottom: r + e.h * t.k
|
|
188
198
|
};
|
|
189
199
|
}, X = ({ left: e, top: t, right: n, bottom: r }, i) => Math.max(0, Math.min(n, i.width) - Math.max(e, 0)) * Math.max(0, Math.min(r, i.height) - Math.max(t, 0));
|
|
190
|
-
function Z({ boards: e, view: t, viewport: n, pinned: r, snapshots: i, hovered: a }) {
|
|
191
|
-
let
|
|
200
|
+
function Z({ boards: e, view: t, viewport: n, pinned: r, snapshots: i, hovered: a, limit: o = 24, untilSnapshot: s = !1 }) {
|
|
201
|
+
let c = e.map((e) => {
|
|
192
202
|
let r = Y(e, t), { left: i, top: a, right: o, bottom: s } = r, c = X(r, n), l = Math.hypot(Math.max(0, -o, i - n.width), Math.max(0, -s, a - n.height));
|
|
193
203
|
return {
|
|
194
204
|
id: e.id,
|
|
@@ -196,8 +206,8 @@ function Z({ boards: e, view: t, viewport: n, pinned: r, snapshots: i, hovered:
|
|
|
196
206
|
mostlyVisible: c * 2 > Math.min((o - i) * (s - a), n.width * n.height),
|
|
197
207
|
distance: l
|
|
198
208
|
};
|
|
199
|
-
}),
|
|
200
|
-
return new Map(
|
|
209
|
+
}), l = a && !r.has(a) && c.some((e) => e.id === a) ? [a] : [], u = t.k >= .4 ? c.filter((e) => e.mostlyVisible && !r.has(e.id) && e.id !== a && (!s || !i.has(e.id))).sort((e, t) => t.area - e.area).map((e) => e.id) : [], d = new Set([...l, ...u].slice(0, Math.max(0, o)));
|
|
210
|
+
return new Map(c.map(({ id: e, distance: t }) => r.has(e) || d.has(e) ? [e, "live"] : t > n.width ? [e, "empty"] : [e, i.has(e) ? "snapshot" : "placeholder"]));
|
|
201
211
|
}
|
|
202
212
|
function Q({ boards: e, view: t, viewport: n }) {
|
|
203
213
|
return new Map(e.map((e) => {
|
|
@@ -211,16 +221,16 @@ function Q({ boards: e, view: t, viewport: n }) {
|
|
|
211
221
|
}];
|
|
212
222
|
}));
|
|
213
223
|
}
|
|
214
|
-
function
|
|
215
|
-
return e.filter((e) => !r.has(e.id) && !i.has(e.id) && e.w * t.k >=
|
|
224
|
+
function ne({ boards: e, view: t, viewport: n, snapshots: r, skip: i, minWidth: a = 120 }) {
|
|
225
|
+
return e.filter((e) => !r.has(e.id) && !i.has(e.id) && e.w * t.k >= a).map((e) => ({
|
|
216
226
|
id: e.id,
|
|
217
227
|
area: X(Y(e, t), n)
|
|
218
228
|
})).filter((e) => e.area > 0).sort((e, t) => t.area - e.area).map((e) => e.id);
|
|
219
229
|
}
|
|
220
230
|
//#endregion
|
|
221
231
|
//#region src/viewer/layouts/PreviewView.tsx
|
|
222
|
-
var
|
|
223
|
-
function
|
|
232
|
+
var re = a(() => import("./shims.js").then(() => import("./SnapshotDocument-B2n8Szmf.js").then((e) => e.n))), $ = a(() => import("./Canvas-OcYUm3tP.js").then((e) => e.n).then(({ Canvas: e }) => ({ default: e }))), ie = () => () => {}, ae = () => {}, oe = /* @__PURE__ */ new Set();
|
|
233
|
+
function se({ type: t, id: n, data: i, failed: a }) {
|
|
224
234
|
let { t: o } = e(), [u, d] = c(() => ({
|
|
225
235
|
width: innerWidth,
|
|
226
236
|
height: innerHeight
|
|
@@ -245,11 +255,11 @@ function ae({ type: t, id: n, data: i, failed: a }) {
|
|
|
245
255
|
tabIndex: -1,
|
|
246
256
|
title: i.title
|
|
247
257
|
});
|
|
248
|
-
if (t === "document") return i.state ? /* @__PURE__ */ l(
|
|
258
|
+
if (t === "document") return i.state ? /* @__PURE__ */ l(C, {
|
|
249
259
|
resetKey: i.state,
|
|
250
260
|
children: /* @__PURE__ */ l(r, {
|
|
251
261
|
fallback: f(o("preview.loading")),
|
|
252
|
-
children: /* @__PURE__ */ l(
|
|
262
|
+
children: /* @__PURE__ */ l(re, {
|
|
253
263
|
contentBase: i.contentBase,
|
|
254
264
|
id: n,
|
|
255
265
|
state: i.state
|
|
@@ -258,7 +268,7 @@ function ae({ type: t, id: n, data: i, failed: a }) {
|
|
|
258
268
|
}) : f(o("preview.waitingDocument"));
|
|
259
269
|
let p = i.canvas, m = p?.activePage ?? p?.pages[0]?.id, h = m ? i.layout?.pages[m]?.bounds : null;
|
|
260
270
|
if (!p || !m || !h) return f(o("preview.waitingCanvas"));
|
|
261
|
-
let g =
|
|
271
|
+
let g = j(h, u, {
|
|
262
272
|
top: 24,
|
|
263
273
|
right: 24,
|
|
264
274
|
bottom: 24,
|
|
@@ -266,19 +276,19 @@ function ae({ type: t, id: n, data: i, failed: a }) {
|
|
|
266
276
|
}), _ = Object.entries(p.boards).filter(([, e]) => e.page === m);
|
|
267
277
|
return /* @__PURE__ */ l("div", {
|
|
268
278
|
className: "artifact-preview-canvas",
|
|
269
|
-
children: /* @__PURE__ */ l(
|
|
279
|
+
children: /* @__PURE__ */ l(C, {
|
|
270
280
|
resetKey: p,
|
|
271
281
|
children: /* @__PURE__ */ l(r, {
|
|
272
282
|
fallback: f(o("preview.loading")),
|
|
273
|
-
children: /* @__PURE__ */ l(
|
|
283
|
+
children: /* @__PURE__ */ l($, {
|
|
274
284
|
boards: _,
|
|
275
285
|
contentBase: i.contentBase,
|
|
276
|
-
frameLoaded:
|
|
277
|
-
frameRef:
|
|
286
|
+
frameLoaded: ae,
|
|
287
|
+
frameRef: ie,
|
|
278
288
|
inspecting: !1,
|
|
279
289
|
notes: Object.entries(p.notes ?? {}).filter(([, e]) => e.page === m),
|
|
280
290
|
pending: new Set(i.pending),
|
|
281
|
-
playing:
|
|
291
|
+
playing: oe,
|
|
282
292
|
replays: {},
|
|
283
293
|
versions: i.versions ?? {},
|
|
284
294
|
view: g,
|
|
@@ -296,4 +306,4 @@ function ae({ type: t, id: n, data: i, failed: a }) {
|
|
|
296
306
|
});
|
|
297
307
|
}
|
|
298
308
|
//#endregion
|
|
299
|
-
export {
|
|
309
|
+
export { m as A, _ as C, S as D, ee as E, f as O, C as S, b as T, M as _, Q as a, T as b, L as c, I as d, B as f, U as g, V as h, J as i, d as j, p as k, H as l, F as m, ne as n, G as o, N as p, Z as r, R as s, se as t, j as u, P as v, x as w, E as x, D as y };
|
package/dist/viewer-lib/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import './stylex-Bp5PFQ3Y.css';
|
|
2
|
-
import { A as e, C as t, D as n, E as r, O as i,
|
|
2
|
+
import { A as e, C as t, D as n, E as r, O as i, T as a, b as o, j as s, k as c, t as l, w as u, y as d } from "./PreviewView-Clnb4pmR.js";
|
|
3
3
|
import { a as f, c as p, d as m, f as h, i as g, l as _, m as v, n as y, o as b, p as x, r as S, s as C, t as w, u as T } from "./i18n-ah-b6Etu.js";
|
|
4
|
-
export {
|
|
4
|
+
export { t as ARTIFACT_LOCATOR_SOURCE, i as ARTIFACT_TYPES, c as BOARD_TYPES, b as HTML_LANG, l as PreviewView, w as Trans, o as ViewerProvider, s as cloudErrorDetails, y as createViewerI18n, S as i18n, u as isArtifactAddress, a as isArtifactId, r as isArtifactLocator, n as isArtifactType, e as isMediaBoard, _ as isVisibility, T as ownLink, C as parseAcceptLanguage, m as publishState, h as publishing, x as readPublication, p as resolveLocale, v as syncNote, g as t, d as useSystemTheme, f as useTranslation };
|