@dxos/lit-ui 0.8.4-main.ae835ea → 0.8.4-main.bc674ce
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/src/dx-anchor/dx-anchor.js +1 -1
- package/dist/src/dx-anchor/dx-anchor.js.map +1 -1
- package/dist/src/dx-avatar/dx-avatar.d.ts +1 -1
- package/dist/src/dx-avatar/dx-avatar.d.ts.map +1 -1
- package/dist/src/dx-avatar/dx-avatar.js +11 -7
- package/dist/src/dx-avatar/dx-avatar.js.map +1 -1
- package/dist/src/dx-avatar/dx-avatar.lit-stories.d.ts.map +1 -1
- package/dist/src/dx-avatar/dx-avatar.lit-stories.js +3 -1
- package/dist/src/dx-avatar/dx-avatar.lit-stories.js.map +1 -1
- package/dist/src/react.d.ts +1 -1
- package/dist/src/react.d.ts.map +1 -1
- package/dist/src/react.js +2 -1
- package/dist/src/react.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -12
- package/src/defs.ts +1 -1
- package/src/dx-anchor/dx-anchor.ts +1 -1
- package/src/dx-avatar/dx-avatar.lit-stories.ts +3 -1
- package/src/dx-avatar/dx-avatar.pcss +1 -1
- package/src/dx-avatar/dx-avatar.ts +13 -8
- package/src/react.ts +2 -2
package/package.json
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/lit-ui",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.bc674ce",
|
|
4
4
|
"description": "Web Components for DXOS using Lit",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
|
-
"sideEffects":
|
|
13
|
+
"sideEffects": [
|
|
14
|
+
"*.css",
|
|
15
|
+
"*.pcss"
|
|
16
|
+
],
|
|
10
17
|
"type": "module",
|
|
11
18
|
"exports": {
|
|
12
19
|
".": {
|
|
13
|
-
"source": "./src/index.ts",
|
|
14
20
|
"types": "./dist/src/index.d.ts",
|
|
15
|
-
"
|
|
16
|
-
"node": "./dist/src/index.js"
|
|
21
|
+
"default": "./dist/src/index.js"
|
|
17
22
|
},
|
|
18
23
|
"./react": {
|
|
19
|
-
"source": "./src/react.ts",
|
|
20
24
|
"types": "./dist/src/react.d.ts",
|
|
21
|
-
"
|
|
22
|
-
"node": "./dist/src/react.js"
|
|
25
|
+
"default": "./dist/src/react.js"
|
|
23
26
|
},
|
|
24
27
|
"./dx-avatar.pcss": "./src/dx-avatar/dx-avatar.pcss",
|
|
25
28
|
"./dx-tag-picker.pcss": "./src/dx-tag-picker/dx-tag-picker.pcss"
|
|
@@ -40,12 +43,12 @@
|
|
|
40
43
|
"dependencies": {
|
|
41
44
|
"@lit/react": "^1.0.8",
|
|
42
45
|
"lit": "^3.3.1",
|
|
43
|
-
"@dxos/react-hooks": "0.8.4-main.
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/util": "0.8.4-main.
|
|
46
|
+
"@dxos/react-hooks": "0.8.4-main.bc674ce",
|
|
47
|
+
"@dxos/ui-types": "0.8.4-main.bc674ce",
|
|
48
|
+
"@dxos/util": "0.8.4-main.bc674ce"
|
|
46
49
|
},
|
|
47
50
|
"devDependencies": {
|
|
48
|
-
"@dxos/test-utils": "0.8.4-main.
|
|
51
|
+
"@dxos/test-utils": "0.8.4-main.bc674ce"
|
|
49
52
|
},
|
|
50
53
|
"publishConfig": {
|
|
51
54
|
"access": "public"
|
package/src/defs.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
// TODO(thure): I was unable to bring this in from `
|
|
5
|
+
// TODO(thure): I was unable to bring this in from `ui-types` because toolbox.ts would not acknowledge
|
|
6
6
|
// `"@dxos/lit-ui": [ "packages/ui/lit-ui/src/index.ts" ]` in tsconfig.paths.json. How is this meant to work? How is it
|
|
7
7
|
// okay with `react-hooks`?
|
|
8
8
|
export type Size =
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { LitElement } from 'lit';
|
|
9
9
|
import { customElement, property } from 'lit/decorators.js';
|
|
10
10
|
|
|
11
|
-
import { DxAnchorActivate } from '@dxos/
|
|
11
|
+
import { DxAnchorActivate } from '@dxos/ui-types';
|
|
12
12
|
|
|
13
13
|
@customElement('dx-anchor')
|
|
14
14
|
export class DxAnchor extends LitElement {
|
|
@@ -71,7 +71,7 @@ export class DxAvatar extends LitElement {
|
|
|
71
71
|
hue: string | undefined = undefined;
|
|
72
72
|
|
|
73
73
|
@property({ type: String })
|
|
74
|
-
hueVariant: 'fill' | 'surface' = 'fill';
|
|
74
|
+
hueVariant: 'fill' | 'surface' | 'transparent' = 'fill';
|
|
75
75
|
|
|
76
76
|
@property({ type: String })
|
|
77
77
|
size: Size = 10;
|
|
@@ -113,11 +113,14 @@ export class DxAvatar extends LitElement {
|
|
|
113
113
|
const r = sizePx / 2 - ringGap - ringWidth;
|
|
114
114
|
const isTextOnly = Boolean(this.fallback && /[0-9a-zA-Z]+/.test(this.fallback));
|
|
115
115
|
const fontScale = (isTextOnly ? 3 : 3.6) * (1 / 1.612);
|
|
116
|
-
const bg =
|
|
117
|
-
|
|
118
|
-
?
|
|
119
|
-
:
|
|
120
|
-
|
|
116
|
+
const bg =
|
|
117
|
+
this.hueVariant === 'transparent'
|
|
118
|
+
? 'transparent'
|
|
119
|
+
: this.hue
|
|
120
|
+
? this.hueVariant === 'surface'
|
|
121
|
+
? `var(--dx-${this.hue}Surface)`
|
|
122
|
+
: `var(--dx-${this.hue === 'neutral' ? 'inputSurface' : `${this.hue}Fill`})`
|
|
123
|
+
: 'var(--surface-bg)';
|
|
121
124
|
const fg =
|
|
122
125
|
this.hue && this.hueVariant === 'surface' ? `var(--dx-${this.hue}SurfaceText)` : 'var(--dx-accentSurfaceText)';
|
|
123
126
|
|
|
@@ -181,7 +184,8 @@ export class DxAvatar extends LitElement {
|
|
|
181
184
|
y=${sizePx / 5}
|
|
182
185
|
width=${(3 * sizePx) / 5}
|
|
183
186
|
height=${(3 * sizePx) / 5} />`
|
|
184
|
-
:
|
|
187
|
+
: // NOTE: Firefox currently doesn't fully support alignment-baseline.
|
|
188
|
+
svg`
|
|
185
189
|
<text
|
|
186
190
|
x="50%"
|
|
187
191
|
y="50%"
|
|
@@ -189,10 +193,11 @@ export class DxAvatar extends LitElement {
|
|
|
189
193
|
fill=${fg}
|
|
190
194
|
text-anchor="middle"
|
|
191
195
|
alignment-baseline="central"
|
|
196
|
+
dominant-baseline="middle"
|
|
192
197
|
font-size=${this.size === 'px' ? '200%' : this.size * fontScale}
|
|
193
198
|
mask=${`url(#${this.maskId})`}
|
|
194
199
|
>
|
|
195
|
-
${/\p{
|
|
200
|
+
${/\p{Emoji_Presentation}/u.test(this.fallback) ? this.fallback : getInitials(this.fallback)}
|
|
196
201
|
</text>`
|
|
197
202
|
}
|
|
198
203
|
${
|
package/src/react.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { type EventName, createComponent } from '@lit/react';
|
|
6
6
|
import React, { type ComponentPropsWithRef } from 'react';
|
|
7
7
|
|
|
8
|
-
import { type DxAnchorActivate } from '@dxos/
|
|
8
|
+
import { DX_ANCHOR_ACTIVATE, type DxAnchorActivate } from '@dxos/ui-types';
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
type DxTagPickerItemClick,
|
|
@@ -20,7 +20,7 @@ export const DxAnchor = createComponent({
|
|
|
20
20
|
elementClass: NaturalDxAnchor,
|
|
21
21
|
react: React,
|
|
22
22
|
events: {
|
|
23
|
-
onActivate:
|
|
23
|
+
onActivate: DX_ANCHOR_ACTIVATE as EventName<DxAnchorActivate>,
|
|
24
24
|
},
|
|
25
25
|
});
|
|
26
26
|
|