@1agh/maude 2.0.4 → 2.0.8

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 (272) hide show
  1. package/apps/hub/src/project-transactions/kernel.mjs +10 -1
  2. package/apps/studio/access/closure.ts +156 -16
  3. package/apps/studio/access/filters.ts +39 -5
  4. package/apps/studio/access/known-canvases.ts +24 -1
  5. package/apps/studio/access/refused-inputs.ts +89 -0
  6. package/apps/studio/actions/agents.ts +59 -0
  7. package/apps/studio/actions/ctx.ts +3 -0
  8. package/apps/studio/actions/defs/app.ts +12 -0
  9. package/apps/studio/actions/defs/sync.ts +13 -0
  10. package/apps/studio/actions/defs/view.ts +59 -3
  11. package/apps/studio/actions/keymap.gen.ts +35 -0
  12. package/apps/studio/actions/menu.ts +2 -0
  13. package/apps/studio/actions/types.ts +3 -1
  14. package/apps/studio/actions.manifest.json +148 -1
  15. package/apps/studio/actions.parity.json +31 -1
  16. package/apps/studio/annotations/ui/ai-seen.tsx +4 -3
  17. package/apps/studio/annotations/ui/element-node.tsx +139 -54
  18. package/apps/studio/annotations/ui/lod.tsx +1 -1
  19. package/apps/studio/annotations/ui/ride.ts +2 -1
  20. package/apps/studio/annotations/ui/text-style.ts +1 -1
  21. package/apps/studio/annotations-context-toolbar.tsx +5 -4
  22. package/apps/studio/annotations-layer.tsx +4 -15
  23. package/apps/studio/api.ts +425 -128
  24. package/apps/studio/artboard-activity-overlay.tsx +4 -4
  25. package/apps/studio/artboard-ai-copies.tsx +4 -4
  26. package/apps/studio/artboard-freeze.ts +108 -0
  27. package/apps/studio/artboard-live-gate.tsx +636 -0
  28. package/apps/studio/artboard-live.ts +831 -0
  29. package/apps/studio/artboard-placeholder.ts +197 -0
  30. package/apps/studio/artboard-still-raster.ts +485 -0
  31. package/apps/studio/artboard-still-warmup.ts +221 -0
  32. package/apps/studio/artboard-still.ts +1188 -0
  33. package/apps/studio/artboard-webgl.ts +669 -0
  34. package/apps/studio/asset-placeholder.tsx +237 -132
  35. package/apps/studio/asset-upload-bars.tsx +4 -4
  36. package/apps/studio/bin/_agent-browser-bin.mjs +8 -0
  37. package/apps/studio/bin/_agent-browser-safe.mjs +2 -1
  38. package/apps/studio/bin/_canvas-reasons.mjs +34 -0
  39. package/apps/studio/bin/_ds-check-live.mjs +37 -0
  40. package/apps/studio/bin/_ds-check.mjs +4 -1
  41. package/apps/studio/bin/_ds-prove-judge.mjs +167 -0
  42. package/apps/studio/bin/_ds-prove-playwright.mjs +183 -105
  43. package/apps/studio/bin/_import-asset.mjs +2 -1
  44. package/apps/studio/bin/_perf-probe-open.mjs +364 -0
  45. package/apps/studio/bin/_perf-probe.mjs +2 -1
  46. package/apps/studio/bin/_perf-shared.mjs +12 -7
  47. package/apps/studio/bin/_pw-launch.mjs +26 -1
  48. package/apps/studio/bin/_studio-verb.mjs +24 -3
  49. package/apps/studio/bin/_thumb-blank.mjs +70 -0
  50. package/apps/studio/bin/_thumb-cover.mjs +35 -0
  51. package/apps/studio/bin/_thumbs-playwright.mjs +89 -12
  52. package/apps/studio/bin/ds-check.sh +5 -1
  53. package/apps/studio/bin/perf.sh +30 -1
  54. package/apps/studio/bin/server-up.sh +7 -2
  55. package/apps/studio/bin/smoke.sh +19 -0
  56. package/apps/studio/bridge/dgn-protocol.ts +35 -0
  57. package/apps/studio/canvas-build-sandbox.ts +69 -13
  58. package/apps/studio/canvas-camera.ts +90 -0
  59. package/apps/studio/canvas-comment-mount.tsx +9 -9
  60. package/apps/studio/canvas-lib.tsx +289 -44
  61. package/apps/studio/canvas-pages-view.tsx +465 -0
  62. package/apps/studio/canvas-pages.ts +305 -0
  63. package/apps/studio/canvas-rows.ts +62 -0
  64. package/apps/studio/canvas-shell.tsx +62 -16
  65. package/apps/studio/canvas-theme-icons.tsx +41 -0
  66. package/apps/studio/canvas-theme-pill.tsx +15 -6
  67. package/apps/studio/canvas-theme.ts +12 -11
  68. package/apps/studio/client/app.jsx +7 -0
  69. package/apps/studio/client/canvas-url.js +36 -1
  70. package/apps/studio/client/home/HomeAccounts.jsx +262 -0
  71. package/apps/studio/client/home/Shelves.jsx +4 -3
  72. package/apps/studio/client/home/home-accounts-model.js +121 -0
  73. package/apps/studio/client/home/home-api.js +6 -0
  74. package/apps/studio/client/home/home-app.jsx +141 -40
  75. package/apps/studio/client/home/home-model.js +172 -6
  76. package/apps/studio/client/home/home.css +169 -5
  77. package/apps/studio/client/home/shell-mode.js +8 -1
  78. package/apps/studio/client/hooks/canvas-origin-probe.js +34 -0
  79. package/apps/studio/client/hooks/use-action-keys.jsx +3 -1
  80. package/apps/studio/client/hooks/use-canvas-bridge.jsx +1 -1
  81. package/apps/studio/client/hooks/use-palette-and-panels.jsx +23 -6
  82. package/apps/studio/client/hooks/use-photo-and-timeline.jsx +16 -8
  83. package/apps/studio/client/hooks/use-project-data.jsx +13 -2
  84. package/apps/studio/client/hooks/use-shell-core.jsx +19 -9
  85. package/apps/studio/client/index-loader.ts +41 -21
  86. package/apps/studio/client/inspector/inspector-panel.jsx +35 -14
  87. package/apps/studio/client/panels/ChatPanel.jsx +27 -20
  88. package/apps/studio/client/panels/CreateProject.jsx +19 -5
  89. package/apps/studio/client/panels/caps-cache.js +46 -0
  90. package/apps/studio/client/shell/viewport.jsx +66 -22
  91. package/apps/studio/client/tree/tree.jsx +17 -0
  92. package/apps/studio/client/v2/access/access-client.js +2 -0
  93. package/apps/studio/client/v2/access/access-host.jsx +12 -1
  94. package/apps/studio/client/v2/access/trashed-banner.jsx +6 -3
  95. package/apps/studio/client/v2/ai/Advanced.jsx +12 -0
  96. package/apps/studio/client/v2/ai/Composer.jsx +27 -10
  97. package/apps/studio/client/v2/canvases/canvases-panel.jsx +24 -0
  98. package/apps/studio/client/v2/canvases/use-canvas-index.js +24 -1
  99. package/apps/studio/client/v2/code/canvas-error-card.jsx +14 -2
  100. package/apps/studio/client/v2/code/canvas-imports-card.jsx +19 -14
  101. package/apps/studio/client/v2/code/canvas-imports-words.js +60 -0
  102. package/apps/studio/client/v2/code/canvas-waiting-card.jsx +59 -5
  103. package/apps/studio/client/v2/code/canvas-waiting.js +18 -1
  104. package/apps/studio/client/v2/code/code-bus.js +5 -0
  105. package/apps/studio/client/v2/code/code-consent-sheet.jsx +87 -0
  106. package/apps/studio/client/v2/code/code-consent.js +67 -0
  107. package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +62 -10
  108. package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +314 -5
  109. package/apps/studio/client/v2/ds/advanced-host.jsx +11 -26
  110. package/apps/studio/client/v2/ds/ds-refresh.js +161 -0
  111. package/apps/studio/client/v2/ds/library-host.jsx +45 -45
  112. package/apps/studio/client/v2/ds/make-host.jsx +13 -15
  113. package/apps/studio/client/v2/ds/off-system-host.jsx +18 -19
  114. package/apps/studio/client/v2/ds/review-host.jsx +7 -1
  115. package/apps/studio/client/v2/ds/truth-host.jsx +15 -17
  116. package/apps/studio/client/v2/ds/upgrade-host.jsx +26 -10
  117. package/apps/studio/client/v2/history/branch-actions.js +13 -9
  118. package/apps/studio/client/v2/history/git-advanced.jsx +8 -1
  119. package/apps/studio/client/v2/history/git-model.js +3 -1
  120. package/apps/studio/client/v2/history/git-parts.jsx +16 -1
  121. package/apps/studio/client/v2/layers/artboard-layers.jsx +24 -5
  122. package/apps/studio/client/v2/layers/layers-request.js +49 -0
  123. package/apps/studio/client/v2/left-panel/canvases-pinned.jsx +93 -3
  124. package/apps/studio/client/v2/left-panel/ds-boards.js +39 -0
  125. package/apps/studio/client/v2/left-panel/left-panel-model.js +13 -0
  126. package/apps/studio/client/v2/left-panel/left-panel.css +24 -0
  127. package/apps/studio/client/v2/presence/faces.jsx +42 -14
  128. package/apps/studio/client/v2/shell/account-card.jsx +10 -4
  129. package/apps/studio/client/v2/shell/canvas-crash-guard.js +172 -0
  130. package/apps/studio/client/v2/shell/canvas-mode.js +17 -1
  131. package/apps/studio/client/v2/shell/floating-panels.css +37 -1
  132. package/apps/studio/client/v2/shell/github-signin-host.jsx +42 -0
  133. package/apps/studio/client/v2/shell/menu-runner.js +11 -0
  134. package/apps/studio/client/v2/shell/mode-switch.jsx +14 -3
  135. package/apps/studio/client/v2/shell/opening-skeleton.js +118 -0
  136. package/apps/studio/client/v2/shell/opening-skeleton.jsx +103 -0
  137. package/apps/studio/client/v2/shell/pages-pick.js +49 -0
  138. package/apps/studio/client/v2/shell/project-account-card.jsx +203 -0
  139. package/apps/studio/client/v2/shell/project-account-model.js +182 -0
  140. package/apps/studio/client/v2/shell/project-menu-model.js +3 -0
  141. package/apps/studio/client/v2/shell/share-cluster-host.jsx +140 -11
  142. package/apps/studio/client/v2/shell/share-cluster.css +58 -0
  143. package/apps/studio/client/v2/shell/share-cluster.jsx +26 -7
  144. package/apps/studio/client/v2/shell/shell-parity.json +8 -0
  145. package/apps/studio/client/v2/shell/team-switch.js +94 -0
  146. package/apps/studio/client/v2/shell/too-heavy-card.jsx +38 -0
  147. package/apps/studio/client/v2/shell/use-account.js +8 -1
  148. package/apps/studio/client/v2/shell/use-canvas-mode-lane.js +30 -0
  149. package/apps/studio/collab/persistence.ts +9 -1
  150. package/apps/studio/collab/registry.ts +32 -0
  151. package/apps/studio/collab/room.ts +8 -0
  152. package/apps/studio/comments-overlay.tsx +12 -11
  153. package/apps/studio/config-reload-wire.ts +56 -0
  154. package/apps/studio/config.schema.json +6 -0
  155. package/apps/studio/context.ts +37 -1
  156. package/apps/studio/dist/client.bundle.js +1198 -1198
  157. package/apps/studio/dist/comment-mount.js +2 -2
  158. package/apps/studio/dist/styles.css +1 -1
  159. package/apps/studio/ds/board/board.css +6 -0
  160. package/apps/studio/ds/board/ds-bar.tsx +21 -3
  161. package/apps/studio/ds/board/specimen.tsx +16 -2
  162. package/apps/studio/ds/board/template.ts +39 -19
  163. package/apps/studio/ds/canvas-cli.ts +58 -2
  164. package/apps/studio/ds/check.ts +26 -1
  165. package/apps/studio/ds/cli.ts +14 -4
  166. package/apps/studio/ds/component-list.ts +2 -1
  167. package/apps/studio/ds/convert.ts +34 -6
  168. package/apps/studio/ds/default.ts +6 -1
  169. package/apps/studio/ds/ds-resolver.ts +58 -8
  170. package/apps/studio/ds/ds-verb.ts +13 -0
  171. package/apps/studio/ds/engine.ts +3 -1
  172. package/apps/studio/ds/folder-systems.ts +199 -0
  173. package/apps/studio/ds/pairing-css.ts +2 -1
  174. package/apps/studio/ds/post-build.ts +38 -0
  175. package/apps/studio/ds/rename.ts +10 -3
  176. package/apps/studio/ds/shell-fallbacks.ts +2 -1
  177. package/apps/studio/ds/upgrade-apply.ts +27 -5
  178. package/apps/studio/ds/upgrade-cli.ts +22 -2
  179. package/apps/studio/ds/upgrade-prove.ts +198 -15
  180. package/apps/studio/ds/upgrade-stage.ts +10 -3
  181. package/apps/studio/editing/ai-point-ring.tsx +4 -4
  182. package/apps/studio/editing/ai-scope-outline.tsx +4 -4
  183. package/apps/studio/editing/align-bar.tsx +4 -4
  184. package/apps/studio/editing/anchor-report.ts +3 -2
  185. package/apps/studio/editing/artboard-handles.tsx +4 -4
  186. package/apps/studio/editing/corner-dots.tsx +4 -4
  187. package/apps/studio/editing/crop-mode.tsx +4 -4
  188. package/apps/studio/editing/drop-chip.tsx +4 -4
  189. package/apps/studio/editing/empty-report.ts +3 -2
  190. package/apps/studio/editing/focus-model.tsx +4 -4
  191. package/apps/studio/editing/gap-bands.tsx +3 -3
  192. package/apps/studio/editing/hold-rings.tsx +4 -4
  193. package/apps/studio/editing/lock-badge.tsx +3 -3
  194. package/apps/studio/editing/long-page.ts +23 -1
  195. package/apps/studio/editing/nudge.tsx +2 -2
  196. package/apps/studio/editing/page-activity.ts +4 -3
  197. package/apps/studio/editing/paste-bar.tsx +4 -4
  198. package/apps/studio/editing/pen/overlay.tsx +4 -3
  199. package/apps/studio/editing/place-freely.tsx +3 -3
  200. package/apps/studio/editing/reorder-slot.tsx +3 -3
  201. package/apps/studio/editing/selection.tsx +4 -4
  202. package/apps/studio/editing/size-ghost.tsx +4 -4
  203. package/apps/studio/editing/tab-order.tsx +4 -4
  204. package/apps/studio/editing/text-in-place.tsx +4 -4
  205. package/apps/studio/editing/undo-preview.tsx +3 -3
  206. package/apps/studio/equal-spacing-handles.tsx +3 -3
  207. package/apps/studio/frame-clock.ts +89 -0
  208. package/apps/studio/history/trash.ts +6 -0
  209. package/apps/studio/home/accounts.ts +87 -0
  210. package/apps/studio/home/index-reader.ts +24 -2
  211. package/apps/studio/home/routes.ts +19 -0
  212. package/apps/studio/http.ts +80 -34
  213. package/apps/studio/index/ds-usage.ts +4 -1
  214. package/apps/studio/index-cache.ts +272 -0
  215. package/apps/studio/inspect-overlay.tsx +4 -3
  216. package/apps/studio/inspect.ts +7 -2
  217. package/apps/studio/link-chip-overlay.tsx +4 -3
  218. package/apps/studio/measure-overlay.tsx +4 -3
  219. package/apps/studio/present/pointer-dot.tsx +3 -2
  220. package/apps/studio/present/present-media.ts +6 -2
  221. package/apps/studio/present/present-stage.tsx +3 -2
  222. package/apps/studio/preview/preview-camera.tsx +3 -2
  223. package/apps/studio/routes/ds-convert.ts +18 -0
  224. package/apps/studio/routes/sync.ts +176 -0
  225. package/apps/studio/routes/trash.ts +16 -1
  226. package/apps/studio/safe-zones-overlay.tsx +3 -2
  227. package/apps/studio/server.ts +8 -10
  228. package/apps/studio/skip-dirs.ts +103 -47
  229. package/apps/studio/studio-page-host.ts +70 -0
  230. package/apps/studio/sync/accepted-cold-start.ts +28 -13
  231. package/apps/studio/sync/asset-push.ts +146 -23
  232. package/apps/studio/sync/asset-state.ts +3 -2
  233. package/apps/studio/sync/code-module-consent.ts +86 -0
  234. package/apps/studio/sync/file-ledger.ts +24 -0
  235. package/apps/studio/sync/file-membership.ts +28 -3
  236. package/apps/studio/sync/file-plane.ts +497 -61
  237. package/apps/studio/sync/file-pull.ts +304 -33
  238. package/apps/studio/sync/held-deletes.ts +230 -0
  239. package/apps/studio/sync/hub-link.ts +1 -2
  240. package/apps/studio/sync/hubs-config.ts +59 -2
  241. package/apps/studio/sync/index.ts +405 -163
  242. package/apps/studio/sync/journal-client.ts +94 -5
  243. package/apps/studio/sync/pending-deletes.ts +100 -0
  244. package/apps/studio/sync/projection.ts +77 -12
  245. package/apps/studio/sync/seed-progress.ts +104 -3
  246. package/apps/studio/sync/settings.ts +36 -1
  247. package/apps/studio/sync/status.ts +17 -1
  248. package/apps/studio/sync/writer-registry.ts +5 -0
  249. package/apps/studio/text-caret.ts +5 -3
  250. package/apps/studio/thumbs/service.ts +12 -2
  251. package/apps/studio/thumbs/validate.ts +7 -0
  252. package/apps/studio/toolbars/toolbar-rect.ts +3 -2
  253. package/apps/studio/ui-prefs-migrate.ts +4 -0
  254. package/apps/studio/use-annotation-resize.tsx +4 -3
  255. package/apps/studio/use-artboard-drag.tsx +3 -2
  256. package/apps/studio/use-element-resize.tsx +7 -6
  257. package/apps/studio/use-grid-track-handles.tsx +5 -4
  258. package/apps/studio/use-selection-set.tsx +64 -4
  259. package/apps/studio/use-spacing-handles.tsx +7 -6
  260. package/apps/studio/video-comp.tsx +75 -39
  261. package/apps/studio/video-play-overlay.tsx +4 -3
  262. package/apps/studio/whats-new.json +99 -0
  263. package/cli/commands/design.mjs +5 -2
  264. package/cli/commands/hub.mjs +10 -1
  265. package/cli/lib/bash-guard.mjs +27 -1
  266. package/cli/lib/design-help.gen.mjs +1 -1
  267. package/cli/lib/design-hook.mjs +20 -0
  268. package/cli/lib/design-link.mjs +42 -17
  269. package/cli/lib/hub-purge.mjs +183 -0
  270. package/cli/lib/studio-locate.mjs +35 -10
  271. package/package.json +8 -8
  272. package/plugins/design/templates/_shell.html +164 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1agh/maude",
3
- "version": "2.0.4",
3
+ "version": "2.0.8",
4
4
  "description": "Marketplace of Claude Code plugins by Michal Dovrtěl: `design` (canvas-first design iteration) + `flow` (generic agentic workflow loop with .ai second brain). Ships the `maude` CLI (with `mdcc` legacy alias) to scaffold workspace, run the design dev server, and manage configs.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -65,13 +65,13 @@
65
65
  "test:e2e:desktop:parity:cloud": "pnpm --filter @maude/desktop-e2e e2e:parity:cloud"
66
66
  },
67
67
  "optionalDependencies": {
68
- "@1agh/maude-darwin-arm64": "2.0.4",
69
- "@1agh/maude-darwin-x64": "2.0.4",
70
- "@1agh/maude-linux-arm64": "2.0.4",
71
- "@1agh/maude-linux-arm64-musl": "2.0.4",
72
- "@1agh/maude-linux-x64": "2.0.4",
73
- "@1agh/maude-linux-x64-musl": "2.0.4",
74
- "@1agh/maude-win32-x64": "2.0.4"
68
+ "@1agh/maude-darwin-arm64": "2.0.8",
69
+ "@1agh/maude-darwin-x64": "2.0.8",
70
+ "@1agh/maude-linux-arm64": "2.0.8",
71
+ "@1agh/maude-linux-arm64-musl": "2.0.8",
72
+ "@1agh/maude-linux-x64": "2.0.8",
73
+ "@1agh/maude-linux-x64-musl": "2.0.8",
74
+ "@1agh/maude-win32-x64": "2.0.8"
75
75
  },
76
76
  "files": [
77
77
  "cli",
@@ -134,6 +134,122 @@
134
134
  }
135
135
  }
136
136
  </script>
137
+ <script id="maude-frame-freeze">
138
+ // 2.0.7 — the gesture freeze (apps/studio/frame-clock.ts). While the camera moves, an artboard's own frame
139
+ // callbacks wait: requestAnimationFrame is gated HERE, before any module loads, so the canvas runtime gets
140
+ // the gated one too (motion keeps the function it found when it loaded). A callback that comes due while
141
+ // frozen is held and runs on the first frame after the thaw, in the order it was requested; a cancel still
142
+ // reaches it. Maude's own frame code calls the exempt `raf`. A freeze not renewed for WATCHDOG_MS thaws
143
+ // itself, so a canvas that went away mid-gesture never leaves the frame frozen.
144
+ (function (W) {
145
+ if (typeof W.requestAnimationFrame !== 'function' || W.__maudeFrameFreeze) return;
146
+ var nativeRaf = W.requestAnimationFrame.bind(W);
147
+ var nativeCaf = W.cancelAnimationFrame.bind(W);
148
+ var later = W.setTimeout.bind(W);
149
+ var unlater = W.clearTimeout.bind(W);
150
+ var WATCHDOG_MS = 2000;
151
+ var frozen = false;
152
+ var held = new Map();
153
+ var flushId = 0;
154
+ var watchdog = 0;
155
+ var subs = [];
156
+ var n = { freezes: 0, deferred: 0, flushed: 0, watchdog: 0 };
157
+ var tell = function () {
158
+ var list = subs.slice();
159
+ for (var i = 0; i < list.length; i++) {
160
+ try {
161
+ list[i](frozen);
162
+ } catch (e) {
163
+ later(function () {
164
+ throw e;
165
+ }, 0);
166
+ }
167
+ }
168
+ };
169
+ var flush = function (t) {
170
+ flushId = 0;
171
+ var due = Array.from(held.keys());
172
+ for (var i = 0; i < due.length; i++) {
173
+ if (frozen) return;
174
+ var cb = held.get(due[i]);
175
+ if (!cb) continue;
176
+ held.delete(due[i]);
177
+ n.flushed++;
178
+ try {
179
+ cb(t);
180
+ } catch (e) {
181
+ later(function () {
182
+ throw e;
183
+ }, 0);
184
+ }
185
+ }
186
+ };
187
+ var gated = function (cb) {
188
+ if (typeof cb !== 'function') return nativeRaf(cb);
189
+ var id = nativeRaf(function (t) {
190
+ if (!frozen) return cb(t);
191
+ held.set(id, cb);
192
+ n.deferred++;
193
+ });
194
+ return id;
195
+ };
196
+ var cancel = function (id) {
197
+ if (!held.delete(id)) nativeCaf(id);
198
+ };
199
+ var set = function (on) {
200
+ if (on) {
201
+ if (watchdog) unlater(watchdog);
202
+ watchdog = later(function () {
203
+ watchdog = 0;
204
+ n.watchdog++;
205
+ set(false);
206
+ }, WATCHDOG_MS);
207
+ if (frozen) return;
208
+ frozen = true;
209
+ n.freezes++;
210
+ return tell();
211
+ }
212
+ if (watchdog) unlater(watchdog);
213
+ watchdog = 0;
214
+ if (!frozen) return;
215
+ frozen = false;
216
+ if (held.size && !flushId) flushId = nativeRaf(flush);
217
+ tell();
218
+ };
219
+ W.requestAnimationFrame = gated;
220
+ W.cancelAnimationFrame = cancel;
221
+ Object.defineProperty(W, '__maudeFrameFreeze', {
222
+ configurable: false,
223
+ writable: false,
224
+ value: Object.freeze({
225
+ v: 1,
226
+ raf: nativeRaf,
227
+ caf: cancel,
228
+ set: set,
229
+ frozen: function () {
230
+ return frozen;
231
+ },
232
+ on: function (fn) {
233
+ subs.push(fn);
234
+ return function () {
235
+ var i = subs.indexOf(fn);
236
+ if (i >= 0) subs.splice(i, 1);
237
+ };
238
+ },
239
+ stats: function () {
240
+ return {
241
+ frozen: frozen,
242
+ freezes: n.freezes,
243
+ held: held.size,
244
+ deferred: n.deferred,
245
+ flushed: n.flushed,
246
+ watchdog: n.watchdog,
247
+ };
248
+ },
249
+ }),
250
+ });
251
+ })(window);
252
+ </script>
137
253
  <style>
138
254
  :root {
139
255
  color-scheme: light dark;
@@ -948,6 +1064,53 @@ function scopeCss(css, value, opts = {}) {
948
1064
  });
949
1065
  }
950
1066
  // soft-reload:end
1067
+ // build-wait:begin
1068
+ // 2.0.7 (#2) — A COLD BUILD IS NOT A FAILURE. On a team server a canvas whose build outlives the
1069
+ // request is answered 503 + Retry-After ("still being built") while the build goes on and is
1070
+ // cached (2.0.4 task P). The frame used to treat that 503 as a broken canvas: it gave up after
1071
+ // the second 503, or — when the build finished during the second ask — after a 200 it never
1072
+ // imported, and the studio showed "can't be drawn right now" with no details over a canvas a
1073
+ // Reload then drew at once (design.studyfi.com, first open of the design system after a
1074
+ // restart). Now a 503 waits its Retry-After and asks again, up to the deadline; a build that
1075
+ // finished in between is imported at once; anything else fails as before.
1076
+ const BUILD_WAIT_DEADLINE_MS = 10 * 60 * 1000;
1077
+ function importWhenBuilt(url, io) {
1078
+ const started = io.now();
1079
+ let attempt = 0;
1080
+ let afterBuilt = 0;
1081
+ const next = () => {
1082
+ const u = attempt === 0 ? url : url + (url.includes('?') ? '&' : '?') + 'v=b' + attempt;
1083
+ return io.load(u).catch((err) =>
1084
+ io.probe(url).then((p) => {
1085
+ attempt++;
1086
+ if (p && p.status === 503 && io.now() - started < BUILD_WAIT_DEADLINE_MS) {
1087
+ if (io.onWaiting) io.onWaiting(attempt);
1088
+ const s = Math.min(10, Math.max(1, Number(p.retryAfterS) || 5));
1089
+ return io.sleep(s * 1000).then(next);
1090
+ }
1091
+ // built while we asked: the module is in the server's cache now — import it (once more)
1092
+ if (p && p.ok && afterBuilt++ < 1) return next();
1093
+ throw err;
1094
+ })
1095
+ );
1096
+ };
1097
+ return next();
1098
+ }
1099
+ const shellBuildIo = {
1100
+ load: (u) => import(u),
1101
+ probe: (u) =>
1102
+ fetch(u, { headers: { 'Cache-Control': 'no-store' } }).then(
1103
+ (r) => {
1104
+ try { if (r.body) r.body.cancel(); } catch (e) { /* already read */ }
1105
+ return { ok: r.ok, status: r.status, retryAfterS: Number(r.headers.get('Retry-After')) || 0 };
1106
+ },
1107
+ () => null
1108
+ ),
1109
+ sleep: (ms) => new Promise((r) => setTimeout(r, ms)),
1110
+ now: () => Date.now(),
1111
+ onWaiting: (n) => console.info('[canvas-shell] still being built — waiting (' + n + ')'),
1112
+ };
1113
+ // build-wait:end
951
1114
  // Phase 6.5 — exporters pass ?hide-chrome=1 to flip the export-mode
952
1115
  // stylesheet from `media="not all"` to `media="all"`, hiding the
953
1116
  // dev-server overlays during capture. See `<style id="canvas-hide-chrome">`.
@@ -1559,7 +1722,7 @@ function scopeCss(css, value, opts = {}) {
1559
1722
  // React singleton (inlining a second React would break hooks).
1560
1723
  const [{ mountCanvas }, mod] = await Promise.all([
1561
1724
  import(withCap('/_client/comment-mount.js')),
1562
- import(canvasUrl),
1725
+ importWhenBuilt(canvasUrl, shellBuildIo),
1563
1726
  metaFetch,
1564
1727
  ]);
1565
1728
  const Canvas = mod.default;