@pie-qti/web-component-loaders 1.0.0-beta.4 → 1.0.0-beta.6

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.
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Single-flight dynamic import keyed in a shared store. While pending,
3
+ * concurrent callers share one promise. If the import rejects — a transient
4
+ * chunk failure such as a blocked network or a stale-deploy 404 — the entry is
5
+ * cleared so a later call retries the import instead of replaying the same
6
+ * rejection for the rest of the page's lifetime.
7
+ *
8
+ * Internal loading primitive: imported by tests directly, not listed in the
9
+ * package's exports map.
10
+ */
11
+ export declare function cachedImport(store: Record<string, Promise<void>>, key: string, load: () => Promise<void>): Promise<void>;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Single-flight dynamic import keyed in a shared store. While pending,
3
+ * concurrent callers share one promise. If the import rejects — a transient
4
+ * chunk failure such as a blocked network or a stale-deploy 404 — the entry is
5
+ * cleared so a later call retries the import instead of replaying the same
6
+ * rejection for the rest of the page's lifetime.
7
+ *
8
+ * Internal loading primitive: imported by tests directly, not listed in the
9
+ * package's exports map.
10
+ */
11
+ export function cachedImport(store, key, load) {
12
+ const existing = store[key];
13
+ if (existing)
14
+ return existing;
15
+ const pending = load().catch((error) => {
16
+ // Only clear our own entry: a concurrent replacement (not possible with
17
+ // the single-flight guarantee, but cheap to guard) must survive.
18
+ if (store[key] === pending)
19
+ delete store[key];
20
+ throw error;
21
+ });
22
+ store[key] = pending;
23
+ return pending;
24
+ }
package/dist/index.d.ts CHANGED
@@ -1,10 +1,16 @@
1
1
  declare global {
2
2
  var __pieQtiWebComponentLoaders__: undefined | Record<string, Promise<void>>;
3
3
  }
4
- export declare const DEFAULT_INTERACTION_TAGS: readonly ["pie-qti-choice", "pie-qti-slider", "pie-qti-order", "pie-qti-match", "pie-qti-associate", "pie-qti-gap-match", "pie-qti-hotspot", "pie-qti-hottext", "pie-qti-media", "pie-qti-custom", "pie-qti-portable-custom", "pie-qti-end-attempt", "pie-qti-position-object", "pie-qti-graphic-gap-match", "pie-qti-graphic-order", "pie-qti-graphic-associate", "pie-qti-select-point", "pie-qti-extended-text", "pie-qti-upload", "pie-qti-drawing", "pie-qti-catalog-popup"];
5
4
  /**
6
5
  * Idempotently loads the PIE QTI player and default interaction web components.
7
- * Safe to call multiple times; the underlying import will only happen once.
6
+ * Safe to call multiple times; the underlying import happens once — and once
7
+ * more after a failed attempt, so a transient chunk failure is not permanent.
8
+ *
9
+ * No `customElements.whenDefined` wait on top of the import: the register
10
+ * module registers every element as a synchronous side effect of its module
11
+ * graph's evaluation, so by the time its import resolves all of the elements
12
+ * it defines are already defined. Awaiting a separately maintained tag
13
+ * inventory would add nothing when correct and could only hang forever on
14
+ * drift (one renamed tag would leave a `whenDefined` that never settles).
8
15
  */
9
16
  export declare function loadPieQtiPlayerElements(): Promise<void>;
10
- export type {};
package/dist/index.js CHANGED
@@ -1,26 +1,4 @@
1
- export const DEFAULT_INTERACTION_TAGS = [
2
- 'pie-qti-choice',
3
- 'pie-qti-slider',
4
- 'pie-qti-order',
5
- 'pie-qti-match',
6
- 'pie-qti-associate',
7
- 'pie-qti-gap-match',
8
- 'pie-qti-hotspot',
9
- 'pie-qti-hottext',
10
- 'pie-qti-media',
11
- 'pie-qti-custom',
12
- 'pie-qti-portable-custom',
13
- 'pie-qti-end-attempt',
14
- 'pie-qti-position-object',
15
- 'pie-qti-graphic-gap-match',
16
- 'pie-qti-graphic-order',
17
- 'pie-qti-graphic-associate',
18
- 'pie-qti-select-point',
19
- 'pie-qti-extended-text',
20
- 'pie-qti-upload',
21
- 'pie-qti-drawing',
22
- 'pie-qti-catalog-popup',
23
- ];
1
+ import { cachedImport } from './cachedImport.js';
24
2
  function getStore() {
25
3
  const g = globalThis;
26
4
  if (!g.__pieQtiWebComponentLoaders__)
@@ -29,23 +7,20 @@ function getStore() {
29
7
  }
30
8
  /**
31
9
  * Idempotently loads the PIE QTI player and default interaction web components.
32
- * Safe to call multiple times; the underlying import will only happen once.
10
+ * Safe to call multiple times; the underlying import happens once — and once
11
+ * more after a failed attempt, so a transient chunk failure is not permanent.
12
+ *
13
+ * No `customElements.whenDefined` wait on top of the import: the register
14
+ * module registers every element as a synchronous side effect of its module
15
+ * graph's evaluation, so by the time its import resolves all of the elements
16
+ * it defines are already defined. Awaiting a separately maintained tag
17
+ * inventory would add nothing when correct and could only hang forever on
18
+ * drift (one renamed tag would leave a `whenDefined` that never settles).
33
19
  */
34
- export async function loadPieQtiPlayerElements() {
20
+ export function loadPieQtiPlayerElements() {
35
21
  if (typeof globalThis.window === 'undefined')
36
- return;
37
- const store = getStore();
38
- store.pieQtiPlayerElements ??= import('@pie-qti/player-elements/register').then(async () => {
39
- const win = globalThis.window;
40
- if (!win || typeof win.customElements === 'undefined')
41
- return;
42
- await Promise.allSettled([
43
- win.customElements.whenDefined('pie-qti-item-player'),
44
- win.customElements.whenDefined('pie-qti-assessment-player'),
45
- win.customElements.whenDefined('pie-qti-section-player-splitpane'),
46
- win.customElements.whenDefined('pie-qti-section-player-vertical'),
47
- ...DEFAULT_INTERACTION_TAGS.map((tagName) => win.customElements.whenDefined(tagName)),
48
- ]);
22
+ return Promise.resolve();
23
+ return cachedImport(getStore(), 'pieQtiPlayerElements', async () => {
24
+ await import('@pie-qti/player-elements/register');
49
25
  });
50
- return store.pieQtiPlayerElements;
51
26
  }
package/dist/qti-pnp.css CHANGED
@@ -131,6 +131,12 @@
131
131
  --pie-qti-neutral: var(--qti-scheme-fg);
132
132
  --pie-qti-neutral-content: var(--qti-scheme-bg);
133
133
  --pie-qti-focus: var(--qti-scheme-fg);
134
+ /* Message/state text and control boundaries draw in the scheme's two colours. */
135
+ --pie-qti-error-text: var(--qti-scheme-fg);
136
+ --pie-qti-warning-text: var(--qti-scheme-fg);
137
+ --pie-qti-success-text: var(--qti-scheme-fg);
138
+ --pie-qti-info-text: var(--qti-scheme-fg);
139
+ --pie-qti-border-strong: var(--qti-scheme-fg);
134
140
  }
135
141
 
136
142
  [data-qti-colorscheme] :where(a),
@@ -151,6 +157,17 @@
151
157
  filter: invert(1) hue-rotate(180deg);
152
158
  }
153
159
 
160
+ /*
161
+ * Forced colours (Windows high contrast) already paint the candidate's own palette: inverting
162
+ * it on top would turn that palette into its complement, the colours they did not choose.
163
+ */
164
+ @media (forced-colors: active) {
165
+ [data-qti-invert-polarity='invert'],
166
+ [data-qti-invert-polarity='invert'] :where(img, picture, video, canvas, object) {
167
+ filter: none;
168
+ }
169
+ }
170
+
154
171
  /* With the profile's colours, they take the scheme's place. */
155
172
  [data-qti-invert-polarity='colors'] {
156
173
  --qti-scheme-fg: var(--qti-invert-foreground, #ffffff);
@@ -174,13 +191,19 @@
174
191
  Text appearance: each property the profile sets is a token on the attribute
175
192
  ============================================================================= */
176
193
 
194
+ /*
195
+ * The --pie-qti-* typography tokens follow the profile too, so player chrome
196
+ * sized from those tokens keeps the candidate's text appearance.
197
+ */
177
198
  [data-qti-text-appearance~='font-size'] {
178
199
  font-size: var(--qti-font-size);
200
+ --pie-qti-font-size-base: var(--qti-font-size);
179
201
  }
180
202
 
181
203
  [data-qti-text-appearance~='font-family'],
182
204
  [data-qti-text-appearance~='font-family'] :where(p, li, td, th, label, span, div, button, input, textarea, select) {
183
205
  font-family: var(--qti-font-family);
206
+ --pie-qti-font-family: var(--qti-font-family);
184
207
  }
185
208
 
186
209
  [data-qti-text-appearance~='font-color'] {
@@ -189,15 +212,36 @@
189
212
  --pie-qti-base-content: var(--qti-font-color);
190
213
  }
191
214
 
215
+ /* Raised surfaces take the candidate's background too, so text on them keeps the chosen contrast. */
192
216
  [data-qti-text-appearance~='background-color'] {
193
217
  background-color: var(--qti-background-color);
194
218
  --color-base-100: var(--qti-background-color);
219
+ --color-base-200: var(--qti-background-color);
195
220
  --pie-qti-base-100: var(--qti-background-color);
221
+ --pie-qti-base-200: var(--qti-background-color);
222
+ }
223
+
224
+ /*
225
+ * The theme's message/state text, control boundary and focus colours are only checked
226
+ * against the theme's own surfaces. With the candidate's own text or background colour they
227
+ * draw in the text colour instead: the candidate's (--pie-qti-base-content is the font colour
228
+ * on this element), or the theme's when only a background is chosen. They keep the contrast
229
+ * the candidate chose; state is also conveyed by icons and text, never by colour alone.
230
+ */
231
+ [data-qti-text-appearance~='font-color'],
232
+ [data-qti-text-appearance~='background-color'] {
233
+ --pie-qti-error-text: var(--pie-qti-base-content, oklch(21% 0 0));
234
+ --pie-qti-warning-text: var(--pie-qti-base-content, oklch(21% 0 0));
235
+ --pie-qti-success-text: var(--pie-qti-base-content, oklch(21% 0 0));
236
+ --pie-qti-info-text: var(--pie-qti-base-content, oklch(21% 0 0));
237
+ --pie-qti-border-strong: var(--pie-qti-base-content, oklch(21% 0 0));
238
+ --pie-qti-focus: var(--pie-qti-base-content, oklch(21% 0 0));
196
239
  }
197
240
 
198
241
  [data-qti-text-appearance~='line-height'],
199
242
  [data-qti-text-appearance~='line-height'] :where(p, li, td, th, label, span, div) {
200
243
  line-height: var(--qti-line-height);
244
+ --pie-qti-line-height: var(--qti-line-height);
201
245
  }
202
246
 
203
247
  [data-qti-text-appearance~='letter-spacing'] {
@@ -70,9 +70,13 @@
70
70
 
71
71
  .qti-well {
72
72
  padding: 1em;
73
- border: 1px solid #ccc;
73
+ /*
74
+ * Theme-aware surface (a fixed light grey broke dark themes and PNP colour
75
+ * schemes); the border is a non-text boundary at >= 3:1 (WCAG 1.4.11).
76
+ */
77
+ border: 1px solid var(--pie-qti-border-strong, #767676);
74
78
  border-radius: 4px;
75
- background-color: #f9f9f9;
79
+ background-color: var(--pie-qti-base-200, #f9f9f9);
76
80
  }
77
81
 
78
82
  /* =============================================================================
@@ -22,5 +22,213 @@
22
22
  --pie-qti-warning-content: var(--color-warning-content);
23
23
  --pie-qti-error: var(--color-error);
24
24
  --pie-qti-error-content: var(--color-error-content);
25
+ /* Last resort for engines without color-mix(); the blocks below replace it. */
25
26
  --pie-qti-focus: var(--color-primary);
27
+
28
+ /*
29
+ * Message/state TEXT is deliberately NOT mapped to DaisyUI's
30
+ * info/success/warning/error colours: those are fills, and as text on
31
+ * white they reach only 1.8:1 to 2.9:1 in the DaisyUI light theme.
32
+ * The bridge keeps the @pie-qti/theme defaults instead and selects the
33
+ * light or dark value from the color-scheme that every DaisyUI theme
34
+ * declares. The relative-colour tier below darkens (light themes) or
35
+ * lightens (dark themes) these just far enough to clear 4.5:1 on the
36
+ * tinted surfaces of themes such as garden, aqua, retro and nord; engines
37
+ * without relative colour syntax keep the values here, which hold on
38
+ * neutral surfaces only.
39
+ */
40
+ --pie-qti-error-text: light-dark(#b91c1c, #f87171);
41
+ --pie-qti-warning-text: light-dark(#92400e, #fbbf24);
42
+ --pie-qti-success-text: light-dark(#15803d, #4ade80);
43
+ --pie-qti-info-text: light-dark(#1d4ed8, #60a5fa);
44
+
45
+ /* Control boundaries and non-text cues: >= 3:1 on base-100/base-200. */
46
+ --pie-qti-border-strong: light-dark(#767676, #9ca3af);
47
+
48
+ /* Shape tokens follow DaisyUI's radius scale: boxes and fields. */
49
+ --pie-qti-radius: var(--radius-box, 0.5rem);
50
+ --pie-qti-radius-sm: var(--radius-field, 0.25rem);
51
+ }
52
+
53
+ /*
54
+ * Focus indicator, fallback tier: DaisyUI primaries such as cupcake's or
55
+ * pastel's are as light as the page (1.25:1), so the raw primary cannot be a
56
+ * focus colour. 45% primary mixed with the theme's text colour reaches >= 3:1
57
+ * on base-100 and base-200 in every stock DaisyUI theme, at the cost of a
58
+ * darker (light themes) or paler (dark themes) brand colour in all of them.
59
+ */
60
+ @supports (color: color-mix(in oklab, red 45%, blue)) {
61
+ :root,
62
+ [data-theme] {
63
+ --pie-qti-focus: color-mix(in oklab, var(--color-primary) 45%, var(--color-base-content));
64
+ }
65
+ }
66
+
67
+ /*
68
+ * Text on fills: black or white, whichever contrasts more with the fill. One of
69
+ * the two reaches >= 4.58:1 on any colour; the switch is at relative luminance
70
+ * 0.17913, where both are equal. DaisyUI's own *-content colours fall below
71
+ * 4.5:1 on their fills in many stock themes (secondary-content in the light
72
+ * theme: 3.04:1). Luminance is computed from the fill clipped to sRGB, as it is
73
+ * displayed and as automated checkers measure it. Engines without relative
74
+ * colour syntax keep the DaisyUI colours.
75
+ */
76
+ @supports (color: color(from red srgb-linear clamp(0, (0.5 - r) * 1000000, 1) calc(g * min(1, 0.5 / max(0.0001, b))) calc(b + max(0, 0.5 - min(r, 1)) * (1 - b)) / 1)) {
77
+ :root,
78
+ [data-theme] {
79
+ --pie-qti-primary-content: color(
80
+ from var(--color-primary) srgb-linear
81
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1)
82
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1)
83
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1) / 1
84
+ );
85
+ --pie-qti-secondary-content: color(
86
+ from var(--color-secondary) srgb-linear
87
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1)
88
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1)
89
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1) / 1
90
+ );
91
+ --pie-qti-accent-content: color(
92
+ from var(--color-accent) srgb-linear
93
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1)
94
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1)
95
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1) / 1
96
+ );
97
+ --pie-qti-neutral-content: color(
98
+ from var(--color-neutral) srgb-linear
99
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1)
100
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1)
101
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1) / 1
102
+ );
103
+ --pie-qti-info-content: color(
104
+ from var(--color-info) srgb-linear
105
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1)
106
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1)
107
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1) / 1
108
+ );
109
+ --pie-qti-success-content: color(
110
+ from var(--color-success) srgb-linear
111
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1)
112
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1)
113
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1) / 1
114
+ );
115
+ --pie-qti-warning-content: color(
116
+ from var(--color-warning) srgb-linear
117
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1)
118
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1)
119
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1) / 1
120
+ );
121
+ --pie-qti-error-content: color(
122
+ from var(--color-error) srgb-linear
123
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1)
124
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1)
125
+ clamp(0, (0.17913 - (0.2126 * clamp(0, r, 1) + 0.7152 * clamp(0, g, 1) + 0.0722 * clamp(0, b, 1))) * 1000000, 1) / 1
126
+ );
127
+ }
128
+ }
129
+
130
+ /*
131
+ * Focus indicator, preferred tier: the brand primary itself wherever it is
132
+ * already distinguishable, otherwise the same colour darkened (light themes) or
133
+ * lightened (dark themes) in linear light just far enough:
134
+ * - light: scaled towards black until its relative luminance is <= 0.175,
135
+ * which keeps its chromaticity and clears 3:1 on any surface of luminance
136
+ * >= 0.625 (about #cfcfcf or lighter);
137
+ * - dark: mixed towards white until its luminance is >= 0.25, which clears 3:1
138
+ * on any surface of luminance <= 0.05 (about #3f3f3f or darker).
139
+ * Every stock DaisyUI theme's base-100 and base-200 lie within those bounds.
140
+ * The luminance bounds (negative channels ignored for darkening, channels
141
+ * above 1 ignored for lightening) hold whether an out-of-sRGB primary is
142
+ * clipped or shown on a wide-gamut screen.
143
+ */
144
+ @supports (color: color(from red srgb-linear clamp(0, (0.5 - r) * 1000000, 1) calc(g * min(1, 0.5 / max(0.0001, b))) calc(b + max(0, 0.5 - min(r, 1)) * (1 - b)) / 1)) and (color: light-dark(red, blue)) {
145
+ :root,
146
+ [data-theme] {
147
+ /*
148
+ * Message/state text: the fixed light and dark values, darkened (light
149
+ * themes) or lightened (dark themes) in linear light just far enough to
150
+ * reach >= 4.5:1 against both base surfaces of every stock theme:
151
+ * - light: scaled towards black until its relative luminance is <= 0.1,
152
+ * which clears 4.5:1 (4.66:1 at the exact bound) on any surface of
153
+ * luminance >= 0.625 (about #cfcfcf or lighter);
154
+ * - dark: mixed towards white until its luminance is >= 0.4, which
155
+ * clears 4.5:1 (4.63:1 at the exact bound) on any surface of
156
+ * luminance <= 0.05 (about #3f3f3f or darker).
157
+ * A value already within the bound stays as it is, so neutral-surface
158
+ * themes keep the familiar colours. Every stock DaisyUI theme's
159
+ * base-100 and base-200 lie within those bounds. Engines without
160
+ * relative colour syntax keep the plain fixed values above.
161
+ */
162
+ --pie-qti-error-text: light-dark(
163
+ color(
164
+ from #b91c1c srgb-linear
165
+ calc(r * min(1, 0.1 / max(0.0001, 0.2126 * max(r, 0) + 0.7152 * max(g, 0) + 0.0722 * max(b, 0))))
166
+ calc(g * min(1, 0.1 / max(0.0001, 0.2126 * max(r, 0) + 0.7152 * max(g, 0) + 0.0722 * max(b, 0))))
167
+ calc(b * min(1, 0.1 / max(0.0001, 0.2126 * max(r, 0) + 0.7152 * max(g, 0) + 0.0722 * max(b, 0)))) / 1
168
+ ),
169
+ color(
170
+ from #f87171 srgb-linear
171
+ calc(r + max(0, (0.4 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1))) / max(0.0001, 1 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1)))) * (1 - r))
172
+ calc(g + max(0, (0.4 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1))) / max(0.0001, 1 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1)))) * (1 - g))
173
+ calc(b + max(0, (0.4 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1))) / max(0.0001, 1 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1)))) * (1 - b)) / 1
174
+ )
175
+ );
176
+ --pie-qti-warning-text: light-dark(
177
+ color(
178
+ from #92400e srgb-linear
179
+ calc(r * min(1, 0.1 / max(0.0001, 0.2126 * max(r, 0) + 0.7152 * max(g, 0) + 0.0722 * max(b, 0))))
180
+ calc(g * min(1, 0.1 / max(0.0001, 0.2126 * max(r, 0) + 0.7152 * max(g, 0) + 0.0722 * max(b, 0))))
181
+ calc(b * min(1, 0.1 / max(0.0001, 0.2126 * max(r, 0) + 0.7152 * max(g, 0) + 0.0722 * max(b, 0)))) / 1
182
+ ),
183
+ color(
184
+ from #fbbf24 srgb-linear
185
+ calc(r + max(0, (0.4 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1))) / max(0.0001, 1 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1)))) * (1 - r))
186
+ calc(g + max(0, (0.4 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1))) / max(0.0001, 1 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1)))) * (1 - g))
187
+ calc(b + max(0, (0.4 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1))) / max(0.0001, 1 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1)))) * (1 - b)) / 1
188
+ )
189
+ );
190
+ --pie-qti-success-text: light-dark(
191
+ color(
192
+ from #15803d srgb-linear
193
+ calc(r * min(1, 0.1 / max(0.0001, 0.2126 * max(r, 0) + 0.7152 * max(g, 0) + 0.0722 * max(b, 0))))
194
+ calc(g * min(1, 0.1 / max(0.0001, 0.2126 * max(r, 0) + 0.7152 * max(g, 0) + 0.0722 * max(b, 0))))
195
+ calc(b * min(1, 0.1 / max(0.0001, 0.2126 * max(r, 0) + 0.7152 * max(g, 0) + 0.0722 * max(b, 0)))) / 1
196
+ ),
197
+ color(
198
+ from #4ade80 srgb-linear
199
+ calc(r + max(0, (0.4 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1))) / max(0.0001, 1 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1)))) * (1 - r))
200
+ calc(g + max(0, (0.4 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1))) / max(0.0001, 1 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1)))) * (1 - g))
201
+ calc(b + max(0, (0.4 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1))) / max(0.0001, 1 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1)))) * (1 - b)) / 1
202
+ )
203
+ );
204
+ --pie-qti-info-text: light-dark(
205
+ color(
206
+ from #1d4ed8 srgb-linear
207
+ calc(r * min(1, 0.1 / max(0.0001, 0.2126 * max(r, 0) + 0.7152 * max(g, 0) + 0.0722 * max(b, 0))))
208
+ calc(g * min(1, 0.1 / max(0.0001, 0.2126 * max(r, 0) + 0.7152 * max(g, 0) + 0.0722 * max(b, 0))))
209
+ calc(b * min(1, 0.1 / max(0.0001, 0.2126 * max(r, 0) + 0.7152 * max(g, 0) + 0.0722 * max(b, 0)))) / 1
210
+ ),
211
+ color(
212
+ from #60a5fa srgb-linear
213
+ calc(r + max(0, (0.4 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1))) / max(0.0001, 1 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1)))) * (1 - r))
214
+ calc(g + max(0, (0.4 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1))) / max(0.0001, 1 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1)))) * (1 - g))
215
+ calc(b + max(0, (0.4 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1))) / max(0.0001, 1 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1)))) * (1 - b)) / 1
216
+ )
217
+ );
218
+
219
+ --pie-qti-focus: light-dark(
220
+ color(
221
+ from var(--color-primary) srgb-linear
222
+ calc(r * min(1, 0.175 / max(0.0001, 0.2126 * max(r, 0) + 0.7152 * max(g, 0) + 0.0722 * max(b, 0))))
223
+ calc(g * min(1, 0.175 / max(0.0001, 0.2126 * max(r, 0) + 0.7152 * max(g, 0) + 0.0722 * max(b, 0))))
224
+ calc(b * min(1, 0.175 / max(0.0001, 0.2126 * max(r, 0) + 0.7152 * max(g, 0) + 0.0722 * max(b, 0)))) / 1
225
+ ),
226
+ color(
227
+ from var(--color-primary) srgb-linear
228
+ calc(r + max(0, (0.25 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1))) / max(0.0001, 1 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1)))) * (1 - r))
229
+ calc(g + max(0, (0.25 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1))) / max(0.0001, 1 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1)))) * (1 - g))
230
+ calc(b + max(0, (0.25 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1))) / max(0.0001, 1 - (0.2126 * min(r, 1) + 0.7152 * min(g, 1) + 0.0722 * min(b, 1)))) * (1 - b)) / 1
231
+ )
232
+ );
233
+ }
26
234
  }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@pie-qti/web-component-loaders",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.0-beta.6",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
- "@pie-qti/player-elements": "1.0.0-beta.4"
6
+ "@pie-qti/player-elements": "1.0.0-beta.6"
7
7
  },
8
8
  "devDependencies": {
9
- "@pie-qti/default-components": "1.0.0-beta.4",
10
- "@pie-qti/theme-daisyui": "1.0.0-beta.4",
11
- "typescript": "^5.9.3"
9
+ "@pie-qti/default-components": "1.0.0-beta.6",
10
+ "@pie-qti/theme-daisyui": "1.0.0-beta.6",
11
+ "typescript": "^6.0.3"
12
12
  },
13
13
  "exports": {
14
14
  ".": {
@@ -23,6 +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
+ "typecheck": "tsc --noEmit",
26
27
  "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
28
  "test": "bun test"
28
29
  },