@pie-players/pie-section-player 0.3.65 → 0.3.67

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
@@ -278,21 +278,25 @@ When both max-width attributes are set, the with-passage cap resolves to the gre
278
278
  of the two configured values (after clamp), so with-passage mode never ends up narrower
279
279
  than no-passage mode.
280
280
 
281
- ### Item card media region
281
+ ### Content-card tool surfaces
282
282
 
283
- An item card can carry a `data-region="media"` region beside its content region.
284
- It is a host surface named `item-media`, not a feature: whatever capability
285
- declares `surfaces: ['item-media']` in its registration renders there, and this
286
- package names none of them. The region appears only when policy grants the
287
- capability *and* the capability's own `requiresAuthoredContent` resolves, so
288
- there is no dead affordance on items that carry nothing.
283
+ Item and passage cards offer two content-scoped host surfaces:
284
+
285
+ - `content-lead` is a full-width stack before the authored player content.
286
+ - `content-media` is the resizable region beside that content.
287
+
288
+ They are host surfaces, not features: whatever capability declares one of those
289
+ names in `surfaces` may render there, and this package names no capability. A
290
+ surface becomes mountable only when policy grants the capability and its own
291
+ `requiresAuthoredContent` resolves, so an item or passage without the authored
292
+ resource gets no dead affordance.
289
293
 
290
294
  Today's occupant is `@pie-players/pie-tool-sign-language` — a signed (ASL)
291
295
  translation gated on the `signLanguage` PNP support. It is not part of the
292
296
  packaged capability set: a deployment opts in by registering it on the tool
293
297
  registry it passes to the player.
294
298
 
295
- It sits to the right of the question content and is resizable via a
299
+ The `content-media` adapter sits to the right of the content and is resizable via a
296
300
  keyboard-accessible divider (`role="separator"`; arrow keys, `Home`/`End`,
297
301
  `Escape` to cancel a drag). Below a card width of 560px the region stacks under
298
302
  the content and the divider is withdrawn. Placement is fixed in this iteration:
@@ -306,6 +310,16 @@ set for that belong to `@pie-players/pie-tool-sign-language` and are documented
306
310
  with their defaults in [its README](../tool-sign-language/README.md) — they keep
307
311
  the `pie-section-player` prefix because hosts already set them by those names.
308
312
 
313
+ All three section-player surfaces (`content-lead`, `content-media`, and
314
+ `section-overlay`) share one internal Tool Surface Host. It observes live
315
+ `ToolRegistry` mutations and policy/catalog changes, preserves registration
316
+ order across lazy loads, synchronizes an existing element when its current
317
+ context changes, and always calls `destroy()` before removing it. Surface
318
+ failures are isolated per capability and emitted as recoverable
319
+ `framework-error` warnings; they never block readiness or remove another
320
+ working capability. A `renderSurface()` result of `null` is a normal
321
+ mountable-but-unoccupied result, not an error.
322
+
309
323
  ### API direction: CE defaults first, JS customization for advanced cases
310
324
 
311
325
  The intended usage model is:
@@ -18,6 +18,16 @@
18
18
  * capability declares this surface once and reaches both.
19
19
  */
20
20
  export declare const CONTENT_MEDIA_SURFACE = "content-media";
21
+ /**
22
+ * Host slot for a text alternate that has to be read in order with the content:
23
+ * full width, above the card body, in document flow.
24
+ *
25
+ * Separate from {@link CONTENT_MEDIA_SURFACE} because the geometry is the whole
26
+ * difference. Docked media is watched beside the content and is sized by an
27
+ * aspect ratio; a transcript or a plain-language alternate is read *before* the
28
+ * control it belongs to, which a sticky side column cannot express.
29
+ */
30
+ export declare const CONTENT_LEAD_SURFACE = "content-lead";
21
31
  /**
22
32
  * Default and bounds for the media region's share of the card width.
23
33
  *
@@ -0,0 +1,28 @@
1
+ import { CatalogOwnerContext, ToolRegistry, ToolSurfaceServices } from '@pie-players/pie-assessment-toolkit';
2
+ export type ToolSurfaceScope = {
3
+ kind: "content";
4
+ ownerContext: CatalogOwnerContext;
5
+ } | {
6
+ kind: "section";
7
+ assessmentId: string;
8
+ sectionId: string;
9
+ };
10
+ export interface ToolSurfaceHostInput {
11
+ anchor: HTMLElement | null;
12
+ surface: string;
13
+ registry: ToolRegistry | null;
14
+ services: ToolSurfaceServices;
15
+ scope: ToolSurfaceScope;
16
+ }
17
+ export interface ToolSurfaceHostSnapshot {
18
+ /** At least one capability is eligible, including one still loading. */
19
+ mountable: boolean;
20
+ /** At least one capability successfully mounted an element. */
21
+ occupied: boolean;
22
+ }
23
+ export interface ToolSurfaceHost {
24
+ update(input: ToolSurfaceHostInput): void;
25
+ destroy(): void;
26
+ }
27
+ /** Create one lifecycle owner for one host surface anchor. */
28
+ export declare function createToolSurfaceHost(onSnapshot: (snapshot: ToolSurfaceHostSnapshot) => void): ToolSurfaceHost;