@momentum-design/components 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/browser/index.js.map +1 -1
- package/package.json +4 -1
- package/.eslintrc.js +0 -16
- package/CONTRIBUTING.md +0 -5
- package/SCRIPTS.md +0 -15
- package/TESTING.md +0 -38
- package/config/api-extractor.json +0 -33
- package/config/custom-elements-manifest.config.js +0 -28
- package/config/esbuild/configs/browser.js +0 -21
- package/config/esbuild/configs/e2e.js +0 -10
- package/config/esbuild/esbuild-e2e.config.js +0 -22
- package/config/esbuild/esbuild.config.js +0 -9
- package/config/playwright/playwright.config.ts +0 -107
- package/config/playwright/public/index.css +0 -43
- package/config/playwright/public/index.html +0 -26
- package/config/playwright/setup/Components.page.ts +0 -163
- package/config/playwright/setup/constants.ts +0 -27
- package/config/playwright/setup/index.ts +0 -42
- package/config/playwright/setup/steps/accessibility.ts +0 -9
- package/config/playwright/setup/types.ts +0 -5
- package/config/playwright/setup/utils/accessibility.ts +0 -70
- package/config/playwright/setup/utils/visual-regression.ts +0 -35
- package/config/plop/actions/AddComponent.ts +0 -21
- package/config/plop/actions/AddToComponentExports.ts +0 -16
- package/config/plop/actions/AddToComponentImports.ts +0 -16
- package/config/plop/constants/index.ts +0 -31
- package/config/plop/esbuild.config.plop.js +0 -4
- package/config/plop/generators/component/index.ts +0 -25
- package/config/plop/plopfile.ts +0 -6
- package/config/plop/prompts/index.ts +0 -8
- package/config/plop/templates/add/component/index.ts.hbs +0 -12
- package/config/plop/templates/add/component/{{componentName}}.component.ts.hbs +0 -22
- package/config/plop/templates/add/component/{{componentName}}.constants.ts.hbs +0 -5
- package/config/plop/templates/add/component/{{componentName}}.e2e-test.ts.hbs +0 -67
- package/config/plop/templates/add/component/{{componentName}}.fixtures.ts.hbs +0 -13
- package/config/plop/templates/add/component/{{componentName}}.stories.ts.hbs +0 -18
- package/config/plop/templates/add/component/{{componentName}}.styles.ts.hbs +0 -8
- package/config/plop/tsconfig.plop.json +0 -11
- package/config/storybook/MomentumStorybookTheme.js +0 -41
- package/config/storybook/main.js +0 -21
- package/config/storybook/manager.js +0 -17
- package/config/storybook/preview.js +0 -63
- package/config/storybook/provider/iconProvider.js +0 -8
- package/config/storybook/provider/themeProvider.js +0 -31
- package/config/storybook/public/background-graphic.png +0 -0
- package/config/storybook/public/fonts/Inter.var.woff2 +0 -0
- package/config/storybook/public/momentum-logo.png +0 -0
- package/config/storybook/themes/index.js +0 -14
- package/config/storybook/themes/themes.css +0 -15
- package/data/custom-elements.json +0 -677
- package/jest.config.js +0 -3
- package/scripts/copyFonts.js +0 -31
- package/scripts/copyIcons.js +0 -31
- package/scripts/copyTokens.js +0 -24
- package/src/components/avatar/__screenshots__/mdc-avatar.png +0 -0
- package/src/components/avatar/avatar.component.ts +0 -74
- package/src/components/avatar/avatar.constants.ts +0 -12
- package/src/components/avatar/avatar.e2e-test.ts +0 -70
- package/src/components/avatar/avatar.stories.ts +0 -25
- package/src/components/avatar/avatar.styles.ts +0 -20
- package/src/components/avatar/avatar.types.ts +0 -1
- package/src/components/avatar/index.ts +0 -12
- package/src/components/badge/__screenshots__/mdc-badge.png +0 -0
- package/src/components/badge/badge.component.ts +0 -121
- package/src/components/badge/badge.constants.ts +0 -13
- package/src/components/badge/badge.e2e-test.ts +0 -68
- package/src/components/badge/badge.stories.ts +0 -33
- package/src/components/badge/badge.styles.ts +0 -26
- package/src/components/badge/badge.types.ts +0 -1
- package/src/components/badge/index.ts +0 -12
- package/src/components/icon/__screenshots__/mdc-icon-default.png +0 -0
- package/src/components/icon/__screenshots__/mdc-icon-scale.png +0 -0
- package/src/components/icon/icon.component.ts +0 -155
- package/src/components/icon/icon.constants.ts +0 -10
- package/src/components/icon/icon.e2e-test.ts +0 -101
- package/src/components/icon/icon.stories.ts +0 -34
- package/src/components/icon/icon.styles.ts +0 -15
- package/src/components/icon/icon.utils.ts +0 -13
- package/src/components/icon/index.ts +0 -12
- package/src/components/iconprovider/__screenshots__/mdc-iconprovider.png +0 -0
- package/src/components/iconprovider/iconprovider.component.ts +0 -76
- package/src/components/iconprovider/iconprovider.constants.ts +0 -12
- package/src/components/iconprovider/iconprovider.context.ts +0 -16
- package/src/components/iconprovider/iconprovider.e2e-test.ts +0 -65
- package/src/components/iconprovider/iconprovider.stories.ts +0 -27
- package/src/components/iconprovider/iconprovider.stories.utils.ts +0 -27
- package/src/components/iconprovider/index.ts +0 -12
- package/src/components/text/__screenshots__/mdc-text-body-large.png +0 -0
- package/src/components/text/__screenshots__/mdc-text-body-regular.png +0 -0
- package/src/components/text/__screenshots__/mdc-text-body-small.png +0 -0
- package/src/components/text/__screenshots__/mdc-text-heading-1.png +0 -0
- package/src/components/text/__screenshots__/mdc-text-heading-2.png +0 -0
- package/src/components/text/__screenshots__/mdc-text-heading-3.png +0 -0
- package/src/components/text/__screenshots__/mdc-text-heading-4.png +0 -0
- package/src/components/text/__screenshots__/mdc-text-heading-5.png +0 -0
- package/src/components/text/__screenshots__/mdc-text-heading-6.png +0 -0
- package/src/components/text/__screenshots__/mdc-text-heading-7.png +0 -0
- package/src/components/text/__screenshots__/mdc-text-image-title.png +0 -0
- package/src/components/text/__screenshots__/mdc-text-label.png +0 -0
- package/src/components/text/fonts.styles.ts +0 -99
- package/src/components/text/index.ts +0 -12
- package/src/components/text/text.component.ts +0 -51
- package/src/components/text/text.constants.ts +0 -27
- package/src/components/text/text.e2e-test.ts +0 -76
- package/src/components/text/text.stories.ts +0 -29
- package/src/components/text/text.styles.ts +0 -17
- package/src/components/text/text.types.ts +0 -13
- package/src/components/text/text.utils.ts +0 -51
- package/src/components/themeprovider/__screenshots__/mdc-themeprovider-darkWebex.png +0 -0
- package/src/components/themeprovider/__screenshots__/mdc-themeprovider-lightWebex.png +0 -0
- package/src/components/themeprovider/index.ts +0 -12
- package/src/components/themeprovider/themeprovider.component.ts +0 -91
- package/src/components/themeprovider/themeprovider.constants.ts +0 -32
- package/src/components/themeprovider/themeprovider.context.ts +0 -18
- package/src/components/themeprovider/themeprovider.e2e-test.ts +0 -89
- package/src/components/themeprovider/themeprovider.stories.styles.css +0 -22
- package/src/components/themeprovider/themeprovider.stories.ts +0 -38
- package/src/components/themeprovider/themeprovider.stories.utils.ts +0 -23
- package/src/components/themeprovider/themeprovider.styles.ts +0 -13
- package/src/components/themeprovider/themeprovider.types.ts +0 -7
- package/src/components/themeprovider/themeprovider.utils.ts +0 -16
- package/src/index.ts +0 -22
- package/src/models/component/component.component.ts +0 -46
- package/src/models/component/component.types.ts +0 -16
- package/src/models/component/index.ts +0 -7
- package/src/models/index.ts +0 -11
- package/src/models/provider/index.ts +0 -3
- package/src/models/provider/provider.component.ts +0 -87
- package/src/models/provider/provider.styles.ts +0 -14
- package/src/stories/colors.mdx +0 -32
- package/src/stories/icons.mdx +0 -13
- package/src/stories/typography.mdx +0 -20
- package/src/utils/mixins/DisabledMixin.ts +0 -19
- package/src/utils/mixins/TabIndexMixin.ts +0 -19
- package/src/utils/provider/index.ts +0 -21
- package/src/utils/styles/index.ts +0 -13
- package/src/utils/tag-name/constants.ts +0 -10
- package/src/utils/tag-name/index.ts +0 -15
- package/src/utils/types.ts +0 -1
- package/tsconfig.json +0 -45
- package/tsconfig.module.json +0 -47
@@ -1,38 +0,0 @@
|
|
1
|
-
import type { Meta, StoryObj, Args } from '@storybook/web-components';
|
2
|
-
import { html } from 'lit';
|
3
|
-
import '.';
|
4
|
-
import './themeprovider.stories.styles.css';
|
5
|
-
import { THEMES } from './themeprovider.constants';
|
6
|
-
import './themeprovider.stories.utils';
|
7
|
-
|
8
|
-
const render = (args: Args) => html`
|
9
|
-
<mdc-themeprovider class="themeWrapper" theme="${args.theme}">
|
10
|
-
<p>Current theme:</p>
|
11
|
-
<mdc-subcomponent></mdc-subcomponent>
|
12
|
-
<div>
|
13
|
-
<div class="colorBox" style="background: var(--mds-color-theme-text-accent-normal);"></div>
|
14
|
-
<div class="colorBox" style="background: var(--mds-color-theme-text-warning-normal);"></div>
|
15
|
-
<div class="colorBox" style="background: var(--mds-color-theme-background-alert-success-normal);"></div>
|
16
|
-
</div>
|
17
|
-
</mdc-themeprovider>
|
18
|
-
`;
|
19
|
-
|
20
|
-
const meta: Meta = {
|
21
|
-
tags: ['autodocs'],
|
22
|
-
component: 'mdc-themeprovider',
|
23
|
-
render,
|
24
|
-
argTypes: {
|
25
|
-
theme: {
|
26
|
-
options: THEMES,
|
27
|
-
control: { type: 'radio' },
|
28
|
-
},
|
29
|
-
},
|
30
|
-
};
|
31
|
-
|
32
|
-
export default meta;
|
33
|
-
|
34
|
-
export const Primary: StoryObj = {
|
35
|
-
args: {
|
36
|
-
theme: THEMES[0],
|
37
|
-
},
|
38
|
-
};
|
@@ -1,23 +0,0 @@
|
|
1
|
-
import { html } from 'lit';
|
2
|
-
import { Component } from '../../models';
|
3
|
-
import ThemeProvider from './themeprovider.component';
|
4
|
-
import providerUtils from '../../utils/provider';
|
5
|
-
|
6
|
-
// Subcomponent to be rendered in storybook, to showcase that the
|
7
|
-
// theme can be consumed as a subcomponent
|
8
|
-
class SubComponentThemeProvider extends Component {
|
9
|
-
currentTheme?: string;
|
10
|
-
|
11
|
-
private themeProviderContext = providerUtils.consume({ host: this, context: ThemeProvider.Context });
|
12
|
-
|
13
|
-
override render() {
|
14
|
-
return html` <p>${this.themeProviderContext.value?.theme}</p> `;
|
15
|
-
}
|
16
|
-
}
|
17
|
-
|
18
|
-
SubComponentThemeProvider.register('mdc-subcomponent');
|
19
|
-
declare global {
|
20
|
-
interface HTMLElementTagNameMap {
|
21
|
-
['mdc-subcomponent']: SubComponentThemeProvider;
|
22
|
-
}
|
23
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { css } from "lit";
|
2
|
-
|
3
|
-
const styles = css`
|
4
|
-
:host {
|
5
|
-
--mdc-themeprovider-font-family: "Momentum";
|
6
|
-
--mdc-themeprovider-color-default: var(--mds-color-theme-text-primary-normal);
|
7
|
-
|
8
|
-
font-family: var(--mdc-themeprovider-font-family);
|
9
|
-
color: var(--mdc-themeprovider-color-default);
|
10
|
-
}
|
11
|
-
`;
|
12
|
-
|
13
|
-
export default styles;
|
@@ -1,7 +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
|
-
|
5
|
-
export type ThemeName = ValueOf<typeof THEME_NAMES>;
|
6
|
-
|
7
|
-
export type Theme<T extends ThemeName = ThemeName> = `${ThemeClassPrefix}${ThemeClassSeparator}${T}`;
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import type { Theme, ThemeName } from './themeprovider.types';
|
2
|
-
|
3
|
-
const THEME_CLASS_PREFIX = 'mds-theme-stable' as const;
|
4
|
-
|
5
|
-
export const THEME_CLASS_SEPARATOR = '-' as const;
|
6
|
-
|
7
|
-
const getFullQualifiedTheme = <T extends ThemeName>(themeName: T): Theme =>
|
8
|
-
[THEME_CLASS_PREFIX, themeName].join(THEME_CLASS_SEPARATOR) as Theme<T>;
|
9
|
-
|
10
|
-
const utils = {
|
11
|
-
getFullQualifiedTheme,
|
12
|
-
};
|
13
|
-
|
14
|
-
export default utils;
|
15
|
-
export type ThemeClassPrefix = typeof THEME_CLASS_PREFIX;
|
16
|
-
export type ThemeClassSeparator = typeof THEME_CLASS_SEPARATOR;
|
package/src/index.ts
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
Component,
|
3
|
-
Provider,
|
4
|
-
} from './models';
|
5
|
-
|
6
|
-
import ThemeProvider from './components/themeprovider';
|
7
|
-
import Icon from './components/icon';
|
8
|
-
import IconProvider from './components/iconprovider';
|
9
|
-
import Avatar from './components/avatar';
|
10
|
-
import Badge from './components/badge';
|
11
|
-
import Text from './components/text';
|
12
|
-
|
13
|
-
export {
|
14
|
-
Component,
|
15
|
-
Provider,
|
16
|
-
ThemeProvider,
|
17
|
-
Icon,
|
18
|
-
IconProvider,
|
19
|
-
Avatar,
|
20
|
-
Badge,
|
21
|
-
Text,
|
22
|
-
};
|
@@ -1,46 +0,0 @@
|
|
1
|
-
import { LitElement } from 'lit';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Core Component class to ultimately be inherited by all Web Components within
|
5
|
-
* this package.
|
6
|
-
*
|
7
|
-
* @public
|
8
|
-
*/
|
9
|
-
class Component extends LitElement {
|
10
|
-
/**
|
11
|
-
* Register `this` extended `Component` Class as a custom element within the
|
12
|
-
* DOM's custom elements registry.
|
13
|
-
*
|
14
|
-
* @remarks
|
15
|
-
* This method must be called in order for this component to be consumable
|
16
|
-
* within the DOM.
|
17
|
-
*
|
18
|
-
* @example
|
19
|
-
* ```ts
|
20
|
-
* import CustomComponent from './custom-component';
|
21
|
-
*
|
22
|
-
* // Standard registration.
|
23
|
-
* CustomComponent.register();
|
24
|
-
*
|
25
|
-
* // Custom registration.
|
26
|
-
* CustomComponent.register({
|
27
|
-
* name: 'custom-component',
|
28
|
-
* prefix: 'prefix',
|
29
|
-
* });
|
30
|
-
*
|
31
|
-
* export default CustomComponent;
|
32
|
-
* ```
|
33
|
-
*
|
34
|
-
*
|
35
|
-
* @returns - Void.
|
36
|
-
*/
|
37
|
-
public static register(namespace: string): void {
|
38
|
-
if (customElements.get(namespace)) {
|
39
|
-
return;
|
40
|
-
}
|
41
|
-
|
42
|
-
customElements.define(namespace, this as any);
|
43
|
-
}
|
44
|
-
}
|
45
|
-
|
46
|
-
export default Component;
|
@@ -1,16 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* `Component` Class' static `registration()` method options.
|
3
|
-
*
|
4
|
-
* @public
|
5
|
-
*/
|
6
|
-
export interface RegisterOptions {
|
7
|
-
/**
|
8
|
-
* Name to use when registering this `Component` Class' to within DOM.
|
9
|
-
*/
|
10
|
-
name: string;
|
11
|
-
|
12
|
-
/**
|
13
|
-
* Name to use when registering this `Component` Class' to within DOM.
|
14
|
-
*/
|
15
|
-
prefix?: string;
|
16
|
-
}
|
package/src/models/index.ts
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
import { ContextProvider } from '@lit-labs/context';
|
2
|
-
import { CSSResult, html } from 'lit';
|
3
|
-
|
4
|
-
import Component from '../component';
|
5
|
-
|
6
|
-
import styles from './provider.styles';
|
7
|
-
|
8
|
-
type ConstructorOptions<C> = {
|
9
|
-
context: { __context__: C };
|
10
|
-
initialValue?: C;
|
11
|
-
};
|
12
|
-
|
13
|
-
/**
|
14
|
-
* Provider Component class to ultimately be inherited by all Provider-type Web
|
15
|
-
* Components within this package.
|
16
|
-
*
|
17
|
-
* @public
|
18
|
-
*/
|
19
|
-
abstract class Provider<C> extends Component {
|
20
|
-
/**
|
21
|
-
* Constructor of the Provider.
|
22
|
-
*
|
23
|
-
* Execute in the constructor of the provider implementation,
|
24
|
-
* like so
|
25
|
-
*
|
26
|
-
* ```
|
27
|
-
* constructor() {
|
28
|
-
* super(TAG_NAME, {initialValue: new ContextClass(defaultValues)});
|
29
|
-
* }
|
30
|
-
* ```
|
31
|
-
* @param host - host of where the context will be hooked onto, e.g. this
|
32
|
-
* @param context - context (returned by createContext)
|
33
|
-
* @param initialValue - initialValue of the ContextClass, like `new ContextClass(defaultValues)`
|
34
|
-
*/
|
35
|
-
constructor({ context, initialValue }: ConstructorOptions<C>) {
|
36
|
-
super();
|
37
|
-
|
38
|
-
this.context = new ContextProvider(this, {
|
39
|
-
context,
|
40
|
-
initialValue,
|
41
|
-
});
|
42
|
-
}
|
43
|
-
|
44
|
-
/**
|
45
|
-
* Context associated with this provider.
|
46
|
-
*
|
47
|
-
* @remarks
|
48
|
-
* Providing a Context type as a generic when creating extended Provider Class
|
49
|
-
* definitions will help enforce the property validation.
|
50
|
-
*/
|
51
|
-
protected context: ContextProvider<{ __context__: C }>;
|
52
|
-
|
53
|
-
/**
|
54
|
-
* Styles associated with this Provider Component.
|
55
|
-
*/
|
56
|
-
public static override styles: CSSResult | Array<CSSResult> = styles;
|
57
|
-
|
58
|
-
/**
|
59
|
-
* Update the context of this Provider and trigger its consumers to update.
|
60
|
-
*
|
61
|
-
* @remarks
|
62
|
-
* This method is called every time this Provider is re-rendered and should
|
63
|
-
* be used to update the local Context based on any deltas between this
|
64
|
-
* Provider's attributes and this Provider's context that caused the
|
65
|
-
* re-render. If the `render()` method is overwritten, this call must be made
|
66
|
-
* manually.
|
67
|
-
*/
|
68
|
-
protected abstract updateContext(): void;
|
69
|
-
|
70
|
-
/**
|
71
|
-
* Render this Provider.
|
72
|
-
*
|
73
|
-
* @remarks
|
74
|
-
* This method calls `updateContext()` then validates whether or not to
|
75
|
-
* update all consumers based on the results of the `shouldUpdateConsumers`
|
76
|
-
* getter.
|
77
|
-
*
|
78
|
-
* @returns - This Provider as an HTML Element.
|
79
|
-
*/
|
80
|
-
public override render() {
|
81
|
-
this.updateContext();
|
82
|
-
|
83
|
-
return html`<slot></slot>`;
|
84
|
-
}
|
85
|
-
}
|
86
|
-
|
87
|
-
export default Provider;
|
package/src/stories/colors.mdx
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
import { Meta, ColorPalette, ColorItem } from "@storybook/blocks";
|
2
|
-
|
3
|
-
<Meta title="System/Colors" />
|
4
|
-
|
5
|
-
{/* TODO: automate this such that the color palette is automatically generated from our tokens */}
|
6
|
-
|
7
|
-
<ColorPalette>
|
8
|
-
<ColorItem
|
9
|
-
title="common-text"
|
10
|
-
colors={{
|
11
|
-
white: "#fffffff2",
|
12
|
-
gray: "#ffffffb3",
|
13
|
-
black: "#000000f2",
|
14
|
-
disabled: "#ffffff66",
|
15
|
-
}}
|
16
|
-
/>
|
17
|
-
<ColorItem
|
18
|
-
title="common-text-success"
|
19
|
-
colors={{
|
20
|
-
normal: "#3cc29a",
|
21
|
-
hover: "#9fedd8",
|
22
|
-
}}
|
23
|
-
/>
|
24
|
-
<ColorItem
|
25
|
-
title="button-accent"
|
26
|
-
colors={{
|
27
|
-
normal: "#1170cf",
|
28
|
-
hover: "#0353a8",
|
29
|
-
pressed: "#063a75"
|
30
|
-
}}
|
31
|
-
/>
|
32
|
-
</ColorPalette>
|
package/src/stories/icons.mdx
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
import { Meta, IconGallery, IconItem } from "@storybook/blocks";
|
2
|
-
|
3
|
-
<Meta title="System/Icons" />
|
4
|
-
|
5
|
-
{/* TODO: automate this such that the icon gallery is automatically generated from our icons */}
|
6
|
-
|
7
|
-
<IconGallery>
|
8
|
-
<IconItem name="3d-object-bold">
|
9
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
10
|
-
<path d="M27.776 6.823 16.78 2.155a2.02 2.02 0 0 0-1.546 0L4.231 6.822A1.995 1.995 0 0 0 3 8.667v14.667a1.993 1.993 0 0 0 1.225 1.843l11.016 4.669a2.033 2.033 0 0 0 1.545-.002l10.984-4.666A1.994 1.994 0 0 0 29 23.333V8.666a1.992 1.992 0 0 0-1.224-1.843ZM16.003 3.998l9.402 3.99-9.425 3.929-9.397-3.922 9.42-3.997ZM5.006 9.504 15 13.675v13.896L5 23.334l.006-13.83Zm21.987 13.832L17 27.584V13.658l10-4.167v13.842l-.007.003Z" />
|
11
|
-
</svg>
|
12
|
-
</IconItem>
|
13
|
-
</IconGallery>
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import { Meta, Typeset } from "@storybook/blocks";
|
2
|
-
|
3
|
-
<Meta title="System/Typography" />
|
4
|
-
|
5
|
-
{/* TODO: automate this such that typeset is automatically generated from our font package */}
|
6
|
-
|
7
|
-
{/* to be able to pass in textTransform to the typeset block, we would
|
8
|
-
need to do something similar like:
|
9
|
-
https://github.com/storybookjs/storybook/pull/15302
|
10
|
-
it looks like the existing lineHeight doesn't work in mdx though - has to be investigated */}
|
11
|
-
|
12
|
-
### Heading 1
|
13
|
-
<Typeset
|
14
|
-
fontSizes={["7.5rem"]}
|
15
|
-
fontWeight="700"
|
16
|
-
sampleText="Lorem ipsum dolor sit amet, consectectur adipiscing elit."
|
17
|
-
fontFamily='"Momentum"'
|
18
|
-
fontStyle="normal"
|
19
|
-
lineHeight="48px"
|
20
|
-
/>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { LitElement } from 'lit';
|
2
|
-
import { property } from 'lit/decorators.js';
|
3
|
-
|
4
|
-
type Constructor<T = {}> = new (...args: any[]) => T;
|
5
|
-
|
6
|
-
export interface DisabledMixinInterface {
|
7
|
-
disabled: boolean;
|
8
|
-
}
|
9
|
-
|
10
|
-
export const DisabledMixin = <T extends Constructor<LitElement>>(
|
11
|
-
superClass: T,
|
12
|
-
) => {
|
13
|
-
class InnerMixinClass extends superClass {
|
14
|
-
@property({ reflect: true, type: Boolean })
|
15
|
-
public disabled = false;
|
16
|
-
}
|
17
|
-
// Cast return type to your mixin's interface intersected with the superClass type
|
18
|
-
return InnerMixinClass as Constructor<DisabledMixinInterface> & T;
|
19
|
-
};
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { LitElement } from 'lit';
|
2
|
-
import { property } from 'lit/decorators.js';
|
3
|
-
|
4
|
-
type Constructor<T = {}> = new (...args: any[]) => T;
|
5
|
-
|
6
|
-
export interface TabIndexMixinInterface {
|
7
|
-
tabIndex: number;
|
8
|
-
}
|
9
|
-
|
10
|
-
export const TabIndexMixin = <T extends Constructor<LitElement>>(
|
11
|
-
superClass: T,
|
12
|
-
) => {
|
13
|
-
class InnerMixinClass extends superClass {
|
14
|
-
@property({ reflect: true, type: Number, attribute: 'tabindex' })
|
15
|
-
public override tabIndex = 0;
|
16
|
-
}
|
17
|
-
// Cast return type to your mixin's interface intersected with the superClass type
|
18
|
-
return InnerMixinClass as Constructor<TabIndexMixinInterface> & T;
|
19
|
-
};
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { Context, ContextConsumer } from '@lit-labs/context';
|
2
|
-
import { ReactiveElement } from 'lit';
|
3
|
-
|
4
|
-
type ConsumeOptions<C> = {
|
5
|
-
host: ReactiveElement;
|
6
|
-
context: C;
|
7
|
-
subscribe?:boolean
|
8
|
-
}
|
9
|
-
const consume = <C extends Context<unknown, unknown>>(options: ConsumeOptions<C>) => {
|
10
|
-
const { host, context, subscribe } = options;
|
11
|
-
|
12
|
-
return new ContextConsumer<C, typeof host>(host, {
|
13
|
-
context,
|
14
|
-
subscribe: subscribe ?? true,
|
15
|
-
});
|
16
|
-
};
|
17
|
-
|
18
|
-
const providerUtils = {
|
19
|
-
consume,
|
20
|
-
};
|
21
|
-
export default providerUtils;
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/* eslint-disable implicit-arrow-linebreak */
|
2
|
-
/* eslint-disable max-len */
|
3
|
-
import CONSTANTS from './constants';
|
4
|
-
|
5
|
-
// make ReturnType a String Literal to make it usable in the HTMLElementTagNameMap per component
|
6
|
-
// using Template Literal Types: https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html
|
7
|
-
type ReturnType<ComponentName extends string> =
|
8
|
-
`${typeof CONSTANTS.NAMESPACE.PREFIX}${typeof CONSTANTS.NAMESPACE.SEPARATOR}${ComponentName}`;
|
9
|
-
|
10
|
-
const constructTagName = <ComponentName extends string>(componentName: ComponentName): ReturnType<ComponentName> =>
|
11
|
-
[CONSTANTS.NAMESPACE.PREFIX, componentName].join(CONSTANTS.NAMESPACE.SEPARATOR) as ReturnType<ComponentName>;
|
12
|
-
|
13
|
-
export default {
|
14
|
-
constructTagName,
|
15
|
-
};
|
package/src/utils/types.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export type ValueOf<T> = T[keyof T];
|
package/tsconfig.json
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"extends": "../../../config/typescript/tsconfig.base.json",
|
3
|
-
"compilerOptions": {
|
4
|
-
"target": "es2019",
|
5
|
-
"module": "es2020",
|
6
|
-
"lib": [
|
7
|
-
"es2020",
|
8
|
-
"DOM",
|
9
|
-
"DOM.Iterable"
|
10
|
-
],
|
11
|
-
"declaration": true,
|
12
|
-
"declarationMap": true,
|
13
|
-
"sourceMap": true,
|
14
|
-
"inlineSources": true,
|
15
|
-
"outDir": "./dist",
|
16
|
-
"rootDir": "./",
|
17
|
-
"strict": true,
|
18
|
-
"noUnusedLocals": true,
|
19
|
-
"noUnusedParameters": true,
|
20
|
-
"noImplicitReturns": true,
|
21
|
-
"noFallthroughCasesInSwitch": true,
|
22
|
-
"noImplicitAny": true,
|
23
|
-
"noImplicitThis": true,
|
24
|
-
"moduleResolution": "node",
|
25
|
-
"allowSyntheticDefaultImports": true,
|
26
|
-
"experimentalDecorators": true,
|
27
|
-
"forceConsistentCasingInFileNames": true,
|
28
|
-
"noImplicitOverride": true,
|
29
|
-
"useDefineForClassFields": false,
|
30
|
-
"plugins": [
|
31
|
-
{
|
32
|
-
"name": "ts-lit-plugin",
|
33
|
-
"strict": true
|
34
|
-
}
|
35
|
-
]
|
36
|
-
},
|
37
|
-
"include": [
|
38
|
-
"src/**/*.ts",
|
39
|
-
"config",
|
40
|
-
".eslintrc.js"
|
41
|
-
],
|
42
|
-
"exclude": [
|
43
|
-
"node_modules"
|
44
|
-
],
|
45
|
-
}
|
package/tsconfig.module.json
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"extends": "../../../config/typescript/tsconfig.base.json",
|
3
|
-
"compilerOptions": {
|
4
|
-
"target": "es2019",
|
5
|
-
"module": "CommonJS",
|
6
|
-
"lib": [
|
7
|
-
"es2020",
|
8
|
-
"DOM",
|
9
|
-
"DOM.Iterable"
|
10
|
-
],
|
11
|
-
"declaration": true,
|
12
|
-
"declarationMap": false,
|
13
|
-
"declarationDir": "./dist",
|
14
|
-
"sourceMap": false,
|
15
|
-
"inlineSources": false,
|
16
|
-
"outDir": "./dist",
|
17
|
-
"strict": true,
|
18
|
-
"noUnusedLocals": true,
|
19
|
-
"noUnusedParameters": true,
|
20
|
-
"noImplicitReturns": true,
|
21
|
-
"noFallthroughCasesInSwitch": true,
|
22
|
-
"noImplicitAny": true,
|
23
|
-
"noImplicitThis": true,
|
24
|
-
"moduleResolution": "node",
|
25
|
-
"allowSyntheticDefaultImports": true,
|
26
|
-
"experimentalDecorators": true,
|
27
|
-
"forceConsistentCasingInFileNames": true,
|
28
|
-
"noImplicitOverride": true,
|
29
|
-
"useDefineForClassFields": false,
|
30
|
-
"removeComments": false,
|
31
|
-
"plugins": [
|
32
|
-
{
|
33
|
-
"name": "ts-lit-plugin",
|
34
|
-
"strict": true
|
35
|
-
}
|
36
|
-
],
|
37
|
-
},
|
38
|
-
"files": [
|
39
|
-
"src/index.ts"
|
40
|
-
],
|
41
|
-
"exclude": [
|
42
|
-
"**/*.e2e-test.ts",
|
43
|
-
"**/*.fixtures.ts",
|
44
|
-
"**/*.stories.ts",
|
45
|
-
"node_modules"
|
46
|
-
],
|
47
|
-
}
|