@pie-players/pie-assessment-toolkit 0.3.58 → 0.3.60

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.
@@ -17693,9 +17693,11 @@ function hasChoiceInteraction(context) {
17693
17693
  "pie-multiple-choice",
17694
17694
  "pie-inline-choice",
17695
17695
  "pie-select-text",
17696
+ "pie-ebsr",
17696
17697
  "multiple-choice",
17697
17698
  "inline-choice",
17698
- "select-text"
17699
+ "select-text",
17700
+ "ebsr"
17699
17701
  ];
17700
17702
  if (isElementContext(context)) {
17701
17703
  const config = context.item.config;
@@ -21427,6 +21429,7 @@ class ToolCoordinator {
21427
21429
  tools = new Map;
21428
21430
  layerCounters = new Map;
21429
21431
  listeners = new Set;
21432
+ visibilityState = new Map;
21430
21433
  constructor(config = {}) {
21431
21434
  this.config = config;
21432
21435
  this.layerCounters.set(ZIndexLayer.BASE, 0);
@@ -21450,13 +21453,14 @@ class ToolCoordinator {
21450
21453
  log(`Tool ${id} is already registered`);
21451
21454
  return;
21452
21455
  }
21456
+ const isVisible = this.visibilityState.get(id) ?? false;
21453
21457
  if (!element2) {
21454
21458
  this.tools.set(id, {
21455
21459
  id,
21456
21460
  name,
21457
21461
  element: null,
21458
21462
  layer,
21459
- isVisible: false,
21463
+ isVisible,
21460
21464
  baseZIndex: layer
21461
21465
  });
21462
21466
  log("Tool registered without element:", id);
@@ -21464,6 +21468,7 @@ class ToolCoordinator {
21464
21468
  }
21465
21469
  const baseZIndex = layer + this.getNextLayerOffset(layer);
21466
21470
  element2.style.zIndex = String(baseZIndex);
21471
+ element2.style.display = isVisible ? "" : "none";
21467
21472
  const mouseDownHandler = () => this.bringToFront(element2);
21468
21473
  element2.addEventListener("mousedown", mouseDownHandler);
21469
21474
  this.tools.set(id, {
@@ -21471,10 +21476,13 @@ class ToolCoordinator {
21471
21476
  name,
21472
21477
  element: element2,
21473
21478
  layer,
21474
- isVisible: false,
21479
+ isVisible,
21475
21480
  baseZIndex,
21476
21481
  mouseDownHandler
21477
21482
  });
21483
+ if (isVisible) {
21484
+ this.bringToFront(element2);
21485
+ }
21478
21486
  log("Tool registered with element:", id);
21479
21487
  }
21480
21488
  unregisterTool(id) {
@@ -21486,6 +21494,10 @@ class ToolCoordinator {
21486
21494
  }
21487
21495
  this.tools.delete(id);
21488
21496
  }
21497
+ releaseTool(id) {
21498
+ this.unregisterTool(id);
21499
+ this.visibilityState.delete(id);
21500
+ }
21489
21501
  showTool(id) {
21490
21502
  const tool = this.tools.get(id);
21491
21503
  if (!tool) {
@@ -21497,6 +21509,7 @@ class ToolCoordinator {
21497
21509
  this.bringToFront(tool.element);
21498
21510
  }
21499
21511
  tool.isVisible = true;
21512
+ this.visibilityState.set(id, true);
21500
21513
  this.notifyListeners();
21501
21514
  }
21502
21515
  hideTool(id) {
@@ -21509,6 +21522,7 @@ class ToolCoordinator {
21509
21522
  tool.element.style.display = "none";
21510
21523
  }
21511
21524
  tool.isVisible = false;
21525
+ this.visibilityState.set(id, false);
21512
21526
  this.notifyListeners();
21513
21527
  }
21514
21528
  toggleTool(id) {
@@ -21527,7 +21541,9 @@ class ToolCoordinator {
21527
21541
  }
21528
21542
  isToolVisible(id) {
21529
21543
  const tool = this.tools.get(id);
21530
- return tool?.isVisible ?? false;
21544
+ if (tool)
21545
+ return tool.isVisible;
21546
+ return this.visibilityState.get(id) ?? false;
21531
21547
  }
21532
21548
  bringToFront(element2) {
21533
21549
  const tool = Array.from(this.tools.values()).find((t) => t.element === element2);
@@ -28750,7 +28766,7 @@ function PieAssessmentToolkit($$anchor, $$props) {
28750
28766
  preloaded: "pie-item-player",
28751
28767
  custom: ""
28752
28768
  };
28753
- let assessmentId = prop($$props, "assessmentId", 7, ""), section = prop($$props, "section", 7, null), sectionId = prop($$props, "sectionId", 7, ""), attemptId = prop($$props, "attemptId", 7, ""), env = prop($$props, "env", 23, () => ({})), lazyInit = prop($$props, "lazyInit", 7, true), toolConfigStrictness = prop($$props, "toolConfigStrictness", 7, "error"), tools = prop($$props, "tools", 23, () => ({})), toolContextResolvers = prop($$props, "toolContextResolvers", 7, null), enabledTools = prop($$props, "enabledTools", 7, ""), toolRegistry = prop($$props, "toolRegistry", 7, null), accessibility = prop($$props, "accessibility", 23, () => ({})), player = prop($$props, "player", 7, null), playerType = prop($$props, "playerType", 7, ""), coordinator = prop($$props, "coordinator", 7, null), createSectionController = prop($$props, "createSectionController", 7, null), onFrameworkError = prop($$props, "onFrameworkError", 7, null), errorRenderer = prop($$props, "errorRenderer", 7, null), onStageChange = prop($$props, "onStageChange", 7, null), assessment = prop($$props, "assessment", 7, null), currentItemRef = prop($$props, "currentItemRef", 7, null), pnpEnforcement = prop($$props, "pnpEnforcement", 7, null), isolation = prop($$props, "isolation", 7, "inherit");
28769
+ let assessmentId = prop($$props, "assessmentId", 7, ""), section = prop($$props, "section", 7, null), sectionId = prop($$props, "sectionId", 7, ""), attemptId = prop($$props, "attemptId", 7, ""), env = prop($$props, "env", 23, () => ({})), ndsIcons = prop($$props, "ndsIcons", 7, false), lazyInit = prop($$props, "lazyInit", 7, true), toolConfigStrictness = prop($$props, "toolConfigStrictness", 7, "error"), tools = prop($$props, "tools", 23, () => ({})), toolContextResolvers = prop($$props, "toolContextResolvers", 7, null), enabledTools = prop($$props, "enabledTools", 7, ""), toolRegistry = prop($$props, "toolRegistry", 7, null), accessibility = prop($$props, "accessibility", 23, () => ({})), player = prop($$props, "player", 7, null), playerType = prop($$props, "playerType", 7, ""), coordinator = prop($$props, "coordinator", 7, null), createSectionController = prop($$props, "createSectionController", 7, null), onFrameworkError = prop($$props, "onFrameworkError", 7, null), errorRenderer = prop($$props, "errorRenderer", 7, null), onStageChange = prop($$props, "onStageChange", 7, null), assessment = prop($$props, "assessment", 7, null), currentItemRef = prop($$props, "currentItemRef", 7, null), pnpEnforcement = prop($$props, "pnpEnforcement", 7, null), isolation = prop($$props, "isolation", 7, "inherit");
28754
28770
  let anchor = state(null);
28755
28771
  let ownedCoordinator = state(null);
28756
28772
  let inheritedRuntime = state(null);
@@ -29162,6 +29178,7 @@ function PieAssessmentToolkit($$anchor, $$props) {
29162
29178
  assessmentId: get2(effectiveAssessmentId),
29163
29179
  sectionId: get2(effectiveSectionId),
29164
29180
  itemPlayer: get2(effectiveItemPlayer),
29181
+ ndsIcons: ndsIcons() === true,
29165
29182
  reportSessionChanged: (itemId, detail) => {
29166
29183
  const result = sectionEngine.updateItemSession(itemId, detail);
29167
29184
  emitNormalizedSessionChanged({ itemId, result, fallbackSession: detail });
@@ -29764,6 +29781,13 @@ function PieAssessmentToolkit($$anchor, $$props) {
29764
29781
  env($$value);
29765
29782
  flushSync();
29766
29783
  },
29784
+ get ndsIcons() {
29785
+ return ndsIcons();
29786
+ },
29787
+ set ndsIcons($$value) {
29788
+ ndsIcons($$value);
29789
+ flushSync();
29790
+ },
29767
29791
  get lazyInit() {
29768
29792
  return lazyInit();
29769
29793
  },
@@ -29938,6 +29962,7 @@ __pieDefineSafely("pie-assessment-toolkit", create_custom_element(PieAssessmentT
29938
29962
  sectionId: { attribute: "section-id", type: "String" },
29939
29963
  attemptId: { attribute: "attempt-id", type: "String" },
29940
29964
  env: { attribute: "env", type: "Object" },
29965
+ ndsIcons: { attribute: "nds-icons", type: "Boolean" },
29941
29966
  lazyInit: { attribute: "lazy-init", type: "Boolean" },
29942
29967
  toolConfigStrictness: { attribute: "tool-config-strictness", type: "String" },
29943
29968
  tools: { attribute: "tools", type: "Object" },