@pie-qti/default-components 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/.turbo/turbo-build.log +1 -0
- package/CHANGELOG.md +9 -0
- package/STYLING.md +226 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +190 -0
- package/dist/plugins/associate/index.d.ts +8 -0
- package/dist/plugins/associate/index.d.ts.map +1 -0
- package/dist/plugins/associate/index.js +8 -0
- package/dist/plugins/choice/index.d.ts +8 -0
- package/dist/plugins/choice/index.d.ts.map +1 -0
- package/dist/plugins/choice/index.js +8 -0
- package/dist/plugins/custom/index.d.ts +8 -0
- package/dist/plugins/custom/index.d.ts.map +1 -0
- package/dist/plugins/custom/index.js +8 -0
- package/dist/plugins/end-attempt/index.d.ts +8 -0
- package/dist/plugins/end-attempt/index.d.ts.map +1 -0
- package/dist/plugins/end-attempt/index.js +8 -0
- package/dist/plugins/extended-text/index.d.ts +8 -0
- package/dist/plugins/extended-text/index.d.ts.map +1 -0
- package/dist/plugins/extended-text/index.js +8 -0
- package/dist/plugins/gap-match/index.d.ts +8 -0
- package/dist/plugins/gap-match/index.d.ts.map +1 -0
- package/dist/plugins/gap-match/index.js +8 -0
- package/dist/plugins/graphic-associate/index.d.ts +8 -0
- package/dist/plugins/graphic-associate/index.d.ts.map +1 -0
- package/dist/plugins/graphic-associate/index.js +8 -0
- package/dist/plugins/graphic-gap-match/index.d.ts +8 -0
- package/dist/plugins/graphic-gap-match/index.d.ts.map +1 -0
- package/dist/plugins/graphic-gap-match/index.js +8 -0
- package/dist/plugins/graphic-order/index.d.ts +8 -0
- package/dist/plugins/graphic-order/index.d.ts.map +1 -0
- package/dist/plugins/graphic-order/index.js +8 -0
- package/dist/plugins/hotspot/index.d.ts +8 -0
- package/dist/plugins/hotspot/index.d.ts.map +1 -0
- package/dist/plugins/hotspot/index.js +8 -0
- package/dist/plugins/hottext/index.d.ts +8 -0
- package/dist/plugins/hottext/index.d.ts.map +1 -0
- package/dist/plugins/hottext/index.js +8 -0
- package/dist/plugins/index.d.ts +30 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +30 -0
- package/dist/plugins/match/index.d.ts +8 -0
- package/dist/plugins/match/index.d.ts.map +1 -0
- package/dist/plugins/match/index.js +8 -0
- package/dist/plugins/media/index.d.ts +8 -0
- package/dist/plugins/media/index.d.ts.map +1 -0
- package/dist/plugins/media/index.js +8 -0
- package/dist/plugins/order/index.d.ts +8 -0
- package/dist/plugins/order/index.d.ts.map +1 -0
- package/dist/plugins/order/index.js +8 -0
- package/dist/plugins/position-object/index.d.ts +8 -0
- package/dist/plugins/position-object/index.d.ts.map +1 -0
- package/dist/plugins/position-object/index.js +8 -0
- package/dist/plugins/select-point/index.d.ts +8 -0
- package/dist/plugins/select-point/index.d.ts.map +1 -0
- package/dist/plugins/select-point/index.js +8 -0
- package/dist/plugins/slider/index.d.ts +8 -0
- package/dist/plugins/slider/index.d.ts.map +1 -0
- package/dist/plugins/slider/index.js +8 -0
- package/dist/shared/actions/typesetAction.d.ts +26 -0
- package/dist/shared/actions/typesetAction.d.ts.map +1 -0
- package/dist/shared/actions/typesetAction.js +70 -0
- package/dist/shared/extensions/MathLiveEditor.d.ts +19 -0
- package/dist/shared/extensions/MathLiveEditor.d.ts.map +1 -0
- package/dist/shared/extensions/MathLiveEditor.js +239 -0
- package/dist/shared/index.d.ts +11 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +15 -0
- package/dist/shared/utils/eventHelpers.d.ts +18 -0
- package/dist/shared/utils/eventHelpers.d.ts.map +1 -0
- package/dist/shared/utils/eventHelpers.js +30 -0
- package/dist/shared/utils/pairHelpers.d.ts +55 -0
- package/dist/shared/utils/pairHelpers.d.ts.map +1 -0
- package/dist/shared/utils/pairHelpers.js +76 -0
- package/dist/shared/utils/touchDragHelper.d.ts +33 -0
- package/dist/shared/utils/touchDragHelper.d.ts.map +1 -0
- package/dist/shared/utils/touchDragHelper.js +168 -0
- package/dist/shared/utils/webComponentHelpers.d.ts +9 -0
- package/dist/shared/utils/webComponentHelpers.d.ts.map +1 -0
- package/dist/shared/utils/webComponentHelpers.js +26 -0
- package/package.json +93 -0
- package/src/index.ts +213 -0
- package/src/plugins/associate/AssociateInteraction.svelte +273 -0
- package/src/plugins/associate/index.ts +9 -0
- package/src/plugins/choice/ChoiceInteraction.svelte +212 -0
- package/src/plugins/choice/index.ts +9 -0
- package/src/plugins/custom/CustomInteraction.svelte +61 -0
- package/src/plugins/custom/index.ts +9 -0
- package/src/plugins/drawing/DrawingInteraction.svelte +90 -0
- package/src/plugins/end-attempt/EndAttemptInteraction.svelte +142 -0
- package/src/plugins/end-attempt/index.ts +9 -0
- package/src/plugins/extended-text/ExtendedTextInteraction.svelte +77 -0
- package/src/plugins/extended-text/index.ts +9 -0
- package/src/plugins/gap-match/GapMatchInteraction.svelte +379 -0
- package/src/plugins/gap-match/index.ts +9 -0
- package/src/plugins/graphic-associate/GraphicAssociateInteraction.svelte +427 -0
- package/src/plugins/graphic-associate/index.ts +9 -0
- package/src/plugins/graphic-gap-match/GraphicGapMatchInteraction.svelte +508 -0
- package/src/plugins/graphic-gap-match/index.ts +9 -0
- package/src/plugins/graphic-order/GraphicOrderInteraction.svelte +241 -0
- package/src/plugins/graphic-order/index.ts +9 -0
- package/src/plugins/hotspot/HotspotInteraction.svelte +244 -0
- package/src/plugins/hotspot/index.ts +9 -0
- package/src/plugins/hottext/HottextInteraction.svelte +296 -0
- package/src/plugins/hottext/index.ts +9 -0
- package/src/plugins/index.ts +31 -0
- package/src/plugins/match/MatchInteraction.svelte +70 -0
- package/src/plugins/match/index.ts +9 -0
- package/src/plugins/media/MediaInteraction.svelte +213 -0
- package/src/plugins/media/index.ts +9 -0
- package/src/plugins/order/OrderInteraction.svelte +159 -0
- package/src/plugins/order/index.ts +9 -0
- package/src/plugins/position-object/PositionObjectInteraction.svelte +671 -0
- package/src/plugins/position-object/README.md +130 -0
- package/src/plugins/position-object/index.ts +9 -0
- package/src/plugins/select-point/SelectPointInteraction.svelte +453 -0
- package/src/plugins/select-point/index.ts +9 -0
- package/src/plugins/slider/SliderInteraction.svelte +141 -0
- package/src/plugins/slider/index.ts +9 -0
- package/src/plugins/upload/UploadInteraction.svelte +59 -0
- package/src/shared/actions/typesetAction.ts +87 -0
- package/src/shared/components/CustomInteractionFallback.svelte +153 -0
- package/src/shared/components/DragHandle.svelte +44 -0
- package/src/shared/components/DrawingCanvas.svelte +243 -0
- package/src/shared/components/FileUpload.svelte +153 -0
- package/src/shared/components/GraphicGapMatch.svelte +316 -0
- package/src/shared/components/GraphicGapMatchAdapter.svelte +36 -0
- package/src/shared/components/InlineInteractionRenderer.svelte +124 -0
- package/src/shared/components/MatchDragDrop.svelte +434 -0
- package/src/shared/components/MathContent.svelte +18 -0
- package/src/shared/components/ModalFeedbackDisplay.svelte +81 -0
- package/src/shared/components/RichTextEditor.svelte +316 -0
- package/src/shared/components/ShadowBaseStyles.svelte +391 -0
- package/src/shared/components/SortableList.svelte +297 -0
- package/src/shared/extensions/MathLiveEditor.ts +304 -0
- package/src/shared/index.ts +17 -0
- package/src/shared/styles/shared.css +16 -0
- package/src/shared/utils/eventHelpers.ts +36 -0
- package/src/shared/utils/pairHelpers.ts +86 -0
- package/src/shared/utils/touchDragHelper.ts +211 -0
- package/src/shared/utils/webComponentHelpers.ts +27 -0
- package/src/svelte-shims.d.ts +9 -0
- package/svelte.config.js +9 -0
- package/tests/index.test.ts +8 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$ tsc
|
package/CHANGELOG.md
ADDED
package/STYLING.md
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# Styling Contract (Option A: Shadow DOM + CSS Variables + ::part)
|
|
2
|
+
|
|
3
|
+
This package ships QTI interaction renderers as **web components** (Svelte custom elements). They render in **Shadow DOM** for encapsulation and portability.
|
|
4
|
+
|
|
5
|
+
To make them themeable by the host (e.g. a QTI player shell using DaisyUI) while remaining framework-agnostic, the styling contract is:
|
|
6
|
+
|
|
7
|
+
- Components **own layout/accessibility CSS** (so they render correctly with *zero* host CSS).
|
|
8
|
+
- Components **consume theme tokens via CSS variables** (so the host controls colors/typography/radii).
|
|
9
|
+
- Components expose stable **`part="..."` hooks** so host pages can refine styling via `::part(...)` without breaking encapsulation.
|
|
10
|
+
|
|
11
|
+
## Theme tokens (CSS variables)
|
|
12
|
+
|
|
13
|
+
The components use CSS variables in the form:
|
|
14
|
+
|
|
15
|
+
- `hsl(var(--p))`: primary
|
|
16
|
+
- `hsl(var(--a))`: accent
|
|
17
|
+
- `hsl(var(--b1))`, `hsl(var(--b2))`, `hsl(var(--b3))`: base surfaces
|
|
18
|
+
- `hsl(var(--bc))`: base/content text
|
|
19
|
+
- `hsl(var(--su))`: success
|
|
20
|
+
|
|
21
|
+
These align with DaisyUI’s variable scheme. If the host does not provide them, components fall back to safe defaults via `var(--token, fallback)`.
|
|
22
|
+
|
|
23
|
+
### Host responsibilities (recommended)
|
|
24
|
+
|
|
25
|
+
- Load your theme (DaisyUI or any other system) and set variables on `:root` (or any ancestor of the web component).
|
|
26
|
+
- Optionally set `data-theme="..."` if you’re using DaisyUI themes.
|
|
27
|
+
|
|
28
|
+
## `::part` hooks
|
|
29
|
+
|
|
30
|
+
### `pie-qti-order` (`orderInteraction`)
|
|
31
|
+
|
|
32
|
+
Parts:
|
|
33
|
+
|
|
34
|
+
- `list`: the container holding the reorderable list
|
|
35
|
+
- `item`: a single draggable item row (button)
|
|
36
|
+
- `index`: the item index badge
|
|
37
|
+
- `handle`: the drag handle icon
|
|
38
|
+
- `text`: the item label text
|
|
39
|
+
|
|
40
|
+
Example:
|
|
41
|
+
|
|
42
|
+
```css
|
|
43
|
+
pie-qti-order::part(item) {
|
|
44
|
+
border-radius: 12px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
pie-qti-order::part(handle) {
|
|
48
|
+
opacity: 0.9;
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### `pie-qti-match` (`matchInteraction`)
|
|
53
|
+
|
|
54
|
+
Parts:
|
|
55
|
+
|
|
56
|
+
- `grid`: overall two-column layout container
|
|
57
|
+
- `source-column`, `source-heading`
|
|
58
|
+
- `target-column`, `target-heading`
|
|
59
|
+
- `source-item`: draggable source button
|
|
60
|
+
- `source-handle`: drag handle icon inside the source item
|
|
61
|
+
- `source-clear`: “clear match” button
|
|
62
|
+
- `target`: drop zone/target button
|
|
63
|
+
|
|
64
|
+
Example:
|
|
65
|
+
|
|
66
|
+
```css
|
|
67
|
+
pie-qti-match::part(target) {
|
|
68
|
+
border-style: solid;
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Regression guarantee (no-host-CSS)
|
|
73
|
+
|
|
74
|
+
The repo includes a Playwright regression test that renders `pie-qti-order` and `pie-qti-match` in an iframe with **no Tailwind/DaisyUI loaded** and asserts that SVG handles do not fall back to browser-default sizing.
|
|
75
|
+
|
|
76
|
+
See: `packages/example/tests/playwright/no-host-css.pw.ts`
|
|
77
|
+
|
|
78
|
+
## Baseline class styling (Shadow DOM)
|
|
79
|
+
|
|
80
|
+
The default web components include a small baseline stylesheet (`ShadowBaseStyles`) to provide minimal styling for common DaisyUI classnames (e.g. `btn`, `alert`, `badge`, `card`, `select`) **inside Shadow DOM** when the host does not load DaisyUI/Tailwind CSS.
|
|
81
|
+
|
|
82
|
+
File: `src/shared/components/ShadowBaseStyles.svelte`
|
|
83
|
+
|
|
84
|
+
### `pie-qti-hotspot` (`hotspotInteraction`)
|
|
85
|
+
|
|
86
|
+
Parts:
|
|
87
|
+
|
|
88
|
+
- `prompt`: prompt text
|
|
89
|
+
- `stage`: container holding the image + overlay
|
|
90
|
+
- `image`: the rendered image/SVG container
|
|
91
|
+
- `overlay`: SVG overlay that contains the hotspot shapes (positioned absolutely)
|
|
92
|
+
- `selected`: “Selected: …” message container
|
|
93
|
+
|
|
94
|
+
Notes:
|
|
95
|
+
|
|
96
|
+
- The interactive hotspot shapes are SVG elements inside `overlay`. The component includes a real CSS `:hover` fallback so hover feedback works even when Tailwind `hover:` utilities are not present.
|
|
97
|
+
|
|
98
|
+
### `pie-qti-graphic-gap-match` (`graphicGapMatchInteraction`)
|
|
99
|
+
|
|
100
|
+
Parts:
|
|
101
|
+
|
|
102
|
+
- `prompt`: prompt text
|
|
103
|
+
- `region`: container for labels + stage
|
|
104
|
+
- `labels`: labels palette container
|
|
105
|
+
- `label-remove`: remove button next to a matched label
|
|
106
|
+
- `stage`: container holding the image + overlay
|
|
107
|
+
- `overlay`: SVG overlay for hotspots
|
|
108
|
+
|
|
109
|
+
### `pie-qti-graphic-order` (`graphicOrderInteraction`)
|
|
110
|
+
|
|
111
|
+
Parts:
|
|
112
|
+
|
|
113
|
+
- `prompt`
|
|
114
|
+
- `layout`
|
|
115
|
+
- `image-area`
|
|
116
|
+
- `stage`
|
|
117
|
+
- `panel`
|
|
118
|
+
- `panel-title`
|
|
119
|
+
- `list`
|
|
120
|
+
- `item`
|
|
121
|
+
- `handle-icon`
|
|
122
|
+
- `confirm`
|
|
123
|
+
- `confirmed-icon`
|
|
124
|
+
|
|
125
|
+
### `pie-qti-position-object` (`positionObjectInteraction`)
|
|
126
|
+
|
|
127
|
+
Parts:
|
|
128
|
+
|
|
129
|
+
- `prompt`
|
|
130
|
+
- `layout`
|
|
131
|
+
- `canvas-area`
|
|
132
|
+
- `canvas`
|
|
133
|
+
- `placed`
|
|
134
|
+
- `remove`
|
|
135
|
+
- `palette`
|
|
136
|
+
- `palette-item`
|
|
137
|
+
- `drag-icon`
|
|
138
|
+
|
|
139
|
+
### `pie-qti-graphic-associate` (`graphicAssociateInteraction`)
|
|
140
|
+
|
|
141
|
+
Parts:
|
|
142
|
+
|
|
143
|
+
- `prompt`
|
|
144
|
+
- `layout`
|
|
145
|
+
- `image-area`
|
|
146
|
+
- `stage`
|
|
147
|
+
- `overlay`
|
|
148
|
+
- `hotspot`
|
|
149
|
+
- `panel`
|
|
150
|
+
|
|
151
|
+
### `pie-qti-choice` (`choiceInteraction`)
|
|
152
|
+
|
|
153
|
+
Parts:
|
|
154
|
+
|
|
155
|
+
- `root`
|
|
156
|
+
- `option`
|
|
157
|
+
- `label`
|
|
158
|
+
- `input`
|
|
159
|
+
- `text`
|
|
160
|
+
|
|
161
|
+
### `pie-qti-slider` (`sliderInteraction`)
|
|
162
|
+
|
|
163
|
+
Parts:
|
|
164
|
+
|
|
165
|
+
- `root`
|
|
166
|
+
- `prompt`
|
|
167
|
+
- `track`
|
|
168
|
+
- `min`
|
|
169
|
+
- `input`
|
|
170
|
+
- `max`
|
|
171
|
+
- `value`
|
|
172
|
+
- `value-number`
|
|
173
|
+
|
|
174
|
+
### `pie-qti-gap-match` (`gapMatchInteraction`)
|
|
175
|
+
|
|
176
|
+
Parts:
|
|
177
|
+
|
|
178
|
+
- `root`
|
|
179
|
+
- `prompt`
|
|
180
|
+
- `palette`
|
|
181
|
+
- `word`
|
|
182
|
+
- `text`
|
|
183
|
+
- `gap`
|
|
184
|
+
|
|
185
|
+
### `pie-qti-hottext` (`hottextInteraction`)
|
|
186
|
+
|
|
187
|
+
Parts:
|
|
188
|
+
|
|
189
|
+
- `root`
|
|
190
|
+
- `prompt`
|
|
191
|
+
- `content`
|
|
192
|
+
- `footer`
|
|
193
|
+
|
|
194
|
+
### `pie-qti-associate` (`associateInteraction`)
|
|
195
|
+
|
|
196
|
+
Parts:
|
|
197
|
+
|
|
198
|
+
- `root`
|
|
199
|
+
- `prompt`
|
|
200
|
+
- `choices`
|
|
201
|
+
- `choice`
|
|
202
|
+
- `pairs-title`
|
|
203
|
+
- `pairs`
|
|
204
|
+
- `pair`
|
|
205
|
+
- `pair-remove`
|
|
206
|
+
- `helper`
|
|
207
|
+
|
|
208
|
+
### `pie-qti-custom` (`customInteraction`)
|
|
209
|
+
|
|
210
|
+
Parts:
|
|
211
|
+
|
|
212
|
+
- `root` (on the `pie-qti-custom` wrapper)
|
|
213
|
+
- `root`, `warning`, `manual`, `manual-label`, `manual-input`, `toggle`, `details`, `details-title`, `attributes`, `xml` (from `CustomInteractionFallback`)
|
|
214
|
+
|
|
215
|
+
### `pie-qti-extended-text` (`extendedTextInteraction`)
|
|
216
|
+
|
|
217
|
+
Parts:
|
|
218
|
+
|
|
219
|
+
- `root`
|
|
220
|
+
- `editor`
|
|
221
|
+
|
|
222
|
+
The rich text editor component also exposes parts:
|
|
223
|
+
|
|
224
|
+
- `root`, `toolbar`, `toolbar-button`, `toolbar-divider`, `editor`
|
|
225
|
+
|
|
226
|
+
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @pie-qti/default-components
|
|
3
|
+
*
|
|
4
|
+
* Default Svelte-based component implementations for the QTI 2.x player.
|
|
5
|
+
* These components are packaged as web components that work with the
|
|
6
|
+
* framework-agnostic @pie-qti/item-player core.
|
|
7
|
+
*/
|
|
8
|
+
import type { ComponentRegistry } from '@pie-qti/item-player';
|
|
9
|
+
export * from './shared/index.js';
|
|
10
|
+
/**
|
|
11
|
+
* Register all default components with the ComponentRegistry
|
|
12
|
+
*
|
|
13
|
+
* This function should be called once at application startup to make
|
|
14
|
+
* all default interaction components available to the player.
|
|
15
|
+
*
|
|
16
|
+
* IMPORTANT: Before calling this function, you MUST import the plugin loader:
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import '@pie-qti/default-components/plugins';
|
|
19
|
+
* ```
|
|
20
|
+
* This import triggers web component registration via Svelte's customElement option.
|
|
21
|
+
*
|
|
22
|
+
* @param registry - The ComponentRegistry instance from the Player
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* import { Player } from '@pie-qti/item-player';
|
|
27
|
+
* import '@pie-qti/default-components/plugins'; // Load web components
|
|
28
|
+
* import { registerDefaultComponents } from '@pie-qti/default-components';
|
|
29
|
+
*
|
|
30
|
+
* const player = new Player(qtiXml);
|
|
31
|
+
* registerDefaultComponents(player.getComponentRegistry());
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function registerDefaultComponents(registry: ComponentRegistry): void;
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG9D,cAAc,mBAAmB,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CA+K3E"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @pie-qti/default-components
|
|
3
|
+
*
|
|
4
|
+
* Default Svelte-based component implementations for the QTI 2.x player.
|
|
5
|
+
* These components are packaged as web components that work with the
|
|
6
|
+
* framework-agnostic @pie-qti/item-player core.
|
|
7
|
+
*/
|
|
8
|
+
// Export shared utilities and helpers
|
|
9
|
+
export * from './shared/index.js';
|
|
10
|
+
/**
|
|
11
|
+
* Register all default components with the ComponentRegistry
|
|
12
|
+
*
|
|
13
|
+
* This function should be called once at application startup to make
|
|
14
|
+
* all default interaction components available to the player.
|
|
15
|
+
*
|
|
16
|
+
* IMPORTANT: Before calling this function, you MUST import the plugin loader:
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import '@pie-qti/default-components/plugins';
|
|
19
|
+
* ```
|
|
20
|
+
* This import triggers web component registration via Svelte's customElement option.
|
|
21
|
+
*
|
|
22
|
+
* @param registry - The ComponentRegistry instance from the Player
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* import { Player } from '@pie-qti/item-player';
|
|
27
|
+
* import '@pie-qti/default-components/plugins'; // Load web components
|
|
28
|
+
* import { registerDefaultComponents } from '@pie-qti/default-components';
|
|
29
|
+
*
|
|
30
|
+
* const player = new Player(qtiXml);
|
|
31
|
+
* registerDefaultComponents(player.getComponentRegistry());
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export function registerDefaultComponents(registry) {
|
|
35
|
+
// ChoiceInteraction - Radio buttons or checkboxes
|
|
36
|
+
registry.register('choiceInteraction', {
|
|
37
|
+
name: 'default-choice',
|
|
38
|
+
priority: 0,
|
|
39
|
+
description: 'Default Svelte-based choice interaction',
|
|
40
|
+
canHandle: () => true,
|
|
41
|
+
tagName: 'pie-qti-choice',
|
|
42
|
+
// No componentClass needed - Svelte already registered it
|
|
43
|
+
});
|
|
44
|
+
// SliderInteraction - Range slider
|
|
45
|
+
registry.register('sliderInteraction', {
|
|
46
|
+
name: 'default-slider',
|
|
47
|
+
priority: 0,
|
|
48
|
+
description: 'Default Svelte-based slider interaction',
|
|
49
|
+
canHandle: () => true,
|
|
50
|
+
tagName: 'pie-qti-slider',
|
|
51
|
+
});
|
|
52
|
+
// OrderInteraction - Sortable list
|
|
53
|
+
registry.register('orderInteraction', {
|
|
54
|
+
name: 'default-order',
|
|
55
|
+
priority: 0,
|
|
56
|
+
description: 'Default Svelte-based order interaction',
|
|
57
|
+
canHandle: () => true,
|
|
58
|
+
tagName: 'pie-qti-order',
|
|
59
|
+
});
|
|
60
|
+
// MatchInteraction - Match source to target
|
|
61
|
+
registry.register('matchInteraction', {
|
|
62
|
+
name: 'default-match',
|
|
63
|
+
priority: 0,
|
|
64
|
+
description: 'Default Svelte-based match interaction',
|
|
65
|
+
canHandle: () => true,
|
|
66
|
+
tagName: 'pie-qti-match',
|
|
67
|
+
});
|
|
68
|
+
// AssociateInteraction - Create associations between choices
|
|
69
|
+
registry.register('associateInteraction', {
|
|
70
|
+
name: 'default-associate',
|
|
71
|
+
priority: 0,
|
|
72
|
+
description: 'Default Svelte-based associate interaction',
|
|
73
|
+
canHandle: () => true,
|
|
74
|
+
tagName: 'pie-qti-associate',
|
|
75
|
+
});
|
|
76
|
+
// GapMatchInteraction - Fill gaps with words
|
|
77
|
+
registry.register('gapMatchInteraction', {
|
|
78
|
+
name: 'default-gap-match',
|
|
79
|
+
priority: 0,
|
|
80
|
+
description: 'Default Svelte-based gap match interaction',
|
|
81
|
+
canHandle: () => true,
|
|
82
|
+
tagName: 'pie-qti-gap-match',
|
|
83
|
+
});
|
|
84
|
+
// HotspotInteraction - Click on image hotspots
|
|
85
|
+
registry.register('hotspotInteraction', {
|
|
86
|
+
name: 'default-hotspot',
|
|
87
|
+
priority: 0,
|
|
88
|
+
description: 'Default Svelte-based hotspot interaction',
|
|
89
|
+
canHandle: () => true,
|
|
90
|
+
tagName: 'pie-qti-hotspot',
|
|
91
|
+
});
|
|
92
|
+
// HottextInteraction - Select text within content
|
|
93
|
+
registry.register('hottextInteraction', {
|
|
94
|
+
name: 'default-hottext',
|
|
95
|
+
priority: 0,
|
|
96
|
+
description: 'Default Svelte-based hottext interaction',
|
|
97
|
+
canHandle: () => true,
|
|
98
|
+
tagName: 'pie-qti-hottext',
|
|
99
|
+
});
|
|
100
|
+
// MediaInteraction - Audio/video playback with tracking
|
|
101
|
+
registry.register('mediaInteraction', {
|
|
102
|
+
name: 'default-media',
|
|
103
|
+
priority: 0,
|
|
104
|
+
description: 'Default Svelte-based media interaction',
|
|
105
|
+
canHandle: () => true,
|
|
106
|
+
tagName: 'pie-qti-media',
|
|
107
|
+
});
|
|
108
|
+
// CustomInteraction - Fallback for custom interactions
|
|
109
|
+
registry.register('customInteraction', {
|
|
110
|
+
name: 'default-custom',
|
|
111
|
+
priority: 0,
|
|
112
|
+
description: 'Default Svelte-based custom interaction',
|
|
113
|
+
canHandle: () => true,
|
|
114
|
+
tagName: 'pie-qti-custom',
|
|
115
|
+
});
|
|
116
|
+
// EndAttemptInteraction - End attempt button
|
|
117
|
+
registry.register('endAttemptInteraction', {
|
|
118
|
+
name: 'default-end-attempt',
|
|
119
|
+
priority: 0,
|
|
120
|
+
description: 'Default Svelte-based end attempt interaction',
|
|
121
|
+
canHandle: () => true,
|
|
122
|
+
tagName: 'pie-qti-end-attempt',
|
|
123
|
+
});
|
|
124
|
+
// PositionObjectInteraction - Drag objects onto canvas
|
|
125
|
+
registry.register('positionObjectInteraction', {
|
|
126
|
+
name: 'default-position-object',
|
|
127
|
+
priority: 0,
|
|
128
|
+
description: 'Default Svelte-based position object interaction',
|
|
129
|
+
canHandle: () => true,
|
|
130
|
+
tagName: 'pie-qti-position-object',
|
|
131
|
+
});
|
|
132
|
+
// GraphicGapMatchInteraction - Drag labels onto image hotspots
|
|
133
|
+
registry.register('graphicGapMatchInteraction', {
|
|
134
|
+
name: 'default-graphic-gap-match',
|
|
135
|
+
priority: 0,
|
|
136
|
+
description: 'Default Svelte-based graphic gap match interaction',
|
|
137
|
+
canHandle: () => true,
|
|
138
|
+
tagName: 'pie-qti-graphic-gap-match',
|
|
139
|
+
});
|
|
140
|
+
// GraphicOrderInteraction - Order items with graphic reference
|
|
141
|
+
registry.register('graphicOrderInteraction', {
|
|
142
|
+
name: 'default-graphic-order',
|
|
143
|
+
priority: 0,
|
|
144
|
+
description: 'Default Svelte-based graphic order interaction',
|
|
145
|
+
canHandle: () => true,
|
|
146
|
+
tagName: 'pie-qti-graphic-order',
|
|
147
|
+
});
|
|
148
|
+
// GraphicAssociateInteraction - Create associations on image
|
|
149
|
+
registry.register('graphicAssociateInteraction', {
|
|
150
|
+
name: 'default-graphic-associate',
|
|
151
|
+
priority: 0,
|
|
152
|
+
description: 'Default Svelte-based graphic associate interaction',
|
|
153
|
+
canHandle: () => true,
|
|
154
|
+
tagName: 'pie-qti-graphic-associate',
|
|
155
|
+
});
|
|
156
|
+
// SelectPointInteraction - Select points on image
|
|
157
|
+
registry.register('selectPointInteraction', {
|
|
158
|
+
name: 'default-select-point',
|
|
159
|
+
priority: 0,
|
|
160
|
+
description: 'Default Svelte-based select point interaction',
|
|
161
|
+
canHandle: () => true,
|
|
162
|
+
tagName: 'pie-qti-select-point',
|
|
163
|
+
});
|
|
164
|
+
// ExtendedTextInteraction - Rich text editor
|
|
165
|
+
registry.register('extendedTextInteraction', {
|
|
166
|
+
name: 'default-extended-text',
|
|
167
|
+
priority: 0,
|
|
168
|
+
description: 'Default Svelte-based extended text interaction',
|
|
169
|
+
canHandle: () => true,
|
|
170
|
+
tagName: 'pie-qti-extended-text',
|
|
171
|
+
});
|
|
172
|
+
// UploadInteraction - File upload
|
|
173
|
+
registry.register('uploadInteraction', {
|
|
174
|
+
name: 'default-upload',
|
|
175
|
+
priority: 0,
|
|
176
|
+
description: 'Default Svelte-based upload interaction',
|
|
177
|
+
canHandle: () => true,
|
|
178
|
+
tagName: 'pie-qti-upload',
|
|
179
|
+
});
|
|
180
|
+
// DrawingInteraction - Canvas drawing
|
|
181
|
+
registry.register('drawingInteraction', {
|
|
182
|
+
name: 'default-drawing',
|
|
183
|
+
priority: 0,
|
|
184
|
+
description: 'Default Svelte-based drawing interaction',
|
|
185
|
+
canHandle: () => true,
|
|
186
|
+
tagName: 'pie-qti-drawing',
|
|
187
|
+
});
|
|
188
|
+
// Note: TextEntryInteraction and InlineChoiceInteraction are handled
|
|
189
|
+
// by ItemRenderer as inline interactions, not as separate components
|
|
190
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/associate/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;;;;CAMpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/choice/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;;;;CAMpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/custom/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;;;;CAMpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/end-attempt/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;;;;CAMpB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Svelte component exported via web component
|
|
2
|
+
export const metadata = {
|
|
3
|
+
interactionType: 'endAttemptInteraction',
|
|
4
|
+
tagName: 'pie-qti-end-attempt',
|
|
5
|
+
name: 'default-end-attempt',
|
|
6
|
+
description: 'Default Svelte-based end attempt interaction',
|
|
7
|
+
priority: 0,
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/extended-text/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;;;;CAMpB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Svelte component exported via web component
|
|
2
|
+
export const metadata = {
|
|
3
|
+
interactionType: 'extendedTextInteraction',
|
|
4
|
+
tagName: 'pie-qti-extended-text',
|
|
5
|
+
name: 'default-extended-text',
|
|
6
|
+
description: 'Default Svelte-based extended text interaction',
|
|
7
|
+
priority: 0,
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/gap-match/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;;;;CAMpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/graphic-associate/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;;;;CAMpB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Svelte component exported via web component
|
|
2
|
+
export const metadata = {
|
|
3
|
+
interactionType: 'graphicAssociateInteraction',
|
|
4
|
+
tagName: 'pie-qti-graphic-associate',
|
|
5
|
+
name: 'default-graphic-associate',
|
|
6
|
+
description: 'Default Svelte-based graphic associate interaction',
|
|
7
|
+
priority: 0,
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/graphic-gap-match/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;;;;CAMpB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Svelte component exported via web component
|
|
2
|
+
export const metadata = {
|
|
3
|
+
interactionType: 'graphicGapMatchInteraction',
|
|
4
|
+
tagName: 'pie-qti-graphic-gap-match',
|
|
5
|
+
name: 'default-graphic-gap-match',
|
|
6
|
+
description: 'Default Svelte-based graphic gap match interaction',
|
|
7
|
+
priority: 0,
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/graphic-order/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;;;;CAMpB,CAAC"}
|