@pie-players/pie-assessment-toolkit 0.3.57 → 0.3.59

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.
@@ -21,6 +21,13 @@ export interface AssessmentToolkitRuntimeContext {
21
21
  assessmentId: string;
22
22
  sectionId: string;
23
23
  itemPlayer: ItemPlayerConfig;
24
+ /**
25
+ * Opt-in flag: context consumers render the vendored `<nds-icon-button>`
26
+ * only when this is `true`; otherwise (unset/`false`, the default) they
27
+ * render plain `<button>` controls. Sourced from the host's
28
+ * `runtime.ndsIcons` (or the `nds-icons` attribute on the toolkit).
29
+ */
30
+ ndsIcons?: boolean;
24
31
  reportSessionChanged?: (itemId: string, detail: unknown) => void;
25
32
  }
26
33
  export declare const assessmentToolkitRuntimeContext: {
@@ -1 +1 @@
1
- {"version":3,"file":"assessment-toolkit-context.js","sourceRoot":"","sources":["../../src/context/assessment-toolkit-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAqCzD,MAAM,CAAC,MAAM,+BAA+B,GAC3C,aAAa,CACZ,MAAM,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAClD,CAAC;AAOH,MAAM,CAAC,MAAM,mCAAmC,GAC/C,aAAa,CACZ,MAAM,CAAC,GAAG,CAAC,0CAA0C,CAAC,CACtD,CAAC;AAeH,MAAM,CAAC,MAAM,6BAA6B,GACzC,aAAa,CACZ,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAChD,CAAC;AAOH,MAAM,CAAC,MAAM,mCAAmC,GAC/C,aAAa,CACZ,MAAM,CAAC,GAAG,CAAC,0CAA0C,CAAC,CACtD,CAAC","sourcesContent":["import { createContext } from \"@pie-players/pie-context\";\nimport type { LoaderConfig } from \"@pie-players/pie-players-shared/loader-config\";\nimport type {\n\tAccessibilityCatalogResolverApi,\n\tElementToolStateStoreApi,\n\tHighlightCoordinatorApi,\n\tToolCoordinatorApi,\n\tToolkitCoordinatorApi,\n\tTtsServiceApi,\n} from \"../services/interfaces.js\";\nimport type { TTSHighlightTargetResolver } from \"../services/tts/highlight-target-resolver.js\";\n\nexport type ItemPlayerType = \"iife\" | \"esm\" | \"preloaded\" | \"custom\";\n\nexport interface ItemPlayerConfig {\n\ttype: ItemPlayerType;\n\ttagName: string;\n\tversion?: string;\n\tsource?: string;\n\tloaderConfig?: LoaderConfig;\n\tloaderOptions?: Record<string, unknown>;\n\tisDefault: boolean;\n}\n\nexport interface AssessmentToolkitRuntimeContext {\n\ttoolkitCoordinator: ToolkitCoordinatorApi;\n\ttoolCoordinator: ToolCoordinatorApi;\n\tttsService: TtsServiceApi;\n\thighlightCoordinator: HighlightCoordinatorApi;\n\tcatalogResolver: AccessibilityCatalogResolverApi;\n\telementToolStateStore: ElementToolStateStoreApi;\n\tassessmentId: string;\n\tsectionId: string;\n\titemPlayer: ItemPlayerConfig;\n\treportSessionChanged?: (itemId: string, detail: unknown) => void;\n}\n\nexport const assessmentToolkitRuntimeContext =\n\tcreateContext<AssessmentToolkitRuntimeContext>(\n\t\tSymbol.for(\"pie.assessmentToolkit.runtimeContext\"),\n\t);\n\nexport interface AssessmentToolkitHostRuntimeContext {\n\truntimeId: string;\n\tcoordinator: ToolkitCoordinatorApi;\n}\n\nexport const assessmentToolkitHostRuntimeContext =\n\tcreateContext<AssessmentToolkitHostRuntimeContext>(\n\t\tSymbol.for(\"pie.assessmentToolkit.hostRuntimeContext\"),\n\t);\n\nexport type ShellContextKind = \"item\" | \"passage\";\n\nexport interface AssessmentToolkitShellContext {\n\tkind: ShellContextKind;\n\titemId: string;\n\tcanonicalItemId: string;\n\tcontentKind: string;\n\tregionPolicy: string;\n\tscopeElement: HTMLElement | null;\n\titem: unknown;\n\tcontextVersion: number;\n}\n\nexport const assessmentToolkitShellContext =\n\tcreateContext<AssessmentToolkitShellContext>(\n\t\tSymbol.for(\"pie.assessmentToolkit.shellContext\"),\n\t);\n\nexport interface AssessmentToolkitRegionScopeContext {\n\tscopeElement: HTMLElement | null;\n\tttsHighlightTargetResolver?: TTSHighlightTargetResolver | null;\n}\n\nexport const assessmentToolkitRegionScopeContext =\n\tcreateContext<AssessmentToolkitRegionScopeContext>(\n\t\tSymbol.for(\"pie.assessmentToolkit.regionScopeContext\"),\n\t);\n"]}
1
+ {"version":3,"file":"assessment-toolkit-context.js","sourceRoot":"","sources":["../../src/context/assessment-toolkit-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AA4CzD,MAAM,CAAC,MAAM,+BAA+B,GAC3C,aAAa,CACZ,MAAM,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAClD,CAAC;AAOH,MAAM,CAAC,MAAM,mCAAmC,GAC/C,aAAa,CACZ,MAAM,CAAC,GAAG,CAAC,0CAA0C,CAAC,CACtD,CAAC;AAeH,MAAM,CAAC,MAAM,6BAA6B,GACzC,aAAa,CACZ,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAChD,CAAC;AAOH,MAAM,CAAC,MAAM,mCAAmC,GAC/C,aAAa,CACZ,MAAM,CAAC,GAAG,CAAC,0CAA0C,CAAC,CACtD,CAAC","sourcesContent":["import { createContext } from \"@pie-players/pie-context\";\nimport type { LoaderConfig } from \"@pie-players/pie-players-shared/loader-config\";\nimport type {\n\tAccessibilityCatalogResolverApi,\n\tElementToolStateStoreApi,\n\tHighlightCoordinatorApi,\n\tToolCoordinatorApi,\n\tToolkitCoordinatorApi,\n\tTtsServiceApi,\n} from \"../services/interfaces.js\";\nimport type { TTSHighlightTargetResolver } from \"../services/tts/highlight-target-resolver.js\";\n\nexport type ItemPlayerType = \"iife\" | \"esm\" | \"preloaded\" | \"custom\";\n\nexport interface ItemPlayerConfig {\n\ttype: ItemPlayerType;\n\ttagName: string;\n\tversion?: string;\n\tsource?: string;\n\tloaderConfig?: LoaderConfig;\n\tloaderOptions?: Record<string, unknown>;\n\tisDefault: boolean;\n}\n\nexport interface AssessmentToolkitRuntimeContext {\n\ttoolkitCoordinator: ToolkitCoordinatorApi;\n\ttoolCoordinator: ToolCoordinatorApi;\n\tttsService: TtsServiceApi;\n\thighlightCoordinator: HighlightCoordinatorApi;\n\tcatalogResolver: AccessibilityCatalogResolverApi;\n\telementToolStateStore: ElementToolStateStoreApi;\n\tassessmentId: string;\n\tsectionId: string;\n\titemPlayer: ItemPlayerConfig;\n\t/**\n\t * Opt-in flag: context consumers render the vendored `<nds-icon-button>`\n\t * only when this is `true`; otherwise (unset/`false`, the default) they\n\t * render plain `<button>` controls. Sourced from the host's\n\t * `runtime.ndsIcons` (or the `nds-icons` attribute on the toolkit).\n\t */\n\tndsIcons?: boolean;\n\treportSessionChanged?: (itemId: string, detail: unknown) => void;\n}\n\nexport const assessmentToolkitRuntimeContext =\n\tcreateContext<AssessmentToolkitRuntimeContext>(\n\t\tSymbol.for(\"pie.assessmentToolkit.runtimeContext\"),\n\t);\n\nexport interface AssessmentToolkitHostRuntimeContext {\n\truntimeId: string;\n\tcoordinator: ToolkitCoordinatorApi;\n}\n\nexport const assessmentToolkitHostRuntimeContext =\n\tcreateContext<AssessmentToolkitHostRuntimeContext>(\n\t\tSymbol.for(\"pie.assessmentToolkit.hostRuntimeContext\"),\n\t);\n\nexport type ShellContextKind = \"item\" | \"passage\";\n\nexport interface AssessmentToolkitShellContext {\n\tkind: ShellContextKind;\n\titemId: string;\n\tcanonicalItemId: string;\n\tcontentKind: string;\n\tregionPolicy: string;\n\tscopeElement: HTMLElement | null;\n\titem: unknown;\n\tcontextVersion: number;\n}\n\nexport const assessmentToolkitShellContext =\n\tcreateContext<AssessmentToolkitShellContext>(\n\t\tSymbol.for(\"pie.assessmentToolkit.shellContext\"),\n\t);\n\nexport interface AssessmentToolkitRegionScopeContext {\n\tscopeElement: HTMLElement | null;\n\tttsHighlightTargetResolver?: TTSHighlightTargetResolver | null;\n}\n\nexport const assessmentToolkitRegionScopeContext =\n\tcreateContext<AssessmentToolkitRegionScopeContext>(\n\t\tSymbol.for(\"pie.assessmentToolkit.regionScopeContext\"),\n\t);\n"]}
@@ -60,6 +60,14 @@ export type RuntimeConfig = {
60
60
  createSectionController?: unknown;
61
61
  isolation?: string;
62
62
  env?: Record<string, unknown>;
63
+ /**
64
+ * Presentation flag: opt-in to the vendored `<nds-icon-button>` for the
65
+ * toolbar tool buttons, the calculator shell controls, inline-TTS
66
+ * play/pause, and the section scroll-hint. NDS icons render only when
67
+ * this is explicitly `true`; unset/`false` keeps the plain `<button>`
68
+ * markup (the default). Purely visual — no engine effect.
69
+ */
70
+ ndsIcons?: boolean;
63
71
  toolConfigStrictness?: ToolConfigStrictness;
64
72
  onFrameworkError?: FrameworkErrorHandler;
65
73
  onStageChange?: StageChangeHandler;
@@ -118,6 +126,14 @@ export declare function resolveRuntime(args: {
118
126
  onLoadingComplete: LoadingCompleteHandler | undefined;
119
127
  tools: unknown;
120
128
  toolContextResolvers?: Record<string, unknown> | null;
129
+ /**
130
+ * Presentation flag: opt-in to the vendored `<nds-icon-button>` for the
131
+ * toolbar tool buttons, the calculator shell controls, inline-TTS
132
+ * play/pause, and the section scroll-hint. NDS icons render only when
133
+ * this is explicitly `true`; unset/`false` keeps the plain `<button>`
134
+ * markup (the default). Purely visual — no engine effect.
135
+ */
136
+ ndsIcons?: boolean;
121
137
  };
122
138
  /**
123
139
  * Effective runtime returned by `resolveRuntime`. The shape is exposed
@@ -1 +1 @@
1
- {"version":3,"file":"engine-resolver.js","sourceRoot":"","sources":["../../../src/runtime/core/engine-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAUH,MAAM,CAAC,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAC1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AACtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAC3C,MAAM,CAAC,MAAM,W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AAE,IAAI,CAAC,aAAa;QACjC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;KACzC,CAAC,CAAC;IACH,MAAM,aAAa,GAAG,IAAI,CAAC,oBAAoB,CAAC;QAC/C,gBAAgB,EAAE,gBAA2C;QAC7D,UAAU,EAAE,MAAM,CAAC,gBAAgB,CAAC,UAAU,IAAI,mBAAmB,CAAC;QACtE,GAAG,EAAG,gBAAgB,CAAC,GAAsC,IAAI,IAAI;KACrE,CAAC,CAAC;IACH,OAAO;QACN,oBAAoB;QACpB,gBAAgB;QAChB,aAAa;KACb,CAAC;AACH,CAAC","sourcesContent":["/**\n * Section runtime engine resolver (M7).\n *\n * Canonical home of `resolveRuntime`, `resolveToolsConfig`, and their\n * supporting helpers/types. As of M7 PR 7 the previous duplicates in\n * `packages/section-player/src/components/shared/section-player-runtime.ts`\n * have been deleted; section-player now consumes these helpers via\n * `@pie-players/pie-assessment-toolkit/runtime/internal`.\n *\n * What is NOT absorbed in this module:\n * - `resolvePlayerRuntime` stays in section-player because it depends on\n * `DEFAULT_PLAYER_DEFINITIONS` (which side-effect-imports the\n * item-player package). The toolkit core stays free of that\n * dependency by exposing a parametrized orchestrator —\n * `resolveSectionEngineRuntimeState` — that takes a `resolvePlayerRuntime`\n * callable. The section-player wrapper\n * (`resolveSectionPlayerRuntimeState` in\n * `packages/section-player/src/components/shared/section-player-host-runtime.ts`)\n * hands its local implementation in.\n *\n * Runtime-owned configuration flows through `runtime.<key>`. Layout-only\n * inputs stay on the section-player host elements.\n */\n\nimport type { LoaderConfig } from \"@pie-players/pie-players-shared/loader-config\";\nimport type {\n\tLoadingCompleteDetail,\n\tStageChangeDetail,\n} from \"@pie-players/pie-players-shared/pie\";\nimport type { FrameworkErrorModel } from \"../../services/framework-error.js\";\nimport type { ToolConfigStrictness } from \"../../services/tool-config-validation.js\";\n\nexport const DEFAULT_ASSESSMENT_ID = \"section-demo-direct\";\nexport const DEFAULT_PLAYER_TYPE = \"iife\";\nexport const DEFAULT_LAZY_INIT = true;\nexport const DEFAULT_ISOLATION = \"inherit\";\nexport const DEFAULT_ENV = { mode: \"gather\", role: \"student\" } as Record<\n\tstring,\n\tunknown\n>;\n\nexport type PlayerOverrides = {\n\tloaderConfig?: LoaderConfig;\n\tloaderOptions?: Record<string, unknown>;\n\t[key: string]: unknown;\n};\n\nexport type FrameworkErrorHandler = (model: FrameworkErrorModel) => void;\nexport type StageChangeHandler = (detail: StageChangeDetail) => void;\nexport type LoadingCompleteHandler = (detail: LoadingCompleteDetail) => void;\n\n/**\n * Section runtime config.\n *\n * Documented exceptions (no runtime mirror, by design): identity\n * (`section-id`, `attempt-id`, `section`); layout-only shell knobs\n * (`show-toolbar`, `toolbar-position`, etc.); and layout-shell host\n * data (`policies`, `hooks`, `toolRegistry`, `*HostButtons`). Those\n * surfaces are layout-shell concerns; the runtime engine does not see\n * them. See section-player's ARCHITECTURE.md for the full policy.\n */\nexport type RuntimeConfig = {\n\tassessmentId?: string;\n\tplayerType?: string;\n\tplayer?: PlayerOverrides | null;\n\tlazyInit?: boolean;\n\ttools?: Record<string, unknown> | null;\n\ttoolContextResolvers?: Record<string, unknown> | null;\n\taccessibility?: Record<string, unknown> | null;\n\tcoordinator?: unknown;\n\tcreateSectionController?: unknown;\n\tisolation?: string;\n\tenv?: Record<string, unknown>;\n\ttoolConfigStrictness?: ToolConfigStrictness;\n\n\t// Canonical framework-error callback.\n\tonFrameworkError?: FrameworkErrorHandler;\n\n\t// Canonical stage-change callback. The DOM event\n\t// `pie-stage-change` remains the primary channel; this callback is\n\t// the convenience surface that mirrors the event one-to-one.\n\tonStageChange?: StageChangeHandler;\n\n\t// Canonical loading-complete callback. Mirrors the\n\t// `pie-loading-complete` DOM event, which the engine dispatches\n\t// once per cohort when every item has finished loading.\n\tonLoadingComplete?: LoadingCompleteHandler;\n};\n\nexport type RuntimeInputs = {\n\tassessmentId?: string;\n\ttoolConfigStrictness?: ToolConfigStrictness;\n\tonFrameworkError?: FrameworkErrorHandler;\n\tonStageChange?: StageChangeHandler;\n\tonLoadingComplete?: LoadingCompleteHandler;\n\truntime: RuntimeConfig | null;\n};\n\n/**\n * Pick the runtime-tier value when defined, otherwise the prop/attribute\n * value. The strict mirror rule means every tier-1 surface is resolved\n * with this single helper; per-feature special-casing is forbidden.\n */\nfunction pick<T>(\n\truntimeVal: T | undefined,\n\tattrVal: T | undefined,\n): T | undefined {\n\treturn runtimeVal !== undefined ? runtimeVal : attrVal;\n}\n\n/**\n * Resolve the canonical `onFrameworkError` handler from the two-tier\n * surface. Precedence (highest first): `runtime.onFrameworkError`,\n * then top-level `onFrameworkError`. Layout CEs and the kernel call\n * this so every entry point converges on the same handler.\n */\nexport function resolveOnFrameworkError(args: {\n\truntime: RuntimeConfig | null;\n\tonFrameworkError?: FrameworkErrorHandler;\n}): FrameworkErrorHandler | undefined {\n\tconst r = args.runtime ?? {};\n\tif (r.onFrameworkError !== undefined) return r.onFrameworkError;\n\treturn args.onFrameworkError;\n}\n\nexport function resolveToolsConfig(args: { runtime: RuntimeConfig | null }) {\n\tconst runtimeTools = (args.runtime?.tools || {}) as Record<string, unknown>;\n\tconst placement = (runtimeTools.placement || {}) as Record<string, unknown>;\n\tconst overlayToolsConfig = { ...runtimeTools, placement: { ...placement } };\n\t// Keep host-provided shape intact; framework-owned validation surfaces malformed config.\n\treturn overlayToolsConfig;\n}\n\nexport function resolveRuntime(args: {\n\tassessmentId: string;\n\truntime: RuntimeConfig | null;\n\teffectiveToolsConfig: unknown;\n\ttoolConfigStrictness?: ToolConfigStrictness;\n\tonFrameworkError?: FrameworkErrorHandler;\n\tonStageChange?: StageChangeHandler;\n\tonLoadingComplete?: LoadingCompleteHandler;\n}) {\n\tconst r = args.runtime || {};\n\tconst runtimePlayer = r.player ? { ...r.player } : null;\n\treturn {\n\t\t...r,\n\t\tassessmentId: pick(r.assessmentId, args.assessmentId),\n\t\tplayerType: r.playerType ?? DEFAULT_PLAYER_TYPE,\n\t\tplayer: runtimePlayer,\n\t\tlazyInit: r.lazyInit ?? DEFAULT_LAZY_INIT,\n\t\taccessibility: r.accessibility ?? null,\n\t\tcoordinator: r.coordinator ?? null,\n\t\tcreateSectionController: r.createSectionController,\n\t\tisolation: r.isolation ?? DEFAULT_ISOLATION,\n\t\tenv: r.env ?? DEFAULT_ENV,\n\t\ttoolConfigStrictness:\n\t\t\tpick(r.toolConfigStrictness, args.toolConfigStrictness) ?? \"error\",\n\n\t\t// Runtime callback wins; top-level callback remains a layout CE event\n\t\t// convenience for hosts that do not use DOM listeners.\n\t\tonFrameworkError: resolveOnFrameworkError({\n\t\t\truntime: args.runtime,\n\t\t\tonFrameworkError: args.onFrameworkError,\n\t\t}),\n\n\t\t// Runtime callback wins over the top-level callback prop.\n\t\tonStageChange: pick(r.onStageChange, args.onStageChange),\n\n\t\t// Runtime callback wins over the top-level callback prop.\n\t\tonLoadingComplete: pick(r.onLoadingComplete, args.onLoadingComplete),\n\n\t\ttools: args.effectiveToolsConfig,\n\t};\n}\n\n/**\n * Effective runtime returned by `resolveRuntime`. The shape is exposed\n * as `unknown` at the public boundary because consumers spread it into\n * arbitrary host props; downstream call sites narrow with the specific\n * keys they need.\n */\nexport type EffectiveRuntime = ReturnType<typeof resolveRuntime>;\n\n/**\n * Engine-side orchestrator that powers `resolveSectionPlayerRuntimeState`\n * from section-player and takes\n * `resolvePlayerRuntime` as an injected callable so the toolkit core\n * stays free of host-coupled defaults (`DEFAULT_PLAYER_DEFINITIONS`).\n */\nexport function resolveSectionEngineRuntimeState<P>(\n\targs: RuntimeInputs,\n\tdeps: {\n\t\tresolvePlayerRuntime: (resolverArgs: {\n\t\t\teffectiveRuntime: Record<string, unknown>;\n\t\t\tplayerType: string;\n\t\t\tenv: Record<string, unknown> | null;\n\t\t}) => P;\n\t},\n): {\n\teffectiveToolsConfig: unknown;\n\teffectiveRuntime: EffectiveRuntime;\n\tplayerRuntime: P;\n} {\n\tconst assessmentId = args.assessmentId ?? DEFAULT_ASSESSMENT_ID;\n\n\tconst effectiveToolsConfig = resolveToolsConfig({\n\t\truntime: args.runtime,\n\t});\n\tconst effectiveRuntime = resolveRuntime({\n\t\tassessmentId,\n\t\truntime: args.runtime,\n\t\teffectiveToolsConfig,\n\t\ttoolConfigStrictness: args.toolConfigStrictness,\n\t\tonFrameworkError: args.onFrameworkError,\n\t\tonStageChange: args.onStageChange,\n\t\tonLoadingComplete: args.onLoadingComplete,\n\t});\n\tconst playerRuntime = deps.resolvePlayerRuntime({\n\t\teffectiveRuntime: effectiveRuntime as Record<string, unknown>,\n\t\tplayerType: String(effectiveRuntime.playerType ?? DEFAULT_PLAYER_TYPE),\n\t\tenv: (effectiveRuntime.env as Record<string, unknown> | null) ?? null,\n\t});\n\treturn {\n\t\teffectiveToolsConfig,\n\t\teffectiveRuntime,\n\t\tplayerRuntime,\n\t};\n}\n"]}
1
+ {"version":3,"file":"engine-resolver.js","sourceRoot":"","sources":["../../../src/runtime/core/engine-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAUH,MAAM,CAAC,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAC1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AACtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAC3C,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAG3D,CAAC;AAmEF;;;;GAIG;AACH,SAAS,IAAI,CACZ,UAAyB,EACzB,OAAsB;IAEtB,OAAO,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC;AACxD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAGvC;IACA,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;IAC7B,IAAI,CAAC,C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AACH,CAAC","sourcesContent":["/**\n * Section runtime engine resolver (M7).\n *\n * Canonical home of `resolveRuntime`, `resolveToolsConfig`, and their\n * supporting helpers/types. As of M7 PR 7 the previous duplicates in\n * `packages/section-player/src/components/shared/section-player-runtime.ts`\n * have been deleted; section-player now consumes these helpers via\n * `@pie-players/pie-assessment-toolkit/runtime/internal`.\n *\n * What is NOT absorbed in this module:\n * - `resolvePlayerRuntime` stays in section-player because it depends on\n * `DEFAULT_PLAYER_DEFINITIONS` (which side-effect-imports the\n * item-player package). The toolkit core stays free of that\n * dependency by exposing a parametrized orchestrator —\n * `resolveSectionEngineRuntimeState` — that takes a `resolvePlayerRuntime`\n * callable. The section-player wrapper\n * (`resolveSectionPlayerRuntimeState` in\n * `packages/section-player/src/components/shared/section-player-host-runtime.ts`)\n * hands its local implementation in.\n *\n * Runtime-owned configuration flows through `runtime.<key>`. Layout-only\n * inputs stay on the section-player host elements.\n */\n\nimport type { LoaderConfig } from \"@pie-players/pie-players-shared/loader-config\";\nimport type {\n\tLoadingCompleteDetail,\n\tStageChangeDetail,\n} from \"@pie-players/pie-players-shared/pie\";\nimport type { FrameworkErrorModel } from \"../../services/framework-error.js\";\nimport type { ToolConfigStrictness } from \"../../services/tool-config-validation.js\";\n\nexport const DEFAULT_ASSESSMENT_ID = \"section-demo-direct\";\nexport const DEFAULT_PLAYER_TYPE = \"iife\";\nexport const DEFAULT_LAZY_INIT = true;\nexport const DEFAULT_ISOLATION = \"inherit\";\nexport const DEFAULT_ENV = { mode: \"gather\", role: \"student\" } as Record<\n\tstring,\n\tunknown\n>;\n\nexport type PlayerOverrides = {\n\tloaderConfig?: LoaderConfig;\n\tloaderOptions?: Record<string, unknown>;\n\t[key: string]: unknown;\n};\n\nexport type FrameworkErrorHandler = (model: FrameworkErrorModel) => void;\nexport type StageChangeHandler = (detail: StageChangeDetail) => void;\nexport type LoadingCompleteHandler = (detail: LoadingCompleteDetail) => void;\n\n/**\n * Section runtime config.\n *\n * Documented exceptions (no runtime mirror, by design): identity\n * (`section-id`, `attempt-id`, `section`); layout-only shell knobs\n * (`show-toolbar`, `toolbar-position`, etc.); and layout-shell host\n * data (`policies`, `hooks`, `toolRegistry`, `*HostButtons`). Those\n * surfaces are layout-shell concerns; the runtime engine does not see\n * them. See section-player's ARCHITECTURE.md for the full policy.\n */\nexport type RuntimeConfig = {\n\tassessmentId?: string;\n\tplayerType?: string;\n\tplayer?: PlayerOverrides | null;\n\tlazyInit?: boolean;\n\ttools?: Record<string, unknown> | null;\n\ttoolContextResolvers?: Record<string, unknown> | null;\n\taccessibility?: Record<string, unknown> | null;\n\tcoordinator?: unknown;\n\tcreateSectionController?: unknown;\n\tisolation?: string;\n\tenv?: Record<string, unknown>;\n\t/**\n\t * Presentation flag: opt-in to the vendored `<nds-icon-button>` for the\n\t * toolbar tool buttons, the calculator shell controls, inline-TTS\n\t * play/pause, and the section scroll-hint. NDS icons render only when\n\t * this is explicitly `true`; unset/`false` keeps the plain `<button>`\n\t * markup (the default). Purely visual — no engine effect.\n\t */\n\tndsIcons?: boolean;\n\ttoolConfigStrictness?: ToolConfigStrictness;\n\n\t// Canonical framework-error callback.\n\tonFrameworkError?: FrameworkErrorHandler;\n\n\t// Canonical stage-change callback. The DOM event\n\t// `pie-stage-change` remains the primary channel; this callback is\n\t// the convenience surface that mirrors the event one-to-one.\n\tonStageChange?: StageChangeHandler;\n\n\t// Canonical loading-complete callback. Mirrors the\n\t// `pie-loading-complete` DOM event, which the engine dispatches\n\t// once per cohort when every item has finished loading.\n\tonLoadingComplete?: LoadingCompleteHandler;\n};\n\nexport type RuntimeInputs = {\n\tassessmentId?: string;\n\ttoolConfigStrictness?: ToolConfigStrictness;\n\tonFrameworkError?: FrameworkErrorHandler;\n\tonStageChange?: StageChangeHandler;\n\tonLoadingComplete?: LoadingCompleteHandler;\n\truntime: RuntimeConfig | null;\n};\n\n/**\n * Pick the runtime-tier value when defined, otherwise the prop/attribute\n * value. The strict mirror rule means every tier-1 surface is resolved\n * with this single helper; per-feature special-casing is forbidden.\n */\nfunction pick<T>(\n\truntimeVal: T | undefined,\n\tattrVal: T | undefined,\n): T | undefined {\n\treturn runtimeVal !== undefined ? runtimeVal : attrVal;\n}\n\n/**\n * Resolve the canonical `onFrameworkError` handler from the two-tier\n * surface. Precedence (highest first): `runtime.onFrameworkError`,\n * then top-level `onFrameworkError`. Layout CEs and the kernel call\n * this so every entry point converges on the same handler.\n */\nexport function resolveOnFrameworkError(args: {\n\truntime: RuntimeConfig | null;\n\tonFrameworkError?: FrameworkErrorHandler;\n}): FrameworkErrorHandler | undefined {\n\tconst r = args.runtime ?? {};\n\tif (r.onFrameworkError !== undefined) return r.onFrameworkError;\n\treturn args.onFrameworkError;\n}\n\nexport function resolveToolsConfig(args: { runtime: RuntimeConfig | null }) {\n\tconst runtimeTools = (args.runtime?.tools || {}) as Record<string, unknown>;\n\tconst placement = (runtimeTools.placement || {}) as Record<string, unknown>;\n\tconst overlayToolsConfig = { ...runtimeTools, placement: { ...placement } };\n\t// Keep host-provided shape intact; framework-owned validation surfaces malformed config.\n\treturn overlayToolsConfig;\n}\n\nexport function resolveRuntime(args: {\n\tassessmentId: string;\n\truntime: RuntimeConfig | null;\n\teffectiveToolsConfig: unknown;\n\ttoolConfigStrictness?: ToolConfigStrictness;\n\tonFrameworkError?: FrameworkErrorHandler;\n\tonStageChange?: StageChangeHandler;\n\tonLoadingComplete?: LoadingCompleteHandler;\n}) {\n\tconst r = args.runtime || {};\n\tconst runtimePlayer = r.player ? { ...r.player } : null;\n\treturn {\n\t\t...r,\n\t\tassessmentId: pick(r.assessmentId, args.assessmentId),\n\t\tplayerType: r.playerType ?? DEFAULT_PLAYER_TYPE,\n\t\tplayer: runtimePlayer,\n\t\tlazyInit: r.lazyInit ?? DEFAULT_LAZY_INIT,\n\t\taccessibility: r.accessibility ?? null,\n\t\tcoordinator: r.coordinator ?? null,\n\t\tcreateSectionController: r.createSectionController,\n\t\tisolation: r.isolation ?? DEFAULT_ISOLATION,\n\t\tenv: r.env ?? DEFAULT_ENV,\n\t\ttoolConfigStrictness:\n\t\t\tpick(r.toolConfigStrictness, args.toolConfigStrictness) ?? \"error\",\n\n\t\t// Runtime callback wins; top-level callback remains a layout CE event\n\t\t// convenience for hosts that do not use DOM listeners.\n\t\tonFrameworkError: resolveOnFrameworkError({\n\t\t\truntime: args.runtime,\n\t\t\tonFrameworkError: args.onFrameworkError,\n\t\t}),\n\n\t\t// Runtime callback wins over the top-level callback prop.\n\t\tonStageChange: pick(r.onStageChange, args.onStageChange),\n\n\t\t// Runtime callback wins over the top-level callback prop.\n\t\tonLoadingComplete: pick(r.onLoadingComplete, args.onLoadingComplete),\n\n\t\ttools: args.effectiveToolsConfig,\n\t};\n}\n\n/**\n * Effective runtime returned by `resolveRuntime`. The shape is exposed\n * as `unknown` at the public boundary because consumers spread it into\n * arbitrary host props; downstream call sites narrow with the specific\n * keys they need.\n */\nexport type EffectiveRuntime = ReturnType<typeof resolveRuntime>;\n\n/**\n * Engine-side orchestrator that powers `resolveSectionPlayerRuntimeState`\n * from section-player and takes\n * `resolvePlayerRuntime` as an injected callable so the toolkit core\n * stays free of host-coupled defaults (`DEFAULT_PLAYER_DEFINITIONS`).\n */\nexport function resolveSectionEngineRuntimeState<P>(\n\targs: RuntimeInputs,\n\tdeps: {\n\t\tresolvePlayerRuntime: (resolverArgs: {\n\t\t\teffectiveRuntime: Record<string, unknown>;\n\t\t\tplayerType: string;\n\t\t\tenv: Record<string, unknown> | null;\n\t\t}) => P;\n\t},\n): {\n\teffectiveToolsConfig: unknown;\n\teffectiveRuntime: EffectiveRuntime;\n\tplayerRuntime: P;\n} {\n\tconst assessmentId = args.assessmentId ?? DEFAULT_ASSESSMENT_ID;\n\n\tconst effectiveToolsConfig = resolveToolsConfig({\n\t\truntime: args.runtime,\n\t});\n\tconst effectiveRuntime = resolveRuntime({\n\t\tassessmentId,\n\t\truntime: args.runtime,\n\t\teffectiveToolsConfig,\n\t\ttoolConfigStrictness: args.toolConfigStrictness,\n\t\tonFrameworkError: args.onFrameworkError,\n\t\tonStageChange: args.onStageChange,\n\t\tonLoadingComplete: args.onLoadingComplete,\n\t});\n\tconst playerRuntime = deps.resolvePlayerRuntime({\n\t\teffectiveRuntime: effectiveRuntime as Record<string, unknown>,\n\t\tplayerType: String(effectiveRuntime.playerType ?? DEFAULT_PLAYER_TYPE),\n\t\tenv: (effectiveRuntime.env as Record<string, unknown> | null) ?? null,\n\t});\n\treturn {\n\t\teffectiveToolsConfig,\n\t\teffectiveRuntime,\n\t\tplayerRuntime,\n\t};\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-players/pie-assessment-toolkit",
3
- "version": "0.3.57",
3
+ "version": "0.3.59",
4
4
  "type": "module",
5
5
  "description": "PIE assessment toolkit: composable services + reference implementation for assessment players and tool coordination",
6
6
  "license": "MIT",
@@ -75,15 +75,15 @@
75
75
  "test": "bun test"
76
76
  },
77
77
  "dependencies": {
78
- "@pie-players/pie-calculator": "0.3.57",
79
- "@pie-players/pie-context": "0.3.57",
80
- "@pie-players/pie-players-shared": "0.3.57",
81
- "@pie-players/pie-tts": "0.3.57",
78
+ "@pie-players/pie-calculator": "0.3.59",
79
+ "@pie-players/pie-context": "0.3.59",
80
+ "@pie-players/pie-players-shared": "0.3.59",
81
+ "@pie-players/pie-tts": "0.3.59",
82
82
  "speech-rule-engine": "^5.0.0-rc.1"
83
83
  },
84
84
  "peerDependencies": {
85
- "@pie-players/pie-calculator-desmos": "0.3.57",
86
- "@pie-players/tts-client-server": "0.3.57"
85
+ "@pie-players/pie-calculator-desmos": "0.3.59",
86
+ "@pie-players/tts-client-server": "0.3.59"
87
87
  },
88
88
  "peerDependenciesMeta": {
89
89
  "@pie-players/pie-calculator-desmos": {
@@ -1,110 +0,0 @@
1
- # Vendored: `nds-icon-button`
2
-
3
- Pre-built bundle of the Renaissance Next Design System (NDS)
4
- `<nds-icon-button>` custom element. Used by `ItemToolBar.svelte` for the
5
- calculator shell header (chevrons, zoom, close) so the toolkit matches the
6
- Knowledge-Check Figma without taking a runtime dependency on Lit or the rest
7
- of NDS.
8
-
9
- ## Provenance
10
-
11
- | Field | Value |
12
- | --- | --- |
13
- | Upstream repo | `git@github.com:RenaissancePlace/nextComponentLibrary.git` |
14
- | Source file | `web-components/src/components/icon-button/nds-icon-button.ts` |
15
- | Last sync commit | `1c728d3` (`feat(UX-2319): add new components…`) |
16
- | Bundler | Vite 7 in lib mode, ES output, single-file (Lit inlined) |
17
-
18
- ## Why a vendored bundle, not an npm dep
19
-
20
- NDS is not currently published to a registry the `@pie-players/*` chain can
21
- consume. Copying the `.ts` source directly (the path the NDS docs suggest)
22
- would force `@pie-players/pie-assessment-toolkit` to take a `lit` dependency
23
- and pull in a chunk of foundations CSS, both of which would leak to every
24
- downstream consumer on lockstep release. A pre-built single-file bundle
25
- sidesteps both: zero new package deps, the bundle inlines what it needs, and
26
- the toolkit's CE build inlines this file into the published artifact.
27
-
28
- ## How to refresh
29
-
30
- When a newer `nds-icon-button` is needed:
31
-
32
- 1. Pull the latest `nextComponentLibrary` next to this repo (sibling
33
- checkout: `../../nextComponentLibrary`).
34
- 2. From `nextComponentLibrary/web-components/`, `bun install`.
35
- 3. Build a self-contained ESM bundle (no shared chunks) — the upstream
36
- `vite.bundle.config.js` splits Lit into a `property.js` chunk, which would
37
- break the single-file copy here. Use this one-shot config instead:
38
-
39
- ```js
40
- // vite.self-contained.config.js
41
- import { defineConfig } from 'vite';
42
- import { resolve } from 'path';
43
- export default defineConfig({
44
- publicDir: false,
45
- build: {
46
- outDir: resolve(__dirname, 'NDS-Prototypes/dist-bundles-self-contained'),
47
- emptyOutDir: true,
48
- minify: true,
49
- lib: {
50
- entry: resolve(__dirname, 'src/components/icon-button/nds-icon-button.ts'),
51
- name: 'NdsIconButton',
52
- fileName: () => 'nds-icon-button.bundled.js',
53
- formats: ['es'],
54
- },
55
- rollupOptions: { output: { inlineDynamicImports: true } },
56
- },
57
- });
58
- ```
59
-
60
- Then: `bunx vite build --config vite.self-contained.config.js`.
61
- 4. Copy the output:
62
- ```bash
63
- cp NDS-Prototypes/dist-bundles-self-contained/nds-icon-button.bundled.js \
64
- ../../pie-players/packages/assessment-toolkit/src/components/vendor/nds/nds-icon-button.js
65
- ```
66
- 5. Update the `Last sync commit` row above with the new upstream SHA.
67
- 6. From `packages/assessment-toolkit`, run `bun run build` and verify the
68
- calculator shell still mounts and the buttons still register.
69
-
70
- ## Build-time mutation
71
-
72
- `scripts/build-ce-components.mjs` does **not** copy this file verbatim. It
73
- rewrites every `customElements.define(IDENT, IDENT)` call into
74
- `customElements.get(IDENT) || customElements.define(IDENT, IDENT)` while
75
- mirroring `src/components/vendor/` → `dist/components/vendor/`.
76
-
77
- This is required because the toolkit produces three CE bundles
78
- (`ItemToolBar`, `SectionToolBar`, `PieAssessmentToolkit`), each of which
79
- inlines this file via `bun build`. A host page that loads more than one of
80
- those bundles would otherwise hit a duplicate-define `NotSupportedError`
81
- when the second bundle's `nds-icon-button` register call fires.
82
-
83
- If a future vendored bundle uses a different define call shape (e.g.
84
- `customElements.define("literal-tag", Ctor)` or via an alias), the regex in
85
- `build-ce-components.mjs` will silently miss it. Re-test by loading the
86
- `PieAssessmentToolkit` and `ItemToolBar` CEs on the same page after a refresh.
87
-
88
- ## Runtime dependencies
89
-
90
- The bundle's `connectedCallback` injects a `<link>` for the Renaissance
91
- Roboto stylesheet. The toolkit pre-injects a CORS-clean Roboto from Google
92
- Fonts before the first `<nds-icon-button>` mounts so the bundle's
93
- `link[href*="Roboto"]` guard short-circuits.
94
-
95
- The bundle's `render()` emits `fa-light fa-${iconName}` classes for icons.
96
- Light is FontAwesome 6 **Pro** (commercial license). The toolkit loads:
97
-
98
- 1. FA Free from jsDelivr as a same-origin-friendly fallback.
99
- 2. FA Pro from `/_fa-pro/{fontawesome,light}.min.css` if the host exposes
100
- that path. `apps/section-demos/vite.config.ts` proxies `/_fa-pro/*` →
101
- `https://ui.renaissance.com/fonts/Font_Awesome_6_Pro/*`. Hosts without
102
- the proxy fall through to FA Free's Solid weight (thicker stroke than
103
- the design intends, but legible).
104
-
105
- ## Linting / formatting
106
-
107
- This folder is excluded from `biome` checks via `biome.json`. The
108
- `check-ce-define-safety` script allowlists this exact file because the
109
- upstream Lit decorator emits a raw `customElements.define`; safety is
110
- recovered at build time by the rewrite described above.