@pie-qti/default-components 0.1.9 → 0.1.11
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/dist/chunks/__vite-browser-external-BjvdLQIS.js +9 -0
- package/dist/chunks/__vite-browser-external-BjvdLQIS.js.map +1 -0
- package/dist/chunks/chunk-Bayd9M4T.js +20 -0
- package/dist/chunks/{mathlive.min-Bvtiaxg4.js → mathlive.min-CAPebTxM.js} +245 -29
- package/dist/chunks/{mathlive.min-Bvtiaxg4.js.map → mathlive.min-CAPebTxM.js.map} +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/associate/index.d.ts +0 -1
- package/dist/plugins/associate/index.js +1 -0
- package/dist/plugins/associate/index.js.map +1 -0
- package/dist/plugins/choice/index.d.ts +0 -1
- package/dist/plugins/choice/index.js +1 -0
- package/dist/plugins/choice/index.js.map +1 -0
- package/dist/plugins/custom/index.d.ts +0 -1
- package/dist/plugins/custom/index.js +1 -0
- package/dist/plugins/custom/index.js.map +1 -0
- package/dist/plugins/end-attempt/index.d.ts +0 -1
- package/dist/plugins/end-attempt/index.js +1 -0
- package/dist/plugins/end-attempt/index.js.map +1 -0
- package/dist/plugins/extended-text/index.d.ts +0 -1
- package/dist/plugins/extended-text/index.js +1 -0
- package/dist/plugins/extended-text/index.js.map +1 -0
- package/dist/plugins/gap-match/index.d.ts +0 -1
- package/dist/plugins/gap-match/index.js +1 -0
- package/dist/plugins/gap-match/index.js.map +1 -0
- package/dist/plugins/graphic-associate/index.d.ts +0 -1
- package/dist/plugins/graphic-associate/index.js +1 -0
- package/dist/plugins/graphic-associate/index.js.map +1 -0
- package/dist/plugins/graphic-gap-match/index.d.ts +0 -1
- package/dist/plugins/graphic-gap-match/index.js +1 -0
- package/dist/plugins/graphic-gap-match/index.js.map +1 -0
- package/dist/plugins/graphic-order/index.d.ts +0 -1
- package/dist/plugins/graphic-order/index.js +1 -0
- package/dist/plugins/graphic-order/index.js.map +1 -0
- package/dist/plugins/hotspot/index.d.ts +0 -1
- package/dist/plugins/hotspot/index.js +1 -0
- package/dist/plugins/hotspot/index.js.map +1 -0
- package/dist/plugins/hottext/index.d.ts +0 -1
- package/dist/plugins/hottext/index.js +1 -0
- package/dist/plugins/hottext/index.js.map +1 -0
- package/dist/plugins/match/index.d.ts +0 -1
- package/dist/plugins/match/index.js +1 -0
- package/dist/plugins/match/index.js.map +1 -0
- package/dist/plugins/media/index.d.ts +0 -1
- package/dist/plugins/media/index.js +1 -0
- package/dist/plugins/media/index.js.map +1 -0
- package/dist/plugins/order/index.d.ts +0 -1
- package/dist/plugins/order/index.js +1 -0
- package/dist/plugins/order/index.js.map +1 -0
- package/dist/plugins/position-object/index.d.ts +0 -1
- package/dist/plugins/position-object/index.js +1 -0
- package/dist/plugins/position-object/index.js.map +1 -0
- package/dist/plugins/public-types.d.ts +5 -0
- package/dist/plugins/public-types.js +2 -0
- package/dist/plugins/public-types.js.map +1 -0
- package/dist/plugins/select-point/index.d.ts +0 -1
- package/dist/plugins/select-point/index.js +1 -0
- package/dist/plugins/select-point/index.js.map +1 -0
- package/dist/plugins/slider/index.d.ts +0 -1
- package/dist/plugins/slider/index.js +1 -0
- package/dist/plugins/slider/index.js.map +1 -0
- package/dist/plugins.js +25958 -7690
- package/dist/plugins.js.map +1 -1
- package/dist/shared/actions/typesetAction.d.ts +0 -1
- package/dist/shared/actions/typesetAction.js +1 -0
- package/dist/shared/actions/typesetAction.js.map +1 -0
- package/dist/shared/extensions/MathLiveEditor.d.ts +0 -1
- package/dist/shared/extensions/MathLiveEditor.js +1 -0
- package/dist/shared/extensions/MathLiveEditor.js.map +1 -0
- package/dist/shared/index.d.ts +0 -2
- package/dist/shared/index.js +1 -2
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/utils/eventHelpers.d.ts +6 -1
- package/dist/shared/utils/eventHelpers.js +7 -0
- package/dist/shared/utils/eventHelpers.js.map +1 -0
- package/dist/shared/utils/matchGroupUtils.d.ts +0 -1
- package/dist/shared/utils/matchGroupUtils.js +1 -0
- package/dist/shared/utils/matchGroupUtils.js.map +1 -0
- package/dist/shared/utils/pairHelpers.d.ts +0 -1
- package/dist/shared/utils/pairHelpers.js +1 -0
- package/dist/shared/utils/pairHelpers.js.map +1 -0
- package/dist/shared/utils/webComponentHelpers.d.ts +16 -1
- package/dist/shared/utils/webComponentHelpers.js +13 -0
- package/dist/shared/utils/webComponentHelpers.js.map +1 -0
- package/package.json +11 -33
- package/dist/index.d.ts.map +0 -1
- package/dist/plugins/associate/index.d.ts.map +0 -1
- package/dist/plugins/choice/index.d.ts.map +0 -1
- package/dist/plugins/custom/index.d.ts.map +0 -1
- package/dist/plugins/end-attempt/index.d.ts.map +0 -1
- package/dist/plugins/extended-text/index.d.ts.map +0 -1
- package/dist/plugins/gap-match/index.d.ts.map +0 -1
- package/dist/plugins/graphic-associate/index.d.ts.map +0 -1
- package/dist/plugins/graphic-gap-match/index.d.ts.map +0 -1
- package/dist/plugins/graphic-order/index.d.ts.map +0 -1
- package/dist/plugins/hotspot/index.d.ts.map +0 -1
- package/dist/plugins/hottext/index.d.ts.map +0 -1
- package/dist/plugins/index.d.ts +0 -31
- package/dist/plugins/index.d.ts.map +0 -1
- package/dist/plugins/index.js +0 -31
- package/dist/plugins/match/index.d.ts.map +0 -1
- package/dist/plugins/media/index.d.ts.map +0 -1
- package/dist/plugins/order/index.d.ts.map +0 -1
- package/dist/plugins/position-object/index.d.ts.map +0 -1
- package/dist/plugins/select-point/index.d.ts.map +0 -1
- package/dist/plugins/slider/index.d.ts.map +0 -1
- package/dist/shared/actions/typesetAction.d.ts.map +0 -1
- package/dist/shared/extensions/MathLiveEditor.d.ts.map +0 -1
- package/dist/shared/index.d.ts.map +0 -1
- package/dist/shared/utils/eventHelpers.d.ts.map +0 -1
- package/dist/shared/utils/matchGroupUtils.d.ts.map +0 -1
- package/dist/shared/utils/pairHelpers.d.ts.map +0 -1
- package/dist/shared/utils/touchDragHelper.d.ts +0 -2
- package/dist/shared/utils/touchDragHelper.d.ts.map +0 -1
- package/dist/shared/utils/touchDragHelper.js +0 -1
- package/dist/shared/utils/webComponentHelpers.d.ts.map +0 -1
- package/src/catalog/CatalogPopup.svelte +0 -163
- package/src/index.ts +0 -141
- package/src/plugins/associate/AssociateInteraction.svelte +0 -310
- package/src/plugins/associate/index.ts +0 -9
- package/src/plugins/choice/ChoiceInteraction.svelte +0 -358
- package/src/plugins/choice/index.ts +0 -9
- package/src/plugins/custom/CustomInteraction.svelte +0 -61
- package/src/plugins/custom/index.ts +0 -9
- package/src/plugins/drawing/DrawingInteraction.svelte +0 -99
- package/src/plugins/end-attempt/EndAttemptInteraction.svelte +0 -142
- package/src/plugins/end-attempt/index.ts +0 -9
- package/src/plugins/extended-text/ExtendedTextInteraction.svelte +0 -150
- package/src/plugins/extended-text/index.ts +0 -9
- package/src/plugins/gap-match/GapMatchInteraction.svelte +0 -556
- package/src/plugins/gap-match/index.ts +0 -9
- package/src/plugins/graphic-associate/GraphicAssociateInteraction.svelte +0 -503
- package/src/plugins/graphic-associate/index.ts +0 -9
- package/src/plugins/graphic-gap-match/GraphicGapMatchInteraction.svelte +0 -593
- package/src/plugins/graphic-gap-match/index.ts +0 -9
- package/src/plugins/graphic-order/GraphicOrderInteraction.svelte +0 -241
- package/src/plugins/graphic-order/index.ts +0 -9
- package/src/plugins/hotspot/HotspotInteraction.svelte +0 -287
- package/src/plugins/hotspot/index.ts +0 -9
- package/src/plugins/hottext/HottextInteraction.svelte +0 -325
- package/src/plugins/hottext/index.ts +0 -9
- package/src/plugins/index.ts +0 -32
- package/src/plugins/match/MatchInteraction.svelte +0 -82
- package/src/plugins/match/index.ts +0 -9
- package/src/plugins/media/MediaInteraction.svelte +0 -216
- package/src/plugins/media/index.ts +0 -9
- package/src/plugins/order/OrderInteraction.svelte +0 -280
- package/src/plugins/order/index.ts +0 -9
- package/src/plugins/position-object/PositionObjectInteraction.svelte +0 -903
- package/src/plugins/position-object/README.md +0 -130
- package/src/plugins/position-object/index.ts +0 -9
- package/src/plugins/select-point/SelectPointInteraction.svelte +0 -571
- package/src/plugins/select-point/index.ts +0 -9
- package/src/plugins/slider/SliderInteraction.svelte +0 -141
- package/src/plugins/slider/index.ts +0 -9
- package/src/plugins/upload/UploadInteraction.svelte +0 -59
- package/src/shared/actions/typesetAction.ts +0 -87
- package/src/shared/components/CustomInteractionFallback.svelte +0 -153
- package/src/shared/components/DragHandle.svelte +0 -44
- package/src/shared/components/DrawingCanvas.svelte +0 -259
- package/src/shared/components/FileUpload.svelte +0 -158
- package/src/shared/components/GraphicGapMatch.svelte +0 -318
- package/src/shared/components/GraphicGapMatchAdapter.svelte +0 -45
- package/src/shared/components/InlineInteractionRenderer.svelte +0 -141
- package/src/shared/components/MatchDragDrop.svelte +0 -481
- package/src/shared/components/MathContent.svelte +0 -18
- package/src/shared/components/ModalFeedbackDisplay.svelte +0 -91
- package/src/shared/components/RichTextEditor.svelte +0 -316
- package/src/shared/components/ShadowBaseStyles.svelte +0 -390
- package/src/shared/components/SortableList.svelte +0 -297
- package/src/shared/extensions/MathLiveEditor.ts +0 -299
- package/src/shared/index.ts +0 -17
- package/src/shared/styles/shared.css +0 -16
- package/src/shared/utils/eventHelpers.ts +0 -52
- package/src/shared/utils/matchGroupUtils.ts +0 -14
- package/src/shared/utils/pairHelpers.ts +0 -109
- package/src/shared/utils/touchDragHelper.ts +0 -1
- package/src/shared/utils/webComponentHelpers.ts +0 -27
- package/src/svelte-shims.d.ts +0 -9
- /package/{src → dist}/shared/styles/qti-shared-vocabulary.css +0 -0
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility functions for working with QTI pair responses
|
|
3
|
-
* Pairs are represented as space-separated strings: "sourceId targetId"
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Gets the target ID matched with a source ID (first match only, for one-to-one display)
|
|
8
|
-
* @param pairs - Array of "sourceId targetId" pair strings
|
|
9
|
-
* @param sourceId - The source identifier to search for
|
|
10
|
-
* @returns The matched target ID, or null if not found
|
|
11
|
-
*/
|
|
12
|
-
export function getTargetForSource(pairs: string[], sourceId: string): string | null {
|
|
13
|
-
const pair = pairs.find((p) => p.startsWith(`${sourceId} `));
|
|
14
|
-
return pair ? pair.split(' ')[1] : null;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Gets all target IDs matched with a source ID (for many-to-many)
|
|
19
|
-
* @param pairs - Array of "sourceId targetId" pair strings
|
|
20
|
-
* @param sourceId - The source identifier to search for
|
|
21
|
-
* @returns Array of matched target IDs
|
|
22
|
-
*/
|
|
23
|
-
export function getTargetsForSource(pairs: string[], sourceId: string): string[] {
|
|
24
|
-
return pairs
|
|
25
|
-
.filter((p) => p.startsWith(`${sourceId} `))
|
|
26
|
-
.map((p) => p.split(' ')[1])
|
|
27
|
-
.filter((t): t is string => !!t);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Gets the source ID matched with a target ID
|
|
32
|
-
* @param pairs - Array of "sourceId targetId" pair strings
|
|
33
|
-
* @param targetId - The target identifier to search for
|
|
34
|
-
* @returns The matched source ID, or null if not found
|
|
35
|
-
*/
|
|
36
|
-
export function getSourceForTarget(pairs: string[], targetId: string): string | null {
|
|
37
|
-
const pair = pairs.find((p) => p.endsWith(` ${targetId}`));
|
|
38
|
-
return pair ? pair.split(' ')[0] : null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Creates or updates a pair.
|
|
43
|
-
* - Removes any existing pair for the target (target receives at most one when matchMax=1)
|
|
44
|
-
* - Does NOT remove other pairs for the source (allows many-to-many: one source → multiple targets)
|
|
45
|
-
* @param pairs - Array of existing pair strings
|
|
46
|
-
* @param sourceId - The source identifier
|
|
47
|
-
* @param targetId - The target identifier
|
|
48
|
-
* @returns A new array with the pair created/updated
|
|
49
|
-
*/
|
|
50
|
-
export function createOrUpdatePair(pairs: string[], sourceId: string, targetId: string): string[] {
|
|
51
|
-
// Remove any existing pair for this target (target gets "replaced")
|
|
52
|
-
let newPairs = pairs.filter((p) => !p.endsWith(` ${targetId}`));
|
|
53
|
-
|
|
54
|
-
// Don't remove source pairs - allows one source to match multiple targets (many-to-many)
|
|
55
|
-
// Add new pair (avoid duplicate if same pair already exists)
|
|
56
|
-
const newPair = `${sourceId} ${targetId}`;
|
|
57
|
-
if (!newPairs.includes(newPair)) {
|
|
58
|
-
newPairs.push(newPair);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return newPairs;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Removes a pair by source ID
|
|
66
|
-
* @param pairs - Array of existing pair strings
|
|
67
|
-
* @param sourceId - The source identifier to remove
|
|
68
|
-
* @returns A new array without the pair
|
|
69
|
-
*/
|
|
70
|
-
export function removePairBySource(pairs: string[], sourceId: string): string[] {
|
|
71
|
-
return pairs.filter((p) => !p.startsWith(`${sourceId} `));
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Removes a specific pair by source and target ID
|
|
76
|
-
*/
|
|
77
|
-
export function removePair(pairs: string[], sourceId: string, targetId: string): string[] {
|
|
78
|
-
return pairs.filter((p) => p !== `${sourceId} ${targetId}`);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Removes a pair by target ID
|
|
83
|
-
* @param pairs - Array of existing pair strings
|
|
84
|
-
* @param targetId - The target identifier to remove
|
|
85
|
-
* @returns A new array without the pair
|
|
86
|
-
*/
|
|
87
|
-
export function removePairByTarget(pairs: string[], targetId: string): string[] {
|
|
88
|
-
return pairs.filter((p) => !p.endsWith(` ${targetId}`));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Checks if a source is paired
|
|
93
|
-
* @param pairs - Array of pair strings
|
|
94
|
-
* @param sourceId - The source identifier
|
|
95
|
-
* @returns True if the source has a pair
|
|
96
|
-
*/
|
|
97
|
-
export function isSourcePaired(pairs: string[], sourceId: string): boolean {
|
|
98
|
-
return pairs.some((p) => p.startsWith(`${sourceId} `));
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Checks if a target is paired
|
|
103
|
-
* @param pairs - Array of pair strings
|
|
104
|
-
* @param targetId - The target identifier
|
|
105
|
-
* @returns True if the target has a pair
|
|
106
|
-
*/
|
|
107
|
-
export function isTargetPaired(pairs: string[], targetId: string): boolean {
|
|
108
|
-
return pairs.some((p) => p.endsWith(` ${targetId}`));
|
|
109
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { touchDrag, touchDragStyles } from '@pie-qti/qti-common';
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Helper utilities for web component prop handling
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Parse a prop that may be a JSON string or an object
|
|
7
|
-
* Used when components are used as web components and receive JSON strings
|
|
8
|
-
*/
|
|
9
|
-
export function parseJsonProp<T>(prop: T | string | null | undefined): T | undefined {
|
|
10
|
-
if (prop === null || prop === undefined) return undefined;
|
|
11
|
-
|
|
12
|
-
if (typeof prop === 'string') {
|
|
13
|
-
// Handle "null" string
|
|
14
|
-
if (prop === 'null') return undefined;
|
|
15
|
-
|
|
16
|
-
// Try to parse as JSON
|
|
17
|
-
try {
|
|
18
|
-
return JSON.parse(prop) as T;
|
|
19
|
-
} catch {
|
|
20
|
-
// If it's not valid JSON, return the string as-is
|
|
21
|
-
// This handles simple string identifiers
|
|
22
|
-
return prop as unknown as T;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return prop as T;
|
|
27
|
-
}
|
package/src/svelte-shims.d.ts
DELETED
|
File without changes
|