@dxos/ui 0.8.4-main.e250131250 → 0.8.4-main.f466a3d56e

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/LICENSE CHANGED
@@ -1,8 +1,105 @@
1
- MIT License
2
- Copyright (c) 2022 DXOS
1
+ # Functional Source License, Version 1.1, ALv2 Future License
3
2
 
4
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ ## Abbreviation
5
4
 
6
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ FSL-1.1-Apache-2.0
7
6
 
8
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7
+ ## Notice
8
+
9
+ Copyright 2026 DXOS
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the Apache License, Version 2.0 that is effective on the second anniversary of
91
+ the date we make the Software available. On or after that date, you may use the
92
+ Software under the Apache License, Version 2.0, in which case the following
93
+ will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
+ this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software distributed
103
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
+ specific language governing permissions and limitations under the License.
package/README.md CHANGED
@@ -18,4 +18,4 @@ pnpm i @dxos/ui
18
18
 
19
19
  Your ideas, issues, and code are most welcome. Please take a look at our [community code of conduct](https://github.com/dxos/dxos/blob/main/CODE_OF_CONDUCT.md), the [issue guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-issues), and the [PR contribution guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-prs).
20
20
 
21
- License: [MIT](./LICENSE) Copyright 2022 © DXOS
21
+ License: [FSL-1.1-Apache-2.0](./LICENSE) Copyright 2022 © DXOS
@@ -8,18 +8,20 @@ var hasIosKeyboard = () => {
8
8
 
9
9
  // src/domino.ts
10
10
  import { mx } from "@dxos/ui-theme";
11
- var ICONS_URL = "/icons.svg";
11
+ var DEFAULT_ICONS_URL = "/icons.svg";
12
12
  var Domino = class _Domino {
13
13
  static SVG = "http://www.w3.org/2000/svg";
14
+ /** Overridable at module level so `Domino.svg()` can resolve from any origin. */
15
+ static iconsUrl = DEFAULT_ICONS_URL;
14
16
  // TODO(burdon): Make private.
15
- static icon = (icon) => ICONS_URL + "#" + icon;
17
+ static icon = (icon) => _Domino.iconsUrl + "#" + icon;
16
18
  /**
17
19
  * Creates an SVG icon element from the icon sprite sheet.
18
20
  */
19
21
  // TODO(burdon): Rename icon.
20
22
  static svg = (icon) => _Domino.of("svg", _Domino.SVG).classNames("shrink-0 h-[1em] w-[1em]").attributes({
21
23
  viewBox: "0 0 256 256"
22
- }).children(_Domino.of("use", _Domino.SVG).attributes({
24
+ }).append(_Domino.of("use", _Domino.SVG).attributes({
23
25
  href: _Domino.icon(icon)
24
26
  }));
25
27
  static of(tag, namespace) {
@@ -58,12 +60,20 @@ var Domino = class _Domino {
58
60
  Object.assign(this._el.style, styles);
59
61
  return this;
60
62
  }
61
- children(...children) {
63
+ append(...children) {
62
64
  children.forEach((child) => this._el.appendChild(child.root));
63
65
  return this;
64
66
  }
65
- on(event, handler) {
66
- this._el.addEventListener(event, handler);
67
+ on(event, handler, options) {
68
+ this._el.addEventListener(event, handler, options);
69
+ return this;
70
+ }
71
+ /**
72
+ * Convenience for attaching the root element to a parent node — useful at
73
+ * the end of a chain to avoid a trailing `.root` / `parent.appendChild()`.
74
+ */
75
+ mount(parent) {
76
+ parent.appendChild(this._el);
67
77
  return this;
68
78
  }
69
79
  get root() {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/index.ts", "../../../src/device.ts", "../../../src/domino.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport { mx } from '@dxos/ui-theme';\nexport type { ThemedClassName } from '@dxos/ui-types';\n\nexport * from './device';\nexport * from './domino';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport const hasIosKeyboard = () => {\n // TODO(thure): UA sniffing is never good, however I haven’t found a better way to query for whether the on-screen keyboard will appear on `focus` outside of a click handler.\n return !!navigator.userAgent.match(/(iPad|iPod|iPhone).+Safari/);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { mx } from '@dxos/ui-theme';\nimport { type ClassNameValue } from '@dxos/ui-types';\n\n// From icon-plugin.\nconst ICONS_URL = '/icons.svg';\n\n/**\n * Super lightweight chainable DOM builder.\n */\nexport class Domino<T extends HTMLElement | SVGElement> {\n static SVG = 'http://www.w3.org/2000/svg';\n\n // TODO(burdon): Make private.\n static icon = (icon: string) => ICONS_URL + '#' + icon;\n\n /**\n * Creates an SVG icon element from the icon sprite sheet.\n */\n // TODO(burdon): Rename icon.\n static svg = (icon: string) =>\n Domino.of('svg', Domino.SVG)\n .classNames('shrink-0 h-[1em] w-[1em]')\n .attributes({ viewBox: '0 0 256 256' })\n .children(Domino.of('use', Domino.SVG).attributes({ href: Domino.icon(icon) }));\n\n /**\n * Create builder from DOM node.\n */\n static of<K extends keyof HTMLElementTagNameMap>(tag: K): Domino<HTMLElementTagNameMap[K]>;\n static of<K extends keyof SVGElementTagNameMap>(tag: K, namespace: string): Domino<SVGElementTagNameMap[K]>;\n static of(tag: string, namespace?: string): Domino<HTMLElement | SVGElement> {\n return new Domino(tag, namespace);\n }\n\n private readonly _el: T;\n\n private constructor(tag: string, namespace?: string) {\n if (namespace) {\n this._el = document.createElementNS(namespace, tag) as T;\n } else {\n this._el = document.createElement(tag) as T;\n }\n }\n\n classNames(...classNames: ClassNameValue[]): this {\n const merged = mx(classNames);\n if (this._el instanceof HTMLElement || this._el instanceof SVGElement) {\n this._el.setAttribute('class', merged);\n }\n return this;\n }\n\n text(value: string): this {\n this._el.textContent = value;\n return this;\n }\n\n data(key: string, value: string): this {\n if (this._el instanceof HTMLElement) {\n this._el.dataset[key] = value;\n }\n return this;\n }\n\n attributes(attr: Record<string, string | undefined>): this {\n Object.entries(attr)\n .filter(([_, value]) => value !== undefined)\n .map(([key, value]) => this._el.setAttribute(key, value!));\n return this;\n }\n\n style(styles: Partial<CSSStyleDeclaration>): this {\n Object.assign(this._el.style, styles);\n return this;\n }\n\n children<C extends HTMLElement | SVGElement>(...children: Domino<C>[]): this {\n children.forEach((child) => this._el.appendChild(child.root));\n return this;\n }\n\n on(event: string, handler: (e: Event) => void): this {\n this._el.addEventListener(event, handler);\n return this;\n }\n\n get root(): T {\n return this._el;\n }\n}\n"],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UAAUU,MAAAA,EACjCC,IAAI,CAAC,CAACR,KAAKH,KAAAA,MAAW,KAAKV,IAAIQ,aAAaK,KAAKH,KAAAA,CAAAA;AACpD,WAAO;EACT;EAEAY,MAAMC,QAA4C;AAChDP,WAAOQ,OAAO,KAAKxB,IAAIsB,OAAOC,MAAAA;AAC9B,WAAO;EACT;EAEA3B,YAAgDA,UAA6B;AAC3EA,aAAS6B,QAAQ,CAACC,UAAU,KAAK1B,IAAI2B,YAAYD,MAAME,IAAI,CAAA;AAC3D,WAAO;EACT;EAEAC,GAAGC,OAAeC,SAAmC;AACnD,SAAK/B,IAAIgC,iBAAiBF,OAAOC,OAAAA;AACjC,WAAO;EACT;EAEA,IAAIH,OAAU;AACZ,WAAO,KAAK5B;EACd;AACF;",
6
- "names": ["mx", "hasIosKeyboard", "navigator", "userAgent", "match", "mx", "ICONS_URL", "Domino", "SVG", "icon", "svg", "of", "classNames", "attributes", "viewBox", "children", "href", "tag", "namespace", "_el", "document", "createElementNS", "createElement", "merged", "mx", "HTMLElement", "SVGElement", "setAttribute", "text", "value", "textContent", "data", "key", "dataset", "attr", "Object", "entries", "filter", "_", "undefined", "map", "style", "styles", "assign", "forEach", "child", "appendChild", "root", "on", "event", "handler", "addEventListener"]
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport { mx } from '@dxos/ui-theme';\nexport type { ThemedClassName } from '@dxos/ui-types';\n\nexport * from './device';\nexport * from './domino';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport const hasIosKeyboard = () => {\n // TODO(thure): UA sniffing is never good, however I haven’t found a better way to query for whether the on-screen keyboard will appear on `focus` outside of a click handler.\n return !!navigator.userAgent.match(/(iPad|iPod|iPhone).+Safari/);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { mx } from '@dxos/ui-theme';\nimport { type ClassNameValue } from '@dxos/ui-types';\n\n/**\n * Base URL of the icon sprite sheet emitted by `@dxos/vite-plugin-icons`.\n * Defaults to `/icons.svg` which works inside hosted apps served at the\n * site root. Callers running in a different origin context (e.g. browser\n * extensions that inject into arbitrary pages) can override by assigning\n * `Domino.iconsUrl` before first use.\n */\nconst DEFAULT_ICONS_URL = '/icons.svg';\n\n/**\n * Super lightweight chainable DOM builder.\n */\nexport class Domino<T extends HTMLElement | SVGElement> {\n static SVG = 'http://www.w3.org/2000/svg';\n\n /** Overridable at module level so `Domino.svg()` can resolve from any origin. */\n static iconsUrl: string = DEFAULT_ICONS_URL;\n\n // TODO(burdon): Make private.\n static icon = (icon: string) => Domino.iconsUrl + '#' + icon;\n\n /**\n * Creates an SVG icon element from the icon sprite sheet.\n */\n // TODO(burdon): Rename icon.\n static svg = (icon: string) =>\n Domino.of('svg', Domino.SVG)\n .classNames('shrink-0 h-[1em] w-[1em]')\n .attributes({ viewBox: '0 0 256 256' })\n .append(Domino.of('use', Domino.SVG).attributes({ href: Domino.icon(icon) }));\n\n /**\n * Create builder from DOM node.\n */\n static of<K extends keyof HTMLElementTagNameMap>(tag: K): Domino<HTMLElementTagNameMap[K]>;\n static of<K extends keyof SVGElementTagNameMap>(tag: K, namespace: string): Domino<SVGElementTagNameMap[K]>;\n static of(tag: string, namespace?: string): Domino<HTMLElement | SVGElement> {\n return new Domino(tag, namespace);\n }\n\n private readonly _el: T;\n\n private constructor(tag: string, namespace?: string) {\n if (namespace) {\n this._el = document.createElementNS(namespace, tag) as T;\n } else {\n this._el = document.createElement(tag) as T;\n }\n }\n\n classNames(...classNames: ClassNameValue[]): this {\n const merged = mx(classNames);\n if (this._el instanceof HTMLElement || this._el instanceof SVGElement) {\n this._el.setAttribute('class', merged);\n }\n return this;\n }\n\n text(value: string): this {\n this._el.textContent = value;\n return this;\n }\n\n data(key: string, value: string): this {\n if (this._el instanceof HTMLElement) {\n this._el.dataset[key] = value;\n }\n return this;\n }\n\n attributes(attr: Record<string, string | undefined>): this {\n Object.entries(attr)\n .filter(([_, value]) => value !== undefined)\n .map(([key, value]) => this._el.setAttribute(key, value!));\n return this;\n }\n\n style(styles: Partial<CSSStyleDeclaration>): this {\n Object.assign(this._el.style, styles);\n return this;\n }\n\n append<C extends HTMLElement | SVGElement>(...children: Domino<C>[]): this {\n children.forEach((child) => this._el.appendChild(child.root));\n return this;\n }\n\n /**\n * Typed event listener. Accepts the standard `AddEventListenerOptions`\n * third argument so callers can opt into `capture`, `once`, `passive`.\n */\n on<K extends keyof HTMLElementEventMap>(\n event: K,\n handler: (e: HTMLElementEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions,\n ): this;\n on(event: string, handler: (e: Event) => void, options?: boolean | AddEventListenerOptions): this;\n on(event: string, handler: (e: Event) => void, options?: boolean | AddEventListenerOptions): this {\n this._el.addEventListener(event, handler, options);\n return this;\n }\n\n /**\n * Convenience for attaching the root element to a parent node — useful at\n * the end of a chain to avoid a trailing `.root` / `parent.appendChild()`.\n */\n mount(parent: Node): this {\n parent.appendChild(this._el);\n return this;\n }\n\n get root(): T {\n return this._el;\n }\n}\n"],
5
+ "mappings": ";AAIA,SAASA,MAAAA,WAAU;;;ACAZ,IAAMC,iBAAiB,MAAA;AAE5B,SAAO,CAAC,CAACC,UAAUC,UAAUC,MAAM,4BAAA;AACrC;;;ACHA,SAASC,UAAU;AAUnB,IAAMC,oBAAoB;AAKnB,IAAMC,SAAN,MAAMA,QAAAA;EACX,OAAOC,MAAM;;EAGb,OAAOC,WAAmBH;;EAG1B,OAAOI,OAAO,CAACA,SAAiBH,QAAOE,WAAW,MAAMC;;;;;EAMxD,OAAOC,MAAM,CAACD,SACZH,QAAOK,GAAG,OAAOL,QAAOC,GAAG,EACxBK,WAAW,0BAAA,EACXC,WAAW;IAAEC,SAAS;EAAc,CAAA,EACpCC,OAAOT,QAAOK,GAAG,OAAOL,QAAOC,GAAG,EAAEM,WAAW;IAAEG,MAAMV,QAAOG,KAAKA,IAAAA;EAAM,CAAA,CAAA;EAO9E,OAAOE,GAAGM,KAAaC,WAAsD;AAC3E,WAAO,IAAIZ,QAAOW,KAAKC,SA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IosKeyboard", "navigator", "userAgent", "match", "mx", "DEFAULT_ICONS_URL", "Domino", "SVG", "iconsUrl", "icon", "svg", "of", "classNames", "attributes", "viewBox", "append", "href", "tag", "namespace", "_el", "document", "createElementNS", "createElement", "merged", "HTMLElement", "SVGElement", "setAttribute", "text", "value", "textContent", "data", "key", "dataset", "attr", "Object", "entries", "filter", "_", "undefined", "map", "style", "styles", "assign", "children", "forEach", "child", "appendChild", "root", "on", "event", "handler", "options", "addEventListener", "mount", "parent"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/device.ts":{"bytes":1228,"imports":[],"format":"esm"},"src/domino.ts":{"bytes":8647,"imports":[{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":730,"imports":[{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"src/device.ts","kind":"import-statement","original":"./device"},{"path":"src/domino.ts","kind":"import-statement","original":"./domino"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5359},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"exports":["Domino","hasIosKeyboard","mx"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":44},"src/device.ts":{"bytesInOutput":100},"src/domino.ts":{"bytesInOutput":1728}},"bytes":2011}}}
1
+ {"inputs":{"src/device.ts":{"bytes":1162,"imports":[],"format":"esm"},"src/domino.ts":{"bytes":11242,"imports":[{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":665,"imports":[{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"src/device.ts","kind":"import-statement","original":"./device"},{"path":"src/domino.ts","kind":"import-statement","original":"./domino"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6753},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"exports":["Domino","hasIosKeyboard","mx"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":44},"src/device.ts":{"bytesInOutput":100},"src/domino.ts":{"bytesInOutput":2119}},"bytes":2402}}}
@@ -10,18 +10,20 @@ var hasIosKeyboard = () => {
10
10
 
11
11
  // src/domino.ts
12
12
  import { mx } from "@dxos/ui-theme";
13
- var ICONS_URL = "/icons.svg";
13
+ var DEFAULT_ICONS_URL = "/icons.svg";
14
14
  var Domino = class _Domino {
15
15
  static SVG = "http://www.w3.org/2000/svg";
16
+ /** Overridable at module level so `Domino.svg()` can resolve from any origin. */
17
+ static iconsUrl = DEFAULT_ICONS_URL;
16
18
  // TODO(burdon): Make private.
17
- static icon = (icon) => ICONS_URL + "#" + icon;
19
+ static icon = (icon) => _Domino.iconsUrl + "#" + icon;
18
20
  /**
19
21
  * Creates an SVG icon element from the icon sprite sheet.
20
22
  */
21
23
  // TODO(burdon): Rename icon.
22
24
  static svg = (icon) => _Domino.of("svg", _Domino.SVG).classNames("shrink-0 h-[1em] w-[1em]").attributes({
23
25
  viewBox: "0 0 256 256"
24
- }).children(_Domino.of("use", _Domino.SVG).attributes({
26
+ }).append(_Domino.of("use", _Domino.SVG).attributes({
25
27
  href: _Domino.icon(icon)
26
28
  }));
27
29
  static of(tag, namespace) {
@@ -60,12 +62,20 @@ var Domino = class _Domino {
60
62
  Object.assign(this._el.style, styles);
61
63
  return this;
62
64
  }
63
- children(...children) {
65
+ append(...children) {
64
66
  children.forEach((child) => this._el.appendChild(child.root));
65
67
  return this;
66
68
  }
67
- on(event, handler) {
68
- this._el.addEventListener(event, handler);
69
+ on(event, handler, options) {
70
+ this._el.addEventListener(event, handler, options);
71
+ return this;
72
+ }
73
+ /**
74
+ * Convenience for attaching the root element to a parent node — useful at
75
+ * the end of a chain to avoid a trailing `.root` / `parent.appendChild()`.
76
+ */
77
+ mount(parent) {
78
+ parent.appendChild(this._el);
69
79
  return this;
70
80
  }
71
81
  get root() {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/index.ts", "../../../src/device.ts", "../../../src/domino.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport { mx } from '@dxos/ui-theme';\nexport type { ThemedClassName } from '@dxos/ui-types';\n\nexport * from './device';\nexport * from './domino';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport const hasIosKeyboard = () => {\n // TODO(thure): UA sniffing is never good, however I haven’t found a better way to query for whether the on-screen keyboard will appear on `focus` outside of a click handler.\n return !!navigator.userAgent.match(/(iPad|iPod|iPhone).+Safari/);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { mx } from '@dxos/ui-theme';\nimport { type ClassNameValue } from '@dxos/ui-types';\n\n// From icon-plugin.\nconst ICONS_URL = '/icons.svg';\n\n/**\n * Super lightweight chainable DOM builder.\n */\nexport class Domino<T extends HTMLElement | SVGElement> {\n static SVG = 'http://www.w3.org/2000/svg';\n\n // TODO(burdon): Make private.\n static icon = (icon: string) => ICONS_URL + '#' + icon;\n\n /**\n * Creates an SVG icon element from the icon sprite sheet.\n */\n // TODO(burdon): Rename icon.\n static svg = (icon: string) =>\n Domino.of('svg', Domino.SVG)\n .classNames('shrink-0 h-[1em] w-[1em]')\n .attributes({ viewBox: '0 0 256 256' })\n .children(Domino.of('use', Domino.SVG).attributes({ href: Domino.icon(icon) }));\n\n /**\n * Create builder from DOM node.\n */\n static of<K extends keyof HTMLElementTagNameMap>(tag: K): Domino<HTMLElementTagNameMap[K]>;\n static of<K extends keyof SVGElementTagNameMap>(tag: K, namespace: string): Domino<SVGElementTagNameMap[K]>;\n static of(tag: string, namespace?: string): Domino<HTMLElement | SVGElement> {\n return new Domino(tag, namespace);\n }\n\n private readonly _el: T;\n\n private constructor(tag: string, namespace?: string) {\n if (namespace) {\n this._el = document.createElementNS(namespace, tag) as T;\n } else {\n this._el = document.createElement(tag) as T;\n }\n }\n\n classNames(...classNames: ClassNameValue[]): this {\n const merged = mx(classNames);\n if (this._el instanceof HTMLElement || this._el instanceof SVGElement) {\n this._el.setAttribute('class', merged);\n }\n return this;\n }\n\n text(value: string): this {\n this._el.textContent = value;\n return this;\n }\n\n data(key: string, value: string): this {\n if (this._el instanceof HTMLElement) {\n this._el.dataset[key] = value;\n }\n return this;\n }\n\n attributes(attr: Record<string, string | undefined>): this {\n Object.entries(attr)\n .filter(([_, value]) => value !== undefined)\n .map(([key, value]) => this._el.setAttribute(key, value!));\n return this;\n }\n\n style(styles: Partial<CSSStyleDeclaration>): this {\n Object.assign(this._el.style, styles);\n return this;\n }\n\n children<C extends HTMLElement | SVGElement>(...children: Domino<C>[]): this {\n children.forEach((child) => this._el.appendChild(child.root));\n return this;\n }\n\n on(event: string, handler: (e: Event) => void): this {\n this._el.addEventListener(event, handler);\n return this;\n }\n\n get root(): T {\n return this._el;\n }\n}\n"],
5
- "mappings": ";;;AAIA,SAASA,MAAAA,WAAU;;;ACAZ,IAAMC,iBAAiB,MAAA;AAE5B,SAAO,CAAC,CAACC,UAAUC,UAAUC,MAAM,4BAAA;AACrC;;;ACHA,SAASC,UAAU;AAInB,IAAMC,YAAY;AAKX,IAAMC,SAAN,MAAMA,QAAAA;EACX,OAAOC,MAAM;;EAGb,OAAOC,OAAO,CAACA,SAAiBH,YAAY,MAAMG;;;;;EAMlD,OAAOC,MAAM,CAACD,SACZF,QAAOI,GAAG,OAAOJ,QAAOC,GAAG,EACxBI,WAAW,0BAAA,EACXC,WAAW;IAAEC,SAAS;EAAc,CAAA,EACpCC,SAASR,QAAOI,GAAG,OAAOJ,QAAOC,GAAG,EAAEK,WAAW;IAAEG,MAAMT,QAAOE,KAAKA,IAAAA;EAAM,CAAA,CAAA;EAOhF,OAAOE,GAAGM,KAAaC,WAAsD;AAC3E,WAAO,IAAIX,QAAOU,KAAKC,SAAAA;EACzB;EAEiBC;EAEjB,YAAoBF,KAAaC,WAAoB;AACnD,QAAIA,WAAW;AACb,WAAKC,MAAMC,SAASC,gBAAgBH,WAAWD,GAAAA;IACjD,OAAO;AACL,WAAKE,MAAMC,SAASE,cAAcL,GAAAA;IACpC;EACF;EAEAL,cAAcA,YAAoC;AAChD,UAAMW,SAASC,GAAGZ,UAAAA;AAClB,QAAI,KAAKO,eAAeM,eAAe,KAAKN,eAAeO,YAAY;AACrE,WAAKP,IAAIQ,aAAa,SAASJ,MAAAA;IACjC;AACA,WAAO;EACT;EAEAK,KAAKC,OAAqB;AACxB,SAAKV,IAAIW,cAAcD;AACvB,WAAO;EACT;EAEAE,KAAKC,KAAaH,OAAqB;AACrC,QAAI,KAAKV,eAAeM,aAAa;AACnC,WAAKN,IAAIc,QAAQD,GAAAA,IAAOH;IAC1B;AACA,WAAO;EACT;EAEAhB,WAAWqB,MAAgD;AACzDC,WAAOC,QAAQF,IAAAA,EACZG,OAAO,CAAC,CAACC,GAAGT,KAAAA,MAAWA,UAAUU,MAAAA,EACjCC,IAAI,CAAC,CAACR,KAAKH,KAAAA,MAAW,KAAKV,IAAIQ,aAAaK,KAAKH,KAAAA,CAAAA;AACpD,WAAO;EACT;EAEAY,MAAMC,QAA4C;AAChDP,WAAOQ,OAAO,KAAKxB,IAAIsB,OAAOC,MAAAA;AAC9B,WAAO;EACT;EAEA3B,YAAgDA,UAA6B;AAC3EA,aAAS6B,QAAQ,CAACC,UAAU,KAAK1B,IAAI2B,YAAYD,MAAME,IAAI,CAAA;AAC3D,WAAO;EACT;EAEAC,GAAGC,OAAeC,SAAmC;AACnD,SAAK/B,IAAIgC,iBAAiBF,OAAOC,OAAAA;AACjC,WAAO;EACT;EAEA,IAAIH,OAAU;AACZ,WAAO,KAAK5B;EACd;AACF;",
6
- "names": ["mx", "hasIosKeyboard", "navigator", "userAgent", "match", "mx", "ICONS_URL", "Domino", "SVG", "icon", "svg", "of", "classNames", "attributes", "viewBox", "children", "href", "tag", "namespace", "_el", "document", "createElementNS", "createElement", "merged", "mx", "HTMLElement", "SVGElement", "setAttribute", "text", "value", "textContent", "data", "key", "dataset", "attr", "Object", "entries", "filter", "_", "undefined", "map", "style", "styles", "assign", "forEach", "child", "appendChild", "root", "on", "event", "handler", "addEventListener"]
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport { mx } from '@dxos/ui-theme';\nexport type { ThemedClassName } from '@dxos/ui-types';\n\nexport * from './device';\nexport * from './domino';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport const hasIosKeyboard = () => {\n // TODO(thure): UA sniffing is never good, however I haven’t found a better way to query for whether the on-screen keyboard will appear on `focus` outside of a click handler.\n return !!navigator.userAgent.match(/(iPad|iPod|iPhone).+Safari/);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { mx } from '@dxos/ui-theme';\nimport { type ClassNameValue } from '@dxos/ui-types';\n\n/**\n * Base URL of the icon sprite sheet emitted by `@dxos/vite-plugin-icons`.\n * Defaults to `/icons.svg` which works inside hosted apps served at the\n * site root. Callers running in a different origin context (e.g. browser\n * extensions that inject into arbitrary pages) can override by assigning\n * `Domino.iconsUrl` before first use.\n */\nconst DEFAULT_ICONS_URL = '/icons.svg';\n\n/**\n * Super lightweight chainable DOM builder.\n */\nexport class Domino<T extends HTMLElement | SVGElement> {\n static SVG = 'http://www.w3.org/2000/svg';\n\n /** Overridable at module level so `Domino.svg()` can resolve from any origin. */\n static iconsUrl: string = DEFAULT_ICONS_URL;\n\n // TODO(burdon): Make private.\n static icon = (icon: string) => Domino.iconsUrl + '#' + icon;\n\n /**\n * Creates an SVG icon element from the icon sprite sheet.\n */\n // TODO(burdon): Rename icon.\n static svg = (icon: string) =>\n Domino.of('svg', Domino.SVG)\n .classNames('shrink-0 h-[1em] w-[1em]')\n .attributes({ viewBox: '0 0 256 256' })\n .append(Domino.of('use', Domino.SVG).attributes({ href: Domino.icon(icon) }));\n\n /**\n * Create builder from DOM node.\n */\n static of<K extends keyof HTMLElementTagNameMap>(tag: K): Domino<HTMLElementTagNameMap[K]>;\n static of<K extends keyof SVGElementTagNameMap>(tag: K, namespace: string): Domino<SVGElementTagNameMap[K]>;\n static of(tag: string, namespace?: string): Domino<HTMLElement | SVGElement> {\n return new Domino(tag, namespace);\n }\n\n private readonly _el: T;\n\n private constructor(tag: string, namespace?: string) {\n if (namespace) {\n this._el = document.createElementNS(namespace, tag) as T;\n } else {\n this._el = document.createElement(tag) as T;\n }\n }\n\n classNames(...classNames: ClassNameValue[]): this {\n const merged = mx(classNames);\n if (this._el instanceof HTMLElement || this._el instanceof SVGElement) {\n this._el.setAttribute('class', merged);\n }\n return this;\n }\n\n text(value: string): this {\n this._el.textContent = value;\n return this;\n }\n\n data(key: string, value: string): this {\n if (this._el instanceof HTMLElement) {\n this._el.dataset[key] = value;\n }\n return this;\n }\n\n attributes(attr: Record<string, string | undefined>): this {\n Object.entries(attr)\n .filter(([_, value]) => value !== undefined)\n .map(([key, value]) => this._el.setAttribute(key, value!));\n return this;\n }\n\n style(styles: Partial<CSSStyleDeclaration>): this {\n Object.assign(this._el.style, styles);\n return this;\n }\n\n append<C extends HTMLElement | SVGElement>(...children: Domino<C>[]): this {\n children.forEach((child) => this._el.appendChild(child.root));\n return this;\n }\n\n /**\n * Typed event listener. Accepts the standard `AddEventListenerOptions`\n * third argument so callers can opt into `capture`, `once`, `passive`.\n */\n on<K extends keyof HTMLElementEventMap>(\n event: K,\n handler: (e: HTMLElementEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions,\n ): this;\n on(event: string, handler: (e: Event) => void, options?: boolean | AddEventListenerOptions): this;\n on(event: string, handler: (e: Event) => void, options?: boolean | AddEventListenerOptions): this {\n this._el.addEventListener(event, handler, options);\n return this;\n }\n\n /**\n * Convenience for attaching the root element to a parent node — useful at\n * the end of a chain to avoid a trailing `.root` / `parent.appendChild()`.\n */\n mount(parent: Node): this {\n parent.appendChild(this._el);\n return this;\n }\n\n get root(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,QAAQF,IAAAA,EACZG,OAAO,CAAC,CAACC,GAAGT,KAAAA,MAAWA,UAAUU,MAAAA,EACjCC,IAAI,CAAC,CAACR,KAAKH,KAAAA,MAAW,KAAKT,IAAIO,aAAaK,KAAKH,KAAAA,CAAAA;AACpD,WAAO;EACT;EAEAY,MAAMC,QAA4C;AAChDP,WAAOQ,OAAO,KAAKvB,IAAIqB,OAAOC,MAAAA;AAC9B,WAAO;EACT;EAEA1B,UAA8C4B,UAA6B;AACzEA,aAASC,QAAQ,CAACC,UAAU,KAAK1B,IAAI2B,YAAYD,MAAME,IAAI,CAAA;AAC3D,WAAO;EACT;EAYAC,GAAGC,OAAeC,SAA6BC,SAAmD;AAChG,SAAKhC,IAAIiC,iBAAiBH,OAAOC,SAASC,OAAAA;AAC1C,WAAO;EACT;;;;;EAMAE,MAAMC,QAAoB;AACxBA,WAAOR,YAAY,KAAK3B,GAAG;AAC3B,WAAO;EACT;EAEA,IAAI4B,OAAU;AACZ,WAAO,KAAK5B;EACd;AACF;",
6
+ "names": ["mx", "hasIosKeyboard", "navigator", "userAgent", "match", "mx", "DEFAULT_ICONS_URL", "Domino", "SVG", "iconsUrl", "icon", "svg", "of", "classNames", "attributes", "viewBox", "append", "href", "tag", "namespace", "_el", "document", "createElementNS", "createElement", "merged", "HTMLElement", "SVGElement", "setAttribute", "text", "value", "textContent", "data", "key", "dataset", "attr", "Object", "entries", "filter", "_", "undefined", "map", "style", "styles", "assign", "children", "forEach", "child", "appendChild", "root", "on", "event", "handler", "options", "addEventListener", "mount", "parent"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/device.ts":{"bytes":1228,"imports":[],"format":"esm"},"src/domino.ts":{"bytes":8647,"imports":[{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":730,"imports":[{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"src/device.ts","kind":"import-statement","original":"./device"},{"path":"src/domino.ts","kind":"import-statement","original":"./domino"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5361},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"exports":["Domino","hasIosKeyboard","mx"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":44},"src/device.ts":{"bytesInOutput":100},"src/domino.ts":{"bytesInOutput":1728}},"bytes":2104}}}
1
+ {"inputs":{"src/device.ts":{"bytes":1162,"imports":[],"format":"esm"},"src/domino.ts":{"bytes":11242,"imports":[{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":665,"imports":[{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"src/device.ts","kind":"import-statement","original":"./device"},{"path":"src/domino.ts","kind":"import-statement","original":"./domino"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6755},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"exports":["Domino","hasIosKeyboard","mx"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":44},"src/device.ts":{"bytesInOutput":100},"src/domino.ts":{"bytesInOutput":2119}},"bytes":2495}}}
@@ -4,6 +4,8 @@ import { type ClassNameValue } from '@dxos/ui-types';
4
4
  */
5
5
  export declare class Domino<T extends HTMLElement | SVGElement> {
6
6
  static SVG: string;
7
+ /** Overridable at module level so `Domino.svg()` can resolve from any origin. */
8
+ static iconsUrl: string;
7
9
  static icon: (icon: string) => string;
8
10
  /**
9
11
  * Creates an SVG icon element from the icon sprite sheet.
@@ -21,8 +23,18 @@ export declare class Domino<T extends HTMLElement | SVGElement> {
21
23
  data(key: string, value: string): this;
22
24
  attributes(attr: Record<string, string | undefined>): this;
23
25
  style(styles: Partial<CSSStyleDeclaration>): this;
24
- children<C extends HTMLElement | SVGElement>(...children: Domino<C>[]): this;
25
- on(event: string, handler: (e: Event) => void): this;
26
+ append<C extends HTMLElement | SVGElement>(...children: Domino<C>[]): this;
27
+ /**
28
+ * Typed event listener. Accepts the standard `AddEventListenerOptions`
29
+ * third argument so callers can opt into `capture`, `once`, `passive`.
30
+ */
31
+ on<K extends keyof HTMLElementEventMap>(event: K, handler: (e: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): this;
32
+ on(event: string, handler: (e: Event) => void, options?: boolean | AddEventListenerOptions): this;
33
+ /**
34
+ * Convenience for attaching the root element to a parent node — useful at
35
+ * the end of a chain to avoid a trailing `.root` / `parent.appendChild()`.
36
+ */
37
+ mount(parent: Node): this;
26
38
  get root(): T;
27
39
  }
28
40
  //# sourceMappingURL=domino.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"domino.d.ts","sourceRoot":"","sources":["../../../src/domino.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAKrD;;GAEG;AACH,qBAAa,MAAM,CAAC,CAAC,SAAS,WAAW,GAAG,UAAU;IACpD,MAAM,CAAC,GAAG,SAAgC;IAG1C,MAAM,CAAC,IAAI,GAAI,MAAM,MAAM,YAA4B;IAEvD;;OAEG;IAEH,MAAM,CAAC,GAAG,GAAI,MAAM,MAAM,2BAI0D;IAEpF;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAC1F,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,MAAM,oBAAoB,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAK3G,OAAO,CAAC,QAAQ,CA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