@pie-players/pie-assessment-player 0.3.29 → 0.3.31
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,OAA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BAAuB,IAAI,0BAA0B,GAAG,IAAI;IAItD,2BAA2B,CAAC,SAAS,SAAO;CAUlD"}
|
|
@@ -1,28 +1,21 @@
|
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
var U = "https://proxy.pie-api.com", H = `${U}/bundles/`;
|
|
5
|
+
function $(e) {
|
|
6
|
+
try {
|
|
7
|
+
const t = {
|
|
8
|
+
BASE_URL: "/",
|
|
9
|
+
DEV: !1,
|
|
10
|
+
MODE: "production",
|
|
11
|
+
PROD: !0,
|
|
12
|
+
SSR: !1
|
|
13
|
+
}[e];
|
|
14
|
+
if (typeof t == "string" && t.length > 0) return t;
|
|
15
|
+
} catch {
|
|
16
|
+
}
|
|
17
17
|
}
|
|
18
|
-
var
|
|
19
|
-
(function(e) {
|
|
20
|
-
e.player = "player.js", e.clientPlayer = "client-player.js", e.editor = "editor.js";
|
|
21
|
-
})(S || (S = {}));
|
|
22
|
-
var P;
|
|
23
|
-
(function(e) {
|
|
24
|
-
e.loading = "loading", e.loaded = "loaded";
|
|
25
|
-
})(P || (P = {}));
|
|
18
|
+
var Le = typeof window < "u" && window.PIE_BUILDER_ORIGIN_URL || $("PUBLIC_BUILDER_ORIGIN_URL") || U, V = typeof window < "u" && window.PIE_BUILDER_BUNDLE_URL || $("PUBLIC_BUILDER_BUNDLE_URL") || H;
|
|
26
19
|
function g(e) {
|
|
27
20
|
"@babel/helpers - typeof";
|
|
28
21
|
return g = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
@@ -31,7 +24,7 @@ function g(e) {
|
|
|
31
24
|
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
32
25
|
}, g(e);
|
|
33
26
|
}
|
|
34
|
-
function
|
|
27
|
+
function J(e, t) {
|
|
35
28
|
if (g(e) != "object" || !e) return e;
|
|
36
29
|
var s = e[Symbol.toPrimitive];
|
|
37
30
|
if (s !== void 0) {
|
|
@@ -41,57 +34,37 @@ function V(e, t) {
|
|
|
41
34
|
}
|
|
42
35
|
return (t === "string" ? String : Number)(e);
|
|
43
36
|
}
|
|
44
|
-
function
|
|
45
|
-
var t =
|
|
37
|
+
function K(e) {
|
|
38
|
+
var t = J(e, "string");
|
|
46
39
|
return g(t) == "symbol" ? t : t + "";
|
|
47
40
|
}
|
|
48
41
|
function a(e, t, s) {
|
|
49
|
-
return (t =
|
|
42
|
+
return (t = K(t)) in e ? Object.defineProperty(e, t, {
|
|
50
43
|
value: s,
|
|
51
44
|
enumerable: !0,
|
|
52
45
|
configurable: !0,
|
|
53
46
|
writable: !0
|
|
54
47
|
}) : e[t] = s, e;
|
|
55
48
|
}
|
|
56
|
-
|
|
57
|
-
loadingScripts: {},
|
|
58
|
-
loadingPromises: {},
|
|
59
|
-
globalLoadQueue: Promise.resolve(),
|
|
60
|
-
activeBundleUrl: null
|
|
61
|
-
});
|
|
62
|
-
var U = "https://proxy.pie-api.com", J = `${U}/bundles/`;
|
|
63
|
-
function B(e) {
|
|
64
|
-
try {
|
|
65
|
-
const t = {
|
|
66
|
-
BASE_URL: "/",
|
|
67
|
-
DEV: !1,
|
|
68
|
-
MODE: "production",
|
|
69
|
-
PROD: !0,
|
|
70
|
-
SSR: !1
|
|
71
|
-
}[e];
|
|
72
|
-
if (typeof t == "string" && t.length > 0) return t;
|
|
73
|
-
} catch {
|
|
74
|
-
}
|
|
75
|
-
}
|
|
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;
|
|
49
|
+
var P;
|
|
77
50
|
(function(e) {
|
|
78
51
|
e.SAVE = "save", e.MODEL = "model", e.SCORE = "score", e.MANUAL_SCORE = "manual-score";
|
|
52
|
+
})(P || (P = {}));
|
|
53
|
+
var N;
|
|
54
|
+
(function(e) {
|
|
55
|
+
e.AUTO = "auto", e.MANUAL = "manual";
|
|
79
56
|
})(N || (N = {}));
|
|
80
57
|
var C;
|
|
81
58
|
(function(e) {
|
|
82
|
-
e.
|
|
59
|
+
e.GATHER = "gather", e.VIEW = "view", e.EVALUATE = "evaluate";
|
|
83
60
|
})(C || (C = {}));
|
|
84
61
|
var A;
|
|
85
|
-
(function(e) {
|
|
86
|
-
e.GATHER = "gather", e.VIEW = "view", e.EVALUATE = "evaluate";
|
|
87
|
-
})(A || (A = {}));
|
|
88
|
-
var x;
|
|
89
62
|
(function(e) {
|
|
90
63
|
e.PENDING = "pending", e.IN_PROGRESS = "in_progress", e.COMPLETED = "completed", e.FAILED = "failed";
|
|
91
|
-
})(
|
|
92
|
-
var W = class
|
|
64
|
+
})(A || (A = {}));
|
|
65
|
+
var W = class B extends CustomEvent {
|
|
93
66
|
constructor(t, s = !1) {
|
|
94
|
-
super(
|
|
67
|
+
super(B.TYPE, {
|
|
95
68
|
bubbles: !0,
|
|
96
69
|
detail: {
|
|
97
70
|
update: t,
|
|
@@ -101,7 +74,7 @@ var W = class $ extends CustomEvent {
|
|
|
101
74
|
}
|
|
102
75
|
};
|
|
103
76
|
a(W, "TYPE", "model.updated");
|
|
104
|
-
var
|
|
77
|
+
var Z = class O extends CustomEvent {
|
|
105
78
|
constructor(t, s) {
|
|
106
79
|
super(O.TYPE, {
|
|
107
80
|
bubbles: !0,
|
|
@@ -112,8 +85,8 @@ var Q = class O extends CustomEvent {
|
|
|
112
85
|
}), a(this, "src", void 0), a(this, "done", void 0), this.src = t, this.done = s;
|
|
113
86
|
}
|
|
114
87
|
};
|
|
115
|
-
a(
|
|
116
|
-
var
|
|
88
|
+
a(Z, "TYPE", "delete.image");
|
|
89
|
+
var Q = class M extends CustomEvent {
|
|
117
90
|
constructor(t) {
|
|
118
91
|
super(M.TYPE, {
|
|
119
92
|
bubbles: !0,
|
|
@@ -121,7 +94,7 @@ var Z = class M extends CustomEvent {
|
|
|
121
94
|
}), a(this, "handler", void 0), this.handler = t;
|
|
122
95
|
}
|
|
123
96
|
};
|
|
124
|
-
a(
|
|
97
|
+
a(Q, "TYPE", "insert.image");
|
|
125
98
|
var X = class F extends CustomEvent {
|
|
126
99
|
constructor(t, s) {
|
|
127
100
|
super(F.TYPE, {
|
|
@@ -156,12 +129,34 @@ var te = class G extends CustomEvent {
|
|
|
156
129
|
}
|
|
157
130
|
};
|
|
158
131
|
a(te, "TYPE", "session-changed");
|
|
159
|
-
var
|
|
132
|
+
var x;
|
|
160
133
|
(function(e) {
|
|
161
134
|
e[e.ROOT = 0] = "ROOT", e[e.SUBJECT = 1] = "SUBJECT", e[e.LEVEL = 2] = "LEVEL", e[e.STANDARD = 3] = "STANDARD";
|
|
135
|
+
})(x || (x = {}));
|
|
136
|
+
function m(e, t) {
|
|
137
|
+
const s = `[${e}]`;
|
|
138
|
+
return {
|
|
139
|
+
debug: (n, ...i) => {
|
|
140
|
+
t() && console.debug(s, n, ...i);
|
|
141
|
+
},
|
|
142
|
+
info: (n, ...i) => console.info(s, n, ...i),
|
|
143
|
+
warn: (n, ...i) => console.warn(s, n, ...i),
|
|
144
|
+
error: (n, ...i) => console.error(s, n, ...i)
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function p() {
|
|
148
|
+
return typeof window < "u" && window.PIE_DEBUG === !0;
|
|
149
|
+
}
|
|
150
|
+
var ke = m("math-rendering", () => p()), S;
|
|
151
|
+
(function(e) {
|
|
152
|
+
e.player = "player.js", e.clientPlayer = "client-player.js", e.editor = "editor.js";
|
|
153
|
+
})(S || (S = {}));
|
|
154
|
+
var R;
|
|
155
|
+
(function(e) {
|
|
156
|
+
e.loading = "loading", e.loaded = "loaded";
|
|
162
157
|
})(R || (R = {}));
|
|
163
|
-
var
|
|
164
|
-
buildServiceBase:
|
|
158
|
+
var Te = m("pie-scoring", () => p()), De = m("pie-updates", () => p()), _e = m("pie-initialization", () => p()), Ue = {
|
|
159
|
+
buildServiceBase: V,
|
|
165
160
|
bundleType: S.player,
|
|
166
161
|
env: {
|
|
167
162
|
mode: "gather",
|
|
@@ -173,7 +168,7 @@ function j(e) {
|
|
|
173
168
|
const t = e;
|
|
174
169
|
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
170
|
}
|
|
176
|
-
var se =
|
|
171
|
+
var se = m("instrumentation-event-bridge", () => p());
|
|
177
172
|
function ne(e) {
|
|
178
173
|
return e && typeof e == "object" ? e : typeof e > "u" ? {} : { value: e };
|
|
179
174
|
}
|
|
@@ -358,7 +353,7 @@ function D(e) {
|
|
|
358
353
|
function de(e, t) {
|
|
359
354
|
return e.kind === "value" || e.kind === "null" ? e : t;
|
|
360
355
|
}
|
|
361
|
-
var v, le =
|
|
356
|
+
var v, le = m("instrumentation-provider-resolution", () => p());
|
|
362
357
|
function ue() {
|
|
363
358
|
return v || (v = new ce(), v.initialize()), v;
|
|
364
359
|
}
|
|
@@ -373,7 +368,12 @@ function he(e) {
|
|
|
373
368
|
}
|
|
374
369
|
}
|
|
375
370
|
}
|
|
376
|
-
var
|
|
371
|
+
var $e = Object.freeze([
|
|
372
|
+
"composed",
|
|
373
|
+
"engine-ready",
|
|
374
|
+
"interactive",
|
|
375
|
+
"disposed"
|
|
376
|
+
]), me = [
|
|
377
377
|
{
|
|
378
378
|
sourceEventName: "assessment-controller-ready",
|
|
379
379
|
instrumentationEventName: "pie-assessment-controller-ready"
|
|
@@ -406,8 +406,8 @@ var me = [
|
|
|
406
406
|
sourceEventName: "assessment-error",
|
|
407
407
|
instrumentationEventName: "pie-assessment-error"
|
|
408
408
|
}
|
|
409
|
-
];
|
|
410
|
-
function
|
|
409
|
+
], Be = m("pie-overrides", () => p());
|
|
410
|
+
function f() {
|
|
411
411
|
return Date.now();
|
|
412
412
|
}
|
|
413
413
|
function y(e) {
|
|
@@ -415,10 +415,10 @@ function y(e) {
|
|
|
415
415
|
}
|
|
416
416
|
function pe(e) {
|
|
417
417
|
if (e.attemptId) return `aas_v1_${y(e.assessmentId)}_${y(e.attemptId)}`;
|
|
418
|
-
const t =
|
|
418
|
+
const t = Y(), s = t ? fe(t) : "anon";
|
|
419
419
|
return `aas_v1_${y(e.assessmentId)}_${y(s)}`;
|
|
420
420
|
}
|
|
421
|
-
function
|
|
421
|
+
function Y() {
|
|
422
422
|
try {
|
|
423
423
|
return typeof window > "u" ? null : window.localStorage;
|
|
424
424
|
} catch {
|
|
@@ -431,11 +431,11 @@ function fe(e) {
|
|
|
431
431
|
const n = `anon-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
|
|
432
432
|
return e.setItem(t, n), n;
|
|
433
433
|
}
|
|
434
|
-
function
|
|
434
|
+
function q() {
|
|
435
435
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
436
436
|
}
|
|
437
437
|
function ge(e) {
|
|
438
|
-
const t =
|
|
438
|
+
const t = q(), s = e.sectionIdentifiers[0];
|
|
439
439
|
return {
|
|
440
440
|
version: 1,
|
|
441
441
|
assessmentAttemptSessionIdentifier: e.assessmentAttemptSessionIdentifier,
|
|
@@ -455,7 +455,7 @@ function ge(e) {
|
|
|
455
455
|
};
|
|
456
456
|
}
|
|
457
457
|
function ve(e, t) {
|
|
458
|
-
const s =
|
|
458
|
+
const s = q();
|
|
459
459
|
return {
|
|
460
460
|
...e,
|
|
461
461
|
updatedAt: s,
|
|
@@ -524,7 +524,7 @@ var Ie = class {
|
|
|
524
524
|
async getPersistenceStrategy() {
|
|
525
525
|
if (this.persistenceStrategy) return this.persistenceStrategy;
|
|
526
526
|
const e = { createDefaultPersistence: () => {
|
|
527
|
-
const t =
|
|
527
|
+
const t = Y(), s = `pie:assessment-controller:v1:${this.storageContext.assessmentId}:${this.storageContext.attemptId || "default"}`;
|
|
528
528
|
return {
|
|
529
529
|
async loadSession() {
|
|
530
530
|
if (!t) return null;
|
|
@@ -581,7 +581,7 @@ var Ie = class {
|
|
|
581
581
|
const e = await (await this.getPersistenceStrategy()).loadSession(this.storageContext);
|
|
582
582
|
e && (this.session = e, this.emit({
|
|
583
583
|
type: "assessment-session-applied",
|
|
584
|
-
timestamp:
|
|
584
|
+
timestamp: f()
|
|
585
585
|
})), this.ensureSession(), this.readiness = "ready";
|
|
586
586
|
} catch (e) {
|
|
587
587
|
this.readiness = "error", this.handleError(e, "session-load");
|
|
@@ -632,7 +632,7 @@ var Ie = class {
|
|
|
632
632
|
const i = this.buildNavigationSnapshot();
|
|
633
633
|
return this.emit({
|
|
634
634
|
type: "assessment-route-changed",
|
|
635
|
-
timestamp:
|
|
635
|
+
timestamp: f(),
|
|
636
636
|
currentSectionIndex: i.currentSectionIndex,
|
|
637
637
|
totalSections: i.totalSections,
|
|
638
638
|
currentSectionId: i.currentSectionId,
|
|
@@ -641,10 +641,10 @@ var Ie = class {
|
|
|
641
641
|
canPrevious: i.canPrevious
|
|
642
642
|
}), this.emit({
|
|
643
643
|
type: "assessment-session-changed",
|
|
644
|
-
timestamp:
|
|
644
|
+
timestamp: f()
|
|
645
645
|
}), this.emit({
|
|
646
646
|
type: "assessment-progress-changed",
|
|
647
|
-
timestamp:
|
|
647
|
+
timestamp: f(),
|
|
648
648
|
visitedSectionCount: this.ensureSession().navigationState.visitedSectionIdentifiers.length,
|
|
649
649
|
totalSections: i.totalSections
|
|
650
650
|
}), !0;
|
|
@@ -665,7 +665,7 @@ var Ie = class {
|
|
|
665
665
|
async submit() {
|
|
666
666
|
this.submitted = !0, this.emit({
|
|
667
667
|
type: "assessment-submission-state-changed",
|
|
668
|
-
timestamp:
|
|
668
|
+
timestamp: f(),
|
|
669
669
|
submitted: !0
|
|
670
670
|
}), await this.persist();
|
|
671
671
|
}
|
|
@@ -688,7 +688,7 @@ var Ie = class {
|
|
|
688
688
|
sectionSession: t
|
|
689
689
|
}), this.emit({
|
|
690
690
|
type: "assessment-session-changed",
|
|
691
|
-
timestamp:
|
|
691
|
+
timestamp: f()
|
|
692
692
|
});
|
|
693
693
|
}
|
|
694
694
|
}, u = {
|
|
@@ -740,9 +740,11 @@ var Pe = class extends HTMLElement {
|
|
|
740
740
|
this._sectionPlayerRuntime = e, this.isConnected && this.attachInstrumentationBridge();
|
|
741
741
|
}
|
|
742
742
|
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
|
|
744
|
-
const e = this.getAttribute("player-
|
|
745
|
-
|
|
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;
|
|
744
|
+
const e = this.getAttribute("section-player-layout");
|
|
745
|
+
this.sectionPlayerLayout = e === "vertical" ? "vertical" : this.sectionPlayerLayout;
|
|
746
|
+
const t = this.getAttribute("player-type");
|
|
747
|
+
t && (this.playerType = t), this.debug = this.getAttribute("debug") ?? this.debug, this.attachInstrumentationBridge(), this.bootstrapController();
|
|
746
748
|
}
|
|
747
749
|
disconnectedCallback() {
|
|
748
750
|
this.unsubscribeController?.(), this.detachInstrumentationBridge?.(), this.detachInstrumentationBridge = void 0, this.hooks?.onAssessmentControllerDispose?.(this.controller || void 0);
|
|
@@ -768,7 +770,7 @@ var Pe = class extends HTMLElement {
|
|
|
768
770
|
hooks: this.hooks || void 0
|
|
769
771
|
});
|
|
770
772
|
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);
|
|
773
|
+
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
774
|
});
|
|
773
775
|
try {
|
|
774
776
|
await e.initialize(), this.readiness = { phase: "ready" }, this.controllerReadyResolve?.(e), this.dispatch(u.controllerReady, { controller: e }), this.hooks?.onAssessmentControllerReady?.(e), this.render();
|
|
@@ -803,24 +805,42 @@ var Pe = class extends HTMLElement {
|
|
|
803
805
|
buildSectionPlayerTag() {
|
|
804
806
|
return this.sectionPlayerLayout === "vertical" ? Ee : be;
|
|
805
807
|
}
|
|
808
|
+
cleanupTtsForSectionNavigation(e) {
|
|
809
|
+
if (e.currentSectionId && e.previousSectionId && e.currentSectionId === e.previousSectionId) return;
|
|
810
|
+
const t = this.coordinator?.ttsService;
|
|
811
|
+
if (t) {
|
|
812
|
+
try {
|
|
813
|
+
t.stop?.();
|
|
814
|
+
} catch {
|
|
815
|
+
}
|
|
816
|
+
try {
|
|
817
|
+
t.requestControlHandoff?.();
|
|
818
|
+
} catch {
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
}
|
|
806
822
|
syncCurrentSectionSessionIntoAssessment() {
|
|
807
823
|
const e = this.controller;
|
|
808
824
|
if (!e) return;
|
|
809
|
-
const t = this.
|
|
825
|
+
const t = this.sectionHost?.firstElementChild?.getSectionController?.() || this.sectionControllerRef;
|
|
810
826
|
if (!t?.getSession) return;
|
|
811
827
|
const s = e.getCurrentSection();
|
|
812
828
|
s && e.updateSectionSession(s.sectionIdentifier, t.getSession());
|
|
813
829
|
}
|
|
814
830
|
attachSectionControllerReadyListener(e, t) {
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
831
|
+
const s = e;
|
|
832
|
+
queueMicrotask(() => {
|
|
833
|
+
(async () => {
|
|
834
|
+
const n = await s.waitForSectionController?.(5e3) || null;
|
|
835
|
+
if (this.sectionControllerRef = n, !n) return;
|
|
836
|
+
const i = this.controller?.getSectionSession(t);
|
|
837
|
+
i && n.applySession && await n.applySession(i, { mode: "replace" });
|
|
838
|
+
})();
|
|
819
839
|
}), e.addEventListener("session-changed", () => this.syncCurrentSectionSessionIntoAssessment()), e.addEventListener("item-session-changed", () => this.syncCurrentSectionSessionIntoAssessment());
|
|
820
840
|
}
|
|
821
841
|
render() {
|
|
822
842
|
const e = this.controller;
|
|
823
|
-
this.attachInstrumentationBridge(), this.innerHTML = "";
|
|
843
|
+
this.attachInstrumentationBridge(), this.innerHTML = "", this.sectionControllerRef = null;
|
|
824
844
|
const t = document.createElement("div");
|
|
825
845
|
t.className = "pie-assessment-player-default";
|
|
826
846
|
const s = document.createElement("style");
|
|
@@ -894,7 +914,7 @@ var Pe = class extends HTMLElement {
|
|
|
894
914
|
const d = typeof this.debug == "boolean" ? String(this.debug) : this.debug;
|
|
895
915
|
r.setAttribute("debug", d);
|
|
896
916
|
}
|
|
897
|
-
r.section = c.section, this.env && (r.env = this.env), this.coordinator && (r.coordinator = this.coordinator), this.sectionPlayerRuntime && (r.runtime = this.sectionPlayerRuntime), r.hooks = { cardTitleFormatter: this.hooks?.cardTitleFormatter }, this.attachSectionControllerReadyListener(r, c.sectionIdentifier)
|
|
917
|
+
r.section = c.section, this.env && (r.env = this.env), this.coordinator && (r.coordinator = this.coordinator), this.sectionPlayerRuntime && (r.runtime = this.sectionPlayerRuntime), r.hooks = { cardTitleFormatter: this.hooks?.cardTitleFormatter }, i.appendChild(r), this.attachSectionControllerReadyListener(r, c.sectionIdentifier);
|
|
898
918
|
}
|
|
899
919
|
t.appendChild(i), this.appendChild(t);
|
|
900
920
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-players/pie-assessment-player",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.31",
|
|
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.
|
|
53
|
-
"@pie-players/pie-players-shared": "0.3.
|
|
54
|
-
"@pie-players/pie-section-player": "0.3.
|
|
52
|
+
"@pie-players/pie-assessment-toolkit": "0.3.31",
|
|
53
|
+
"@pie-players/pie-players-shared": "0.3.31",
|
|
54
|
+
"@pie-players/pie-section-player": "0.3.31"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@axe-core/playwright": "^4.11.1",
|
|
58
|
-
"@playwright/test": "^1.
|
|
59
|
-
"@biomejs/biome": "^2.
|
|
58
|
+
"@playwright/test": "^1.59.1",
|
|
59
|
+
"@biomejs/biome": "^2.4.12",
|
|
60
60
|
"typescript": "^5.9.3",
|
|
61
|
-
"vite": "^8.0.
|
|
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",
|