@pie-players/pie-assessment-toolkit 0.3.63 → 0.3.65

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 (67) hide show
  1. package/README.md +92 -1
  2. package/dist/components/ItemToolBar.custom-element.js +1 -1
  3. package/dist/components/PieAssessmentToolkit.custom-element.js +11 -11
  4. package/dist/components/SectionToolBar.custom-element.js +1 -1
  5. package/dist/components/chunks/ItemToolBar-cckwpz6c.js +51 -0
  6. package/dist/components/chunks/ItemToolBar-pryf0rtz.js +22 -0
  7. package/dist/index.d.ts +10 -6
  8. package/dist/index.js +12 -4
  9. package/dist/policy/core/ToolPolicyEngine.d.ts +21 -0
  10. package/dist/policy/core/ToolPolicyEngine.js +27 -0
  11. package/dist/policy/core/feature-decision.d.ts +57 -0
  12. package/dist/policy/core/feature-decision.js +40 -0
  13. package/dist/policy/engine.d.ts +1 -0
  14. package/dist/policy/sources/PnpPolicySource.d.ts +22 -0
  15. package/dist/policy/sources/PnpPolicySource.js +41 -11
  16. package/dist/runtime/catalog-registration.d.ts +56 -1
  17. package/dist/runtime/catalog-registration.js +64 -31
  18. package/dist/runtime/composition-emit-scheduler.d.ts +78 -0
  19. package/dist/runtime/composition-emit-scheduler.js +154 -0
  20. package/dist/runtime/core/engine-resolver.d.ts +1 -1
  21. package/dist/services/AccessibilityCatalogResolver.d.ts +100 -4
  22. package/dist/services/AccessibilityCatalogResolver.js +183 -58
  23. package/dist/services/SSMLExtractor.js +28 -18
  24. package/dist/services/TTSService.d.ts +25 -0
  25. package/dist/services/TTSService.js +241 -45
  26. package/dist/services/ToolRegistry.d.ts +218 -8
  27. package/dist/services/ToolRegistry.js +124 -8
  28. package/dist/services/ToolkitCoordinator.d.ts +25 -3
  29. package/dist/services/ToolkitCoordinator.js +47 -6
  30. package/dist/services/catalog-media.d.ts +25 -0
  31. package/dist/services/catalog-media.js +101 -0
  32. package/dist/services/createDefaultToolRegistry.d.ts +25 -58
  33. package/dist/services/createDefaultToolRegistry.js +24 -104
  34. package/dist/services/defaultPersonalNeedsProfile.d.ts +20 -2
  35. package/dist/services/defaultPersonalNeedsProfile.js +21 -19
  36. package/dist/services/interfaces.d.ts +29 -2
  37. package/dist/services/pnp-standard-features.d.ts +1 -1
  38. package/dist/services/spoken-audio-cards.d.ts +54 -0
  39. package/dist/services/spoken-audio-cards.js +66 -0
  40. package/dist/services/tool-config-defaults.d.ts +7 -23
  41. package/dist/services/tool-config-defaults.js +7 -46
  42. package/dist/services/tool-config-validation.d.ts +1 -1
  43. package/dist/services/tool-config-validation.js +44 -4
  44. package/dist/services/tts/browser-provider.js +2 -1
  45. package/dist/services/tts/math-aware-text-processing.js +3 -3
  46. package/dist/services/tts/text-processing.d.ts +51 -0
  47. package/dist/services/tts/text-processing.js +117 -1
  48. package/dist/services/tts-runtime-config.js +7 -2
  49. package/dist/tools/internal.d.ts +34 -0
  50. package/dist/tools/internal.js +33 -0
  51. package/dist/tools/tool-tag-map.d.ts +15 -3
  52. package/dist/tools/tool-tag-map.js +21 -18
  53. package/package.json +14 -10
  54. package/dist/components/chunks/ItemToolBar-843902tp.js +0 -51
  55. package/dist/components/chunks/ItemToolBar-84nv78dy.js +0 -22
  56. package/dist/tools/registrations/accessibility-tools.d.ts +0 -34
  57. package/dist/tools/registrations/accessibility-tools.js +0 -217
  58. package/dist/tools/registrations/calculator.d.ts +0 -20
  59. package/dist/tools/registrations/calculator.js +0 -228
  60. package/dist/tools/registrations/interaction-tools.d.ts +0 -27
  61. package/dist/tools/registrations/interaction-tools.js +0 -143
  62. package/dist/tools/registrations/measurement-tools.d.ts +0 -24
  63. package/dist/tools/registrations/measurement-tools.js +0 -130
  64. package/dist/tools/registrations/subject-specific-tools.d.ts +0 -27
  65. package/dist/tools/registrations/subject-specific-tools.js +0 -158
  66. package/dist/tools/registrations/tts.d.ts +0 -21
  67. package/dist/tools/registrations/tts.js +0 -184
@@ -1,130 +0,0 @@
1
- /**
2
- * Measurement Tools Registrations
3
- *
4
- * Registers ruler and protractor tools for on-screen measurements.
5
- *
6
- * Maps to QTI 3.0 standard access features:
7
- * - ruler (assessment tool)
8
- * - protractor (assessment tool)
9
- */
10
- import { hasMathContent } from "../../services/tool-context.js";
11
- import { createToolElement, } from "../tool-tag-map.js";
12
- import { applyOverlaySurface, createScopedVisibilityBinding, syncButtonAndOverlayVisibility, } from "./toolbar-registration-helpers.js";
13
- /**
14
- * Ruler tool registration
15
- *
16
- * Provides an on-screen ruler for measuring lengths.
17
- * Typically appears on geometry or measurement problems.
18
- */
19
- export const rulerToolRegistration = {
20
- toolId: "ruler",
21
- name: "Ruler",
22
- description: "On-screen ruler for measurements",
23
- icon: "ruler",
24
- // Ruler typically appears at section/item/element level
25
- supportedLevels: ["section", "item", "element"],
26
- // PNP support IDs
27
- // Maps to QTI 3.0 standard feature: ruler
28
- pnpSupportIds: [
29
- "ruler", // QTI 3.0 standard (assessment.ruler)
30
- "measurement", // Common variant
31
- ],
32
- /**
33
- * Pass 2: Ruler is relevant when math content is present
34
- */
35
- isVisibleInContext(context) {
36
- return hasMathContent(context);
37
- },
38
- renderToolbar(context, toolbarContext) {
39
- const visibility = createScopedVisibilityBinding(this.toolId, toolbarContext);
40
- const button = {
41
- toolId: this.toolId,
42
- label: this.name,
43
- icon: typeof this.icon === "function" ? this.icon(context) : this.icon,
44
- disabled: false,
45
- ariaLabel: "Open ruler tool",
46
- tooltip: "Ruler",
47
- onClick: () => toolbarContext.toggleTool(this.toolId),
48
- active: visibility.isActive(),
49
- };
50
- const componentOverrides = toolbarContext.componentOverrides ?? {};
51
- const overlay = createToolElement(this.toolId, context, toolbarContext, componentOverrides);
52
- overlay.setAttribute("tool-id", visibility.fullToolId);
53
- applyOverlaySurface(overlay, "frameless");
54
- return {
55
- toolId: this.toolId,
56
- button,
57
- elements: [{ element: overlay, mount: "after-buttons" }],
58
- sync: () => {
59
- syncButtonAndOverlayVisibility({
60
- button,
61
- overlay,
62
- isActive: visibility.isActive,
63
- });
64
- if (toolbarContext.toolkitCoordinator) {
65
- overlay.toolkitCoordinator = toolbarContext.toolkitCoordinator;
66
- }
67
- },
68
- subscribeActive: visibility.subscribeActive,
69
- };
70
- },
71
- };
72
- /**
73
- * Protractor tool registration
74
- *
75
- * Provides an on-screen protractor for measuring angles.
76
- * Typically appears on geometry problems.
77
- */
78
- export const protractorToolRegistration = {
79
- toolId: "protractor",
80
- name: "Protractor",
81
- description: "On-screen protractor for angle measurements",
82
- icon: "protractor",
83
- // Protractor typically appears at section/item/element level
84
- supportedLevels: ["section", "item", "element"],
85
- // PNP support IDs
86
- // Maps to QTI 3.0 standard feature: protractor
87
- pnpSupportIds: [
88
- "protractor", // QTI 3.0 standard (assessment.protractor)
89
- "angleMeasurement", // Common variant
90
- ],
91
- /**
92
- * Pass 2: Protractor is relevant when math content is present
93
- */
94
- isVisibleInContext(context) {
95
- return hasMathContent(context);
96
- },
97
- renderToolbar(context, toolbarContext) {
98
- const visibility = createScopedVisibilityBinding(this.toolId, toolbarContext);
99
- const button = {
100
- toolId: this.toolId,
101
- label: this.name,
102
- icon: typeof this.icon === "function" ? this.icon(context) : this.icon,
103
- disabled: false,
104
- ariaLabel: "Open protractor tool",
105
- tooltip: "Protractor",
106
- onClick: () => toolbarContext.toggleTool(this.toolId),
107
- active: visibility.isActive(),
108
- };
109
- const componentOverrides = toolbarContext.componentOverrides ?? {};
110
- const overlay = createToolElement(this.toolId, context, toolbarContext, componentOverrides);
111
- overlay.setAttribute("tool-id", visibility.fullToolId);
112
- applyOverlaySurface(overlay, "frameless");
113
- return {
114
- toolId: this.toolId,
115
- button,
116
- elements: [{ element: overlay, mount: "after-buttons" }],
117
- sync: () => {
118
- syncButtonAndOverlayVisibility({
119
- button,
120
- overlay,
121
- isActive: visibility.isActive,
122
- });
123
- if (toolbarContext.toolkitCoordinator) {
124
- overlay.toolkitCoordinator = toolbarContext.toolkitCoordinator;
125
- }
126
- },
127
- subscribeActive: visibility.subscribeActive,
128
- };
129
- },
130
- };
@@ -1,27 +0,0 @@
1
- /**
2
- * Subject-Specific Tools Registrations
3
- *
4
- * Registers tools for specific subject areas:
5
- * - Graph (graphing calculator/coordinate plane)
6
- * - Periodic Table (chemistry reference)
7
- *
8
- * Maps to QTI 3.0 standard access features:
9
- * - graphingCalculator (assessment tool)
10
- * - graph (assessment tool)
11
- * - periodicTable (assessment tool)
12
- */
13
- import type { ToolRegistration } from "../../services/ToolRegistry.js";
14
- /**
15
- * Graph tool registration
16
- *
17
- * Provides graphing calculator and coordinate plane functionality.
18
- * Context-smart: appears automatically for math content or when explicitly enabled.
19
- */
20
- export declare const graphToolRegistration: ToolRegistration;
21
- /**
22
- * Periodic Table tool registration
23
- *
24
- * Provides chemistry periodic table reference.
25
- * Context-smart: appears automatically for science content or when explicitly enabled.
26
- */
27
- export declare const periodicTableToolRegistration: ToolRegistration;
@@ -1,158 +0,0 @@
1
- /**
2
- * Subject-Specific Tools Registrations
3
- *
4
- * Registers tools for specific subject areas:
5
- * - Graph (graphing calculator/coordinate plane)
6
- * - Periodic Table (chemistry reference)
7
- *
8
- * Maps to QTI 3.0 standard access features:
9
- * - graphingCalculator (assessment tool)
10
- * - graph (assessment tool)
11
- * - periodicTable (assessment tool)
12
- */
13
- import { hasMathContent, hasScienceContent, } from "../../services/tool-context.js";
14
- import { createToolElement, } from "../tool-tag-map.js";
15
- import { createScopedVisibilityBinding, syncButtonAndOverlayVisibility, } from "./toolbar-registration-helpers.js";
16
- /**
17
- * Graph tool registration
18
- *
19
- * Provides graphing calculator and coordinate plane functionality.
20
- * Context-smart: appears automatically for math content or when explicitly enabled.
21
- */
22
- export const graphToolRegistration = {
23
- toolId: "graph",
24
- name: "Graph",
25
- description: "Graphing calculator and coordinate plane",
26
- icon: "chart-bar",
27
- // Graph is a section-level floating tool.
28
- supportedLevels: ["section"],
29
- // PNP support IDs
30
- // Maps to QTI 3.0 standard features: graph, graphingCalculator
31
- pnpSupportIds: [
32
- "graph", // QTI 3.0 standard (assessment.graph)
33
- "graphingCalculator", // QTI 3.0 standard (assessment.graphingCalculator)
34
- "coordinatePlane", // Common variant
35
- "graphingTool", // Common variant
36
- ],
37
- /**
38
- * Pass 2: Graph is relevant when math content is present
39
- */
40
- isVisibleInContext(context) {
41
- return hasMathContent(context);
42
- },
43
- renderToolbar(context, toolbarContext) {
44
- const visibility = createScopedVisibilityBinding(this.toolId, toolbarContext);
45
- const button = {
46
- toolId: this.toolId,
47
- label: this.name,
48
- icon: typeof this.icon === "function" ? this.icon(context) : this.icon,
49
- disabled: false,
50
- ariaLabel: "Graph - Graphing calculator",
51
- tooltip: "Graph",
52
- onClick: () => toolbarContext.toggleTool(this.toolId),
53
- active: visibility.isActive(),
54
- };
55
- const componentOverrides = toolbarContext.componentOverrides ?? {};
56
- const overlay = createToolElement(this.toolId, context, toolbarContext, componentOverrides);
57
- overlay.setAttribute("tool-id", visibility.fullToolId);
58
- return {
59
- toolId: this.toolId,
60
- button,
61
- elements: [
62
- {
63
- element: overlay,
64
- mount: "after-buttons",
65
- shell: {
66
- title: this.name,
67
- draggable: true,
68
- resizable: true,
69
- closeable: true,
70
- initialWidth: 920,
71
- initialHeight: 680,
72
- minWidth: 640,
73
- minHeight: 500,
74
- },
75
- },
76
- ],
77
- sync: () => {
78
- syncButtonAndOverlayVisibility({
79
- button,
80
- overlay,
81
- isActive: visibility.isActive,
82
- });
83
- },
84
- subscribeActive: visibility.subscribeActive,
85
- };
86
- },
87
- };
88
- /**
89
- * Periodic Table tool registration
90
- *
91
- * Provides chemistry periodic table reference.
92
- * Context-smart: appears automatically for science content or when explicitly enabled.
93
- */
94
- export const periodicTableToolRegistration = {
95
- toolId: "periodicTable",
96
- name: "Periodic Table",
97
- description: "Chemistry periodic table reference",
98
- icon: "beaker",
99
- // Periodic table is a section-level floating tool.
100
- supportedLevels: ["section"],
101
- // PNP support IDs
102
- // Maps to QTI 3.0 standard feature: periodicTable
103
- pnpSupportIds: [
104
- "periodicTable", // QTI 3.0 standard (assessment.periodicTable)
105
- "chemistryReference", // Common variant
106
- "elementReference", // Common variant
107
- ],
108
- /**
109
- * Pass 2: Periodic table is relevant when science content is present
110
- */
111
- isVisibleInContext(context) {
112
- return hasScienceContent(context);
113
- },
114
- renderToolbar(context, toolbarContext) {
115
- const visibility = createScopedVisibilityBinding(this.toolId, toolbarContext);
116
- const button = {
117
- toolId: this.toolId,
118
- label: this.name,
119
- icon: typeof this.icon === "function" ? this.icon(context) : this.icon,
120
- disabled: false,
121
- ariaLabel: "Periodic table - Chemistry reference",
122
- tooltip: "Periodic Table",
123
- onClick: () => toolbarContext.toggleTool(this.toolId),
124
- active: visibility.isActive(),
125
- };
126
- const componentOverrides = toolbarContext.componentOverrides ?? {};
127
- const overlay = createToolElement(this.toolId, context, toolbarContext, componentOverrides);
128
- overlay.setAttribute("tool-id", visibility.fullToolId);
129
- return {
130
- toolId: this.toolId,
131
- button,
132
- elements: [
133
- {
134
- element: overlay,
135
- mount: "after-buttons",
136
- shell: {
137
- title: this.name,
138
- draggable: true,
139
- resizable: true,
140
- closeable: true,
141
- initialWidth: 1160,
142
- initialHeight: 760,
143
- minWidth: 920,
144
- minHeight: 620,
145
- },
146
- },
147
- ],
148
- sync: () => {
149
- syncButtonAndOverlayVisibility({
150
- button,
151
- overlay,
152
- isActive: visibility.isActive,
153
- });
154
- },
155
- subscribeActive: visibility.subscribeActive,
156
- };
157
- },
158
- };
@@ -1,21 +0,0 @@
1
- /**
2
- * Text-to-Speech (TTS) Tool Registration
3
- *
4
- * Registers the TTS tool for reading content aloud.
5
- *
6
- * Maps to QTI 3.0 standard access features:
7
- * - textToSpeech (auditory support)
8
- * - readAloud (auditory support)
9
- */
10
- import type { ToolRegistration } from "../../services/ToolRegistry.js";
11
- export declare const TOOL_ELEMENT_UNMOUNT_CALLBACK_PROP = "__pieToolElementUnmount";
12
- export declare const TOOL_ACTIVE_CHANGE_EVENT = "pie-tool-active-change";
13
- /**
14
- * Text-to-Speech tool registration
15
- *
16
- * Supports:
17
- * - Reading content aloud using browser TTS or external providers
18
- * - Context-aware visibility (shows when readable text is available)
19
- * - All levels except assessment and element
20
- */
21
- export declare const ttsToolRegistration: ToolRegistration;
@@ -1,184 +0,0 @@
1
- /**
2
- * Text-to-Speech (TTS) Tool Registration
3
- *
4
- * Registers the TTS tool for reading content aloud.
5
- *
6
- * Maps to QTI 3.0 standard access features:
7
- * - textToSpeech (auditory support)
8
- * - readAloud (auditory support)
9
- */
10
- import { hasReadableText } from "../../services/tool-context.js";
11
- import { createScopedToolId } from "../../services/tool-instance-id.js";
12
- import { buildRuntimeTTSConfig, normalizeTTSLayoutMode, normalizeTTSSpeedControlOptions, resolveTTSHostToolbarLayout, resolveTTSLayoutMode, resolveTTSBackend, resolveTTSRuntimeSettings, resolveRuntimeProvider, resolveTransportMode, } from "../../services/tts-runtime-config.js";
13
- import { TTSToolProvider } from "../../services/tool-providers/index.js";
14
- const inlineTTSControls = new Map();
15
- export const TOOL_ELEMENT_UNMOUNT_CALLBACK_PROP = "__pieToolElementUnmount";
16
- export const TOOL_ACTIVE_CHANGE_EVENT = "pie-tool-active-change";
17
- /**
18
- * Text-to-Speech tool registration
19
- *
20
- * Supports:
21
- * - Reading content aloud using browser TTS or external providers
22
- * - Context-aware visibility (shows when readable text is available)
23
- * - All levels except assessment and element
24
- */
25
- export const ttsToolRegistration = {
26
- toolId: "textToSpeech",
27
- name: "Text to Speech",
28
- description: "Read content aloud",
29
- icon: "volume-up",
30
- provider: {
31
- getProviderId: () => "tts",
32
- createProvider: (config) => {
33
- const settings = resolveTTSRuntimeSettings(config);
34
- return new TTSToolProvider(resolveTTSBackend(settings));
35
- },
36
- getInitConfig: (config) => {
37
- const settings = resolveTTSRuntimeSettings(config);
38
- const backend = resolveTTSBackend(settings);
39
- const serverProvider = resolveRuntimeProvider(settings, backend);
40
- const transportMode = resolveTransportMode(settings, serverProvider);
41
- return {
42
- backend,
43
- serverProvider,
44
- transportMode,
45
- ...buildRuntimeTTSConfig(settings),
46
- };
47
- },
48
- getAuthFetcher: (config) => {
49
- const runtimeAuthFetcher = config?.provider?.runtime?.authFetcher;
50
- return typeof runtimeAuthFetcher === "function"
51
- ? runtimeAuthFetcher
52
- : undefined;
53
- },
54
- sanitizeConfig: (config) => {
55
- const settings = config.settings && typeof config.settings === "object"
56
- ? { ...config.settings }
57
- : undefined;
58
- if (settings && "layoutMode" in settings) {
59
- settings.layoutMode = normalizeTTSLayoutMode(settings.layoutMode);
60
- }
61
- if (settings && "speedOptions" in settings) {
62
- settings.speedOptions = normalizeTTSSpeedControlOptions(settings.speedOptions);
63
- }
64
- const normalizedConfig = {
65
- ...config,
66
- };
67
- if ("layoutMode" in normalizedConfig) {
68
- normalizedConfig.layoutMode = normalizeTTSLayoutMode(normalizedConfig.layoutMode);
69
- }
70
- if ("speedOptions" in normalizedConfig) {
71
- normalizedConfig.speedOptions = normalizeTTSSpeedControlOptions(normalizedConfig.speedOptions);
72
- }
73
- if (settings) {
74
- normalizedConfig.settings = settings;
75
- }
76
- return normalizedConfig;
77
- },
78
- lazy: true,
79
- },
80
- // TTS is inline-only and scoped to item/passage contexts.
81
- supportedLevels: ["item", "passage"],
82
- // PNP support IDs that enable this tool
83
- // Maps to QTI 3.0 standard features: textToSpeech, readAloud
84
- pnpSupportIds: [
85
- "textToSpeech", // QTI 3.0 standard (auditory.textToSpeech)
86
- "readAloud", // QTI 3.0 standard (auditory.readAloud)
87
- "tts", // Common abbreviation
88
- "speechOutput", // Common variant
89
- ],
90
- /**
91
- * Pass 2: Determine if TTS is relevant in this context
92
- *
93
- * TTS is relevant when:
94
- * - Context contains readable text (at least 10 characters)
95
- */
96
- isVisibleInContext(context) {
97
- return hasReadableText(context);
98
- },
99
- renderToolbar(_context, toolbarContext) {
100
- const resolveRuntimeSettings = () => resolveTTSRuntimeSettings(toolbarContext.toolkitCoordinator?.getToolConfig(this.toolId) ||
101
- undefined);
102
- const resolveElementSpeedOptions = () => {
103
- const runtimeSettings = resolveRuntimeSettings();
104
- return normalizeTTSSpeedControlOptions(runtimeSettings.speedOptions);
105
- };
106
- const resolveLayoutMode = () => resolveTTSLayoutMode(resolveRuntimeSettings());
107
- const resolveHostLayout = () => resolveTTSHostToolbarLayout(resolveRuntimeSettings());
108
- const fullToolId = createScopedToolId(this.toolId, toolbarContext.scope.level, toolbarContext.scope.scopeId);
109
- const resolveControlSize = () => {
110
- const raw = toolbarContext.ui?.size;
111
- return raw === "sm" || raw === "lg" ? raw : "md";
112
- };
113
- const ensureElement = () => {
114
- let element = inlineTTSControls.get(fullToolId);
115
- if (element &&
116
- typeof element.isConnected ===
117
- "boolean" &&
118
- !element.isConnected) {
119
- inlineTTSControls.delete(fullToolId);
120
- element = undefined;
121
- }
122
- if (!element) {
123
- element = document.createElement("pie-tool-tts-inline");
124
- element[TOOL_ELEMENT_UNMOUNT_CALLBACK_PROP] = () => {
125
- if (inlineTTSControls.get(fullToolId) === element) {
126
- inlineTTSControls.delete(fullToolId);
127
- }
128
- };
129
- inlineTTSControls.set(fullToolId, element);
130
- }
131
- element.setAttribute("tool-id", fullToolId);
132
- element.setAttribute("catalog-id", toolbarContext.catalogId || toolbarContext.itemId);
133
- element.setAttribute("language", toolbarContext.language || "en-US");
134
- element.setAttribute("size", resolveControlSize());
135
- element.setAttribute("layout-mode", resolveLayoutMode());
136
- element.speedOptions = resolveElementSpeedOptions();
137
- element.showSingleSpeedOption =
138
- resolveRuntimeSettings().showSingleSpeedOption === true;
139
- return element;
140
- };
141
- const hostLayout = resolveHostLayout();
142
- return {
143
- toolId: this.toolId,
144
- button: null,
145
- elements: [
146
- {
147
- element: ensureElement(),
148
- mount: hostLayout.mount,
149
- layoutHints: {
150
- controlsRow: {
151
- reserveSpace: hostLayout.controlsRow.reserveSpace,
152
- showWhenToolActive: hostLayout.controlsRow.expandWhenToolActive,
153
- },
154
- headerOverlay: {
155
- showWhenToolActive: hostLayout.headerOverlay.expandWhenToolActive,
156
- },
157
- },
158
- },
159
- ],
160
- subscribeActive: (callback) => {
161
- const element = ensureElement();
162
- const handler = (event) => {
163
- const detail = event.detail;
164
- callback(detail?.active === true);
165
- };
166
- element.addEventListener(TOOL_ACTIVE_CHANGE_EVENT, handler);
167
- return () => {
168
- element.removeEventListener(TOOL_ACTIVE_CHANGE_EVENT, handler);
169
- };
170
- },
171
- sync: () => {
172
- const element = ensureElement();
173
- element.setAttribute("tool-id", fullToolId);
174
- element.setAttribute("catalog-id", toolbarContext.catalogId || toolbarContext.itemId);
175
- element.setAttribute("language", toolbarContext.language || "en-US");
176
- element.setAttribute("size", resolveControlSize());
177
- element.setAttribute("layout-mode", resolveLayoutMode());
178
- element.speedOptions = resolveElementSpeedOptions();
179
- element.showSingleSpeedOption =
180
- resolveRuntimeSettings().showSingleSpeedOption === true;
181
- },
182
- };
183
- },
184
- };