@pie-players/pie-tool-calculator-desmos 0.3.75 → 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 +55 -18
- package/custom-elements.json +21 -0
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -1,38 +1,75 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @pie-players/pie-tool-calculator-desmos
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`@pie-players/pie-tool-calculator-shared/calculator-element
|
|
6
|
-
|
|
7
|
-
|
|
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.
|
|
8
11
|
|
|
9
|
-
|
|
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
|
+
```
|
|
10
21
|
|
|
11
|
-
|
|
22
|
+
## Usage
|
|
12
23
|
|
|
13
24
|
```ts
|
|
14
25
|
import "@pie-players/pie-tool-calculator-desmos";
|
|
15
26
|
```
|
|
16
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
|
+
|
|
17
34
|
```html
|
|
18
35
|
<pie-tool-calculator
|
|
19
|
-
visible
|
|
36
|
+
visible
|
|
20
37
|
tool-id="calculator"
|
|
21
38
|
calculator-type="scientific"
|
|
22
39
|
></pie-tool-calculator>
|
|
23
40
|
```
|
|
24
41
|
|
|
25
|
-
##
|
|
42
|
+
## Attributes and properties
|
|
26
43
|
|
|
27
|
-
|
|
|
44
|
+
| Property | Attribute | Default | Purpose |
|
|
28
45
|
| --- | --- | --- | --- |
|
|
29
|
-
| `visible` | `
|
|
30
|
-
| `toolId` | `
|
|
31
|
-
| `calculatorType` | `
|
|
32
|
-
| `availableTypes` | `
|
|
33
|
-
| `calculatorConfig` |
|
|
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`.
|
|
34
69
|
|
|
35
|
-
## Related
|
|
70
|
+
## Related documentation
|
|
36
71
|
|
|
37
|
-
- [Calculator providers](../default-tool-loaders/
|
|
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
|
|
38
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
|
+
"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,17 +43,16 @@
|
|
|
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.
|
|
45
|
-
"@pie-players/pie-tool-calculator-shared": "0.
|
|
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.75",
|
|
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.
|
|
55
|
+
"vite": "^8.3.3",
|
|
55
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",
|