@pie-qti/web-component-loaders 0.1.28 → 1.0.0-beta.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.
@@ -3,8 +3,10 @@
3
3
  *
4
4
  * Import this once in host applications that use loadPieQtiPlayerElements().
5
5
  * It wires host DaisyUI theme tokens into QTI components and enables QTI 3
6
- * shared vocabulary classes in authored item content.
6
+ * shared vocabulary classes in authored item content and the candidate's PNP display
7
+ * needs.
7
8
  */
8
9
 
9
10
  @import './theme-bridge.css';
10
11
  @import './qti-shared-vocabulary.css';
12
+ @import './qti-pnp.css';
@@ -0,0 +1,209 @@
1
+ /*
2
+ * Personal needs display, from the PNP profile the item player applies to its root
3
+ * (`applyPnpToRoot`): colour schemes, inverted polarity, single-column layout and text
4
+ * appearance. Every scheme's foreground and background meet WCAG 1.4.3's 4.5:1.
5
+ */
6
+
7
+ /* =============================================================================
8
+ Colour schemes
9
+ ============================================================================= */
10
+
11
+ /* light text on a dark ground */
12
+ [data-qti-colorscheme='defaultreverse'] {
13
+ --qti-scheme-fg: #ffffff;
14
+ --qti-scheme-bg: #1a1a1a;
15
+ }
16
+
17
+ /* black on white */
18
+ [data-qti-colorscheme='blackwhite'] {
19
+ --qti-scheme-fg: #000000;
20
+ --qti-scheme-bg: #ffffff;
21
+ }
22
+
23
+ /* white on black */
24
+ [data-qti-colorscheme='whiteblack'] {
25
+ --qti-scheme-fg: #ffffff;
26
+ --qti-scheme-bg: #000000;
27
+ }
28
+
29
+ /* black on rose */
30
+ [data-qti-colorscheme='blackrose'] {
31
+ --qti-scheme-fg: #000000;
32
+ --qti-scheme-bg: #ffd0ff;
33
+ }
34
+
35
+ /* rose on black */
36
+ [data-qti-colorscheme='roseblack'] {
37
+ --qti-scheme-fg: #ffd0ff;
38
+ --qti-scheme-bg: #000000;
39
+ }
40
+
41
+ /* yellow on blue */
42
+ [data-qti-colorscheme='yellowblue'] {
43
+ --qti-scheme-fg: #ffff00;
44
+ --qti-scheme-bg: #003399;
45
+ }
46
+
47
+ /* blue on yellow */
48
+ [data-qti-colorscheme='blueyellow'] {
49
+ --qti-scheme-fg: #003399;
50
+ --qti-scheme-bg: #ffff00;
51
+ }
52
+
53
+ /* medium grey on dark grey */
54
+ [data-qti-colorscheme='mgraydgray'] {
55
+ --qti-scheme-fg: #bbbbbb;
56
+ --qti-scheme-bg: #333333;
57
+ }
58
+
59
+ /* dark grey on medium grey */
60
+ [data-qti-colorscheme='dgraymgray'] {
61
+ --qti-scheme-fg: #333333;
62
+ --qti-scheme-bg: #bbbbbb;
63
+ }
64
+
65
+ /* black on cyan */
66
+ [data-qti-colorscheme='blackcyan'] {
67
+ --qti-scheme-fg: #000000;
68
+ --qti-scheme-bg: #00ffff;
69
+ }
70
+
71
+ /* cyan on black */
72
+ [data-qti-colorscheme='cyanblack'] {
73
+ --qti-scheme-fg: #00ffff;
74
+ --qti-scheme-bg: #000000;
75
+ }
76
+
77
+ /* black on cream */
78
+ [data-qti-colorscheme='blackcream'] {
79
+ --qti-scheme-fg: #000000;
80
+ --qti-scheme-bg: #fffacd;
81
+ }
82
+
83
+ /* cream on black */
84
+ [data-qti-colorscheme='creamblack'] {
85
+ --qti-scheme-fg: #fffacd;
86
+ --qti-scheme-bg: #000000;
87
+ }
88
+
89
+ /* white on navy */
90
+ [data-qti-colorscheme='whitenav'] {
91
+ --qti-scheme-fg: #ffffff;
92
+ --qti-scheme-bg: #000080;
93
+ }
94
+
95
+ /* black on medium grey */
96
+ [data-qti-colorscheme='medgray'] {
97
+ --qti-scheme-fg: #000000;
98
+ --qti-scheme-bg: #a0a0a0;
99
+ }
100
+
101
+ /*
102
+ * A scheme recolours the player: the root and the theme tokens interactions draw with,
103
+ * so selection and focus states stay visible in the scheme's two colours.
104
+ */
105
+ [data-qti-colorscheme],
106
+ [data-qti-invert-polarity='colors'] {
107
+ color: var(--qti-scheme-fg);
108
+ background-color: var(--qti-scheme-bg);
109
+ --color-base-100: var(--qti-scheme-bg);
110
+ --color-base-200: var(--qti-scheme-bg);
111
+ --color-base-300: var(--qti-scheme-fg);
112
+ --color-base-content: var(--qti-scheme-fg);
113
+ --color-primary: var(--qti-scheme-fg);
114
+ --color-primary-content: var(--qti-scheme-bg);
115
+ --color-secondary: var(--qti-scheme-fg);
116
+ --color-secondary-content: var(--qti-scheme-bg);
117
+ --color-accent: var(--qti-scheme-fg);
118
+ --color-accent-content: var(--qti-scheme-bg);
119
+ --color-neutral: var(--qti-scheme-fg);
120
+ --color-neutral-content: var(--qti-scheme-bg);
121
+ --pie-qti-base-100: var(--qti-scheme-bg);
122
+ --pie-qti-base-200: var(--qti-scheme-bg);
123
+ --pie-qti-base-300: var(--qti-scheme-fg);
124
+ --pie-qti-base-content: var(--qti-scheme-fg);
125
+ --pie-qti-primary: var(--qti-scheme-fg);
126
+ --pie-qti-primary-content: var(--qti-scheme-bg);
127
+ --pie-qti-secondary: var(--qti-scheme-fg);
128
+ --pie-qti-secondary-content: var(--qti-scheme-bg);
129
+ --pie-qti-accent: var(--qti-scheme-fg);
130
+ --pie-qti-accent-content: var(--qti-scheme-bg);
131
+ --pie-qti-neutral: var(--qti-scheme-fg);
132
+ --pie-qti-neutral-content: var(--qti-scheme-bg);
133
+ --pie-qti-focus: var(--qti-scheme-fg);
134
+ }
135
+
136
+ [data-qti-colorscheme] :where(a),
137
+ [data-qti-invert-polarity='colors'] :where(a) {
138
+ color: inherit;
139
+ }
140
+
141
+ /* =============================================================================
142
+ Inverted polarity
143
+ ============================================================================= */
144
+
145
+ /* Without colours of its own, the player inverts and media is inverted back. */
146
+ [data-qti-invert-polarity='invert'] {
147
+ filter: invert(1) hue-rotate(180deg);
148
+ }
149
+
150
+ [data-qti-invert-polarity='invert'] :where(img, picture, video, canvas, object) {
151
+ filter: invert(1) hue-rotate(180deg);
152
+ }
153
+
154
+ /* With the profile's colours, they take the scheme's place. */
155
+ [data-qti-invert-polarity='colors'] {
156
+ --qti-scheme-fg: var(--qti-invert-foreground, #ffffff);
157
+ --qti-scheme-bg: var(--qti-invert-background, #000000);
158
+ }
159
+
160
+ /* =============================================================================
161
+ Single-column layout
162
+ ============================================================================= */
163
+
164
+ [data-qti-layout='single-column'] .qti-layout-row {
165
+ flex-direction: column;
166
+ }
167
+
168
+ [data-qti-layout='single-column'] .qti-layout-row > * {
169
+ width: 100%;
170
+ margin-left: 0;
171
+ }
172
+
173
+ /* =============================================================================
174
+ Text appearance: each property the profile sets is a token on the attribute
175
+ ============================================================================= */
176
+
177
+ [data-qti-text-appearance~='font-size'] {
178
+ font-size: var(--qti-font-size);
179
+ }
180
+
181
+ [data-qti-text-appearance~='font-family'],
182
+ [data-qti-text-appearance~='font-family'] :where(p, li, td, th, label, span, div, button, input, textarea, select) {
183
+ font-family: var(--qti-font-family);
184
+ }
185
+
186
+ [data-qti-text-appearance~='font-color'] {
187
+ color: var(--qti-font-color);
188
+ --color-base-content: var(--qti-font-color);
189
+ --pie-qti-base-content: var(--qti-font-color);
190
+ }
191
+
192
+ [data-qti-text-appearance~='background-color'] {
193
+ background-color: var(--qti-background-color);
194
+ --color-base-100: var(--qti-background-color);
195
+ --pie-qti-base-100: var(--qti-background-color);
196
+ }
197
+
198
+ [data-qti-text-appearance~='line-height'],
199
+ [data-qti-text-appearance~='line-height'] :where(p, li, td, th, label, span, div) {
200
+ line-height: var(--qti-line-height);
201
+ }
202
+
203
+ [data-qti-text-appearance~='letter-spacing'] {
204
+ letter-spacing: var(--qti-letter-spacing);
205
+ }
206
+
207
+ [data-qti-text-appearance~='word-spacing'] {
208
+ word-spacing: var(--qti-word-spacing);
209
+ }
@@ -245,6 +245,7 @@
245
245
  .qti-display-inline-grid { display: inline-grid; }
246
246
  .qti-display-table { display: table; }
247
247
  .qti-display-table-row { display: table-row; }
248
+ .qti-display-table-cell { display: table-cell; }
248
249
  .qti-display-list-item { display: list-item; }
249
250
 
250
251
  /* Visually hidden but available to screen readers */
@@ -316,5 +317,197 @@
316
317
  .qti-width-3-6 { width: 50%; }
317
318
  .qti-width-4-6 { width: 66.6667%; }
318
319
  .qti-width-5-6 { width: 83.3333%; }
319
- .qti-width-full { width: 100%; }
320
+ .qti-width-1-12 { width: 8.3333%; }
321
+ .qti-width-2-12 { width: 16.6667%; }
322
+ .qti-width-3-12 { width: 25%; }
323
+ .qti-width-4-12 { width: 33.3333%; }
324
+ .qti-width-5-12 { width: 41.6667%; }
325
+ .qti-width-6-12 { width: 50%; }
326
+ .qti-width-7-12 { width: 58.3333%; }
327
+ .qti-width-8-12 { width: 66.6667%; }
328
+ .qti-width-9-12 { width: 75%; }
329
+ .qti-width-10-12 { width: 83.3333%; }
330
+ .qti-width-11-12 { width: 91.6667%; }
331
+ .qti-width-full,
332
+ .qti-fullwidth { width: 100%; }
320
333
  .qti-width-auto { width: auto; }
334
+
335
+ /* =============================================================================
336
+ Height (same scale as width)
337
+ ============================================================================= */
338
+
339
+ .qti-height-0 { height: 0; }
340
+ .qti-height-px { height: 1px; }
341
+ .qti-height-0p5 { height: 0.125rem; }
342
+ .qti-height-1 { height: 0.25rem; }
343
+ .qti-height-1p5 { height: 0.375rem; }
344
+ .qti-height-2 { height: 0.5rem; }
345
+ .qti-height-2p5 { height: 0.625rem; }
346
+ .qti-height-3 { height: 0.75rem; }
347
+ .qti-height-3p5 { height: 0.875rem; }
348
+ .qti-height-4 { height: 1rem; }
349
+ .qti-height-5 { height: 1.25rem; }
350
+ .qti-height-6 { height: 1.5rem; }
351
+ .qti-height-7 { height: 1.75rem; }
352
+ .qti-height-8 { height: 2rem; }
353
+ .qti-height-9 { height: 2.25rem; }
354
+ .qti-height-10 { height: 2.5rem; }
355
+ .qti-height-11 { height: 2.75rem; }
356
+ .qti-height-12 { height: 3rem; }
357
+ .qti-height-14 { height: 3.5rem; }
358
+ .qti-height-16 { height: 4rem; }
359
+ .qti-height-20 { height: 5rem; }
360
+ .qti-height-24 { height: 6rem; }
361
+ .qti-height-28 { height: 7rem; }
362
+ .qti-height-32 { height: 8rem; }
363
+ .qti-height-36 { height: 9rem; }
364
+ .qti-height-40 { height: 10rem; }
365
+ .qti-height-44 { height: 11rem; }
366
+ .qti-height-48 { height: 12rem; }
367
+ .qti-height-52 { height: 13rem; }
368
+ .qti-height-56 { height: 14rem; }
369
+ .qti-height-60 { height: 15rem; }
370
+ .qti-height-64 { height: 16rem; }
371
+ .qti-height-72 { height: 18rem; }
372
+ .qti-height-80 { height: 20rem; }
373
+ .qti-height-96 { height: 24rem; }
374
+ .qti-height-1-2 { height: 50%; }
375
+ .qti-height-1-3 { height: 33.3333%; }
376
+ .qti-height-2-3 { height: 66.6667%; }
377
+ .qti-height-1-4 { height: 25%; }
378
+ .qti-height-2-4 { height: 50%; }
379
+ .qti-height-3-4 { height: 75%; }
380
+ .qti-height-1-5 { height: 20%; }
381
+ .qti-height-2-5 { height: 40%; }
382
+ .qti-height-3-5 { height: 60%; }
383
+ .qti-height-4-5 { height: 80%; }
384
+ .qti-height-1-6 { height: 16.6667%; }
385
+ .qti-height-2-6 { height: 33.3333%; }
386
+ .qti-height-3-6 { height: 50%; }
387
+ .qti-height-4-6 { height: 66.6667%; }
388
+ .qti-height-5-6 { height: 83.3333%; }
389
+ .qti-height-full { height: 100%; }
390
+ .qti-height-auto { height: auto; }
391
+
392
+ /* =============================================================================
393
+ Text Indent
394
+ ============================================================================= */
395
+
396
+ .qti-text-indent-0 { text-indent: 0; }
397
+ .qti-text-indent-px { text-indent: 1px; }
398
+ .qti-text-indent-0p5 { text-indent: 0.125rem; }
399
+ .qti-text-indent-1 { text-indent: 0.25rem; }
400
+ .qti-text-indent-1p5 { text-indent: 0.375rem; }
401
+ .qti-text-indent-2 { text-indent: 0.5rem; }
402
+ .qti-text-indent-2p5 { text-indent: 0.625rem; }
403
+ .qti-text-indent-3 { text-indent: 0.75rem; }
404
+ .qti-text-indent-3p5 { text-indent: 0.875rem; }
405
+ .qti-text-indent-4 { text-indent: 1rem; }
406
+ .qti-text-indent-5 { text-indent: 1.25rem; }
407
+ .qti-text-indent-6 { text-indent: 1.5rem; }
408
+ .qti-text-indent-7 { text-indent: 1.75rem; }
409
+ .qti-text-indent-8 { text-indent: 2rem; }
410
+ .qti-text-indent-12 { text-indent: 3rem; }
411
+ .qti-text-indent-16 { text-indent: 4rem; }
412
+ .qti-text-indent-20 { text-indent: 5rem; }
413
+ .qti-text-indent-24 { text-indent: 6rem; }
414
+ .qti-text-indent-28 { text-indent: 7rem; }
415
+ .qti-text-indent-32 { text-indent: 8rem; }
416
+
417
+ /* =============================================================================
418
+ Flex
419
+ ============================================================================= */
420
+
421
+ .qti-flex-direction-column { flex-direction: column; }
422
+ .qti-flex-direction-row { flex-direction: row; }
423
+ .qti-flex-grow-1 { flex-grow: 1; }
424
+ .qti-flex-grow-0 { flex-grow: 0; }
425
+
426
+ /* =============================================================================
427
+ Float
428
+ ============================================================================= */
429
+
430
+ .qti-float-left { float: left; }
431
+ .qti-float-right { float: right; }
432
+ .qti-float-none { float: none; }
433
+ .qti-float-clear-left { clear: left; }
434
+ .qti-float-clear-right { clear: right; }
435
+ .qti-float-clear-both { clear: both; }
436
+ .qti-float-clearfix::after {
437
+ content: '';
438
+ clear: both;
439
+ display: table;
440
+ }
441
+
442
+ /* =============================================================================
443
+ Vertical Writing
444
+ ============================================================================= */
445
+
446
+ .qti-writing-mode-vertical-rl { writing-mode: vertical-rl; }
447
+ .qti-writing-mode-vertical-lr { writing-mode: vertical-lr; }
448
+ .qti-writing-mode-horizontal-tb { writing-mode: horizontal-tb; }
449
+ .qti-text-orientation-upright { text-orientation: upright; }
450
+ .qti-text-orientation-mixed { text-orientation: mixed; }
451
+ .qti-text-orientation-sideways { text-orientation: sideways; }
452
+ .qti-text-combine-upright-all { text-combine-upright: all; }
453
+
454
+ /* =============================================================================
455
+ List Style Type
456
+ ============================================================================= */
457
+
458
+ .qti-list-style-type-none { list-style-type: none; }
459
+ .qti-list-style-type-disc { list-style-type: disc; }
460
+ .qti-list-style-type-circle { list-style-type: circle; }
461
+ .qti-list-style-type-square { list-style-type: square; }
462
+ .qti-list-style-type-decimal { list-style-type: decimal; }
463
+ .qti-list-style-type-decimal-leading-zero { list-style-type: decimal-leading-zero; }
464
+ .qti-list-style-type-lower-alpha { list-style-type: lower-alpha; }
465
+ .qti-list-style-type-upper-alpha { list-style-type: upper-alpha; }
466
+ .qti-list-style-type-lower-roman { list-style-type: lower-roman; }
467
+ .qti-list-style-type-upper-roman { list-style-type: upper-roman; }
468
+ .qti-list-style-type-lower-latin { list-style-type: lower-latin; }
469
+ .qti-list-style-type-upper-latin { list-style-type: upper-latin; }
470
+ .qti-list-style-type-lower-greek { list-style-type: lower-greek; }
471
+ .qti-list-style-type-arabic-indic { list-style-type: arabic-indic; }
472
+ .qti-list-style-type-armenian { list-style-type: armenian; }
473
+ .qti-list-style-type-lower-armenian { list-style-type: lower-armenian; }
474
+ .qti-list-style-type-upper-armenian { list-style-type: upper-armenian; }
475
+ .qti-list-style-type-bengali { list-style-type: bengali; }
476
+ .qti-list-style-type-cambodian { list-style-type: cambodian; }
477
+ .qti-list-style-type-simp-chinese-formal { list-style-type: simp-chinese-formal; }
478
+ .qti-list-style-type-simp-chinese-informal { list-style-type: simp-chinese-informal; }
479
+ .qti-list-style-type-trad-chinese-formal { list-style-type: trad-chinese-formal; }
480
+ .qti-list-style-type-trad-chinese-informal { list-style-type: trad-chinese-informal; }
481
+ .qti-list-style-type-cjk-ideographic { list-style-type: cjk-ideographic; }
482
+ .qti-list-style-type-cjk-heavenly-stem { list-style-type: cjk-heavenly-stem; }
483
+ .qti-list-style-type-cjk-earthly-branch { list-style-type: cjk-earthly-branch; }
484
+ .qti-list-style-type-devanagari { list-style-type: devanagari; }
485
+ .qti-list-style-type-ethiopic-halehame-ti-er { list-style-type: ethiopic-halehame-ti-er; }
486
+ .qti-list-style-type-ethiopic-halehame-ti-et { list-style-type: ethiopic-halehame-ti-et; }
487
+ .qti-list-style-type-ethiopic-halehame-am { list-style-type: ethiopic-halehame-am; }
488
+ .qti-list-style-type-ethiopic-halehame { list-style-type: ethiopic-halehame; }
489
+ .qti-list-style-type-georgian { list-style-type: georgian; }
490
+ .qti-list-style-type-gujarati { list-style-type: gujarati; }
491
+ .qti-list-style-type-gurmukhi { list-style-type: gurmukhi; }
492
+ .qti-list-style-type-hangul { list-style-type: hangul; }
493
+ .qti-list-style-type-hangul-consonant { list-style-type: hangul-consonant; }
494
+ .qti-list-style-type-hebrew { list-style-type: hebrew; }
495
+ .qti-list-style-type-hiragana { list-style-type: hiragana; }
496
+ .qti-list-style-type-hiragana-iroha { list-style-type: hiragana-iroha; }
497
+ .qti-list-style-type-kannada { list-style-type: kannada; }
498
+ .qti-list-style-type-katakana { list-style-type: katakana; }
499
+ .qti-list-style-type-katakana-iroha { list-style-type: katakana-iroha; }
500
+ .qti-list-style-type-khmer { list-style-type: khmer; }
501
+ .qti-list-style-type-korean-hangul-formal { list-style-type: korean-hangul-formal; }
502
+ .qti-list-style-type-korean-hanja-formal { list-style-type: korean-hanja-formal; }
503
+ .qti-list-style-type-korean-hanja-informal { list-style-type: korean-hanja-informal; }
504
+ .qti-list-style-type-lao { list-style-type: lao; }
505
+ .qti-list-style-type-malayalam { list-style-type: malayalam; }
506
+ .qti-list-style-type-mongolian { list-style-type: mongolian; }
507
+ .qti-list-style-type-myanmar { list-style-type: myanmar; }
508
+ .qti-list-style-type-oriya { list-style-type: oriya; }
509
+ .qti-list-style-type-persian { list-style-type: persian; }
510
+ .qti-list-style-type-thai { list-style-type: thai; }
511
+ .qti-list-style-type-tibetan { list-style-type: tibetan; }
512
+ .qti-list-style-type-telugu { list-style-type: telugu; }
513
+ .qti-list-style-type-urdu { list-style-type: urdu; }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@pie-qti/web-component-loaders",
3
- "version": "0.1.28",
3
+ "version": "1.0.0-beta.1",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
- "@pie-qti/player-elements": "0.1.28"
6
+ "@pie-qti/player-elements": "1.0.0-beta.1"
7
7
  },
8
8
  "devDependencies": {
9
- "@pie-qti/default-components": "0.1.28",
10
- "@pie-qti/theme-daisyui": "0.1.28",
9
+ "@pie-qti/default-components": "1.0.0-beta.1",
10
+ "@pie-qti/theme-daisyui": "1.0.0-beta.1",
11
11
  "typescript": "^5.9.3"
12
12
  },
13
13
  "exports": {
@@ -23,7 +23,7 @@
23
23
  "description": "Shared, idempotent client-side loaders for QTI-related web components used across apps",
24
24
  "license": "MIT",
25
25
  "scripts": {
26
- "build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p ./tsconfig.json && cp src/*.css dist/ && cp ../theme-daisyui/src/bridge.css dist/theme-bridge.css && cp ../default-components/src/shared/styles/qti-shared-vocabulary.css dist/qti-shared-vocabulary.css",
26
+ "build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p ./tsconfig.json && cp src/*.css dist/ && cp ../theme-daisyui/src/bridge.css dist/theme-bridge.css && cp ../default-components/src/shared/styles/qti-shared-vocabulary.css ../default-components/src/shared/styles/qti-pnp.css dist/",
27
27
  "test": "bun test"
28
28
  },
29
29
  "type": "module",