@design.estate/dees-domtools 3.0.0 → 3.0.2
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/.smartconfig.json +10 -1
- package/dist_bundle/bundle.js +236 -127
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_bundle/bundle.js.third-party-notices.json +1644 -0
- package/dist_bundle/bundle.js.third-party-notices.txt +3687 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/domtools.elementbasic.js +62 -7
- package/licenses/SOURCES.md +12 -0
- package/licenses/lit-labs-ssr-dom-shim.txt +28 -0
- package/package.json +9 -8
- package/readme.md +2 -0
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/domtools.elementbasic.ts +64 -6
- package/readme.hints.md +0 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@design.estate/dees-domtools',
|
|
6
|
-
version: '3.0.
|
|
6
|
+
version: '3.0.2',
|
|
7
7
|
description: 'A package providing tools to simplify complex CSS structures and web development tasks, featuring TypeScript support and integration with various web technologies.'
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSw4QkFBOEI7SUFDcEMsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLHFLQUFxSztDQUNuTCxDQUFBIn0=
|
|
@@ -1,12 +1,70 @@
|
|
|
1
1
|
import { DomTools } from './domtools.classes.domtools.js';
|
|
2
2
|
import { scrollBarStyles, globalBaseStyles } from './domtools.css.basestyles.js';
|
|
3
3
|
import { html, LitElement, css, unsafeCSS } from 'lit';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The elements of the HTML standard, as TypeScript's DOM library lists them. A custom element's
|
|
6
|
+
* name always contains a hyphen, so no custom element can appear here.
|
|
7
|
+
*/
|
|
8
|
+
const standardHtmlElementNames = [
|
|
9
|
+
'a', 'abbr', 'address', 'area', 'article', 'aside', 'audio',
|
|
10
|
+
'b', 'base', 'bdi', 'bdo', 'blockquote', 'body', 'br', 'button',
|
|
11
|
+
'canvas', 'caption', 'cite', 'code', 'col', 'colgroup',
|
|
12
|
+
'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt',
|
|
13
|
+
'em', 'embed',
|
|
14
|
+
'fieldset', 'figcaption', 'figure', 'footer', 'form',
|
|
15
|
+
'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html',
|
|
16
|
+
'i', 'iframe', 'img', 'input', 'ins',
|
|
17
|
+
'kbd',
|
|
18
|
+
'label', 'legend', 'li', 'link',
|
|
19
|
+
'main', 'map', 'mark', 'menu', 'meta', 'meter',
|
|
20
|
+
'nav', 'noscript',
|
|
21
|
+
'object', 'ol', 'optgroup', 'option', 'output',
|
|
22
|
+
'p', 'picture', 'pre', 'progress',
|
|
23
|
+
'q',
|
|
24
|
+
'rp', 'rt', 'ruby',
|
|
25
|
+
's', 'samp', 'script', 'search', 'section', 'select', 'slot', 'small', 'source', 'span',
|
|
26
|
+
'strong', 'style', 'sub', 'summary', 'sup',
|
|
27
|
+
'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title',
|
|
28
|
+
'tr', 'track',
|
|
29
|
+
'u', 'ul',
|
|
30
|
+
'var', 'video',
|
|
31
|
+
'wbr',
|
|
32
|
+
];
|
|
33
|
+
/**
|
|
34
|
+
* Every built-in element: the standard HTML elements, and everything outside the HTML namespace
|
|
35
|
+
* (SVG, MathML), where no custom element can exist. `:where()` keeps the zero specificity of `*`,
|
|
36
|
+
* so any rule of a component still overrides a default given through this selector.
|
|
37
|
+
*
|
|
38
|
+
* Each entry gets its own `:where()` instead of sharing one list: the browser can then index every
|
|
39
|
+
* entry by its tag name rather than test each element against the whole list, which keeps style
|
|
40
|
+
* recalculation as fast as it is with `*`.
|
|
41
|
+
*/
|
|
42
|
+
const builtInElementSelector = [...standardHtmlElementNames, ':not(xhtml|*)']
|
|
43
|
+
.map((selector) => `:where(${selector})`)
|
|
44
|
+
.join(', ');
|
|
45
|
+
/**
|
|
46
|
+
* The defaults for the elements a component renders into its shadow tree, shared by both exports.
|
|
47
|
+
* Each export opens with them because the `@namespace` rule that `builtInElementSelector` relies
|
|
48
|
+
* on is only valid ahead of every other rule.
|
|
49
|
+
*
|
|
50
|
+
* The fade is limited to built-in elements. `*` would also match the hosts of the custom elements
|
|
51
|
+
* nested in the shadow tree, and the outer tree's declarations beat a nested element's own `:host`
|
|
52
|
+
* rules whatever their specificity or layer, so no nested element could animate its own host.
|
|
53
|
+
*/
|
|
54
|
+
const shadowTreeElementStyles = css `
|
|
55
|
+
@namespace xhtml url('http://www.w3.org/1999/xhtml');
|
|
56
|
+
|
|
5
57
|
* {
|
|
6
|
-
transition: background 0.1s, color 0.1s;
|
|
7
58
|
box-sizing: border-box;
|
|
8
59
|
}
|
|
9
60
|
|
|
61
|
+
${unsafeCSS(builtInElementSelector)} {
|
|
62
|
+
transition: background 0.1s, color 0.1s;
|
|
63
|
+
}
|
|
64
|
+
`.cssText;
|
|
65
|
+
export const staticStyles = css `
|
|
66
|
+
${unsafeCSS(shadowTreeElementStyles)}
|
|
67
|
+
|
|
10
68
|
:host {
|
|
11
69
|
box-sizing: border-box;
|
|
12
70
|
font-family: 'Geist Sans', 'Inter', sans-serif;
|
|
@@ -19,10 +77,7 @@ export const staticStyles = css `
|
|
|
19
77
|
*/
|
|
20
78
|
export const styles = html `
|
|
21
79
|
<style>
|
|
22
|
-
|
|
23
|
-
transition: background 0.1s, color 0.1s;
|
|
24
|
-
box-sizing: border-box;
|
|
25
|
-
}
|
|
80
|
+
${shadowTreeElementStyles}
|
|
26
81
|
|
|
27
82
|
:host {
|
|
28
83
|
font-family: 'Geist Sans', 'Inter', sans-serif;
|
|
@@ -51,4 +106,4 @@ export const setup = async (elementArg, optionsArg = {}) => {
|
|
|
51
106
|
await domTools.globalStylesReady.promise;
|
|
52
107
|
return domTools;
|
|
53
108
|
};
|
|
54
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
109
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZG9tdG9vbHMuZWxlbWVudGJhc2ljLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvZG9tdG9vbHMuZWxlbWVudGJhc2ljLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxRQUFRLEVBQW1DLE1BQU0sZ0NBQWdDLENBQUM7QUFDM0YsT0FBTyxFQUFFLGVBQWUsRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLDhCQUE4QixDQUFDO0FBRWpGLE9BQU8sRUFBRSxJQUFJLEVBQUUsVUFBVSxFQUFFLEdBQUcsRUFBRSxTQUFTLEVBQUUsTUFBTSxLQUFLLENBQUM7QUFFdkQ7OztHQUdHO0FBQ0gsTUFBTSx3QkFBd0IsR0FBRztJQUMvQixHQUFHLEVBQUUsTUFBTSxFQUFFLFNBQVMsRUFBRSxNQUFNLEVBQUUsU0FBUyxFQUFFLE9BQU8sRUFBRSxPQUFPO0lBQzNELEdBQUcsRUFBRSxNQUFNLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSxFQUFFLElBQUksRUFBRSxRQUFRO0lBQy9ELFFBQVEsRUFBRSxTQUFTLEVBQUUsTUFBTSxFQUFFLE1BQU0sRUFBRSxLQU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QUMsQ0FBQztJQUUxRCxJQUFJLFVBQVUsRUFBRSxDQUFDO1FBQ2YscUNBQXFDO1FBQ3JDLHFCQUFxQjtJQUN2QixDQUFDO0lBRUQsTUFBTSxRQUFRLENBQUMsT0FBTyxDQUFDLG1CQUFtQixFQUFFLEtBQUssSUFBSSxFQUFFO1FBQ3JELGFBQWE7UUFDYixNQUFNLFFBQVEsQ0FBQyxlQUFlLENBQUMsZ0JBQWdCLENBQUMsQ0FBQztJQUNuRCxDQUFDLENBQUMsQ0FBQztJQUNILElBQUksUUFBUSxDQUFDLGlCQUFpQixDQUFDLE1BQU0sS0FBSyxTQUFTLEVBQUUsQ0FBQztRQUNwRCxRQUFRLENBQUMsaUJBQWlCLENBQUMsT0FBTyxFQUFFLENBQUM7SUFDdkMsQ0FBQztJQUNELE1BQU0sUUFBUSxDQUFDLGlCQUFpQixDQUFDLE9BQU8sQ0FBQztJQUN6QyxPQUFPLFFBQVEsQ0FBQztBQUNsQixDQUFDLENBQUMifQ==
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Sources of the license texts in this directory
|
|
2
|
+
|
|
3
|
+
These files supply license texts for dependencies that declare a license in `package.json`
|
|
4
|
+
but publish no license file. They are declared in `.smartconfig.json` under
|
|
5
|
+
`"@git.zone/tsbundle".thirdPartyNotices.supplements`, so tsbundle bundles and tsdeno
|
|
6
|
+
executables that contain dees-domtools carry them in their third-party notices.
|
|
7
|
+
|
|
8
|
+
| File | Covers | Source |
|
|
9
|
+
|------|--------|--------|
|
|
10
|
+
| `lit-labs-ssr-dom-shim.txt` | `@lit-labs/ssr-dom-shim` (BSD-3-Clause), taken at 1.6.0. It reaches dees-domtools through `lit` (`@lit/reactive-element`, `lit-element`); Node.js and Deno load it where browsers do not, so it appears in server bundles and `deno compile` executables. | `LICENSE` of https://github.com/lit/lit at tag `@lit-labs/ssr-dom-shim@1.6.0` (commit `20afabd3c5bfd49fdcdf1b8518e05c7f99a46db6`): https://raw.githubusercontent.com/lit/lit/20afabd3c5bfd49fdcdf1b8518e05c7f99a46db6/LICENSE. `packages/labs/ssr-dom-shim` has no license file of its own at that tag, so the repository license applies. The file last changed before that tag in commit `a53b8475abcee9919b039a86742f1d6a2f1ebd2f` (2021), so it also covers 1.5.1, which the repository does not tag; it is byte-identical to the `LICENSE` that `lit` 3.3.3 publishes. |
|
|
11
|
+
|
|
12
|
+
The file is a byte-for-byte copy of the file named.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Google LLC. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@design.estate/dees-domtools",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package providing tools to simplify complex CSS structures and web development tasks, featuring TypeScript support and integration with various web technologies.",
|
|
6
6
|
"main": "dist_ts/index.js",
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"author": "Lossless GmbH",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@git.zone/tsbuild": "^
|
|
13
|
-
"@git.zone/tsbundle": "^
|
|
14
|
-
"@git.zone/tstest": "^
|
|
15
|
-
"@types/node": "^
|
|
12
|
+
"@git.zone/tsbuild": "^5.0.0",
|
|
13
|
+
"@git.zone/tsbundle": "^3.1.0",
|
|
14
|
+
"@git.zone/tstest": "^6.3.2",
|
|
15
|
+
"@types/node": "^26.6.2"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@api.global/typedrequest": "^8.0.3",
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
"@push.rocks/lik": "^6.4.0",
|
|
21
21
|
"@push.rocks/smartdelay": "^3.0.5",
|
|
22
22
|
"@push.rocks/smartjson": "^6.0.0",
|
|
23
|
-
"@push.rocks/smartmarkdown": "^3.
|
|
23
|
+
"@push.rocks/smartmarkdown": "^3.2.3",
|
|
24
24
|
"@push.rocks/smartpromise": "^4.2.3",
|
|
25
25
|
"@push.rocks/smartrouter": "^1.3.3",
|
|
26
26
|
"@push.rocks/smartrx": "^3.0.10",
|
|
27
|
-
"@push.rocks/smartstate": "^2.3.
|
|
27
|
+
"@push.rocks/smartstate": "^2.3.3",
|
|
28
28
|
"@push.rocks/smartstring": "^4.1.0",
|
|
29
29
|
"@push.rocks/smarturl": "^3.1.0",
|
|
30
30
|
"@push.rocks/webrequest": "^4.0.5",
|
|
31
|
-
"@push.rocks/websetup": "^3.0.
|
|
31
|
+
"@push.rocks/websetup": "^3.0.20",
|
|
32
32
|
"@push.rocks/webstore": "^2.0.21",
|
|
33
33
|
"@tempfix/lenis": "^1.3.20",
|
|
34
34
|
"lit": "^3.3.2",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"assets/**/*",
|
|
45
45
|
"cli.js",
|
|
46
46
|
".smartconfig.json",
|
|
47
|
+
"licenses/**/*",
|
|
47
48
|
"readme.md"
|
|
48
49
|
],
|
|
49
50
|
"browserslist": [
|
package/readme.md
CHANGED
|
@@ -271,6 +271,8 @@ class DemoElement extends LitElement {
|
|
|
271
271
|
}
|
|
272
272
|
```
|
|
273
273
|
|
|
274
|
+
`elementBasic.staticStyles` is the base stylesheet for a component, and `elementBasic.styles` renders the same element defaults as a `<style>` element inside a template. Every element of the component's shadow tree gets `box-sizing: border-box`, and every built-in element (HTML, SVG, MathML) fades `background` and `color` over 0.1s. The fade never reaches the host of a custom element nested in the component: that host keeps the transition its own styles declare, so a nested component can still animate its host, such as a sidebar collapsing its width. The defaults carry zero specificity, so any rule of the component overrides them.
|
|
275
|
+
|
|
274
276
|
`elementBasic.setup()` performs the shared `DomTools` setup and injects the package's global base styles once.
|
|
275
277
|
|
|
276
278
|
The returned promise resolves after the shared base styles have been injected, and `domtools.globalStylesReady` resolves at the same point.
|
package/ts/00_commitinfo_data.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@design.estate/dees-domtools',
|
|
6
|
-
version: '3.0.
|
|
6
|
+
version: '3.0.2',
|
|
7
7
|
description: 'A package providing tools to simplify complex CSS structures and web development tasks, featuring TypeScript support and integration with various web technologies.'
|
|
8
8
|
}
|
|
@@ -3,12 +3,73 @@ import { scrollBarStyles, globalBaseStyles } from './domtools.css.basestyles.js'
|
|
|
3
3
|
|
|
4
4
|
import { html, LitElement, css, unsafeCSS } from 'lit';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* The elements of the HTML standard, as TypeScript's DOM library lists them. A custom element's
|
|
8
|
+
* name always contains a hyphen, so no custom element can appear here.
|
|
9
|
+
*/
|
|
10
|
+
const standardHtmlElementNames = [
|
|
11
|
+
'a', 'abbr', 'address', 'area', 'article', 'aside', 'audio',
|
|
12
|
+
'b', 'base', 'bdi', 'bdo', 'blockquote', 'body', 'br', 'button',
|
|
13
|
+
'canvas', 'caption', 'cite', 'code', 'col', 'colgroup',
|
|
14
|
+
'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt',
|
|
15
|
+
'em', 'embed',
|
|
16
|
+
'fieldset', 'figcaption', 'figure', 'footer', 'form',
|
|
17
|
+
'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html',
|
|
18
|
+
'i', 'iframe', 'img', 'input', 'ins',
|
|
19
|
+
'kbd',
|
|
20
|
+
'label', 'legend', 'li', 'link',
|
|
21
|
+
'main', 'map', 'mark', 'menu', 'meta', 'meter',
|
|
22
|
+
'nav', 'noscript',
|
|
23
|
+
'object', 'ol', 'optgroup', 'option', 'output',
|
|
24
|
+
'p', 'picture', 'pre', 'progress',
|
|
25
|
+
'q',
|
|
26
|
+
'rp', 'rt', 'ruby',
|
|
27
|
+
's', 'samp', 'script', 'search', 'section', 'select', 'slot', 'small', 'source', 'span',
|
|
28
|
+
'strong', 'style', 'sub', 'summary', 'sup',
|
|
29
|
+
'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title',
|
|
30
|
+
'tr', 'track',
|
|
31
|
+
'u', 'ul',
|
|
32
|
+
'var', 'video',
|
|
33
|
+
'wbr',
|
|
34
|
+
] as const satisfies readonly (keyof HTMLElementTagNameMap)[];
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Every built-in element: the standard HTML elements, and everything outside the HTML namespace
|
|
38
|
+
* (SVG, MathML), where no custom element can exist. `:where()` keeps the zero specificity of `*`,
|
|
39
|
+
* so any rule of a component still overrides a default given through this selector.
|
|
40
|
+
*
|
|
41
|
+
* Each entry gets its own `:where()` instead of sharing one list: the browser can then index every
|
|
42
|
+
* entry by its tag name rather than test each element against the whole list, which keeps style
|
|
43
|
+
* recalculation as fast as it is with `*`.
|
|
44
|
+
*/
|
|
45
|
+
const builtInElementSelector = [...standardHtmlElementNames, ':not(xhtml|*)']
|
|
46
|
+
.map((selector) => `:where(${selector})`)
|
|
47
|
+
.join(', ');
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The defaults for the elements a component renders into its shadow tree, shared by both exports.
|
|
51
|
+
* Each export opens with them because the `@namespace` rule that `builtInElementSelector` relies
|
|
52
|
+
* on is only valid ahead of every other rule.
|
|
53
|
+
*
|
|
54
|
+
* The fade is limited to built-in elements. `*` would also match the hosts of the custom elements
|
|
55
|
+
* nested in the shadow tree, and the outer tree's declarations beat a nested element's own `:host`
|
|
56
|
+
* rules whatever their specificity or layer, so no nested element could animate its own host.
|
|
57
|
+
*/
|
|
58
|
+
const shadowTreeElementStyles: string = css`
|
|
59
|
+
@namespace xhtml url('http://www.w3.org/1999/xhtml');
|
|
60
|
+
|
|
7
61
|
* {
|
|
8
|
-
transition: background 0.1s, color 0.1s;
|
|
9
62
|
box-sizing: border-box;
|
|
10
63
|
}
|
|
11
64
|
|
|
65
|
+
${unsafeCSS(builtInElementSelector)} {
|
|
66
|
+
transition: background 0.1s, color 0.1s;
|
|
67
|
+
}
|
|
68
|
+
`.cssText;
|
|
69
|
+
|
|
70
|
+
export const staticStyles = css`
|
|
71
|
+
${unsafeCSS(shadowTreeElementStyles)}
|
|
72
|
+
|
|
12
73
|
:host {
|
|
13
74
|
box-sizing: border-box;
|
|
14
75
|
font-family: 'Geist Sans', 'Inter', sans-serif;
|
|
@@ -22,10 +83,7 @@ export const staticStyles = css`
|
|
|
22
83
|
*/
|
|
23
84
|
export const styles = html`
|
|
24
85
|
<style>
|
|
25
|
-
|
|
26
|
-
transition: background 0.1s, color 0.1s;
|
|
27
|
-
box-sizing: border-box;
|
|
28
|
-
}
|
|
86
|
+
${shadowTreeElementStyles}
|
|
29
87
|
|
|
30
88
|
:host {
|
|
31
89
|
font-family: 'Geist Sans', 'Inter', sans-serif;
|
package/readme.hints.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|