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

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 (39) hide show
  1. package/README.md +83 -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-12jy8e7c.js +49 -0
  6. package/dist/components/chunks/ItemToolBar-16t5ary7.js +46 -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/HighlightCoordinator.d.ts +5 -1
  12. package/dist/services/HighlightCoordinator.js +5 -8
  13. package/dist/services/ToolRegistry.d.ts +48 -0
  14. package/dist/services/ToolRegistry.js +34 -0
  15. package/dist/services/ToolkitCoordinator.d.ts +23 -13
  16. package/dist/services/ToolkitCoordinator.js +373 -66
  17. package/dist/services/tool-context.js +8 -3
  18. package/dist/services/tool-providers/CortexToolProvider.d.ts +13 -0
  19. package/dist/services/tool-providers/CortexToolProvider.js +32 -0
  20. package/dist/services/tool-providers/DesmosToolProvider.d.ts +8 -102
  21. package/dist/services/tool-providers/DesmosToolProvider.js +14 -145
  22. package/dist/services/tool-providers/GeoGebraToolProvider.d.ts +16 -0
  23. package/dist/services/tool-providers/GeoGebraToolProvider.js +32 -0
  24. package/dist/services/tool-providers/LazyCalculatorToolProvider.d.ts +35 -0
  25. package/dist/services/tool-providers/LazyCalculatorToolProvider.js +95 -0
  26. package/dist/services/tool-providers/index.d.ts +4 -0
  27. package/dist/services/tool-providers/index.js +2 -0
  28. package/dist/services/tool-request.d.ts +1 -0
  29. package/dist/services/tool-request.js +4 -0
  30. package/dist/tools/client.d.ts +0 -1
  31. package/dist/tools/client.js +0 -2
  32. package/dist/tools/internal.d.ts +1 -1
  33. package/dist/tools/internal.js +1 -1
  34. package/dist/tools/types.d.ts +1 -66
  35. package/package.json +22 -12
  36. package/dist/components/chunks/ItemToolBar-38mhtjsq.js +0 -51
  37. package/dist/components/chunks/ItemToolBar-9ymm7pd1.js +0 -46
  38. package/dist/tools/library-loader.d.ts +0 -62
  39. 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
  };
@@ -857,6 +911,9 @@ const services = coordinator.getServiceBundle();
857
911
  coordinator.isToolEnabled('textToSpeech'); // Check if tool is enabled
858
912
  coordinator.getToolConfig('textToSpeech'); // Get tool-specific config
859
913
  coordinator.updateToolConfig('textToSpeech', { rate: 1.5 }); // Update tool config
914
+
915
+ // Final teardown by the owner that constructed the coordinator
916
+ await coordinator.dispose();
860
917
  ```
861
918
 
862
919
  ### Direct Service Access
@@ -1026,6 +1083,24 @@ const id = highlightCoordinator.addAnnotation(range, 'yellow');
1026
1083
  highlightCoordinator.removeAnnotation(id);
1027
1084
  ```
1028
1085
 
1086
+ Reading highlights resolve through five `component-public` tokens registered in
1087
+ `packages/theme/src/token-registry.json`:
1088
+
1089
+ | Custom property | Default | Description |
1090
+ | --- | --- | --- |
1091
+ | `--pie-tts-word-highlight` | `--pie-missing` at 68% | Fill behind the current word |
1092
+ | `--pie-tts-sentence-highlight` | `--pie-missing` at 38% | Fill behind the current sentence |
1093
+ | `--pie-tts-line-highlight` | `--pie-tts-sentence-highlight` | Fill behind the current line |
1094
+ | `--pie-tts-word-underline` | `--pie-text` at 70% | Underline marking the current word |
1095
+ | `--pie-tts-word-shadow` | `--pie-text` at 35% | Shadow carrying the word over its fill |
1096
+
1097
+ The coordinator derives all five from the active theme's accent, text and
1098
+ background — opacities clamped to a legible band, and the underline colour picked
1099
+ by background luminance so the cue survives a dark scheme — then writes them
1100
+ inline on the document element. Inline styles outrank any author selector, so a
1101
+ host override takes `!important` and owns the contrast the derivation was
1102
+ maintaining, across every scheme it ships.
1103
+
1029
1104
  ### AccessibilityCatalogResolver
1030
1105
 
1031
1106
  ```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-16t5ary7.js";import"./chunks/ItemToolBar-12jy8e7c.js";export{a as default};