@pie-players/pie-tool-picture-dictionary 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
@@ -7,6 +7,7 @@ Picture dictionary panel for the PIE assessment player. Registers
7
7
 
8
8
  PIE ships no endpoint. The symbol corpus behind a picture dictionary is licensed, so
9
9
  a host supplies one.
10
+ [Dictionary Languages And Services](../../docs/tools-and-accomodations/dictionary-languages-and-services.md) records where service selection, credentials and the lookup language sit.
10
11
 
11
12
  ```html
12
13
  <pie-tool-picture-dictionary endpoint="/api/picture-dictionary" language="en">
@@ -23,7 +24,7 @@ element.lookup = async ({ keyword, language, max }, signal) => ({
23
24
  With neither, the panel says no service is configured.
24
25
 
25
26
  The endpoint is called `same-origin`, so a route already behind the assessment's own
26
- session answers with no further configuration. A host authorising some other way
27
+ session answers with no further configuration. A host authorizing some other way
27
28
  passes a `headers` function, read per request so a short-lived token is fetched fresh;
28
29
  one that wants no ambient credentials passes `credentials: "omit"`. Both are optional
29
30
  properties.
@@ -31,7 +32,7 @@ properties.
31
32
  ### Request
32
33
 
33
34
  `POST` with `{ keyword, language?, max? }` — the shape a picture-dictionary service
34
- is expected to accept. `keyword` is normalised before it is sent, and a selection
35
+ is expected to accept. `keyword` is normalized before it is sent, and a selection
35
36
  longer than four words is refused without a request.
36
37
 
37
38
  ### Response
@@ -0,0 +1,187 @@
1
+ {
2
+ "schemaVersion": "2.1.0",
3
+ "modules": [
4
+ {
5
+ "kind": "javascript-module",
6
+ "path": "dist/tool-picture-dictionary.js",
7
+ "declarations": [
8
+ {
9
+ "kind": "class",
10
+ "description": "Picture dictionary panel body: a word-or-phrase field and the pictures found for it, each with its caption, or else the searched word, as alt text. Lookup is host-supplied, through a `lookup` function or a POST to `endpoint`, and a picture whose URL is not https, protocol-relative or same-origin is dropped. The toolbar shell that mounts it owns `visible` and the floating chrome, and a `term` set from a text selection opens the panel already searched.",
11
+ "name": "ToolPictureDictionary",
12
+ "tagName": "pie-tool-picture-dictionary",
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": "'pictureDictionary'",
31
+ "attribute": "tool-id"
32
+ },
33
+ {
34
+ "kind": "field",
35
+ "name": "term",
36
+ "type": {
37
+ "text": "string"
38
+ },
39
+ "default": "''",
40
+ "attribute": "term"
41
+ },
42
+ {
43
+ "kind": "field",
44
+ "name": "termRequestId",
45
+ "type": {
46
+ "text": "string | number"
47
+ },
48
+ "description": "Identity of the current `term`, changing once per time it was asked for. Optional: a host assigning `term` directly need not mint one, and the panel falls back to the term itself. What it buys is a learner selecting the same word twice — a second request for `cat` has a new id, so it re-runs, where an unchanged `term` alone looks like a re-render.",
49
+ "attribute": "termrequestid"
50
+ },
51
+ {
52
+ "kind": "field",
53
+ "name": "endpoint",
54
+ "type": {
55
+ "text": "string"
56
+ },
57
+ "default": "''",
58
+ "attribute": "endpoint"
59
+ },
60
+ {
61
+ "kind": "field",
62
+ "name": "language",
63
+ "type": {
64
+ "text": "string"
65
+ },
66
+ "default": "''",
67
+ "attribute": "language"
68
+ },
69
+ {
70
+ "kind": "field",
71
+ "name": "lookup",
72
+ "type": {
73
+ "text": "PictureLookup"
74
+ },
75
+ "description": "Host-supplied resolver, preferred over `endpoint`.",
76
+ "attribute": "lookup"
77
+ },
78
+ {
79
+ "kind": "field",
80
+ "name": "headers",
81
+ "type": {
82
+ "text": "() => Promise<Record<string, string>> | Record<string, string>"
83
+ },
84
+ "description": "Extra request headers for the `endpoint` path, read per request so a short-lived token is fetched fresh. Only for a host whose route is not authorised by the assessment's own session, which is called `same-origin` by default.",
85
+ "attribute": "headers"
86
+ },
87
+ {
88
+ "kind": "field",
89
+ "name": "credentials",
90
+ "type": {
91
+ "text": "RequestCredentials"
92
+ },
93
+ "description": "Overrides the `same-origin` default for the `endpoint` path.",
94
+ "attribute": "credentials"
95
+ }
96
+ ],
97
+ "attributes": [
98
+ {
99
+ "name": "visible",
100
+ "type": {
101
+ "text": "boolean"
102
+ },
103
+ "default": "false",
104
+ "fieldName": "visible"
105
+ },
106
+ {
107
+ "name": "tool-id",
108
+ "type": {
109
+ "text": "string"
110
+ },
111
+ "default": "'pictureDictionary'",
112
+ "fieldName": "toolId"
113
+ },
114
+ {
115
+ "name": "term",
116
+ "type": {
117
+ "text": "string"
118
+ },
119
+ "default": "''",
120
+ "fieldName": "term"
121
+ },
122
+ {
123
+ "name": "termrequestid",
124
+ "type": {
125
+ "text": "string"
126
+ },
127
+ "description": "Identity of the current `term`, changing once per time it was asked for. Optional: a host assigning `term` directly need not mint one, and the panel falls back to the term itself. What it buys is a learner selecting the same word twice — a second request for `cat` has a new id, so it re-runs, where an unchanged `term` alone looks like a re-render.",
128
+ "fieldName": "termRequestId"
129
+ },
130
+ {
131
+ "name": "endpoint",
132
+ "type": {
133
+ "text": "string"
134
+ },
135
+ "default": "''",
136
+ "fieldName": "endpoint"
137
+ },
138
+ {
139
+ "name": "language",
140
+ "type": {
141
+ "text": "string"
142
+ },
143
+ "default": "''",
144
+ "fieldName": "language"
145
+ },
146
+ {
147
+ "name": "lookup",
148
+ "type": {
149
+ "text": "string"
150
+ },
151
+ "description": "Host-supplied resolver, preferred over `endpoint`.",
152
+ "fieldName": "lookup"
153
+ },
154
+ {
155
+ "name": "headers",
156
+ "type": {
157
+ "text": "string"
158
+ },
159
+ "description": "Extra request headers for the `endpoint` path, read per request so a short-lived token is fetched fresh. Only for a host whose route is not authorised by the assessment's own session, which is called `same-origin` by default.",
160
+ "fieldName": "headers"
161
+ },
162
+ {
163
+ "name": "credentials",
164
+ "type": {
165
+ "text": "string"
166
+ },
167
+ "description": "Overrides the `same-origin` default for the `endpoint` path.",
168
+ "fieldName": "credentials"
169
+ }
170
+ ],
171
+ "x-pie": {
172
+ "shadow": "open"
173
+ }
174
+ }
175
+ ],
176
+ "exports": [
177
+ {
178
+ "kind": "custom-element-definition",
179
+ "name": "pie-tool-picture-dictionary",
180
+ "declaration": {
181
+ "name": "ToolPictureDictionary"
182
+ }
183
+ }
184
+ ]
185
+ }
186
+ ]
187
+ }