@pie-players/pie-section-player 0.3.30 → 0.3.32

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 (40) hide show
  1. package/README.md +87 -24
  2. package/dist/chunks/tool-annotation-toolbar-db5bfbec.js +1018 -934
  3. package/dist/components/shared/player-preload.d.ts +88 -71
  4. package/dist/components/shared/player-preload.d.ts.map +1 -1
  5. package/dist/components/shared/section-player-host-runtime.d.ts +72 -0
  6. package/dist/components/shared/section-player-host-runtime.d.ts.map +1 -0
  7. package/dist/components/shared/section-player-runtime-callbacks.d.ts +33 -0
  8. package/dist/components/shared/section-player-runtime-callbacks.d.ts.map +1 -0
  9. package/dist/components/shared/section-player-view-state.d.ts.map +1 -1
  10. package/dist/contracts/host-hooks.d.ts +20 -0
  11. package/dist/contracts/host-hooks.d.ts.map +1 -1
  12. package/dist/contracts/layout-contract.d.ts +2 -2
  13. package/dist/contracts/layout-contract.d.ts.map +1 -1
  14. package/dist/contracts/layout-parity-metadata.d.ts.map +1 -1
  15. package/dist/contracts/public-events.d.ts +86 -10
  16. package/dist/contracts/public-events.d.ts.map +1 -1
  17. package/dist/contracts/stages.d.ts +11 -0
  18. package/dist/contracts/stages.d.ts.map +1 -0
  19. package/dist/controllers/SectionController.d.ts +9 -0
  20. package/dist/controllers/SectionController.d.ts.map +1 -1
  21. package/dist/controllers/toolkit-section-contracts.d.ts +1 -1
  22. package/dist/controllers/toolkit-section-contracts.d.ts.map +1 -1
  23. package/dist/controllers/types.d.ts +6 -0
  24. package/dist/controllers/types.d.ts.map +1 -1
  25. package/dist/pie-section-player.d.ts +2 -2
  26. package/dist/pie-section-player.d.ts.map +1 -1
  27. package/dist/pie-section-player.js +18407 -6465
  28. package/dist/policies/index.d.ts +21 -4
  29. package/dist/policies/index.d.ts.map +1 -1
  30. package/dist/policies/types.d.ts +0 -5
  31. package/dist/policies/types.d.ts.map +1 -1
  32. package/package.json +12 -15
  33. package/dist/chunks/player-preload-79b07366.js +0 -10093
  34. package/dist/components/shared/section-player-readiness.d.ts +0 -14
  35. package/dist/components/shared/section-player-readiness.d.ts.map +0 -1
  36. package/dist/components/shared/section-player-runtime.d.ts +0 -154
  37. package/dist/components/shared/section-player-runtime.d.ts.map +0 -1
  38. package/dist/utils/player-preload.d.ts +0 -2
  39. package/dist/utils/player-preload.d.ts.map +0 -1
  40. package/dist/utils/player-preload.js +0 -8
package/README.md CHANGED
@@ -151,10 +151,10 @@ The intended usage model is:
151
151
  - `assessment-id`, `section`, `section-id`, `attempt-id`, `debug`
152
152
  - `show-toolbar`, `toolbar-position`, `narrow-layout-breakpoint`
153
153
  - `content-max-width-no-passage`, `content-max-width-with-passage`, `split-pane-min-region-width`, `split-pane-collapse-strategy`
154
- - `enabled-tools`, `item-toolbar-tools`, `passage-toolbar-tools`
154
+ - `enabled-tools` (per-region tool placement is configured via `tools.placement.{item,passage}`; the `item-toolbar-tools` / `passage-toolbar-tools` aliases were removed in the broad architecture review compat sweep)
155
155
  - **JS API for advanced customization**:
156
- - Get the controller handle via `getSectionController()` or `waitForSectionController()`
157
- - Listen to `section-controller-ready`
156
+ - Get the controller handle via `getSectionController()` or `waitForSectionController()` (preferred)
157
+ - Listen for `pie-stage-change` and filter on `detail.stage === "engine-ready"` for an event-driven entry point
158
158
  - Apply custom policy/gating in host code (for example, domain-specific `canNext` based on controller events like `section-items-complete-changed`)
159
159
  - Compose forward/backward eligibility in host code using `selectNavigation()` + host state; there is intentionally no separate parallel CE gating API for this
160
160
  - Inject custom toolbar tooling with `toolRegistry` and optional host button arrays (`sectionHostButtons`, `itemHostButtons`, `passageHostButtons`)
@@ -174,7 +174,7 @@ host.hooks = {
174
174
  };
175
175
  ```
176
176
 
177
- Advanced CE props are still supported as escape hatches (`runtime`, `coordinator`, `createSectionController`, etc.), but hosts should prefer JS/controller composition for non-standard behavior.
177
+ Advanced CE props are still supported as escape hatches (`runtime`, `coordinator`, etc.), but hosts should prefer JS/controller composition for non-standard behavior. Note: `createSectionController` is **runtime-only** — set it on `runtime.createSectionController` rather than as a top-level CE prop (the prop alias was removed in the broad architecture review compat sweep).
178
178
 
179
179
  ### Focus management
180
180
 
@@ -222,6 +222,29 @@ host.policies = {
222
222
  };
223
223
  ```
224
224
 
225
+ **Wired policy toggles.** Each `SectionPlayerPolicies` field has a real
226
+ runtime effect; nothing in this surface is decorative.
227
+
228
+ - `readiness.mode` (`"progressive"` | `"strict"`) — drives readiness-event
229
+ emission via `createReadinessDetail` in `SectionPlayerLayoutKernel`.
230
+ - `preload.enabled` — when `false`, `SectionItemsPane` short-circuits the
231
+ section-level element warmup pipeline (`warmupSectionElements`). Items
232
+ still mount and item-players register their own elements on demand. Use
233
+ this to disable section pre-warm when the host already owns element
234
+ registration end-to-end. Default: `true`.
235
+ - `focus.autoFocus` — focus strategy on navigation; see "Focus management"
236
+ above.
237
+ - `telemetry.enabled` — when `false`, the layout custom elements skip
238
+ `attachInstrumentationEventBridge` setup, so no `pie-section-*`
239
+ telemetry events flow through the bridge. Hosts that want a different
240
+ shape of opt-out can still override `runtime.player.loaderConfig.instrumentationProvider`.
241
+ Default: `true`.
242
+
243
+ The exported `isPreloadEnabled(policies)` and `isTelemetryEnabled(policies)`
244
+ helpers read these toggles with the documented default-true semantics, so
245
+ host code that needs to mirror the same gate (e.g. when composing a custom
246
+ layout host) can call them directly.
247
+
225
248
  **Imperative escape hatch (host-owned focus moments).** Every layout
226
249
  element (`pie-section-player-splitpane`, `-vertical`, `-tabbed`,
227
250
  `-kernel-host`, and `-base`) exposes a `focusStart(): boolean` method.
@@ -245,11 +268,6 @@ wherever the host has opted in for navigation focus:
245
268
  For Next / Back / question-number navigation the host does **not** call
246
269
  `focusStart()` — the `autoFocus` policy fires automatically.
247
270
 
248
- **Deprecation.** `SectionPlayerFocusPolicy.autoFocusFirstItem` still
249
- works for one release (mapped onto `autoFocus`: `true` →
250
- `"start-of-content"`, `false` → `"none"`) and emits a one-time console
251
- warning. It will be removed in the next major. Migrate to `autoFocus`.
252
-
253
271
  ### Navigation signals
254
272
 
255
273
  - `item-selected`: item-level navigation change within the current section in the `SectionController` broadcast stream (`itemIndex`, `currentItemId`, `totalItems`).
@@ -257,9 +275,9 @@ warning. It will be removed in the next major. Migrate to `autoFocus`.
257
275
 
258
276
  Runtime precedence is explicit:
259
277
 
260
- - `runtime` values are primary for runtime fields (`assessmentId`, `playerType`, `player`, `lazyInit`, `tools`, `accessibility`, `coordinator`, `createSectionController`, `isolation`, `env`).
278
+ - `runtime` values are primary for runtime fields (`assessmentId`, `playerType`, `player`, `lazyInit`, `tools`, `accessibility`, `coordinator`, `isolation`, `env`). `createSectionController` is exposed only via `runtime.createSectionController`.
261
279
  - Top-level runtime-like props remain compatibility inputs and are merged with `runtime` values. For `player`, top-level values are merged first, then `runtime.player` overrides. Nested `loaderOptions` and `loaderConfig` are also merged with the same precedence.
262
- - Toolbar placement overrides (`enabled-tools`, `item-toolbar-tools`, `passage-toolbar-tools`) are normalized on top of the runtime tools config.
280
+ - The section-level toolbar placement override (`enabled-tools`) is normalized on top of the runtime tools config and merges into `tools.placement.section`. Per-region placement (`tools.placement.item` / `tools.placement.passage`) is configured directly on the canonical `tools` / `runtime.tools` object — the deprecated `item-toolbar-tools` / `passage-toolbar-tools` aliases were removed in the broad architecture review compat sweep.
263
281
  - Tool configuration validation is canonical in toolkit initialization (`pie-assessment-toolkit`), including toolbar overlays. Use `runtime.toolConfigStrictness` (`off` | `warn` | `error`) to control warning-only vs fail-fast behavior.
264
282
  - TTS provider config must use `tools.providers.textToSpeech` (canonical). `tools.providers.tts` is rejected by validation.
265
283
  - Host tool overrides are additive:
@@ -426,20 +444,66 @@ Section-player instrumentation is provider-agnostic and uses the shared
426
444
  - Toolkit telemetry forwarding uses the same provider path, so tool/backend
427
445
  operational events are visible alongside section events when toolkit is mounted.
428
446
 
429
- Section-player owned canonical stream:
430
-
431
- - `pie-section-readiness-change`
432
- - `pie-section-interaction-ready`
433
- - `pie-section-ready`
434
- - `pie-section-controller-ready`
447
+ Canonical lifecycle stream (engine-routed, dispatched on the outer layout CE):
448
+
449
+ - `pie-stage-change` — single typed transition stream covering
450
+ `composed` → `engine-ready` → `interactive` → `disposed`. Payload is a
451
+ `StageChangeDetail`. Replaces the legacy readiness vocabulary.
452
+ - `pie-loading-complete` — fires once per cohort when every item has
453
+ loaded (kernel-routed; gated on `interactive`).
454
+ - `framework-error` — canonical error event for any failure crossing the
455
+ framework boundary. Payload is a `FrameworkErrorModel`. The toolkit's
456
+ package-internal `FrameworkErrorBus` and the `onFrameworkError`
457
+ callback prop deliver each error exactly once regardless of wrapper
458
+ depth. The `framework-error` *DOM event* on the outer layout CE
459
+ also delivers each error exactly once: the kernel listener at
460
+ `<pie-section-player-base>` intercepts the toolkit's bubbled emit
461
+ and calls `event.stopPropagation()`, leaving only the canonical
462
+ engine-bridge emit on the layout host. The single-emit contract is
463
+ pinned by `tests/section-player-framework-error-dual-emit.test.ts`.
464
+ Direct listeners attached to `<pie-assessment-toolkit>` itself
465
+ still see the toolkit's own emit. The previous dual-emit on the
466
+ layout host was removed in the broad architecture review compat
467
+ sweep.
468
+
469
+ Callback-prop mirrors with two-tier precedence (`runtime.<key>` wins over
470
+ the top-level prop):
471
+
472
+ - `onStageChange(detail)` — on every layout CE, `pie-section-player-base`,
473
+ and `pie-assessment-toolkit`.
474
+ - `onLoadingComplete(detail)` — on the kernel-backed layout CEs only
475
+ (split-pane / vertical / tabbed / kernel-host).
476
+ - `onFrameworkError(model)` — on every layout CE and
477
+ `pie-section-player-base`. Fires exactly once per error regardless of
478
+ wrapper depth (delivered through the package-internal
479
+ `FrameworkErrorBus`). The `framework-error` DOM event on the layout
480
+ CE host is also single-fire post-compat-sweep; consume either.
481
+
482
+ Section-player owned instrumentation stream:
483
+
484
+ - `pie-section-stage-change`
485
+ - `pie-section-loading-complete`
435
486
  - `pie-section-session-changed`
436
487
  - `pie-section-composition-changed`
437
- - `pie-section-runtime-error`
438
-
439
- Framework boundary stream (from toolkit, re-emitted through section-player wrappers):
440
-
441
- - `framework-error` (canonical)
442
- - `runtime-error` (compatibility signal)
488
+ - `pie-section-framework-error`
489
+
490
+ The deprecated readiness aliases (`readiness-change`,
491
+ `interaction-ready`, `ready`) and their `legacy-event-bridge`, along
492
+ with the deprecated `section-controller-ready` Svelte/DOM event and
493
+ its `pie-section-controller-ready` instrumentation mapping, were
494
+ removed in the broad architecture review compat sweep. Migrate
495
+ consumers as follows:
496
+
497
+ - `readiness-change` → listen for `pie-stage-change`. The readiness
498
+ payload is also available via `selectReadiness()` /
499
+ `getSnapshot().readiness` on the layout CE.
500
+ - `interaction-ready` → `pie-stage-change` filtered on
501
+ `detail.stage === "interactive"`.
502
+ - `ready` → `pie-loading-complete`.
503
+ - `section-controller-ready` → call
504
+ `waitForSectionController(timeoutMs)` or `getSectionController()`
505
+ on the layout CE, or filter `pie-stage-change` for
506
+ `detail.stage === "engine-ready"`.
443
507
 
444
508
  If toolkit is mounted, toolkit lifecycle events are emitted on a separate
445
509
  `pie-toolkit-*` stream. This separation avoids semantic overlap; bridge dedupe
@@ -528,7 +592,6 @@ Published exports are intentionally minimal:
528
592
  - `@pie-players/pie-section-player/contracts/layout-parity-metadata`
529
593
  - `@pie-players/pie-section-player/contracts/host-hooks`
530
594
  - `@pie-players/pie-section-player/policies`
531
- - `@pie-players/pie-section-player/utils/player-preload`
532
595
 
533
596
  ## Development
534
597