@momentum-design/components 0.0.29 → 0.0.31
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/browser/index.js +16 -16
- package/dist/browser/index.js.map +4 -4
- package/dist/components/themeprovider/themeprovider.component.d.ts +29 -17
- package/dist/components/themeprovider/themeprovider.component.js +41 -33
- package/dist/components/themeprovider/themeprovider.constants.d.ts +2 -7
- package/dist/components/themeprovider/themeprovider.constants.js +2 -21
- package/dist/components/themeprovider/themeprovider.context.d.ts +2 -3
- package/dist/components/themeprovider/themeprovider.context.js +3 -3
- package/dist/custom-elements.json +28 -28
- package/dist/react/themeprovider/index.d.ts +13 -5
- package/dist/react/themeprovider/index.js +13 -5
- package/package.json +9 -3
- package/dist/components/iconprovider/iconprovider.stories.utils.d.ts +0 -11
- package/dist/components/iconprovider/iconprovider.stories.utils.js +0 -25
- package/dist/components/themeprovider/themeprovider.stories.utils.d.ts +0 -12
- package/dist/components/themeprovider/themeprovider.stories.utils.js +0 -20
- package/dist/components/themeprovider/themeprovider.types.d.ts +0 -5
- package/dist/components/themeprovider/themeprovider.types.js +0 -2
- package/dist/components/themeprovider/themeprovider.utils.d.ts +0 -9
- package/dist/components/themeprovider/themeprovider.utils.js +0 -10
@@ -1,48 +1,60 @@
|
|
1
1
|
import { Provider } from '../../models';
|
2
2
|
import ThemeProviderContext from './themeprovider.context';
|
3
|
-
import type { Theme } from './themeprovider.types';
|
4
3
|
/**
|
5
|
-
* ThemeProvider component, which sets the
|
6
|
-
*
|
4
|
+
* ThemeProvider component, which sets the passed in themeclass as class.
|
5
|
+
* If the themeclass switches, the existing themeclass will be removed as a class
|
6
|
+
* and the new themeclass will be added.
|
7
|
+
*
|
8
|
+
* CSS variables defined in the themeclass will be used for the styling of child dom nodes.
|
9
|
+
*
|
10
|
+
* Themeclass context can be be consumed from Lit child components
|
7
11
|
* (see providerUtils.consume for how to consume)
|
8
12
|
*
|
9
|
-
* ThemeProvider also includes
|
10
|
-
* for Text components.
|
13
|
+
* ThemeProvider also includes basic font defaults for text.
|
11
14
|
*
|
12
|
-
* @tag mdc-themeprovider
|
13
15
|
* @tagname mdc-themeprovider
|
16
|
+
*
|
17
|
+
* @slot default - children
|
18
|
+
*
|
19
|
+
* @cssproperty --mdc-themeprovider-font-family - Option to override the font family
|
20
|
+
* @cssproperty --mdc-themeprovider-color-default - Option to override the default color
|
14
21
|
*/
|
15
22
|
declare class ThemeProvider extends Provider<ThemeProviderContext> {
|
16
23
|
constructor();
|
24
|
+
/**
|
25
|
+
* Context object of the ThemeProvider, to be consumed by child components
|
26
|
+
*/
|
17
27
|
static get Context(): {
|
18
28
|
__context__: ThemeProviderContext;
|
19
29
|
};
|
20
30
|
/**
|
21
|
-
*
|
22
|
-
*
|
23
|
-
* Has to be a space separated string, like className
|
24
|
-
* e.g.: `mds-theme-stable-darkWebex mds-theme-stable-lightWebex`
|
31
|
+
* To keep track of the current theme class
|
32
|
+
* @internal
|
25
33
|
*/
|
26
|
-
|
34
|
+
private currentThemeClass?;
|
27
35
|
/**
|
28
|
-
* Current theme
|
36
|
+
* Current theme class
|
29
37
|
*
|
30
38
|
* Has to be fully qualified, such that
|
31
|
-
* the theme
|
39
|
+
* the theme class matches the class of the respective
|
32
40
|
* theme stylesheet
|
41
|
+
*
|
42
|
+
* Default: 'mds-theme-stable-darkWebex'
|
33
43
|
*/
|
34
|
-
|
44
|
+
themeclass: string;
|
35
45
|
protected updated(changedProperties: Map<string, any>): void;
|
36
46
|
/**
|
37
47
|
* Update all observing components of this
|
38
|
-
* provider to update the
|
48
|
+
* provider to update the themeclass
|
49
|
+
*
|
50
|
+
* Is called on every re-render, see Provider class
|
39
51
|
*/
|
40
52
|
protected updateContext(): void;
|
41
53
|
/**
|
42
|
-
* Function to update the active theme
|
54
|
+
* Function to update the active theme classnames to update the theme tokens
|
43
55
|
* as CSS variables on the web component.
|
44
56
|
*/
|
45
|
-
private
|
57
|
+
private setThemeInClassList;
|
46
58
|
static styles: import("lit").CSSResult;
|
47
59
|
}
|
48
60
|
export default ThemeProvider;
|
@@ -7,80 +7,88 @@ const models_1 = require("../../models");
|
|
7
7
|
const themeprovider_context_1 = tslib_1.__importDefault(require("./themeprovider.context"));
|
8
8
|
const themeprovider_styles_1 = tslib_1.__importDefault(require("./themeprovider.styles"));
|
9
9
|
/**
|
10
|
-
* ThemeProvider component, which sets the
|
11
|
-
*
|
10
|
+
* ThemeProvider component, which sets the passed in themeclass as class.
|
11
|
+
* If the themeclass switches, the existing themeclass will be removed as a class
|
12
|
+
* and the new themeclass will be added.
|
13
|
+
*
|
14
|
+
* CSS variables defined in the themeclass will be used for the styling of child dom nodes.
|
15
|
+
*
|
16
|
+
* Themeclass context can be be consumed from Lit child components
|
12
17
|
* (see providerUtils.consume for how to consume)
|
13
18
|
*
|
14
|
-
* ThemeProvider also includes
|
15
|
-
* for Text components.
|
19
|
+
* ThemeProvider also includes basic font defaults for text.
|
16
20
|
*
|
17
|
-
* @tag mdc-themeprovider
|
18
21
|
* @tagname mdc-themeprovider
|
22
|
+
*
|
23
|
+
* @slot default - children
|
24
|
+
*
|
25
|
+
* @cssproperty --mdc-themeprovider-font-family - Option to override the font family
|
26
|
+
* @cssproperty --mdc-themeprovider-color-default - Option to override the default color
|
19
27
|
*/
|
20
28
|
class ThemeProvider extends models_1.Provider {
|
21
29
|
constructor() {
|
22
|
-
// initialise the context by running the Provider constructor:
|
23
30
|
super({
|
24
31
|
context: themeprovider_context_1.default.context,
|
25
|
-
initialValue: new themeprovider_context_1.default(themeprovider_constants_1.DEFAULTS.
|
32
|
+
initialValue: new themeprovider_context_1.default(themeprovider_constants_1.DEFAULTS.THEMECLASS),
|
26
33
|
});
|
27
34
|
/**
|
28
|
-
*
|
29
|
-
*
|
30
|
-
* Has to be a space separated string, like className
|
31
|
-
* e.g.: `mds-theme-stable-darkWebex mds-theme-stable-lightWebex`
|
32
|
-
*/
|
33
|
-
this.themes = themeprovider_constants_1.THEMES.join(' ');
|
34
|
-
/**
|
35
|
-
* Current theme attribute
|
35
|
+
* Current theme class
|
36
36
|
*
|
37
37
|
* Has to be fully qualified, such that
|
38
|
-
* the theme
|
38
|
+
* the theme class matches the class of the respective
|
39
39
|
* theme stylesheet
|
40
|
+
*
|
41
|
+
* Default: 'mds-theme-stable-darkWebex'
|
40
42
|
*/
|
41
|
-
this.
|
43
|
+
this.themeclass = themeprovider_constants_1.DEFAULTS.THEMECLASS;
|
42
44
|
}
|
45
|
+
/**
|
46
|
+
* Context object of the ThemeProvider, to be consumed by child components
|
47
|
+
*/
|
43
48
|
static get Context() {
|
44
49
|
return themeprovider_context_1.default.context;
|
45
50
|
}
|
46
51
|
updated(changedProperties) {
|
47
52
|
super.updated(changedProperties);
|
48
|
-
if (changedProperties.has('
|
49
|
-
this.
|
53
|
+
if (changedProperties.has('themeclass')) {
|
54
|
+
this.setThemeInClassList();
|
55
|
+
this.currentThemeClass = this.themeclass;
|
50
56
|
}
|
51
57
|
}
|
52
58
|
/**
|
53
59
|
* Update all observing components of this
|
54
|
-
* provider to update the
|
60
|
+
* provider to update the themeclass
|
61
|
+
*
|
62
|
+
* Is called on every re-render, see Provider class
|
55
63
|
*/
|
56
64
|
updateContext() {
|
57
|
-
|
58
|
-
|
59
|
-
this.context.value.theme = this.theme;
|
60
|
-
shouldUpdateConsumers = true;
|
61
|
-
}
|
62
|
-
if (shouldUpdateConsumers) {
|
65
|
+
if (this.context.value.themeclass !== this.themeclass) {
|
66
|
+
this.context.value.themeclass = this.themeclass;
|
63
67
|
this.context.updateObservers();
|
64
68
|
}
|
65
69
|
}
|
66
70
|
/**
|
67
|
-
* Function to update the active theme
|
71
|
+
* Function to update the active theme classnames to update the theme tokens
|
68
72
|
* as CSS variables on the web component.
|
69
73
|
*/
|
70
|
-
|
74
|
+
setThemeInClassList() {
|
71
75
|
// remove all existing theme classes from the classList:
|
72
|
-
|
76
|
+
if (this.currentThemeClass) {
|
77
|
+
this.classList.remove(...this.currentThemeClass.split(' '));
|
78
|
+
}
|
73
79
|
// add current theme class to classList:
|
74
|
-
|
80
|
+
if (this.themeclass) {
|
81
|
+
this.classList.add(...this.themeclass.split(' '));
|
82
|
+
}
|
75
83
|
}
|
76
84
|
}
|
77
85
|
ThemeProvider.styles = themeprovider_styles_1.default;
|
78
86
|
tslib_1.__decorate([
|
79
|
-
(0, decorators_js_1.
|
87
|
+
(0, decorators_js_1.state)(),
|
80
88
|
tslib_1.__metadata("design:type", String)
|
81
|
-
], ThemeProvider.prototype, "
|
89
|
+
], ThemeProvider.prototype, "currentThemeClass", void 0);
|
82
90
|
tslib_1.__decorate([
|
83
91
|
(0, decorators_js_1.property)({ type: String }),
|
84
92
|
tslib_1.__metadata("design:type", String)
|
85
|
-
], ThemeProvider.prototype, "
|
93
|
+
], ThemeProvider.prototype, "themeclass", void 0);
|
86
94
|
exports.default = ThemeProvider;
|
@@ -1,10 +1,5 @@
|
|
1
1
|
declare const TAG_NAME: "mdc-themeprovider";
|
2
|
-
declare const THEME_NAMES: {
|
3
|
-
DARK_WEBEX: "darkWebex";
|
4
|
-
LIGHT_WEBEX: "lightWebex";
|
5
|
-
};
|
6
|
-
declare const THEMES: ("mds-theme-stable-darkWebex" | "mds-theme-stable-lightWebex")[];
|
7
2
|
declare const DEFAULTS: {
|
8
|
-
|
3
|
+
THEMECLASS: "mds-theme-stable-darkWebex";
|
9
4
|
};
|
10
|
-
export { DEFAULTS,
|
5
|
+
export { DEFAULTS, TAG_NAME };
|
@@ -1,31 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.TAG_NAME = exports.
|
3
|
+
exports.TAG_NAME = exports.DEFAULTS = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
/* eslint-disable implicit-arrow-linebreak */
|
6
6
|
const tag_name_1 = tslib_1.__importDefault(require("../../utils/tag-name"));
|
7
|
-
const themeprovider_utils_1 = tslib_1.__importDefault(require("./themeprovider.utils"));
|
8
7
|
const TAG_NAME = tag_name_1.default.constructTagName('themeprovider');
|
9
8
|
exports.TAG_NAME = TAG_NAME;
|
10
|
-
// Some themes are disabled until tokens are available for those themes
|
11
|
-
const THEME_NAMES = {
|
12
|
-
// DARK_BRONZE: 'darkBronze' as const,
|
13
|
-
// DARK_INDIGO: 'darkIndigo' as const,
|
14
|
-
// DARK_JADE: 'darkJade' as const,
|
15
|
-
// DARK_LAVENDER: 'darkLavender' as const,
|
16
|
-
// DARK_ROSE: 'darkRose' as const,
|
17
|
-
DARK_WEBEX: 'darkWebex',
|
18
|
-
// LIGHT_BRONZE: 'lightBronze' as const,
|
19
|
-
// LIGHT_INDIGO: 'lightIndigo' as const,
|
20
|
-
// LIGHT_JADE: 'lightJade' as const,
|
21
|
-
// LIGHT_LAVENDER: 'lightLavender' as const,
|
22
|
-
// LIGHT_ROSE: 'lightRose' as const,
|
23
|
-
LIGHT_WEBEX: 'lightWebex',
|
24
|
-
};
|
25
|
-
exports.THEME_NAMES = THEME_NAMES;
|
26
|
-
const THEMES = Object.values(THEME_NAMES).map((themeName) => themeprovider_utils_1.default.getFullQualifiedTheme(themeName));
|
27
|
-
exports.THEMES = THEMES;
|
28
9
|
const DEFAULTS = {
|
29
|
-
|
10
|
+
THEMECLASS: 'mds-theme-stable-darkWebex',
|
30
11
|
};
|
31
12
|
exports.DEFAULTS = DEFAULTS;
|
@@ -1,9 +1,8 @@
|
|
1
|
-
import type { Theme } from './themeprovider.types';
|
2
1
|
declare class ThemeProviderContext {
|
3
|
-
|
2
|
+
themeclass?: string;
|
4
3
|
static context: {
|
5
4
|
__context__: ThemeProviderContext;
|
6
5
|
};
|
7
|
-
constructor(
|
6
|
+
constructor(defaultThemeClass?: string);
|
8
7
|
}
|
9
8
|
export default ThemeProviderContext;
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const context_1 = require("@lit/context");
|
4
4
|
const themeprovider_constants_1 = require("./themeprovider.constants");
|
5
5
|
class ThemeProviderContext {
|
6
|
-
// constructor to allow setting the
|
7
|
-
constructor(
|
8
|
-
this.
|
6
|
+
// constructor to allow setting the defaultThemeClass
|
7
|
+
constructor(defaultThemeClass) {
|
8
|
+
this.themeclass = defaultThemeClass;
|
9
9
|
}
|
10
10
|
}
|
11
11
|
// create typed lit context as part of the ThemeProviderContext
|
@@ -630,33 +630,41 @@
|
|
630
630
|
"declarations": [
|
631
631
|
{
|
632
632
|
"kind": "class",
|
633
|
-
"description": "ThemeProvider component, which sets the
|
633
|
+
"description": "ThemeProvider component, which sets the passed in themeclass as class.\nIf the themeclass switches, the existing themeclass will be removed as a class\nand the new themeclass will be added.\n\nCSS variables defined in the themeclass will be used for the styling of child dom nodes.\n\nThemeclass context can be be consumed from Lit child components\n(see providerUtils.consume for how to consume)\n\nThemeProvider also includes basic font defaults for text.",
|
634
634
|
"name": "ThemeProvider",
|
635
|
+
"cssProperties": [
|
636
|
+
{
|
637
|
+
"description": "Option to override the font family",
|
638
|
+
"name": "--mdc-themeprovider-font-family"
|
639
|
+
},
|
640
|
+
{
|
641
|
+
"description": "Option to override the default color",
|
642
|
+
"name": "--mdc-themeprovider-color-default"
|
643
|
+
}
|
644
|
+
],
|
645
|
+
"slots": [
|
646
|
+
{
|
647
|
+
"description": "children",
|
648
|
+
"name": "default"
|
649
|
+
}
|
650
|
+
],
|
635
651
|
"members": [
|
636
652
|
{
|
637
653
|
"kind": "field",
|
638
654
|
"name": "Context",
|
639
655
|
"privacy": "public",
|
640
656
|
"static": true,
|
657
|
+
"description": "Context object of the ThemeProvider, to be consumed by child components",
|
641
658
|
"readonly": true
|
642
659
|
},
|
643
660
|
{
|
644
661
|
"kind": "field",
|
645
|
-
"name": "
|
662
|
+
"name": "themeclass",
|
646
663
|
"type": {
|
647
664
|
"text": "string"
|
648
665
|
},
|
649
|
-
"description": "
|
650
|
-
"attribute": "
|
651
|
-
},
|
652
|
-
{
|
653
|
-
"kind": "field",
|
654
|
-
"name": "theme",
|
655
|
-
"type": {
|
656
|
-
"text": "Theme"
|
657
|
-
},
|
658
|
-
"description": "Current theme attribute\n\nHas to be fully qualified, such that\nthe theme name matches the className of the respective\ntheme stylesheet",
|
659
|
-
"attribute": "theme"
|
666
|
+
"description": "Current theme class\n\nHas to be fully qualified, such that\nthe theme class matches the class of the respective\ntheme stylesheet\n\nDefault: 'mds-theme-stable-darkWebex'",
|
667
|
+
"attribute": "themeclass"
|
660
668
|
},
|
661
669
|
{
|
662
670
|
"kind": "method",
|
@@ -667,31 +675,23 @@
|
|
667
675
|
"text": "void"
|
668
676
|
}
|
669
677
|
},
|
670
|
-
"description": "Update all observing components of this\nprovider to update the
|
678
|
+
"description": "Update all observing components of this\nprovider to update the themeclass\n\nIs called on every re-render, see Provider class"
|
671
679
|
},
|
672
680
|
{
|
673
681
|
"kind": "method",
|
674
|
-
"name": "
|
682
|
+
"name": "setThemeInClassList",
|
675
683
|
"privacy": "private",
|
676
|
-
"description": "Function to update the active theme
|
684
|
+
"description": "Function to update the active theme classnames to update the theme tokens\nas CSS variables on the web component."
|
677
685
|
}
|
678
686
|
],
|
679
687
|
"attributes": [
|
680
688
|
{
|
681
|
-
"name": "
|
689
|
+
"name": "themeclass",
|
682
690
|
"type": {
|
683
691
|
"text": "string"
|
684
692
|
},
|
685
|
-
"description": "
|
686
|
-
"fieldName": "
|
687
|
-
},
|
688
|
-
{
|
689
|
-
"name": "theme",
|
690
|
-
"type": {
|
691
|
-
"text": "Theme"
|
692
|
-
},
|
693
|
-
"description": "Current theme attribute\n\nHas to be fully qualified, such that\nthe theme name matches the className of the respective\ntheme stylesheet",
|
694
|
-
"fieldName": "theme"
|
693
|
+
"description": "Current theme class\n\nHas to be fully qualified, such that\nthe theme class matches the class of the respective\ntheme stylesheet\n\nDefault: 'mds-theme-stable-darkWebex'",
|
694
|
+
"fieldName": "themeclass"
|
695
695
|
}
|
696
696
|
],
|
697
697
|
"superclass": {
|
@@ -699,7 +699,7 @@
|
|
699
699
|
"module": "/src/models"
|
700
700
|
},
|
701
701
|
"tagName": "mdc-themeprovider",
|
702
|
-
"jsDoc": "/**\n * ThemeProvider component, which sets the
|
702
|
+
"jsDoc": "/**\n * ThemeProvider component, which sets the passed in themeclass as class.\n * If the themeclass switches, the existing themeclass will be removed as a class\n * and the new themeclass will be added.\n *\n * CSS variables defined in the themeclass will be used for the styling of child dom nodes.\n *\n * Themeclass context can be be consumed from Lit child components\n * (see providerUtils.consume for how to consume)\n *\n * ThemeProvider also includes basic font defaults for text.\n *\n * @tagname mdc-themeprovider\n *\n * @slot default - children\n *\n * @cssproperty --mdc-themeprovider-font-family - Option to override the font family\n * @cssproperty --mdc-themeprovider-color-default - Option to override the default color\n */",
|
703
703
|
"customElement": true
|
704
704
|
}
|
705
705
|
],
|
@@ -1,14 +1,22 @@
|
|
1
1
|
import Component from '../../components/themeprovider';
|
2
2
|
/**
|
3
|
-
* ThemeProvider component, which sets the
|
4
|
-
*
|
3
|
+
* ThemeProvider component, which sets the passed in themeclass as class.
|
4
|
+
* If the themeclass switches, the existing themeclass will be removed as a class
|
5
|
+
* and the new themeclass will be added.
|
6
|
+
*
|
7
|
+
* CSS variables defined in the themeclass will be used for the styling of child dom nodes.
|
8
|
+
*
|
9
|
+
* Themeclass context can be be consumed from Lit child components
|
5
10
|
* (see providerUtils.consume for how to consume)
|
6
11
|
*
|
7
|
-
* ThemeProvider also includes
|
8
|
-
* for Text components.
|
12
|
+
* ThemeProvider also includes basic font defaults for text.
|
9
13
|
*
|
10
|
-
* @tag mdc-themeprovider
|
11
14
|
* @tagname mdc-themeprovider
|
15
|
+
*
|
16
|
+
* @slot default - children
|
17
|
+
*
|
18
|
+
* @cssproperty --mdc-themeprovider-font-family - Option to override the font family
|
19
|
+
* @cssproperty --mdc-themeprovider-color-default - Option to override the default color
|
12
20
|
*/
|
13
21
|
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
|
14
22
|
export default reactWrapper;
|
@@ -6,15 +6,23 @@ const react_1 = require("@lit/react");
|
|
6
6
|
const themeprovider_1 = tslib_1.__importDefault(require("../../components/themeprovider"));
|
7
7
|
const themeprovider_constants_1 = require("../../components/themeprovider/themeprovider.constants");
|
8
8
|
/**
|
9
|
-
* ThemeProvider component, which sets the
|
10
|
-
*
|
9
|
+
* ThemeProvider component, which sets the passed in themeclass as class.
|
10
|
+
* If the themeclass switches, the existing themeclass will be removed as a class
|
11
|
+
* and the new themeclass will be added.
|
12
|
+
*
|
13
|
+
* CSS variables defined in the themeclass will be used for the styling of child dom nodes.
|
14
|
+
*
|
15
|
+
* Themeclass context can be be consumed from Lit child components
|
11
16
|
* (see providerUtils.consume for how to consume)
|
12
17
|
*
|
13
|
-
* ThemeProvider also includes
|
14
|
-
* for Text components.
|
18
|
+
* ThemeProvider also includes basic font defaults for text.
|
15
19
|
*
|
16
|
-
* @tag mdc-themeprovider
|
17
20
|
* @tagname mdc-themeprovider
|
21
|
+
*
|
22
|
+
* @slot default - children
|
23
|
+
*
|
24
|
+
* @cssproperty --mdc-themeprovider-font-family - Option to override the font family
|
25
|
+
* @cssproperty --mdc-themeprovider-color-default - Option to override the default color
|
18
26
|
*/
|
19
27
|
const reactWrapper = (0, react_1.createComponent)({
|
20
28
|
tagName: themeprovider_constants_1.TAG_NAME,
|
package/package.json
CHANGED
@@ -14,8 +14,14 @@
|
|
14
14
|
"require": "./dist/index.js"
|
15
15
|
},
|
16
16
|
"./browser": "./dist/browser/index.js",
|
17
|
-
"./
|
18
|
-
"./react": "./dist/react"
|
17
|
+
"./react": "./dist/react/index.js",
|
18
|
+
"./react/*": "./dist/react/*",
|
19
|
+
"./dist/react": "./dist/react/index.js",
|
20
|
+
"./dist/react/*": "./dist/react/*",
|
21
|
+
"./components": "./dist/components/index.js",
|
22
|
+
"./components/*": "./dist/components/*",
|
23
|
+
"./dist/components": "./dist/components/index.js",
|
24
|
+
"./dist/components/*": "./dist/components/*"
|
19
25
|
},
|
20
26
|
"files": [
|
21
27
|
"./dist/",
|
@@ -31,5 +37,5 @@
|
|
31
37
|
"@momentum-design/icons": "*",
|
32
38
|
"@momentum-design/tokens": "*"
|
33
39
|
},
|
34
|
-
"version": "0.0.
|
40
|
+
"version": "0.0.31"
|
35
41
|
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { Component } from '../../models';
|
2
|
-
declare class SubComponentIconProvider extends Component {
|
3
|
-
private readonly iconProviderContext;
|
4
|
-
render(): import("lit-html").TemplateResult<1>;
|
5
|
-
}
|
6
|
-
declare global {
|
7
|
-
interface HTMLElementTagNameMap {
|
8
|
-
['mdc-subcomponent-icon']: SubComponentIconProvider;
|
9
|
-
}
|
10
|
-
}
|
11
|
-
export {};
|
@@ -1,25 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const tslib_1 = require("tslib");
|
4
|
-
const lit_1 = require("lit");
|
5
|
-
const models_1 = require("../../models");
|
6
|
-
const iconprovider_component_1 = tslib_1.__importDefault(require("./iconprovider.component"));
|
7
|
-
const provider_1 = tslib_1.__importDefault(require("../../utils/provider"));
|
8
|
-
// SubComponent to be rendered in storybook, to showcase that the
|
9
|
-
// icon provider can be consumed as a sub component
|
10
|
-
class SubComponentIconProvider extends models_1.Component {
|
11
|
-
constructor() {
|
12
|
-
super(...arguments);
|
13
|
-
this.iconProviderContext = provider_1.default.consume({ host: this, context: iconprovider_component_1.default.Context });
|
14
|
-
}
|
15
|
-
render() {
|
16
|
-
var _a, _b, _c, _d;
|
17
|
-
return (0, lit_1.html) `
|
18
|
-
<p>URL: ${(_a = this.iconProviderContext.value) === null || _a === void 0 ? void 0 : _a.url}</p>
|
19
|
-
<p>File Extension: ${(_b = this.iconProviderContext.value) === null || _b === void 0 ? void 0 : _b.fileExtension}</p>
|
20
|
-
<p>Length Unit: ${(_c = this.iconProviderContext.value) === null || _c === void 0 ? void 0 : _c.lengthUnit}</p>
|
21
|
-
<p>Default Size: ${(_d = this.iconProviderContext.value) === null || _d === void 0 ? void 0 : _d.size}</p>
|
22
|
-
`;
|
23
|
-
}
|
24
|
-
}
|
25
|
-
SubComponentIconProvider.register('mdc-subcomponent-icon');
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import { Component } from '../../models';
|
2
|
-
declare class SubComponentThemeProvider extends Component {
|
3
|
-
currentTheme?: string;
|
4
|
-
private themeProviderContext;
|
5
|
-
render(): import("lit-html").TemplateResult<1>;
|
6
|
-
}
|
7
|
-
declare global {
|
8
|
-
interface HTMLElementTagNameMap {
|
9
|
-
['mdc-subcomponent']: SubComponentThemeProvider;
|
10
|
-
}
|
11
|
-
}
|
12
|
-
export {};
|
@@ -1,20 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const tslib_1 = require("tslib");
|
4
|
-
const lit_1 = require("lit");
|
5
|
-
const models_1 = require("../../models");
|
6
|
-
const themeprovider_component_1 = tslib_1.__importDefault(require("./themeprovider.component"));
|
7
|
-
const provider_1 = tslib_1.__importDefault(require("../../utils/provider"));
|
8
|
-
// Subcomponent to be rendered in storybook, to showcase that the
|
9
|
-
// theme can be consumed as a subcomponent
|
10
|
-
class SubComponentThemeProvider extends models_1.Component {
|
11
|
-
constructor() {
|
12
|
-
super(...arguments);
|
13
|
-
this.themeProviderContext = provider_1.default.consume({ host: this, context: themeprovider_component_1.default.Context });
|
14
|
-
}
|
15
|
-
render() {
|
16
|
-
var _a;
|
17
|
-
return (0, lit_1.html) ` <p>${(_a = this.themeProviderContext.value) === null || _a === void 0 ? void 0 : _a.theme}</p> `;
|
18
|
-
}
|
19
|
-
}
|
20
|
-
SubComponentThemeProvider.register('mdc-subcomponent');
|
@@ -1,5 +0,0 @@
|
|
1
|
-
import type { ValueOf } from '../../utils/types';
|
2
|
-
import { THEME_NAMES } from './themeprovider.constants';
|
3
|
-
import type { ThemeClassPrefix, ThemeClassSeparator } from './themeprovider.utils';
|
4
|
-
export type ThemeName = ValueOf<typeof THEME_NAMES>;
|
5
|
-
export type Theme<T extends ThemeName = ThemeName> = `${ThemeClassPrefix}${ThemeClassSeparator}${T}`;
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import type { Theme, ThemeName } from './themeprovider.types';
|
2
|
-
declare const THEME_CLASS_PREFIX: "mds-theme-stable";
|
3
|
-
export declare const THEME_CLASS_SEPARATOR: "-";
|
4
|
-
declare const utils: {
|
5
|
-
getFullQualifiedTheme: <T extends ThemeName>(themeName: T) => Theme;
|
6
|
-
};
|
7
|
-
export default utils;
|
8
|
-
export type ThemeClassPrefix = typeof THEME_CLASS_PREFIX;
|
9
|
-
export type ThemeClassSeparator = typeof THEME_CLASS_SEPARATOR;
|
@@ -1,10 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.THEME_CLASS_SEPARATOR = void 0;
|
4
|
-
const THEME_CLASS_PREFIX = 'mds-theme-stable';
|
5
|
-
exports.THEME_CLASS_SEPARATOR = '-';
|
6
|
-
const getFullQualifiedTheme = (themeName) => [THEME_CLASS_PREFIX, themeName].join(exports.THEME_CLASS_SEPARATOR);
|
7
|
-
const utils = {
|
8
|
-
getFullQualifiedTheme,
|
9
|
-
};
|
10
|
-
exports.default = utils;
|