@furystack/shades-common-components 3.6.0 → 3.6.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.
- package/dist/components/app-bar-link.js +8 -10
- package/dist/components/app-bar-link.js.map +1 -1
- package/dist/components/app-bar.js +3 -7
- package/dist/components/app-bar.js.map +1 -1
- package/dist/components/button.js +37 -27
- package/dist/components/button.js.map +1 -1
- package/dist/components/command-palette/command-palette-suggestion-list.js +1 -1
- package/dist/components/command-palette/command-palette-suggestion-list.js.map +1 -1
- package/dist/components/data-grid/data-grid.js +3 -14
- package/dist/components/data-grid/data-grid.js.map +1 -1
- package/dist/components/data-grid/footer.js +3 -10
- package/dist/components/data-grid/footer.js.map +1 -1
- package/dist/components/grid.js +1 -10
- package/dist/components/grid.js.map +1 -1
- package/dist/components/inputs/input.js +10 -14
- package/dist/components/inputs/input.js.map +1 -1
- package/dist/components/inputs/text-area.js +3 -7
- package/dist/components/inputs/text-area.js.map +1 -1
- package/dist/components/loader.js +0 -10
- package/dist/components/loader.js.map +1 -1
- package/dist/components/noty-list.js +1 -1
- package/dist/components/noty-list.js.map +1 -1
- package/dist/components/paper.js +2 -12
- package/dist/components/paper.js.map +1 -1
- package/dist/components/tabs.js +2 -10
- package/dist/components/tabs.js.map +1 -1
- package/dist/services/default-variable-theme.js +80 -0
- package/dist/services/default-variable-theme.js.map +1 -0
- package/dist/services/index.js +1 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/theme-provider-service.js +9 -7
- package/dist/services/theme-provider-service.js.map +1 -1
- package/package.json +2 -2
- package/src/components/app-bar-link.tsx +9 -12
- package/src/components/app-bar.tsx +3 -6
- package/src/components/button.tsx +44 -31
- package/src/components/command-palette/command-palette-suggestion-list.tsx +1 -1
- package/src/components/data-grid/data-grid.tsx +3 -14
- package/src/components/data-grid/footer.tsx +3 -11
- package/src/components/grid.tsx +1 -10
- package/src/components/inputs/input.tsx +11 -16
- package/src/components/inputs/text-area.tsx +3 -9
- package/src/components/loader.tsx +0 -9
- package/src/components/noty-list.tsx +1 -1
- package/src/components/paper.tsx +3 -11
- package/src/components/tabs.tsx +2 -10
- package/src/services/default-variable-theme.ts +83 -0
- package/src/services/index.ts +1 -0
- package/src/services/theme-provider-service.ts +11 -8
- package/tsconfig.tsbuildinfo +1 -1
- package/types/components/app-bar-link.d.ts.map +1 -1
- package/types/components/app-bar.d.ts.map +1 -1
- package/types/components/button.d.ts.map +1 -1
- package/types/components/data-grid/data-grid.d.ts.map +1 -1
- package/types/components/data-grid/footer.d.ts.map +1 -1
- package/types/components/grid.d.ts.map +1 -1
- package/types/components/inputs/input.d.ts +1 -2
- package/types/components/inputs/input.d.ts.map +1 -1
- package/types/components/inputs/text-area.d.ts +0 -2
- package/types/components/inputs/text-area.d.ts.map +1 -1
- package/types/components/loader.d.ts.map +1 -1
- package/types/components/paper.d.ts.map +1 -1
- package/types/components/tabs.d.ts.map +1 -1
- package/types/services/default-variable-theme.d.ts +7 -0
- package/types/services/default-variable-theme.d.ts.map +1 -0
- package/types/services/index.d.ts +1 -0
- package/types/services/index.d.ts.map +1 -1
- package/types/services/theme-provider-service.d.ts +2 -3
- package/types/services/theme-provider-service.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paper.js","sourceRoot":"","sources":["../../src/components/paper.tsx"],"names":[],"mappings":";;;AACA,8CAA0D;AAC1D,+EAAyE;AAE5D,QAAA,KAAK,GAAG,IAAA,cAAK,EAA6D;IACrF,aAAa,EAAE,aAAa;
|
|
1
|
+
{"version":3,"file":"paper.js","sourceRoot":"","sources":["../../src/components/paper.tsx"],"names":[],"mappings":";;;AACA,8CAA0D;AAC1D,+EAAyE;AAE5D,QAAA,KAAK,GAAG,IAAA,cAAK,EAA6D;IACrF,aAAa,EAAE,aAAa;IAE5B,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;QACxC,MAAM,aAAa,GAAG,QAAQ,CAAC,WAAW,CAAC,6CAAoB,CAAC,CAAA;QAChE,OAAO,CACL,0CACM,KAAK,EACT,KAAK,EAAE;gBACL,YAAY,EAAE,KAAK;gBACnB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,SAAS,MAAM,KAAK,CAAC,SAAS,oBAAoB,CAAC,CAAC,CAAC,EAAE;gBACjG,eAAe,EAAE,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK;gBACrD,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS;gBACzC,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE,UAAU;gBACnB,GAAG,KAAK,EAAE,KAAK;aAChB,IAEA,QAAQ,CACL,CACP,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
|
package/dist/components/tabs.js
CHANGED
|
@@ -7,7 +7,7 @@ const promisify_animation_1 = require("../utils/promisify-animation");
|
|
|
7
7
|
exports.Tabs = (0, shades_1.Shade)({
|
|
8
8
|
shadowDomName: 'shade-tabs',
|
|
9
9
|
getInitialState: ({ props }) => ({ activeIndex: props.activeTab || 0 }),
|
|
10
|
-
constructed: ({ injector, updateState
|
|
10
|
+
constructed: ({ injector, updateState }) => {
|
|
11
11
|
const subscriptions = [
|
|
12
12
|
injector.getInstance(shades_1.LocationService).onLocationChanged.subscribe(() => {
|
|
13
13
|
const { hash } = location;
|
|
@@ -16,20 +16,12 @@ exports.Tabs = (0, shades_1.Shade)({
|
|
|
16
16
|
page && updateState({ activeIndex: page });
|
|
17
17
|
}
|
|
18
18
|
}, true),
|
|
19
|
-
injector.getInstance(services_1.ThemeProviderService).theme.subscribe((t) => {
|
|
20
|
-
const headers = element.querySelectorAll('.shade-tabs-headers');
|
|
21
|
-
headers.forEach((header) => {
|
|
22
|
-
const isActive = header.classList.contains('active');
|
|
23
|
-
header.style.backgroundColor = isActive ? t.background.paper : t.background.default;
|
|
24
|
-
header.style.color = isActive ? t.text.primary : t.text.secondary;
|
|
25
|
-
});
|
|
26
|
-
}),
|
|
27
19
|
];
|
|
28
20
|
return () => subscriptions.forEach((s) => s.dispose());
|
|
29
21
|
},
|
|
30
22
|
render: ({ props, getState, updateState, injector }) => {
|
|
31
23
|
const themeProvider = injector.getInstance(services_1.ThemeProviderService);
|
|
32
|
-
const theme = themeProvider
|
|
24
|
+
const { theme } = themeProvider;
|
|
33
25
|
return ((0, shades_1.createComponent)("div", { style: { width: '100%', height: '100%', display: 'flex', flexDirection: 'column', ...props.containerStyle } },
|
|
34
26
|
(0, shades_1.createComponent)("div", { className: "shade-tabs-header-container", style: { display: 'inline-flex', borderRadius: '5px 5px 0 0', overflow: 'hidden', flexShrink: '0' } }, props.tabs.map((tab, index) => {
|
|
35
27
|
const isActive = index === getState().activeIndex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../src/components/tabs.tsx"],"names":[],"mappings":";;;AAAA,8CAA2E;AAC3E,0CAAkD;AAClD,sEAAiE;AAOpD,QAAA,IAAI,GAAG,IAAA,cAAK,EASvB;IACA,aAAa,EAAE,YAAY;IAC3B,eAAe,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,SAAS,IAAI,CAAC,EAAE,CAAC;IACvE,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../src/components/tabs.tsx"],"names":[],"mappings":";;;AAAA,8CAA2E;AAC3E,0CAAkD;AAClD,sEAAiE;AAOpD,QAAA,IAAI,GAAG,IAAA,cAAK,EASvB;IACA,aAAa,EAAE,YAAY;IAC3B,eAAe,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,SAAS,IAAI,CAAC,EAAE,CAAC;IACvE,WAAW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CACxF,CACF,CAAA;iBACF;gBAED,OAAO,UAAU,CAAA;YACnB,CAAC,CAAC,CACE;YACN,uCAAK,SAAS,EAAC,2BAA2B,EAAC,KAAK,EAAE,KAAK,CAAC,KAAK,IAC1D,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,CAAC,SAAS,CACzC,CACF,CACP,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useThemeCssVariables = exports.getCssVariable = exports.setCssVariable = exports.defaultVariableTheme = void 0;
|
|
4
|
+
exports.defaultVariableTheme = {
|
|
5
|
+
text: {
|
|
6
|
+
primary: 'var(--shades-theme-text-primary)',
|
|
7
|
+
secondary: 'var(--shades-theme-text-secondary)',
|
|
8
|
+
disabled: 'var(--shades-theme-text-disabled)',
|
|
9
|
+
},
|
|
10
|
+
button: {
|
|
11
|
+
active: 'var(--shades-theme-button-active)',
|
|
12
|
+
hover: 'var(--shades-theme-button-hover)',
|
|
13
|
+
selected: 'var(--shades-theme-button-selected)',
|
|
14
|
+
disabled: 'var(--shades-theme-button-disabled)',
|
|
15
|
+
disabledBackground: 'var(--shades-theme-button-disabled-background)',
|
|
16
|
+
},
|
|
17
|
+
background: {
|
|
18
|
+
default: 'var(--shades-theme-background-default)',
|
|
19
|
+
paper: 'var(--shades-theme-background-paper)',
|
|
20
|
+
},
|
|
21
|
+
palette: {
|
|
22
|
+
primary: {
|
|
23
|
+
light: 'var(--shades-theme-palette-primary-light)',
|
|
24
|
+
main: 'var(--shades-theme-palette-primary-main)',
|
|
25
|
+
dark: 'var(--shades-theme-palette-primary-dark)',
|
|
26
|
+
},
|
|
27
|
+
secondary: {
|
|
28
|
+
light: 'var(--shades-theme-palette-secondary-light)',
|
|
29
|
+
main: 'var(--shades-theme-palette-secondary-main)',
|
|
30
|
+
dark: 'var(--shades-theme-palette-secondary-dark)',
|
|
31
|
+
},
|
|
32
|
+
error: {
|
|
33
|
+
light: 'var(--shades-theme-palette-error-light)',
|
|
34
|
+
main: 'var(--shades-theme-palette-error-main)',
|
|
35
|
+
dark: 'var(--shades-theme-palette-error-dark)',
|
|
36
|
+
},
|
|
37
|
+
warning: {
|
|
38
|
+
light: 'var(--shades-theme-palette-warning-light)',
|
|
39
|
+
main: 'var(--shades-theme-palette-warning-main)',
|
|
40
|
+
dark: 'var(--shades-theme-palette-warning-dark)',
|
|
41
|
+
},
|
|
42
|
+
info: {
|
|
43
|
+
light: 'var(--shades-theme-palette-info-light)',
|
|
44
|
+
main: 'var(--shades-theme-palette-info-main)',
|
|
45
|
+
dark: 'var(--shades-theme-palette-info-dark)',
|
|
46
|
+
},
|
|
47
|
+
success: {
|
|
48
|
+
light: 'var(--shades-theme-palette-success-light)',
|
|
49
|
+
main: 'var(--shades-theme-palette-success-main)',
|
|
50
|
+
dark: 'var(--shades-theme-palette-success-dark)',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
divider: 'var(--shades-theme-divider)',
|
|
54
|
+
};
|
|
55
|
+
const setCssVariable = (key, value, root) => {
|
|
56
|
+
root.style.setProperty(key.replace('var(', '').replace(')', ''), value);
|
|
57
|
+
};
|
|
58
|
+
exports.setCssVariable = setCssVariable;
|
|
59
|
+
const getCssVariable = (key, root = document.querySelector(':root')) => {
|
|
60
|
+
return getComputedStyle(root).getPropertyValue(key.replace('var(', '').replace(')', ''));
|
|
61
|
+
};
|
|
62
|
+
exports.getCssVariable = getCssVariable;
|
|
63
|
+
const assignValue = (target, source, root, assignFn = exports.setCssVariable) => {
|
|
64
|
+
const keys = Object.keys(target);
|
|
65
|
+
keys.forEach((key) => {
|
|
66
|
+
if (typeof source[key] === 'object' && typeof target[key] === 'object') {
|
|
67
|
+
assignValue(target[key], source[key], root);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
assignFn(target[key], source[key], root);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
const useThemeCssVariables = (theme) => {
|
|
76
|
+
const root = document.querySelector(':root');
|
|
77
|
+
assignValue(exports.defaultVariableTheme, theme, root);
|
|
78
|
+
};
|
|
79
|
+
exports.useThemeCssVariables = useThemeCssVariables;
|
|
80
|
+
//# sourceMappingURL=default-variable-theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-variable-theme.js","sourceRoot":"","sources":["../../src/services/default-variable-theme.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAU;IACzC,IAAI,EAAE;QACJ,OAAO,EAAE,kCAAkC;QAC3C,SAAS,EAAE,oCAAoC;QAC/C,QAAQ,EAAE,mCAAmC;KAC9C;IACD,MAAM,EAAE;QACN,MAAM,EAAE,mCAAmC;QAC3C,KAAK,EAAE,kCAAkC;QACzC,QAAQ,EAAE,qCAAqC;QAC/C,QAAQ,EAAE,qCAAqC;QAC/C,kBAAkB,EAAE,gDAAgD;KACrE;IACD,UAAU,EAAE;QACV,OAAO,EAAE,wCAAwC;QACjD,KAAK,EAAE,sCAAsC;KAC9C;IACD,OAAO,EAAE;QACP,OAAO,EAAE;YACP,KAAK,EAAE,2CAA2C;YAClD,IAAI,EAAE,0CAA0C;YAChD,IAAI,EAAE,0CAA0C;SACjD;QACD,SAAS,EAAE;YACT,KAAK,EAAE,6CAA6C;YACpD,IAAI,EAAE,4CAA4C;YAClD,IAAI,EAAE,4CAA4C;SACnD;QACD,KAAK,EAAE;YACL,KAAK,EAAE,yCAAyC;YAChD,IAAI,EAAE,wCAAwC;YAC9C,IAAI,EAAE,wCAAwC;SAC/C;QACD,OAAO,EAAE;YACP,KAAK,EAAE,2CAA2C;YAClD,IAAI,EAAE,0CAA0C;YAChD,IAAI,EAAE,0CAA0C;SACjD;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,wCAAwC;YAC/C,IAAI,EAAE,uCAAuC;YAC7C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C,GAAG,CAAW,EAAE,MAAM,CAAC,GAAG,CAAW,EAAE,IAAI,CAAC,CAAA;SAC7D;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAEM,MAAM,oBAAoB,GAAG,CAAC,KAAyB,EAAE,EAAE;IAChE,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAgB,CAAA;IAC3D,WAAW,CAAC,4BAAoB,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;AAChD,CAAC,CAAA;AAHY,QAAA,oBAAoB,wBAGhC"}
|
package/dist/services/index.js
CHANGED
|
@@ -21,4 +21,5 @@ __exportStar(require("./default-dark-theme"), exports);
|
|
|
21
21
|
__exportStar(require("./default-light-theme"), exports);
|
|
22
22
|
__exportStar(require("./default-palette"), exports);
|
|
23
23
|
__exportStar(require("./noty-service"), exports);
|
|
24
|
+
__exportStar(require("./default-variable-theme"), exports);
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC;AACpC,uDAAoC;AACpC,2DAAwC;AACxC,uDAAoC;AACpC,wDAAqC;AACrC,oDAAiC;AACjC,iDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC;AACpC,uDAAoC;AACpC,2DAAwC;AACxC,uDAAoC;AACpC,wDAAqC;AACrC,oDAAiC;AACjC,iDAA8B;AAC9B,2DAAwC"}
|
|
@@ -8,8 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.ThemeProviderService = exports.RgbColor = void 0;
|
|
10
10
|
const inject_1 = require("@furystack/inject");
|
|
11
|
-
const
|
|
12
|
-
const default_dark_theme_1 = require("./default-dark-theme");
|
|
11
|
+
const default_variable_theme_1 = require("./default-variable-theme");
|
|
13
12
|
class RgbColor {
|
|
14
13
|
constructor(r, g, b, a = 1) {
|
|
15
14
|
this.r = r;
|
|
@@ -31,10 +30,10 @@ exports.RgbColor = RgbColor;
|
|
|
31
30
|
*/
|
|
32
31
|
let ThemeProviderService = class ThemeProviderService {
|
|
33
32
|
constructor() {
|
|
34
|
-
this.theme =
|
|
33
|
+
this.theme = default_variable_theme_1.defaultVariableTheme;
|
|
35
34
|
}
|
|
36
35
|
/**
|
|
37
|
-
*
|
|
36
|
+
* @deprecated does not respect CSS vars
|
|
38
37
|
* @param color The background color
|
|
39
38
|
* @param bright The Bright color
|
|
40
39
|
* @param dark The Dark color
|
|
@@ -51,6 +50,9 @@ let ThemeProviderService = class ThemeProviderService {
|
|
|
51
50
|
* @returns The parsed R,G,B, A values
|
|
52
51
|
*/
|
|
53
52
|
getRgbFromColorString(color) {
|
|
53
|
+
if (color.startsWith('var(--')) {
|
|
54
|
+
return this.getRgbFromColorString((0, default_variable_theme_1.getCssVariable)(color));
|
|
55
|
+
}
|
|
54
56
|
if (color.startsWith('#')) {
|
|
55
57
|
if (color.length === 7) {
|
|
56
58
|
const r = parseInt(color.substr(1, 2), 16);
|
|
@@ -71,13 +73,13 @@ let ThemeProviderService = class ThemeProviderService {
|
|
|
71
73
|
return new RgbColor(parseInt(result.groups.red, 10), parseInt(result.groups.green, 10), parseInt(result.groups.blue, 10), parseInt(result.groups.alpha, 10));
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
|
-
throw Error(`Color format '${color} is not supported.'`);
|
|
76
|
+
throw Error(`Color format '${color}' is not supported.'`);
|
|
75
77
|
}
|
|
76
78
|
set(change) {
|
|
77
|
-
|
|
79
|
+
(0, default_variable_theme_1.useThemeCssVariables)(change);
|
|
78
80
|
}
|
|
79
81
|
dispose() {
|
|
80
|
-
|
|
82
|
+
/** */
|
|
81
83
|
}
|
|
82
84
|
};
|
|
83
85
|
ThemeProviderService = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-provider-service.js","sourceRoot":"","sources":["../../src/services/theme-provider-service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,8CAA8C;AAE9C,
|
|
1
|
+
{"version":3,"file":"theme-provider-service.js","sourceRoot":"","sources":["../../src/services/theme-provider-service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,8CAA8C;AAE9C,qEAAqG;AA8CrG,MAAa,QAAQ;IACnB,YAAmB,CAAS,EAAS,CAAS,EAAS,CAAS,EAAS,IAAY,CAAC;QAAnE,MAAC,GAAD,CAAC,CAAQ;QAAS,MAAC,GAAD,CAAC,CAAQ;QAAS,MAAC,GAAD,CAAC,CAAQ;QAAS,MAAC,GAAD,CAAC,CAAY;IAAG,CAAC;IAEnF,MAAM,CAAC,GAA0B,EAAE,KAAa;QACrD,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;QACjB,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,QAAQ;QACb,OAAO,QAAQ,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,CAAA;IACxD,CAAC;CACF;AAXD,4BAWC;AAED;;GAEG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAA1B;QAsDW,UAAK,GAAG,6CAAoB,CAAA;IAS9C,CAAC;IA9DC;;;;;;OAMG;IACI,YAAY,CAAC,KAAa,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,GAAG,SAAS;QACrE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAA;QACrD,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAA;QAChD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-23,7 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@furystack/core": "^11.2.2",
|
|
25
25
|
"@furystack/inject": "^7.1.4",
|
|
26
|
-
"@furystack/shades": "^6.1.
|
|
26
|
+
"@furystack/shades": "^6.1.5",
|
|
27
27
|
"@furystack/utils": "^3.1.4",
|
|
28
28
|
"path-to-regexp": "^6.2.1",
|
|
29
29
|
"semaphore-async-await": "^1.5.1"
|
|
@@ -3,24 +3,20 @@ import { createComponent, LocationService, RouteLink, Shade } from '@furystack/s
|
|
|
3
3
|
import { match } from 'path-to-regexp'
|
|
4
4
|
import { ThemeProviderService } from '../services'
|
|
5
5
|
|
|
6
|
-
export const AppBarLink = Shade<RouteLinkProps
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const updateColor = () => {
|
|
10
|
-
const { isActive } = getState()
|
|
6
|
+
export const AppBarLink = Shade<RouteLinkProps>({
|
|
7
|
+
resources: ({ injector, props, element }) => {
|
|
8
|
+
const updateColor = (isActive: boolean) => {
|
|
11
9
|
const themeProviderService = injector.getInstance(ThemeProviderService)
|
|
12
|
-
const theme = themeProviderService
|
|
10
|
+
const { theme } = themeProviderService
|
|
13
11
|
const el = element.querySelector('a') as HTMLElement
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
el.style.
|
|
17
|
-
el.style.color = themeProviderService.getTextColor(backgroundColor)
|
|
12
|
+
el.style.color = isActive ? theme.text.primary : theme.text.secondary
|
|
13
|
+
el.style.opacity = isActive ? '1' : '0.8'
|
|
14
|
+
el.style.transform = isActive ? 'scale(1)' : 'scale(0.9)'
|
|
18
15
|
}
|
|
19
16
|
return [
|
|
20
17
|
injector.getInstance(LocationService).onLocationChanged.subscribe(async (currentUrl) => {
|
|
21
18
|
const isActive = !!match(props.href as string)(currentUrl)
|
|
22
|
-
|
|
23
|
-
updateColor()
|
|
19
|
+
updateColor(isActive)
|
|
24
20
|
}, true),
|
|
25
21
|
]
|
|
26
22
|
},
|
|
@@ -34,6 +30,7 @@ export const AppBarLink = Shade<RouteLinkProps, { isActive: boolean }>({
|
|
|
34
30
|
textDecoration: 'none',
|
|
35
31
|
alignItems: 'center',
|
|
36
32
|
padding: '0 8px',
|
|
33
|
+
transition: 'color .2s ease-in-out, transform .2s ease-in-out',
|
|
37
34
|
...props.style,
|
|
38
35
|
}}
|
|
39
36
|
{...props}
|
|
@@ -3,11 +3,6 @@ import { ThemeProviderService } from '../services/theme-provider-service'
|
|
|
3
3
|
|
|
4
4
|
export const AppBar = Shade({
|
|
5
5
|
shadowDomName: 'shade-app-bar',
|
|
6
|
-
resources: ({ element, injector }) => [
|
|
7
|
-
injector.getInstance(ThemeProviderService).theme.subscribe((t) => {
|
|
8
|
-
;(element.children[0] as HTMLElement).style.color = t.text.secondary
|
|
9
|
-
}, true), // TODO: Check TRUE
|
|
10
|
-
],
|
|
11
6
|
constructed: ({ element }) => {
|
|
12
7
|
const container = element.children[0] as HTMLElement
|
|
13
8
|
requestAnimationFrame(() => {
|
|
@@ -15,7 +10,8 @@ export const AppBar = Shade({
|
|
|
15
10
|
container.style.opacity = '1'
|
|
16
11
|
})
|
|
17
12
|
},
|
|
18
|
-
render: ({ children }) => {
|
|
13
|
+
render: ({ children, injector }) => {
|
|
14
|
+
const { theme } = injector.getInstance(ThemeProviderService)
|
|
19
15
|
return (
|
|
20
16
|
<div
|
|
21
17
|
style={{
|
|
@@ -31,6 +27,7 @@ export const AppBar = Shade({
|
|
|
31
27
|
opacity: '0',
|
|
32
28
|
position: 'fixed',
|
|
33
29
|
zIndex: '1',
|
|
30
|
+
color: theme.text.secondary,
|
|
34
31
|
}}
|
|
35
32
|
>
|
|
36
33
|
{children}
|
|
@@ -3,6 +3,7 @@ import { Shade, createComponent } from '@furystack/shades'
|
|
|
3
3
|
import { promisifyAnimation } from '../utils/promisify-animation'
|
|
4
4
|
import type { Palette, Theme } from '../services/theme-provider-service'
|
|
5
5
|
import { ThemeProviderService } from '../services/theme-provider-service'
|
|
6
|
+
import { Trace } from '@furystack/utils'
|
|
6
7
|
|
|
7
8
|
export type ButtonProps = PartialElement<HTMLButtonElement> & {
|
|
8
9
|
variant?: 'contained' | 'outlined'
|
|
@@ -65,13 +66,7 @@ const getHoveredTextColor = (buttonProps: ButtonProps, theme: Theme, fallback: (
|
|
|
65
66
|
: theme.text.primary
|
|
66
67
|
: fallback()
|
|
67
68
|
|
|
68
|
-
export const Button = Shade<ButtonProps
|
|
69
|
-
getInitialState: ({ injector }) => ({
|
|
70
|
-
theme: injector.getInstance(ThemeProviderService).theme.getValue(),
|
|
71
|
-
}),
|
|
72
|
-
resources: ({ injector, updateState }) => [
|
|
73
|
-
injector.getInstance(ThemeProviderService).theme.subscribe((theme) => updateState({ theme })),
|
|
74
|
-
],
|
|
69
|
+
export const Button = Shade<ButtonProps>({
|
|
75
70
|
constructed: ({ element }) => {
|
|
76
71
|
/**
|
|
77
72
|
* @param this The Document instance
|
|
@@ -99,11 +94,30 @@ export const Button = Shade<ButtonProps, { theme: Theme }>({
|
|
|
99
94
|
}
|
|
100
95
|
},
|
|
101
96
|
shadowDomName: 'shade-button',
|
|
102
|
-
|
|
97
|
+
resources: ({ injector, element, props }) => {
|
|
98
|
+
const tp = injector.getInstance(ThemeProviderService)
|
|
99
|
+
return [
|
|
100
|
+
...(props.variant === 'contained'
|
|
101
|
+
? [
|
|
102
|
+
Trace.method({
|
|
103
|
+
object: tp,
|
|
104
|
+
method: tp.set,
|
|
105
|
+
onFinished: () => {
|
|
106
|
+
const el = element.firstElementChild as HTMLButtonElement
|
|
107
|
+
el.style.color = getTextColor(props, tp.theme, () =>
|
|
108
|
+
tp.getTextColor(el.style.background || el.style.backgroundColor),
|
|
109
|
+
)
|
|
110
|
+
},
|
|
111
|
+
}),
|
|
112
|
+
]
|
|
113
|
+
: []),
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
render: ({ props, children, injector, element }) => {
|
|
103
117
|
const mouseDownHandler = props.onmousedown
|
|
104
118
|
const mouseUpHandler = props.onmouseup
|
|
105
|
-
const { theme } = getState()
|
|
106
119
|
const themeProvider = injector.getInstance(ThemeProviderService)
|
|
120
|
+
const { theme } = themeProvider
|
|
107
121
|
const background = getBackground(props, theme)
|
|
108
122
|
|
|
109
123
|
const hoveredBackground = getHoveredBackground(props, theme, () => {
|
|
@@ -114,8 +128,9 @@ export const Button = Shade<ButtonProps, { theme: Theme }>({
|
|
|
114
128
|
})
|
|
115
129
|
const boxShadow = getBoxShadow(props, theme)
|
|
116
130
|
const hoveredBoxShadow = getHoveredBoxShadow(props, theme)
|
|
117
|
-
const
|
|
118
|
-
const
|
|
131
|
+
const getTextColorInner = () => getTextColor(props, theme, () => themeProvider.getTextColor(background))
|
|
132
|
+
const getHoveredTextColorInner = () =>
|
|
133
|
+
getHoveredTextColor(props, theme, () => themeProvider.getTextColor(background))
|
|
119
134
|
|
|
120
135
|
const tryAnimate = async (
|
|
121
136
|
keyframes: PropertyIndexedKeyframes | Keyframe[] | null,
|
|
@@ -143,29 +158,27 @@ export const Button = Shade<ButtonProps, { theme: Theme }>({
|
|
|
143
158
|
mouseUpHandler?.call(this, ev)
|
|
144
159
|
}}
|
|
145
160
|
onmouseenter={() => {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
)
|
|
162
|
-
}
|
|
161
|
+
tryAnimate(
|
|
162
|
+
[
|
|
163
|
+
{
|
|
164
|
+
background,
|
|
165
|
+
boxShadow,
|
|
166
|
+
color: getTextColorInner(),
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
background: hoveredBackground,
|
|
170
|
+
boxShadow: hoveredBoxShadow,
|
|
171
|
+
color: getHoveredTextColorInner(),
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
{ duration: 500, fill: 'forwards', easing: 'cubic-bezier(0.215, 0.610, 0.355, 1.000)' },
|
|
175
|
+
)
|
|
163
176
|
}}
|
|
164
177
|
onmouseout={() => {
|
|
165
178
|
tryAnimate(
|
|
166
179
|
[
|
|
167
|
-
{ background: hoveredBackground, boxShadow: hoveredBoxShadow, color:
|
|
168
|
-
{ background, boxShadow, color:
|
|
180
|
+
{ background: hoveredBackground, boxShadow: hoveredBoxShadow, color: getHoveredTextColorInner() },
|
|
181
|
+
{ background, boxShadow, color: getTextColorInner() },
|
|
169
182
|
],
|
|
170
183
|
{
|
|
171
184
|
duration: 500,
|
|
@@ -184,7 +197,7 @@ export const Button = Shade<ButtonProps, { theme: Theme }>({
|
|
|
184
197
|
border: 'none',
|
|
185
198
|
borderRadius: '4px',
|
|
186
199
|
textTransform: 'uppercase',
|
|
187
|
-
color:
|
|
200
|
+
color: getTextColorInner(),
|
|
188
201
|
filter: 'drop-shadow(1px 1px 10px rgba(0,0,0,.5))',
|
|
189
202
|
backdropFilter: props.variant === 'outlined' ? 'blur(35px)' : undefined,
|
|
190
203
|
userSelect: 'none',
|
|
@@ -75,7 +75,7 @@ export const CommandPaletteSuggestionList = Shade<
|
|
|
75
75
|
maxHeight: `${window.innerHeight * 0.8}px`,
|
|
76
76
|
zIndex: '1',
|
|
77
77
|
left: 'auto',
|
|
78
|
-
backgroundColor: injector.getInstance(ThemeProviderService).theme.
|
|
78
|
+
backgroundColor: injector.getInstance(ThemeProviderService).theme.background.paper,
|
|
79
79
|
boxShadow: '3px 3px 5px rgba(0,0,0,0.3)',
|
|
80
80
|
width: `calc(${Math.round(element.parentElement?.getBoundingClientRect().width || 200)}px - 3em)`,
|
|
81
81
|
...(props.fullScreenSuggestions ? { left: '0', width: 'calc(100% - 42px)' } : {}),
|
|
@@ -72,17 +72,8 @@ export const DataGrid: <T>(props: DataGridProps<T>, children: ChildrenList) => J
|
|
|
72
72
|
DataGridProps<any>
|
|
73
73
|
>({
|
|
74
74
|
shadowDomName: 'shade-data-grid',
|
|
75
|
-
resources: ({
|
|
76
|
-
const tp = injector.getInstance(ThemeProviderService)
|
|
75
|
+
resources: ({ element, props }) => {
|
|
77
76
|
return [
|
|
78
|
-
tp.theme.subscribe((t) => {
|
|
79
|
-
const headers = element.querySelectorAll('th')
|
|
80
|
-
const { r, g, b } = tp.getRgbFromColorString(t.background.paper)
|
|
81
|
-
headers.forEach((header) => {
|
|
82
|
-
header.style.color = t.text.secondary
|
|
83
|
-
header.style.backgroundColor = `rgba(${r}, ${g}, ${b}, 0.3)`
|
|
84
|
-
})
|
|
85
|
-
}),
|
|
86
77
|
new ClickAwayService(element, () => {
|
|
87
78
|
props.service.hasFocus.setValue(false)
|
|
88
79
|
}),
|
|
@@ -95,12 +86,10 @@ export const DataGrid: <T>(props: DataGridProps<T>, children: ChildrenList) => J
|
|
|
95
86
|
},
|
|
96
87
|
render: ({ props, injector }) => {
|
|
97
88
|
const tp = injector.getInstance(ThemeProviderService)
|
|
98
|
-
const theme = tp
|
|
89
|
+
const { theme } = tp
|
|
99
90
|
|
|
100
|
-
const { r, g, b } = tp.getRgbFromColorString(theme.background.paper)
|
|
101
91
|
const headerStyle: Partial<CSSStyleDeclaration> = {
|
|
102
|
-
|
|
103
|
-
backdropFilter: 'blur(10px)',
|
|
92
|
+
backdropFilter: 'blur(12px)',
|
|
104
93
|
padding: '12px 0',
|
|
105
94
|
color: theme.text.secondary,
|
|
106
95
|
alignItems: 'center',
|
|
@@ -9,16 +9,8 @@ export const DataGridFooter = Shade<{ service: CollectionService<any> }, { data:
|
|
|
9
9
|
getInitialState: ({ props }) => ({
|
|
10
10
|
data: props.service.data.getValue(),
|
|
11
11
|
}),
|
|
12
|
-
constructed: ({ props, updateState
|
|
13
|
-
const disposables = [
|
|
14
|
-
props.service.data.subscribe((data) => updateState({ data })),
|
|
15
|
-
|
|
16
|
-
injector.getInstance(ThemeProviderService).theme.subscribe((t) => {
|
|
17
|
-
const el = element.querySelector('div') as HTMLDivElement
|
|
18
|
-
el.style.color = t.text.secondary
|
|
19
|
-
el.style.background = t.background.paper
|
|
20
|
-
}),
|
|
21
|
-
]
|
|
12
|
+
constructed: ({ props, updateState }) => {
|
|
13
|
+
const disposables = [props.service.data.subscribe((data) => updateState({ data }))]
|
|
22
14
|
|
|
23
15
|
return () => disposables.forEach((d) => d.dispose())
|
|
24
16
|
},
|
|
@@ -27,7 +19,7 @@ export const DataGridFooter = Shade<{ service: CollectionService<any> }, { data:
|
|
|
27
19
|
const currentQuerySettings = props.service.querySettings.getValue()
|
|
28
20
|
const currentPage = Math.ceil(currentQuerySettings.skip || 0) / (currentQuerySettings.top || 1)
|
|
29
21
|
const currentEntriesPerPage = currentQuerySettings.top || Infinity
|
|
30
|
-
const theme = injector.getInstance(ThemeProviderService)
|
|
22
|
+
const { theme } = injector.getInstance(ThemeProviderService)
|
|
31
23
|
|
|
32
24
|
return (
|
|
33
25
|
<div
|
package/src/components/grid.tsx
CHANGED
|
@@ -25,17 +25,8 @@ export type RowCells<T> = {
|
|
|
25
25
|
|
|
26
26
|
export const Grid: <T>(props: GridProps<T>, children: ChildrenList) => JSX.Element<any, any> = Shade({
|
|
27
27
|
shadowDomName: 'shade-grid',
|
|
28
|
-
resources: ({ injector, element }) => [
|
|
29
|
-
injector.getInstance(ThemeProviderService).theme.subscribe((t) => {
|
|
30
|
-
const headers = element.querySelectorAll('th')
|
|
31
|
-
headers.forEach((header) => {
|
|
32
|
-
header.style.color = t.text.secondary
|
|
33
|
-
header.style.background = t.background.paper
|
|
34
|
-
})
|
|
35
|
-
}),
|
|
36
|
-
],
|
|
37
28
|
render: ({ props, injector }) => {
|
|
38
|
-
const theme = injector.getInstance(ThemeProviderService)
|
|
29
|
+
const { theme } = injector.getInstance(ThemeProviderService)
|
|
39
30
|
const headerStyle: Partial<CSSStyleDeclaration> = {
|
|
40
31
|
padding: '0 0.51em',
|
|
41
32
|
backgroundColor: theme.background.paper,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PartialElement } from '@furystack/shades'
|
|
2
2
|
import { Shade, createComponent, attachStyles } from '@furystack/shades'
|
|
3
3
|
import { ThemeProviderService } from '../..'
|
|
4
|
-
import type { Palette
|
|
4
|
+
import type { Palette } from '../../services'
|
|
5
5
|
|
|
6
6
|
export interface TextInputProps extends PartialElement<HTMLInputElement> {
|
|
7
7
|
/**
|
|
@@ -47,7 +47,6 @@ export interface TextInputProps extends PartialElement<HTMLInputElement> {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export type TextInputState = {
|
|
50
|
-
theme: Theme
|
|
51
50
|
value: string
|
|
52
51
|
focused: boolean
|
|
53
52
|
validity: ValidityState
|
|
@@ -69,12 +68,12 @@ const getLabelStyle = ({
|
|
|
69
68
|
justifyContent: 'space-between',
|
|
70
69
|
fontSize: '10px',
|
|
71
70
|
color: props.disabled
|
|
72
|
-
?
|
|
71
|
+
? themeProvider.theme.text.disabled
|
|
73
72
|
: state.validity?.valid === false
|
|
74
|
-
?
|
|
73
|
+
? themeProvider.theme.palette.error.main
|
|
75
74
|
: state.focused
|
|
76
|
-
?
|
|
77
|
-
:
|
|
75
|
+
? themeProvider.theme.text.primary
|
|
76
|
+
: themeProvider.theme.text.secondary,
|
|
78
77
|
marginBottom: '1em',
|
|
79
78
|
padding: '1em',
|
|
80
79
|
borderRadius: '5px',
|
|
@@ -83,8 +82,8 @@ const getLabelStyle = ({
|
|
|
83
82
|
? themeProvider
|
|
84
83
|
.getRgbFromColorString(
|
|
85
84
|
state.validity?.valid === false
|
|
86
|
-
?
|
|
87
|
-
:
|
|
85
|
+
? themeProvider.theme.palette.error.main
|
|
86
|
+
: themeProvider.theme.palette[props.defaultColor || 'primary'].main,
|
|
88
87
|
)
|
|
89
88
|
.update('a', state.focused ? 0.1 : 0.2)
|
|
90
89
|
.toString()
|
|
@@ -93,10 +92,10 @@ const getLabelStyle = ({
|
|
|
93
92
|
props.variant === 'outlined' || props.variant === 'contained'
|
|
94
93
|
? `0 0 0 1px ${
|
|
95
94
|
state.validity?.valid === false
|
|
96
|
-
?
|
|
95
|
+
? themeProvider.theme.palette.error.main
|
|
97
96
|
: state.focused
|
|
98
|
-
?
|
|
99
|
-
:
|
|
97
|
+
? themeProvider.theme.palette[props.defaultColor || 'primary'].main
|
|
98
|
+
: themeProvider.theme.text.primary
|
|
100
99
|
}`
|
|
101
100
|
: 'none',
|
|
102
101
|
filter: props.disabled ? 'grayscale(100%)' : 'none',
|
|
@@ -109,15 +108,11 @@ const getLabelStyle = ({
|
|
|
109
108
|
|
|
110
109
|
export const Input = Shade<TextInputProps, TextInputState>({
|
|
111
110
|
shadowDomName: 'shade-input',
|
|
112
|
-
getInitialState: ({
|
|
113
|
-
theme: injector.getInstance(ThemeProviderService).theme.getValue(),
|
|
111
|
+
getInitialState: ({ props }) => ({
|
|
114
112
|
value: props.value || '',
|
|
115
113
|
focused: props.autofocus || false,
|
|
116
114
|
validity: { valid: true } as ValidityState,
|
|
117
115
|
}),
|
|
118
|
-
resources: ({ injector, updateState }) => [
|
|
119
|
-
injector.getInstance(ThemeProviderService).theme.subscribe((theme) => updateState({ theme })),
|
|
120
|
-
],
|
|
121
116
|
compareState: ({ newState, element, props, injector }) => {
|
|
122
117
|
const themeProvider = injector.getInstance(ThemeProviderService)
|
|
123
118
|
const label = element.querySelector('label') as HTMLLabelElement
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { PartialElement } from '@furystack/shades'
|
|
2
2
|
import { createComponent, Shade } from '@furystack/shades'
|
|
3
|
-
import type { Theme } from '../../services'
|
|
4
3
|
import { ThemeProviderService } from '../../services'
|
|
5
4
|
import { promisifyAnimation } from '../../utils'
|
|
6
5
|
|
|
@@ -12,23 +11,18 @@ export interface TextAreaProps extends PartialElement<HTMLTextAreaElement> {
|
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
export type TextAreaInputState = {
|
|
15
|
-
theme: Theme
|
|
16
14
|
value?: string
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
export const TextArea = Shade<TextAreaProps, TextAreaInputState>({
|
|
20
18
|
shadowDomName: 'shade-text-area',
|
|
21
|
-
getInitialState: ({
|
|
22
|
-
theme: injector.getInstance(ThemeProviderService).theme.getValue(),
|
|
19
|
+
getInitialState: ({ props }) => ({
|
|
23
20
|
value: props.value,
|
|
24
21
|
}),
|
|
25
|
-
resources: ({ injector, updateState }) => {
|
|
26
|
-
const themeProvider = injector.getInstance(ThemeProviderService)
|
|
27
|
-
return [themeProvider.theme.subscribe((theme) => updateState({ theme }))]
|
|
28
|
-
},
|
|
29
22
|
render: ({ props, element, injector, getState }) => {
|
|
30
23
|
const themeProvider = injector.getInstance(ThemeProviderService)
|
|
31
|
-
const { theme
|
|
24
|
+
const { theme } = themeProvider
|
|
25
|
+
const { value } = getState()
|
|
32
26
|
const { palette } = theme
|
|
33
27
|
|
|
34
28
|
return (
|