@pie-players/pie-assessment-toolkit 0.3.68 → 0.3.69

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.
Files changed (33) hide show
  1. package/README.md +80 -8
  2. package/dist/components/ItemToolBar.custom-element.js +1 -1
  3. package/dist/components/PieAssessmentToolkit.custom-element.js +13 -13
  4. package/dist/components/SectionToolBar.custom-element.js +1 -1
  5. package/dist/components/chunks/ItemToolBar-pe5szfyx.js +46 -0
  6. package/dist/components/chunks/ItemToolBar-rd7te9r0.js +51 -0
  7. package/dist/policy/core/compose-decision.js +14 -0
  8. package/dist/policy/core/decision-types.d.ts +1 -1
  9. package/dist/policy/sources/PnpPolicySource.d.ts +8 -0
  10. package/dist/policy/sources/PnpPolicySource.js +19 -10
  11. package/dist/services/ToolRegistry.d.ts +34 -0
  12. package/dist/services/ToolRegistry.js +34 -0
  13. package/dist/services/tool-context.js +8 -3
  14. package/dist/services/tool-providers/CortexToolProvider.d.ts +18 -0
  15. package/dist/services/tool-providers/CortexToolProvider.js +32 -0
  16. package/dist/services/tool-providers/DesmosToolProvider.d.ts +13 -102
  17. package/dist/services/tool-providers/DesmosToolProvider.js +14 -145
  18. package/dist/services/tool-providers/GeoGebraToolProvider.d.ts +21 -0
  19. package/dist/services/tool-providers/GeoGebraToolProvider.js +32 -0
  20. package/dist/services/tool-providers/LazyCalculatorToolProvider.d.ts +35 -0
  21. package/dist/services/tool-providers/LazyCalculatorToolProvider.js +95 -0
  22. package/dist/services/tool-providers/index.d.ts +4 -0
  23. package/dist/services/tool-providers/index.js +2 -0
  24. package/dist/tools/client.d.ts +0 -1
  25. package/dist/tools/client.js +0 -2
  26. package/dist/tools/internal.d.ts +1 -1
  27. package/dist/tools/internal.js +1 -1
  28. package/dist/tools/types.d.ts +1 -66
  29. package/package.json +22 -12
  30. package/dist/components/chunks/ItemToolBar-38mhtjsq.js +0 -51
  31. package/dist/components/chunks/ItemToolBar-9ymm7pd1.js +0 -46
  32. package/dist/tools/library-loader.d.ts +0 -62
  33. package/dist/tools/library-loader.js +0 -261
package/README.md CHANGED
@@ -417,7 +417,11 @@ tools: {
417
417
  rubric: []
418
418
  },
419
419
  providers: {
420
- calculator: { authFetcher: async () => ({ apiKey: '...' }) },
420
+ calculator: {
421
+ provider: {
422
+ runtime: { authFetcher: async () => ({ apiKey: '...' }) }
423
+ }
424
+ },
421
425
  textToSpeech: { enabled: true, backend: 'browser' }
422
426
  }
423
427
  }
@@ -478,7 +482,9 @@ tools: {
478
482
  providers: {
479
483
  calculator: {
480
484
  enabled: true,
481
- authFetcher: async () => { /* ... */ }
485
+ provider: {
486
+ runtime: { authFetcher: async () => { /* ... */ } }
487
+ }
482
488
  }
483
489
  }
484
490
  }
@@ -536,9 +542,13 @@ const coordinator = new ToolkitCoordinator({
536
542
  providers: {
537
543
  calculator: {
538
544
  enabled: true,
539
- authFetcher: async () => {
540
- const response = await fetch('/api/tools/desmos/auth');
541
- return response.json();
545
+ provider: {
546
+ runtime: {
547
+ authFetcher: async () => {
548
+ const response = await fetch('/api/tools/desmos/auth');
549
+ return response.json();
550
+ }
551
+ }
542
552
  }
543
553
  },
544
554
  textToSpeech: { enabled: true, backend: 'browser' }
@@ -565,14 +575,50 @@ const coordinator = new ToolkitCoordinator({
565
575
  passage: ['textToSpeech']
566
576
  },
567
577
  providers: {
568
- calculator: { enabled: true },
578
+ calculator: {
579
+ enabled: true,
580
+ provider: {
581
+ runtime: { authFetcher: fetchLicensedDesmosApiKey }
582
+ }
583
+ },
569
584
  textToSpeech: { enabled: true, backend: 'browser' }
570
585
  }
571
586
  }
572
587
  });
573
588
  ```
574
589
 
575
- The ToolkitCoordinator handles all internal complexity (service initialization, provider management, state coordination). The only special configuration is `authFetcher` for Desmos calculator (optional - falls back to local calculator if not provided).
590
+ The ToolkitCoordinator handles service initialization, provider management, and
591
+ state coordination. With no calculator provider configuration, the existing
592
+ Desmos implementation remains the default and preserves its legacy unkeyed load.
593
+ That fallback is for client compatibility; it does not grant a Desmos license.
594
+ Licensed deployments can supply `provider.init.apiKey` or
595
+ `provider.runtime.authFetcher`. Runtime key delivery avoids committing the key
596
+ but does not hide it from the browser's Desmos script request.
597
+
598
+ Select the separate GeoGebra implementation explicitly without changing the
599
+ calculator capability, placement, or item policy:
600
+
601
+ ```typescript
602
+ providers: {
603
+ calculator: {
604
+ provider: { id: 'calculator-geogebra' },
605
+ settings: { showResetIcon: true }
606
+ }
607
+ }
608
+ ```
609
+
610
+ Select the bundled open-source implementation in the same way. It uses no API
611
+ key or runtime network request and supports basic, scientific, and focused
612
+ graphing modes:
613
+
614
+ ```typescript
615
+ providers: {
616
+ calculator: {
617
+ provider: { id: 'calculator-cortex' },
618
+ settings: { angleMode: 'degree', evaluationTimeLimitMs: 1000 }
619
+ }
620
+ }
621
+ ```
576
622
 
577
623
  ### Minimal Server-Backed TTS Config
578
624
 
@@ -834,7 +880,15 @@ export interface ToolkitCoordinatorConfig {
834
880
  };
835
881
  calculator?: {
836
882
  enabled?: boolean;
837
- authFetcher?: () => Promise<Record<string, unknown>>;
883
+ provider?: {
884
+ id?: 'calculator-desmos' | 'calculator-geogebra' | 'calculator-cortex';
885
+ init?: Record<string, unknown>;
886
+ runtime?: {
887
+ authFetcher?: () => Promise<Record<string, unknown>>;
888
+ };
889
+ };
890
+ settings?: Record<string, unknown>;
891
+ restrictedMode?: boolean;
838
892
  };
839
893
  };
840
894
  };
@@ -1026,6 +1080,24 @@ const id = highlightCoordinator.addAnnotation(range, 'yellow');
1026
1080
  highlightCoordinator.removeAnnotation(id);
1027
1081
  ```
1028
1082
 
1083
+ Reading highlights resolve through five `component-public` tokens registered in
1084
+ `packages/theme/src/token-registry.json`:
1085
+
1086
+ | Custom property | Default | Description |
1087
+ | --- | --- | --- |
1088
+ | `--pie-tts-word-highlight` | `--pie-missing` at 68% | Fill behind the current word |
1089
+ | `--pie-tts-sentence-highlight` | `--pie-missing` at 38% | Fill behind the current sentence |
1090
+ | `--pie-tts-line-highlight` | `--pie-tts-sentence-highlight` | Fill behind the current line |
1091
+ | `--pie-tts-word-underline` | `--pie-text` at 70% | Underline marking the current word |
1092
+ | `--pie-tts-word-shadow` | `--pie-text` at 35% | Shadow carrying the word over its fill |
1093
+
1094
+ The coordinator derives all five from the active theme's accent, text and
1095
+ background — opacities clamped to a legible band, and the underline colour picked
1096
+ by background luminance so the cue survives a dark scheme — then writes them
1097
+ inline on the document element. Inline styles outrank any author selector, so a
1098
+ host override takes `!important` and owns the contrast the derivation was
1099
+ maintaining, across every scheme it ships.
1100
+
1029
1101
  ### AccessibilityCatalogResolver
1030
1102
 
1031
1103
  ```typescript
@@ -1 +1 @@
1
- import{a}from"./chunks/ItemToolBar-9ymm7pd1.js";import"./chunks/ItemToolBar-38mhtjsq.js";export{a as default};
1
+ import{a}from"./chunks/ItemToolBar-pe5szfyx.js";import"./chunks/ItemToolBar-rd7te9r0.js";export{a as default};