@dxos/ui 0.8.4-main.bc674ce → 0.8.4-main.bd9b33e6c8
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 +10 -0
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +10 -0
- 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 +7 -0
- package/dist/types/src/domino.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/domino.ts +14 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/ui",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.bd9b33e6c8",
|
|
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.
|
|
33
|
-
"@dxos/ui-types": "0.8.4-main.
|
|
32
|
+
"@dxos/ui-theme": "0.8.4-main.bd9b33e6c8",
|
|
33
|
+
"@dxos/ui-types": "0.8.4-main.bd9b33e6c8"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
package/src/domino.ts
CHANGED
|
@@ -14,8 +14,22 @@ const ICONS_URL = '/icons.svg';
|
|
|
14
14
|
export class Domino<T extends HTMLElement | SVGElement> {
|
|
15
15
|
static SVG = 'http://www.w3.org/2000/svg';
|
|
16
16
|
|
|
17
|
+
// TODO(burdon): Make private.
|
|
17
18
|
static icon = (icon: string) => ICONS_URL + '#' + icon;
|
|
18
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Creates an SVG icon element from the icon sprite sheet.
|
|
22
|
+
*/
|
|
23
|
+
// TODO(burdon): Rename icon.
|
|
24
|
+
static svg = (icon: string) =>
|
|
25
|
+
Domino.of('svg', Domino.SVG)
|
|
26
|
+
.classNames('shrink-0 h-[1em] w-[1em]')
|
|
27
|
+
.attributes({ viewBox: '0 0 256 256' })
|
|
28
|
+
.children(Domino.of('use', Domino.SVG).attributes({ href: Domino.icon(icon) }));
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Create builder from DOM node.
|
|
32
|
+
*/
|
|
19
33
|
static of<K extends keyof HTMLElementTagNameMap>(tag: K): Domino<HTMLElementTagNameMap[K]>;
|
|
20
34
|
static of<K extends keyof SVGElementTagNameMap>(tag: K, namespace: string): Domino<SVGElementTagNameMap[K]>;
|
|
21
35
|
static of(tag: string, namespace?: string): Domino<HTMLElement | SVGElement> {
|