@pie-players/pie-assessment-toolkit 1.0.0-beta.6 → 1.0.0-beta.8
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/custom-elements.json +7 -0
- package/dist/attempt/TestSession.d.ts +7 -0
- package/dist/attempt/TestSession.js +3 -0
- package/dist/components/ItemScope.custom-element.js +1 -1
- package/dist/components/ItemToolBar.custom-element.js +1 -1
- package/dist/components/PieAssessmentToolkit.custom-element.js +7 -7
- package/dist/components/SectionToolBar.custom-element.js +1 -1
- package/dist/components/chunks/ItemToolBar-bsww9e8f.js +4 -0
- package/dist/components/chunks/{ItemToolBar-pxan157g.js → ItemToolBar-gsb96731.js} +2 -2
- package/dist/components/chunks/ItemToolBar-na4e5vwt.js +2 -0
- package/dist/components/chunks/{ItemToolBar-xwjrpdmz.js → ItemToolBar-wcw4yxjy.js} +1 -1
- package/dist/components/chunks/ItemToolBar-x998kkvy.js +2 -0
- package/dist/components/chunks/ItemToolBar-zvy0hskj.js +40 -0
- package/dist/components/chunks/sre-engine-wazxma67.js +1 -0
- package/dist/context/assessment-toolkit-context.d.ts +8 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/runtime/SectionControllerBinding.d.ts +11 -0
- package/dist/runtime/SectionControllerBinding.js +8 -0
- package/dist/runtime/content-language.d.ts +13 -2
- package/dist/runtime/content-language.js +31 -5
- package/dist/runtime/registration-events.d.ts +28 -1
- package/dist/runtime/registration-events.js +19 -0
- package/dist/runtime/shell-event-bridge.d.ts +7 -1
- package/dist/runtime/shell-event-bridge.js +44 -1
- package/dist/runtime/shell-scope.d.ts +2 -2
- package/dist/runtime/shell-scope.js +14 -5
- package/dist/services/AccessibilityCatalogResolver.js +9 -5
- package/dist/services/SSMLExtractor.js +8 -23
- package/dist/services/TTSService.d.ts +4 -3
- package/dist/services/TTSService.js +8 -5
- package/dist/services/ToolRegistry.d.ts +11 -3
- package/dist/services/ToolRegistry.js +8 -4
- package/dist/services/ToolkitCoordinator.d.ts +12 -47
- package/dist/services/ToolkitCoordinator.js +45 -284
- package/dist/services/section-controller-types.d.ts +40 -0
- package/dist/services/tool-config-validation.d.ts +1 -1
- package/dist/services/tool-context.js +94 -11
- package/dist/services/tool-icons.js +2 -0
- package/dist/services/tool-provider-defaults.d.ts +13 -0
- package/dist/services/tool-provider-defaults.js +20 -0
- package/dist/services/tts/browser-provider.js +3 -1
- package/dist/services/tts/math-control-names.d.ts +3 -1
- package/dist/services/tts/math-control-names.js +42 -2
- package/dist/services/tts/tts-lifecycle.d.ts +142 -0
- package/dist/services/tts/tts-lifecycle.js +341 -0
- package/dist/tools/content-surfaces.d.ts +35 -0
- package/dist/tools/content-surfaces.js +35 -0
- package/dist/tools/registration.d.ts +2 -0
- package/dist/tools/registration.js +5 -0
- package/package.json +9 -9
- package/dist/components/chunks/ItemToolBar-4vq9nbxz.js +0 -2
- package/dist/components/chunks/ItemToolBar-f971t0cw.js +0 -4
- package/dist/components/chunks/ItemToolBar-n05xjkp8.js +0 -2
- package/dist/components/chunks/ItemToolBar-rgmvw9sm.js +0 -40
- package/dist/components/chunks/sre-engine-dq0w45fv.js +0 -1
package/custom-elements.json
CHANGED
|
@@ -173,6 +173,13 @@
|
|
|
173
173
|
},
|
|
174
174
|
"description": "In a toolkit that holds a section, when the item player reports a response change; the player's own `session-changed` stops at the scope."
|
|
175
175
|
},
|
|
176
|
+
{
|
|
177
|
+
"name": "item-player-event",
|
|
178
|
+
"type": {
|
|
179
|
+
"text": "CustomEvent<{ itemId: string; canonicalItemId: string; type: \"load-complete\" | \"player-error\" | \"correct-responses-populated\" | \"bundle-retry-status\" | \"session-snapshot-available\" | \"backend-load-complete\" | \"backend-model-complete\" | \"backend-session-saved\" | \"backend-score-complete\" | \"backend-error\"; detail: unknown }>"
|
|
180
|
+
},
|
|
181
|
+
"description": "In a toolkit that holds a section, when the item player fires one of these events, carrying its detail; `load-complete` and `player-error` still stop at the scope."
|
|
182
|
+
},
|
|
176
183
|
{
|
|
177
184
|
"name": "pie-item-session-changed",
|
|
178
185
|
"type": {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ServedContentIdentity } from "@pie-players/pie-players-shared/types";
|
|
1
2
|
export interface TestAttemptSessionNavigationState {
|
|
2
3
|
currentItemIndex: number;
|
|
3
4
|
visitedItemIdentifiers: string[];
|
|
@@ -29,6 +30,11 @@ export interface TestAttemptItemSession {
|
|
|
29
30
|
updatedAt?: string;
|
|
30
31
|
completedAt?: string;
|
|
31
32
|
session?: unknown;
|
|
33
|
+
/**
|
|
34
|
+
* The content version this item was delivered as, and its language. Present
|
|
35
|
+
* when the item declares a language or a backend reported what it served.
|
|
36
|
+
*/
|
|
37
|
+
content?: ServedContentIdentity;
|
|
32
38
|
}
|
|
33
39
|
export interface TestAttemptSession {
|
|
34
40
|
version: 1;
|
|
@@ -67,5 +73,6 @@ export declare function upsertItemSessionFromPieSessionChange(session: TestAttem
|
|
|
67
73
|
pieSessionId: string;
|
|
68
74
|
isCompleted?: boolean;
|
|
69
75
|
session?: unknown;
|
|
76
|
+
content?: ServedContentIdentity;
|
|
70
77
|
}): TestAttemptSession;
|
|
71
78
|
export declare function toItemSessionsRecord(testAttemptSession: TestAttemptSession): Record<string, unknown>;
|
|
@@ -70,6 +70,9 @@ export function upsertItemSessionFromPieSessionChange(session, args) {
|
|
|
70
70
|
updatedAt: now,
|
|
71
71
|
completedAt: completed ? existing?.completedAt || now : undefined,
|
|
72
72
|
session: args.session ?? existing?.session,
|
|
73
|
+
...(args.content || existing?.content
|
|
74
|
+
? { content: args.content ?? existing?.content }
|
|
75
|
+
: {}),
|
|
73
76
|
};
|
|
74
77
|
return {
|
|
75
78
|
...session,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as wJ,c as g,d as o,e as u,f as p,g as m,h as E,i as T,j as S,k as c,p as _}from"./chunks/ItemToolBar-x998kkvy.js";import{A as JJ,B as QJ,C as ZJ,D as f,E as XJ,F as qJ,I as WJ,K as UJ,L as y,N as C,R as YJ,T as MJ,Z as jJ,_ as zJ,ea as KJ,fa as k,ga as xJ,ja as i,ka as t,la as P,oa as b,pa as v,qa as OJ,ra as d}from"./chunks/ItemToolBar-bsww9e8f.js";import"./chunks/ItemToolBar-wcw4yxjy.js";import{commitPendingSessions as AJ,createPieLogger as FJ,normalizeItemSessionChange as LJ}from"@pie-players/pie-players-shared";function VJ(Q){let J=Q&&typeof Q==="object"?{...Q}:Q;if(J&&typeof J==="object")delete J.timestamp,delete J.sourceRuntimeId;try{return JSON.stringify(J)}catch{return String(J)}}var fJ=(Q)=>Boolean(Q&&typeof Q==="object"&&Q.sessionSource==="correct-response"),kJ=(Q)=>Boolean(Q&&typeof Q==="object"&&Q.sessionCommitReason);function l(Q){let{host:J,kind:Z,identity:U,mode:z,send:Y}=Q,M=FJ(J.localName||"pie-shell",()=>!1),x="",O=(j)=>{let{itemId:W,canonicalItemId:K}=U();if(!W)return;Y(u,{itemId:W,session:j});let X=LJ({itemId:W,sessionDetail:j});if(X.intent==="metadata-only"||!X.session)return;let L={itemId:W,canonicalItemId:K||W,session:X.session,...X.sessionCommitReason?{sessionCommitReason:X.sessionCommitReason}:{}};P(J,p,L)},w=(j)=>{if(z()!=="section")return;if(j.stopPropagation(),Z!=="item")return;let W=j.detail;if(fJ(W))return;let K=VJ(W);if(!kJ(W)&&K===x)return;x=K,O(W)},A=(j)=>{if(z()==="section")j.stopPropagation();let{itemId:W,canonicalItemId:K,contentKind:q}=U();if(!W)return;let X={itemId:W,canonicalItemId:K||W,contentKind:q,detail:j.detail};Y(T,X)},F=(j)=>{if(z()!=="section"||Z!=="item")return;let W=j.detail;if(W?.scope!=="delivery")return;let{itemId:K,canonicalItemId:q}=U();if(!K)return;let X={itemId:K,canonicalItemId:q||K,...W.identity?{identity:W.identity}:{}};Y(S,X)},V=(j)=>{if(z()==="section")j.stopPropagation();let{itemId:W,canonicalItemId:K,contentKind:q}=U();if(!W)return;let X={itemId:W,canonicalItemId:K||W,contentKind:q,error:j.detail};Y(c,X)},B=(j)=>{if(z()!=="section"||Z!=="item")return;let{itemId:W,canonicalItemId:K}=U();if(!W)return;let q={itemId:W,canonicalItemId:K||W,type:j.type,detail:j.detail};P(J,m,q)};J.addEventListener("session-changed",w),J.addEventListener("load-complete",A),J.addEventListener("backend-load-complete",F),J.addEventListener("player-error",V);for(let j of E)J.addEventListener(j,B);return{disconnect:()=>{try{if(Z==="item"&&z()==="section")AJ(J,{reason:"teardown",logger:M})}finally{J.removeEventListener("session-changed",w),J.removeEventListener("load-complete",A),J.removeEventListener("backend-load-complete",F),J.removeEventListener("player-error",V);for(let j of E)J.removeEventListener(j,B)}}}}import{ContextProvider as CJ}from"@pie-players/pie-context";function HJ(Q,J){return Q.kind===J.kind&&Q.host===J.host&&Q.itemId===J.itemId&&Q.canonicalItemId===J.canonicalItemId&&Q.contentKind===J.contentKind&&d(Q.settings,J.settings)}function r(Q){return _(Q.item,Q.kind)}function $(Q,J){return Q.isConnected||!J?Q:J.eventTarget}function I(Q,J,Z){let U={kind:J.kind,itemId:J.itemId,canonicalItemId:J.canonicalItemId,contentKind:J.contentKind,item:J.item,...J.settings?{settings:J.settings}:{},element:J.host,...Z?{runtimeId:Z.runtimeId}:{}};P($(J.host,Z),Q,U)}function s(){let Q=null,J=null,Z;function U(){let Y=Q;if(!Y)return;let M=Z;Q=null,J=null,Z=void 0,I(o,Y,M)}function z(Y,M){if(!Y){U();return}if(Q&&Z?.runtimeId!==M?.runtimeId)U();if(Q&&HJ(Q,Y)){if(Q.item===Y.item)return;let x=r(Y);if(x!==null&&x===J){Q=Y;return}Q=Y,J=x,I(g,Y,M);return}Q=Y,J=r(Y),Z=M,I(g,Y,M)}return{sync:z,retire:U}}var PJ=50;function n(Q,J,Z){let U=new CJ(Q,{context:J,initialValue:Z});return U.connect(),{provider:U,value:Z}}function a(Q,J,Z){if(Z(Q.value,J))return;Q.value=J,Q.provider.setValue(J)}var DJ=(Q,J,Z)=>{if(Q===J)return!0;if(!Q||!J)return!1;if(Q.id!==J.id)return!1;let U=_(Q,Z);return U!==null&&U===_(J,Z)},TJ=(Q,J)=>Q.kind===J.kind&&Q.itemId===J.itemId&&Q.canonicalItemId===J.canonicalItemId&&Q.contentKind===J.contentKind&&Q.regionPolicy===J.regionPolicy&&Q.scopeElement===J.scopeElement&&DJ(Q.item,J.item,Q.kind),SJ=(Q,J)=>Q.scopeElement===J.scopeElement&&Q.ttsHighlightTargetResolver===J.ttsHighlightTargetResolver,N=(Q,J,Z)=>{if(Q.getAttribute(J)!==Z)Q.setAttribute(J,Z)};function e(){let Q=s(),J=Date.now(),Z=null,U=null,z=null,Y=null,M=null,x=null,O=[],w=null,A=null,F=()=>{if(M!==null)Q.sync(x,M)},V=(q,X)=>q.isConnected&&X.eventTarget.isConnected===!1;function B(q,X){if(q===T)w=X;if(q===S)A=X;if(Z&&M!==null&&!V(Z,M)){P($(Z,M),q,{...X,runtimeId:M.runtimeId});return}if(O.push({type:q,detail:X}),O.length>PJ)O.shift()}function j(q){let X=M!==null&&q.runtimeId!==M.runtimeId;if(q.runtimeId!==M?.runtimeId)M={runtimeId:q.runtimeId,eventTarget:q.eventTarget},F();let L=O;O=[];for(let G of L)B(G.type,G.detail);if(!X)return;let H=(G)=>L.some((D)=>D.type===G);if(A&&!H(S))B(S,A);if(w&&!H(T))B(T,w)}function W(){for(let q of[U,z])q?.provider.disconnect();Y?.(),Y=null,M=null,O=[],w=null,A=null,x=null,U=null,z=null,Z=null}function K(q){if(!q){Q.sync(null),W();return}if(q.host!==Z)W();Z=q.host;let X=q.canonicalItemId||q.itemId,L=q.regionPolicy||"default",H=q.scopeElement||q.host,G={kind:q.kind,itemId:q.itemId,canonicalItemId:X,contentKind:q.contentKind,regionPolicy:L,scopeElement:H,item:q.item??null,contextVersion:J};if(U)a(U,G,TJ);else U=n(Z,i,G);let D={scopeElement:H,ttsHighlightTargetResolver:q.ttsHighlightTargetResolver??null};if(z)a(z,D,SJ);else z=n(Z,t,D);N(Z,"data-item-id",q.itemId),N(Z,"data-canonical-item-id",X),N(Z,"data-pie-shell-root",q.kind),N(Z,"data-region-policy",L);let R=x;if(x=q.itemId?{kind:q.kind,host:Z,itemId:q.itemId,canonicalItemId:X,contentKind:q.contentKind,item:q.item??null,settings:q.settings??null}:null,R&&(R.itemId!==x?.itemId||R.canonicalItemId!==x?.canonicalItemId))w=null;Y??=b(Z,j),F()}return{publish:K,retire:Q.retire,disconnect:W,send:B}}var RJ=(Q,J)=>{if(customElements.get(Q))return;try{customElements.define(Q,J)}catch(Z){if(!(Z instanceof DOMException&&Z.name==="NotSupportedError"||Z&&typeof Z==="object"&&Z.name==="NotSupportedError")||!customElements.get(Q))throw Z}},_J=YJ('<div class="pie-item-scope-anchor svelte-980v5l" aria-hidden="true"></div> <!>',1),NJ={hash:"svelte-980v5l",code:".pie-item-scope-anchor.svelte-980v5l {display:none;}"};function BJ(Q,J){JJ(J,!0),zJ(Q,NJ);let Z=k(J,"itemId",7,""),U=k(J,"canonicalItemId",7,""),z=k(J,"contentKind",7,"assessment-item"),Y=k(J,"regionPolicy",7,"default"),M=k(J,"scopeElement",7,null),x=k(J,"ttsHighlightTargetResolver",7,null),O=k(J,"item",7,null),w=k(J,"settings",7,null),A=XJ(null),F=ZJ(()=>{let X=C(A)?.getRootNode();return X instanceof ShadowRoot?X.host:null}),V=e(),B=null;y(()=>{if(!C(F))return;let X=C(F),L=!1,H=!1,G=wJ(X);B=G;let D=b(X,(h)=>{H=!0,L=h.sectionBound===!0,G.setCoordinator(h.coordinator??null)}),R=setTimeout(()=>{if(H||!X.isConnected)return;OJ(X.ownerDocument,"itemScopeWithoutToolkit",`[pie-item-scope] No <pie-assessment-toolkit> has answered item "${Z()}" after ${v/1000} s, so the item is not registered and the tools inside the scope have no runtime. Place the scope inside the toolkit element; it keeps waiting for one. Reported once per page.`)},v),GJ=l({host:X,kind:"item",identity:()=>({itemId:Z(),canonicalItemId:U(),contentKind:z()}),mode:()=>L?"section":"plain",send:V.send});return()=>{clearTimeout(R);try{GJ.disconnect()}finally{if(D(),V.retire(),V.disconnect(),G.disconnect(),B===G)B=null}}}),y(()=>{V.publish(C(F)?{host:C(F),kind:"item",itemId:Z(),canonicalItemId:U(),contentKind:z(),regionPolicy:Y(),scopeElement:M(),ttsHighlightTargetResolver:x(),item:O(),settings:w()}:null),B?.setItem(C(F)?{itemId:Z(),canonicalItemId:U()}:null)});var j={get itemId(){return Z()},set itemId(X){Z(X),f()},get canonicalItemId(){return U()},set canonicalItemId(X){U(X),f()},get contentKind(){return z()},set contentKind(X){z(X),f()},get regionPolicy(){return Y()},set regionPolicy(X){Y(X),f()},get scopeElement(){return M()},set scopeElement(X){M(X),f()},get ttsHighlightTargetResolver(){return x()},set ttsHighlightTargetResolver(X){x(X),f()},get item(){return O()},set item(X){O(X),f()},get settings(){return w()},set settings(X){w(X),f()}},W=_J(),K=WJ(W);KJ(K,(X)=>qJ(A,X),()=>C(A));var q=UJ(K,2);return jJ(q,J,"default",{},null),MJ(Q,W),QJ(j)}RJ("pie-item-scope",xJ(BJ,{itemId:{attribute:"item-id",type:"String"},canonicalItemId:{attribute:"canonical-item-id",type:"String"},contentKind:{attribute:"content-kind",type:"String"},regionPolicy:{attribute:"region-policy",type:"String"},scopeElement:{type:"Object"},ttsHighlightTargetResolver:{type:"Object"},item:{type:"Object"},settings:{type:"Object"}},["default"],[],{mode:"open"}));export{BJ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{q as a}from"./chunks/ItemToolBar-zvy0hskj.js";import"./chunks/ItemToolBar-na4e5vwt.js";import"./chunks/ItemToolBar-bsww9e8f.js";import"./chunks/ItemToolBar-wcw4yxjy.js";export{a as default};
|