@dxos/ui 0.8.4-main.bc674ce → 0.8.4-main.c85a9c8dae

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/ui",
3
- "version": "0.8.4-main.bc674ce",
3
+ "version": "0.8.4-main.c85a9c8dae",
4
4
  "description": "Core UI.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -29,8 +29,8 @@
29
29
  "src"
30
30
  ],
31
31
  "dependencies": {
32
- "@dxos/ui-theme": "0.8.4-main.bc674ce",
33
- "@dxos/ui-types": "0.8.4-main.bc674ce"
32
+ "@dxos/ui-types": "0.8.4-main.c85a9c8dae",
33
+ "@dxos/ui-theme": "0.8.4-main.c85a9c8dae"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
package/src/domino.ts CHANGED
@@ -16,6 +16,18 @@ export class Domino<T extends HTMLElement | SVGElement> {
16
16
 
17
17
  static icon = (icon: string) => ICONS_URL + '#' + icon;
18
18
 
19
+ /**
20
+ * Creates an SVG icon element from the icon sprite sheet.
21
+ */
22
+ static svg = (icon: string) =>
23
+ Domino.of('svg', Domino.SVG)
24
+ .classNames('shrink-0 h-[1em] w-[1em]')
25
+ .attributes({ viewBox: '0 0 256 256' })
26
+ .children(Domino.of('use', Domino.SVG).attributes({ href: Domino.icon(icon) }));
27
+
28
+ /**
29
+ * Create builder from DOM node.
30
+ */
19
31
  static of<K extends keyof HTMLElementTagNameMap>(tag: K): Domino<HTMLElementTagNameMap[K]>;
20
32
  static of<K extends keyof SVGElementTagNameMap>(tag: K, namespace: string): Domino<SVGElementTagNameMap[K]>;
21
33
  static of(tag: string, namespace?: string): Domino<HTMLElement | SVGElement> {