@3mo/theme 0.0.1 → 0.0.3
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/README.md +2 -2
- package/dist/Accent.js +10 -10
- package/dist/Background.d.ts +0 -1
- package/dist/Background.d.ts.map +1 -1
- package/dist/Background.js +3 -9
- package/dist/Theme/Background.d.ts +0 -1
- package/dist/Theme/Background.d.ts.map +1 -1
- package/dist/bundle.js +10 -10
- package/dist/styles.css.js +80 -80
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +30 -30
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# Theme
|
|
2
|
-
|
|
1
|
+
# Theme
|
|
2
|
+
|
|
3
3
|
Tools & tokens for theming 3MO components & applications.
|
package/dist/Accent.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css, unsafeCSS } from '@a11d/lit';
|
|
2
|
-
import { RootCssInjector } from '@a11d/
|
|
2
|
+
import { RootCssInjector } from '@a11d/root-css-injector';
|
|
3
3
|
import { LocalStorage } from '@a11d/local-storage';
|
|
4
4
|
import { Color } from '@3mo/color';
|
|
5
5
|
import { ColorSet } from './ColorSet.js';
|
|
@@ -42,15 +42,15 @@ export class AccentStorage extends LocalStorage {
|
|
|
42
42
|
const firstColor = value instanceof ColorSet ? value.colors[0] : value;
|
|
43
43
|
const secondColor = value instanceof ColorSet ? value.colors[1] : value;
|
|
44
44
|
const thirdColor = value instanceof ColorSet ? value.colors[2] : value;
|
|
45
|
-
this.styleElement = RootCssInjector.inject(css `
|
|
46
|
-
|
|
47
|
-
--mo-color-accent-base-r:${unsafeCSS(medianColor === null || medianColor === void 0 ? void 0 : medianColor.r)};
|
|
48
|
-
--mo-color-accent-base-g:${unsafeCSS(medianColor === null || medianColor === void 0 ? void 0 : medianColor.g)};
|
|
49
|
-
--mo-color-accent-base-b:${unsafeCSS(medianColor === null || medianColor === void 0 ? void 0 : medianColor.b)};
|
|
50
|
-
--mo-color-accent-gradient-1: ${unsafeCSS(firstColor === null || firstColor === void 0 ? void 0 : firstColor.rgb)};
|
|
51
|
-
--mo-color-accent-gradient-2: ${unsafeCSS(secondColor === null || secondColor === void 0 ? void 0 : secondColor.rgb)};
|
|
52
|
-
--mo-color-accent-gradient-3: ${unsafeCSS(thirdColor === null || thirdColor === void 0 ? void 0 : thirdColor.rgb)};
|
|
53
|
-
}
|
|
45
|
+
this.styleElement = RootCssInjector.inject(css `
|
|
46
|
+
:root {
|
|
47
|
+
--mo-color-accent-base-r:${unsafeCSS(medianColor === null || medianColor === void 0 ? void 0 : medianColor.r)};
|
|
48
|
+
--mo-color-accent-base-g:${unsafeCSS(medianColor === null || medianColor === void 0 ? void 0 : medianColor.g)};
|
|
49
|
+
--mo-color-accent-base-b:${unsafeCSS(medianColor === null || medianColor === void 0 ? void 0 : medianColor.b)};
|
|
50
|
+
--mo-color-accent-gradient-1: ${unsafeCSS(firstColor === null || firstColor === void 0 ? void 0 : firstColor.rgb)};
|
|
51
|
+
--mo-color-accent-gradient-2: ${unsafeCSS(secondColor === null || secondColor === void 0 ? void 0 : secondColor.rgb)};
|
|
52
|
+
--mo-color-accent-gradient-3: ${unsafeCSS(thirdColor === null || thirdColor === void 0 ? void 0 : thirdColor.rgb)};
|
|
53
|
+
}
|
|
54
54
|
`, this.styleElement);
|
|
55
55
|
}
|
|
56
56
|
}
|
package/dist/Background.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export declare const enum Background {
|
|
|
5
5
|
Dark = "dark"
|
|
6
6
|
}
|
|
7
7
|
export declare class BackgroundStorage extends LocalStorage<Background> {
|
|
8
|
-
private application?;
|
|
9
8
|
constructor();
|
|
10
9
|
get calculatedValue(): Background.Light | Background.Dark;
|
|
11
10
|
private updateAttributeValue;
|
package/dist/Background.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Background.d.ts","sourceRoot":"","sources":["../Background.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Background.d.ts","sourceRoot":"","sources":["../Background.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,0BAAkB,UAAU;IAC3B,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,IAAI,SAAS;CACb;AAED,qBAAa,iBAAkB,SAAQ,YAAY,CAAC,UAAU,CAAC;;IAS9D,IAAI,eAAe,uCAMlB;IAED,OAAO,CAAC,oBAAoB;CAG5B"}
|
package/dist/Background.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import { Application } from '@a11d/lit-application';
|
|
2
1
|
import { LocalStorage } from '@a11d/local-storage';
|
|
3
|
-
import { Theme } from './Theme.js';
|
|
4
2
|
export class BackgroundStorage extends LocalStorage {
|
|
5
3
|
constructor() {
|
|
6
4
|
super('Theme.Background', "system" /* Background.System */);
|
|
7
5
|
window.matchMedia('(prefers-color-scheme: dark)').onchange = () => this.updateAttributeValue();
|
|
8
6
|
window.matchMedia('(prefers-color-scheme: light)').onchange = () => this.updateAttributeValue();
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.updateAttributeValue();
|
|
12
|
-
Theme.background.changed.subscribe(() => this.updateAttributeValue());
|
|
13
|
-
});
|
|
7
|
+
this.updateAttributeValue();
|
|
8
|
+
this.changed.subscribe(() => this.updateAttributeValue());
|
|
14
9
|
}
|
|
15
10
|
get calculatedValue() {
|
|
16
11
|
return this.value !== "system" /* Background.System */
|
|
@@ -20,7 +15,6 @@ export class BackgroundStorage extends LocalStorage {
|
|
|
20
15
|
: "light" /* Background.Light */;
|
|
21
16
|
}
|
|
22
17
|
updateAttributeValue() {
|
|
23
|
-
|
|
24
|
-
(_a = this.application) === null || _a === void 0 ? void 0 : _a.setAttribute('data-theme', this.calculatedValue);
|
|
18
|
+
document.documentElement.setAttribute('data-theme', this.calculatedValue);
|
|
25
19
|
}
|
|
26
20
|
}
|
|
@@ -5,7 +5,6 @@ export declare const enum Background {
|
|
|
5
5
|
Dark = "dark"
|
|
6
6
|
}
|
|
7
7
|
export declare class BackgroundStorage extends LocalStorage<Background> {
|
|
8
|
-
private application?;
|
|
9
8
|
constructor();
|
|
10
9
|
get calculatedValue(): Background.Light | Background.Dark;
|
|
11
10
|
private updateAttributeValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Background.d.ts","sourceRoot":"","sources":["../../Background.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Background.d.ts","sourceRoot":"","sources":["../../Background.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,0BAAkB,UAAU;IAC3B,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,IAAI,SAAS;CACb;AAED,qBAAa,iBAAkB,SAAQ,YAAY,CAAC,UAAU,CAAC;;IAS9D,IAAI,eAAe,uCAMlB;IAED,OAAO,CAAC,oBAAoB;CAG5B"}
|