@pie-players/pie-assessment-player 0.3.29 → 0.3.30

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 CHANGED
@@ -86,3 +86,17 @@ Toolkit tool/backend operational stream (when toolkit is mounted):
86
86
  - `pie-tool-init-start|success|error`
87
87
  - `pie-tool-backend-call-start|success|error`
88
88
  - `pie-tool-library-load-start|success|error`
89
+
90
+ ## Content trust boundary
91
+
92
+ Assessment markup reaches the DOM via the underlying
93
+ `<pie-item-player>` element, which now sanitizes item / passage markup by
94
+ default through DOMPurify. See
95
+ [pie-item-player README](./README.md#content-trust-boundary)
96
+ for the allow-list, opt-out mechanics (`trust-markup`), and the
97
+ `sanitizeMarkup` property override. Assessment-player hosts forward these
98
+ settings by setting `runtime.player.trustMarkup` /
99
+ `runtime.player.sanitizeMarkup` on the shared runtime they pass into the
100
+ section-player instances; the section-player runtime flattens `runtime.player.*`
101
+ fields onto the embedded `<pie-item-player>` (see the section-player README
102
+ for the exact forwarding shape).
@@ -37,6 +37,7 @@ export declare class AssessmentPlayerDefaultElement extends HTMLElement implemen
37
37
  private attachInstrumentationBridge;
38
38
  private renderEmptyState;
39
39
  private buildSectionPlayerTag;
40
+ private cleanupTtsForSectionNavigation;
40
41
  private syncCurrentSectionSessionIntoAssessment;
41
42
  private attachSectionControllerReadyListener;
42
43
  private render;
@@ -1 +1 @@
1
- {"version":3,"file":"AssessmentPlayerDefaultElement.d.ts","sourceRoot":"","sources":["../../src/components/AssessmentPlayerDefaultElement.ts"],"names":[],"mappings":"AAAA,OAAO,6EAA6E,CAAC;AACrF,OAAO,4EAA4E,CAAC;AAMpF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAEjE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAQxF,OAAO,KAAK,EACX,gCAAgC,EAChC,mCAAmC,EACnC,wBAAwB,EACxB,MAAM,uCAAuC,C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OAAO,CAAC,8BAA8B;IAqBtC,OAAO,CAAC,uCAAuC;IAe/C,OAAO,CAAC,oCAAoC;IA2B5C,OAAO,CAAC,MAAM;IA8Hd,OAAO,CAAC,cAAc;IActB,WAAW,IAAI,wBAAwB;IA6BvC,gBAAgB;IAIhB,eAAe;;;IAIf,cAAc,IAAI,gCAAgC;IAIlD,UAAU,CAAC,iBAAiB,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO;IAiCvD,YAAY,IAAI,OAAO;IAqBvB,gBAAgB,IAAI,OAAO;IAqB3B,uBAAuB,IAAI,0BAA0B,GAAG,IAAI;IAItD,2BAA2B,CAAC,SAAS,SAAO;CAUlD"}
@@ -1,7 +1,7 @@
1
1
  import "@pie-players/pie-section-player/components/section-player-splitpane-element";
2
2
  import "@pie-players/pie-section-player/components/section-player-vertical-element";
3
3
  import { defineCustomElementSafely as _ } from "@pie-players/pie-players-shared";
4
- function p(e, t) {
4
+ function m(e, t) {
5
5
  const s = `[${e}]`;
6
6
  return {
7
7
  debug: (n, ...i) => {
@@ -12,7 +12,7 @@ function p(e, t) {
12
12
  error: (n, ...i) => console.error(s, n, ...i)
13
13
  };
14
14
  }
15
- function f() {
15
+ function p() {
16
16
  return typeof window < "u" && window.PIE_DEBUG === !0;
17
17
  }
18
18
  var S;
@@ -53,13 +53,18 @@ function a(e, t, s) {
53
53
  writable: !0
54
54
  }) : e[t] = s, e;
55
55
  }
56
+ function U(e) {
57
+ if (!e || typeof e != "object") return !1;
58
+ const t = e;
59
+ return typeof t.providerId == "string" && typeof t.providerName == "string" && typeof t.initialize == "function" && typeof t.trackError == "function" && typeof t.trackEvent == "function" && typeof t.destroy == "function" && typeof t.isReady == "function";
60
+ }
56
61
  typeof window < "u" && !window.pieHelpers && (window.pieHelpers = {
57
62
  loadingScripts: {},
58
63
  loadingPromises: {},
59
64
  globalLoadQueue: Promise.resolve(),
60
65
  activeBundleUrl: null
61
66
  });
62
- var U = "https://proxy.pie-api.com", J = `${U}/bundles/`;
67
+ var $ = "https://proxy.pie-api.com", J = `${$}/bundles/`;
63
68
  function B(e) {
64
69
  try {
65
70
  const t = {
@@ -73,7 +78,7 @@ function B(e) {
73
78
  } catch {
74
79
  }
75
80
  }
76
- var Le = typeof window < "u" && window.PIE_BUILDER_ORIGIN_URL || B("PUBLIC_BUILDER_ORIGIN_URL") || U, K = typeof window < "u" && window.PIE_BUILDER_BUNDLE_URL || B("PUBLIC_BUILDER_BUNDLE_URL") || J, N;
81
+ var Le = typeof window < "u" && window.PIE_BUILDER_ORIGIN_URL || B("PUBLIC_BUILDER_ORIGIN_URL") || $, K = typeof window < "u" && window.PIE_BUILDER_BUNDLE_URL || B("PUBLIC_BUILDER_BUNDLE_URL") || J, N;
77
82
  (function(e) {
78
83
  e.SAVE = "save", e.MODEL = "model", e.SCORE = "score", e.MANUAL_SCORE = "manual-score";
79
84
  })(N || (N = {}));
@@ -89,9 +94,9 @@ var x;
89
94
  (function(e) {
90
95
  e.PENDING = "pending", e.IN_PROGRESS = "in_progress", e.COMPLETED = "completed", e.FAILED = "failed";
91
96
  })(x || (x = {}));
92
- var W = class $ extends CustomEvent {
97
+ var W = class O extends CustomEvent {
93
98
  constructor(t, s = !1) {
94
- super($.TYPE, {
99
+ super(O.TYPE, {
95
100
  bubbles: !0,
96
101
  detail: {
97
102
  update: t,
@@ -101,9 +106,9 @@ var W = class $ extends CustomEvent {
101
106
  }
102
107
  };
103
108
  a(W, "TYPE", "model.updated");
104
- var Q = class O extends CustomEvent {
109
+ var Q = class M extends CustomEvent {
105
110
  constructor(t, s) {
106
- super(O.TYPE, {
111
+ super(M.TYPE, {
107
112
  bubbles: !0,
108
113
  detail: {
109
114
  src: t,
@@ -113,18 +118,18 @@ var Q = class O extends CustomEvent {
113
118
  }
114
119
  };
115
120
  a(Q, "TYPE", "delete.image");
116
- var Z = class M extends CustomEvent {
121
+ var Z = class F extends CustomEvent {
117
122
  constructor(t) {
118
- super(M.TYPE, {
123
+ super(F.TYPE, {
119
124
  bubbles: !0,
120
125
  detail: t
121
126
  }), a(this, "handler", void 0), this.handler = t;
122
127
  }
123
128
  };
124
129
  a(Z, "TYPE", "insert.image");
125
- var X = class F extends CustomEvent {
130
+ var X = class z extends CustomEvent {
126
131
  constructor(t, s) {
127
- super(F.TYPE, {
132
+ super(z.TYPE, {
128
133
  bubbles: !0,
129
134
  detail: {
130
135
  src: t,
@@ -134,18 +139,18 @@ var X = class F extends CustomEvent {
134
139
  }
135
140
  };
136
141
  a(X, "TYPE", "delete.sound");
137
- var ee = class z extends CustomEvent {
142
+ var ee = class G extends CustomEvent {
138
143
  constructor(t) {
139
- super(z.TYPE, {
144
+ super(G.TYPE, {
140
145
  bubbles: !0,
141
146
  detail: t
142
147
  }), a(this, "handler", void 0), this.handler = t;
143
148
  }
144
149
  };
145
150
  a(ee, "TYPE", "insert.sound");
146
- var te = class G extends CustomEvent {
151
+ var te = class j extends CustomEvent {
147
152
  constructor(t, s) {
148
- super(G.TYPE, {
153
+ super(j.TYPE, {
149
154
  bubbles: !0,
150
155
  composed: !0,
151
156
  detail: {
@@ -160,20 +165,14 @@ var R;
160
165
  (function(e) {
161
166
  e[e.ROOT = 0] = "ROOT", e[e.SUBJECT = 1] = "SUBJECT", e[e.LEVEL = 2] = "LEVEL", e[e.STANDARD = 3] = "STANDARD";
162
167
  })(R || (R = {}));
163
- var ke = p("math-rendering", () => f()), Te = p("pie-scoring", () => f()), De = p("pie-updates", () => f()), _e = p("pie-initialization", () => f()), Ue = {
168
+ var ke = m("math-rendering", () => p()), Te = m("pie-scoring", () => p()), De = m("pie-updates", () => p()), _e = m("pie-initialization", () => p()), Ue = {
164
169
  buildServiceBase: K,
165
170
  bundleType: S.player,
166
171
  env: {
167
172
  mode: "gather",
168
173
  role: "student"
169
174
  }
170
- };
171
- function j(e) {
172
- if (!e || typeof e != "object") return !1;
173
- const t = e;
174
- return typeof t.providerId == "string" && typeof t.providerName == "string" && typeof t.initialize == "function" && typeof t.trackError == "function" && typeof t.trackEvent == "function" && typeof t.destroy == "function" && typeof t.isReady == "function";
175
- }
176
- var se = p("instrumentation-event-bridge", () => f());
175
+ }, se = m("instrumentation-event-bridge", () => p());
177
176
  function ne(e) {
178
177
  return e && typeof e == "object" ? e : typeof e > "u" ? {} : { value: e };
179
178
  }
@@ -195,7 +194,7 @@ function oe(e) {
195
194
  };
196
195
  if (!e.instrumentationProvider) return () => {
197
196
  };
198
- if (!j(e.instrumentationProvider))
197
+ if (!U(e.instrumentationProvider))
199
198
  return e.debug && ie(e.component), () => {
200
199
  };
201
200
  const t = e.instrumentationProvider, s = [], n = Math.max(0, e.dedupeWindowMs ?? 0), i = /* @__PURE__ */ new Map(), c = (o, r) => {
@@ -358,7 +357,7 @@ function D(e) {
358
357
  function de(e, t) {
359
358
  return e.kind === "value" || e.kind === "null" ? e : t;
360
359
  }
361
- var v, le = p("instrumentation-provider-resolution", () => f());
360
+ var v, le = m("instrumentation-provider-resolution", () => p());
362
361
  function ue() {
363
362
  return v || (v = new ce(), v.initialize()), v;
364
363
  }
@@ -366,7 +365,7 @@ function he(e) {
366
365
  const t = k(e.runtimePlayer), s = k(e.player), n = D(t), i = D(s), c = n ?? i ?? !1, o = de(T(t), T(s));
367
366
  if (o.kind !== "null") {
368
367
  if (o.kind === "unset") return c ? ue() : void 0;
369
- if (j(o.value)) return o.value;
368
+ if (U(o.value)) return o.value;
370
369
  if (e.debug) {
371
370
  const r = e.component ? `[${e.component}] ` : "";
372
371
  le.warn(`${r}Ignoring invalid instrumentation provider; expected InstrumentationProvider contract`);
@@ -406,8 +405,8 @@ var me = [
406
405
  sourceEventName: "assessment-error",
407
406
  instrumentationEventName: "pie-assessment-error"
408
407
  }
409
- ];
410
- function m() {
408
+ ], $e = m("pie-overrides", () => p());
409
+ function f() {
411
410
  return Date.now();
412
411
  }
413
412
  function y(e) {
@@ -581,7 +580,7 @@ var Ie = class {
581
580
  const e = await (await this.getPersistenceStrategy()).loadSession(this.storageContext);
582
581
  e && (this.session = e, this.emit({
583
582
  type: "assessment-session-applied",
584
- timestamp: m()
583
+ timestamp: f()
585
584
  })), this.ensureSession(), this.readiness = "ready";
586
585
  } catch (e) {
587
586
  this.readiness = "error", this.handleError(e, "session-load");
@@ -632,7 +631,7 @@ var Ie = class {
632
631
  const i = this.buildNavigationSnapshot();
633
632
  return this.emit({
634
633
  type: "assessment-route-changed",
635
- timestamp: m(),
634
+ timestamp: f(),
636
635
  currentSectionIndex: i.currentSectionIndex,
637
636
  totalSections: i.totalSections,
638
637
  currentSectionId: i.currentSectionId,
@@ -641,10 +640,10 @@ var Ie = class {
641
640
  canPrevious: i.canPrevious
642
641
  }), this.emit({
643
642
  type: "assessment-session-changed",
644
- timestamp: m()
643
+ timestamp: f()
645
644
  }), this.emit({
646
645
  type: "assessment-progress-changed",
647
- timestamp: m(),
646
+ timestamp: f(),
648
647
  visitedSectionCount: this.ensureSession().navigationState.visitedSectionIdentifiers.length,
649
648
  totalSections: i.totalSections
650
649
  }), !0;
@@ -665,7 +664,7 @@ var Ie = class {
665
664
  async submit() {
666
665
  this.submitted = !0, this.emit({
667
666
  type: "assessment-submission-state-changed",
668
- timestamp: m(),
667
+ timestamp: f(),
669
668
  submitted: !0
670
669
  }), await this.persist();
671
670
  }
@@ -688,7 +687,7 @@ var Ie = class {
688
687
  sectionSession: t
689
688
  }), this.emit({
690
689
  type: "assessment-session-changed",
691
- timestamp: m()
690
+ timestamp: f()
692
691
  });
693
692
  }
694
693
  }, u = {
@@ -740,9 +739,11 @@ var Pe = class extends HTMLElement {
740
739
  this._sectionPlayerRuntime = e, this.isConnected && this.attachInstrumentationBridge();
741
740
  }
742
741
  connectedCallback() {
743
- this.assessmentId || (this.assessmentId = this.getAttribute("assessment-id") || ""), this.attemptId || (this.attemptId = this.getAttribute("attempt-id") || ""), this.showNavigation = this.getAttribute("show-navigation") ?? this.showNavigation, this.sectionPlayerLayout = this.getAttribute("section-player-layout") === "vertical" ? "vertical" : this.sectionPlayerLayout;
744
- const e = this.getAttribute("player-type");
745
- e && (this.playerType = e), this.debug = this.getAttribute("debug") ?? this.debug, this.attachInstrumentationBridge(), this.bootstrapController();
742
+ this.assessmentId || (this.assessmentId = this.getAttribute("assessment-id") || ""), this.attemptId || (this.attemptId = this.getAttribute("attempt-id") || ""), this.showNavigation = this.getAttribute("show-navigation") ?? this.showNavigation;
743
+ const e = this.getAttribute("section-player-layout");
744
+ this.sectionPlayerLayout = e === "vertical" ? "vertical" : this.sectionPlayerLayout;
745
+ const t = this.getAttribute("player-type");
746
+ t && (this.playerType = t), this.debug = this.getAttribute("debug") ?? this.debug, this.attachInstrumentationBridge(), this.bootstrapController();
746
747
  }
747
748
  disconnectedCallback() {
748
749
  this.unsubscribeController?.(), this.detachInstrumentationBridge?.(), this.detachInstrumentationBridge = void 0, this.hooks?.onAssessmentControllerDispose?.(this.controller || void 0);
@@ -768,7 +769,7 @@ var Pe = class extends HTMLElement {
768
769
  hooks: this.hooks || void 0
769
770
  });
770
771
  this.unsubscribeController?.(), this.controller = e, this.unsubscribeController = e.subscribe((t) => {
771
- t.type === "assessment-route-changed" && (this.dispatch(u.routeChanged, t), this.render()), t.type === "assessment-session-applied" && this.dispatch(u.sessionApplied, t), t.type === "assessment-session-changed" && this.dispatch(u.sessionChanged, t), t.type === "assessment-progress-changed" && this.dispatch(u.progressChanged, t), t.type === "assessment-submission-state-changed" && this.dispatch(u.submissionStateChanged, t);
772
+ t.type === "assessment-route-changed" && (this.cleanupTtsForSectionNavigation(t), this.dispatch(u.routeChanged, t), this.render()), t.type === "assessment-session-applied" && this.dispatch(u.sessionApplied, t), t.type === "assessment-session-changed" && this.dispatch(u.sessionChanged, t), t.type === "assessment-progress-changed" && this.dispatch(u.progressChanged, t), t.type === "assessment-submission-state-changed" && this.dispatch(u.submissionStateChanged, t);
772
773
  });
773
774
  try {
774
775
  await e.initialize(), this.readiness = { phase: "ready" }, this.controllerReadyResolve?.(e), this.dispatch(u.controllerReady, { controller: e }), this.hooks?.onAssessmentControllerReady?.(e), this.render();
@@ -803,24 +804,39 @@ var Pe = class extends HTMLElement {
803
804
  buildSectionPlayerTag() {
804
805
  return this.sectionPlayerLayout === "vertical" ? Ee : be;
805
806
  }
807
+ cleanupTtsForSectionNavigation(e) {
808
+ if (e.currentSectionId && e.previousSectionId && e.currentSectionId === e.previousSectionId) return;
809
+ const t = this.coordinator?.ttsService;
810
+ if (t) {
811
+ try {
812
+ t.stop?.();
813
+ } catch {
814
+ }
815
+ try {
816
+ t.requestControlHandoff?.();
817
+ } catch {
818
+ }
819
+ }
820
+ }
806
821
  syncCurrentSectionSessionIntoAssessment() {
807
822
  const e = this.controller;
808
823
  if (!e) return;
809
- const t = this.sectionControllerRef || this.sectionHost?.firstElementChild?.getSectionController?.();
824
+ const t = this.sectionHost?.firstElementChild?.getSectionController?.() || this.sectionControllerRef;
810
825
  if (!t?.getSession) return;
811
826
  const s = e.getCurrentSection();
812
827
  s && e.updateSectionSession(s.sectionIdentifier, t.getSession());
813
828
  }
814
829
  attachSectionControllerReadyListener(e, t) {
815
830
  e.addEventListener("section-controller-ready", async (s) => {
816
- this.sectionControllerRef = s.detail?.controller || null;
817
- const n = this.controller?.getSectionSession(t);
818
- n && this.sectionControllerRef?.applySession && await this.sectionControllerRef.applySession(n, { mode: "replace" });
831
+ const n = s.detail;
832
+ this.sectionControllerRef = n?.controller || null;
833
+ const i = this.controller?.getSectionSession(t);
834
+ i && this.sectionControllerRef?.applySession && await this.sectionControllerRef.applySession(i, { mode: "replace" });
819
835
  }), e.addEventListener("session-changed", () => this.syncCurrentSectionSessionIntoAssessment()), e.addEventListener("item-session-changed", () => this.syncCurrentSectionSessionIntoAssessment());
820
836
  }
821
837
  render() {
822
838
  const e = this.controller;
823
- this.attachInstrumentationBridge(), this.innerHTML = "";
839
+ this.attachInstrumentationBridge(), this.innerHTML = "", this.sectionControllerRef = null;
824
840
  const t = document.createElement("div");
825
841
  t.className = "pie-assessment-player-default";
826
842
  const s = document.createElement("style");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-players/pie-assessment-player",
3
- "version": "0.3.29",
3
+ "version": "0.3.30",
4
4
  "type": "module",
5
5
  "description": "Assessment-level coordinator custom elements for orchestrating section-player instances",
6
6
  "license": "MIT",
@@ -49,16 +49,16 @@
49
49
  "lint": "biome check ."
50
50
  },
51
51
  "dependencies": {
52
- "@pie-players/pie-assessment-toolkit": "0.3.29",
53
- "@pie-players/pie-players-shared": "0.3.29",
54
- "@pie-players/pie-section-player": "0.3.29"
52
+ "@pie-players/pie-assessment-toolkit": "0.3.30",
53
+ "@pie-players/pie-players-shared": "0.3.30",
54
+ "@pie-players/pie-section-player": "0.3.30"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@axe-core/playwright": "^4.11.1",
58
- "@playwright/test": "^1.58.2",
59
- "@biomejs/biome": "^2.3.13",
58
+ "@playwright/test": "^1.59.1",
59
+ "@biomejs/biome": "^2.4.12",
60
60
  "typescript": "^5.9.3",
61
- "vite": "^8.0.1",
61
+ "vite": "^8.0.10",
62
62
  "vite-plugin-dts": "^4.5.4"
63
63
  },
64
64
  "homepage": "https://github.com/pie-framework/pie-players/tree/master/packages/assessment-player#readme",