@pie-qti/default-components 0.1.7 → 0.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-qti/default-components",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Default Svelte-based component implementations for QTI (2.x and 3.0) player",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -27,9 +27,9 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "dependencies": {
30
- "@pie-qti/i18n": "0.1.7",
31
- "@pie-qti/item-player": "0.1.7",
32
- "@pie-qti/qti-common": "0.1.7",
30
+ "@pie-qti/i18n": "0.1.8",
31
+ "@pie-qti/item-player": "0.1.8",
32
+ "@pie-qti/qti-common": "0.1.8",
33
33
  "@tiptap/core": "^3.15.3",
34
34
  "@tiptap/extension-mathematics": "^3.15.3",
35
35
  "@tiptap/extension-placeholder": "^3.15.3",
@@ -142,6 +142,10 @@
142
142
  <ShadowBaseStyles />
143
143
 
144
144
  <div bind:this={rootElement} part="root" class={['qti-choice-interaction space-y-2', ...(parsedInteraction?.interactionClasses ?? [])].join(' ')} use:typesetAction={{ typeset }}>
145
+ {#if parsedInteraction?.prompt}
146
+ <div part="prompt" class="qti-choice-prompt font-semibold">{@html parsedInteraction.prompt}</div>
147
+ {/if}
148
+
145
149
  {#if !parsedInteraction}
146
150
  <div class="alert alert-error">{i18n?.t('common.errorNoData') ?? 'No interaction data provided'}</div>
147
151
  {:else if parsedInteraction.maxChoices === 1}
@@ -243,6 +247,9 @@
243
247
  display: grid;
244
248
  gap: 0.5rem;
245
249
  }
250
+ .qti-choice-prompt {
251
+ margin: 0 0 0.25rem;
252
+ }
246
253
  .qti-choice-option {
247
254
  display: block;
248
255
  }
@@ -4,6 +4,7 @@
4
4
  import type { ExtendedTextInteractionData } from '@pie-qti/item-player';
5
5
  import type { I18nProvider } from '@pie-qti/i18n';
6
6
  import RichTextEditor from '../../shared/components/RichTextEditor.svelte';
7
+ import { typesetAction } from '../../shared/actions/typesetAction';
7
8
  import ShadowBaseStyles from '../../shared/components/ShadowBaseStyles.svelte';
8
9
  import { createQtiChangeEvent } from '../../shared/utils/eventHelpers';
9
10
  import { parseJsonProp } from '../../shared/utils/webComponentHelpers';
@@ -63,6 +64,11 @@
63
64
  {#if !parsedInteraction}
64
65
  <div class="alert alert-error">{i18n?.t('common.errorNoData', 'No interaction data provided')}</div>
65
66
  {:else}
67
+ {#if parsedInteraction.prompt}
68
+ <div part="prompt" class="qti-extended-text-prompt font-semibold" use:typesetAction={{ typeset }}>
69
+ {@html parsedInteraction.prompt}
70
+ </div>
71
+ {/if}
66
72
  <div part="editor">
67
73
  <RichTextEditor
68
74
  value={parsedResponse || ''}
@@ -100,6 +106,18 @@
100
106
  gap: 0.75rem;
101
107
  }
102
108
 
109
+ .qti-extended-text-prompt {
110
+ line-height: 1.5;
111
+ }
112
+
113
+ .qti-extended-text-prompt :global(:first-child) {
114
+ margin-top: 0;
115
+ }
116
+
117
+ .qti-extended-text-prompt :global(:last-child) {
118
+ margin-bottom: 0;
119
+ }
120
+
103
121
  /* QTI 3.0 Shared Vocabulary: qti-height-lines-N sets minimum textarea height.
104
122
  Each line unit = 1.5rem (24px) matching the editor's line-height. */
105
123
  .qti-height-lines-1 { --qti-min-height: 1.5rem; }