@pygmalionjs/pygmalion 0.2.22 → 0.2.23

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 { jsxs as C, jsx as w } from "react/jsx-runtime";
2
- import { b as Y, m as Ue, i as He, g as qe, e as q, c as Ke, a as Ge, d as Je, f as We, h as Ve, j as Qe, k as Le, l as Xe, n as be, o as ve, p as Ye, q as Ze, r as et, t as tt, u as nt, v as rt, w as Ie, x as se, S as ot, A as st, y as xe, z as it, B as at, C as ct, D as lt, E as dt, G as ut, H as ft, I as ht, J as Pe } from "./App-wIyYhdCu.js";
3
- import { K as pn, L as mn, M as gn, O as yn, P as wn, Q as Sn, R as bn, T as vn, U as In, V as xn, W as Pn, X as En, Y as Cn, Z as Nn, _ as Rn, $ as An, a0 as $n, a1 as On, a2 as Mn, a3 as kn, a4 as Dn, a5 as Fn, a6 as Tn, a7 as zn } from "./App-wIyYhdCu.js";
2
+ import { b as Y, m as Ue, i as He, g as qe, e as q, c as Ke, a as Ge, d as Je, f as We, h as Ve, j as Qe, k as Le, l as Xe, n as be, o as ve, p as Ye, q as Ze, r as et, t as tt, u as nt, v as rt, w as Ie, x as se, S as ot, A as st, y as xe, z as it, B as at, C as ct, D as lt, E as dt, G as ut, H as ft, I as ht, J as Pe } from "./App-CkJW2APT.js";
3
+ import { K as pn, L as mn, M as gn, O as yn, P as wn, Q as Sn, R as bn, T as vn, U as In, V as xn, W as Pn, X as En, Y as Cn, Z as Nn, _ as Rn, $ as An, a0 as $n, a1 as On, a2 as Mn, a3 as kn, a4 as Dn, a5 as Fn, a6 as Tn, a7 as zn } from "./App-CkJW2APT.js";
4
4
  import { createElement as Ee, useMemo as ae, useState as re, useRef as me, useCallback as X, useEffect as oe } from "react";
5
5
  function ge(e, t = /* @__PURE__ */ new Set()) {
6
6
  if (e == null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e))
@@ -168,16 +168,16 @@ function yt(e) {
168
168
  const k = `${v}\0${P}`, R = y.get(k);
169
169
  if (R) {
170
170
  if (!R.sourceEdgeIds.includes(f)) {
171
- const G = {
171
+ const J = {
172
172
  ...R,
173
173
  sourceEdgeIds: z([
174
174
  ...R.sourceEdgeIds,
175
175
  f
176
176
  ])
177
177
  };
178
- y.set(k, G);
178
+ y.set(k, J);
179
179
  const H = I.indexOf(R);
180
- H >= 0 && (I[H] = G);
180
+ H >= 0 && (I[H] = J);
181
181
  }
182
182
  continue;
183
183
  }
@@ -273,12 +273,12 @@ function yt(e) {
273
273
  h.flatMap((i) => i.scenarioIds)
274
274
  ), te = new Set(
275
275
  (e.nonVisualScenarioIds ?? []).map((i) => i.trim())
276
- ), W = z(
276
+ ), V = z(
277
277
  (e.scenarios ?? []).map((i) => i.id)
278
- ), V = W.filter(
278
+ ), G = V.filter(
279
279
  (i) => !K.has(i) && !te.has(i)
280
280
  );
281
- for (const i of V)
281
+ for (const i of G)
282
282
  t.push({
283
283
  code: "missing-code-scenario",
284
284
  severity: "warning",
@@ -297,12 +297,12 @@ function yt(e) {
297
297
  edges: I.length,
298
298
  connectedNodes: h.length - D.length,
299
299
  disconnectedScreens: Q,
300
- codeScenarios: W.length,
301
- representedScenarios: W.filter(
300
+ codeScenarios: V.length,
301
+ representedScenarios: V.filter(
302
302
  (i) => K.has(i)
303
303
  ).length,
304
- missingScenarios: V,
305
- complete: Q.length === 0 && V.length === 0 && !t.some((i) => i.severity === "error") && s.size === 0
304
+ missingScenarios: G,
305
+ complete: Q.length === 0 && G.length === 0 && !t.some((i) => i.severity === "error") && s.size === 0
306
306
  };
307
307
  return {
308
308
  version: 1,
@@ -1492,7 +1492,7 @@ function Vt(e, t) {
1492
1492
  return ie.set(t, r), r;
1493
1493
  }
1494
1494
  }
1495
- async function J(e) {
1495
+ async function W(e) {
1496
1496
  const t = await e.json();
1497
1497
  if (!e.ok) throw new Error(t.error ?? `Pygmalion request failed (${e.status})`);
1498
1498
  return t;
@@ -1539,24 +1539,24 @@ function on(e = {}) {
1539
1539
  headers: { "content-type": "application/json" },
1540
1540
  body: JSON.stringify({ ref: f })
1541
1541
  } : {}
1542
- }), R = await J(k);
1542
+ }), R = await W(k);
1543
1543
  const L = Date.now();
1544
1544
  for (; !d && R.state === "syncing" && Date.now() - L < 12e4; )
1545
- await new Promise((ne) => window.setTimeout(ne, 500)), k = await n(`${a}/status`), R = await J(k);
1545
+ await new Promise((ne) => window.setTimeout(ne, 500)), k = await n(`${a}/status`), R = await W(k);
1546
1546
  if (R.state !== "ready" || !R.appOrigin || !R.commit)
1547
1547
  throw new Error(R.error ?? "Pygmalion could not prepare the source preview");
1548
- const G = await J(
1548
+ const J = await W(
1549
1549
  await n(`${c}/open`, {
1550
1550
  method: "POST",
1551
1551
  headers: { "content-type": "application/json" },
1552
1552
  body: JSON.stringify({ sessionId: I, baseDevSha: R.commit })
1553
1553
  })
1554
1554
  );
1555
- if (!G.ok || !G.session)
1556
- throw new Error(G.error ?? "Pygmalion could not open the design session");
1557
- let H = G.session;
1555
+ if (!J.ok || !J.session)
1556
+ throw new Error(J.error ?? "Pygmalion could not open the design session");
1557
+ let H = J.session;
1558
1558
  if (H.branchName) {
1559
- const ne = await J(
1559
+ const ne = await W(
1560
1560
  await n(`${c}/check`, {
1561
1561
  method: "POST",
1562
1562
  headers: { "content-type": "application/json" },
@@ -1586,7 +1586,7 @@ function on(e = {}) {
1586
1586
  [n, a, c, I]
1587
1587
  ), B = X(async () => {
1588
1588
  try {
1589
- const d = await J(
1589
+ const d = await W(
1590
1590
  await n(`${a}/refs`)
1591
1591
  ), f = {
1592
1592
  refs: d.refs ?? [],
@@ -1613,7 +1613,7 @@ function on(e = {}) {
1613
1613
  const f = E.current;
1614
1614
  if (f && (f.sessionId !== p.id || f.baseDevSha !== p.baseDevSha || f.revision !== p.revision || f.fingerprint !== JSON.stringify(d)))
1615
1615
  throw new Error("The code diff you checked is out of date. Please check the diff for the current changes again.");
1616
- const v = await J(
1616
+ const v = await W(
1617
1617
  await n(`${c}/apply-visual`, {
1618
1618
  method: "POST",
1619
1619
  headers: { "content-type": "application/json" },
@@ -1640,13 +1640,13 @@ function on(e = {}) {
1640
1640
  frameIds: f.qaFrameIds
1641
1641
  });
1642
1642
  } catch (L) {
1643
- const G = L instanceof Error ? L.message : String(L);
1643
+ const J = L instanceof Error ? L.message : String(L);
1644
1644
  k = {
1645
1645
  phase: "changed",
1646
1646
  baselineId: f.qaBaselineId,
1647
1647
  complete: !1,
1648
1648
  frames: [],
1649
- failures: f.qaFrameIds.map((H) => ({ id: H, error: G }))
1649
+ failures: f.qaFrameIds.map((H) => ({ id: H, error: J }))
1650
1650
  };
1651
1651
  }
1652
1652
  return E.current = null, {
@@ -1663,7 +1663,7 @@ function on(e = {}) {
1663
1663
  var R;
1664
1664
  if (!p) throw new Error("Pygmalion design session is not ready");
1665
1665
  E.current = null;
1666
- const f = await J(
1666
+ const f = await W(
1667
1667
  await n(`${c}/preview-visual`, {
1668
1668
  method: "POST",
1669
1669
  headers: { "content-type": "application/json" },
@@ -1717,7 +1717,7 @@ function on(e = {}) {
1717
1717
  ), te = X(
1718
1718
  async (d) => {
1719
1719
  if (d.length === 0) return { files: [] };
1720
- const f = await J(
1720
+ const f = await W(
1721
1721
  await n(`${u}/impact`, {
1722
1722
  method: "POST",
1723
1723
  headers: { "content-type": "application/json" },
@@ -1729,10 +1729,10 @@ function on(e = {}) {
1729
1729
  return { files: Array.isArray(f.files) ? f.files : [] };
1730
1730
  },
1731
1731
  [n, u]
1732
- ), W = X(async () => {
1732
+ ), V = X(async () => {
1733
1733
  if (!(p != null && p.canRevert) || !p.headSha)
1734
1734
  throw new Error("There are no reversible changes applied");
1735
- const d = await J(
1735
+ const d = await W(
1736
1736
  await n(`${c}/revert-visual`, {
1737
1737
  method: "POST",
1738
1738
  headers: { "content-type": "application/json" },
@@ -1757,12 +1757,12 @@ function on(e = {}) {
1757
1757
  }, [r, D]), oe(() => {
1758
1758
  r && B();
1759
1759
  }, [r]);
1760
- const V = (p == null ? void 0 : p.appOrigin) ?? y.appOrigin ?? A, Q = (p == null ? void 0 : p.headSha) ?? (p == null ? void 0 : p.baseDevSha) ?? y.commit ?? "pending";
1760
+ const G = (p == null ? void 0 : p.appOrigin) ?? y.appOrigin ?? A, Q = (p == null ? void 0 : p.headSha) ?? (p == null ? void 0 : p.baseDevSha) ?? y.commit ?? "pending";
1761
1761
  return {
1762
1762
  mirror: y,
1763
1763
  session: p,
1764
1764
  ready: A != null,
1765
- appOrigin: V,
1765
+ appOrigin: G,
1766
1766
  previewRevision: `${Q}:${(p == null ? void 0 : p.revision) ?? 0}`,
1767
1767
  previewSourceRevision: Q,
1768
1768
  refresh: D,
@@ -1772,7 +1772,7 @@ function on(e = {}) {
1772
1772
  previewVisual: K,
1773
1773
  inspectImpact: te,
1774
1774
  applyVisual: ee,
1775
- revertLastVisual: W
1775
+ revertLastVisual: V
1776
1776
  };
1777
1777
  }
1778
1778
  function sn({
@@ -1895,7 +1895,7 @@ function un({
1895
1895
  n && (n.assertComplete(), Ke(n));
1896
1896
  const Z = e ?? (n == null ? void 0 : n.getRegistry()), ee = t ?? (n == null ? void 0 : n.getTokens()), K = o ?? (n == null ? void 0 : n.getInitialPages());
1897
1897
  Z && Ge(Z), ee && Je(ee), r && We(r), ct(s ?? null), a != null && Ve(a), c != null && Qe(c), Le(u);
1898
- const te = D ?? g, W = (K ?? []).flatMap(
1898
+ const te = D ?? g, V = (K ?? []).flatMap(
1899
1899
  (x) => x.route && x.importPageId ? [
1900
1900
  {
1901
1901
  canonicalId: x.importPageId,
@@ -1908,7 +1908,7 @@ function un({
1908
1908
  assertions: x.assertions
1909
1909
  }
1910
1910
  ] : []
1911
- ), V = me([]), Q = W.map((x) => ({
1911
+ ), G = me([]), Q = V.map((x) => ({
1912
1912
  id: x.canonicalId,
1913
1913
  fingerprint: Xe(
1914
1914
  x,
@@ -1916,13 +1916,13 @@ function un({
1916
1916
  be()
1917
1917
  )
1918
1918
  }));
1919
- return V.current = Q, te && K && b && Ye(te, {
1919
+ return G.current = Q, te && K && b && Ye(te, {
1920
1920
  namespace: u ?? "",
1921
1921
  previewRevision: ve(),
1922
1922
  appOrigin: lt(),
1923
1923
  baselineEnvironment: be(),
1924
1924
  allowStaleIdentity: D == null && !!h,
1925
- pages: W.map((x, j) => {
1925
+ pages: V.map((x, j) => {
1926
1926
  var $;
1927
1927
  return {
1928
1928
  ...x,
@@ -1951,7 +1951,7 @@ function un({
1951
1951
  }).then((v) => {
1952
1952
  !f.aborted && v.status === "accepted" && B(v.artifact);
1953
1953
  });
1954
- $(V.current, !1, x.signal);
1954
+ G.current.length && $(G.current, !1, x.signal);
1955
1955
  const i = new AbortController();
1956
1956
  return Ie((l) => {
1957
1957
  $(l, !0, i.signal).catch(() => {
@@ -1,4 +1,4 @@
1
- import { F as s, N as a, e as r, s as i, a as t } from "./App-wIyYhdCu.js";
1
+ import { F as s, N as a, e as r, s as i, a as t } from "./App-CkJW2APT.js";
2
2
  export {
3
3
  s as FrozenRoutePreviewView,
4
4
  a as NodeModel,
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pygmalionjs/pygmalion",
3
- "version": "0.2.22",
3
+ "version": "0.2.23",
4
4
  "description": "Code-backed DOM design sandbox and visual QA editor",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {