@dxos/ui 0.8.4-main.d05673bc65 → 0.8.4-main.dfabb4ec29
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/dist/lib/browser/index.mjs +18 -6
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +18 -6
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/domino.d.ts +14 -2
- package/dist/types/src/domino.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -6
- package/src/domino.test.ts +29 -1
- package/src/domino.ts +37 -7
|
@@ -8,16 +8,20 @@ var hasIosKeyboard = () => {
|
|
|
8
8
|
|
|
9
9
|
// src/domino.ts
|
|
10
10
|
import { mx } from "@dxos/ui-theme";
|
|
11
|
-
var
|
|
11
|
+
var DEFAULT_ICONS_URL = "/icons.svg";
|
|
12
12
|
var Domino = class _Domino {
|
|
13
13
|
static SVG = "http://www.w3.org/2000/svg";
|
|
14
|
-
|
|
14
|
+
/** Overridable at module level so `Domino.svg()` can resolve from any origin. */
|
|
15
|
+
static iconsUrl = DEFAULT_ICONS_URL;
|
|
16
|
+
// TODO(burdon): Make private.
|
|
17
|
+
static icon = (icon) => _Domino.iconsUrl + "#" + icon;
|
|
15
18
|
/**
|
|
16
19
|
* Creates an SVG icon element from the icon sprite sheet.
|
|
17
20
|
*/
|
|
21
|
+
// TODO(burdon): Rename icon.
|
|
18
22
|
static svg = (icon) => _Domino.of("svg", _Domino.SVG).classNames("shrink-0 h-[1em] w-[1em]").attributes({
|
|
19
23
|
viewBox: "0 0 256 256"
|
|
20
|
-
}).
|
|
24
|
+
}).append(_Domino.of("use", _Domino.SVG).attributes({
|
|
21
25
|
href: _Domino.icon(icon)
|
|
22
26
|
}));
|
|
23
27
|
static of(tag, namespace) {
|
|
@@ -56,12 +60,20 @@ var Domino = class _Domino {
|
|
|
56
60
|
Object.assign(this._el.style, styles);
|
|
57
61
|
return this;
|
|
58
62
|
}
|
|
59
|
-
|
|
63
|
+
append(...children) {
|
|
60
64
|
children.forEach((child) => this._el.appendChild(child.root));
|
|
61
65
|
return this;
|
|
62
66
|
}
|
|
63
|
-
on(event, handler) {
|
|
64
|
-
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);
|
|
65
77
|
return this;
|
|
66
78
|
}
|
|
67
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
|
|
5
|
-
"mappings": ";AAIA,SAASA,MAAAA,WAAU;;;ACAZ,IAAMC,iBAAiB,MAAA;AAE5B,SAAO,CAAC,CAACC,UAAUC,UAAUC,MAAM,4BAAA;AACrC;;;ACHA,SAASC,UAAU;
|
|
6
|
-
"names": ["mx", "hasIosKeyboard", "navigator", "userAgent", "match", "mx", "
|
|
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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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":
|
|
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,16 +10,20 @@ var hasIosKeyboard = () => {
|
|
|
10
10
|
|
|
11
11
|
// src/domino.ts
|
|
12
12
|
import { mx } from "@dxos/ui-theme";
|
|
13
|
-
var
|
|
13
|
+
var DEFAULT_ICONS_URL = "/icons.svg";
|
|
14
14
|
var Domino = class _Domino {
|
|
15
15
|
static SVG = "http://www.w3.org/2000/svg";
|
|
16
|
-
|
|
16
|
+
/** Overridable at module level so `Domino.svg()` can resolve from any origin. */
|
|
17
|
+
static iconsUrl = DEFAULT_ICONS_URL;
|
|
18
|
+
// TODO(burdon): Make private.
|
|
19
|
+
static icon = (icon) => _Domino.iconsUrl + "#" + icon;
|
|
17
20
|
/**
|
|
18
21
|
* Creates an SVG icon element from the icon sprite sheet.
|
|
19
22
|
*/
|
|
23
|
+
// TODO(burdon): Rename icon.
|
|
20
24
|
static svg = (icon) => _Domino.of("svg", _Domino.SVG).classNames("shrink-0 h-[1em] w-[1em]").attributes({
|
|
21
25
|
viewBox: "0 0 256 256"
|
|
22
|
-
}).
|
|
26
|
+
}).append(_Domino.of("use", _Domino.SVG).attributes({
|
|
23
27
|
href: _Domino.icon(icon)
|
|
24
28
|
}));
|
|
25
29
|
static of(tag, namespace) {
|
|
@@ -58,12 +62,20 @@ var Domino = class _Domino {
|
|
|
58
62
|
Object.assign(this._el.style, styles);
|
|
59
63
|
return this;
|
|
60
64
|
}
|
|
61
|
-
|
|
65
|
+
append(...children) {
|
|
62
66
|
children.forEach((child) => this._el.appendChild(child.root));
|
|
63
67
|
return this;
|
|
64
68
|
}
|
|
65
|
-
on(event, handler) {
|
|
66
|
-
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);
|
|
67
79
|
return this;
|
|
68
80
|
}
|
|
69
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
|
|
5
|
-
"mappings": ";;;AAIA,SAASA,MAAAA,WAAU;;;ACAZ,IAAMC,iBAAiB,MAAA;AAE5B,SAAO,CAAC,CAACC,UAAUC,UAAUC,MAAM,4BAAA;AACrC;;;ACHA,SAASC,UAAU;
|
|
6
|
-
"names": ["mx", "hasIosKeyboard", "navigator", "userAgent", "match", "mx", "
|
|
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,SAAi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AASC,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":
|
|
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
|
-
|
|
25
|
-
|
|
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,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