@pygmalionjs/pygmalion 0.7.3 → 0.8.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.
Files changed (133) hide show
  1. package/README.ko.md +17 -2
  2. package/README.md +18 -2
  3. package/dist-lib/CameraLayer-nkNrazn8.js +159 -0
  4. package/dist-lib/pygmalion.js +14562 -16919
  5. package/dist-lib/runtime-DdYnT6k4.js +19705 -0
  6. package/dist-lib/style.css +1 -1
  7. package/dist-lib/testing.js +20 -21
  8. package/dist-lib/types/EditorShell.d.ts +1 -1
  9. package/dist-lib/types/canvas/CameraLayer.d.ts +3 -3
  10. package/dist-lib/types/canvas/Canvas.d.ts +2 -2
  11. package/dist-lib/types/canvas/FrameLabelBanner.d.ts +1 -1
  12. package/dist-lib/types/canvas/FrameView.d.ts +8 -2
  13. package/dist-lib/types/canvas/FrozenRoutePreview.d.ts +1 -1
  14. package/dist-lib/types/canvas/InspectOverlay.d.ts +4 -2
  15. package/dist-lib/types/canvas/LightweightCanvas.d.ts +1 -1
  16. package/dist-lib/types/canvas/SectionBoxes.d.ts +1 -1
  17. package/dist-lib/types/canvas/ShadowRoutePreview.d.ts +2 -2
  18. package/dist-lib/types/canvas/useFlowSession.d.ts +1 -1
  19. package/dist-lib/types/canvas/useFrameLod.d.ts +1 -1
  20. package/dist-lib/types/contract/transport.d.ts +5 -5
  21. package/dist-lib/types/contract/types.d.ts +1 -1
  22. package/dist-lib/types/contract/validate.d.ts +3 -3
  23. package/dist-lib/types/core/context.d.ts +2 -2
  24. package/dist-lib/types/core/debug.d.ts +14 -14
  25. package/dist-lib/types/core/hostBindings.d.ts +2 -2
  26. package/dist-lib/types/core/runtime.d.ts +34 -3
  27. package/dist-lib/types/core/runtimeContext.d.ts +3 -3
  28. package/dist-lib/types/core/schedulers.d.ts +67 -0
  29. package/dist-lib/types/editor/assetEditing.d.ts +2 -2
  30. package/dist-lib/types/editor/automaticMotion.d.ts +0 -11
  31. package/dist-lib/types/editor/automaticPseudoStates.d.ts +8 -2
  32. package/dist-lib/types/editor/captureSupply.d.ts +25 -7
  33. package/dist-lib/types/editor/catalog.d.ts +2 -2
  34. package/dist-lib/types/editor/codegen.d.ts +6 -3
  35. package/dist-lib/types/editor/componentConnections.d.ts +13 -8
  36. package/dist-lib/types/editor/componentInstances.d.ts +2 -2
  37. package/dist-lib/types/editor/declarations.d.ts +107 -0
  38. package/dist-lib/types/editor/designCompiler.d.ts +9 -4
  39. package/dist-lib/types/editor/designImport.d.ts +48 -12
  40. package/dist-lib/types/editor/documentSync.d.ts +28 -25
  41. package/dist-lib/types/editor/domImport.d.ts +2 -2
  42. package/dist-lib/types/editor/fiberMap.d.ts +1 -1
  43. package/dist-lib/types/editor/flowSessionScheduler.d.ts +106 -159
  44. package/dist-lib/types/editor/flowSessions.d.ts +147 -84
  45. package/dist-lib/types/editor/frameInteraction.d.ts +22 -32
  46. package/dist-lib/types/editor/frameLabels.d.ts +11 -5
  47. package/dist-lib/types/editor/frameLanes.d.ts +14 -17
  48. package/dist-lib/types/editor/frameLod.d.ts +17 -0
  49. package/dist-lib/types/editor/frameLodRuntime.d.ts +38 -38
  50. package/dist-lib/types/editor/framePreviewKeys.d.ts +14 -5
  51. package/dist-lib/types/editor/frozenImport.d.ts +13 -14
  52. package/dist-lib/types/editor/heldPseudoStates.d.ts +1 -1
  53. package/dist-lib/types/editor/host.d.ts +10 -55
  54. package/dist-lib/types/editor/implementationSourceMap.d.ts +2 -2
  55. package/dist-lib/types/editor/importFidelity.d.ts +1 -1
  56. package/dist-lib/types/editor/inspect.d.ts +7 -2
  57. package/dist-lib/types/editor/interactiveSessionSurface.d.ts +26 -34
  58. package/dist-lib/types/editor/interactiveStates.d.ts +12 -10
  59. package/dist-lib/types/editor/livePreviewInstances.d.ts +13 -3
  60. package/dist-lib/types/editor/liveScreens.d.ts +25 -16
  61. package/dist-lib/types/editor/mountScheduler.d.ts +8 -11
  62. package/dist-lib/types/editor/nodeSelector.d.ts +1 -1
  63. package/dist-lib/types/editor/pendingSourceChanges.d.ts +19 -0
  64. package/dist-lib/types/editor/previewBootstrap.d.ts +12 -22
  65. package/dist-lib/types/editor/previewCaptureProgress.d.ts +10 -6
  66. package/dist-lib/types/editor/previewEnvironmentControls.d.ts +14 -17
  67. package/dist-lib/types/editor/previewIntent.d.ts +11 -16
  68. package/dist-lib/types/editor/previewSweep.d.ts +7 -3
  69. package/dist-lib/types/editor/previewWarmup.d.ts +19 -7
  70. package/dist-lib/types/editor/projectRuntime.d.ts +2 -2
  71. package/dist-lib/types/editor/registry.d.ts +6 -2
  72. package/dist-lib/types/editor/revisionCatalog.d.ts +19 -19
  73. package/dist-lib/types/editor/revisionCatalogInstall.d.ts +18 -17
  74. package/dist-lib/types/editor/routePreview.d.ts +85 -139
  75. package/dist-lib/types/editor/scenarioCoverage.d.ts +52 -20
  76. package/dist-lib/types/editor/screenCards.d.ts +10 -6
  77. package/dist-lib/types/editor/screenDimensions.d.ts +9 -5
  78. package/dist-lib/types/editor/screenFlows.d.ts +8 -5
  79. package/dist-lib/types/editor/screenInteractions.d.ts +9 -1
  80. package/dist-lib/types/editor/screenLists.d.ts +8 -4
  81. package/dist-lib/types/editor/screenStateGroups.d.ts +1 -1
  82. package/dist-lib/types/editor/sectionHeaders.d.ts +10 -6
  83. package/dist-lib/types/editor/sessionPresets.d.ts +12 -32
  84. package/dist-lib/types/editor/shadowPreview.d.ts +7 -10
  85. package/dist-lib/types/editor/sharedSource.d.ts +4 -2
  86. package/dist-lib/types/editor/sourceChangeSummary.d.ts +1 -1
  87. package/dist-lib/types/editor/sourceJournal.d.ts +2 -2
  88. package/dist-lib/types/editor/stateSwitchMetrics.d.ts +68 -82
  89. package/dist-lib/types/editor/store.d.ts +88 -22
  90. package/dist-lib/types/editor/storyboardAuthored.d.ts +2 -2
  91. package/dist-lib/types/editor/storyboardDiscovery.d.ts +4 -3
  92. package/dist-lib/types/editor/storyboardEnvironment.d.ts +9 -5
  93. package/dist-lib/types/editor/storyboardGraph.d.ts +1 -1
  94. package/dist-lib/types/editor/storyboardGraphRuntime.d.ts +8 -10
  95. package/dist-lib/types/editor/storyboardGraphView.d.ts +1 -1
  96. package/dist-lib/types/editor/storyboardJourney.d.ts +1 -1
  97. package/dist-lib/types/editor/surfaceDemands.d.ts +196 -31
  98. package/dist-lib/types/editor/tokens.d.ts +24 -25
  99. package/dist-lib/types/editor/variantAxes.d.ts +70 -0
  100. package/dist-lib/types/editor/variantPrefetch.d.ts +26 -43
  101. package/dist-lib/types/editor/viewportPresets.d.ts +6 -6
  102. package/dist-lib/types/editor/visualQa.d.ts +2 -2
  103. package/dist-lib/types/lib.d.ts +104 -108
  104. package/dist-lib/types/shell/CatalogAssetPanel.d.ts +1 -1
  105. package/dist-lib/types/shell/CodePanel.d.ts +1 -1
  106. package/dist-lib/types/shell/ComponentStateControls.d.ts +7 -53
  107. package/dist-lib/types/shell/FrameInspector.d.ts +17 -0
  108. package/dist-lib/types/shell/FrameReviewDetails.d.ts +28 -0
  109. package/dist-lib/types/shell/LayerTree.d.ts +1 -1
  110. package/dist-lib/types/shell/StoryboardGraphPanel.d.ts +2 -2
  111. package/dist-lib/types/shell/VariantPanel.d.ts +23 -0
  112. package/dist-lib/types/shell/inspectorControls.d.ts +34 -0
  113. package/dist-lib/types/shell/qaPresentation.d.ts +1 -1
  114. package/dist-lib/types/testing.d.ts +5 -6
  115. package/dist-lib/types/ui/SourceRefControl.d.ts +1 -1
  116. package/docs/coverage-contracts.md +431 -0
  117. package/docs/screen-state-contract.md +14 -16
  118. package/node/component-branches.mjs +7 -13
  119. package/node/design-session.mjs +3 -5
  120. package/node/dev-mirror.mjs +9 -6
  121. package/node/envelope.mjs +43 -0
  122. package/node/impact-frames.mjs +94 -0
  123. package/node/inspect-plugin.mjs +12 -6
  124. package/node/preview-artifact-plugin.mjs +3 -9
  125. package/node/qa-capture-plugin.mjs +3 -6
  126. package/node/source-graph.mjs +1 -0
  127. package/node/storyboard-environment.mjs +33 -6
  128. package/node/vite.mjs +1 -0
  129. package/package.json +7 -2
  130. package/dist-lib/CameraLayer-D2wrEPwG.js +0 -415
  131. package/dist-lib/frameLodRuntime-CU0IYaSu.js +0 -272
  132. package/dist-lib/runtime-DRkTU9eq.js +0 -16195
  133. package/dist-lib/types/core/defaultRuntime.d.ts +0 -3
package/README.ko.md CHANGED
@@ -319,14 +319,22 @@ captureStoryboardCase({
319
319
  하나의 시나리오는 반드시 한 분류에만 속해야 합니다. 잘못된 참조, 누락된
320
320
  시나리오, 중복 분류가 있으면 에디터를 열기 전에 검증이 실패합니다.
321
321
 
322
+ 모든 소스 라우트가 표현되었는지는 별개의 질문이며 에디터 없이 답합니다.
323
+ `auditRouteCoverage`는 호스트가 발견한 라우트를 호스트가 선언한 화면(구체적인
324
+ 프리뷰, 명시적인 `coverageRoutes` 매핑, 등록된 컴포넌트 fixture)과 대조합니다.
325
+ `validateSurfaceDemands`는 나머지 라우트에 내린 판정이 실제로 선언된 대상을
326
+ 가리키는지 확인합니다. 요약 함수는 제외 항목과 todo 항목을 커버리지와 따로
327
+ 셉니다. 식별자, 진단, 호스트에 남는 책임은
328
+ [Coverage contracts](./docs/coverage-contracts.md)가 정의합니다.
329
+
322
330
  화면 레시피는 `click`, `focus`, `hover`, `focus-visible`, `active`, `fill`,
323
331
  `check`, `press`, `scroll`, `wait`, `storage` 단계를 지원합니다. 각 프레임이 항상
324
332
  같은 애플리케이션 상태를 재현하도록 결정적인 레시피와 assertion을 사용하세요.
325
333
  어떤 변형이 프레임인지, 상호작용 상태인지, 조건 상태인지, 편집 가능한
326
334
  매개변수인지, 모션 프리뷰인지, 동작 전용 QA인지는
327
335
  [화면 상태 계약](./docs/screen-state-contract.md)이 정의합니다. 렌더링된 CSS와
328
- Web Animations 대상은 오른쪽 패널의 Motion 컨트롤에 자동으로 나타납니다. 재생,
329
- 일시 정지, 초기화, 대상 격리, 단계 스크러빙을 지원합니다.
336
+ Web Animations 대상은 캡처를 위해 자동으로 찾아 정착시킵니다. 라이브 프레임은
337
+ 제품의 모션을 그대로 재생합니다.
330
338
 
331
339
  ### 제품 라우트와 프리뷰 진입 라우트 분리하기
332
340
 
@@ -457,8 +465,15 @@ npm run lint:language
457
465
  - [Product readiness](./PRODUCTIZATION.md): 품질 기준과 남은 작업을 정의합니다.
458
466
  - [The editor transport](./docs/transport.md): 모든 요청이 거치는 하나의
459
467
  객체를 정의합니다. 엔드포인트 표와 오류 모델도 여기에 있습니다.
468
+ - [Coverage contracts](./docs/coverage-contracts.md): 호스트의 소스 라우트
469
+ 게이트를 정의합니다. 라우트를 식별하는 기준과 프리뷰·명시적 매핑·fixture로
470
+ 표현하는 방법, 시나리오를 정확히 한 번 분류하는 규칙, 진단을 소스로 연결하는
471
+ 방식이 여기에 있습니다.
460
472
  - [Upgrading to 0.7](./docs/migration-0.7.md): 사라진 모듈 수준 export를
461
473
  에디터 런타임으로, 사라진 엔드포인트 prop을 transport로 대응시킵니다.
474
+ - [Upgrading to 0.8](./docs/migration-0.8.md): 런타임으로 옮겨간 것들, 커버리지
475
+ 계약, 라이브 캔버스, 그리고 Next.js 호스트를 위한 0.6 → 0.8 체크리스트를
476
+ 정리합니다.
462
477
  - [Contributing](./CONTRIBUTING.md): 필수 커밋 형식과 릴리스 절차를 정의합니다.
463
478
  - [Changelog](./CHANGELOG.md): 발행된 각 버전이 무엇을 바꿨는지 기록합니다.
464
479
 
package/README.md CHANGED
@@ -319,14 +319,23 @@ either:
319
319
  A scenario must appear in exactly one category. Invalid references, missing
320
320
  coverage, and duplicate classifications fail before the editor opens.
321
321
 
322
+ Whether every source route is represented is a separate question, answered
323
+ headless: `auditRouteCoverage` compares the routes the host discovered with
324
+ the screens it declared (a concrete preview, an explicit `coverageRoutes`
325
+ mapping, or a registered component fixture), `validateSurfaceDemands` checks
326
+ the verdicts for the rest against the declarations they name, and the
327
+ summaries count exclusions and todo items apart from coverage.
328
+ [Coverage contracts](./docs/coverage-contracts.md) defines the identities,
329
+ the diagnostics, and what stays in the host.
330
+
322
331
  Screen recipes support `click`, `focus`, `hover`, `focus-visible`, `active`,
323
332
  `fill`, `check`, `press`, `scroll`, `wait`, and `storage` steps. Use deterministic recipes
324
333
  and assertions so each frame represents a repeatable application state. The
325
334
  [screen state contract](./docs/screen-state-contract.md) defines when a
326
335
  variation is a frame, an interaction state, a condition state, an editable
327
336
  parameter, a motion preview, or behavior-only QA. Rendered CSS and Web
328
- Animations targets are automatically available in the right-panel Motion
329
- controls with play, pause, reset, target isolation, and phase scrubbing.
337
+ Animations targets are discovered and settled for captures; a live frame
338
+ plays the product's own motion.
330
339
 
331
340
  ### Keep product routes separate from preview entry routes
332
341
 
@@ -459,9 +468,16 @@ npm run lint:language
459
468
  work.
460
469
  - [The editor transport](./docs/transport.md) defines the one object every
461
470
  request goes through, its endpoint table, and its error model.
471
+ - [Coverage contracts](./docs/coverage-contracts.md) defines how a host's
472
+ source-route gate identifies routes, represents them by preview, mapping,
473
+ or fixture, classifies scenarios exactly once, and joins diagnostics back
474
+ to source.
462
475
  - [Upgrading to 0.7](./docs/migration-0.7.md) maps the removed module-level
463
476
  exports to the editor runtime and the removed endpoint props to the
464
477
  transport.
478
+ - [Upgrading to 0.8](./docs/migration-0.8.md) lists what moved onto the
479
+ runtime, the coverage contracts, the live canvas, and a 0.6 to 0.8
480
+ checklist for a Next.js host.
465
481
  - [Contributing](./CONTRIBUTING.md) defines the required commit format and the
466
482
  release flow.
467
483
  - [Changelog](./CHANGELOG.md) lists what each published version changed.
@@ -0,0 +1,159 @@
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { a as C, R as P, at as g, bB as R, bC as b, C as E, bD as k, P as m, K as I } from "./runtime-DdYnT6k4.js";
3
+ import { useRef as L, useLayoutEffect as h } from "react";
4
+ function v(n) {
5
+ return `translate(${n.panX}px, ${n.panY}px) scale(${n.zoom})`;
6
+ }
7
+ function x(n, e, i, r = !1) {
8
+ return r || k(n, e, i) ? void 0 : "none";
9
+ }
10
+ function f(n, e) {
11
+ return x(
12
+ n.editMode,
13
+ n.tool,
14
+ e != null,
15
+ n.inspectOn
16
+ );
17
+ }
18
+ const l = /* @__PURE__ */ new WeakMap();
19
+ function z(n, e, i, r) {
20
+ if (e.route == null) return 0;
21
+ const t = I(e) ?? e.route, a = e.width ?? 390, o = e.height ?? 600, c = n.declarations.getPreviewIdentityEpoch();
22
+ let s = l.get(e);
23
+ (!s || s.revision !== i || s.epoch !== c || s.route !== t || s.width !== a || s.height !== o) && (s = {
24
+ revision: i,
25
+ epoch: c,
26
+ route: t,
27
+ width: a,
28
+ height: o,
29
+ key: m(n, e, i, r)
30
+ }, l.set(e, s));
31
+ const d = n.previews.getRoutePreviewSnapshot(s.key);
32
+ if (d != null) return d.length * 2;
33
+ const u = n.previews.getRoutePreviewShadowArtifact(s.key);
34
+ return u ? u.bodyHtml.length * 2 : 0;
35
+ }
36
+ function F(n, e, i, r) {
37
+ var s;
38
+ if (e.route == null) return null;
39
+ const t = l.get(e), a = (t == null ? void 0 : t.key) ?? m(n, e, i, r), o = (s = n.previews.getRoutePreviewArtifactOutcome(a)) == null ? void 0 : s.screenshot;
40
+ if (!o) return null;
41
+ const c = e.width ?? 390;
42
+ return c > 0 ? o.width / c : null;
43
+ }
44
+ function W(n) {
45
+ return w(n).map((i) => {
46
+ var t;
47
+ const r = n.store.pages.find((a) => a.id === i.id);
48
+ return {
49
+ ...i,
50
+ memoKey: r ? (t = l.get(r)) == null ? void 0 : t.key : void 0
51
+ };
52
+ });
53
+ }
54
+ function w(n) {
55
+ const e = n.store, i = n.host.previewRevision, r = e.selectedCanvasObject;
56
+ return e.pages.filter(
57
+ (t) => (t.canvas ?? "default") === e.activeCanvas && (e.isScreenStateShown(t) || e.isScreenStateStandby(t))
58
+ ).map((t) => ({
59
+ id: t.id,
60
+ rect: {
61
+ x: t.x ?? 0,
62
+ y: t.y ?? 0,
63
+ width: t.width ?? 390,
64
+ height: E(t)
65
+ },
66
+ pinned: t.id === e.activePageId || (r == null ? void 0 : r.kind) === "frame" && r.id === t.id || // A standby variant renders its full surface hidden at the group's
67
+ // slot, so the switch to it has nothing left to mount.
68
+ e.isScreenStateStandby(t) || // Catalog sheets need a full first render to replace their 1x1 seed.
69
+ // Their live DOM remains mounted afterwards; offscreen paint may be skipped.
70
+ b(t) || n.schedulers.previewIntent.hasPreviewIntent(t.id),
71
+ weightBytes: z(n, t, i, t.id === e.activePageId),
72
+ screenshotDensity: F(
73
+ n,
74
+ t,
75
+ i,
76
+ t.id === e.activePageId
77
+ )
78
+ }));
79
+ }
80
+ let B = 0;
81
+ function $({
82
+ children: n,
83
+ interactionFrameId: e = null
84
+ }) {
85
+ const i = C(), r = i.store, t = L(null);
86
+ return h(() => {
87
+ const a = t.current;
88
+ if (!a) return;
89
+ const o = new P(`CameraLayer#${++B}`, () => {
90
+ o.isDisposed || c();
91
+ }), c = () => {
92
+ o.track(() => {
93
+ a.style.transform = v(r), a.style.pointerEvents = f(r, e) ?? "";
94
+ });
95
+ };
96
+ return c(), () => o.dispose();
97
+ }, [r, e]), h(() => {
98
+ const a = i.schedulers.frameLod.createFrameLodController({
99
+ readCamera: () => ({
100
+ panX: r.panX,
101
+ panY: r.panY,
102
+ zoom: r.zoom,
103
+ canvas: r.activeCanvas
104
+ }),
105
+ readFrames: () => w(i),
106
+ // The live-screen budget follows the camera: the active frame first,
107
+ // then the frames nearest the viewport take the remaining slots.
108
+ onRecompute: ({ frames: o, camera: c, viewport: s }) => {
109
+ const { liveScreens: d } = i.schedulers, { activeId: u, siblingIds: y, groupSize: S } = g(() => ({
110
+ activeId: r.activePageId,
111
+ siblingIds: r.activeScreenStateSiblingIds,
112
+ groupSize: r.activeScreenStateGroup.length
113
+ }));
114
+ d.setLiveScreenGroupSize(S), d.setLiveScreenCandidates(
115
+ R({
116
+ frames: o,
117
+ camera: c,
118
+ viewport: s,
119
+ activeId: u,
120
+ preferredIds: y
121
+ })
122
+ );
123
+ },
124
+ readViewport: () => {
125
+ var c;
126
+ const o = (c = t.current) == null ? void 0 : c.parentElement;
127
+ if (o) {
128
+ const s = o.getBoundingClientRect();
129
+ if (s.width > 0 && s.height > 0)
130
+ return { width: s.width, height: s.height };
131
+ }
132
+ return { width: window.innerWidth, height: window.innerHeight };
133
+ }
134
+ });
135
+ return a.start(), () => a.stop();
136
+ }, [r, i]), /* @__PURE__ */ p(
137
+ "div",
138
+ {
139
+ ref: t,
140
+ "data-canvas-camera": !0,
141
+ style: {
142
+ position: "absolute",
143
+ left: 0,
144
+ top: 0,
145
+ transform: v(r),
146
+ transformOrigin: "0 0",
147
+ transition: "none",
148
+ willChange: "transform",
149
+ pointerEvents: f(r, e)
150
+ },
151
+ children: n
152
+ }
153
+ );
154
+ }
155
+ export {
156
+ $ as CameraLayer,
157
+ W as __debugReadEditorFrames,
158
+ x as resolveCameraPointerEvents
159
+ };