@pie-players/pie-default-tool-loaders 0.1.1

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/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # PIE Default Tool Loaders
2
+
3
+ Default lazy module loader mappings for built-in PIE assessment tools.
4
+
5
+ This package intentionally owns concrete `pie-tool-*` dependencies so toolkit core can remain dependency-light and cycle-safe.
6
+
7
+ ## Usage
8
+
9
+ ```ts
10
+ import { createDefaultToolRegistry } from "@pie-players/pie-assessment-toolkit";
11
+ import {
12
+ DEFAULT_TOOL_MODULE_LOADERS,
13
+ registerSectionToolModuleLoaders,
14
+ } from "@pie-players/pie-default-tool-loaders";
15
+
16
+ // Full default loaders (item + section tools)
17
+ const registry = createDefaultToolRegistry({
18
+ toolModuleLoaders: DEFAULT_TOOL_MODULE_LOADERS,
19
+ });
20
+
21
+ // Section-only loaders (for section toolbar bootstrap points)
22
+ registerSectionToolModuleLoaders(registry);
23
+ ```
24
+
@@ -0,0 +1,17 @@
1
+ export type ToolModuleLoader = () => Promise<unknown>;
2
+ export interface ToolRegistryLike {
3
+ setToolModuleLoaders(loaders: Partial<Record<string, ToolModuleLoader>>): void;
4
+ }
5
+ export declare const SECTION_TOOL_MODULE_LOADERS: Record<string, ToolModuleLoader>;
6
+ export declare const ITEM_TOOL_MODULE_LOADERS: Record<string, ToolModuleLoader>;
7
+ export declare const DEFAULT_TOOL_MODULE_LOADERS: Record<string, ToolModuleLoader>;
8
+ export type RegisterDefaultToolModuleLoadersOptions = {
9
+ loaders?: Partial<Record<string, ToolModuleLoader>>;
10
+ };
11
+ /**
12
+ * Register built-in lazy module loaders on a registry.
13
+ * Hosts can override or extend the defaults via options.loaders.
14
+ */
15
+ export declare function registerDefaultToolModuleLoaders(registry: ToolRegistryLike, options?: RegisterDefaultToolModuleLoadersOptions): void;
16
+ export declare function registerSectionToolModuleLoaders(registry: ToolRegistryLike, options?: RegisterDefaultToolModuleLoadersOptions): void;
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAChC,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,GAAG,IAAI,CAAC;CAC/E;AAaD,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAOxE,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAOrE,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAGxE,CAAC;AAEF,MAAM,MAAM,uCAAuC,GAAG;IACrD,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;CACpD,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gCAAgC,CAC/C,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,GAAE,uCAA4C,GACnD,IAAI,CAKN;AAED,wBAAgB,gCAAgC,CAC/C,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,GAAE,uCAA4C,GACnD,IAAI,CAKN"}
package/dist/index.js ADDED
@@ -0,0 +1,45 @@
1
+ function loadCalculatorModule() {
2
+ if (typeof globalThis !== "undefined" &&
3
+ "customElements" in globalThis &&
4
+ globalThis.customElements?.get("pie-tool-calculator")) {
5
+ return Promise.resolve();
6
+ }
7
+ return import("@pie-players/pie-tool-calculator");
8
+ }
9
+ export const SECTION_TOOL_MODULE_LOADERS = {
10
+ calculator: loadCalculatorModule,
11
+ graph: () => import("@pie-players/pie-tool-graph"),
12
+ periodicTable: () => import("@pie-players/pie-tool-periodic-table"),
13
+ ruler: () => import("@pie-players/pie-tool-ruler"),
14
+ protractor: () => import("@pie-players/pie-tool-protractor"),
15
+ lineReader: () => import("@pie-players/pie-tool-line-reader"),
16
+ };
17
+ export const ITEM_TOOL_MODULE_LOADERS = {
18
+ calculator: loadCalculatorModule,
19
+ textToSpeech: () => import("@pie-players/pie-tool-text-to-speech"),
20
+ answerEliminator: () => import("@pie-players/pie-tool-answer-eliminator"),
21
+ highlighter: () => import("@pie-players/pie-tool-annotation-toolbar"),
22
+ annotationToolbar: () => import("@pie-players/pie-tool-annotation-toolbar"),
23
+ colorScheme: () => import("@pie-players/pie-tool-color-scheme"),
24
+ };
25
+ export const DEFAULT_TOOL_MODULE_LOADERS = {
26
+ ...ITEM_TOOL_MODULE_LOADERS,
27
+ ...SECTION_TOOL_MODULE_LOADERS,
28
+ };
29
+ /**
30
+ * Register built-in lazy module loaders on a registry.
31
+ * Hosts can override or extend the defaults via options.loaders.
32
+ */
33
+ export function registerDefaultToolModuleLoaders(registry, options = {}) {
34
+ registry.setToolModuleLoaders({
35
+ ...DEFAULT_TOOL_MODULE_LOADERS,
36
+ ...(options.loaders || {}),
37
+ });
38
+ }
39
+ export function registerSectionToolModuleLoaders(registry, options = {}) {
40
+ registry.setToolModuleLoaders({
41
+ ...SECTION_TOOL_MODULE_LOADERS,
42
+ ...(options.loaders || {}),
43
+ });
44
+ }
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,SAAS,oBAAoB;IAC5B,IACC,OAAO,UAAU,KAAK,WAAW;QACjC,gBAAgB,IAAI,UAAU;QAC9B,UAAU,CAAC,cAAc,EAAE,GAAG,CAAC,qBAAqB,CAAC,EACpD,CAAC;QACF,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;IACD,OAAO,MAAM,CAAC,kCAAkC,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,CA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CAAC,OAAO,IAAI,EAAE,CAAC;KAC1B,CAAC,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@pie-players/pie-default-tool-loaders",
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "description": "Default lazy module loaders for PIE assessment tools",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/pie-framework/pie-players.git",
9
+ "directory": "packages/default-tool-loaders"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "license": "MIT",
15
+ "main": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.js"
21
+ }
22
+ },
23
+ "files": [
24
+ "dist",
25
+ "README.md"
26
+ ],
27
+ "scripts": {
28
+ "build": "tsc -p tsconfig.json",
29
+ "dev": "tsc -p tsconfig.json --watch",
30
+ "typecheck": "tsc -p tsconfig.json --noEmit",
31
+ "lint": "biome check ."
32
+ },
33
+ "dependencies": {
34
+ "@pie-players/pie-tool-annotation-toolbar": "0.1.9",
35
+ "@pie-players/pie-tool-answer-eliminator": "0.2.9",
36
+ "@pie-players/pie-tool-calculator": "0.1.9",
37
+ "@pie-players/pie-tool-color-scheme": "0.1.9",
38
+ "@pie-players/pie-tool-graph": "0.1.9",
39
+ "@pie-players/pie-tool-line-reader": "0.1.9",
40
+ "@pie-players/pie-tool-periodic-table": "0.1.9",
41
+ "@pie-players/pie-tool-protractor": "0.1.9",
42
+ "@pie-players/pie-tool-ruler": "0.1.9",
43
+ "@pie-players/pie-tool-text-to-speech": "0.1.9"
44
+ },
45
+ "devDependencies": {
46
+ "@biomejs/biome": "^2.3.10",
47
+ "typescript": "^5.9.3"
48
+ },
49
+ "homepage": "https://github.com/pie-framework/pie-players/tree/master/packages/default-tool-loaders#readme",
50
+ "bugs": {
51
+ "url": "https://github.com/pie-framework/pie-players/issues"
52
+ },
53
+ "engines": {
54
+ "node": ">=18.0.0"
55
+ },
56
+ "sideEffects": false
57
+ }