@ossclip/scenes 0.1.7 → 0.1.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ossclip/scenes",
3
- "version": "0.1.7",
3
+ "version": "0.1.10",
4
4
  "description": "ossclip's scene library and stage geometry — React components shared by preview and render",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "dependencies": {
21
21
  "zod": "^3.25.0",
22
- "@ossclip/core": "0.1.7"
22
+ "@ossclip/core": "0.1.10"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": ">=18",
@@ -170,6 +170,18 @@ export const SceneLayer: React.FC<{ cues: SceneCue[]; theme: Theme }> = ({ cues,
170
170
  // Fill the slot instead of floating at natural size in it (§23). The
171
171
  // component lays out at contentW/scale and is then scaled up, so its
172
172
  // rendered width is exactly the content width while its type grows.
173
+ //
174
+ // Accepted v1 wrinkle (PLAN Task 2): `fitScale` sizes off `cue.props`
175
+ // alone — it has no visibility into which elements the user hid via
176
+ // `cue.elements[id].hidden`, so a scene with a hidden bubble/line/
177
+ // node still gets the SAME conservative scale as if everything were
178
+ // showing. The remaining siblings still close the gap correctly
179
+ // (`editStyle`'s `display:none` just removes a box from the flex/
180
+ // stack), they just aren't scaled up to use the space the hidden one
181
+ // freed. Teaching the fit models the edit layer would mean every
182
+ // metrics function taking `elements` alongside `props` for a v1
183
+ // feature whose actual ask was "let me delete one bubble," not
184
+ // "re-fit the layout around the gap" — deferred, not forgotten.
173
185
  const scale = fitScale(cue.component, cue.props, { widthPx: contentW, heightPx: contentH });
174
186
  return (
175
187
  <Sequence key={cue.id} from={from} durationInFrames={durationInFrames}>
package/src/editable.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import type React from "react";
2
2
 
3
- /** Per-element nudges from the user's edit layer, keyed by `data-edit-id`. */
3
+ /** Per-element nudges from the user's edit layer, keyed by `data-edit-id`.
4
+ * `hidden` (PLAN Task 2) is a soft-delete flag, not a nudge — see `editStyle`
5
+ * below for where it takes effect. */
4
6
  export type ElementEdits =
5
- | Record<string, { dx?: number; dy?: number; scale?: number }>
7
+ | Record<string, { dx?: number; dy?: number; scale?: number; hidden?: boolean }>
6
8
  | undefined;
7
9
 
8
10
  /**
@@ -45,6 +47,17 @@ export function compensateEdits(edits: ElementEdits, renderScale: number): Eleme
45
47
  export function editStyle(edits: ElementEdits, id: string): React.CSSProperties {
46
48
  const e = edits?.[id];
47
49
  if (!e) return {};
50
+ // Soft-delete (PLAN Task 2), suppressed HERE — the one chokepoint every
51
+ // component's leaf renders its edit style through, so no per-component
52
+ // change is needed and the remaining siblings close the gap on their own
53
+ // (a flex/stack layout just has one fewer box; a scale-to-fill layout's
54
+ // sibling type still fills whatever it filled before — see SceneLayer.tsx
55
+ // for the one place `fitScale` does NOT yet account for this). Also
56
+ // suppresses ChatMock's synthetic CTA bubble (`message-0` in keyword
57
+ // mode, `chatBubbles` in fit.ts) if the user chooses to hide it — that's
58
+ // allowed, not special-cased away: it's their call what the CTA scene
59
+ // shows.
60
+ if (e.hidden) return { display: "none" };
48
61
  const parts = [`translate(${e.dx ?? 0}px, ${e.dy ?? 0}px)`];
49
62
  if (e.scale !== undefined && e.scale !== 1) parts.push(`scale(${e.scale})`);
50
63
  return { transform: parts.join(" ") };
package/src/fit.ts CHANGED
@@ -527,6 +527,10 @@ export function flowMetrics(
527
527
  * chips end up visibly bigger than six, which is the point of §23. Solved by
528
528
  * bisection because the height model depends on the content width, which
529
529
  * depends on the scale.
530
+ *
531
+ * Sizes off `props` alone — blind to which elements the edit layer hid
532
+ * (PLAN Task 2's accepted v1 wrinkle; see the call site's own comment in
533
+ * `SceneLayer.tsx` for the full reasoning).
530
534
  */
531
535
  export function fitScale(
532
536
  component: SceneComponentId,