@pie-players/pie-section-player 0.3.25 → 0.3.27
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 +51 -0
- package/dist/chunks/tool-annotation-toolbar-db5bfbec.js +1129 -1066
- package/dist/components/shared/composition.d.ts +1 -1
- package/dist/components/shared/section-player-card-context.d.ts +2 -0
- package/dist/components/shared/section-player-card-context.d.ts.map +1 -1
- package/dist/components/shared/section-player-runtime.d.ts +21 -2
- package/dist/components/shared/section-player-runtime.d.ts.map +1 -1
- package/dist/components/shared/section-player-view-state.d.ts +1 -1
- package/dist/contracts/card-title-formatters.d.ts +17 -0
- package/dist/contracts/card-title-formatters.d.ts.map +1 -0
- package/dist/contracts/layout-contract.d.ts +1 -1
- package/dist/contracts/layout-contract.d.ts.map +1 -1
- package/dist/contracts/layout-parity-metadata.d.ts.map +1 -1
- package/dist/controllers/types.d.ts +1 -1
- package/dist/pie-section-player.d.ts +1 -0
- package/dist/pie-section-player.d.ts.map +1 -1
- package/dist/pie-section-player.js +5794 -4824
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -13,6 +13,24 @@ The package no longer exposes the legacy `pie-section-player` layout orchestrati
|
|
|
13
13
|
npm install @pie-players/pie-section-player
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
## Runtime boundary and migration
|
|
17
|
+
|
|
18
|
+
- Browser-only package: `@pie-players/pie-section-player` registers custom elements and
|
|
19
|
+
is intended for browser/DOM hosts, not plain Node runtime imports.
|
|
20
|
+
- Node-import-safe packages (for server/runtime utilities) are documented in
|
|
21
|
+
`docs/setup/library-packaging-strategy.md`.
|
|
22
|
+
- Migration direction: prefer the stable default entry for side-effect registration:
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import "@pie-players/pie-section-player";
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
If hosts need explicit registration control, keep using documented component
|
|
29
|
+
entrypoints under `@pie-players/pie-section-player/components/*`.
|
|
30
|
+
|
|
31
|
+
Standalone browser variants for this package are intentionally deferred; the
|
|
32
|
+
current supported contract is the default bundler entrypoints under `dist`.
|
|
33
|
+
|
|
16
34
|
## Usage
|
|
17
35
|
|
|
18
36
|
Import the custom-element registration entrypoint in consumers:
|
|
@@ -43,11 +61,14 @@ Both layout elements support:
|
|
|
43
61
|
- `toolbar-position` (string): `top|right|bottom|left|none`
|
|
44
62
|
- `narrow-layout-breakpoint` (number, optional): viewport width in px below which the layout collapses (split pane: single column; vertical: toolbar moves to top). Clamped to 400–2000; default 1100.
|
|
45
63
|
- `show-toolbar` (boolean-like): accepts `true/false` and common string forms (`"true"`, `"false"`, `"1"`, `"0"`, `"yes"`, `"no"`)
|
|
64
|
+
- Host extension props (JS properties only): `toolRegistry`, `sectionHostButtons`, `itemHostButtons`, `passageHostButtons`, `cardTitleFormatter`
|
|
46
65
|
|
|
47
66
|
When viewport width is within the collapsed range (~1100px and below), inline section
|
|
48
67
|
toolbar positions (`left`/`right`) normalize to `top` so controls remain horizontally
|
|
49
68
|
laid out and easier to access.
|
|
50
69
|
|
|
70
|
+
`cardTitleFormatter` remains active across responsive splitpane transitions (split -> stacked and stacked -> split), because title rendering is provided through shared card context rather than layout-specific state.
|
|
71
|
+
|
|
51
72
|
### API direction: CE defaults first, JS customization for advanced cases
|
|
52
73
|
|
|
53
74
|
The intended usage model is:
|
|
@@ -60,6 +81,20 @@ The intended usage model is:
|
|
|
60
81
|
- Listen to `section-controller-ready`
|
|
61
82
|
- Apply custom policy/gating in host code (for example, domain-specific `canNext` based on controller events like `section-items-complete-changed`)
|
|
62
83
|
- Compose forward/backward eligibility in host code using `selectNavigation()` + host state; there is intentionally no separate parallel CE gating API for this
|
|
84
|
+
- Inject custom toolbar tooling with `toolRegistry` and optional host button arrays (`sectionHostButtons`, `itemHostButtons`, `passageHostButtons`)
|
|
85
|
+
- Customize item/passage card headings via `cardTitleFormatter`
|
|
86
|
+
|
|
87
|
+
Example:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
const host = document.querySelector("pie-section-player-splitpane") as any;
|
|
91
|
+
host.cardTitleFormatter = (context: any) => {
|
|
92
|
+
if (context.kind === "item") {
|
|
93
|
+
return `Question ${context.itemIndex + 1}: ${context.item?.name || context.defaultTitle}`;
|
|
94
|
+
}
|
|
95
|
+
return context.passage?.name || context.defaultTitle;
|
|
96
|
+
};
|
|
97
|
+
```
|
|
63
98
|
|
|
64
99
|
Advanced CE props are still supported as escape hatches (`runtime`, `coordinator`, `createSectionController`, etc.), but hosts should prefer JS/controller composition for non-standard behavior.
|
|
65
100
|
|
|
@@ -73,6 +108,11 @@ Runtime precedence is explicit:
|
|
|
73
108
|
- `runtime` values are primary for runtime fields (`assessmentId`, `playerType`, `player`, `lazyInit`, `tools`, `accessibility`, `coordinator`, `createSectionController`, `isolation`, `env`).
|
|
74
109
|
- 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.
|
|
75
110
|
- Toolbar placement overrides (`enabled-tools`, `item-toolbar-tools`, `passage-toolbar-tools`) are normalized on top of the runtime tools config.
|
|
111
|
+
- 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.
|
|
112
|
+
- TTS provider config must use `tools.providers.textToSpeech` (canonical). `tools.providers.tts` is rejected by validation.
|
|
113
|
+
- Host tool overrides are additive:
|
|
114
|
+
- `toolRegistry` overrides the default toolbar registry when provided
|
|
115
|
+
- host buttons are appended per toolbar scope via `sectionHostButtons`, `itemHostButtons`, `passageHostButtons`
|
|
76
116
|
|
|
77
117
|
Debug logging can be controlled per section-player host:
|
|
78
118
|
|
|
@@ -124,18 +164,24 @@ Minimal pattern for package layout components:
|
|
|
124
164
|
show-toolbar={showToolbar}
|
|
125
165
|
toolbar-position={toolbarPosition}
|
|
126
166
|
enabled-tools={enabledTools}
|
|
167
|
+
toolRegistry={toolRegistry}
|
|
168
|
+
sectionHostButtons={sectionHostButtons}
|
|
127
169
|
>
|
|
128
170
|
<!-- layout-specific body -->
|
|
129
171
|
<pie-section-player-passage-card
|
|
130
172
|
passage={passage}
|
|
131
173
|
playerParams={passagePlayerParams}
|
|
132
174
|
passageToolbarTools={passageToolbarTools}
|
|
175
|
+
toolRegistry={toolRegistry}
|
|
176
|
+
hostButtons={passageHostButtons}
|
|
133
177
|
></pie-section-player-passage-card>
|
|
134
178
|
<pie-section-player-item-card
|
|
135
179
|
item={item}
|
|
136
180
|
canonicalItemId={canonicalItemId}
|
|
137
181
|
playerParams={itemPlayerParams}
|
|
138
182
|
itemToolbarTools={itemToolbarTools}
|
|
183
|
+
toolRegistry={toolRegistry}
|
|
184
|
+
hostButtons={itemHostButtons}
|
|
139
185
|
></pie-section-player-item-card>
|
|
140
186
|
</pie-section-player-shell>
|
|
141
187
|
</pie-section-player-base>
|
|
@@ -238,6 +284,11 @@ Section-player owned canonical stream:
|
|
|
238
284
|
- `pie-section-composition-changed`
|
|
239
285
|
- `pie-section-runtime-error`
|
|
240
286
|
|
|
287
|
+
Framework boundary stream (from toolkit, re-emitted through section-player wrappers):
|
|
288
|
+
|
|
289
|
+
- `framework-error` (canonical)
|
|
290
|
+
- `runtime-error` (compatibility signal)
|
|
291
|
+
|
|
241
292
|
If toolkit is mounted, toolkit lifecycle events are emitted on a separate
|
|
242
293
|
`pie-toolkit-*` stream. This separation avoids semantic overlap; bridge dedupe
|
|
243
294
|
is a defensive safety net only.
|