@pie-players/pie-default-tool-loaders 1.0.0-beta.1 → 1.0.0-beta.10
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/LICENSE +21 -0
- package/README.md +98 -14
- package/dist/afa-profile.d.ts +17 -0
- package/dist/afa-profile.js +18 -0
- package/dist/calculator-providers/LazyCalculatorToolProvider.d.ts +32 -18
- package/dist/calculator-providers/LazyCalculatorToolProvider.js +24 -12
- package/dist/calculator-providers/packaged-calculator-providers.js +26 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.js +8 -5
- package/dist/packaged-capability-composition.js +11 -1
- package/dist/registrations/accessibility-tools.d.ts +8 -0
- package/dist/registrations/accessibility-tools.js +38 -0
- package/dist/registrations/audio-transcript.d.ts +0 -7
- package/dist/registrations/audio-transcript.js +1 -7
- package/dist/registrations/calculator.d.ts +16 -5
- package/dist/registrations/calculator.js +171 -176
- package/dist/registrations/interaction-tools.d.ts +14 -1
- package/dist/registrations/interaction-tools.js +91 -23
- package/dist/registrations/tts.d.ts +23 -2
- package/dist/registrations/tts.js +120 -98
- package/package.json +27 -25
- package/dist/calculator-providers/CortexToolProvider.d.ts +0 -10
- package/dist/calculator-providers/CortexToolProvider.js +0 -18
- package/dist/calculator-providers/DesmosToolProvider.d.ts +0 -11
- package/dist/calculator-providers/DesmosToolProvider.js +0 -18
- package/dist/calculator-providers/GeoGebraToolProvider.d.ts +0 -13
- package/dist/calculator-providers/GeoGebraToolProvider.js +0 -18
- package/dist/registrations/overlay-element-cache.d.ts +0 -23
- package/dist/registrations/overlay-toolbar-render.d.ts +0 -33
- package/dist/registrations/selection-actions.d.ts +0 -24
|
@@ -12,112 +12,134 @@ import { resolveOverlayElement } from "./overlay-element-cache.js";
|
|
|
12
12
|
// and a bundler building the toolkit alone has nothing to resolve.
|
|
13
13
|
const loadServerTTSProvider = async () => (await import("@pie-players/tts-client-server")).ServerTTSProvider;
|
|
14
14
|
const numberOrUndefined = (value) => typeof value === "number" ? value : undefined;
|
|
15
|
+
/** The host-provider path, with the descriptor's auth requirement. */
|
|
16
|
+
class HostTTSToolProvider extends TTSToolProvider {
|
|
17
|
+
constructor(descriptor) {
|
|
18
|
+
super("browser", { loadHostProvider: descriptor.load });
|
|
19
|
+
this.requiresAuth = descriptor.requiresAuth === true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const selectHostProvider = (config, providers) => {
|
|
23
|
+
const id = config?.provider?.id;
|
|
24
|
+
return typeof id === "string" && Object.hasOwn(providers, id)
|
|
25
|
+
? providers[id]
|
|
26
|
+
: undefined;
|
|
27
|
+
};
|
|
15
28
|
/**
|
|
16
|
-
*
|
|
29
|
+
* Builds the text-to-speech registration over the browser and server backends
|
|
30
|
+
* plus any host providers, so a host bundles its provider only by naming it.
|
|
17
31
|
*
|
|
18
32
|
* Supports:
|
|
19
|
-
* - Reading content aloud using browser TTS or
|
|
33
|
+
* - Reading content aloud using browser TTS, a TTS server or a host provider
|
|
20
34
|
* - Context-aware visibility (shows when readable text is available)
|
|
21
35
|
* - Item and passage levels
|
|
22
36
|
*/
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
export function createTTSToolRegistration(options = {}) {
|
|
38
|
+
const providers = { ...options.providers };
|
|
39
|
+
return {
|
|
40
|
+
toolId: "textToSpeech",
|
|
41
|
+
name: "Text to Speech",
|
|
42
|
+
description: "Read content aloud",
|
|
43
|
+
nameKey: "tools.textToSpeech.name",
|
|
44
|
+
descriptionKey: "tools.textToSpeech.description",
|
|
45
|
+
icon: "volume-up",
|
|
46
|
+
provider: {
|
|
47
|
+
createProvider: (config) => {
|
|
48
|
+
const hostProvider = selectHostProvider(config, providers);
|
|
49
|
+
if (hostProvider)
|
|
50
|
+
return new HostTTSToolProvider(hostProvider);
|
|
51
|
+
return new TTSToolProvider(resolveTTSRuntimeSettings(config).backend, {
|
|
52
|
+
loadServerProvider: loadServerTTSProvider,
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
getInitConfig: (config) => buildRuntimeTTSConfig(resolveTTSRuntimeSettings(config)),
|
|
56
|
+
getAuthFetcher: (config) => {
|
|
57
|
+
const runtimeAuthFetcher = config?.provider?.runtime?.authFetcher;
|
|
58
|
+
return typeof runtimeAuthFetcher === "function"
|
|
59
|
+
? runtimeAuthFetcher
|
|
60
|
+
: undefined;
|
|
61
|
+
},
|
|
62
|
+
lazy: true,
|
|
35
63
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
64
|
+
sanitizeConfig: (config) => {
|
|
65
|
+
const normalizedConfig = {
|
|
66
|
+
...config,
|
|
67
|
+
};
|
|
68
|
+
if ("speedOptions" in normalizedConfig) {
|
|
69
|
+
normalizedConfig.speedOptions = normalizeTTSSpeedControlOptions(normalizedConfig.speedOptions);
|
|
70
|
+
}
|
|
71
|
+
return normalizedConfig;
|
|
42
72
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
{
|
|
97
|
-
element,
|
|
98
|
-
mount: "before-buttons",
|
|
99
|
-
layoutHints: {
|
|
100
|
-
controlsRow: {
|
|
101
|
-
reserveSpace: hostLayout.controlsRow.reserveSpace,
|
|
102
|
-
showWhenToolActive: hostLayout.controlsRow.expandWhenToolActive,
|
|
103
|
-
},
|
|
104
|
-
headerOverlay: {
|
|
105
|
-
showWhenToolActive: hostLayout.headerOverlay.expandWhenToolActive,
|
|
73
|
+
// TTS is inline-only and scoped to item/passage contexts.
|
|
74
|
+
supportedLevels: ["item", "passage"],
|
|
75
|
+
/**
|
|
76
|
+
* Pass 2: Determine if TTS is relevant in this context
|
|
77
|
+
*
|
|
78
|
+
* TTS is relevant when the context holds readable text or a catalog idref.
|
|
79
|
+
*/
|
|
80
|
+
isVisibleInContext(context) {
|
|
81
|
+
return hasSpokenContent(context);
|
|
82
|
+
},
|
|
83
|
+
renderToolbar(context, toolbarContext) {
|
|
84
|
+
const resolveRuntimeSettings = () => resolveTTSRuntimeSettings(toolbarContext.toolkitCoordinator?.getToolConfig(this.toolId) ||
|
|
85
|
+
undefined);
|
|
86
|
+
const resolveElementSpeedOptions = () => {
|
|
87
|
+
const runtimeSettings = resolveRuntimeSettings();
|
|
88
|
+
return normalizeTTSSpeedControlOptions(runtimeSettings.speedOptions);
|
|
89
|
+
};
|
|
90
|
+
const fullToolId = createScopedToolId(this.toolId, toolbarContext.scope.level, toolbarContext.scope.scopeId);
|
|
91
|
+
const resolveControlSize = () => {
|
|
92
|
+
const raw = toolbarContext.ui?.size;
|
|
93
|
+
return raw === "sm" || raw === "lg" ? raw : "md";
|
|
94
|
+
};
|
|
95
|
+
const element = resolveOverlayElement(toolbarContext, fullToolId, () => createToolElement(this.toolId, context, toolbarContext, toolbarContext.componentOverrides));
|
|
96
|
+
const applyAttributes = () => {
|
|
97
|
+
element.setAttribute("catalog-id", toolbarContext.catalogId || toolbarContext.itemId);
|
|
98
|
+
element.setAttribute("size", resolveControlSize());
|
|
99
|
+
element.setAttribute("layout-mode", resolveRuntimeSettings().layoutMode);
|
|
100
|
+
element.speedOptions = resolveElementSpeedOptions();
|
|
101
|
+
element.showSingleSpeedOption =
|
|
102
|
+
resolveRuntimeSettings().showSingleSpeedOption === true;
|
|
103
|
+
// The element range-checks these; a non-number means the default.
|
|
104
|
+
const speech = toolbarContext.getToolParameters?.("textToSpeech");
|
|
105
|
+
element.baseRate = numberOrUndefined(speech?.rate);
|
|
106
|
+
element.pitch = numberOrUndefined(speech?.pitch);
|
|
107
|
+
element.volume = numberOrUndefined(speech?.volume);
|
|
108
|
+
};
|
|
109
|
+
applyAttributes();
|
|
110
|
+
const hostLayout = resolveTTSHostToolbarLayout(resolveRuntimeSettings());
|
|
111
|
+
return {
|
|
112
|
+
toolId: this.toolId,
|
|
113
|
+
button: null,
|
|
114
|
+
elements: [
|
|
115
|
+
{
|
|
116
|
+
element,
|
|
117
|
+
mount: "before-buttons",
|
|
118
|
+
layoutHints: {
|
|
119
|
+
controlsRow: {
|
|
120
|
+
reserveSpace: hostLayout.controlsRow.reserveSpace,
|
|
121
|
+
showWhenToolActive: hostLayout.controlsRow.expandWhenToolActive,
|
|
122
|
+
},
|
|
123
|
+
headerOverlay: {
|
|
124
|
+
showWhenToolActive: hostLayout.headerOverlay.expandWhenToolActive,
|
|
125
|
+
},
|
|
106
126
|
},
|
|
107
127
|
},
|
|
128
|
+
],
|
|
129
|
+
subscribeActive: (callback) => {
|
|
130
|
+
const handler = (event) => {
|
|
131
|
+
const detail = event.detail;
|
|
132
|
+
callback(detail?.active === true);
|
|
133
|
+
};
|
|
134
|
+
element.addEventListener(TOOL_ACTIVE_CHANGE_EVENT, handler);
|
|
135
|
+
return () => {
|
|
136
|
+
element.removeEventListener(TOOL_ACTIVE_CHANGE_EVENT, handler);
|
|
137
|
+
};
|
|
108
138
|
},
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return () => {
|
|
117
|
-
element.removeEventListener(TOOL_ACTIVE_CHANGE_EVENT, handler);
|
|
118
|
-
};
|
|
119
|
-
},
|
|
120
|
-
sync: applyAttributes,
|
|
121
|
-
};
|
|
122
|
-
},
|
|
123
|
-
};
|
|
139
|
+
sync: applyAttributes,
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/** The text-to-speech registration with the browser and server backends only. */
|
|
145
|
+
export const ttsToolRegistration = createTTSToolRegistration();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-players/pie-default-tool-loaders",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Composition layer for the packaged PIE assessment tools: registrations, tag map, placement preset, universal and empty profiles, and lazy module loaders",
|
|
6
6
|
"repository": {
|
|
@@ -17,15 +17,17 @@
|
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
|
-
"import": "./dist/index.js"
|
|
21
|
-
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"default": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./package.json": "./package.json"
|
|
22
24
|
},
|
|
23
25
|
"files": [
|
|
24
26
|
"dist",
|
|
25
27
|
"README.md"
|
|
26
28
|
],
|
|
27
29
|
"scripts": {
|
|
28
|
-
"build": "bun run check:composition && tsc -p tsconfig.json",
|
|
30
|
+
"build": "bun run check:composition && tsc -p tsconfig.json && bun ../../scripts/prune-unreachable-declarations.mjs",
|
|
29
31
|
"check:composition": "bun test tests/packaged-capability-composition.test.ts",
|
|
30
32
|
"dev": "tsc -p tsconfig.json --watch",
|
|
31
33
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
@@ -33,29 +35,29 @@
|
|
|
33
35
|
"test": "bun test"
|
|
34
36
|
},
|
|
35
37
|
"dependencies": {
|
|
36
|
-
"@pie-players/pie-assessment-toolkit": "1.0.0-beta.
|
|
37
|
-
"@pie-players/pie-calculator": "1.0.0-beta.
|
|
38
|
-
"@pie-players/pie-calculator-
|
|
39
|
-
"@pie-players/pie-calculator-
|
|
40
|
-
"@pie-players/pie-
|
|
41
|
-
"@pie-players/pie-
|
|
42
|
-
"@pie-players/pie-tool-
|
|
43
|
-
"@pie-players/pie-tool-
|
|
44
|
-
"@pie-players/pie-tool-
|
|
45
|
-
"@pie-players/pie-tool-
|
|
46
|
-
"@pie-players/pie-tool-
|
|
47
|
-
"@pie-players/pie-tool-
|
|
48
|
-
"@pie-players/pie-tool-periodic-table": "1.0.0-beta.
|
|
49
|
-
"@pie-players/pie-tool-picture-dictionary": "1.0.0-beta.
|
|
50
|
-
"@pie-players/pie-tool-protractor": "1.0.0-beta.
|
|
51
|
-
"@pie-players/pie-tool-ruler": "1.0.0-beta.
|
|
52
|
-
"@pie-players/pie-tool-theme": "1.0.0-beta.
|
|
53
|
-
"@pie-players/pie-tool-tts-inline": "1.0.0-beta.
|
|
54
|
-
"@pie-players/tts-client-server": "1.0.0-beta.
|
|
38
|
+
"@pie-players/pie-assessment-toolkit": "1.0.0-beta.10",
|
|
39
|
+
"@pie-players/pie-calculator": "1.0.0-beta.10",
|
|
40
|
+
"@pie-players/pie-calculator-desmos": "1.0.0-beta.10",
|
|
41
|
+
"@pie-players/pie-calculator-geogebra": "1.0.0-beta.10",
|
|
42
|
+
"@pie-players/pie-players-shared": "1.0.0-beta.10",
|
|
43
|
+
"@pie-players/pie-tool-annotation-toolbar": "1.0.0-beta.10",
|
|
44
|
+
"@pie-players/pie-tool-answer-eliminator": "1.0.0-beta.10",
|
|
45
|
+
"@pie-players/pie-tool-calculator-shared": "1.0.0-beta.10",
|
|
46
|
+
"@pie-players/pie-tool-dictionary": "1.0.0-beta.10",
|
|
47
|
+
"@pie-players/pie-tool-graph": "1.0.0-beta.10",
|
|
48
|
+
"@pie-players/pie-tool-line-reader": "1.0.0-beta.10",
|
|
49
|
+
"@pie-players/pie-tool-magnifier": "1.0.0-beta.10",
|
|
50
|
+
"@pie-players/pie-tool-periodic-table": "1.0.0-beta.10",
|
|
51
|
+
"@pie-players/pie-tool-picture-dictionary": "1.0.0-beta.10",
|
|
52
|
+
"@pie-players/pie-tool-protractor": "1.0.0-beta.10",
|
|
53
|
+
"@pie-players/pie-tool-ruler": "1.0.0-beta.10",
|
|
54
|
+
"@pie-players/pie-tool-theme": "1.0.0-beta.10",
|
|
55
|
+
"@pie-players/pie-tool-tts-inline": "1.0.0-beta.10",
|
|
56
|
+
"@pie-players/tts-client-server": "1.0.0-beta.10"
|
|
55
57
|
},
|
|
56
58
|
"devDependencies": {
|
|
57
|
-
"@biomejs/biome": "^2.
|
|
58
|
-
"@happy-dom/global-registrator": "^
|
|
59
|
+
"@biomejs/biome": "^2.6.4",
|
|
60
|
+
"@happy-dom/global-registrator": "^21.0.4",
|
|
59
61
|
"typescript": "^5.9.3"
|
|
60
62
|
},
|
|
61
63
|
"homepage": "https://github.com/pie-framework/pie-players/tree/master/packages/default-tool-loaders#readme",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/** Fully bundled open-source calculator adapter for the tool-provider registry. */
|
|
2
|
-
import type { CalculatorToolProviderInitConfig, LazyCalculatorProviderDefinition } from "./LazyCalculatorToolProvider.js";
|
|
3
|
-
import { LazyCalculatorToolProvider } from "./LazyCalculatorToolProvider.js";
|
|
4
|
-
export type CortexToolProviderConfig = CalculatorToolProviderInitConfig;
|
|
5
|
-
export declare class CortexToolProvider extends LazyCalculatorToolProvider<CortexToolProviderConfig> {
|
|
6
|
-
readonly providerName = "PIE Open-Source Calculator";
|
|
7
|
-
readonly version = "1";
|
|
8
|
-
readonly requiresAuth = false;
|
|
9
|
-
protected getDefinition(): LazyCalculatorProviderDefinition<CortexToolProviderConfig>;
|
|
10
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/** Fully bundled open-source calculator adapter for the tool-provider registry. */
|
|
2
|
-
import { LazyCalculatorToolProvider } from "./LazyCalculatorToolProvider.js";
|
|
3
|
-
export class CortexToolProvider extends LazyCalculatorToolProvider {
|
|
4
|
-
providerName = "PIE Open-Source Calculator";
|
|
5
|
-
version = "1";
|
|
6
|
-
requiresAuth = false;
|
|
7
|
-
getDefinition() {
|
|
8
|
-
return {
|
|
9
|
-
backend: "cortex",
|
|
10
|
-
moduleImportOperation: "cortex-provider-module-import",
|
|
11
|
-
loadProvider: async () => {
|
|
12
|
-
const module = await import("@pie-players/pie-calculator-cortex");
|
|
13
|
-
return module.CortexCalculatorProvider;
|
|
14
|
-
},
|
|
15
|
-
initializationErrorMessage: "Failed to initialize the PIE open-source calculator provider. Confirm that this browser supports module workers and that the bundled worker assets are available.",
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** Desmos calculator adapter for the generic tool-provider registry. */
|
|
2
|
-
import type { CalculatorProviderInit } from "@pie-players/pie-calculator";
|
|
3
|
-
import { LazyCalculatorToolProvider, type LazyCalculatorProviderDefinition } from "./LazyCalculatorToolProvider.js";
|
|
4
|
-
/** Provider initialization is the provider-neutral calculator contract. */
|
|
5
|
-
export type DesmosToolProviderConfig = CalculatorProviderInit;
|
|
6
|
-
export declare class DesmosToolProvider extends LazyCalculatorToolProvider<DesmosToolProviderConfig> {
|
|
7
|
-
readonly providerName = "Desmos Calculator";
|
|
8
|
-
readonly version = "1.12";
|
|
9
|
-
readonly requiresAuth = true;
|
|
10
|
-
protected getDefinition(): LazyCalculatorProviderDefinition<DesmosToolProviderConfig>;
|
|
11
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/** Desmos calculator adapter for the generic tool-provider registry. */
|
|
2
|
-
import { LazyCalculatorToolProvider, } from "./LazyCalculatorToolProvider.js";
|
|
3
|
-
export class DesmosToolProvider extends LazyCalculatorToolProvider {
|
|
4
|
-
providerName = "Desmos Calculator";
|
|
5
|
-
version = "1.12";
|
|
6
|
-
requiresAuth = true;
|
|
7
|
-
getDefinition() {
|
|
8
|
-
return {
|
|
9
|
-
backend: "desmos",
|
|
10
|
-
moduleImportOperation: "desmos-provider-module-import",
|
|
11
|
-
loadProvider: async () => {
|
|
12
|
-
const module = await import("@pie-players/pie-calculator-desmos");
|
|
13
|
-
return module.DesmosCalculatorProvider;
|
|
14
|
-
},
|
|
15
|
-
initializationErrorMessage: "Failed to initialize Desmos calculator provider. Check the application key, preloaded API, runtime endpoint, or network access.",
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** GeoGebra calculator adapter for the generic tool-provider registry. */
|
|
2
|
-
import type { CalculatorToolProviderInitConfig, LazyCalculatorProviderDefinition } from "./LazyCalculatorToolProvider.js";
|
|
3
|
-
import { LazyCalculatorToolProvider } from "./LazyCalculatorToolProvider.js";
|
|
4
|
-
export interface GeoGebraToolProviderConfig extends CalculatorToolProviderInitConfig {
|
|
5
|
-
scriptUrl?: string;
|
|
6
|
-
appletTimeoutMs?: number;
|
|
7
|
-
}
|
|
8
|
-
export declare class GeoGebraToolProvider extends LazyCalculatorToolProvider<GeoGebraToolProviderConfig> {
|
|
9
|
-
readonly providerName = "GeoGebra Calculator";
|
|
10
|
-
readonly version = "6";
|
|
11
|
-
readonly requiresAuth = false;
|
|
12
|
-
protected getDefinition(): LazyCalculatorProviderDefinition<GeoGebraToolProviderConfig>;
|
|
13
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/** GeoGebra calculator adapter for the generic tool-provider registry. */
|
|
2
|
-
import { LazyCalculatorToolProvider } from "./LazyCalculatorToolProvider.js";
|
|
3
|
-
export class GeoGebraToolProvider extends LazyCalculatorToolProvider {
|
|
4
|
-
providerName = "GeoGebra Calculator";
|
|
5
|
-
version = "6";
|
|
6
|
-
requiresAuth = false;
|
|
7
|
-
getDefinition() {
|
|
8
|
-
return {
|
|
9
|
-
backend: "geogebra",
|
|
10
|
-
moduleImportOperation: "geogebra-provider-module-import",
|
|
11
|
-
loadProvider: async () => {
|
|
12
|
-
const module = await import("@pie-players/pie-calculator-geogebra");
|
|
13
|
-
return module.GeoGebraCalculatorProvider;
|
|
14
|
-
},
|
|
15
|
-
initializationErrorMessage: "Failed to initialize GeoGebra calculator provider. Confirm that the deployment may load GeoGebra and that its script URL is reachable.",
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* One overlay element per coordinator and scoped tool id, reused across renders.
|
|
3
|
-
*
|
|
4
|
-
* The toolbar re-derives its rendered tools whenever an input moves — a policy
|
|
5
|
-
* emit, a tool-config update, the interface locale — and mounts whichever
|
|
6
|
-
* element each render returns, swapping out one it has not seen. A registration
|
|
7
|
-
* that creates its overlay on every render therefore remounts it, and the
|
|
8
|
-
* learner loses the ruler's position, the graph's points or the eliminated
|
|
9
|
-
* choices while the tool stays open. Reusing the element keeps the mount a
|
|
10
|
-
* no-op, so per-render attributes are the registration's to re-apply.
|
|
11
|
-
*
|
|
12
|
-
* A Svelte custom element tears its component down once it leaves the document,
|
|
13
|
-
* so a cached element found disconnected is dropped and recreated.
|
|
14
|
-
*/
|
|
15
|
-
import type { ToolbarContext } from "@pie-players/pie-assessment-toolkit/tools/registration";
|
|
16
|
-
/** The property the toolbar calls as it unmounts a tool element. */
|
|
17
|
-
export declare const TOOL_ELEMENT_UNMOUNT_CALLBACK_PROP = "__pieToolElementUnmount";
|
|
18
|
-
/**
|
|
19
|
-
* The element cached for `fullToolId` under this toolbar's coordinator, or the
|
|
20
|
-
* one `create` returns, which is then cached. Without a coordinator there is no
|
|
21
|
-
* session to key by, and every render creates.
|
|
22
|
-
*/
|
|
23
|
-
export declare function resolveOverlayElement<T extends HTMLElement>(toolbarContext: ToolbarContext, fullToolId: string, create: () => T): T;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `renderToolbar` shape shared by every packaged capability that puts one
|
|
3
|
-
* overlay behind one toolbar button.
|
|
4
|
-
*
|
|
5
|
-
* What varies between capabilities is the two options below: whether the overlay
|
|
6
|
-
* paints its own chrome or takes a draggable window, and that window's size. The
|
|
7
|
-
* visibility binding, the button, the component-override lookup, the `tool-id`
|
|
8
|
-
* attribute and the sync are shared, so the shell title has one spelling.
|
|
9
|
-
*
|
|
10
|
-
* Catalog keys are derived from `toolId`: `tools.<toolId>.buttonA11y` and
|
|
11
|
-
* `tools.<toolId>.tooltip`. A capability needing a different prefix — the
|
|
12
|
-
* dictionary variants, which compose several capabilities off one element —
|
|
13
|
-
* keeps its own renderer.
|
|
14
|
-
*/
|
|
15
|
-
import { type ToolContext, type ToolRegistration, type ToolToolbarRenderResult, type ToolbarContext } from "@pie-players/pie-assessment-toolkit/tools/registration";
|
|
16
|
-
/** A window's geometry. Absent for overlays that paint their own chrome. */
|
|
17
|
-
export interface OverlayToolShell {
|
|
18
|
-
resizable: boolean;
|
|
19
|
-
initialWidth: number;
|
|
20
|
-
initialHeight: number;
|
|
21
|
-
minWidth: number;
|
|
22
|
-
minHeight: number;
|
|
23
|
-
}
|
|
24
|
-
export interface RenderOverlayToolbarOptions {
|
|
25
|
-
/**
|
|
26
|
-
* `"frameless"` for an overlay that draws its own surface — a ruler or a line
|
|
27
|
-
* reader sits on the content rather than in a panel.
|
|
28
|
-
*/
|
|
29
|
-
surface?: "frameless";
|
|
30
|
-
/** Present when the capability opens in a draggable, closeable window. */
|
|
31
|
-
shell?: OverlayToolShell;
|
|
32
|
-
}
|
|
33
|
-
export declare function renderOverlayToolbar(registration: ToolRegistration, context: ToolContext, toolbarContext: ToolbarContext, options?: RenderOverlayToolbarOptions): ToolToolbarRenderResult;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Which capabilities appear as actions on the learner's current selection.
|
|
3
|
-
*
|
|
4
|
-
* The one place that pairs a selection gateway to the tools it can open. The gateway
|
|
5
|
-
* renders what it is handed and names nothing; the tools know nothing about
|
|
6
|
-
* selections. Composition is the only layer allowed to know both, which is why this
|
|
7
|
-
* list lives here rather than in either of them.
|
|
8
|
-
*
|
|
9
|
-
* A selection is a shortcut, never the only way in. Chromium does not extend a
|
|
10
|
-
* selection with Shift+Arrow in non-editable content unless caret browsing is on —
|
|
11
|
-
* an OS toggle that does not exist on mobile — so a sighted keyboard-only learner
|
|
12
|
-
* cannot originate one at all. Every tool named here also opens from the toolbar and
|
|
13
|
-
* carries its own term field.
|
|
14
|
-
*/
|
|
15
|
-
import type { ToolSelectionAction, ToolSurfaceServices } from "@pie-players/pie-assessment-toolkit/tools/registration";
|
|
16
|
-
/**
|
|
17
|
-
* Actions for the gateway to render, given the services it was handed.
|
|
18
|
-
*
|
|
19
|
-
* Rebuilt on every sync rather than captured once: a host calling
|
|
20
|
-
* `updateAssessment` mid-session swaps the coordinator without remounting the
|
|
21
|
-
* gateway, and an action closing over the previous one would open a tool in a
|
|
22
|
-
* session the learner has left.
|
|
23
|
-
*/
|
|
24
|
-
export declare function buildSelectionActions(services: ToolSurfaceServices): ToolSelectionAction[];
|