@pie-qti/default-components 0.1.10 → 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 +25917 -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 -1
- package/dist/shared/index.js +1 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/utils/eventHelpers.d.ts +0 -1
- package/dist/shared/utils/eventHelpers.js +1 -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 +0 -1
- package/dist/shared/utils/webComponentHelpers.js +1 -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 -304
- package/src/plugins/associate/index.ts +0 -9
- package/src/plugins/choice/ChoiceInteraction.svelte +0 -355
- 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 -152
- 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 -15
- package/src/shared/styles/shared.css +0 -16
- package/src/shared/utils/eventHelpers.ts +0 -69
- package/src/shared/utils/matchGroupUtils.ts +0 -14
- package/src/shared/utils/pairHelpers.ts +0 -109
- package/src/shared/utils/webComponentHelpers.ts +0 -69
- package/src/svelte-shims.d.ts +0 -9
- /package/{src → dist}/shared/styles/qti-shared-vocabulary.css +0 -0
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
<svelte:options customElement="pie-qti-extended-text" />
|
|
2
|
-
|
|
3
|
-
<script lang="ts">
|
|
4
|
-
import type { ExtendedTextInteractionData } from '@pie-qti/item-player';
|
|
5
|
-
import type { I18nProvider } from '@pie-qti/i18n';
|
|
6
|
-
import RichTextEditor from '../../shared/components/RichTextEditor.svelte';
|
|
7
|
-
import { typesetAction } from '../../shared/actions/typesetAction';
|
|
8
|
-
import ShadowBaseStyles from '../../shared/components/ShadowBaseStyles.svelte';
|
|
9
|
-
import { emitInteractionChange } from '../../shared/utils/eventHelpers';
|
|
10
|
-
import { createInteractionShell } from '../../shared/utils/webComponentHelpers';
|
|
11
|
-
|
|
12
|
-
interface Props {
|
|
13
|
-
interaction?: ExtendedTextInteractionData | string;
|
|
14
|
-
response?: string | null;
|
|
15
|
-
correctResponse?: string | null;
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
role?: string;
|
|
18
|
-
i18n?: I18nProvider;
|
|
19
|
-
typeset?: (element: HTMLElement) => void;
|
|
20
|
-
onChange?: (value: string) => void;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
let { interaction = $bindable(), response = $bindable(), correctResponse = $bindable(), disabled = false, role = 'candidate', i18n = $bindable(), typeset, onChange }: Props = $props();
|
|
24
|
-
|
|
25
|
-
const shell = $derived(
|
|
26
|
-
createInteractionShell<ExtendedTextInteractionData, string, string>({
|
|
27
|
-
interaction,
|
|
28
|
-
response,
|
|
29
|
-
correctResponse,
|
|
30
|
-
role,
|
|
31
|
-
})
|
|
32
|
-
);
|
|
33
|
-
const parsedInteraction = $derived(shell.interaction);
|
|
34
|
-
const parsedResponse = $derived(shell.response);
|
|
35
|
-
const parsedCorrectResponse = $derived(shell.correctResponse);
|
|
36
|
-
const isShowingCorrect = $derived(shell.isShowingCorrect);
|
|
37
|
-
|
|
38
|
-
// Get reference to the root element for event dispatching
|
|
39
|
-
let rootElement: HTMLDivElement | undefined = $state();
|
|
40
|
-
|
|
41
|
-
function handleChange(html: string) {
|
|
42
|
-
response = html;
|
|
43
|
-
emitInteractionChange({ target: rootElement, responseId: shell.responseId, value: html, onChange });
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Character counter support (qti-counter-down / qti-counter-up)
|
|
47
|
-
function charCount(html: string, format: string): number {
|
|
48
|
-
if (format === 'xhtml') {
|
|
49
|
-
// Strip HTML tags, count only text characters
|
|
50
|
-
return html.replace(/<[^>]*>/g, '').length;
|
|
51
|
-
}
|
|
52
|
-
return html.length;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const currentCount = $derived(charCount(parsedResponse ?? '', parsedInteraction?.format ?? 'plain'));
|
|
56
|
-
const expectedLength = $derived(parsedInteraction?.expectedLength ?? 0);
|
|
57
|
-
const classes = $derived(parsedInteraction?.interactionClasses ?? []);
|
|
58
|
-
const showCounterDown = $derived(classes.includes('qti-counter-down') && expectedLength > 0);
|
|
59
|
-
const showCounterUp = $derived(classes.includes('qti-counter-up') && expectedLength > 0);
|
|
60
|
-
const remaining = $derived(expectedLength - currentCount);
|
|
61
|
-
</script>
|
|
62
|
-
|
|
63
|
-
<ShadowBaseStyles />
|
|
64
|
-
|
|
65
|
-
<div bind:this={rootElement} part="root" class={['qti-extended-text-interaction', ...(parsedInteraction?.interactionClasses ?? [])].join(' ')}>
|
|
66
|
-
{#if !parsedInteraction}
|
|
67
|
-
<div class="alert alert-error">{i18n?.t('common.errorNoData', 'No interaction data provided')}</div>
|
|
68
|
-
{:else}
|
|
69
|
-
{#if parsedInteraction.prompt}
|
|
70
|
-
<div part="prompt" class="qti-extended-text-prompt font-semibold" use:typesetAction={{ typeset }}>
|
|
71
|
-
{@html parsedInteraction.prompt}
|
|
72
|
-
</div>
|
|
73
|
-
{/if}
|
|
74
|
-
<div part="editor">
|
|
75
|
-
<RichTextEditor
|
|
76
|
-
value={parsedResponse || ''}
|
|
77
|
-
editable={!disabled}
|
|
78
|
-
placeholder={parsedInteraction.placeholderText || 'Enter your response...'}
|
|
79
|
-
minHeight={parsedInteraction.expectedLines ? parsedInteraction.expectedLines * 24 : 200}
|
|
80
|
-
{i18n}
|
|
81
|
-
onChange={handleChange}
|
|
82
|
-
/>
|
|
83
|
-
</div>
|
|
84
|
-
{#if showCounterDown}
|
|
85
|
-
<p part="counter" class="qti-character-counter" aria-live="polite">
|
|
86
|
-
{remaining >= 0 ? remaining : 0} {i18n?.t('interactions.extendedText.charsRemaining', 'characters remaining')}
|
|
87
|
-
</p>
|
|
88
|
-
{:else if showCounterUp}
|
|
89
|
-
<p part="counter" class="qti-character-counter" aria-live="polite">
|
|
90
|
-
{currentCount} / {expectedLength} {i18n?.t('interactions.extendedText.charsUsed', 'characters')}
|
|
91
|
-
</p>
|
|
92
|
-
{/if}
|
|
93
|
-
{#if isShowingCorrect && parsedCorrectResponse}
|
|
94
|
-
<div part="correct-answer" class="mt-3 p-3 bg-success bg-opacity-10 border border-success rounded">
|
|
95
|
-
<div class="text-sm font-semibold text-success mb-2">
|
|
96
|
-
{i18n?.t('interactions.choice.correct', 'Correct') ?? 'Correct'} Answer:
|
|
97
|
-
</div>
|
|
98
|
-
<div class="text-sm">{parsedCorrectResponse}</div>
|
|
99
|
-
</div>
|
|
100
|
-
{/if}
|
|
101
|
-
{/if}
|
|
102
|
-
</div>
|
|
103
|
-
|
|
104
|
-
<style>
|
|
105
|
-
/* Minimal layout so this works without Tailwind/DaisyUI */
|
|
106
|
-
.qti-extended-text-interaction {
|
|
107
|
-
display: grid;
|
|
108
|
-
gap: 0.75rem;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.qti-extended-text-prompt {
|
|
112
|
-
line-height: 1.5;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.qti-extended-text-prompt :global(:first-child) {
|
|
116
|
-
margin-top: 0;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.qti-extended-text-prompt :global(:last-child) {
|
|
120
|
-
margin-bottom: 0;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/* QTI 3.0 Shared Vocabulary: qti-height-lines-N sets minimum textarea height.
|
|
124
|
-
Each line unit = 1.5rem (24px) matching the editor's line-height. */
|
|
125
|
-
.qti-height-lines-1 { --qti-min-height: 1.5rem; }
|
|
126
|
-
.qti-height-lines-2 { --qti-min-height: 3rem; }
|
|
127
|
-
.qti-height-lines-3 { --qti-min-height: 4.5rem; }
|
|
128
|
-
.qti-height-lines-4 { --qti-min-height: 6rem; }
|
|
129
|
-
.qti-height-lines-5 { --qti-min-height: 7.5rem; }
|
|
130
|
-
.qti-height-lines-6 { --qti-min-height: 9rem; }
|
|
131
|
-
.qti-height-lines-7 { --qti-min-height: 10.5rem; }
|
|
132
|
-
.qti-height-lines-8 { --qti-min-height: 12rem; }
|
|
133
|
-
.qti-height-lines-10 { --qti-min-height: 15rem; }
|
|
134
|
-
.qti-height-lines-12 { --qti-min-height: 18rem; }
|
|
135
|
-
.qti-height-lines-15 { --qti-min-height: 22.5rem; }
|
|
136
|
-
.qti-height-lines-20 { --qti-min-height: 30rem; }
|
|
137
|
-
.qti-height-lines-25 { --qti-min-height: 37.5rem; }
|
|
138
|
-
|
|
139
|
-
/* Apply the CSS variable to the editor's inner textarea via the part */
|
|
140
|
-
[class*='qti-height-lines-'] :global([part='editor'] .ProseMirror),
|
|
141
|
-
[class*='qti-height-lines-'] :global([part='editor'] textarea) {
|
|
142
|
-
min-height: var(--qti-min-height);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.qti-character-counter {
|
|
146
|
-
font-size: 0.8125rem;
|
|
147
|
-
color: var(--color-base-content, #374151);
|
|
148
|
-
opacity: 0.7;
|
|
149
|
-
margin-top: 0.25rem;
|
|
150
|
-
text-align: right;
|
|
151
|
-
}
|
|
152
|
-
</style>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// Svelte component exported via web component
|
|
2
|
-
|
|
3
|
-
export const metadata = {
|
|
4
|
-
interactionType: 'extendedTextInteraction',
|
|
5
|
-
tagName: 'pie-qti-extended-text',
|
|
6
|
-
name: 'default-extended-text',
|
|
7
|
-
description: 'Default Svelte-based extended text interaction',
|
|
8
|
-
priority: 0,
|
|
9
|
-
};
|