@pie-players/pie-assessment-toolkit 0.3.74 → 1.0.0-beta.0
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 +658 -714
- package/custom-elements.json +1315 -0
- package/dist/attempt/TestSession.d.ts +1 -21
- package/dist/attempt/TestSession.js +16 -102
- package/dist/components/ItemScope.custom-element.d.ts +1 -0
- package/dist/components/ItemScope.custom-element.js +1 -0
- package/dist/components/ItemToolBar.custom-element.js +1 -1
- package/dist/components/PieAssessmentToolkit.custom-element.js +14 -14
- package/dist/components/SectionToolBar.custom-element.js +1 -1
- package/dist/components/chunks/ItemToolBar-3zrc4p3d.js +4 -0
- package/dist/components/chunks/ItemToolBar-66hcwmfw.js +2 -0
- package/dist/components/chunks/ItemToolBar-9gqhfxtn.js +40 -0
- package/dist/components/chunks/ItemToolBar-hzc5wyjp.js +2 -0
- package/dist/components/chunks/{ItemToolBar-gmrryv2v.js → ItemToolBar-kkj69ptr.js} +1 -1
- package/dist/components/chunks/ItemToolBar-vdkyn9f3.js +2 -0
- package/dist/components/chunks/sre-engine-bj997w4b.js +1 -0
- package/dist/components/item-scope-element.d.ts +2 -0
- package/dist/components/item-scope-element.js +2 -0
- package/dist/context/assessment-toolkit-context.d.ts +33 -6
- package/dist/index.d.ts +25 -50
- package/dist/index.js +15 -45
- package/dist/policy/core/PolicySource.d.ts +2 -2
- package/dist/policy/core/ToolPolicyEngine.d.ts +118 -34
- package/dist/policy/core/ToolPolicyEngine.js +203 -56
- package/dist/policy/core/compose-decision.d.ts +28 -7
- package/dist/policy/core/compose-decision.js +95 -74
- package/dist/policy/core/decision-types.d.ts +98 -55
- package/dist/policy/core/feature-decision.d.ts +28 -19
- package/dist/policy/core/feature-decision.js +15 -11
- package/dist/policy/core/pnp-policy-inputs.d.ts +29 -35
- package/dist/policy/core/pnp-policy-inputs.js +40 -88
- package/dist/policy/core/provenance.d.ts +10 -5
- package/dist/policy/core/provenance.js +1 -1
- package/dist/policy/core/tool-parameters.d.ts +11 -0
- package/dist/policy/core/tool-parameters.js +15 -0
- package/dist/policy/engine.d.ts +7 -23
- package/dist/policy/engine.js +5 -20
- package/dist/policy/sources/PnpPolicySource.d.ts +43 -68
- package/dist/policy/sources/PnpPolicySource.js +133 -132
- package/dist/runtime/SectionControllerBinding.d.ts +283 -0
- package/dist/runtime/SectionControllerBinding.js +456 -0
- package/dist/runtime/SectionRuntimeEngine.d.ts +26 -289
- package/dist/runtime/SectionRuntimeEngine.js +30 -372
- package/dist/runtime/adapter/SectionEngineAdapter.d.ts +19 -80
- package/dist/runtime/adapter/SectionEngineAdapter.js +19 -92
- package/dist/runtime/adapter/dom-event-bridge.d.ts +15 -30
- package/dist/runtime/adapter/dom-event-bridge.js +17 -44
- package/dist/runtime/adapter/subscriber-fanout.d.ts +1 -3
- package/dist/runtime/adapter/subscriber-fanout.js +2 -6
- package/dist/runtime/catalog-context.d.ts +19 -0
- package/dist/runtime/catalog-context.js +28 -0
- package/dist/runtime/composition-emit-scheduler.d.ts +12 -18
- package/dist/runtime/composition-emit-scheduler.js +10 -16
- package/dist/runtime/content-language.d.ts +32 -0
- package/dist/runtime/content-language.js +46 -0
- package/dist/runtime/content-region.d.ts +13 -0
- package/dist/runtime/content-region.js +29 -0
- package/dist/runtime/content-registration.d.ts +13 -0
- package/dist/runtime/content-registration.js +25 -0
- package/dist/runtime/core/SectionEngineCore.d.ts +2 -4
- package/dist/runtime/core/SectionEngineCore.js +2 -6
- package/dist/runtime/core/cohort.d.ts +1 -6
- package/dist/runtime/core/cohort.js +1 -10
- package/dist/runtime/core/engine-input.d.ts +18 -30
- package/dist/runtime/core/engine-input.js +11 -12
- package/dist/runtime/core/engine-output.d.ts +17 -40
- package/dist/runtime/core/engine-output.js +9 -21
- package/dist/runtime/core/engine-readiness.d.ts +5 -37
- package/dist/runtime/core/engine-readiness.js +8 -41
- package/dist/runtime/core/engine-resolver.d.ts +46 -74
- package/dist/runtime/core/engine-resolver.js +18 -43
- package/dist/runtime/core/engine-state.d.ts +28 -36
- package/dist/runtime/core/engine-state.js +18 -21
- package/dist/runtime/core/engine-transition.d.ts +14 -19
- package/dist/runtime/core/engine-transition.js +74 -53
- package/dist/runtime/engine.d.ts +16 -19
- package/dist/runtime/engine.js +12 -19
- package/dist/runtime/page-warnings.d.ts +13 -0
- package/dist/runtime/page-warnings.js +22 -0
- package/dist/runtime/policy-input-forwarding.d.ts +25 -0
- package/dist/runtime/policy-input-forwarding.js +25 -0
- package/dist/runtime/registration-events.d.ts +22 -14
- package/dist/runtime/runtime-event-claim.d.ts +8 -0
- package/dist/runtime/runtime-event-claim.js +15 -0
- package/dist/runtime/runtime-id.d.ts +1 -1
- package/dist/runtime/runtime-id.js +1 -1
- package/dist/runtime/shell-event-bridge.d.ts +45 -0
- package/dist/runtime/shell-event-bridge.js +127 -0
- package/dist/runtime/shell-registration.d.ts +73 -0
- package/dist/runtime/shell-registration.js +95 -0
- package/dist/runtime/shell-scope.d.ts +68 -0
- package/dist/runtime/shell-scope.js +194 -0
- package/dist/runtime/tool-host-contract.d.ts +8 -14
- package/dist/runtime/tool-host-contract.js +12 -12
- package/dist/runtime/unclaimed-registration-watch.d.ts +7 -0
- package/dist/runtime/unclaimed-registration-watch.js +23 -0
- package/dist/services/AccessibilityCatalogResolver.d.ts +21 -31
- package/dist/services/AccessibilityCatalogResolver.js +29 -42
- package/dist/services/ElementToolStateStore.d.ts +42 -67
- package/dist/services/ElementToolStateStore.js +65 -71
- package/dist/services/HighlightCoordinator.d.ts +28 -40
- package/dist/services/HighlightCoordinator.js +459 -381
- package/dist/services/RangeSerializer.d.ts +11 -33
- package/dist/services/RangeSerializer.js +88 -59
- package/dist/services/SSMLExtractor.d.ts +8 -31
- package/dist/services/SSMLExtractor.js +18 -40
- package/dist/services/TTSService.d.ts +159 -119
- package/dist/services/TTSService.js +937 -822
- package/dist/services/ToolCoordinator.d.ts +42 -102
- package/dist/services/ToolCoordinator.js +178 -256
- package/dist/services/ToolRegistry.d.ts +152 -133
- package/dist/services/ToolRegistry.js +192 -178
- package/dist/services/ToolkitCoordinator.d.ts +233 -237
- package/dist/services/ToolkitCoordinator.js +615 -557
- package/dist/services/audio-handoff.d.ts +6 -7
- package/dist/services/audio-handoff.js +20 -14
- package/dist/services/catalog-owner.d.ts +0 -1
- package/dist/services/framework-error-bus.d.ts +3 -6
- package/dist/services/framework-error-bus.js +3 -6
- package/dist/services/framework-error.d.ts +51 -13
- package/dist/services/framework-error.js +19 -20
- package/dist/services/interfaces.d.ts +189 -184
- package/dist/services/section-controller-types.d.ts +7 -7
- package/dist/services/section-session-assignment.d.ts +21 -0
- package/dist/services/section-session-assignment.js +80 -0
- package/dist/services/spoken-audio-cards.d.ts +2 -6
- package/dist/services/spoken-audio-cards.js +2 -6
- package/dist/services/tool-config-defaults.d.ts +3 -3
- package/dist/services/tool-config-defaults.js +3 -3
- package/dist/services/tool-config-validation.d.ts +9 -12
- package/dist/services/tool-config-validation.js +47 -87
- package/dist/services/tool-context.d.ts +7 -31
- package/dist/services/tool-context.js +99 -65
- package/dist/services/tool-failure.d.ts +30 -0
- package/dist/services/tool-failure.js +11 -0
- package/dist/services/tool-icons.d.ts +5 -5
- package/dist/services/tool-icons.js +6 -5
- package/dist/services/tool-instance-id.d.ts +8 -7
- package/dist/services/tool-instance-id.js +12 -24
- package/dist/services/tool-providers/TTSToolProvider.d.ts +20 -58
- package/dist/services/tool-providers/TTSToolProvider.js +32 -85
- package/dist/services/tool-providers/ToolProviderApi.d.ts +10 -11
- package/dist/services/tool-providers/ToolProviderRegistry.d.ts +29 -60
- package/dist/services/tool-providers/ToolProviderRegistry.js +128 -144
- package/dist/services/tool-request.d.ts +31 -12
- package/dist/services/tool-request.js +31 -16
- package/dist/services/toolbar-decided-tools.d.ts +16 -0
- package/dist/services/toolbar-decided-tools.js +29 -0
- package/dist/services/toolbar-items.js +2 -5
- package/dist/services/tools-config-normalizer.d.ts +33 -29
- package/dist/services/tools-config-normalizer.js +26 -28
- package/dist/services/tts/browser-provider.d.ts +39 -6
- package/dist/services/tts/browser-provider.js +280 -160
- package/dist/services/tts/catalog-span-alignment.js +14 -7
- package/dist/services/tts/flat-tree.d.ts +64 -0
- package/dist/services/tts/flat-tree.js +269 -0
- package/dist/services/tts/generated-speech/assemble-plan.d.ts +3 -1
- package/dist/services/tts/generated-speech/assemble-plan.js +3 -1
- package/dist/services/tts/generated-speech/dom/build-dom-plan.d.ts +2 -0
- package/dist/services/tts/generated-speech/dom/build-dom-plan.js +1 -1
- package/dist/services/tts/generated-speech/dom/to-chunk-inputs.d.ts +2 -2
- package/dist/services/tts/generated-speech/index.d.ts +1 -1
- package/dist/services/tts/generated-speech/index.js +1 -1
- package/dist/services/tts/generated-speech/math-speech-cache.d.ts +3 -1
- package/dist/services/tts/generated-speech/math-speech-cache.js +5 -1
- package/dist/services/tts/generated-speech/types.d.ts +1 -1
- package/dist/services/tts/generated-speech/types.js +1 -1
- package/dist/services/tts/highlight-pipeline/create-highlight-plan.js +22 -16
- package/dist/services/tts/highlight-pipeline/prose-boundary-resolver.js +6 -4
- package/dist/services/tts/highlight-pipeline/readable-region.js +3 -2
- package/dist/services/tts/highlight-pipeline/types.d.ts +5 -0
- package/dist/services/tts/highlight-pipeline/visible-map-range.d.ts +12 -0
- package/dist/services/tts/highlight-pipeline/visible-map-range.js +73 -7
- package/dist/services/tts/highlight-target-resolver.d.ts +12 -0
- package/dist/services/tts/math-aware-text-processing.d.ts +5 -1
- package/dist/services/tts/math-aware-text-processing.js +42 -47
- package/dist/services/tts/math-control-names.d.ts +21 -0
- package/dist/services/tts/math-control-names.js +142 -0
- package/dist/services/tts/math-speech.d.ts +12 -1
- package/dist/services/tts/math-speech.js +54 -18
- package/dist/services/tts/mathml-sanitization.d.ts +7 -0
- package/dist/services/tts/mathml-sanitization.js +9 -1
- package/dist/services/tts/provider-options.d.ts +52 -0
- package/dist/services/tts/provider-options.js +1 -0
- package/dist/services/tts/ssml/spoken-text.d.ts +2 -26
- package/dist/services/tts/ssml/spoken-text.js +29 -0
- package/dist/services/tts/start-failure.d.ts +4 -0
- package/dist/services/tts/start-failure.js +19 -0
- package/dist/services/tts/text-processing.d.ts +9 -0
- package/dist/services/tts/text-processing.js +46 -33
- package/dist/services/tts/text-segmentation.d.ts +12 -0
- package/dist/services/tts/text-segmentation.js +60 -10
- package/dist/services/tts-runtime-config.d.ts +54 -26
- package/dist/services/tts-runtime-config.js +27 -112
- package/dist/tools/content-capability-resolution.d.ts +9 -11
- package/dist/tools/content-capability-resolution.js +8 -45
- package/dist/tools/registration.d.ts +59 -0
- package/dist/tools/registration.js +55 -0
- package/dist/tools/registrations/toolbar-registration-helpers.d.ts +6 -0
- package/dist/tools/registrations/toolbar-registration-helpers.js +8 -2
- package/dist/tools/tool-surface-host.d.ts +6 -10
- package/dist/tools/tool-surface-host.js +45 -50
- package/dist/tools/tool-tag-map.d.ts +5 -15
- package/dist/tools/tool-tag-map.js +6 -20
- package/dist/utils/structural-equality.d.ts +11 -0
- package/dist/utils/structural-equality.js +47 -0
- package/package.json +15 -29
- package/dist/attempt/adapters/activity-to-test-attempt-session.d.ts +0 -49
- package/dist/attempt/adapters/activity-to-test-attempt-session.js +0 -138
- package/dist/components/chunks/ItemToolBar-b9dz5jvd.js +0 -40
- package/dist/components/chunks/ItemToolBar-h4xap0t0.js +0 -4
- package/dist/components/chunks/ItemToolBar-wr2myaah.js +0 -2
- package/dist/components/chunks/sre-engine-wf9s43gg.js +0 -1
- package/dist/context/runtime-context-consumer.d.ts +0 -13
- package/dist/context/runtime-context-consumer.js +0 -18
- package/dist/item-loader.d.ts +0 -44
- package/dist/item-loader.js +0 -61
- package/dist/policy/core/engine-context.d.ts +0 -29
- package/dist/policy/core/engine-context.js +0 -27
- package/dist/policy/core/policy-source-tag.d.ts +0 -31
- package/dist/policy/core/policy-source-tag.js +0 -28
- package/dist/policy/internal.d.ts +0 -25
- package/dist/policy/internal.js +0 -25
- package/dist/runtime/adapter/coordinator-bridge.d.ts +0 -92
- package/dist/runtime/adapter/coordinator-bridge.js +0 -126
- package/dist/runtime/adapter/framework-error-bridge.d.ts +0 -36
- package/dist/runtime/adapter/framework-error-bridge.js +0 -46
- package/dist/runtime/adapter/instrumentation-bridge.d.ts +0 -31
- package/dist/runtime/adapter/instrumentation-bridge.js +0 -38
- package/dist/runtime/core/engine-stage-derivation.d.ts +0 -18
- package/dist/runtime/core/engine-stage-derivation.js +0 -29
- package/dist/runtime/engine-context.d.ts +0 -39
- package/dist/runtime/engine-context.js +0 -31
- package/dist/runtime/internal.d.ts +0 -43
- package/dist/runtime/internal.js +0 -45
- package/dist/runtime/section-runtime-engine-host-context.d.ts +0 -74
- package/dist/runtime/section-runtime-engine-host-context.js +0 -57
- package/dist/runtime/stage-emit-gate.d.ts +0 -92
- package/dist/runtime/stage-emit-gate.js +0 -82
- package/dist/services/ContextVariableStore.d.ts +0 -113
- package/dist/services/ContextVariableStore.js +0 -206
- package/dist/services/I18nService.d.ts +0 -47
- package/dist/services/I18nService.js +0 -84
- package/dist/services/ThemeProvider.d.ts +0 -95
- package/dist/services/ThemeProvider.js +0 -334
- package/dist/services/defaultPersonalNeedsProfile.d.ts +0 -21
- package/dist/services/defaultPersonalNeedsProfile.js +0 -26
- package/dist/services/pnp-standard-features.d.ts +0 -238
- package/dist/services/pnp-standard-features.js +0 -338
- package/dist/services/tts-control-events.d.ts +0 -13
- package/dist/services/tts-control-events.js +0 -7
- package/dist/tools/client.d.ts +0 -10
- package/dist/tools/client.js +0 -10
- package/dist/tools/internal.d.ts +0 -44
- package/dist/tools/internal.js +0 -39
- package/dist/utils/logger.d.ts +0 -6
- package/dist/utils/logger.js +0 -10
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Section controller binding — the toolkit's side of a section runtime.
|
|
3
|
+
*
|
|
4
|
+
* `PieAssessmentToolkit` holds one per element. It resolves the section's
|
|
5
|
+
* controller from the coordinator (`initialize`), keeps the registered item and
|
|
6
|
+
* passage shells (`RuntimeRegistry`) and which of them have loaded, replays
|
|
7
|
+
* both into each controller it resolves, and forwards shell events, session
|
|
8
|
+
* updates and host commands to that controller.
|
|
9
|
+
*
|
|
10
|
+
* The registry outlives a section switch: the shells of the section being left
|
|
11
|
+
* stay registered until they unmount. One membership rule routes every shell
|
|
12
|
+
* event, in replay or live: an event goes to the controller of the section
|
|
13
|
+
* whose composition renders the shell, which is the current controller or a
|
|
14
|
+
* cached controller of a section this binding bound earlier, and is dropped
|
|
15
|
+
* with a warning when no bound section renders it; see `controllerFor`. A
|
|
16
|
+
* cached controller re-bound on a revisit first forgets the loads of shells
|
|
17
|
+
* that are no longer registered, so its `section-loading-complete` waits for
|
|
18
|
+
* the new shells.
|
|
19
|
+
*
|
|
20
|
+
* The section's stage chain is a separate object: the section player's layout
|
|
21
|
+
* kernel drives a `SectionRuntimeEngine` from the readiness signals it derives.
|
|
22
|
+
* The two share no state.
|
|
23
|
+
*/
|
|
24
|
+
import type { ToolkitCoordinator } from "../services/ToolkitCoordinator.js";
|
|
25
|
+
import type { SectionControllerEvent, SectionControllerHandle, SectionControllerSessionState } from "../services/section-controller-types.js";
|
|
26
|
+
import type { MediaTimeSource } from "@pie-players/pie-players-shared/timed-media";
|
|
27
|
+
import type { RuntimeRegistrationDetail } from "./registration-events.js";
|
|
28
|
+
/**
|
|
29
|
+
* Structural view of the resolved section controller, widened with the
|
|
30
|
+
* extra methods the toolkit's runtime CE calls directly. Optional so
|
|
31
|
+
* stub controllers used in tests do not need every entry point.
|
|
32
|
+
*/
|
|
33
|
+
interface RuntimeController extends SectionControllerHandle {
|
|
34
|
+
getCompositionModel?: () => unknown;
|
|
35
|
+
getCanonicalItemId?: (itemId: string) => string;
|
|
36
|
+
handleContentLoaded?: (args: {
|
|
37
|
+
itemId: string;
|
|
38
|
+
canonicalItemId?: string;
|
|
39
|
+
contentKind?: string;
|
|
40
|
+
detail?: unknown;
|
|
41
|
+
timestamp?: number;
|
|
42
|
+
}) => void;
|
|
43
|
+
handleContentRegistered?: (args: {
|
|
44
|
+
itemId: string;
|
|
45
|
+
canonicalItemId?: string;
|
|
46
|
+
contentKind?: string;
|
|
47
|
+
}) => void;
|
|
48
|
+
handleContentUnregistered?: (args: {
|
|
49
|
+
itemId: string;
|
|
50
|
+
canonicalItemId?: string;
|
|
51
|
+
contentKind?: string;
|
|
52
|
+
}) => void;
|
|
53
|
+
handleItemPlayerError?: (args: {
|
|
54
|
+
itemId: string;
|
|
55
|
+
canonicalItemId?: string;
|
|
56
|
+
contentKind?: string;
|
|
57
|
+
error: unknown;
|
|
58
|
+
timestamp?: number;
|
|
59
|
+
}) => void;
|
|
60
|
+
reportSectionError?: (args: {
|
|
61
|
+
source: "item-player" | "section-runtime" | "toolkit" | "controller";
|
|
62
|
+
error: unknown;
|
|
63
|
+
itemId?: string;
|
|
64
|
+
canonicalItemId?: string;
|
|
65
|
+
contentKind?: string;
|
|
66
|
+
timestamp?: number;
|
|
67
|
+
}) => void;
|
|
68
|
+
updateItemSession?: (itemId: string, sessionDetail: unknown) => {
|
|
69
|
+
eventDetail?: unknown;
|
|
70
|
+
} | null;
|
|
71
|
+
subscribe?: (listener: (event: SectionControllerEvent) => void) => () => void;
|
|
72
|
+
navigateToItem?: (index: number) => unknown;
|
|
73
|
+
attachMediaTimeSource?: (source: MediaTimeSource, options?: {
|
|
74
|
+
origin?: "native-adapter" | "host";
|
|
75
|
+
renderableId?: string;
|
|
76
|
+
}) => void;
|
|
77
|
+
detachMediaTimeSource?: (options?: {
|
|
78
|
+
origin?: "native-adapter" | "host";
|
|
79
|
+
}) => void;
|
|
80
|
+
pauseMediaForCompetingAudio?: () => boolean;
|
|
81
|
+
}
|
|
82
|
+
/** What a media-time-source registration reaching the binding has to say. */
|
|
83
|
+
export interface SectionRuntimeMediaTimeSourceAction {
|
|
84
|
+
renderableId: string;
|
|
85
|
+
action: "attach" | "detach";
|
|
86
|
+
source?: MediaTimeSource;
|
|
87
|
+
origin?: "native-adapter" | "host";
|
|
88
|
+
}
|
|
89
|
+
/** What a formative action reaching the binding has to say. */
|
|
90
|
+
export interface SectionRuntimeFormativeAction {
|
|
91
|
+
itemId: string;
|
|
92
|
+
canonicalItemId?: string;
|
|
93
|
+
action: "check" | "retry";
|
|
94
|
+
outcomes?: unknown[];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Initialize args used by the toolkit CE to resolve the coordinator-backed
|
|
98
|
+
* section controller.
|
|
99
|
+
*/
|
|
100
|
+
export interface SectionControllerBindingInitArgs {
|
|
101
|
+
coordinator: ToolkitCoordinator;
|
|
102
|
+
section: unknown;
|
|
103
|
+
sectionId: string;
|
|
104
|
+
assessmentId: string;
|
|
105
|
+
view: string;
|
|
106
|
+
attemptId?: string;
|
|
107
|
+
/**
|
|
108
|
+
* A host-supplied session for this section, applied by the coordinator in
|
|
109
|
+
* place of `hydrate()` when it creates the controller. Absent, creation
|
|
110
|
+
* hydrates from the persistence strategy as before.
|
|
111
|
+
*/
|
|
112
|
+
initialSession?: SectionControllerSessionState | null;
|
|
113
|
+
createDefaultController: () => Promise<RuntimeController> | RuntimeController;
|
|
114
|
+
onCompositionChanged?: (composition: unknown) => void;
|
|
115
|
+
/**
|
|
116
|
+
* The controller event that caused a republish, for the few events the toolkit
|
|
117
|
+
* has to act on rather than merely propagate — a timed-media policy that cannot
|
|
118
|
+
* be enforced becomes a framework warning, and malformed cue data becomes a
|
|
119
|
+
* framework error. Every other event reaches hosts through the composition
|
|
120
|
+
* republish and the coordinator's own subscriptions.
|
|
121
|
+
*/
|
|
122
|
+
onControllerEvent?: (event: SectionControllerEvent) => void;
|
|
123
|
+
}
|
|
124
|
+
export declare class SectionControllerBinding {
|
|
125
|
+
private readonly registry;
|
|
126
|
+
private controller;
|
|
127
|
+
private coordinator;
|
|
128
|
+
private sectionId;
|
|
129
|
+
private attemptId;
|
|
130
|
+
private unsubscribeController;
|
|
131
|
+
private activeInitToken;
|
|
132
|
+
/**
|
|
133
|
+
* Ids of the renderables in the current controller's composition model, read
|
|
134
|
+
* when `initialize` resolves it. `null` while no controller is resolved, and
|
|
135
|
+
* for a controller that publishes no `renderables`: its section cannot be
|
|
136
|
+
* told apart, so every shell reaches it.
|
|
137
|
+
*/
|
|
138
|
+
private sectionRenderableIds;
|
|
139
|
+
/**
|
|
140
|
+
* The renderable ids of every section this binding has bound, keyed by
|
|
141
|
+
* section and attempt, least recently bound first. `controllerFor` reads it
|
|
142
|
+
* to find the section that owns a shell outside the current one.
|
|
143
|
+
*/
|
|
144
|
+
private readonly boundSections;
|
|
145
|
+
/**
|
|
146
|
+
* Tracks which `(canonicalItemId, contentKind)` pairs have already
|
|
147
|
+
* fired `handleContentLoaded` on this binding, so a section handoff can
|
|
148
|
+
* replay the persistent shells' loaded state into the new controller; see
|
|
149
|
+
* `replayRegisteredShellsIntoController`.
|
|
150
|
+
*
|
|
151
|
+
* Records loads of every registered shell, in or out of the current
|
|
152
|
+
* section, so a shell registered ahead of its section's controller is
|
|
153
|
+
* replayed as loaded. A key is dropped when its last shell unregisters,
|
|
154
|
+
* and on `dispose`.
|
|
155
|
+
*/
|
|
156
|
+
private readonly loadedRenderableKeys;
|
|
157
|
+
initialize(args: SectionControllerBindingInitArgs): Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* Re-feed the binding's `RuntimeRegistry` and loaded-set into the
|
|
160
|
+
* resolved controller, limited to the shells of its section (see
|
|
161
|
+
* `isSectionRenderable`). Runs on every `initialize`.
|
|
162
|
+
*
|
|
163
|
+
* Two-pass order — register every shell in document order, then
|
|
164
|
+
* issue `handleContentLoaded` for each shell whose load already
|
|
165
|
+
* fired on this binding. The two-pass shape prevents
|
|
166
|
+
* `evaluateSectionLoadingState` from flapping
|
|
167
|
+
* `section-loading-complete` `false→true→false→…` while replay is
|
|
168
|
+
* mid-walk: any subscriber wired before the binding's own
|
|
169
|
+
* `controller.subscribe` (no such caller today, but cheap defense
|
|
170
|
+
* for future wiring) sees one clean `false→true` transition.
|
|
171
|
+
*
|
|
172
|
+
* Idempotent on the controller side: `handleContentRegistered` and
|
|
173
|
+
* `handleContentLoaded` return early on duplicates, so re-feeding shells
|
|
174
|
+
* the controller already tracks emits nothing.
|
|
175
|
+
*/
|
|
176
|
+
private replayRegisteredShellsIntoController;
|
|
177
|
+
/**
|
|
178
|
+
* Stable key for the binding's `loadedRenderableKeys` set. Mirrors
|
|
179
|
+
* the `(canonicalItemId, contentKind)` shape `SectionController`
|
|
180
|
+
* uses internally (see `getRenderableKey`); we only need
|
|
181
|
+
* consistent add/check semantics on this side, not byte-identical
|
|
182
|
+
* normalization with the controller.
|
|
183
|
+
*/
|
|
184
|
+
private getLoadedKey;
|
|
185
|
+
/**
|
|
186
|
+
* Whether a shell renders one of the current section's renderables: its
|
|
187
|
+
* runtime or canonical id is among the composition model's renderable ids.
|
|
188
|
+
* An item in two sections belongs to both, so its shell carries over a
|
|
189
|
+
* switch the way a persistent passage shell does.
|
|
190
|
+
*/
|
|
191
|
+
private isSectionRenderable;
|
|
192
|
+
private getSectionKey;
|
|
193
|
+
/**
|
|
194
|
+
* The controller a shell event belongs to: the current controller when the
|
|
195
|
+
* shell renders one of its section's renderables, otherwise the cached
|
|
196
|
+
* controller of the most recently bound section that renders it — the
|
|
197
|
+
* section being left, for an outgoing shell's teardown. `null` when no bound
|
|
198
|
+
* section renders the shell or its controller is gone.
|
|
199
|
+
*/
|
|
200
|
+
private controllerFor;
|
|
201
|
+
/** `controllerFor`, warning when the event has nowhere to go. */
|
|
202
|
+
private requireControllerFor;
|
|
203
|
+
/**
|
|
204
|
+
* Forget, on a cached controller about to be re-bound, every load whose
|
|
205
|
+
* shell is no longer registered. A shell that unmounted while its section
|
|
206
|
+
* was not current told that section's controller through `controllerFor`;
|
|
207
|
+
* this covers one whose unregister never arrived.
|
|
208
|
+
*/
|
|
209
|
+
private forgetUnregisteredLoads;
|
|
210
|
+
register(detail: RuntimeRegistrationDetail): boolean;
|
|
211
|
+
unregister(element: HTMLElement): boolean;
|
|
212
|
+
getCompositionModel(): unknown;
|
|
213
|
+
getCanonicalItemId(itemId: string): string;
|
|
214
|
+
handleContentRegistered(detail: RuntimeRegistrationDetail): void;
|
|
215
|
+
/**
|
|
216
|
+
* Called after `unregister` removed the shell from the registry. While
|
|
217
|
+
* another registered shell renders the same renderable — the next
|
|
218
|
+
* section's shell for an item both sections hold — the renderable stays
|
|
219
|
+
* registered and loaded.
|
|
220
|
+
*/
|
|
221
|
+
handleContentUnregistered(detail: RuntimeRegistrationDetail): void;
|
|
222
|
+
handleContentLoaded(args: {
|
|
223
|
+
itemId: string;
|
|
224
|
+
canonicalItemId?: string;
|
|
225
|
+
contentKind?: string;
|
|
226
|
+
detail?: unknown;
|
|
227
|
+
timestamp?: number;
|
|
228
|
+
}): void;
|
|
229
|
+
handleItemPlayerError(args: {
|
|
230
|
+
itemId: string;
|
|
231
|
+
canonicalItemId?: string;
|
|
232
|
+
contentKind?: string;
|
|
233
|
+
error: unknown;
|
|
234
|
+
timestamp?: number;
|
|
235
|
+
}): void;
|
|
236
|
+
reportSectionError(args: {
|
|
237
|
+
source: "item-player" | "section-runtime" | "toolkit" | "controller";
|
|
238
|
+
error: unknown;
|
|
239
|
+
itemId?: string;
|
|
240
|
+
canonicalItemId?: string;
|
|
241
|
+
contentKind?: string;
|
|
242
|
+
timestamp?: number;
|
|
243
|
+
}): void;
|
|
244
|
+
updateItemSession(itemId: string, session: unknown): unknown;
|
|
245
|
+
navigateToItem(index: number): unknown;
|
|
246
|
+
/**
|
|
247
|
+
* Route a learner's formative action to the controller.
|
|
248
|
+
*
|
|
249
|
+
* Canonicalized here for the same reason `updateItemSession` is: the runtime
|
|
250
|
+
* id a card dispatches with is not necessarily the identifier the controller
|
|
251
|
+
* keys state by. Both ids are kept, since the composition's renderables are
|
|
252
|
+
* keyed by the runtime one.
|
|
253
|
+
*/
|
|
254
|
+
handleFormativeAction(action: SectionRuntimeFormativeAction): void;
|
|
255
|
+
/**
|
|
256
|
+
* Bind or release the section's Media Time Source.
|
|
257
|
+
*
|
|
258
|
+
* A pass-through, like `handleFormativeAction`: the binding routes, the
|
|
259
|
+
* controller decides. `renderableId` travels with the attach because whether the
|
|
260
|
+
* registering renderable is the one `stimulusRef` names is the controller's call
|
|
261
|
+
* — it validated `stimulusRef` in the first place.
|
|
262
|
+
*/
|
|
263
|
+
handleMediaTimeSource(action: SectionRuntimeMediaTimeSourceAction): void;
|
|
264
|
+
/**
|
|
265
|
+
* Silence media audio because something else is about to speak.
|
|
266
|
+
*
|
|
267
|
+
* A pass-through like `handleMediaTimeSource`, and for the same reason: which
|
|
268
|
+
* source is authoritative and whether it reports `canPause` are the controller's
|
|
269
|
+
* to know. Returns whether media audio is now silent, or `true` where there is
|
|
270
|
+
* no timed-media controller to ask — nothing is playing.
|
|
271
|
+
*/
|
|
272
|
+
requestMediaPauseForCompetingAudio(): boolean;
|
|
273
|
+
persist(): Promise<void>;
|
|
274
|
+
hydrate(): Promise<void>;
|
|
275
|
+
/**
|
|
276
|
+
* Releases the binding and disposes the controller of every section it
|
|
277
|
+
* bound, so a coordinator the host passes or an outer toolkit lends keeps
|
|
278
|
+
* none of this toolkit's sections, and a later mount of one restores it from
|
|
279
|
+
* its session. The coordinator itself stays with its owner.
|
|
280
|
+
*/
|
|
281
|
+
dispose(): Promise<void>;
|
|
282
|
+
}
|
|
283
|
+
export {};
|