@pie-qti/default-components 0.1.10 → 0.1.12

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.
Files changed (180) hide show
  1. package/dist/chunks/__vite-browser-external-Dz5RCjpq.js +9 -0
  2. package/dist/chunks/__vite-browser-external-Dz5RCjpq.js.map +1 -0
  3. package/dist/chunks/{mathlive.min-Bvtiaxg4.js → mathlive.min-ClqhKA_b.js} +4199 -3978
  4. package/dist/chunks/mathlive.min-ClqhKA_b.js.map +1 -0
  5. package/dist/index.d.ts +0 -1
  6. package/dist/index.js +1 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/plugins/associate/index.d.ts +0 -1
  9. package/dist/plugins/associate/index.js +1 -0
  10. package/dist/plugins/associate/index.js.map +1 -0
  11. package/dist/plugins/choice/index.d.ts +0 -1
  12. package/dist/plugins/choice/index.js +1 -0
  13. package/dist/plugins/choice/index.js.map +1 -0
  14. package/dist/plugins/custom/index.d.ts +0 -1
  15. package/dist/plugins/custom/index.js +1 -0
  16. package/dist/plugins/custom/index.js.map +1 -0
  17. package/dist/plugins/end-attempt/index.d.ts +0 -1
  18. package/dist/plugins/end-attempt/index.js +1 -0
  19. package/dist/plugins/end-attempt/index.js.map +1 -0
  20. package/dist/plugins/extended-text/index.d.ts +0 -1
  21. package/dist/plugins/extended-text/index.js +1 -0
  22. package/dist/plugins/extended-text/index.js.map +1 -0
  23. package/dist/plugins/gap-match/index.d.ts +0 -1
  24. package/dist/plugins/gap-match/index.js +1 -0
  25. package/dist/plugins/gap-match/index.js.map +1 -0
  26. package/dist/plugins/graphic-associate/index.d.ts +0 -1
  27. package/dist/plugins/graphic-associate/index.js +1 -0
  28. package/dist/plugins/graphic-associate/index.js.map +1 -0
  29. package/dist/plugins/graphic-gap-match/index.d.ts +0 -1
  30. package/dist/plugins/graphic-gap-match/index.js +1 -0
  31. package/dist/plugins/graphic-gap-match/index.js.map +1 -0
  32. package/dist/plugins/graphic-order/index.d.ts +0 -1
  33. package/dist/plugins/graphic-order/index.js +1 -0
  34. package/dist/plugins/graphic-order/index.js.map +1 -0
  35. package/dist/plugins/hotspot/index.d.ts +0 -1
  36. package/dist/plugins/hotspot/index.js +1 -0
  37. package/dist/plugins/hotspot/index.js.map +1 -0
  38. package/dist/plugins/hottext/index.d.ts +0 -1
  39. package/dist/plugins/hottext/index.js +1 -0
  40. package/dist/plugins/hottext/index.js.map +1 -0
  41. package/dist/plugins/match/index.d.ts +0 -1
  42. package/dist/plugins/match/index.js +1 -0
  43. package/dist/plugins/match/index.js.map +1 -0
  44. package/dist/plugins/media/index.d.ts +0 -1
  45. package/dist/plugins/media/index.js +1 -0
  46. package/dist/plugins/media/index.js.map +1 -0
  47. package/dist/plugins/order/index.d.ts +0 -1
  48. package/dist/plugins/order/index.js +1 -0
  49. package/dist/plugins/order/index.js.map +1 -0
  50. package/dist/plugins/position-object/index.d.ts +0 -1
  51. package/dist/plugins/position-object/index.js +1 -0
  52. package/dist/plugins/position-object/index.js.map +1 -0
  53. package/dist/plugins/public-types.d.ts +5 -0
  54. package/dist/plugins/public-types.js +2 -0
  55. package/dist/plugins/public-types.js.map +1 -0
  56. package/dist/plugins/select-point/index.d.ts +0 -1
  57. package/dist/plugins/select-point/index.js +1 -0
  58. package/dist/plugins/select-point/index.js.map +1 -0
  59. package/dist/plugins/slider/index.d.ts +0 -1
  60. package/dist/plugins/slider/index.js +1 -0
  61. package/dist/plugins/slider/index.js.map +1 -0
  62. package/dist/plugins.js +27589 -9160
  63. package/dist/plugins.js.map +1 -1
  64. package/dist/shared/actions/typesetAction.d.ts +0 -1
  65. package/dist/shared/actions/typesetAction.js +1 -0
  66. package/dist/shared/actions/typesetAction.js.map +1 -0
  67. package/dist/shared/extensions/MathLiveEditor.d.ts +0 -1
  68. package/dist/shared/extensions/MathLiveEditor.js +1 -0
  69. package/dist/shared/extensions/MathLiveEditor.js.map +1 -0
  70. package/dist/shared/index.d.ts +0 -1
  71. package/dist/shared/index.js +1 -0
  72. package/dist/shared/index.js.map +1 -0
  73. package/dist/shared/utils/eventHelpers.d.ts +0 -1
  74. package/dist/shared/utils/eventHelpers.js +1 -0
  75. package/dist/shared/utils/eventHelpers.js.map +1 -0
  76. package/dist/shared/utils/matchGroupUtils.d.ts +0 -1
  77. package/dist/shared/utils/matchGroupUtils.js +1 -0
  78. package/dist/shared/utils/matchGroupUtils.js.map +1 -0
  79. package/dist/shared/utils/pairHelpers.d.ts +0 -1
  80. package/dist/shared/utils/pairHelpers.js +1 -0
  81. package/dist/shared/utils/pairHelpers.js.map +1 -0
  82. package/dist/shared/utils/webComponentHelpers.d.ts +0 -1
  83. package/dist/shared/utils/webComponentHelpers.js +1 -0
  84. package/dist/shared/utils/webComponentHelpers.js.map +1 -0
  85. package/package.json +15 -33
  86. package/dist/chunks/mathlive.min-Bvtiaxg4.js.map +0 -1
  87. package/dist/index.d.ts.map +0 -1
  88. package/dist/plugins/associate/index.d.ts.map +0 -1
  89. package/dist/plugins/choice/index.d.ts.map +0 -1
  90. package/dist/plugins/custom/index.d.ts.map +0 -1
  91. package/dist/plugins/end-attempt/index.d.ts.map +0 -1
  92. package/dist/plugins/extended-text/index.d.ts.map +0 -1
  93. package/dist/plugins/gap-match/index.d.ts.map +0 -1
  94. package/dist/plugins/graphic-associate/index.d.ts.map +0 -1
  95. package/dist/plugins/graphic-gap-match/index.d.ts.map +0 -1
  96. package/dist/plugins/graphic-order/index.d.ts.map +0 -1
  97. package/dist/plugins/hotspot/index.d.ts.map +0 -1
  98. package/dist/plugins/hottext/index.d.ts.map +0 -1
  99. package/dist/plugins/index.d.ts +0 -31
  100. package/dist/plugins/index.d.ts.map +0 -1
  101. package/dist/plugins/index.js +0 -31
  102. package/dist/plugins/match/index.d.ts.map +0 -1
  103. package/dist/plugins/media/index.d.ts.map +0 -1
  104. package/dist/plugins/order/index.d.ts.map +0 -1
  105. package/dist/plugins/position-object/index.d.ts.map +0 -1
  106. package/dist/plugins/select-point/index.d.ts.map +0 -1
  107. package/dist/plugins/slider/index.d.ts.map +0 -1
  108. package/dist/shared/actions/typesetAction.d.ts.map +0 -1
  109. package/dist/shared/extensions/MathLiveEditor.d.ts.map +0 -1
  110. package/dist/shared/index.d.ts.map +0 -1
  111. package/dist/shared/utils/eventHelpers.d.ts.map +0 -1
  112. package/dist/shared/utils/matchGroupUtils.d.ts.map +0 -1
  113. package/dist/shared/utils/pairHelpers.d.ts.map +0 -1
  114. package/dist/shared/utils/touchDragHelper.d.ts +0 -2
  115. package/dist/shared/utils/touchDragHelper.d.ts.map +0 -1
  116. package/dist/shared/utils/touchDragHelper.js +0 -1
  117. package/dist/shared/utils/webComponentHelpers.d.ts.map +0 -1
  118. package/src/catalog/CatalogPopup.svelte +0 -163
  119. package/src/index.ts +0 -141
  120. package/src/plugins/associate/AssociateInteraction.svelte +0 -304
  121. package/src/plugins/associate/index.ts +0 -9
  122. package/src/plugins/choice/ChoiceInteraction.svelte +0 -355
  123. package/src/plugins/choice/index.ts +0 -9
  124. package/src/plugins/custom/CustomInteraction.svelte +0 -61
  125. package/src/plugins/custom/index.ts +0 -9
  126. package/src/plugins/drawing/DrawingInteraction.svelte +0 -99
  127. package/src/plugins/end-attempt/EndAttemptInteraction.svelte +0 -142
  128. package/src/plugins/end-attempt/index.ts +0 -9
  129. package/src/plugins/extended-text/ExtendedTextInteraction.svelte +0 -152
  130. package/src/plugins/extended-text/index.ts +0 -9
  131. package/src/plugins/gap-match/GapMatchInteraction.svelte +0 -556
  132. package/src/plugins/gap-match/index.ts +0 -9
  133. package/src/plugins/graphic-associate/GraphicAssociateInteraction.svelte +0 -503
  134. package/src/plugins/graphic-associate/index.ts +0 -9
  135. package/src/plugins/graphic-gap-match/GraphicGapMatchInteraction.svelte +0 -593
  136. package/src/plugins/graphic-gap-match/index.ts +0 -9
  137. package/src/plugins/graphic-order/GraphicOrderInteraction.svelte +0 -241
  138. package/src/plugins/graphic-order/index.ts +0 -9
  139. package/src/plugins/hotspot/HotspotInteraction.svelte +0 -287
  140. package/src/plugins/hotspot/index.ts +0 -9
  141. package/src/plugins/hottext/HottextInteraction.svelte +0 -325
  142. package/src/plugins/hottext/index.ts +0 -9
  143. package/src/plugins/index.ts +0 -32
  144. package/src/plugins/match/MatchInteraction.svelte +0 -82
  145. package/src/plugins/match/index.ts +0 -9
  146. package/src/plugins/media/MediaInteraction.svelte +0 -216
  147. package/src/plugins/media/index.ts +0 -9
  148. package/src/plugins/order/OrderInteraction.svelte +0 -280
  149. package/src/plugins/order/index.ts +0 -9
  150. package/src/plugins/position-object/PositionObjectInteraction.svelte +0 -903
  151. package/src/plugins/position-object/README.md +0 -130
  152. package/src/plugins/position-object/index.ts +0 -9
  153. package/src/plugins/select-point/SelectPointInteraction.svelte +0 -571
  154. package/src/plugins/select-point/index.ts +0 -9
  155. package/src/plugins/slider/SliderInteraction.svelte +0 -141
  156. package/src/plugins/slider/index.ts +0 -9
  157. package/src/plugins/upload/UploadInteraction.svelte +0 -59
  158. package/src/shared/actions/typesetAction.ts +0 -87
  159. package/src/shared/components/CustomInteractionFallback.svelte +0 -153
  160. package/src/shared/components/DragHandle.svelte +0 -44
  161. package/src/shared/components/DrawingCanvas.svelte +0 -259
  162. package/src/shared/components/FileUpload.svelte +0 -158
  163. package/src/shared/components/GraphicGapMatch.svelte +0 -318
  164. package/src/shared/components/GraphicGapMatchAdapter.svelte +0 -45
  165. package/src/shared/components/InlineInteractionRenderer.svelte +0 -141
  166. package/src/shared/components/MatchDragDrop.svelte +0 -481
  167. package/src/shared/components/MathContent.svelte +0 -18
  168. package/src/shared/components/ModalFeedbackDisplay.svelte +0 -91
  169. package/src/shared/components/RichTextEditor.svelte +0 -316
  170. package/src/shared/components/ShadowBaseStyles.svelte +0 -390
  171. package/src/shared/components/SortableList.svelte +0 -297
  172. package/src/shared/extensions/MathLiveEditor.ts +0 -299
  173. package/src/shared/index.ts +0 -15
  174. package/src/shared/styles/shared.css +0 -16
  175. package/src/shared/utils/eventHelpers.ts +0 -69
  176. package/src/shared/utils/matchGroupUtils.ts +0 -14
  177. package/src/shared/utils/pairHelpers.ts +0 -109
  178. package/src/shared/utils/webComponentHelpers.ts +0 -69
  179. package/src/svelte-shims.d.ts +0 -9
  180. /package/{src → dist}/shared/styles/qti-shared-vocabulary.css +0 -0
@@ -1,14 +0,0 @@
1
- /**
2
- * Returns true if a source and target choice are compatible for pairing.
3
- *
4
- * Per QTI spec, an empty/absent matchGroup is unrestricted (pairs with anything).
5
- * Two non-empty matchGroups are compatible only if they share at least one value.
6
- */
7
- export function isCompatibleMatchGroup(
8
- sourceGroups: string[] | undefined,
9
- targetGroups: string[] | undefined
10
- ): boolean {
11
- if (!sourceGroups || sourceGroups.length === 0) return true;
12
- if (!targetGroups || targetGroups.length === 0) return true;
13
- return sourceGroups.some((g) => targetGroups.includes(g));
14
- }
@@ -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,69 +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
- }
28
-
29
- export interface InteractionShellProps<TInteraction, TResponse, TCorrectResponse = TResponse> {
30
- interaction?: TInteraction | string;
31
- response?: TResponse | string | null;
32
- correctResponse?: TCorrectResponse | string | null;
33
- role?: string;
34
- }
35
-
36
- export interface InteractionShell<TInteraction, TResponse, TCorrectResponse = TResponse> {
37
- interaction: TInteraction | undefined;
38
- response: TResponse | undefined;
39
- correctResponse: TCorrectResponse | undefined;
40
- isShowingCorrect: boolean;
41
- responseId: string | undefined;
42
- }
43
-
44
- export function createInteractionShell<
45
- TInteraction extends { responseId?: string },
46
- TResponse,
47
- TCorrectResponse = TResponse,
48
- >({
49
- interaction,
50
- response,
51
- correctResponse,
52
- role = 'candidate',
53
- }: InteractionShellProps<TInteraction, TResponse, TCorrectResponse>): InteractionShell<
54
- TInteraction,
55
- TResponse,
56
- TCorrectResponse
57
- > {
58
- const parsedInteraction = parseJsonProp<TInteraction>(interaction);
59
- const parsedResponse = parseJsonProp<TResponse>(response);
60
- const parsedCorrectResponse = parseJsonProp<TCorrectResponse>(correctResponse);
61
-
62
- return {
63
- interaction: parsedInteraction,
64
- response: parsedResponse,
65
- correctResponse: parsedCorrectResponse,
66
- isShowingCorrect: role === 'scorer' && parsedCorrectResponse !== undefined,
67
- responseId: parsedInteraction?.responseId,
68
- };
69
- }
@@ -1,9 +0,0 @@
1
- declare module '*.svelte' {
2
- import type { Component } from 'svelte';
3
- const component: Component<any>;
4
- export default component;
5
- }
6
-
7
-
8
-
9
-