@pie-players/pie-assessment-toolkit 1.0.0-beta.3 → 1.0.0-beta.5
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 +15 -7
- package/custom-elements.json +19 -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-4vq9nbxz.js +2 -0
- package/dist/components/chunks/{ItemToolBar-jpac75fa.js → ItemToolBar-f971t0cw.js} +1 -1
- package/dist/components/chunks/{ItemToolBar-341vf20n.js → ItemToolBar-n05xjkp8.js} +2 -2
- package/dist/components/chunks/{ItemToolBar-66hcwmfw.js → ItemToolBar-pxan157g.js} +2 -2
- package/dist/components/chunks/ItemToolBar-rgmvw9sm.js +40 -0
- package/dist/components/chunks/{ItemToolBar-kkj69ptr.js → ItemToolBar-xwjrpdmz.js} +1 -1
- package/dist/components/chunks/sre-engine-dq0w45fv.js +1 -0
- package/dist/policy/core/ToolPolicyEngine.d.ts +8 -0
- package/dist/policy/core/ToolPolicyEngine.js +4 -2
- package/dist/policy/core/compose-decision.d.ts +7 -1
- package/dist/policy/core/compose-decision.js +29 -0
- package/dist/policy/core/decision-types.d.ts +20 -0
- package/dist/policy/core/feature-decision.d.ts +8 -1
- package/dist/policy/core/feature-decision.js +9 -2
- package/dist/policy/core/provenance.d.ts +1 -1
- package/dist/policy/engine.d.ts +2 -1
- package/dist/policy/sources/PnpPolicySource.d.ts +44 -2
- package/dist/policy/sources/PnpPolicySource.js +80 -11
- package/dist/runtime/core/engine-resolver.d.ts +17 -0
- package/dist/runtime/item-feature-decisions.d.ts +44 -0
- package/dist/runtime/item-feature-decisions.js +115 -0
- package/dist/services/ToolkitCoordinator.d.ts +9 -0
- package/dist/services/ToolkitCoordinator.js +23 -0
- package/dist/services/interfaces.d.ts +10 -0
- package/dist/services/support-conflicts.d.ts +10 -0
- package/dist/services/support-conflicts.js +11 -0
- package/dist/services/tool-config-validation.js +8 -2
- package/dist/services/tool-icons.js +1 -0
- package/package.json +6 -6
- package/dist/components/chunks/ItemToolBar-qvtpthc9.js +0 -40
- package/dist/components/chunks/ItemToolBar-vdkyn9f3.js +0 -2
- package/dist/components/chunks/sre-engine-bj997w4b.js +0 -1
package/README.md
CHANGED
|
@@ -151,7 +151,10 @@ string and boolean attributes are `assessment-id`, `section-id`, `attempt-id`,
|
|
|
151
151
|
- Runtime config on section-player custom elements: `runtime`
|
|
152
152
|
- Toolkit-only object properties: `tools`, `toolRegistry`, `coordinator`,
|
|
153
153
|
`accessibility`
|
|
154
|
-
- Interface: `nds-icons`, `locale`
|
|
154
|
+
- Interface: `nds-icons`, `locale`. The toolkit stamps `lang` and `dir` from
|
|
155
|
+
the interface locale on its own host element, never on the document, and it
|
|
156
|
+
answers `interfaceLocaleContext` (`@pie-players/pie-context`) from the same
|
|
157
|
+
locale for the PIE elements inside it, as `{ locale, direction }`
|
|
155
158
|
- Diagnostics: `tool-config-strictness`, and `debug` on the section-player layouts. Framework-error
|
|
156
159
|
delivery is via the `onFrameworkError` callback (a toolkit property,
|
|
157
160
|
`runtime.onFrameworkError` on a section player) and the
|
|
@@ -538,8 +541,9 @@ tools: {
|
|
|
538
541
|
calculator
|
|
539
542
|
- **Annotation toolbar** (`annotationToolbar`): highlights and annotates
|
|
540
543
|
selected text; it opens from a text selection, outside the toolbars
|
|
541
|
-
- **Line reader** (`lineReader`), **
|
|
542
|
-
(`protractor`), **graph** (`graph`) and **periodic
|
|
544
|
+
- **Line reader** (`lineReader`), **magnifier** (`magnification`), **ruler**
|
|
545
|
+
(`ruler`), **protractor** (`protractor`), **graph** (`graph`) and **periodic
|
|
546
|
+
table** (`periodicTable`)
|
|
543
547
|
- **Dictionaries** (`dictionary`, `pictureDictionary`, `dictionarySpanish`,
|
|
544
548
|
`pictureDictionarySpanish`)
|
|
545
549
|
|
|
@@ -575,6 +579,7 @@ tools: {
|
|
|
575
579
|
- **Protractor** (`protractor`): angle measurement
|
|
576
580
|
- **Ruler** (`ruler`): linear measurement (metric and imperial)
|
|
577
581
|
- **Line reader** (`lineReader`): reading guide and masking overlay
|
|
582
|
+
- **Magnifier** (`magnification`): movable magnifying lens
|
|
578
583
|
- **Dictionaries** (`dictionary`, `pictureDictionary`, `dictionarySpanish`,
|
|
579
584
|
`pictureDictionarySpanish`)
|
|
580
585
|
- **The color-scheme tool** (`theme`): high-contrast color schemes; it also
|
|
@@ -668,9 +673,12 @@ providers: {
|
|
|
668
673
|
}
|
|
669
674
|
```
|
|
670
675
|
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
676
|
+
The bundled open-source implementation uses no API key or runtime network
|
|
677
|
+
request and supports basic, scientific, and focused graphing modes. It is
|
|
678
|
+
outside the packaged set, so the host first adds it with
|
|
679
|
+
`createCalculatorToolRegistration`
|
|
680
|
+
([Adding a backend](../default-tool-loaders/README.md#adding-a-backend)) and then
|
|
681
|
+
selects it in the same way:
|
|
674
682
|
|
|
675
683
|
```typescript
|
|
676
684
|
providers: {
|
|
@@ -922,7 +930,7 @@ export interface ToolkitCoordinatorConfig {
|
|
|
922
930
|
calculator?: {
|
|
923
931
|
enabled?: boolean;
|
|
924
932
|
provider?: {
|
|
925
|
-
id?: 'calculator-desmos'
|
|
933
|
+
id?: string; // 'calculator-desmos' (default), 'calculator-geogebra', or a composed-in backend
|
|
926
934
|
init?: Record<string, unknown>;
|
|
927
935
|
runtime?: {
|
|
928
936
|
authFetcher?: () => Promise<Record<string, unknown>>;
|
package/custom-elements.json
CHANGED
|
@@ -586,6 +586,16 @@
|
|
|
586
586
|
"description": "Interface locale, published onto the runtime context so every tool resolves the same provider. `type: \"String\"` because hosts pass attribute values as strings and a BCP-47 tag is one; POSIX (`nl_NL`) and bare (`nl`) forms both resolve.",
|
|
587
587
|
"attribute": "locale"
|
|
588
588
|
},
|
|
589
|
+
{
|
|
590
|
+
"kind": "field",
|
|
591
|
+
"name": "i18n",
|
|
592
|
+
"type": {
|
|
593
|
+
"text": "I18nProvider | null"
|
|
594
|
+
},
|
|
595
|
+
"default": "null",
|
|
596
|
+
"description": "The interface-locale provider a host composes, published onto the runtime context in place of the one built here: the generated locale tier, host messages, or a provider of the host's own. JS-only, since it carries loaders. `locale` above still names the locale; a supplied provider is driven only by it.",
|
|
597
|
+
"attribute": "i18n"
|
|
598
|
+
},
|
|
589
599
|
{
|
|
590
600
|
"kind": "field",
|
|
591
601
|
"name": "contentLanguage",
|
|
@@ -882,6 +892,15 @@
|
|
|
882
892
|
"description": "Interface locale, published onto the runtime context so every tool resolves the same provider. `type: \"String\"` because hosts pass attribute values as strings and a BCP-47 tag is one; POSIX (`nl_NL`) and bare (`nl`) forms both resolve.",
|
|
883
893
|
"fieldName": "locale"
|
|
884
894
|
},
|
|
895
|
+
{
|
|
896
|
+
"name": "i18n",
|
|
897
|
+
"type": {
|
|
898
|
+
"text": "I18nProvider | null"
|
|
899
|
+
},
|
|
900
|
+
"default": "null",
|
|
901
|
+
"description": "The interface-locale provider a host composes, published onto the runtime context in place of the one built here: the generated locale tier, host messages, or a provider of the host's own. JS-only, since it carries loaders. `locale` above still names the locale; a supplied provider is driven only by it.",
|
|
902
|
+
"fieldName": "i18n"
|
|
903
|
+
},
|
|
885
904
|
{
|
|
886
905
|
"name": "content-language",
|
|
887
906
|
"type": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as jJ,c as b,d as c,e as v,f as $,g as D,h,m as R}from"./chunks/ItemToolBar-4vq9nbxz.js";import{A as F,B as e,C as JJ,F as QJ,H as ZJ,I,K as f,O as XJ,Q as qJ,W as WJ,X as YJ,ba as UJ,ca as V,da as MJ,ga as o,ha as s,ia as P,la as _,ma as g,na as BJ,oa as m,x as a,y as i,z as t}from"./chunks/ItemToolBar-f971t0cw.js";import"./chunks/ItemToolBar-xwjrpdmz.js";import{commitPendingSessions as OJ,createPieLogger as wJ,normalizeItemSessionChange as AJ}from"@pie-players/pie-players-shared";function GJ(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 kJ=(Q)=>Boolean(Q&&typeof Q==="object"&&Q.sessionCommitReason);function p(Q){let{host:J,kind:Z,identity:W,mode:j,send:Y}=Q,U=wJ(J.localName||"pie-shell",()=>!1),z="",O=(B)=>{let{itemId:M,canonicalItemId:x}=W();if(!M)return;Y(v,{itemId:M,session:B});let X=AJ({itemId:M,sessionDetail:B});if(X.intent==="metadata-only"||!X.session)return;let K={itemId:M,canonicalItemId:x||M,session:X.session,...X.sessionCommitReason?{sessionCommitReason:X.sessionCommitReason}:{}};P(J,$,K)},w=(B)=>{if(j()!=="section")return;if(B.stopPropagation(),Z!=="item")return;let M=B.detail,x=GJ(M);if(!kJ(M)&&x===z)return;z=x,O(M)},k=(B)=>{if(j()==="section")B.stopPropagation();let{itemId:M,canonicalItemId:x,contentKind:L}=W();if(!M)return;let X={itemId:M,canonicalItemId:x||M,contentKind:L,detail:B.detail};Y(D,X)},A=(B)=>{if(j()==="section")B.stopPropagation();let{itemId:M,canonicalItemId:x,contentKind:L}=W();if(!M)return;let X={itemId:M,canonicalItemId:x||M,contentKind:L,error:B.detail};Y(h,X)};return J.addEventListener("session-changed",w),J.addEventListener("load-complete",k),J.addEventListener("player-error",A),{disconnect:()=>{try{if(Z==="item"&&j()==="section")OJ(J,{reason:"teardown",logger:U})}finally{J.removeEventListener("session-changed",w),J.removeEventListener("load-complete",k),J.removeEventListener("player-error",A)}}}}import{ContextProvider as FJ}from"@pie-players/pie-context";function LJ(Q,J){return Q.kind===J.kind&&Q.host===J.host&&Q.itemId===J.itemId&&Q.canonicalItemId===J.canonicalItemId&&Q.contentKind===J.contentKind&&m(Q.settings,J.settings)}function u(Q){return R(Q.item,Q.kind)}function E(Q,J){return Q.isConnected||!J?Q:J.eventTarget}function N(Q,J,Z){let W={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(E(J.host,Z),Q,W)}function l(){let Q=null,J=null,Z;function W(){let Y=Q;if(!Y)return;let U=Z;Q=null,J=null,Z=void 0,N(c,Y,U)}function j(Y,U){if(!Y){W();return}if(Q&&Z?.runtimeId!==U?.runtimeId)W();if(Q&&LJ(Q,Y)){if(Q.item===Y.item)return;let z=u(Y);if(z!==null&&z===J){Q=Y;return}Q=Y,J=z,N(b,Y,U);return}Q=Y,J=u(Y),Z=U,N(b,Y,U)}return{sync:j,retire:W}}var VJ=50;function r(Q,J,Z){let W=new FJ(Q,{context:J,initialValue:Z});return W.connect(),{provider:W,value:Z}}function d(Q,J,Z){if(Z(Q.value,J))return;Q.value=J,Q.provider.setValue(J)}var fJ=(Q,J,Z)=>{if(Q===J)return!0;if(!Q||!J)return!1;if(Q.id!==J.id)return!1;let W=R(Q,Z);return W!==null&&W===R(J,Z)},HJ=(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&&fJ(Q.item,J.item,Q.kind),CJ=(Q,J)=>Q.scopeElement===J.scopeElement&&Q.ttsHighlightTargetResolver===J.ttsHighlightTargetResolver,S=(Q,J,Z)=>{if(Q.getAttribute(J)!==Z)Q.setAttribute(J,Z)};function n(){let Q=l(),J=Date.now(),Z=null,W=null,j=null,Y=null,U=null,z=null,O=[],w=null,k=()=>{if(U!==null)Q.sync(z,U)},A=(X,K)=>X.isConnected&&K.eventTarget.isConnected===!1;function B(X,K){if(X===D)w=K;if(Z&&U!==null&&!A(Z,U)){P(E(Z,U),X,{...K,runtimeId:U.runtimeId});return}if(O.push({type:X,detail:K}),O.length>VJ)O.shift()}function M(X){let K=U!==null&&X.runtimeId!==U.runtimeId;if(X.runtimeId!==U?.runtimeId)U={runtimeId:X.runtimeId,eventTarget:X.eventTarget},k();let q=O;O=[];for(let G of q)B(G.type,G.detail);let H=q.some((G)=>G.type===D);if(K&&w&&!H)B(D,w)}function x(){for(let X of[W,j])X?.provider.disconnect();Y?.(),Y=null,U=null,O=[],w=null,z=null,W=null,j=null,Z=null}function L(X){if(!X){Q.sync(null),x();return}if(X.host!==Z)x();Z=X.host;let K=X.canonicalItemId||X.itemId,q=X.regionPolicy||"default",H=X.scopeElement||X.host,G={kind:X.kind,itemId:X.itemId,canonicalItemId:K,contentKind:X.contentKind,regionPolicy:q,scopeElement:H,item:X.item??null,contextVersion:J};if(W)d(W,G,HJ);else W=r(Z,o,G);let C={scopeElement:H,ttsHighlightTargetResolver:X.ttsHighlightTargetResolver??null};if(j)d(j,C,CJ);else j=r(Z,s,C);S(Z,"data-item-id",X.itemId),S(Z,"data-canonical-item-id",K),S(Z,"data-pie-shell-root",X.kind),S(Z,"data-region-policy",q);let T=z;if(z=X.itemId?{kind:X.kind,host:Z,itemId:X.itemId,canonicalItemId:K,contentKind:X.contentKind,item:X.item??null,settings:X.settings??null}:null,T&&(T.itemId!==z?.itemId||T.canonicalItemId!==z?.canonicalItemId))w=null;Y??=_(Z,M),k()}return{publish:L,retire:Q.retire,disconnect:x,send:B}}var PJ=(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}},DJ=XJ('<div class="pie-item-scope-anchor svelte-980v5l" aria-hidden="true"></div> <!>',1),TJ={hash:"svelte-980v5l",code:".pie-item-scope-anchor.svelte-980v5l {display:none;}"};function zJ(Q,J){a(J,!0),YJ(Q,TJ);let Z=V(J,"itemId",7,""),W=V(J,"canonicalItemId",7,""),j=V(J,"contentKind",7,"assessment-item"),Y=V(J,"regionPolicy",7,"default"),U=V(J,"scopeElement",7,null),z=V(J,"ttsHighlightTargetResolver",7,null),O=V(J,"item",7,null),w=V(J,"settings",7,null),k=e(null),A=t(()=>{let q=f(k)?.getRootNode();return q instanceof ShadowRoot?q.host:null}),B=n(),M=null;I(()=>{if(!f(A))return;let q=f(A),H=!1,G=!1,C=jJ(q);M=C;let T=_(q,(y)=>{G=!0,H=y.sectionBound===!0,C.setCoordinator(y.coordinator??null)}),KJ=setTimeout(()=>{if(G||!q.isConnected)return;BJ(q.ownerDocument,"itemScopeWithoutToolkit",`[pie-item-scope] No <pie-assessment-toolkit> has answered item "${Z()}" after ${g/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.`)},g),xJ=p({host:q,kind:"item",identity:()=>({itemId:Z(),canonicalItemId:W(),contentKind:j()}),mode:()=>H?"section":"plain",send:B.send});return()=>{clearTimeout(KJ);try{xJ.disconnect()}finally{if(T(),B.retire(),B.disconnect(),C.disconnect(),M===C)M=null}}}),I(()=>{B.publish(f(A)?{host:f(A),kind:"item",itemId:Z(),canonicalItemId:W(),contentKind:j(),regionPolicy:Y(),scopeElement:U(),ttsHighlightTargetResolver:z(),item:O(),settings:w()}:null),M?.setItem(f(A)?{itemId:Z(),canonicalItemId:W()}:null)});var x={get itemId(){return Z()},set itemId(q){Z(q),F()},get canonicalItemId(){return W()},set canonicalItemId(q){W(q),F()},get contentKind(){return j()},set contentKind(q){j(q),F()},get regionPolicy(){return Y()},set regionPolicy(q){Y(q),F()},get scopeElement(){return U()},set scopeElement(q){U(q),F()},get ttsHighlightTargetResolver(){return z()},set ttsHighlightTargetResolver(q){z(q),F()},get item(){return O()},set item(q){O(q),F()},get settings(){return w()},set settings(q){w(q),F()}},L=DJ(),X=QJ(L);UJ(X,(q)=>JJ(k,q),()=>f(k));var K=ZJ(X,2);return WJ(K,J,"default",{},null),qJ(Q,L),i(x)}PJ("pie-item-scope",MJ(zJ,{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{zJ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{n as a}from"./chunks/ItemToolBar-rgmvw9sm.js";import"./chunks/ItemToolBar-n05xjkp8.js";import"./chunks/ItemToolBar-f971t0cw.js";import"./chunks/ItemToolBar-xwjrpdmz.js";export{a as default};
|