@pygmalionjs/pygmalion 0.2.12 → 0.2.13

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 O, jsx as w } from "react/jsx-runtime";
2
- import { b as V, m as He, v as Ke, c as qe, i as Ge, g as Le, e as K, d as Ve, a as Je, f as We, h as Qe, j as Xe, k as Ye, l as Ze, n as et, o as tt, p as nt, q as rt, r as ot, t as Y, S as st, A as it, u as ve, w as at, x as ct, y as lt, z as dt, B as ft, C as ut, D as pt, E as Ie } from "./App-B0w9z2Br.js";
3
- import { G as $n, H as Mn, I as Tn, J as Dn, K as kn, L as zn, M as _n, O as Fn, P as jn, Q as Bn, R as Un, T as Hn, U as Kn, V as qn, W as Gn, X as Ln, Y as Vn } from "./App-B0w9z2Br.js";
2
+ import { b as V, m as He, v as Ke, c as qe, i as Ge, g as Le, e as K, d as Ve, a as Je, f as We, h as Qe, j as Xe, k as Ye, l as Ze, n as et, o as tt, p as nt, q as rt, r as ot, t as Y, S as st, A as it, u as ve, w as at, x as ct, y as lt, z as dt, B as ft, C as ut, D as pt, E as Ie } from "./App-BpS2IDVb.js";
3
+ import { G as $n, H as Mn, I as Tn, J as Dn, K as kn, L as zn, M as _n, O as Fn, P as Bn, Q as jn, R as Un, T as Hn, U as Kn, V as qn, W as Gn, X as Ln, Y as Vn } from "./App-BpS2IDVb.js";
4
4
  import { createElement as xe, useMemo as Pe, useState as te, useRef as Ee, useCallback as Z, useEffect as ee } from "react";
5
5
  function pe(e, t = /* @__PURE__ */ new Set()) {
6
6
  if (e == null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e))
@@ -244,18 +244,18 @@ function yt(e) {
244
244
  screenId: l,
245
245
  nodeId: i.id
246
246
  });
247
- const B = /* @__PURE__ */ new Map();
247
+ const j = /* @__PURE__ */ new Map();
248
248
  for (const i of u)
249
249
  for (const l of i.sourceKeys) {
250
- const f = B.get(l) ?? {
250
+ const f = j.get(l) ?? {
251
251
  nodeIds: /* @__PURE__ */ new Set(),
252
252
  screenIds: /* @__PURE__ */ new Set()
253
253
  };
254
254
  f.nodeIds.add(i.id);
255
255
  for (const y of i.screenIds) f.screenIds.add(y);
256
- B.set(l, f);
256
+ j.set(l, f);
257
257
  }
258
- const W = [...B.entries()].map(([i, l]) => ({
258
+ const W = [...j.entries()].map(([i, l]) => ({
259
259
  sourceKey: i,
260
260
  nodeIds: [...l.nodeIds].sort((f, y) => f.localeCompare(y)),
261
261
  screenIds: [...l.screenIds].sort((f, y) => f.localeCompare(y)),
@@ -273,9 +273,9 @@ function yt(e) {
273
273
  u.flatMap((i) => i.scenarioIds)
274
274
  ), x = new Set(
275
275
  (e.nonVisualScenarioIds ?? []).map((i) => i.trim())
276
- ), j = z(
276
+ ), B = z(
277
277
  (e.scenarios ?? []).map((i) => i.id)
278
- ), k = j.filter(
278
+ ), k = B.filter(
279
279
  (i) => !G.has(i) && !x.has(i)
280
280
  );
281
281
  for (const i of k)
@@ -297,8 +297,8 @@ function yt(e) {
297
297
  edges: E.length,
298
298
  connectedNodes: u.length - F.length,
299
299
  disconnectedScreens: Q,
300
- codeScenarios: j.length,
301
- representedScenarios: j.filter(
300
+ codeScenarios: B.length,
301
+ representedScenarios: B.filter(
302
302
  (i) => G.has(i)
303
303
  ).length,
304
304
  missingScenarios: k,
@@ -670,8 +670,8 @@ function $t(e, t) {
670
670
  const F = C.shift();
671
671
  if (!M.has(F)) {
672
672
  M.add(F);
673
- for (const B of s.get(F) ?? [])
674
- M.has(B) || C.push(B);
673
+ for (const j of s.get(F) ?? [])
674
+ M.has(j) || C.push(j);
675
675
  }
676
676
  }
677
677
  };
@@ -749,7 +749,7 @@ async function mn(e) {
749
749
  throw V(null), t;
750
750
  }
751
751
  }
752
- const Tt = "pygmalion-preview", Dt = "unknown", kt = 512, zt = 2048, _t = 8 * 1024 * 1024, Ft = 128 * 1024 * 1024, jt = /* @__PURE__ */ new Set([
752
+ const Tt = "pygmalion-preview", Dt = "unknown", kt = 512, zt = 2048, _t = 8 * 1024 * 1024, Ft = 128 * 1024 * 1024, Bt = /* @__PURE__ */ new Set([
753
753
  "__proto__",
754
754
  "constructor",
755
755
  "prototype"
@@ -760,7 +760,7 @@ function J(e, t) {
760
760
  if (re(r)) return r;
761
761
  throw new TypeError("Preview identity must be a non-empty bounded string.");
762
762
  }
763
- function Bt(e) {
763
+ function jt(e) {
764
764
  const t = e ?? 1;
765
765
  if (!Number.isSafeInteger(t) || t < 1)
766
766
  throw new TypeError(
@@ -818,7 +818,7 @@ function gn({
818
818
  const o = J(n), s = J(
819
819
  e,
820
820
  Dt
821
- ), a = Bt(r), c = Ht(t);
821
+ ), a = jt(r), c = Ht(t);
822
822
  return `${o}:${encodeURIComponent(s)}:recipe-v${a}:${c}`;
823
823
  }
824
824
  function yn(e) {
@@ -886,7 +886,7 @@ function Fe(e) {
886
886
  return new TextEncoder().encode(e).byteLength;
887
887
  }
888
888
  function re(e) {
889
- return typeof e == "string" && e.length > 0 && e.length <= kt && e === e.trim() && !jt.has(e);
889
+ return typeof e == "string" && e.length > 0 && e.length <= kt && e === e.trim() && !Bt.has(e);
890
890
  }
891
891
  function qt(e) {
892
892
  const t = /(?:expression\s*\(|-moz-binding\s*:|(?:^|[;{])\s*behavior\s*:)/i;
@@ -1268,11 +1268,11 @@ function Sn({
1268
1268
  function Xt(e) {
1269
1269
  return e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "").toLowerCase() || "page";
1270
1270
  }
1271
- function je(e, t, r = "PygmalionCatalog") {
1271
+ function Be(e, t, r = "PygmalionCatalog") {
1272
1272
  const n = (o) => Xt(o).replace(/-/g, "_");
1273
1273
  return `${r}_${n(e)}_${n(t)}`;
1274
1274
  }
1275
- function Be(e, t) {
1275
+ function je(e, t) {
1276
1276
  return {
1277
1277
  id: e.id,
1278
1278
  name: e.name,
@@ -1412,7 +1412,7 @@ function vn(e) {
1412
1412
  t.set(s.id, {
1413
1413
  page: s,
1414
1414
  items: [o],
1415
- registryName: je(
1415
+ registryName: Be(
1416
1416
  e.kind,
1417
1417
  s.id,
1418
1418
  e.registryPrefix
@@ -1448,7 +1448,7 @@ function vn(e) {
1448
1448
  registry: r,
1449
1449
  collection: {
1450
1450
  expectedCount: e.expectedCount ?? e.items.length,
1451
- assets: e.items.map((o) => Be(o, e.pageFor(o).id)),
1451
+ assets: e.items.map((o) => je(o, e.pageFor(o).id)),
1452
1452
  pages: n
1453
1453
  }
1454
1454
  };
@@ -1586,7 +1586,7 @@ function In(e) {
1586
1586
  Ue(e.items);
1587
1587
  const t = {}, r = [], n = [], o = e.maxVariantCells ?? 60;
1588
1588
  for (const s of e.items) {
1589
- const a = je(
1589
+ const a = Be(
1590
1590
  e.kind,
1591
1591
  s.id,
1592
1592
  e.registryPrefix
@@ -1608,7 +1608,7 @@ function In(e) {
1608
1608
  width: 1,
1609
1609
  height: 1,
1610
1610
  frameSizeMode: "content"
1611
- }), n.push(Be(s, s.id));
1611
+ }), n.push(je(s, s.id));
1612
1612
  }
1613
1613
  return {
1614
1614
  registry: t,
@@ -1749,14 +1749,14 @@ async function L(e) {
1749
1749
  return t;
1750
1750
  }
1751
1751
  function xn(e = {}) {
1752
- var G, x, j, k, Q;
1752
+ var G, x, B, k, Q;
1753
1753
  const {
1754
1754
  sessionId: t,
1755
1755
  sessionStorageKey: r = ln,
1756
1756
  autoStart: n = !0,
1757
1757
  fetcher: o = fetch,
1758
1758
  formatApplyMessage: s
1759
- } = e, a = ((G = e.endpoints) == null ? void 0 : G.mirror) ?? ue.mirror, c = ((x = e.endpoints) == null ? void 0 : x.sessions) ?? ue.sessions, d = ((j = e.endpoints) == null ? void 0 : j.inspect) ?? ue.inspect, h = e.visualQa != null, u = ((k = e.visualQa) == null ? void 0 : k.endpoint) ?? dn, b = JSON.stringify(((Q = e.visualQa) == null ? void 0 : Q.eligibleFrameIds) ?? []), P = Pe(
1759
+ } = e, a = ((G = e.endpoints) == null ? void 0 : G.mirror) ?? ue.mirror, c = ((x = e.endpoints) == null ? void 0 : x.sessions) ?? ue.sessions, d = ((B = e.endpoints) == null ? void 0 : B.inspect) ?? ue.inspect, h = e.visualQa != null, u = ((k = e.visualQa) == null ? void 0 : k.endpoint) ?? dn, b = JSON.stringify(((Q = e.visualQa) == null ? void 0 : Q.eligibleFrameIds) ?? []), P = Pe(
1760
1760
  () => JSON.parse(b),
1761
1761
  [b]
1762
1762
  ), E = Pe(
@@ -1932,7 +1932,7 @@ function xn(e = {}) {
1932
1932
  c,
1933
1933
  h
1934
1934
  ]
1935
- ), B = Z(
1935
+ ), j = Z(
1936
1936
  async (v) => {
1937
1937
  if (v.length === 0) return { files: [] };
1938
1938
  const g = await L(
@@ -1982,7 +1982,7 @@ function xn(e = {}) {
1982
1982
  previewRevision: `${(p == null ? void 0 : p.headSha) ?? (p == null ? void 0 : p.baseDevSha) ?? m.commit ?? "pending"}:${(p == null ? void 0 : p.revision) ?? 0}`,
1983
1983
  refresh: S,
1984
1984
  previewVisual: F,
1985
- inspectImpact: B,
1985
+ inspectImpact: j,
1986
1986
  applyVisual: C,
1987
1987
  revertLastVisual: W
1988
1988
  };
@@ -2027,14 +2027,15 @@ function Rn({
2027
2027
  }) {
2028
2028
  const [A, S] = te(!T), [C, F] = te();
2029
2029
  n && (n.assertComplete(), Ve(n));
2030
- const B = e ?? (n == null ? void 0 : n.getRegistry()), W = t ?? (n == null ? void 0 : n.getTokens()), q = r ?? (n == null ? void 0 : n.getInitialPages());
2031
- B && Je(B), W && We(W), at(o ?? null), s != null && Qe(s), a != null && Xe(a), Ye(c);
2030
+ const j = e ?? (n == null ? void 0 : n.getRegistry()), W = t ?? (n == null ? void 0 : n.getTokens()), q = r ?? (n == null ? void 0 : n.getInitialPages());
2031
+ j && Je(j), W && We(W), at(o ?? null), s != null && Qe(s), a != null && Xe(a), Ye(c);
2032
2032
  const G = C ?? d;
2033
2033
  return G && q && A && Ze(G, {
2034
2034
  namespace: c ?? "",
2035
2035
  previewRevision: lt(),
2036
2036
  appOrigin: ct(),
2037
2037
  baselineEnvironment: et(),
2038
+ allowStaleIdentity: C == null && !!h,
2038
2039
  pages: q.flatMap(
2039
2040
  (x) => x.route && x.importPageId ? [
2040
2041
  {
@@ -2067,8 +2068,8 @@ function Rn({
2067
2068
  captureBaseUrl: s
2068
2069
  }),
2069
2070
  signal: x.signal
2070
- }).then((j) => {
2071
- !x.signal.aborted && j.status === "accepted" && F(j.artifact);
2071
+ }).then((B) => {
2072
+ !x.signal.aborted && B.status === "accepted" && F(B.artifact);
2072
2073
  }), () => x.abort();
2073
2074
  }, [
2074
2075
  h,
@@ -2082,10 +2083,10 @@ function Rn({
2082
2083
  return Y(void 0), S(!0), () => {
2083
2084
  x = !1;
2084
2085
  };
2085
- const j = new AbortController();
2086
+ const B = new AbortController();
2086
2087
  return S(!1), Y(void 0), V(null), _e({
2087
2088
  endpoint: M,
2088
- signal: j.signal,
2089
+ signal: B.signal,
2089
2090
  pages: K.pages.map((k) => ({
2090
2091
  ...k,
2091
2092
  id: k.importPageId ?? k.id,
@@ -2099,7 +2100,7 @@ function Rn({
2099
2100
  }).finally(() => {
2100
2101
  x && S(!0);
2101
2102
  }), () => {
2102
- x = !1, j.abort(), Y(void 0), V(null);
2103
+ x = !1, B.abort(), Y(void 0), V(null);
2103
2104
  };
2104
2105
  }, [
2105
2106
  n,
@@ -2152,9 +2153,9 @@ export {
2152
2153
  _n as createStoryboardGraphViewModel,
2153
2154
  Fn as createStoryboardRouteUrl,
2154
2155
  Xt as designCatalogKey,
2155
- je as designCatalogRegistryName,
2156
- jn as expandDesignScreenCasesViewports,
2157
- Bn as expandDesignScreenCollectionViewports,
2156
+ Be as designCatalogRegistryName,
2157
+ Bn as expandDesignScreenCasesViewports,
2158
+ jn as expandDesignScreenCollectionViewports,
2158
2159
  Un as getRecommendedPygmalionPreviewConcurrency,
2159
2160
  et as getStoryboardBaselineEnvironment,
2160
2161
  ze as getStoryboardDiscoveryBaselineEnvironment,
@@ -1,4 +1,4 @@
1
- import { F as s, N as a, e as r, s as i, a as t } from "./App-B0w9z2Br.js";
1
+ import { F as s, N as a, e as r, s as i, a as t } from "./App-BpS2IDVb.js";
2
2
  export {
3
3
  s as FrozenRoutePreviewView,
4
4
  a as NodeModel,
@@ -46,8 +46,8 @@ function requestedCaptureBaseUrl(url, requestHost) {
46
46
  return null;
47
47
  }
48
48
  try {
49
- const target = new URL(value);
50
49
  const requestOrigin = new URL(`http://${requestHost}`);
50
+ const target = new URL(value, requestOrigin);
51
51
  if (
52
52
  !['http:', 'https:'].includes(target.protocol) ||
53
53
  target.host.toLowerCase() !== requestOrigin.host.toLowerCase() ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pygmalionjs/pygmalion",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "description": "Code-backed DOM design sandbox and visual QA editor",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {