tuix-webcomponents 0.91.1 → 0.93.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +151 -32
- package/custom-elements.json +5380 -0
- package/dist/assets/tuix-styles.css +6 -0
- package/dist/src/index.d.ts +2 -3
- package/dist/src/index.js +0 -10
- package/dist/src/react/index.d.ts +42 -0
- package/dist/src/react/index.js +114 -0
- package/dist/src/tuix-button/TuixBaseButton.d.ts +2 -2
- package/dist/src/tuix-button/TuixBaseButton.js +2 -2
- package/dist/src/tuix-button/TuixButton.d.ts +2 -2
- package/dist/src/tuix-button/TuixButton.js +4 -4
- package/dist/src/tuix-button/TuixButton.styles.js +6 -6
- package/dist/src/tuix-button/enums/tuix-button.enums.d.ts +1 -1
- package/dist/src/tuix-button/enums/tuix-button.enums.js +2 -2
- package/dist/src/tuix-checkbox/TuixCheckbox.d.ts +3 -1
- package/dist/src/tuix-checkbox/TuixCheckbox.js +6 -4
- package/dist/src/tuix-checkbox/TuixCheckbox.styles.js +3 -3
- package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.d.ts +2 -2
- package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.js +2 -2
- package/dist/src/tuix-checkbox/interfaces/tuix-checkbox.interface.d.ts +1 -1
- package/dist/src/tuix-dropdown/TuixDropdown.d.ts +4 -3
- package/dist/src/tuix-dropdown/TuixDropdown.js +5 -4
- package/dist/src/tuix-dropdown/TuixDropdown.styles.js +4 -4
- package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.d.ts +2 -2
- package/dist/src/tuix-icon/TuixIcon.d.ts +2 -2
- package/dist/src/tuix-icon/TuixIcon.icons.d.ts +1 -1
- package/dist/src/tuix-icon/TuixIcon.icons.js +13 -2
- package/dist/src/tuix-icon/TuixIcon.js +4 -4
- package/dist/src/tuix-icon/enums/tuix-icon.enums.d.ts +3 -0
- package/dist/src/tuix-icon/enums/tuix-icon.enums.js +3 -0
- package/dist/src/tuix-icon-button/TuixIconButton.d.ts +2 -2
- package/dist/src/tuix-icon-button/TuixIconButton.js +4 -4
- package/dist/src/tuix-input/TuixInput.d.ts +1 -1
- package/dist/src/tuix-input/TuixInput.js +5 -4
- package/dist/src/tuix-input/TuixInput.styles.js +5 -4
- package/dist/src/tuix-input/enums/tuix-input.enums.d.ts +3 -3
- package/dist/src/tuix-input/enums/tuix-input.enums.js +3 -3
- package/dist/src/tuix-input/interfaces/tuix-input.interface.d.ts +5 -5
- package/dist/src/tuix-link/TuixLink.d.ts +2 -2
- package/dist/src/tuix-link/TuixLink.js +4 -4
- package/dist/src/tuix-link/TuixLink.styles.js +3 -3
- package/dist/src/tuix-modal/TuixModal.d.ts +2 -0
- package/dist/src/tuix-modal/TuixModal.js +2 -0
- package/dist/src/tuix-modal/TuixModal.styles.js +2 -2
- package/dist/src/tuix-paper/TuixPaper.d.ts +1 -1
- package/dist/src/tuix-paper/TuixPaper.js +2 -2
- package/dist/src/tuix-paper/TuixPaper.styles.js +2 -2
- package/dist/src/tuix-radio-button/TuixRadioButton.d.ts +3 -2
- package/dist/src/tuix-radio-button/TuixRadioButton.js +4 -3
- package/dist/src/tuix-radio-button/TuixRadioButton.styles.js +3 -3
- package/dist/src/tuix-radio-button/interfaces/tuix-radio-button.interface.d.ts +1 -1
- package/dist/src/tuix-table/TuixTable.d.ts +2 -0
- package/dist/src/tuix-table/TuixTable.js +6 -4
- package/dist/src/tuix-table/TuixTable.styles.js +1 -1
- package/dist/src/tuix-text/TuixText.styles.js +3 -3
- package/dist/src/tuix-text/enums/tuix-text.enums.js +2 -2
- package/dist/src/tuix-toast/TuixToast.d.ts +3 -0
- package/dist/src/tuix-toast/TuixToast.js +3 -0
- package/dist/src/tuix-toast/TuixToast.styles.js +1 -1
- package/dist/src/tuix-toast/enums/tuix-toast.enums.d.ts +3 -3
- package/dist/src/tuix-toast/enums/tuix-toast.enums.js +7 -7
- package/dist/src/tuix-toggle-button/TuixToggleButton.d.ts +2 -1
- package/dist/src/tuix-toggle-button/TuixToggleButton.js +4 -3
- package/dist/src/tuix-toggle-button/TuixToggleButton.styles.js +4 -4
- package/dist/src/tuix-toggle-button/interfaces/tuix-toggle.interface.d.ts +1 -1
- package/dist/src/utils/darkColors.d.ts +5 -1
- package/dist/src/utils/darkColors.js +4 -0
- package/package.json +45 -20
- package/dist/tsconfig.publish.tsbuildinfo +0 -1
package/README.md
CHANGED
|
@@ -12,41 +12,159 @@ npm i tuix-webcomponents
|
|
|
12
12
|
|
|
13
13
|
### Webbundle version
|
|
14
14
|
|
|
15
|
-
Webbundle Link: https://tuix-webcomponents.s3.eu-central-1.amazonaws.com/build-
|
|
16
|
-
Styles Link: https://tuix-webcomponents.s3.eu-central-1.amazonaws.com/build-
|
|
15
|
+
Webbundle Link: https://tuix-webcomponents.s3.eu-central-1.amazonaws.com/build-67ca511@0.93.0.js
|
|
16
|
+
Styles Link: https://tuix-webcomponents.s3.eu-central-1.amazonaws.com/build-67ca511@0.93.0.css
|
|
17
17
|
|
|
18
|
-
### React
|
|
18
|
+
### React
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
The package ships generated [@lit/react](https://lit.dev/docs/frameworks/react/)
|
|
21
|
+
wrappers, one per element, so nothing has to be wrapped by hand. `@lit/react` is
|
|
22
|
+
a peer dependency:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm i tuix-webcomponents @lit/react
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import 'tuix-webcomponents/dist/assets/tuix-styles.css';
|
|
30
|
+
import { TuixButton, TuixText } from 'tuix-webcomponents/react';
|
|
31
|
+
import { IconName, MainVariant, TextSize } from 'tuix-webcomponents';
|
|
22
32
|
|
|
23
33
|
function App() {
|
|
24
|
-
|
|
25
|
-
// load fonts for SSR and CSR
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
loadFonts()
|
|
28
|
-
}, [])
|
|
29
|
-
|
|
30
34
|
return (
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
<>
|
|
36
|
+
<TuixText size={TextSize.XL}>Test text</TuixText>
|
|
37
|
+
<TuixButton
|
|
38
|
+
variant={MainVariant.PRIMARY}
|
|
39
|
+
iconLeft={IconName.SAVE}
|
|
40
|
+
onCustomClick={() => console.log('clicked')}
|
|
41
|
+
>
|
|
42
|
+
Save
|
|
43
|
+
</TuixButton>
|
|
44
|
+
</>
|
|
45
|
+
);
|
|
33
46
|
}
|
|
34
47
|
```
|
|
35
48
|
|
|
36
|
-
|
|
49
|
+
The props are the element's own properties, so objects and arrays pass through
|
|
50
|
+
untouched, and each custom event arrives as an `on*` prop. Because those
|
|
51
|
+
properties are typed with the exported enums, pass `MainVariant.PRIMARY` rather
|
|
52
|
+
than the string `'primary'`.
|
|
37
53
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
54
|
+
The wrappers are generated by `scripts/build-react.ts` during `npm run build`
|
|
55
|
+
and land in `package-build/src/react`; `src/react/` is gitignored. Nothing
|
|
56
|
+
about them is hand-kept: the generator reads `src/`, so every element with a
|
|
57
|
+
`@customElement` decorator gets a wrapper, and every event it dispatches gets
|
|
58
|
+
its `on*` prop, typed with the detail type written at the dispatch site.
|
|
41
59
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
### Fonts
|
|
61
|
+
|
|
62
|
+
The components render in Rubik, served from the Tuix CDN. The design tokens
|
|
63
|
+
stylesheet imports it, so `import 'tuix-webcomponents/dist/assets/tuix-styles.css'`
|
|
64
|
+
is enough. To start the request earlier, add the link to the document head:
|
|
65
|
+
|
|
66
|
+
```html
|
|
67
|
+
<link rel="preconnect" href="https://hccdn.tuix.ch" />
|
|
68
|
+
<link rel="stylesheet" href="https://hccdn.tuix.ch/rubik_d444e2375d.css" />
|
|
48
69
|
```
|
|
49
70
|
|
|
71
|
+
## Repository setup
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm install # the package
|
|
75
|
+
npm run docs:install # the documentation site, which is its own npm project
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`docs/` carries its own `package.json` and lockfile, so a root `npm install`
|
|
79
|
+
does not reach it, and `npm run docs:dev` and `npm run docs:build` fail until
|
|
80
|
+
`docs:install` has run once. `scripts/build.sh` runs it for the same reason
|
|
81
|
+
before it builds the site in CI. Nothing else needs a second install: the
|
|
82
|
+
package build and Storybook run off the root dependencies, and `docs/` resolves
|
|
83
|
+
`lit` and the component sources through them.
|
|
84
|
+
|
|
85
|
+
## Documentation
|
|
86
|
+
|
|
87
|
+
The developer documentation site (Fumadocs, statically exported) lives in
|
|
88
|
+
`docs/` as its own npm project:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npm run docs:install # once, and whenever docs/package-lock.json changes
|
|
92
|
+
npm run docs:dev # http://localhost:3000/en/developers
|
|
93
|
+
npm run docs:build # static export into docs/dist
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
All three are `npm --prefix docs`, so the same commands run from inside `docs/`
|
|
97
|
+
do the same thing, with one difference: `docs:install` is `npm ci`, a clean
|
|
98
|
+
install of exactly what `docs/package-lock.json` pins. Adding or bumping a
|
|
99
|
+
dependency therefore means an `npm install` inside `docs/`, to write the
|
|
100
|
+
lockfile that `docs:install` then reproduces.
|
|
101
|
+
|
|
102
|
+
It carries step-by-step integration guides for React/Next.js, Vue and Angular,
|
|
103
|
+
and a page per component with live previews of every variant, in English and
|
|
104
|
+
German. Pages are MDX files in `docs/content/docs/` (`*.mdx` English,
|
|
105
|
+
`*.de.mdx` German), ordered by `meta.json` and `meta.de.json`.
|
|
106
|
+
|
|
107
|
+
The site is public-facing: it shows and documents the components, and carries no
|
|
108
|
+
contributor workflow. That lives here and in `docs/src/modules/docs/README.md`,
|
|
109
|
+
which covers how the site is put together: content locations, the live previews,
|
|
110
|
+
the framework selector and the locales.
|
|
111
|
+
|
|
112
|
+
## Building the package
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
npm run build
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
writes `package-build/`, and `npm run stage:package` copies that into `dist/`,
|
|
119
|
+
which is what `npm publish` ships (`files: ["dist"]`):
|
|
120
|
+
|
|
121
|
+
| Path | Entry point |
|
|
122
|
+
| ----------------------------- | ------------------------------------------------------------------- |
|
|
123
|
+
| `dist/src/index.js` + `.d.ts` | `tuix-webcomponents`, the custom elements |
|
|
124
|
+
| `dist/src/react/index.js` | `tuix-webcomponents/react`, the wrappers |
|
|
125
|
+
| `dist/assets/tuix-styles.css` | `tuix-webcomponents/dist/assets/tuix-styles.css`, the design tokens |
|
|
126
|
+
|
|
127
|
+
The two steps are separate on purpose: `dist/` is also where the site is
|
|
128
|
+
assembled, so the package build never writes it. Only the staging step does, and
|
|
129
|
+
that runs in `bin/publish.sh`, i.e. in the publish job, after the site has
|
|
130
|
+
already been uploaded from its own job.
|
|
131
|
+
|
|
132
|
+
The steps behind it: `cem analyze` refreshes `custom-elements.json`,
|
|
133
|
+
`scripts/build-react.ts` regenerates `src/react/`, `tsc -p tsconfig.publish.json`
|
|
134
|
+
compiles both entry points with their declarations, `build:css` renders the
|
|
135
|
+
tokens, and `tsc-esm-fix` adds the `.js` extensions Node's ESM resolver needs.
|
|
136
|
+
|
|
137
|
+
## Releases
|
|
138
|
+
|
|
139
|
+
Releases are automatic, from CircleCI. `bin/publish.sh` takes the newest
|
|
140
|
+
`feat(`, `feat!(` or `fix(` subject out of the last ten commits and derives the
|
|
141
|
+
version from it:
|
|
142
|
+
|
|
143
|
+
| Commit prefix | Bump |
|
|
144
|
+
| ------------- | ----- |
|
|
145
|
+
| `feat!(` | major |
|
|
146
|
+
| `feat(` | minor |
|
|
147
|
+
| anything else | patch |
|
|
148
|
+
|
|
149
|
+
Commit subjects are linted by commitlint against
|
|
150
|
+
[Conventional Commits](https://www.conventionalcommits.org), so the prefix is
|
|
151
|
+
not optional.
|
|
152
|
+
|
|
153
|
+
The branch decides the dist-tag, and the two paths differ:
|
|
154
|
+
|
|
155
|
+
| Branch | Dist-tag | Version | Also does |
|
|
156
|
+
| ------------ | --------- | --------------------------------------------- | --------------------------------------------------------------------------- |
|
|
157
|
+
| `master` | `latest` | bumped from the commit subject, per the table | uploads the web bundle to S3, rewrites the two links below, tags `v<version>` |
|
|
158
|
+
| anything else| `staging` | always a patch bump off `staging` | uploads the web bundle to S3 |
|
|
159
|
+
|
|
160
|
+
Both paths build the bundle as `build-<short hash>@<version>.{js,css}` and
|
|
161
|
+
upload it, so every deployment is immutable. Only `latest` rewrites the
|
|
162
|
+
`Webbundle Link:` and `Styles Link:` lines under [Usage](#usage) and commits
|
|
163
|
+
them, which is why those two lines are the one place in the repository that
|
|
164
|
+
tracks the current bundle. `docs/scripts/build-bundle-links.ts` reads them at
|
|
165
|
+
docs build time rather than copying the URLs into a page, so the documentation
|
|
166
|
+
cannot fall a release behind.
|
|
167
|
+
|
|
50
168
|
## Linting and formatting
|
|
51
169
|
|
|
52
170
|
To scan the project for linting and formatting errors, run
|
|
@@ -75,18 +193,19 @@ To build a production version of Storybook, run
|
|
|
75
193
|
npm run storybook:build
|
|
76
194
|
```
|
|
77
195
|
|
|
196
|
+
That writes `dist/storybook`, which is where the deployed site serves it from.
|
|
197
|
+
The site root is the documentation, and the Storybook sidebar brand links back
|
|
198
|
+
to it. `scripts/build.sh` is what assembles both into `dist/` for CI.
|
|
199
|
+
|
|
200
|
+
Two builds, two folders, so neither clears the other: the site into `dist/`
|
|
201
|
+
(`scripts/build.sh`: Storybook under `dist/storybook`, the docs export at the
|
|
202
|
+
root) and the npm package into `package-build/` (`npm run build`). `dist/` is
|
|
203
|
+
reused for the package only by `npm run stage:package`, which `bin/publish.sh`
|
|
204
|
+
runs in the publish job.
|
|
205
|
+
|
|
78
206
|
|
|
79
207
|
## Tooling configs
|
|
80
208
|
|
|
81
209
|
For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
|
|
82
210
|
|
|
83
211
|
If you customize the configuration a lot, you can consider moving them to individual files.
|
|
84
|
-
|
|
85
|
-
## Local Demo with `web-dev-server`
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
npm start
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
To run a local development server that serves the basic demo located in `demo/index.html`
|
|
92
|
-
|