@pie-qti/theme 1.0.0-beta.0 → 1.0.0-beta.2

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 @@
1
+ export { normalizeQtiThemeVariables, type QtiThemeVariables } from './theme-types.js';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { normalizeQtiThemeVariables } from './theme-types.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAA0B,MAAM,kBAAkB,CAAC","sourcesContent":["export { normalizeQtiThemeVariables, type QtiThemeVariables } from './theme-types.js';\n"]}
@@ -0,0 +1,2 @@
1
+ export type QtiThemeVariables = Record<`--pie-qti-${string}`, string>;
2
+ export declare function normalizeQtiThemeVariables(value: unknown): QtiThemeVariables;
@@ -0,0 +1,22 @@
1
+ export function normalizeQtiThemeVariables(value) {
2
+ if (!value || typeof value !== 'object') {
3
+ return {};
4
+ }
5
+ const output = {};
6
+ for (const [key, rawValue] of Object.entries(value)) {
7
+ if (!key.startsWith('--pie-qti-')) {
8
+ continue;
9
+ }
10
+ if (typeof rawValue === 'string') {
11
+ const trimmed = rawValue.trim();
12
+ if (trimmed) {
13
+ output[key] = trimmed;
14
+ }
15
+ }
16
+ else if (typeof rawValue === 'number') {
17
+ output[key] = String(rawValue);
18
+ }
19
+ }
20
+ return output;
21
+ }
22
+ //# sourceMappingURL=theme-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-types.js","sourceRoot":"","sources":["../src/theme-types.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,0BAA0B,CAAC,KAAc;IACxD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACzC,OAAO,EAAE,CAAC;IACX,CAAC;IAED,MAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;QAChF,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YACnC,SAAS;QACV,CAAC;QAED,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAClC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;YAChC,IAAI,OAAO,EAAE,CAAC;gBACb,MAAM,CAAC,GAA4B,CAAC,GAAG,OAAO,CAAC;YAChD,CAAC;QACF,CAAC;aAAM,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACzC,MAAM,CAAC,GAA4B,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QACzD,CAAC;IACF,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["export type QtiThemeVariables = Record<`--pie-qti-${string}`, string>;\n\nexport function normalizeQtiThemeVariables(value: unknown): QtiThemeVariables {\n\tif (!value || typeof value !== 'object') {\n\t\treturn {};\n\t}\n\n\tconst output: QtiThemeVariables = {};\n\tfor (const [key, rawValue] of Object.entries(value as Record<string, unknown>)) {\n\t\tif (!key.startsWith('--pie-qti-')) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (typeof rawValue === 'string') {\n\t\t\tconst trimmed = rawValue.trim();\n\t\t\tif (trimmed) {\n\t\t\t\toutput[key as `--pie-qti-${string}`] = trimmed;\n\t\t\t}\n\t\t} else if (typeof rawValue === 'number') {\n\t\t\toutput[key as `--pie-qti-${string}`] = String(rawValue);\n\t\t}\n\t}\n\n\treturn output;\n}\n"]}
@@ -0,0 +1,56 @@
1
+ /*
2
+ * Canonical PIE QTI theme variables.
3
+ *
4
+ * These defaults keep QTI players readable in hosts that do not load a theme
5
+ * bridge. Host apps may override any --pie-qti-* variable on :root or on a
6
+ * container that wraps QTI player elements.
7
+ */
8
+
9
+ :root,
10
+ [data-qti-theme='light'] {
11
+ --pie-qti-primary: oklch(45% 0.24 277);
12
+ --pie-qti-primary-content: oklch(98% 0.01 277);
13
+ --pie-qti-secondary: oklch(65% 0.241 354.308);
14
+ --pie-qti-secondary-content: oklch(98% 0.01 354.308);
15
+ --pie-qti-accent: oklch(77% 0.152 181.912);
16
+ --pie-qti-accent-content: oklch(20% 0.03 181.912);
17
+ --pie-qti-neutral: oklch(32% 0 0);
18
+ --pie-qti-neutral-content: oklch(98% 0 0);
19
+ --pie-qti-base-100: oklch(100% 0 0);
20
+ --pie-qti-base-200: oklch(98% 0 0);
21
+ --pie-qti-base-300: oklch(95% 0 0);
22
+ --pie-qti-base-content: oklch(21% 0 0);
23
+ --pie-qti-info: oklch(74% 0.16 232.661);
24
+ --pie-qti-info-content: oklch(20% 0.03 232.661);
25
+ --pie-qti-success: oklch(76% 0.177 163.223);
26
+ --pie-qti-success-content: oklch(20% 0.03 163.223);
27
+ --pie-qti-warning: oklch(82% 0.189 84.429);
28
+ --pie-qti-warning-content: oklch(20% 0.04 84.429);
29
+ --pie-qti-error: oklch(71% 0.194 13.428);
30
+ --pie-qti-error-content: oklch(98% 0.01 13.428);
31
+ --pie-qti-focus: var(--pie-qti-primary);
32
+ }
33
+
34
+ [data-qti-theme='dark'] {
35
+ --pie-qti-primary: oklch(65% 0.24 277);
36
+ --pie-qti-primary-content: oklch(15% 0.04 277);
37
+ --pie-qti-secondary: oklch(75% 0.2 354.308);
38
+ --pie-qti-secondary-content: oklch(18% 0.04 354.308);
39
+ --pie-qti-accent: oklch(82% 0.14 181.912);
40
+ --pie-qti-accent-content: oklch(16% 0.04 181.912);
41
+ --pie-qti-neutral: oklch(70% 0 0);
42
+ --pie-qti-neutral-content: oklch(14% 0 0);
43
+ --pie-qti-base-100: oklch(25% 0.02 255);
44
+ --pie-qti-base-200: oklch(22% 0.02 255);
45
+ --pie-qti-base-300: oklch(18% 0.02 255);
46
+ --pie-qti-base-content: oklch(97% 0.01 255);
47
+ --pie-qti-info: oklch(74% 0.16 232.661);
48
+ --pie-qti-info-content: oklch(15% 0.04 232.661);
49
+ --pie-qti-success: oklch(76% 0.177 163.223);
50
+ --pie-qti-success-content: oklch(15% 0.04 163.223);
51
+ --pie-qti-warning: oklch(82% 0.189 84.429);
52
+ --pie-qti-warning-content: oklch(15% 0.04 84.429);
53
+ --pie-qti-error: oklch(71% 0.194 13.428);
54
+ --pie-qti-error-content: oklch(98% 0.01 13.428);
55
+ --pie-qti-focus: var(--pie-qti-primary);
56
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-qti/theme",
3
- "version": "1.0.0-beta.0",
3
+ "version": "1.0.0-beta.2",
4
4
  "description": "Shared PIE QTI theme tokens and CSS variable contracts",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",