@pie-players/pie-section-player 0.3.73 → 0.3.75

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 (145) hide show
  1. package/README.md +395 -149
  2. package/dist/browser/assets/evaluation-worker-CORp9m0K.js +156459 -0
  3. package/dist/browser/chunks/ItemToolBar-jx38w99s-58defccc.js +1 -0
  4. package/dist/browser/chunks/PUA-tLuTiQ7--f2b27953.js +1 -0
  5. package/dist/browser/chunks/ToolCoordinator-cc2dc319.js +1 -0
  6. package/dist/browser/chunks/accents-BTUYmhn9-cafeb96e.js +1 -0
  7. package/dist/browser/chunks/accents-b-i-CngHZsLL-e0eb98fd.js +1 -0
  8. package/dist/browser/chunks/arabic-BzEHMVZD-30ac1ade.js +1 -0
  9. package/dist/browser/chunks/arrows-VjxlU-jv-2e17c192.js +1 -0
  10. package/dist/browser/chunks/base-dfd67c41.js +1 -0
  11. package/dist/browser/chunks/braille-BeWC_Ruq-a3bb8ef9.js +1 -0
  12. package/dist/browser/chunks/braille-d-Dk6J96GO-d832bfbf.js +1 -0
  13. package/dist/browser/chunks/browser-a3c32178.js +37 -0
  14. package/dist/browser/chunks/calculator-element-271c142f.js +13 -0
  15. package/dist/browser/chunks/calligraphic-Cew9cU3x-04cf0735.js +1 -0
  16. package/dist/browser/chunks/catalog-context-46d3e50e.js +1 -0
  17. package/dist/browser/chunks/catalog-owner-d602f784.js +1 -0
  18. package/dist/browser/chunks/cherokee-Cny3FYho-4da7d2f3.js +1 -0
  19. package/dist/browser/chunks/classPrivateFieldGet2-338e0179.js +1 -0
  20. package/dist/browser/chunks/cyrillic-CfCDulXU-5550df0b.js +1 -0
  21. package/dist/browser/chunks/cyrillic-ss-lU7bNGG9-12eb0188.js +1 -0
  22. package/dist/browser/chunks/defineProperty-a20a667d.js +1 -0
  23. package/dist/browser/chunks/devanagari-CDIz2h-r-18c38725.js +1 -0
  24. package/dist/browser/chunks/dist-41b39e7f.js +1 -0
  25. package/dist/browser/chunks/dist-59132a53.js +1 -0
  26. package/dist/browser/chunks/dist-60d7afef.js +1 -0
  27. package/dist/browser/chunks/dist-ca9b9622.js +1 -0
  28. package/dist/browser/chunks/double-struck-BpJEQk8y-500ce8dd.js +1 -0
  29. package/dist/browser/chunks/en-5ff22e17.js +1 -0
  30. package/dist/browser/chunks/es-a0ba6cb6.js +1 -0
  31. package/dist/browser/chunks/focus-trap-44913bf3.js +1 -0
  32. package/dist/browser/chunks/fraktur-rLEq9DEH-44cc14d8.js +1 -0
  33. package/dist/browser/chunks/greek-BlraJTyL-90ce8924.js +1 -0
  34. package/dist/browser/chunks/greek-ss-D-EN2PK0-91610739.js +1 -0
  35. package/dist/browser/chunks/hebrew-GiQZeybp-b583f555.js +1 -0
  36. package/dist/browser/chunks/latin-b-BhEnC7R2-d13e06ff.js +1 -0
  37. package/dist/browser/chunks/latin-bi-DqiIKv3U-1dec8705.js +1 -0
  38. package/dist/browser/chunks/latin-i-B1xtwaE1-21637466.js +1 -0
  39. package/dist/browser/chunks/latin-xfWFlLkD-5bcea5cf.js +1 -0
  40. package/dist/browser/chunks/logger-8b07fb72.js +1 -0
  41. package/dist/browser/chunks/marrows-DD1NgMQi-15b63755.js +1 -0
  42. package/dist/browser/chunks/math-DpWn1mbG-38eeb914.js +1 -0
  43. package/dist/browser/chunks/math-rendering-ready-9a0fd90a.js +1 -0
  44. package/dist/browser/chunks/mathjax-BKrHE4xs-3ca05bf6.js +232 -0
  45. package/dist/browser/chunks/module-0191e321.js +74 -0
  46. package/dist/browser/chunks/module-shim-58659a86.js +0 -0
  47. package/dist/browser/chunks/module-shim-b4470740.js +12 -0
  48. package/dist/browser/chunks/monospace-D116QD2a-98d484fd.js +1 -0
  49. package/dist/browser/chunks/monospace-ex-DcXpouKS-456b403c.js +1 -0
  50. package/dist/browser/chunks/monospace-l-Ct5wkMDs-f34a4a9e.js +1 -0
  51. package/dist/browser/chunks/mshapes-DCp86WSX-c0055952.js +1 -0
  52. package/dist/browser/chunks/nl-NL-364d61b9.js +1 -0
  53. package/dist/browser/chunks/nl-NL-8b7e6d4b.js +1 -0
  54. package/dist/browser/chunks/overlay-containment-edaaff13.js +1 -0
  55. package/dist/browser/chunks/overlay-placement-e8058232.js +1 -0
  56. package/dist/browser/chunks/phonetics-BwOCw2Y9-d2e3af59.js +1 -0
  57. package/dist/browser/chunks/phonetics-ss-CRtMn02f-579b6135.js +1 -0
  58. package/dist/browser/chunks/pie-api-client-687c319a.js +1 -0
  59. package/dist/browser/chunks/pointer-gesture-ce75f0a7.js +1 -0
  60. package/dist/browser/chunks/preload-helper-6ad28da3.js +1 -0
  61. package/dist/browser/chunks/provider-4c704118.js +1 -0
  62. package/dist/browser/chunks/rolldown-runtime-1287ba31.js +1 -0
  63. package/dist/browser/chunks/runtime-wcU7KOFU-ac86d7b8.js +8536 -0
  64. package/dist/browser/chunks/sanitize-svg-icon-b9082bba.js +3 -0
  65. package/dist/browser/chunks/sans-serif-BYPZKlE9-2efdbcd9.js +1 -0
  66. package/dist/browser/chunks/sans-serif-b-B0kRKiC--b5530dce.js +1 -0
  67. package/dist/browser/chunks/sans-serif-bi-DXWul6mu-5370dba4.js +1 -0
  68. package/dist/browser/chunks/sans-serif-ex-Boux1kMP-aa178f31.js +1 -0
  69. package/dist/browser/chunks/sans-serif-i-676RFaSO-2db54474.js +1 -0
  70. package/dist/browser/chunks/sans-serif-r-DrN9xdZt-0fc72eea.js +1 -0
  71. package/dist/browser/chunks/script-0ohehnXc-526904f4.js +1 -0
  72. package/dist/browser/chunks/shapes-BG47NodJ-d59b0eca.js +1 -0
  73. package/dist/browser/chunks/src-BcptuNS5-ed25d7fd.js +191 -0
  74. package/dist/browser/chunks/sre-0162a7a9.js +53 -0
  75. package/dist/browser/chunks/sre-engine-ace23548.js +1 -0
  76. package/dist/browser/chunks/sre-engine-jd8cc08x-42d270e5.js +1 -0
  77. package/dist/browser/chunks/sre-locales-112320af.js +1 -0
  78. package/dist/browser/chunks/symbols-BqnUxf_t-83087e87.js +1 -0
  79. package/dist/browser/chunks/symbols-b-i-eg9k5hmF-9c461ac2.js +1 -0
  80. package/dist/browser/chunks/tool-annotation-toolbar-997438b4.js +249 -0
  81. package/dist/browser/chunks/tool-answer-eliminator-35483abd.js +13 -0
  82. package/dist/browser/chunks/tool-color-scheme-b7de5cdf.js +26 -0
  83. package/dist/browser/chunks/tool-dictionary-cecff3b4.js +7 -0
  84. package/dist/browser/chunks/tool-graph-cb0338e8.js +11 -0
  85. package/dist/browser/chunks/tool-host-contract-b93b482c.js +1 -0
  86. package/dist/browser/chunks/tool-instance-id-2a92deb0.js +1 -0
  87. package/dist/browser/chunks/tool-line-reader-f8ef3c6a.js +62 -0
  88. package/dist/browser/chunks/tool-periodic-table-43b133b8.js +153 -0
  89. package/dist/browser/chunks/tool-picture-dictionary-33721e91.js +4 -0
  90. package/dist/browser/chunks/tool-protractor-23f77028.js +17 -0
  91. package/dist/browser/chunks/tool-ruler-1d9a03a6.js +15 -0
  92. package/dist/browser/chunks/tool-tts-inline-98c2ce7a.js +179 -0
  93. package/dist/browser/chunks/tts-runtime-config-a7ab1ad4.js +194 -0
  94. package/dist/browser/chunks/variants-2LRNhOUP-966fc49d.js +1 -0
  95. package/dist/browser/chunks/versioned-tag-54a76be9.js +1 -0
  96. package/dist/browser/pie-section-player.js +1727 -0
  97. package/dist/browser.d.ts +10 -0
  98. package/dist/chunks/ItemToolBar-jx38w99s-1287ba31.js +28 -0
  99. package/dist/chunks/module-shim-58659a86.js +2129 -0
  100. package/dist/chunks/{nl-NL-9312c316.js → nl-NL-364d61b9.js} +9 -26
  101. package/dist/chunks/sre-engine-jd8cc08x-42d270e5.js +8 -0
  102. package/dist/components/shared/composition.d.ts +3 -2
  103. package/dist/components/shared/framework-error-latch.d.ts +32 -0
  104. package/dist/components/shared/host-element.d.ts +10 -0
  105. package/dist/components/shared/kernel-host-default-body.d.ts +14 -0
  106. package/dist/components/shared/layout-host-methods.d.ts +385 -0
  107. package/dist/components/shared/missing-tool-providers.d.ts +16 -0
  108. package/dist/components/shared/player-preload.d.ts +14 -10
  109. package/dist/components/shared/section-player-backend-delivery.d.ts +1 -1
  110. package/dist/components/shared/section-player-card-context.d.ts +5 -1
  111. package/dist/components/shared/section-player-host-runtime.d.ts +32 -19
  112. package/dist/components/shared/section-player-layout-context.d.ts +77 -0
  113. package/dist/components/shared/section-player-own-event.d.ts +10 -0
  114. package/dist/components/shared/section-player-runtime-callbacks.d.ts +1 -1
  115. package/dist/components/shared/section-player-shell-layout.svelte.d.ts +3 -11
  116. package/dist/components/shared/section-player-view-state.d.ts +6 -1
  117. package/dist/components/shared/toolkit-ready-wait.d.ts +16 -0
  118. package/dist/contracts/host-hooks.d.ts +4 -12
  119. package/dist/contracts/host-hooks.js +0 -0
  120. package/dist/contracts/runtime-host-contract.d.ts +0 -5
  121. package/dist/contracts/runtime-host-contract.js +0 -0
  122. package/dist/controllers/SectionController.d.ts +14 -0
  123. package/dist/controllers/toolkit-section-contracts.d.ts +1 -17
  124. package/dist/controllers/types.d.ts +25 -11
  125. package/dist/item-section/index.d.ts +22 -0
  126. package/dist/item-section/index.js +37 -0
  127. package/dist/pie-section-player.d.ts +4 -6
  128. package/dist/pie-section-player.js +22006 -41076
  129. package/dist/policies/index.d.ts +5 -16
  130. package/dist/policies/index.js +17 -0
  131. package/dist/policies/types.d.ts +0 -4
  132. package/package.json +33 -68
  133. package/dist/chunks/module-a516757f.js +0 -73997
  134. package/dist/chunks/nl-NL-ef6dd604.js +0 -505
  135. package/dist/chunks/pie-api-client-22de9d9c.js +0 -168
  136. package/dist/chunks/rolldown-runtime-1287ba31.js +0 -20
  137. package/dist/chunks/sre-0162a7a9.js +0 -17637
  138. package/dist/components/item-shell-element.d.ts +0 -1
  139. package/dist/components/shared/shell-registration.d.ts +0 -55
  140. package/dist/contracts/layout-contract.d.ts +0 -17
  141. package/dist/contracts/layout-parity-metadata.d.ts +0 -4
  142. package/dist/contracts/public-events.d.ts +0 -93
  143. package/dist/contracts/stages.d.ts +0 -10
  144. package/dist/policies/guards.d.ts +0 -2
  145. package/dist/utils/z-index.d.ts +0 -5
@@ -1,4 +1,4 @@
1
- import { RuntimeConfig, RuntimeInputs } from '@pie-players/pie-assessment-toolkit/runtime/internal';
1
+ import { RuntimeInputs } from '@pie-players/pie-assessment-toolkit/runtime/engine';
2
2
  import { ItemEntity } from '@pie-players/pie-players-shared';
3
3
  /**
4
4
  * Resolve the player-runtime view (player tag, attributes, props,
@@ -21,14 +21,16 @@ export declare function resolvePlayerRuntime(args: {
21
21
  loaderOptions: {
22
22
  [x: string]: unknown;
23
23
  };
24
- loaderConfig?: import('@pie-players/pie-players-shared').LoaderConfig;
25
24
  hosted: boolean;
25
+ loaderConfig?: import('@pie-players/pie-players-shared').LoaderConfig;
26
+ backend?: Record<string, unknown> | null;
26
27
  } | {
27
28
  loaderOptions: {
28
29
  [x: string]: unknown;
29
30
  };
31
+ hosted?: boolean;
30
32
  loaderConfig?: import('@pie-players/pie-players-shared').LoaderConfig;
31
- hosted?: undefined;
33
+ backend?: Record<string, unknown> | null;
32
34
  };
33
35
  resolvedPlayerEnv: Record<string, unknown>;
34
36
  strategy: import('@pie-players/pie-players-shared').ItemPlayerStrategy;
@@ -51,7 +53,29 @@ export declare function mapRenderablesToItems(renderables: unknown[]): ItemEntit
51
53
  */
52
54
  export declare function resolveSectionPlayerRuntimeState(args: RuntimeInputs): {
53
55
  effectiveToolsConfig: unknown;
54
- effectiveRuntime: import('@pie-players/pie-assessment-toolkit/runtime/internal').EffectiveRuntime;
56
+ effectiveRuntime: {
57
+ playerType: string;
58
+ player: {
59
+ hosted?: boolean;
60
+ loaderConfig?: import('@pie-players/pie-players-shared').LoaderConfig;
61
+ loaderOptions?: Record<string, unknown>;
62
+ backend?: Record<string, unknown> | null;
63
+ } | null;
64
+ lazyInit: boolean;
65
+ accessibility: Record<string, unknown> | null;
66
+ coordinator: {} | null;
67
+ createSectionController: unknown;
68
+ isolation: string;
69
+ env: Record<string, unknown>;
70
+ toolConfigStrictness: import('@pie-players/pie-assessment-toolkit').ToolConfigStrictness;
71
+ tools: unknown;
72
+ assessmentId?: string;
73
+ toolContextResolvers?: Record<string, unknown> | null;
74
+ contentLanguage?: string;
75
+ onFrameworkError?: import('@pie-players/pie-assessment-toolkit/runtime/engine').FrameworkErrorHandler;
76
+ onStageChange?: import('@pie-players/pie-assessment-toolkit/runtime/engine').StageChangeHandler;
77
+ onLoadingComplete?: import('@pie-players/pie-assessment-toolkit/runtime/engine').LoadingCompleteHandler;
78
+ };
55
79
  playerRuntime: {
56
80
  effectivePlayerType: string;
57
81
  resolvedPlayerDefinition: import('../../component-definitions.js').ComponentDefinition;
@@ -61,29 +85,18 @@ export declare function resolveSectionPlayerRuntimeState(args: RuntimeInputs): {
61
85
  loaderOptions: {
62
86
  [x: string]: unknown;
63
87
  };
64
- loaderConfig?: import('@pie-players/pie-players-shared').LoaderConfig;
65
88
  hosted: boolean;
89
+ loaderConfig?: import('@pie-players/pie-players-shared').LoaderConfig;
90
+ backend?: Record<string, unknown> | null;
66
91
  } | {
67
92
  loaderOptions: {
68
93
  [x: string]: unknown;
69
94
  };
95
+ hosted?: boolean;
70
96
  loaderConfig?: import('@pie-players/pie-players-shared').LoaderConfig;
71
- hosted?: undefined;
97
+ backend?: Record<string, unknown> | null;
72
98
  };
73
99
  resolvedPlayerEnv: Record<string, unknown>;
74
100
  strategy: import('@pie-players/pie-players-shared').ItemPlayerStrategy;
75
101
  };
76
102
  };
77
- /**
78
- * Fold a layout element's presentation convenience attributes — `nds-icons` and
79
- * `locale` — into the `runtime` config handed to the kernel.
80
- *
81
- * Only injects an attribute that is explicitly set, so an unset one never
82
- * clobbers a value the host put on `runtime`; when both are present, `runtime`
83
- * wins (spread last). Returns the input unchanged when neither is set, which
84
- * keeps `kernelRuntime` referentially stable for a host that supplies neither.
85
- */
86
- export declare function mergeLayoutAttrsIntoRuntime(runtime: RuntimeConfig | null, attrs: {
87
- ndsIcons?: boolean;
88
- locale?: string;
89
- }): RuntimeConfig | null;
@@ -0,0 +1,77 @@
1
+ import { ToolRegistry, ToolbarItem } from '@pie-players/pie-assessment-toolkit';
2
+ import { ItemEntity } from '@pie-players/pie-players-shared/types';
3
+ import { SectionCompositionModel } from '../../controllers/types.js';
4
+ import { ElementPreloadErrorDetail, ElementPreloadRetryDetail } from './player-preload.js';
5
+ import { HeadingLevel } from './section-player-view-state.js';
6
+ export type SectionPlayerPaneKind = "items" | "passages";
7
+ /** Where the items pane's element pre-warm stands. */
8
+ export type SectionPlayerPaneWarmup = "pending" | "loaded" | "failed";
9
+ export type SectionPlayerPaneReport = {
10
+ warmup: SectionPlayerPaneWarmup;
11
+ /** The renderables signature the report was made for. */
12
+ renderablesSignature: string;
13
+ };
14
+ export type SectionPlayerLayoutContext = {
15
+ /** The layout element's tag, which labels the items pane's preload reports. */
16
+ componentTag: string;
17
+ items: SectionCompositionModel["items"];
18
+ passages: SectionCompositionModel["passages"];
19
+ compositionModel: SectionCompositionModel;
20
+ preloadedRenderables: ItemEntity[];
21
+ preloadedRenderablesSignature: string;
22
+ preloadEnabled: boolean;
23
+ resolvedPlayerEnv: Record<string, unknown>;
24
+ resolvedPlayerAttributes: Record<string, string>;
25
+ resolvedPlayerProps: Record<string, unknown>;
26
+ playerStrategy: string;
27
+ baseHeadingLevel: HeadingLevel;
28
+ iifeBundleHost: string | null;
29
+ toolRegistry: ToolRegistry;
30
+ itemToolbarTools: string;
31
+ passageToolbarTools: string;
32
+ itemHostButtons: ToolbarItem[];
33
+ passageHostButtons: ToolbarItem[];
34
+ /**
35
+ * Whether the items pane's element pre-warm has resolved for the current
36
+ * composition; the passages pane shows its loading card until it has.
37
+ */
38
+ elementsLoaded: boolean;
39
+ /** The pane of each kind that renders. */
40
+ activePanes: Readonly<Record<SectionPlayerPaneKind, Element | null>>;
41
+ /** Returns the unregister. */
42
+ registerPane: (kind: SectionPlayerPaneKind, pane: Element) => () => void;
43
+ /** Reports from any pane but the active items pane are ignored. */
44
+ reportWarmup: (pane: Element, report: SectionPlayerPaneReport) => void;
45
+ reportPreloadRetry: (pane: Element, detail: ElementPreloadRetryDetail) => void;
46
+ reportPreloadError: (pane: Element, detail: ElementPreloadErrorDetail) => void;
47
+ };
48
+ export declare const sectionPlayerLayoutContext: {
49
+ __context__: SectionPlayerLayoutContext;
50
+ };
51
+ export declare function connectSectionPlayerLayoutContext(host: HTMLElement, onValue: (value: SectionPlayerLayoutContext) => void): () => void;
52
+ /**
53
+ * A pane that subscribes before this provider connects is answered through the
54
+ * document's context root, which replays its request when the provider
55
+ * announces itself.
56
+ */
57
+ export declare function createSectionPlayerLayoutContextProvider(host: HTMLElement, initialValue: SectionPlayerLayoutContext): {
58
+ setValue: (value: SectionPlayerLayoutContext) => void;
59
+ disconnect: () => void;
60
+ };
61
+ export type SectionPlayerPaneRegistry = {
62
+ register: (kind: SectionPlayerPaneKind, pane: Element) => () => void;
63
+ active: () => Record<SectionPlayerPaneKind, Element | null>;
64
+ dispose: () => void;
65
+ };
66
+ /**
67
+ * The panes registered with one section player, in registration order.
68
+ *
69
+ * `onChange` receives the active pane of each kind after every change. A second
70
+ * pane of a kind still registered a task later is a layout that renders the
71
+ * kind twice, reported once per registry through `warn`; the deferral lets a
72
+ * layout replace a pane without being reported.
73
+ */
74
+ export declare function createSectionPlayerPaneRegistry(options: {
75
+ onChange: (active: Record<SectionPlayerPaneKind, Element | null>) => void;
76
+ warn?: (message: string) => void;
77
+ }): SectionPlayerPaneRegistry;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Whether an event that reached a layout host belongs to that section player.
3
+ *
4
+ * The runtime engine dispatches its events on the host. The toolkit's
5
+ * `framework-error` bubbles out of the player's own `<pie-section-player-base>`,
6
+ * the first one in the host's render root: its light DOM, or the shadow root
7
+ * of a host that has one, where the event arrives retargeted to the host. An
8
+ * event from a player nested in an item reaches the host with another target.
9
+ */
10
+ export declare function isOwnSectionPlayerEvent(event: Event, host: Element): boolean;
@@ -1,4 +1,4 @@
1
- import { LoadingCompleteHandler, StageChangeHandler } from '@pie-players/pie-assessment-toolkit/runtime/internal';
1
+ import { LoadingCompleteHandler, StageChangeHandler } from '@pie-players/pie-assessment-toolkit/runtime/engine';
2
2
  export type RuntimeCallbackBridgeChannel = "onStageChange" | "onLoadingComplete";
3
3
  export interface RuntimeCallbackBridgeOptions {
4
4
  /** Layout CE host element the engine dispatches DOM events on. */
@@ -3,9 +3,9 @@
3
3
  *
4
4
  * The three shells — vertical, tabbed, split-pane — differ in how they arrange
5
5
  * panes and in nothing else at this level: each clamps the same host-configurable
6
- * pixel values, finds its own host element through the same root-node walk, and
7
- * watches the same narrow-layout media query. That was copied three times, so a
8
- * changed clamp bound reached whichever shells someone remembered.
6
+ * pixel values and watches the same narrow-layout media query. That was copied
7
+ * three times, so a changed clamp bound reached whichever shells someone
8
+ * remembered.
9
9
  *
10
10
  * What cannot be shared, and is not this module's failure: the `props` map inside
11
11
  * `<svelte:options customElement={{…}}>`. The Svelte compiler rejects anything but
@@ -35,14 +35,6 @@ export declare function resolveContentMaxWidths(contentMaxWidthNoPassage: unknow
35
35
  noPassagePx: number | undefined;
36
36
  withPassagePx: number | undefined;
37
37
  };
38
- /**
39
- * The custom element hosting this shell, reached from the shell's anchor node.
40
- *
41
- * Through `getRootNode` so it works whether the shell renders into a shadow root
42
- * or into light DOM, which these shells do (`shadow: "none"`, so item-player and
43
- * runtime styles can cascade into rendered item content).
44
- */
45
- export declare function getShellHostElement(anchor: HTMLElement | null): HTMLElement | null;
46
38
  /**
47
39
  * Track whether the viewport is below the shell's narrow-layout breakpoint.
48
40
  *
@@ -1,4 +1,4 @@
1
- import { ItemEntity } from '@pie-players/pie-players-shared/types';
1
+ import { ItemEntity, ItemSettings } from '@pie-players/pie-players-shared/types';
2
2
  import { FormativeItemView } from '@pie-players/pie-players-shared/formative';
3
3
  import { SectionCompositionModel } from '../../controllers/types.js';
4
4
  import { PlayerElementParams } from './player-action.js';
@@ -101,3 +101,8 @@ export declare function getCanonicalItemId(args: {
101
101
  compositionModel: SectionCompositionModel;
102
102
  item: ItemEntity;
103
103
  }): string;
104
+ /** The policy settings the item's card registers through its item scope. */
105
+ export declare function getItemSettings(args: {
106
+ compositionModel: SectionCompositionModel;
107
+ item: ItemEntity;
108
+ }): ItemSettings | null;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The section controller lookups behind `waitForSectionController`.
3
+ *
4
+ * The toolkit emits `toolkit-ready` each time it initializes a section, once
5
+ * that section's controller has resolved: the first section, each switch and
6
+ * each update to the current one. The event bubbles, composed, through every
7
+ * element around it.
8
+ * A wait listens for it on `target` and looks the controller up again each time
9
+ * it arrives, then once more at the timeout.
10
+ */
11
+ /**
12
+ * Resolves with the first controller `lookup` returns after a `toolkit-ready`
13
+ * reaches `target`, or with what it returns at `timeoutMs`. A `timeoutMs` that
14
+ * is not finite, or too long for a timer, waits for the event alone.
15
+ */
16
+ export declare function waitForToolkitReady<Controller>(target: EventTarget | null, lookup: (event?: Event) => Controller | null, timeoutMs: number): Promise<Controller | null>;
@@ -2,22 +2,14 @@ import { SectionPlayerCardTitleFormatter } from './card-title-formatters.js';
2
2
  /**
3
3
  * Host-extension hook contract for the section-player layout custom elements.
4
4
  *
5
- * Hosts pass a `SectionPlayerHostHooks` value via the `host-hooks` attribute
6
- * (or the `hostHooks` prop, mirroring per the two-tier policy in
7
- * {@link ../../ARCHITECTURE.md}) on `<pie-section-player-*>` to override
8
- * formatter / decoration behavior that the engine intentionally leaves to the
9
- * host. Each hook is optional; omitted hooks fall back to documented defaults.
5
+ * Hosts pass a `SectionPlayerHostHooks` value as the `hooks` JS property on
6
+ * `<pie-section-player-*>` to override formatter / decoration behavior that
7
+ * the engine intentionally leaves to the host. Each hook is optional; omitted
8
+ * hooks fall back to documented defaults.
10
9
  *
11
10
  * Today the contract has a single member (`cardTitleFormatter`). The shape is
12
11
  * intentionally a struct, not a single callback prop, so future host-supplied
13
12
  * formatters / decorators can be added without renaming the surface.
14
- *
15
- * The naming/expansion of this contract is part of the
16
- * "Coherent Options Surface" review; the broader expansion (additional hook
17
- * fields produced as the section host runtime engine consolidates) is owned
18
- * by the M7 follow-up plan in `coherent_options_surface_review_0133a7cd.plan.md`.
19
- * Keeping the current name (`SectionPlayerHostHooks`) is deliberate so that
20
- * additions there do not require a breaking rename across the layout CEs.
21
13
  */
22
14
  export type SectionPlayerHostHooks = {
23
15
  cardTitleFormatter?: SectionPlayerCardTitleFormatter;
File without changes
@@ -1,4 +1,3 @@
1
- import { SectionPlayerReadinessChangeDetail } from './public-events.js';
2
1
  import { SectionControllerHandle } from '@pie-players/pie-assessment-toolkit';
3
2
  export type SectionPlayerNavigationSnapshot = {
4
3
  currentIndex: number;
@@ -8,7 +7,6 @@ export type SectionPlayerNavigationSnapshot = {
8
7
  currentItemId?: string;
9
8
  };
10
9
  export type SectionPlayerSnapshot = {
11
- readiness: SectionPlayerReadinessChangeDetail;
12
10
  composition: {
13
11
  itemsCount: number;
14
12
  passagesCount: number;
@@ -17,9 +15,6 @@ export type SectionPlayerSnapshot = {
17
15
  };
18
16
  export interface SectionPlayerRuntimeHostContract {
19
17
  getSnapshot(): SectionPlayerSnapshot;
20
- selectComposition(): SectionPlayerSnapshot["composition"];
21
- selectNavigation(): SectionPlayerNavigationSnapshot;
22
- selectReadiness(): SectionPlayerReadinessChangeDetail;
23
18
  navigateTo(index: number): boolean;
24
19
  navigateNext(): boolean;
25
20
  navigatePrevious(): boolean;
File without changes
@@ -14,7 +14,10 @@ export declare class SectionController implements SectionControllerHandle {
14
14
  private readonly listeners;
15
15
  private readonly trackedRenderables;
16
16
  private readonly loadedRenderableKeys;
17
+ private readonly heldContentLoads;
17
18
  private readonly itemCompletionByCanonicalId;
19
+ private readonly elementCompletionByCanonicalId;
20
+ private readonly reportedCompletionIds;
18
21
  private sectionLoadingComplete;
19
22
  private totalRegistered;
20
23
  private totalLoaded;
@@ -254,6 +257,7 @@ export declare class SectionController implements SectionControllerHandle {
254
257
  applySession(session: SectionControllerSessionState | null, options?: {
255
258
  mode?: "replace" | "merge";
256
259
  }): Promise<void>;
260
+ private applySessionState;
257
261
  /**
258
262
  * Move between items inside the current section only.
259
263
  * Cross-section navigation belongs to the higher-level assessment player.
@@ -295,7 +299,17 @@ export declare class SectionController implements SectionControllerHandle {
295
299
  private toSectionContentKind;
296
300
  private getRenderableKey;
297
301
  private readCompleteFromSession;
302
+ private sessionHoldsResponse;
303
+ /**
304
+ * `restored` names the items a host session was just applied to: what their
305
+ * elements reported before it describes the session the restore replaced.
306
+ */
298
307
  private bootstrapCompletionFromSessions;
308
+ /**
309
+ * The item's completion after one element reports its own. A report that
310
+ * names no element is the item's completion itself.
311
+ */
312
+ private recordElementCompletion;
299
313
  private updateItemCompleteState;
300
314
  private emitSectionItemsCompleteIfChanged;
301
315
  private evaluateSectionLoadingState;
@@ -1,17 +1 @@
1
- import { ToolkitCoordinator, SectionControllerHandle } from '@pie-players/pie-assessment-toolkit';
2
- export type { SectionControllerContext, SectionControllerEvent, SectionControllerEventType, SectionControllerHandle, SectionControllerKey, SectionControllerLoadedRenderable, SectionSessionPersistenceConfig, SectionSessionPersistenceStrategy, SectionControllerRuntimeState, SectionControllerSessionState, } from '@pie-players/pie-assessment-toolkit';
3
- export type CoordinatorWithSectionControllers = ToolkitCoordinator & {
4
- getOrCreateSectionController(args: {
5
- sectionId: string;
6
- attemptId?: string;
7
- input?: unknown;
8
- updateExisting?: boolean;
9
- createDefaultController: () => SectionControllerHandle | Promise<SectionControllerHandle>;
10
- }): Promise<SectionControllerHandle>;
11
- disposeSectionController(args: {
12
- sectionId: string;
13
- attemptId?: string;
14
- persistBeforeDispose?: boolean;
15
- clearPersistence?: boolean;
16
- }): Promise<void>;
17
- };
1
+ export type { SectionControllerHandle, SectionSessionPersistenceConfig, SectionControllerRuntimeState, SectionControllerSessionState, } from '@pie-players/pie-assessment-toolkit';
@@ -1,6 +1,6 @@
1
1
  import { TestAttemptSession } from '@pie-players/pie-assessment-toolkit';
2
- import { ItemSessionUpdateIntent, AssessmentItemRef, AssessmentSection, ItemEntity, PassageEntity, RubricBlock } from '@pie-players/pie-players-shared';
3
- import { ConfigContainerEntity } from '@pie-players/pie-players-shared/types';
2
+ import { ItemSessionUpdateIntent, SessionCommitReason, AssessmentItemRef, AssessmentSection, ItemEntity, PassageEntity, RubricBlock } from '@pie-players/pie-players-shared';
3
+ import { ConfigContainerEntity, ItemSettings } from '@pie-players/pie-players-shared/types';
4
4
  import { FormativeFeedbackReveal, FormativeItemPolicy, FormativeMasteryRollup, FormativeSectionProjection, FormativeSectionSlice, FormativeTryOutcome } from '@pie-players/pie-players-shared/formative';
5
5
  import { TimedMediaDegradation, TimedMediaSectionProjection, TimedMediaSectionSessionSlice, TimedMediaValidationError } from '@pie-players/pie-players-shared/timed-media';
6
6
  export type SectionView = "candidate" | "scorer" | "author" | "proctor" | "testConstructor" | "tutor";
@@ -23,6 +23,8 @@ export interface SectionContentModel {
23
23
  * that identifier, and two implementations of one mapping.
24
24
  */
25
25
  formative?: FormativeItemPolicy;
26
+ /** The item ref's policy settings, carried for the same reason. */
27
+ settings?: ItemSettings;
26
28
  }>;
27
29
  /**
28
30
  * How an authored `timedMedia.stimulusRef` resolves to a renderable.
@@ -119,15 +121,11 @@ export interface SectionCanonicalItemViewModel {
119
121
  index: number;
120
122
  isCurrent: boolean;
121
123
  session: unknown;
122
- }
123
- export interface SectionCanonicalSectionViewModel {
124
- sectionId: string;
125
- currentItemIndex: number;
126
- items: SectionCanonicalItemViewModel[];
127
- }
128
- export interface SectionCanonicalSessionViewModel {
129
- currentItemIndex: number;
130
- itemSessionsByCanonicalId: Record<string, unknown>;
124
+ /**
125
+ * The item ref's policy settings, which the item's scope registers; they
126
+ * govern the item's own toolbar.
127
+ */
128
+ settings?: ItemSettings;
131
129
  }
132
130
  export interface SectionAttemptSessionSliceLoadedRenderable {
133
131
  itemId: string;
@@ -160,6 +158,8 @@ export interface SessionChangedResult {
160
158
  intent?: ItemSessionUpdateIntent;
161
159
  complete?: boolean;
162
160
  component?: string;
161
+ elementId?: string;
162
+ sessionCommitReason?: SessionCommitReason;
163
163
  timestamp: number;
164
164
  };
165
165
  }
@@ -197,15 +197,29 @@ export interface ItemSessionDataChangedEvent extends ItemScopedControllerEventBa
197
197
  canonicalItemId: string;
198
198
  session: unknown;
199
199
  intent?: ItemSessionUpdateIntent;
200
+ /** The reported completion: the element's own when `elementId` is set. */
200
201
  complete?: boolean;
201
202
  component?: string;
203
+ /** The id of the element that reported, when the change names one. */
204
+ elementId?: string;
205
+ /** The controller input's `sectionId`. */
206
+ sectionId?: string;
207
+ /** Set when the change is a commit at a teardown, navigation or page-hidden seam. */
208
+ sessionCommitReason?: SessionCommitReason;
202
209
  }
203
210
  export interface ItemSessionMetaChangedEvent extends ItemScopedControllerEventBase {
204
211
  type: "item-session-meta-changed";
205
212
  itemId: string;
206
213
  canonicalItemId: string;
214
+ /** The reported completion: the element's own when `elementId` is set. */
207
215
  complete?: boolean;
208
216
  component?: string;
217
+ /** The id of the element that reported, when the change names one. */
218
+ elementId?: string;
219
+ /** The controller input's `sectionId`. */
220
+ sectionId?: string;
221
+ /** Set when the change is a commit at a teardown, navigation or page-hidden seam. */
222
+ sessionCommitReason?: SessionCommitReason;
209
223
  }
210
224
  export interface ItemSelectedEvent extends ItemScopedControllerEventBase {
211
225
  type: "item-selected";
@@ -0,0 +1,22 @@
1
+ import { AssessmentSection, ItemConfig, SectionControllerSessionState } from '@pie-players/pie-players-shared/types';
2
+ export interface ItemSectionOptions {
3
+ /** Defaults to the item config's id. */
4
+ sectionId?: string;
5
+ itemVId?: string;
6
+ /** The item's session, in the shape `<pie-item-player session>` takes. */
7
+ session?: unknown;
8
+ }
9
+ export interface ItemSection {
10
+ section: AssessmentSection;
11
+ session: SectionControllerSessionState | null;
12
+ }
13
+ /**
14
+ * Build the `section` and `session` a section player layout takes from one item
15
+ * config and, optionally, its session.
16
+ *
17
+ * The item ref's `identifier` and the item's `id` are the config's `id`, so
18
+ * every `itemId` the section reports is the id the host already holds. The item
19
+ * and its passage carry no `baseId` or `version`. The host sets `section-id` to
20
+ * `section.identifier`.
21
+ */
22
+ export declare function sectionFromItem(config: ItemConfig, options?: ItemSectionOptions): ItemSection;
@@ -0,0 +1,37 @@
1
+ function d(e) {
2
+ return !!e.pie;
3
+ }
4
+ function r(e) {
5
+ const s = { ...e.pie };
6
+ e.instructorResources !== void 0 && s.instructorResources === void 0 && (s.instructorResources = e.instructorResources), e.defaultExtraModels !== void 0 && s.defaultExtraModels === void 0 && (s.defaultExtraModels = e.defaultExtraModels);
7
+ const t = {
8
+ id: e.id,
9
+ config: s
10
+ };
11
+ return e.passage && (t.passage = {
12
+ id: e.passage.id,
13
+ config: e.passage
14
+ }), t;
15
+ }
16
+ function n(e, s = {}) {
17
+ const t = d(e) ? r(e) : {
18
+ id: e.id,
19
+ config: e
20
+ }, i = {
21
+ identifier: e.id,
22
+ item: t
23
+ };
24
+ return s.itemVId !== void 0 && (i.itemVId = s.itemVId), {
25
+ section: {
26
+ identifier: s.sectionId ?? e.id,
27
+ assessmentItemRefs: [i]
28
+ },
29
+ session: s.session == null ? null : {
30
+ currentItemIndex: 0,
31
+ itemSessions: { [e.id]: s.session }
32
+ }
33
+ };
34
+ }
35
+ export {
36
+ n as sectionFromItem
37
+ };
@@ -1,10 +1,8 @@
1
- export type { SectionPlayerLayoutContract, SectionPlayerLayoutName, SectionPlayerLayoutCapability, SectionPlayerBasicPropName, SectionPlayerAdvancedPropName, SectionPlayerLayoutPropName, SectionPlayerLayoutCommandName, } from './contracts/layout-contract.js';
2
- export type { SectionPlayerPublicEventName, SectionPlayerReadinessPhase, SectionPlayerReadinessChangeDetail, } from './contracts/public-events.js';
3
- export { SECTION_PLAYER_PUBLIC_EVENTS } from './contracts/public-events.js';
4
1
  export type { SectionPlayerRuntimeHostContract, SectionPlayerNavigationSnapshot, SectionPlayerSnapshot, } from './contracts/runtime-host-contract.js';
5
- export { SPLITPANE_LAYOUT_CONTRACT, TABBED_LAYOUT_CONTRACT, VERTICAL_LAYOUT_CONTRACT, } from './contracts/layout-parity-metadata.js';
6
- export type { ReadinessPolicyAdapter, SectionPlayerPolicies, SectionPlayerReadinessPolicy, SectionPlayerPreloadPolicy, SectionPlayerTelemetryPolicy, } from './policies/types.js';
7
- export { DEFAULT_SECTION_PLAYER_POLICIES, isPreloadEnabled, isTelemetryEnabled, } from './policies/index.js';
2
+ export type { SectionPlayerPolicies, SectionPlayerReadinessPolicy, SectionPlayerPreloadPolicy, SectionPlayerTelemetryPolicy, } from './policies/types.js';
3
+ export { DEFAULT_SECTION_PLAYER_POLICIES } from './policies/index.js';
4
+ export { sectionFromItem } from './item-section/index.js';
5
+ export type { ItemSection, ItemSectionOptions } from './item-section/index.js';
8
6
  export type { SectionPlayerCardTitleContext, SectionPlayerCardTitleFormatter, SectionPlayerItemTitleContext, SectionPlayerPassageTitleContext, } from './contracts/card-title-formatters.js';
9
7
  export type { SectionPlayerHostHooks } from './contracts/host-hooks.js';
10
8
  export type { SectionPlayerBackendResolver, SectionPlayerBackendResolverContext, SectionPlayerRuntimeConfig, SectionPlayerRuntimePlayerConfig, } from './components/shared/section-player-backend-delivery.js';