@pie-players/pie-tool-graph 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 +59 -12
- package/custom-elements.json +68 -0
- package/dist/tool-graph.js +1398 -1372
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -1,27 +1,74 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @pie-players/pie-tool-graph
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The graph tool (`graph`): a coordinate grid on which a learner plots points and
|
|
4
|
+
joins them with lines, as scratch work beside math content. It registers
|
|
5
|
+
`<pie-tool-graph>`. The tool records nothing as a response.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun add @pie-players/pie-tool-graph
|
|
11
|
+
```
|
|
4
12
|
|
|
5
13
|
## Usage
|
|
6
14
|
|
|
7
|
-
|
|
15
|
+
The packaged tool set registers the tool as `graph` and loads the element on
|
|
16
|
+
demand; hosts place it through `tools.placement`. It supports the section level,
|
|
17
|
+
and the item level where the toolkit runs without a section; the section
|
|
18
|
+
toolbar is its recommended placement. The toolbar offers it only where the
|
|
19
|
+
content contains math. It opens in a resizable overlay, 920×680px initially and
|
|
20
|
+
at least 640×500px. A host that registers the element itself imports the
|
|
21
|
+
package:
|
|
8
22
|
|
|
9
23
|
```ts
|
|
10
24
|
import "@pie-players/pie-tool-graph";
|
|
11
25
|
```
|
|
12
26
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
27
|
+
| Property | Attribute | Default | Purpose |
|
|
28
|
+
| --- | --- | --- | --- |
|
|
29
|
+
| `visible` | `visible` | `false` | Shows the tool. `"false"`, `"0"`, `"off"` and `"no"` read as false. |
|
|
30
|
+
| `toolId` | `tool-id` | `"graph"` | Tool instance id, set on the dialog as `data-pie-tool-id`. |
|
|
16
31
|
|
|
17
|
-
|
|
32
|
+
The element has an open shadow root and takes its interface locale from the
|
|
33
|
+
toolkit runtime context.
|
|
18
34
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
|
22
|
-
|
|
|
35
|
+
## Modes
|
|
36
|
+
|
|
37
|
+
| Mode | Pointer | Keyboard |
|
|
38
|
+
| --- | --- | --- |
|
|
39
|
+
| Select | Drags a point. | — |
|
|
40
|
+
| Point | Places a point where clicked. | Enter or Space places a point at the cursor. |
|
|
41
|
+
| Line | Joins two clicks with a line; a click within one minor cell of a point reuses it, otherwise it places a new point. | Enter or Space at the cursor, or on a focused point, starts or completes a line. |
|
|
42
|
+
| Delete | Removes the point under the click and its lines. | Enter or Space on a focused point removes it. |
|
|
43
|
+
|
|
44
|
+
A line never joins a point to itself or duplicates an existing line. Changing
|
|
45
|
+
mode cancels a line in progress.
|
|
46
|
+
|
|
47
|
+
## Grid and keyboard
|
|
48
|
+
|
|
49
|
+
The grid has five major rows, each divided into a 5×5 minor grid, and widens
|
|
50
|
+
with the overlay. A slider sets the grid's opacity from 0 to 1.
|
|
51
|
+
|
|
52
|
+
The canvas is focusable. Arrow keys move a keyboard cursor one minor-grid step,
|
|
53
|
+
starting from the canvas center and snapped to minor intersections; pointer
|
|
54
|
+
placement is not snapped. Each point is focusable on its own.
|
|
55
|
+
|
|
56
|
+
## State
|
|
57
|
+
|
|
58
|
+
Points and lines live in the element and are not written to the tool-state
|
|
59
|
+
store. The toolkit reuses the element while the tool stays in the same scope, so
|
|
60
|
+
they survive closing and reopening it; a section change starts them over, as
|
|
61
|
+
[Lifetimes and scope consequences](../../docs/tools-and-accomodations/architecture.md#lifetimes-and-scope-consequences)
|
|
62
|
+
describes.
|
|
63
|
+
|
|
64
|
+
## Styling
|
|
65
|
+
|
|
66
|
+
The tool reads the canonical semantic tokens `--pie-background`, `--pie-white`,
|
|
67
|
+
`--pie-text`, `--pie-border-light`, `--pie-border-dark`, `--pie-primary`,
|
|
68
|
+
`--pie-primary-light`, `--pie-primary-dark`, `--pie-correct`, `--pie-missing`,
|
|
69
|
+
`--pie-missing-icon` and `--pie-button-focus-outline`.
|
|
23
70
|
|
|
24
|
-
## Related
|
|
71
|
+
## Related documentation
|
|
25
72
|
|
|
26
73
|
- [Tools and accommodations architecture](../../docs/tools-and-accomodations/architecture.md)
|
|
27
74
|
- [Tool provider system](../../docs/tools-and-accomodations/tool_provider_system.md)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "2.1.0",
|
|
3
|
+
"modules": [
|
|
4
|
+
{
|
|
5
|
+
"kind": "javascript-module",
|
|
6
|
+
"path": "dist/tool-graph.js",
|
|
7
|
+
"declarations": [
|
|
8
|
+
{
|
|
9
|
+
"kind": "class",
|
|
10
|
+
"description": "Coordinate-grid graphing tool: the student places points, joins them with lines, drags points in select mode and removes them in delete mode, and sets the grid's opacity with a slider. The host shows it with `visible`; the toolkit runtime context supplies its interface locale. On the focused grid, arrow keys move a cursor along the minor grid and Enter or Space applies the current mode at it.",
|
|
11
|
+
"name": "ToolGraph",
|
|
12
|
+
"tagName": "pie-tool-graph",
|
|
13
|
+
"customElement": true,
|
|
14
|
+
"members": [
|
|
15
|
+
{
|
|
16
|
+
"kind": "field",
|
|
17
|
+
"name": "visible",
|
|
18
|
+
"type": {
|
|
19
|
+
"text": "boolean"
|
|
20
|
+
},
|
|
21
|
+
"default": "false",
|
|
22
|
+
"attribute": "visible"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"kind": "field",
|
|
26
|
+
"name": "toolId",
|
|
27
|
+
"type": {
|
|
28
|
+
"text": "string"
|
|
29
|
+
},
|
|
30
|
+
"default": "'graph'",
|
|
31
|
+
"attribute": "tool-id"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"attributes": [
|
|
35
|
+
{
|
|
36
|
+
"name": "visible",
|
|
37
|
+
"type": {
|
|
38
|
+
"text": "boolean"
|
|
39
|
+
},
|
|
40
|
+
"default": "false",
|
|
41
|
+
"fieldName": "visible"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "tool-id",
|
|
45
|
+
"type": {
|
|
46
|
+
"text": "string"
|
|
47
|
+
},
|
|
48
|
+
"default": "'graph'",
|
|
49
|
+
"fieldName": "toolId"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"x-pie": {
|
|
53
|
+
"shadow": "open"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"exports": [
|
|
58
|
+
{
|
|
59
|
+
"kind": "custom-element-definition",
|
|
60
|
+
"name": "pie-tool-graph",
|
|
61
|
+
"declaration": {
|
|
62
|
+
"name": "ToolGraph"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|