ryugi-artifacts 1.40.0 → 1.41.1

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.
@@ -1,6 +1,6 @@
1
1
  import './Canvas-DpuVHV-Q.css';
2
2
  import { n as e } from "./rolldown-runtime-5HNE8Q1r.js";
3
- import { E as t, b as n } from "./ids-DDz78ZZ5.js";
3
+ import { D as t, x as n } from "./ids-AIzX298J.js";
4
4
  import { d as r } from "./cloud-BA1xJLJk.js";
5
5
  import { useEffect as i, useLayoutEffect as a, useRef as o, useState as s } from "react";
6
6
  import { Maximize2 as c, Repeat as l } from "lucide-react";
@@ -391,7 +391,7 @@ function O({ x: e, y: t, zoom: n, agent: r, title: i }) {
391
391
  }
392
392
  //#endregion
393
393
  //#region src/viewer/components/Canvas.tsx
394
- var k = /* @__PURE__ */ e({ Canvas: () => N });
394
+ var k = /* @__PURE__ */ e({ Canvas: () => P });
395
395
  function A(e) {
396
396
  if (!e) return {
397
397
  backgroundColor: "#fff6db",
@@ -410,8 +410,8 @@ function A(e) {
410
410
  color: .2126 * n + .7152 * r + .0722 * i > .179 ? "#000" : "#fff"
411
411
  };
412
412
  }
413
- var j = { visibility: "hidden" };
414
- function M({ image: e, showImage: t, hideFrame: n, frame: r, onError: a }) {
413
+ var j = { visibility: "hidden" }, M = { opacity: 0 };
414
+ function N({ image: e, showImage: t, hideFrame: n, frame: r, onError: a }) {
415
415
  let [c, l] = s(null), [u, m] = s(!1), [h, g] = s(!1), _ = o(t);
416
416
  i(() => {
417
417
  if (!t || !c) {
@@ -443,7 +443,7 @@ function M({ image: e, showImage: t, hideFrame: n, frame: r, onError: a }) {
443
443
  className: "x10l6tqk x10a8y8t xh8yej3 x5yr21d x1lliihq x47corl"
444
444
  }, t))] });
445
445
  }
446
- function N({ view: e, renders: r, boards: i, notes: a, contentBase: o, versions: s, pending: c, playing: l, replays: u, inspecting: m, frameRef: v, frameLoaded: y, live: b, writing: x, agent: S, onExpand: w, onImageError: T }) {
446
+ function P({ view: e, renders: r, boards: i, notes: a, contentBase: o, versions: s, pending: c, playing: l, replays: u, inspecting: m, frameRef: v, frameLoaded: y, live: b, writing: x, agent: S, onExpand: w, onImageError: T }) {
447
447
  let E = x;
448
448
  if (b) {
449
449
  E = void 0;
@@ -484,7 +484,7 @@ function N({ view: e, renders: r, boards: i, notes: a, contentBase: o, versions:
484
484
  src: _(o, i.file, s[i.file] ?? 0, 0),
485
485
  zoom: e.k,
486
486
  onExpand: w && (() => w(n))
487
- }) : /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(M, {
487
+ }) : /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(N, {
488
488
  image: D,
489
489
  showImage: !E || !!b?.overlay,
490
490
  hideFrame: !!b?.hidden,
@@ -492,7 +492,7 @@ function N({ view: e, renders: r, boards: i, notes: a, contentBase: o, versions:
492
492
  frame: E ? (e) => /* @__PURE__ */ f("iframe", {
493
493
  ref: v(n),
494
494
  onLoad: () => y(n),
495
- style: e ? j : void 0,
495
+ style: e ? M : void 0,
496
496
  title: i.title ?? n,
497
497
  src: _(o, i.file, s[i.file] ?? 0, u[n] ?? 0),
498
498
  sandbox: "allow-scripts",
@@ -544,4 +544,4 @@ function N({ view: e, renders: r, boards: i, notes: a, contentBase: o, versions:
544
544
  });
545
545
  }
546
546
  //#endregion
547
- export { h as a, S as i, k as n, g as o, C as r, m as s, N as t };
547
+ export { h as a, S as i, k as n, g as o, C as r, m as s, P as t };
@@ -1,4 +1,4 @@
1
1
  import './stylex-Bp5PFQ3Y.css';
2
- import { E as e, T as t, a as n, i as r, n as i, o as a, r as o, t as s, w as c } from "./ids-DDz78ZZ5.js";
2
+ import { D as e, E as t, T as n, a as r, i, n as a, o, r as s, t as c } from "./ids-AIzX298J.js";
3
3
  import { a as l, c as u, d, f, i as p, l as m, m as h, n as g, o as _, p as v, r as y, s as b, t as x, u as S } from "./cloud-BA1xJLJk.js";
4
- export { c as ARTIFACT_TYPES, t as BOARD_TYPES, f as HTML_LANG, n as PreviewView, b as Trans, a as ViewerProvider, o as cloudErrorDetails, u as createViewerI18n, m as i18n, s as isArtifactId, i as isArtifactType, e as isMediaBoard, x as isVisibility, g as ownLink, v as parseAcceptLanguage, y as publishState, p as publishing, l as readPublication, h as resolveLocale, _ as syncNote, S as t, r as useSystemTheme, d as useTranslation };
4
+ export { n as ARTIFACT_TYPES, t as BOARD_TYPES, f as HTML_LANG, r as PreviewView, b as Trans, o as ViewerProvider, s as cloudErrorDetails, u as createViewerI18n, m as i18n, c as isArtifactId, a as isArtifactType, e as isMediaBoard, x as isVisibility, g as ownLink, v as parseAcceptLanguage, y as publishState, p as publishing, l as readPublication, h as resolveLocale, _ as syncNote, S as t, i as useSystemTheme, d as useTranslation };
@@ -153,19 +153,19 @@ var A = (e, t, n) => ({
153
153
  right: n + e.w * t.k,
154
154
  bottom: r + e.h * t.k
155
155
  };
156
- };
157
- function I({ boards: e, view: t, viewport: n, pinned: r, snapshots: i }) {
156
+ }, I = ({ 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));
157
+ function L({ boards: e, view: t, viewport: n, pinned: r, snapshots: i }) {
158
158
  let a = e.map((e) => {
159
- let { left: r, top: i, right: a, bottom: o } = F(e, t), s = Math.max(0, Math.min(a, n.width) - Math.max(r, 0)) * Math.max(0, Math.min(o, n.height) - Math.max(i, 0)), c = Math.hypot(Math.max(0, -a, r - n.width), Math.max(0, -o, i - n.height));
159
+ let r = F(e, t), { left: i, top: a, right: o, bottom: s } = r, c = I(r, n), l = Math.hypot(Math.max(0, -o, i - n.width), Math.max(0, -s, a - n.height));
160
160
  return {
161
161
  id: e.id,
162
- area: s,
163
- distance: c
162
+ area: c,
163
+ distance: l
164
164
  };
165
165
  }), o = t.k >= .4 ? new Set(a.filter((e) => e.area > 0).sort((e, t) => t.area - e.area).slice(0, 4).map((e) => e.id)) : /* @__PURE__ */ new Set();
166
166
  return new Map(a.map(({ id: e, distance: t }) => r.has(e) || o.has(e) ? [e, "live"] : t > n.width ? [e, "empty"] : [e, i.has(e) ? "snapshot" : "placeholder"]));
167
167
  }
168
- function L({ boards: e, view: t, viewport: n }) {
168
+ function R({ boards: e, view: t, viewport: n }) {
169
169
  return new Map(e.map((e) => {
170
170
  let { left: r, top: i, right: a, bottom: o } = F(e, t), s = a >= -240 && o >= -240 && r <= n.width + N && i <= n.height + N;
171
171
  return [e.id, {
@@ -177,17 +177,23 @@ function L({ boards: e, view: t, viewport: n }) {
177
177
  }];
178
178
  }));
179
179
  }
180
+ function z({ boards: e, view: t, viewport: n, snapshots: r, skip: i }) {
181
+ return e.filter((e) => !r.has(e.id) && !i.has(e.id) && e.w * t.k >= 120).map((e) => ({
182
+ id: e.id,
183
+ area: I(F(e, t), n)
184
+ })).filter((e) => e.area > 0).sort((e, t) => t.area - e.area).map((e) => e.id);
185
+ }
180
186
  //#endregion
181
187
  //#region src/viewer/ViewerContext.tsx
182
- var R = i(null);
183
- function z({ pageWindow: e, children: t }) {
184
- return /* @__PURE__ */ l(R.Provider, {
188
+ var B = i(null);
189
+ function V({ pageWindow: e, children: t }) {
190
+ return /* @__PURE__ */ l(B.Provider, {
185
191
  value: e ?? null,
186
192
  children: t
187
193
  });
188
194
  }
189
- var B = () => o(R) ?? window, V = a(() => import("./shims.js").then(() => import("./SnapshotDocument-De-tiDPI.js").then((e) => e.n))), H = a(() => import("./Canvas-BBqpPRdY.js").then((e) => e.n).then(({ Canvas: e }) => ({ default: e }))), U = () => () => {}, W = () => {}, G = /* @__PURE__ */ new Set();
190
- function K({ type: t, id: n, data: i, failed: a }) {
195
+ var H = () => o(B) ?? window, U = a(() => import("./shims.js").then(() => import("./SnapshotDocument-De-tiDPI.js").then((e) => e.n))), W = a(() => import("./Canvas-BsBvccuh.js").then((e) => e.n).then(({ Canvas: e }) => ({ default: e }))), G = () => () => {}, K = () => {}, q = /* @__PURE__ */ new Set();
196
+ function J({ type: t, id: n, data: i, failed: a }) {
191
197
  let { t: o } = e(), [u, d] = c(() => ({
192
198
  width: innerWidth,
193
199
  height: innerHeight
@@ -216,7 +222,7 @@ function K({ type: t, id: n, data: i, failed: a }) {
216
222
  resetKey: i.state,
217
223
  children: /* @__PURE__ */ l(r, {
218
224
  fallback: f(o("preview.loading")),
219
- children: /* @__PURE__ */ l(V, {
225
+ children: /* @__PURE__ */ l(U, {
220
226
  id: n,
221
227
  state: i.state,
222
228
  contentBase: i.contentBase
@@ -237,9 +243,9 @@ function K({ type: t, id: n, data: i, failed: a }) {
237
243
  resetKey: p,
238
244
  children: /* @__PURE__ */ l(r, {
239
245
  fallback: f(o("preview.loading")),
240
- children: /* @__PURE__ */ l(H, {
246
+ children: /* @__PURE__ */ l(W, {
241
247
  view: g,
242
- renders: L({
248
+ renders: R({
243
249
  boards: _.map(([e, t]) => ({
244
250
  id: e,
245
251
  ...t
@@ -252,11 +258,11 @@ function K({ type: t, id: n, data: i, failed: a }) {
252
258
  contentBase: i.contentBase,
253
259
  versions: i.versions ?? {},
254
260
  pending: new Set(i.pending),
255
- playing: G,
261
+ playing: q,
256
262
  replays: {},
257
263
  inspecting: !1,
258
- frameRef: U,
259
- frameLoaded: W
264
+ frameRef: G,
265
+ frameLoaded: K
260
266
  })
261
267
  })
262
268
  })
@@ -264,7 +270,7 @@ function K({ type: t, id: n, data: i, failed: a }) {
264
270
  }
265
271
  //#endregion
266
272
  //#region src/viewer/hooks/useSystemTheme.ts
267
- function q() {
273
+ function Y() {
268
274
  s(() => {
269
275
  let e = window.matchMedia("(prefers-color-scheme: dark)"), t = () => u({ appearance: e.matches ? "dark" : "light" });
270
276
  return t(), e.addEventListener("change", t), () => e.removeEventListener("change", t);
@@ -272,7 +278,7 @@ function q() {
272
278
  }
273
279
  //#endregion
274
280
  //#region src/shared/cloud-error.ts
275
- function J(e) {
281
+ function X(e) {
276
282
  if (!e || typeof e != "object") return {};
277
283
  let t = e, n = {};
278
284
  if (typeof t.code == "string" && (n.code = t.code), (t.plan === "free" || t.plan === "pro") && (n.plan = t.plan), typeof t.upgradeUrl == "string" && (n.upgradeUrl = t.upgradeUrl), t.limit && typeof t.limit == "object") {
@@ -287,6 +293,6 @@ function J(e) {
287
293
  }
288
294
  //#endregion
289
295
  //#region src/shared/ids.ts
290
- var Y = /^[a-z0-9][a-z0-9-]*$/, X = (e) => Y.test(e), Z = (e) => d.includes(e);
296
+ var Z = /^[a-z0-9][a-z0-9-]*$/, Q = (e) => Z.test(e), $ = (e) => d.includes(e);
291
297
  //#endregion
292
- export { x as C, p as E, y as S, f as T, D as _, K as a, O as b, I as c, j as d, T as f, C as g, v as h, q as i, P as l, k as m, Z as n, z as o, w as p, J as r, B as s, X as t, L as u, b as v, d as w, A as x, S as y };
298
+ export { y as C, p as D, f as E, A as S, d as T, C as _, J as a, S as b, z as c, R as d, j as f, v as g, k as h, Y as i, L as l, w as m, $ as n, V as o, T as p, X as r, H as s, Q as t, P as u, D as v, x as w, O as x, b as y };