@pie-players/pie-tool-calculator-desmos 0.3.74 → 1.0.0-beta.0

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 CHANGED
@@ -1,39 +1,75 @@
1
- # Desmos Calculator Tool
1
+ # @pie-players/pie-tool-calculator-desmos
2
2
 
3
- Calculator custom element backed by the Desmos provider for PIE assessment
4
- player flows. It is a thin compatibility entry for
5
- `@pie-players/pie-tool-calculator-shared/calculator-element`, which holds the
6
- Desmos-specific layout rules and the default `calculator-desmos` provider id.
3
+ A compatibility entry that registers `<pie-tool-calculator>`, the assessment
4
+ toolkit's provider-neutral calculator element. Importing it has the same effect
5
+ as importing `@pie-players/pie-tool-calculator-shared/calculator-element`; the
6
+ `desmos` in the name is historical. The element mounts whichever adapter the
7
+ toolkit's `tools.providers.calculator` selects, [Desmos](../calculator-desmos/README.md),
8
+ [GeoGebra](../calculator-geogebra/README.md) or [Cortex](../calculator-cortex/README.md),
9
+ as [Calculator providers](../default-tool-loaders/README.md#calculator-providers)
10
+ describes.
7
11
 
8
- ## Usage
12
+ The toolkit's packaged tool set loads the same element on demand and skips the
13
+ load when the tag is already defined, so a toolkit host needs this package only
14
+ to register the element ahead of that load, for example in an eager bundle.
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ bun add @pie-players/pie-tool-calculator-desmos
20
+ ```
9
21
 
10
- Import the package to register `<pie-tool-calculator>`:
22
+ ## Usage
11
23
 
12
24
  ```ts
13
25
  import "@pie-players/pie-tool-calculator-desmos";
14
26
  ```
15
27
 
28
+ The toolkit's calculator registration creates the element in the item toolbar's
29
+ overlay and sets its type, allowed types and `calculatorConfig`. A host that
30
+ places the element itself puts it inside a section or item player running the
31
+ toolkit: the element reads the toolkit runtime context and mounts nothing
32
+ without a toolkit coordinator.
33
+
16
34
  ```html
17
35
  <pie-tool-calculator
18
- visible="true"
36
+ visible
19
37
  tool-id="calculator"
20
38
  calculator-type="scientific"
21
39
  ></pie-tool-calculator>
22
40
  ```
23
41
 
24
- ## Props
42
+ ## Attributes and properties
25
43
 
26
- | Prop | Type | Default | Description |
44
+ | Property | Attribute | Default | Purpose |
27
45
  | --- | --- | --- | --- |
28
- | `visible` | `boolean` | `false` | Controls whether the calculator is visible. |
29
- | `toolId` | `string` | `calculator` | Tool identifier used by the assessment toolkit runtime context. |
30
- | `providerId` | `string` | `calculator-desmos` | Toolkit provider registry id. |
31
- | `calculatorType` | `string` | package default | Requested calculator mode. |
32
- | `availableTypes` | `string[]` | package default | Calculator modes the host allows. |
33
- | `calculatorConfig` | `CalculatorProviderConfig` | `{}` | Provider-neutral options plus implementation-owned `settings`. |
34
- | `toolkitCoordinator` | `ToolkitCoordinator` | unset | Optional coordinator reference for toolkit-managed flows. |
46
+ | `visible` | `visible` | `false` | Mounts the calculator while true and destroys it when false. `"false"`, `"0"`, `"off"` and `"no"` read as false. |
47
+ | `toolId` | `tool-id` | `"calculator"` | Tool instance id. The element resolves the provider under its base tool id, the id without the toolkit's `:<level>:<scopeId>` suffix. |
48
+ | `calculatorType` | `calculator-type` | `"basic"` | `basic`, `scientific` or `graphing`. A type outside `availableTypes` falls back to the first allowed type. |
49
+ | `availableTypes` | `available-types` | All three types | Allowed types. The attribute takes a JSON array; the property also accepts a comma-separated string. Unknown values are dropped. |
50
+ | `calculatorConfig` | — | `{}` | `CalculatorProviderConfig` passed to `createCalculator()`. The toolkit sets it from the calculator tool config: `settings`, `restrictedMode`, `locale` and `theme`. |
51
+
52
+ ## Behavior
53
+
54
+ The element renders without a shadow root. On mount it calls the toolkit
55
+ coordinator's `ensureProviderReady()` for the base tool id, creates a provider
56
+ instance, and creates the calculator in its container. A change to the tool id,
57
+ effective type or `calculatorConfig` remounts the calculator, and so does a tool
58
+ config update that replaces the provider. When the provider declares an
59
+ attribution, the element renders it as a link below the calculator. A failed
60
+ mount shows "Calculator failed to initialize." with the error message.
61
+
62
+ The element does not persist calculator state; hiding it destroys the
63
+ calculator. Hosts that save and restore state drive an adapter directly through
64
+ the [`@pie-players/pie-calculator`](../calculator/README.md) contract.
65
+
66
+ ## Exports
67
+
68
+ The entry exports the type `CalculatorType` from `@pie-players/pie-calculator`.
35
69
 
36
- ## Related Documentation
70
+ ## Related documentation
37
71
 
38
- - [Calculator tools README](../assessment-toolkit/src/tools/calculators/README.md)
72
+ - [Calculator providers](../default-tool-loaders/README.md#calculator-providers)
73
+ - [`@pie-players/pie-tool-calculator-inline-desmos`](../tool-calculator-inline-desmos/README.md),
74
+ the item-header button that opens this calculator
39
75
  - [Tools and accommodations architecture](../../docs/tools-and-accomodations/architecture.md)
@@ -0,0 +1,21 @@
1
+ {
2
+ "schemaVersion": "2.1.0",
3
+ "modules": [
4
+ {
5
+ "kind": "javascript-module",
6
+ "path": "dist/pie-tool-calculator.js",
7
+ "declarations": [],
8
+ "exports": [
9
+ {
10
+ "kind": "custom-element-definition",
11
+ "name": "pie-tool-calculator",
12
+ "declaration": {
13
+ "name": "CalculatorElement",
14
+ "module": "dist/calculator-element.js",
15
+ "package": "@pie-players/pie-tool-calculator-shared"
16
+ }
17
+ }
18
+ ]
19
+ }
20
+ ]
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-players/pie-tool-calculator-desmos",
3
- "version": "0.3.74",
3
+ "version": "1.0.0-beta.0",
4
4
  "type": "module",
5
5
  "description": "Calculator tool for PIE assessment player",
6
6
  "repository": {
@@ -25,8 +25,10 @@
25
25
  "import": "./dist/pie-tool-calculator.js"
26
26
  }
27
27
  },
28
+ "customElements": "custom-elements.json",
28
29
  "files": [
29
30
  "dist",
31
+ "custom-elements.json",
30
32
  "README.md"
31
33
  ],
32
34
  "scripts": {
@@ -41,18 +43,17 @@
41
43
  "unpkg": "./dist/pie-tool-calculator.js",
42
44
  "jsdelivr": "./dist/pie-tool-calculator.js",
43
45
  "dependencies": {
44
- "@pie-players/pie-calculator": "0.3.74",
45
- "@pie-players/pie-tool-calculator-shared": "0.3.74"
46
+ "@pie-players/pie-calculator": "1.0.0-beta.0",
47
+ "@pie-players/pie-tool-calculator-shared": "1.0.0-beta.0"
46
48
  },
47
49
  "devDependencies": {
48
50
  "@biomejs/biome": "^2.5.15",
49
- "@pie-players/pie-calculator-desmos": "0.3.74",
50
51
  "@sveltejs/vite-plugin-svelte": "^7.3.1",
51
52
  "svelte": "^5.57.1",
52
53
  "svelte-check": "^4.7.6",
53
54
  "typescript": "^5.9.3",
54
- "vite": "^8.3.2",
55
- "vite-plugin-dts": "^5.1.1"
55
+ "vite": "^8.3.3",
56
+ "vite-plugin-dts": "^5.1.2"
56
57
  },
57
58
  "homepage": "https://github.com/pie-framework/pie-players/tree/master/packages/tool-calculator-desmos#readme",
58
59
  "bugs": {