tuix-webcomponents 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,105 @@
1
+
2
+ version: 2.1
3
+
4
+ workflows:
5
+ git_deploy:
6
+ jobs:
7
+ - deploy-prod:
8
+ filters:
9
+ branches:
10
+ only: master
11
+ - deploy-dev:
12
+ filters:
13
+ branches:
14
+ only: develop
15
+
16
+ jobs:
17
+
18
+ deploy-dev:
19
+ working_directory: ~/app
20
+ docker:
21
+ - image: mhart/alpine-node:14.15.4
22
+ steps:
23
+ - run:
24
+ name: install git and ssh
25
+ command: apk update && apk add rsync && apk add git && apk add openssh-client
26
+ - add_ssh_keys:
27
+ fingerprints:
28
+ - "a1:a0:00:b4:59:8d:34:81:9c:d8:ac:25:cc:e5:93:00"
29
+ - run:
30
+ name: config git
31
+ command: git config --global user.email "pipeline@circleci.com" && git config --global user.name "CircleCI"
32
+ - run:
33
+ name: add github.com as known host
34
+ command: ssh-keygen -F github.com || ssh-keyscan github.com >> ~/.ssh/known_hosts
35
+ - run:
36
+ name: checkout
37
+ command: git clone "$CIRCLE_REPOSITORY_URL" --branch "$CIRCLE_BRANCH" .
38
+ - run:
39
+ name: npm install
40
+ command: npm install
41
+ - run:
42
+ name: npm run storybook:build
43
+ command: npm run storybook:build
44
+ - run:
45
+ name: push build to github
46
+ command: |
47
+ git clone git@github.com:tuixdevelopment/tuix-storybook-staging.git tuix-storybook-staging
48
+ cp -R tuix-storybook-staging/.git .git-backup
49
+ cp -R tuix-storybook-staging/CNAME CNAME-backup
50
+ rm -rf tuix-storybook-staging
51
+ cp -R storybook-static tuix-storybook-staging
52
+ cp -R .git-backup tuix-storybook-staging/.git
53
+ cp -R CNAME-backup tuix-storybook-staging/CNAME
54
+
55
+ GIT_TAG="$GIT_TAG.$(date +%s)"
56
+
57
+ cd tuix-storybook-staging
58
+ git add .
59
+ git commit -m "$GIT_TAG" --allow-empty
60
+ git push origin master -f
61
+
62
+ deploy-prod:
63
+ working_directory: ~/app
64
+ docker:
65
+ - image: mhart/alpine-node:14.15.4
66
+ steps:
67
+ - run:
68
+ name: install git and ssh
69
+ command: apk update && apk add rsync && apk add git && apk add openssh-client
70
+ - add_ssh_keys:
71
+ fingerprints:
72
+ - "a1:a0:00:b4:59:8d:34:81:9c:d8:ac:25:cc:e5:93:00"
73
+ - run:
74
+ name: config git
75
+ command: git config --global user.email "pipeline@circleci.com" && git config --global user.name "CircleCI"
76
+ - run:
77
+ name: add github.com as known host
78
+ command: ssh-keygen -F github.com || ssh-keyscan github.com >> ~/.ssh/known_hosts
79
+ - run:
80
+ name: checkout
81
+ command: git clone "$CIRCLE_REPOSITORY_URL" --branch "$CIRCLE_BRANCH" .
82
+ - run:
83
+ name: npm install
84
+ command: npm install
85
+ - run:
86
+ name: npm run storybook:build
87
+ command: npm run storybook:build
88
+ - run:
89
+ name: push build to github
90
+ command: |
91
+ git clone git@github.com:tuixdevelopment/tuix-storybook-prod.git tuix-storybook-prod
92
+ cp -R tuix-storybook-prod/.git .git-backup
93
+ cp -R tuix-storybook-prod/CNAME CNAME-backup
94
+ rm -rf tuix-storybook-prod
95
+ cp -R storybook-static tuix-storybook-prod
96
+ cp -R .git-backup tuix-storybook-prod/.git
97
+ cp -R CNAME-backup tuix-storybook-prod/CNAME
98
+
99
+ GIT_TAG="0.0.0.$(date +%s)"
100
+
101
+ cd tuix-storybook-prod
102
+ git add .
103
+ git commit -m "$GIT_TAG" --allow-empty
104
+ git push origin master -f
105
+
package/.editorconfig ADDED
@@ -0,0 +1,29 @@
1
+ # EditorConfig helps developers define and maintain consistent
2
+ # coding styles between different editors and IDEs
3
+ # editorconfig.org
4
+
5
+ root = true
6
+
7
+
8
+ [*]
9
+
10
+ # Change these settings to your own preference
11
+ indent_style = space
12
+ indent_size = 2
13
+
14
+ # We recommend you to keep these unchanged
15
+ end_of_line = lf
16
+ charset = utf-8
17
+ trim_trailing_whitespace = true
18
+ insert_final_newline = true
19
+
20
+ [*.md]
21
+ trim_trailing_whitespace = false
22
+
23
+ [*.json]
24
+ indent_size = 2
25
+
26
+ [*.{html,js,md}]
27
+ block_comment_start = /**
28
+ block_comment = *
29
+ block_comment_end = */
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ ./node_modules/.bin/commitlint --edit $1
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ ./node_modules/.bin/lint-staged --allow-empty --concurrent=true
package/.prettierrc ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "all"
4
+ }
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ stories: ['../dist/stories/**/*.stories.{js,md,mdx}'],
3
+ };
@@ -0,0 +1,8 @@
1
+ import { storybookPlugin } from '@web/dev-server-storybook';
2
+ import baseConfig from '../web-dev-server.config.mjs';
3
+
4
+ export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
5
+ ...baseConfig,
6
+ open: '/',
7
+ plugins: [storybookPlugin({ type: 'web-components' }), ...baseConfig.plugins],
8
+ });
package/bin/build.sh ADDED
@@ -0,0 +1,9 @@
1
+ #!/bin/sh
2
+
3
+ rm -rf dist
4
+
5
+ tsc
6
+
7
+ cp package.json dist
8
+ cp LICENSE dist
9
+ cp README.md dist
@@ -0,0 +1,35 @@
1
+ <!doctype html>
2
+ <html lang="en-GB">
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <link rel="preconnect" href="https://fonts.googleapis.com">
7
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
8
+ <link href="https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600&display=swap" rel="stylesheet">
9
+ <style>
10
+ body {
11
+ background: #fafafa;
12
+ }
13
+ </style>
14
+ </head>
15
+
16
+ <body>
17
+ <div id="demo"></div>
18
+
19
+ <script type="module">
20
+ import { html, render } from 'lit';
21
+ import '../dist/src/tuix-text/TuixText.js';
22
+ import { TextSize, TextColor, TextType } from '../dist/src/enums/tuix-text.enums.js'
23
+
24
+ render(
25
+ html`
26
+ <tuix-text size="${TextSize.XL}" color="${TextColor.Primary}" type="${TextType.Headline}">
27
+ Hello World
28
+ </tuix-text>
29
+ `,
30
+ document.querySelector('#demo')
31
+ );
32
+ </script>
33
+ </body>
34
+
35
+ </html>
package/package.json CHANGED
@@ -3,22 +3,18 @@
3
3
  "description": "Webcomponent tuix-webcomponents following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "tuix-webcomponents",
6
- "version": "0.0.4",
6
+ "version": "0.0.6",
7
7
  "type": "commonjs",
8
8
  "main": "src/index.js",
9
9
  "module": "src/index.js",
10
10
  "exports": {
11
11
  ".": "./src/index.js"
12
12
  },
13
- "files": [
14
- "src/**/*.{js,json}",
15
- "!dist/**"
16
- ],
17
13
  "scripts": {
18
14
  "prepare": "husky install",
19
15
  "analyze": "cem analyze --litelement",
20
16
  "start": "rm -rf dist && tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
21
- "build": "rm -rf dist && tsc && cp package.json dist && npm run analyze -- --exclude dist",
17
+ "build": "./bin/build.sh && npm run analyze -- --exclude dist",
22
18
  "prepublish": "tsc && npm run analyze -- --exclude dist",
23
19
  "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
24
20
  "format": "prettier --write \"src/**/*.ts\" \"stories/**/*.ts\"",
@@ -0,0 +1,27 @@
1
+ /* eslint-disable */
2
+ export enum TextSize {
3
+ XL = 'xl',
4
+ L = 'l',
5
+ M = 'm',
6
+ S = 's',
7
+ XS = 'xs',
8
+ }
9
+
10
+ export enum TextColor {
11
+ Primary = 'primary',
12
+ Secondary = 'secondary',
13
+ Grey = 'grey',
14
+ LightGrey = 'lightGrey',
15
+ Disabled = 'disabled',
16
+ Validation = 'validation',
17
+ Error = 'error',
18
+ Success = 'success',
19
+ }
20
+
21
+ export enum TextType {
22
+ Headline = 'headline',
23
+ Body = 'body',
24
+ Button = 'button_link',
25
+ Link = 'button_link',
26
+ Fields = 'fields',
27
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { TuixText } from './tuix-text/TuixText.js';
@@ -0,0 +1,150 @@
1
+ import { html, css, LitElement } from 'lit';
2
+ import { styleMap } from 'lit/directives/style-map.js';
3
+ import { customElement, property } from 'lit/decorators.js';
4
+ import { TextType, TextColor, TextSize } from '../enums/tuix-text.enums.js';
5
+ import { ColorText } from '../utils/colors.js';
6
+
7
+ @customElement('tuix-text')
8
+ export class TuixText extends LitElement {
9
+ @property({ type: String })
10
+ size?: TextSize;
11
+
12
+ @property({ type: TextColor })
13
+ color?: TextColor;
14
+
15
+ @property({ type: TextType })
16
+ type?: TextType;
17
+
18
+ static styles = css`
19
+ .text {
20
+ font-family: 'Rubik', sans-serif;
21
+ }
22
+
23
+ .text.headline.xl {
24
+ font-size: 4rem;
25
+ font-weight: 600;
26
+ line-height: 4.4rem;
27
+ }
28
+
29
+ .text.headline.l {
30
+ font-size: 3.5rem;
31
+ font-weight: 600;
32
+ line-height: 4.2rem;
33
+ }
34
+
35
+ .text.headline.m {
36
+ font-size: 2.25rem;
37
+ font-weight: 500;
38
+ line-height: 2.7rem;
39
+ }
40
+
41
+ .text.headline.s {
42
+ font-size: 1.5rem;
43
+ font-weight: 500;
44
+ line-height: 1.8rem;
45
+ }
46
+
47
+ .text.headline.xs {
48
+ font-size: 1.125rem;
49
+ font-weight: 500;
50
+ line-height: 1.35;
51
+ }
52
+
53
+ .text.body.m {
54
+ font-size: 1rem;
55
+ font-weight: 300;
56
+ line-height: 1.4rem;
57
+ }
58
+
59
+ .text.body.s {
60
+ font-size: 0.875rem;
61
+ font-weight: 300;
62
+ line-height: 1.225rem;
63
+ }
64
+
65
+ .text.button_link.xl {
66
+ font-size: 1.25rem;
67
+ font-weight: 400;
68
+ line-height: 1.5rem;
69
+ }
70
+
71
+ .text.button_link.l {
72
+ font-size: 1.25rem;
73
+ font-weight: 400;
74
+ line-height: 1.5rem;
75
+ }
76
+
77
+ @media only screen and (max-width: 40rem) {
78
+ .text.button_link.m {
79
+ font-size: 1rem;
80
+ font-weight: 400;
81
+ line-height: 1.25rem;
82
+ }
83
+
84
+ .text.body.m {
85
+ line-height: 1.3rem;
86
+ }
87
+
88
+ .text.body.s {
89
+ line-height: 1.1375rem;
90
+ }
91
+
92
+ .text.headline.xl {
93
+ font-size: 3rem;
94
+ line-height: 3.3rem;
95
+ }
96
+ .text.headline.l {
97
+ font-size: 2rem;
98
+ line-height: 2.4rem;
99
+ }
100
+ .text.headline.m {
101
+ font-size: 1.5rem;
102
+ line-height: 1.8rem;
103
+ }
104
+ .text.headline.s {
105
+ font-size: 1.125rem;
106
+ line-height: 1.35rem;
107
+ }
108
+ .text.headline.xs {
109
+ font-size: 1rem;
110
+ line-height: 1.2rem;
111
+ }
112
+ }
113
+
114
+ @media only screen and (max-width: 20rem) {
115
+ .text.button_link.s {
116
+ font-size: 0.875rem;
117
+ font-weight: 400;
118
+ line-height: 1rem;
119
+ }
120
+ .text.button_link.xs {
121
+ font-size: 0.875rem;
122
+ font-weight: 400;
123
+ line-height: 1rem;
124
+ }
125
+ .text.headline.xl {
126
+ font-size: 1.5rem;
127
+ line-height: 1.8rem;
128
+ }
129
+ .text.headline.l {
130
+ font-size: 1.375rem;
131
+ line-height: 1.65rem;
132
+ }
133
+ .text.headline.m {
134
+ font-size: 1.25rem;
135
+ line-height: 1.5rem;
136
+ }
137
+ }
138
+ `;
139
+
140
+ getTextClass() {
141
+ return `${this.type} ${this.size}`;
142
+ }
143
+
144
+ render() {
145
+ return html`<slot
146
+ class="text ${this.getTextClass()}"
147
+ style="${styleMap({ color: ColorText[this.color || TextColor.Primary] })}"
148
+ ></slot>`;
149
+ }
150
+ }
@@ -0,0 +1,10 @@
1
+ export const ColorText = {
2
+ primary: '#000000',
3
+ secondary: '#FFFFFF',
4
+ grey: '#8A8894',
5
+ lightGrey: '#C9C8D3',
6
+ disabled: '#BEC0DA',
7
+ validation: '#FFB82E',
8
+ error: '#F93232',
9
+ success: '#439F6E',
10
+ };
@@ -0,0 +1,82 @@
1
+ import { html, TemplateResult } from 'lit';
2
+ import '../src/tuix-text/TuixText.js';
3
+ import { TextColor, TextSize, TextType } from '../src/enums/tuix-text.enums.js';
4
+
5
+ export default {
6
+ title: 'TextComponent',
7
+ component: 'tuix-text',
8
+ argTypes: {
9
+ value: {
10
+ type: 'string',
11
+ required: true,
12
+ defaultValue: 'Headline 1',
13
+ },
14
+ size: {
15
+ control: {
16
+ type: 'select',
17
+ options: TextSize,
18
+ },
19
+ },
20
+ type: {
21
+ control: {
22
+ type: 'select',
23
+ options: TextType,
24
+ },
25
+ },
26
+ color: {
27
+ control: {
28
+ type: 'select',
29
+ options: TextColor,
30
+ },
31
+ },
32
+ },
33
+ };
34
+
35
+ interface Story<T> {
36
+ (args: T): TemplateResult;
37
+ args?: Partial<T>;
38
+ argTypes?: Record<string, unknown>;
39
+ }
40
+
41
+ interface ArgTypes {
42
+ size?: TextSize;
43
+ type?: TextType;
44
+ color?: TextColor;
45
+ value?: String;
46
+ }
47
+
48
+ const Template: Story<ArgTypes> = ({
49
+ color = TextColor.Primary,
50
+ size = TextSize.XL,
51
+ type = TextType.Headline,
52
+ value,
53
+ }: ArgTypes) => html`
54
+ <div
55
+ style="display: flex; justify-content: center; align-items: center; height: 100vh;"
56
+ >
57
+ <tuix-text size="${size}" type="${type}" color="${color}">
58
+ ${value}
59
+ </tuix-text>
60
+ </div>
61
+ `;
62
+
63
+ export const headline = Template.bind({});
64
+ headline.args = {
65
+ value: 'Headline 1',
66
+ size: TextSize.XL,
67
+ type: TextType.Headline,
68
+ };
69
+
70
+ export const body = Template.bind({});
71
+ body.args = {
72
+ value: 'Body',
73
+ size: TextSize.M,
74
+ type: TextType.Body,
75
+ };
76
+
77
+ export const button = Template.bind({});
78
+ button.args = {
79
+ value: 'Button/Link',
80
+ size: TextSize.XL,
81
+ type: TextType.Button,
82
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2018",
4
+ "module": "esnext",
5
+ "moduleResolution": "node",
6
+ "noEmitOnError": true,
7
+ "lib": ["es2017", "dom"],
8
+ "strict": true,
9
+ "esModuleInterop": false,
10
+ "allowSyntheticDefaultImports": true,
11
+ "experimentalDecorators": true,
12
+ "importHelpers": true,
13
+ "outDir": "dist",
14
+ "sourceMap": true,
15
+ "inlineSources": true,
16
+ "rootDir": "./",
17
+ "declaration": true,
18
+ "incremental": true
19
+ },
20
+ "include": ["**/*.ts", "bin/build.sh"],
21
+ "exclude": ["stories"]
22
+ }
@@ -0,0 +1,27 @@
1
+ // import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
2
+
3
+ /** Use Hot Module replacement by adding --hmr to the start command */
4
+ const hmr = process.argv.includes('--hmr');
5
+
6
+ export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
7
+ open: '/demo/',
8
+ /** Use regular watch mode if HMR is not enabled. */
9
+ watch: !hmr,
10
+ /** Resolve bare module imports */
11
+ nodeResolve: {
12
+ exportConditions: ['browser', 'development'],
13
+ },
14
+
15
+ /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
16
+ // esbuildTarget: 'auto'
17
+
18
+ /** Set appIndex to enable SPA routing */
19
+ // appIndex: 'demo/index.html',
20
+
21
+ plugins: [
22
+ /** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
23
+ // hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
24
+ ],
25
+
26
+ // See documentation for all available options
27
+ });