@womp/mcp-ui 0.1.6 → 0.1.7

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.
package/README.md CHANGED
@@ -11,7 +11,7 @@ in a sandboxed iframe, pushing tool data in over postMessage.
11
11
  generate_image ──► ui://womp/image-<version>.html (280 KB) image card
12
12
  image_to_mesh ──► ui://womp/mesh-<version>.html (900 KB) 3D GLB viewer
13
13
  get_generation ──► ui://womp/mesh-<version>.html (copes with either)
14
- estimate_print ──► ui://womp/print-<version>.html (260 KB) configurator: re-quotes + add to cart
14
+ estimate_print ──► ui://womp/print-<version>.html (321 KB) the print panel as a card: size, material, finish, colour, style, qty
15
15
  prepare_print ──► ui://womp/print-<version>.html (static receipt mode)
16
16
  add_to_cart ──► ui://womp/cart-<version>.html (260 KB) cart rows + checkout link-out
17
17
  view_cart ──► ui://womp/cart-<version>.html (self-fills thumbnails via app-callable view_cart)
@@ -180,6 +180,55 @@ inline (360px) so they do not wall off the transcript — which made fullscreen
180
180
  useless until CSS started keying off `:root[data-display-mode="fullscreen"]`.
181
181
  **PiP is untested.**
182
182
 
183
+ ### The print card is the web print panel, compressed
184
+
185
+ `src/print/` follows swan-frontend's `NewPrintingPanel` step for step — Size,
186
+ Material (finish and colour controls inside the selection), Print style, then a
187
+ review row with quantity and price — so a person who has printed on womp.com
188
+ recognises it. Where the card differs, it is because MCP differs:
189
+
190
+ - **Size is W/H/D in cm or inches, but scales uniformly.** The tool contract
191
+ is `longestSideCm`, so editing one axis rescales the other two and the
192
+ longest side is what gets sent. The panel's 60 × 60 × 40 cm ceiling blocks the
193
+ button here as it does there.
194
+ - **Colour is a hex, snapped to Pantone.** The panel snaps a pick to the
195
+ nearest of 2390 Pantone coated shades and sends the code; MCP orders carry a
196
+ hex. The card snaps the same way (`src/print/pantone.ts`, CIEDE2000 like the
197
+ panel's `color-diff`) and sends the snapped shade's own hex, so both paths
198
+ print the same colour and show the same "Pantone 2386 C". The palette is
199
+ packed into `src/print/pantone-coated.ts` (28 KB) by
200
+ `scripts/gen-pantone.mjs <path to swan-frontend's PantoneCoatedColors.js>`;
201
+ regenerate it if the frontend's list changes. Colour never re-quotes — it
202
+ never changes the price.
203
+ - **Hollow never orders.** Escape holes are placed in the editor, so choosing
204
+ Hollow shows its price and turns the button into "Continue on womp.com",
205
+ which calls `prepare_print` and opens the project. The backend refuses
206
+ `hollow: true` outright; the card never sends it.
207
+ - **Gated Enterprise materials stay visible**, with a crown, behind a
208
+ disclosure. Tapping one keeps the current selection and shows the
209
+ contact-sales note (the backend's `contactUrl`) — the panel's dialog, flattened.
210
+ - **Tool errors are rewritten for a person.** "resin-clear-tinted is a dyed
211
+ material — pass a color as a #rrggbb hex" is for the model; the card says
212
+ "Pick a colour for this material first."
213
+
214
+ What it reads off `estimate_print` beyond the price rows: `material` (the
215
+ catalog KEY it sent — the backend echoes it unchanged; echoing the priced id
216
+ snapped Tinted clear back to Clear on every re-quote), `materialLabel`,
217
+ `finish`, `color`, `repaired` / `nonManifold`, and a role-aware `materials`
218
+ list with `swatchUrl`, `finishes`, `colorRequired` / `colorOptional`,
219
+ `available` and `contactUrl`.
220
+
221
+ **Layout trap that cost an hour:** a grid container's implicit `auto` track
222
+ grows to its items' min-content, and a bare `<input type="number">` is ~150px
223
+ wide intrinsically — three of them widened every row past the card's edge while
224
+ the card itself stayed 360px. Every grid in the card is
225
+ `grid-template-columns: minmax(0, 1fr)` and the inputs have `width: 0` as their
226
+ flex basis. If a row overflows, look there first.
227
+
228
+ The stub takes three switches for the states a default account never shows:
229
+ `FAKE_ENTERPRISE=1` (Enterprise materials orderable), `FAKE_PRO=1` (hollow
230
+ priced as available), `FAKE_REPAIRED=1` (the repaired / non-manifold callouts).
231
+
183
232
  ## Development
184
233
 
185
234
  **Do not iterate through Claude.** A card change reaches a connector only after
@@ -212,7 +261,10 @@ It is deliberately faithful where being unfaithful would hide a bug:
212
261
  | **"built resource" mode** — the exact HTML `resources/read` returns, in a sandboxed opaque-origin iframe | an asset `vite-plugin-singlefile` failed to inline (blank card) |
213
262
 
214
263
  `FAKE_DURATION_MS=8000 yarn dev:mcp` lengthens a fake generation, so the
215
- running → polling → complete transition is worth watching.
264
+ running → polling → complete transition is worth watching. The print stubs
265
+ validate like the real tools (dyed material without a colour, Enterprise
266
+ material, hollow intent, bad finish) so every refusal the card must render is
267
+ reachable locally.
216
268
 
217
269
  **Keep the tab visible.** A backgrounded tab does not run
218
270
  `requestAnimationFrame` and clamps `setTimeout`, so auto-resize stops reporting