@design.estate/dees-domtools 3.0.0 → 3.0.1

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.
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-domtools',
6
- version: '3.0.0',
6
+ version: '3.0.1',
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
- export const staticStyles = css `
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZG9tdG9vbHMuZWxlbWVudGJhc2ljLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvZG9tdG9vbHMuZWxlbWVudGJhc2ljLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxRQUFRLEVBQW1DLE1BQU0sZ0NBQWdDLENBQUM7QUFDM0YsT0FBTyxFQUFFLGVBQWUsRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLDhCQUE4QixDQUFDO0FBRWpGLE9BQU8sRUFBRSxJQUFJLEVBQUUsVUFBVSxFQUFFLEdBQUcsRUFBRSxTQUFTLEVBQUUsTUFBTSxLQUFLLENBQUM7QUFFdkQsTUFBTSxDQUFDLE1BQU0sWUFBWSxHQUFHLEdBQUcsQ0FBQTs7Ozs7Ozs7Ozs7SUFXM0IsU0FBUyxDQUFDLGVBQWUsQ0FBQztDQUM3QixDQUFDO0FBRUY7O0dBRUc7QUFDSCxNQUFNLENBQUMsTUFBTSxNQUFNL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"@design.estate/dees-domtools",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
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": "^4.4.0",
13
- "@git.zone/tsbundle": "^2.13.0",
14
- "@git.zone/tstest": "^3.6.3",
15
- "@types/node": "^25.6.0"
12
+ "@git.zone/tsbuild": "^4.5.1",
13
+ "@git.zone/tsbundle": "^2.14.0",
14
+ "@git.zone/tstest": "^6.1.5",
15
+ "@types/node": "^26.6.1"
16
16
  },
17
17
  "dependencies": {
18
18
  "@api.global/typedrequest": "^8.0.3",
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.
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-domtools',
6
- version: '3.0.0',
6
+ version: '3.0.1',
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
- export const staticStyles = css`
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
-