@threadlabs/looma 0.21.2 → 0.21.4

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": "@threadlabs/looma",
3
- "version": "0.21.2",
3
+ "version": "0.21.4",
4
4
  "type": "module",
5
5
  "description": "Looma components as HTML, Vue, and plain DOM, with design tokens.",
6
6
  "license": "MIT",
@@ -36,6 +36,8 @@
36
36
  font: inherit;
37
37
  font-size: var(--ui-font-size-sm);
38
38
  font-weight: 600;
39
+ /* The initials centre in the circle wherever it sits, whatever line height surrounds it. */
40
+ line-height: 1;
39
41
  text-transform: uppercase;
40
42
  }
41
43
 
@@ -46,6 +48,15 @@
46
48
  font-size: var(--ui-font-size-xs);
47
49
  }
48
50
 
51
+ :scope[data-ui-avatar-state~="size=xs"] {
52
+ --_ui-default-icon-size: 0.75rem;
53
+ inline-size: 1.25rem;
54
+ block-size: 1.25rem;
55
+ /* Below the type scale on purpose: two initials need room inside a 1.25rem circle. */
56
+ font-size: calc(var(--ui-font-size) * 0.5625);
57
+ letter-spacing: 0.02em;
58
+ }
59
+
49
60
  :scope[data-ui-avatar-state~="hasImage"] {
50
61
  border-color: var(--ui-avatar-border, var(--ui-border-strong));
51
62
  }
@@ -12,7 +12,7 @@ export interface UiAvatarProps {
12
12
  fallback?: string | null;
13
13
  name?: string | null;
14
14
  shape?: "circle" | "square" | null;
15
- size?: "sm" | "md" | null;
15
+ size?: "xs" | "sm" | "md" | null;
16
16
  src?: string | null;
17
17
  attributes?: Readonly<Record<string, string | number | boolean | null | undefined>>;
18
18
  children?: readonly (string | Node)[];
@@ -3,7 +3,7 @@ import { manageComponentLifecycle } from "@nextwebwg/html-next/runtime";
3
3
  import * as controller from "../components/ui-avatar/ui-avatar.js";
4
4
  import "../styles/ui-avatar.css";
5
5
 
6
- const definition = {...{"contract":{"tag":"ui-avatar","props":{"active":{"type":"boolean","required":false,"target":{"attribute":"active"},"default":false},"alt":{"type":"string","required":false,"target":{"attribute":"alt"},"default":""},"decorative":{"type":"boolean","required":false,"target":{"attribute":"decorative"},"default":false},"fallback":{"type":"string","required":false,"target":{"attribute":"fallback"},"default":""},"name":{"type":"string","required":false,"target":{"attribute":"name"},"default":""},"shape":{"type":{"kind":"terminal","name":"keyword"},"values":["circle","square"],"required":false,"target":{"attribute":"shape"},"default":"circle"},"size":{"type":{"kind":"terminal","name":"keyword"},"values":["sm","md"],"required":false,"target":{"attribute":"size"},"default":"md"},"src":{"type":"string","required":false,"target":{"attribute":"src"}}}},"template":{"kind":"element","name":"span","attributes":[],"children":[{"kind":"slot"},{"kind":"element","name":"img","attributes":[{"kind":"literal","name":"class","value":"image"},{"kind":"attribute","name":"src","expression":"src","expressionPlan":{"source":"src","ast":{"kind":"id","name":"src"},"dependencies":["src"]}},{"kind":"literal","name":"alt","value":""},{"kind":"literal","name":"aria-hidden","value":"true"},{"kind":"attribute","name":"hidden","expression":"hasAuthoredImage or not hasImage","expressionPlan":{"source":"hasAuthoredImage or not hasImage","ast":{"kind":"binary","op":"or","left":{"kind":"id","name":"hasAuthoredImage"},"right":{"kind":"unary","op":"not","operand":{"kind":"id","name":"hasImage"}}},"dependencies":["hasAuthoredImage","hasImage"]}}],"children":[],"ref":"image"},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"fallback"},{"kind":"attribute","name":"aria-hidden","expression":"hasImage","expressionPlan":{"source":"hasImage","ast":{"kind":"id","name":"hasImage"},"dependencies":["hasImage"]}},{"kind":"attribute","name":"hidden","expression":"hasImage","expressionPlan":{"source":"hasImage","ast":{"kind":"id","name":"hasImage"},"dependencies":["hasImage"]}}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"attribute","name":"hidden","expression":"showGlyph","expressionPlan":{"source":"showGlyph","ast":{"kind":"id","name":"showGlyph"},"dependencies":["showGlyph"]}},{"kind":"directive","name":"value","expression":"initials","expressionPlan":{"source":"initials","ast":{"kind":"id","name":"initials"},"dependencies":["initials"]}}],"children":[]},{"kind":"element","name":"span","attributes":[{"kind":"attribute","name":"hidden","expression":"not showGlyph","expressionPlan":{"source":"not showGlyph","ast":{"kind":"unary","op":"not","operand":{"kind":"id","name":"showGlyph"}},"dependencies":["showGlyph"]}}],"children":[{"kind":"element","name":"ui-icon","attributes":[{"kind":"literal","name":"name","value":"user-round"}],"children":[]}]}]}]},"declarations":[{"kind":"state","name":"hasImage","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"state","name":"hasAuthoredImage","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"state","name":"initials","expression":{"source":"'?'","ast":{"kind":"literal","value":"?"},"dependencies":[]}},{"kind":"state","name":"showGlyph","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}}],"root":{"kind":"native","element":"span","choices":["span"]}},source:{file:import.meta.url},css:""};
6
+ const definition = {...{"contract":{"tag":"ui-avatar","props":{"active":{"type":"boolean","required":false,"target":{"attribute":"active"},"default":false},"alt":{"type":"string","required":false,"target":{"attribute":"alt"},"default":""},"decorative":{"type":"boolean","required":false,"target":{"attribute":"decorative"},"default":false},"fallback":{"type":"string","required":false,"target":{"attribute":"fallback"},"default":""},"name":{"type":"string","required":false,"target":{"attribute":"name"},"default":""},"shape":{"type":{"kind":"terminal","name":"keyword"},"values":["circle","square"],"required":false,"target":{"attribute":"shape"},"default":"circle"},"size":{"type":{"kind":"terminal","name":"keyword"},"values":["xs","sm","md"],"required":false,"target":{"attribute":"size"},"default":"md"},"src":{"type":"string","required":false,"target":{"attribute":"src"}}}},"template":{"kind":"element","name":"span","attributes":[],"children":[{"kind":"slot"},{"kind":"element","name":"img","attributes":[{"kind":"literal","name":"class","value":"image"},{"kind":"attribute","name":"src","expression":"src","expressionPlan":{"source":"src","ast":{"kind":"id","name":"src"},"dependencies":["src"]}},{"kind":"literal","name":"alt","value":""},{"kind":"literal","name":"aria-hidden","value":"true"},{"kind":"attribute","name":"hidden","expression":"hasAuthoredImage or not hasImage","expressionPlan":{"source":"hasAuthoredImage or not hasImage","ast":{"kind":"binary","op":"or","left":{"kind":"id","name":"hasAuthoredImage"},"right":{"kind":"unary","op":"not","operand":{"kind":"id","name":"hasImage"}}},"dependencies":["hasAuthoredImage","hasImage"]}}],"children":[],"ref":"image"},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"fallback"},{"kind":"attribute","name":"aria-hidden","expression":"hasImage","expressionPlan":{"source":"hasImage","ast":{"kind":"id","name":"hasImage"},"dependencies":["hasImage"]}},{"kind":"attribute","name":"hidden","expression":"hasImage","expressionPlan":{"source":"hasImage","ast":{"kind":"id","name":"hasImage"},"dependencies":["hasImage"]}}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"attribute","name":"hidden","expression":"showGlyph","expressionPlan":{"source":"showGlyph","ast":{"kind":"id","name":"showGlyph"},"dependencies":["showGlyph"]}},{"kind":"directive","name":"value","expression":"initials","expressionPlan":{"source":"initials","ast":{"kind":"id","name":"initials"},"dependencies":["initials"]}}],"children":[]},{"kind":"element","name":"span","attributes":[{"kind":"attribute","name":"hidden","expression":"not showGlyph","expressionPlan":{"source":"not showGlyph","ast":{"kind":"unary","op":"not","operand":{"kind":"id","name":"showGlyph"}},"dependencies":["showGlyph"]}}],"children":[{"kind":"element","name":"ui-icon","attributes":[{"kind":"literal","name":"name","value":"user-round"}],"children":[]}]}]}]},"declarations":[{"kind":"state","name":"hasImage","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"state","name":"hasAuthoredImage","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"state","name":"initials","expression":{"source":"'?'","ast":{"kind":"literal","value":"?"},"dependencies":[]}},{"kind":"state","name":"showGlyph","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}}],"root":{"kind":"native","element":"span","choices":["span"]}},source:{file:import.meta.url},css:""};
7
7
 
8
8
  export function createUiAvatar(options = {}) {
9
9
  const { attributes = {}, children = [], slots = {}, ...componentProps } = options;
package/vue/UiAvatar.d.ts CHANGED
@@ -29,7 +29,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
29
29
  default: string;
30
30
  };
31
31
  size: {
32
- type: PropType<"sm" | "md" | null>;
32
+ type: PropType<"xs" | "sm" | "md" | null>;
33
33
  default: string;
34
34
  };
35
35
  src: {
@@ -62,7 +62,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
62
62
  default: string;
63
63
  };
64
64
  size: {
65
- type: PropType<"sm" | "md" | null>;
65
+ type: PropType<"xs" | "sm" | "md" | null>;
66
66
  default: string;
67
67
  };
68
68
  src: {
@@ -76,7 +76,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
76
76
  active: boolean | null;
77
77
  decorative: boolean | null;
78
78
  fallback: string | null;
79
- size: "sm" | "md" | null;
79
+ size: "xs" | "sm" | "md" | null;
80
80
  src: string | null;
81
81
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
82
82
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
package/vue/UiAvatar.vue CHANGED
@@ -15,7 +15,7 @@ const props = defineProps({
15
15
  fallback: { type: null as unknown as PropType<string | null>, default: '' },
16
16
  name: { type: null as unknown as PropType<string | null>, default: '' },
17
17
  shape: { type: null as unknown as PropType<'circle' | 'square' | null>, default: 'circle' },
18
- size: { type: null as unknown as PropType<'sm' | 'md' | null>, default: 'md' },
18
+ size: { type: null as unknown as PropType<'xs' | 'sm' | 'md' | null>, default: 'md' },
19
19
  src: { type: null as unknown as PropType<string | null>, default: null },
20
20
  })
21
21
  const checkedProps = computed(() => ({
@@ -67,14 +67,14 @@ const checkedProps = computed(() => ({
67
67
  undefined,
68
68
  ['circle', 'square'],
69
69
  ) as 'circle' | 'square',
70
- size: checkedProp<'sm' | 'md'>(
70
+ size: checkedProp<'xs' | 'sm' | 'md'>(
71
71
  props['size'],
72
72
  { kind: 'terminal', name: 'keyword' },
73
73
  false,
74
74
  'size',
75
75
  undefined,
76
- ['sm', 'md'],
77
- ) as 'sm' | 'md',
76
+ ['xs', 'sm', 'md'],
77
+ ) as 'xs' | 'sm' | 'md',
78
78
  src: checkedProp<string>(
79
79
  props['src'],
80
80
  { kind: 'terminal', name: 'string' },
@@ -239,6 +239,8 @@ useComponentHost(() => import('../components/ui-avatar/ui-avatar.js'), {
239
239
  font: inherit;
240
240
  font-size: var(--ui-font-size-sm);
241
241
  font-weight: 600;
242
+ /* The initials centre in the circle wherever it sits, whatever line height surrounds it. */
243
+ line-height: 1;
242
244
  text-transform: uppercase;
243
245
  }
244
246
 
@@ -249,6 +251,15 @@ useComponentHost(() => import('../components/ui-avatar/ui-avatar.js'), {
249
251
  font-size: var(--ui-font-size-xs);
250
252
  }
251
253
 
254
+ [data-component~="ui-avatar"][data-ui-avatar-state~="size=xs"] {
255
+ --_ui-default-icon-size: 0.75rem;
256
+ inline-size: 1.25rem;
257
+ block-size: 1.25rem;
258
+ /* Below the type scale on purpose: two initials need room inside a 1.25rem circle. */
259
+ font-size: calc(var(--ui-font-size) * 0.5625);
260
+ letter-spacing: 0.02em;
261
+ }
262
+
252
263
  [data-component~="ui-avatar"][data-ui-avatar-state~="hasImage"] {
253
264
  border-color: var(--ui-avatar-border, var(--ui-border-strong));
254
265
  }
@@ -41,7 +41,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
41
41
  align: "center" | "start" | "stretch" | "end" | null;
42
42
  gap: "s" | "xs" | "m" | "l" | "xl" | null;
43
43
  limit: number | null;
44
- threshold: "sm" | "md" | "lg" | "xs" | null;
44
+ threshold: "xs" | "sm" | "md" | "lg" | null;
45
45
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
46
46
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
47
47
  declare const _default: typeof __VLS_export;
package/vue/UiText.d.ts CHANGED
@@ -82,7 +82,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
82
82
  default: string;
83
83
  };
84
84
  }>> & Readonly<{}>, {
85
- size: "inherit" | "sm" | "md" | "lg" | "xs" | null;
85
+ size: "inherit" | "xs" | "sm" | "md" | "lg" | null;
86
86
  tone: "secondary" | "default" | "info" | "accent" | "success" | "warning" | "danger" | "muted" | null;
87
87
  variant: "code" | "body" | "eyebrow" | null;
88
88
  align: "center" | "start" | null;
@@ -88,7 +88,11 @@ var UiAvatar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
88
88
  size: checkedProp(props["size"], {
89
89
  kind: "terminal",
90
90
  name: "keyword"
91
- }, false, "size", void 0, ["sm", "md"]),
91
+ }, false, "size", void 0, [
92
+ "xs",
93
+ "sm",
94
+ "md"
95
+ ]),
92
96
  src: checkedProp(props["src"], {
93
97
  kind: "terminal",
94
98
  name: "string"
@@ -182,6 +186,6 @@ var UiAvatar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
182
186
  ], 16, _hoisted_1);
183
187
  };
184
188
  }
185
- }), [["__scopeId", "data-v-925a362e"]]);
189
+ }), [["__scopeId", "data-v-4934b13f"]]);
186
190
  //#endregion
187
191
  export { UiAvatar_default as t };
@@ -134,7 +134,7 @@ svg[data-v-fdb3ee4b] {
134
134
  syntax: "*";
135
135
  inherits: false;
136
136
  }
137
- [data-component~="ui-avatar"][data-v-925a362e] {
137
+ [data-component~="ui-avatar"][data-v-4934b13f] {
138
138
  --_ui-default-icon-size: 1.25rem;
139
139
  display: inline-grid;
140
140
  place-items: center;
@@ -152,34 +152,44 @@ svg[data-v-fdb3ee4b] {
152
152
  font: inherit;
153
153
  font-size: var(--ui-font-size-sm);
154
154
  font-weight: 600;
155
+ /* The initials centre in the circle wherever it sits, whatever line height surrounds it. */
156
+ line-height: 1;
155
157
  text-transform: uppercase;
156
158
  }
157
- [data-component~="ui-avatar"][data-ui-avatar-state~="size=sm"][data-v-925a362e] {
159
+ [data-component~="ui-avatar"][data-ui-avatar-state~="size=sm"][data-v-4934b13f] {
158
160
  --_ui-default-icon-size: 1rem;
159
161
  inline-size: 1.75rem;
160
162
  block-size: 1.75rem;
161
163
  font-size: var(--ui-font-size-xs);
162
164
  }
163
- [data-component~="ui-avatar"][data-ui-avatar-state~="hasImage"][data-v-925a362e] {
165
+ [data-component~="ui-avatar"][data-ui-avatar-state~="size=xs"][data-v-4934b13f] {
166
+ --_ui-default-icon-size: 0.75rem;
167
+ inline-size: 1.25rem;
168
+ block-size: 1.25rem;
169
+ /* Below the type scale on purpose: two initials need room inside a 1.25rem circle. */
170
+ font-size: calc(var(--ui-font-size) * 0.5625);
171
+ letter-spacing: 0.02em;
172
+ }
173
+ [data-component~="ui-avatar"][data-ui-avatar-state~="hasImage"][data-v-4934b13f] {
164
174
  border-color: var(--ui-avatar-border, var(--ui-border-strong));
165
175
  }
166
- [data-component~="ui-avatar"][data-ui-avatar-state~="shape=square"][data-v-925a362e] {
176
+ [data-component~="ui-avatar"][data-ui-avatar-state~="shape=square"][data-v-4934b13f] {
167
177
  border-radius: var(--ui-avatar-radius, var(--ui-radius-md));
168
178
  }
169
179
 
170
180
  /* An outline, not a dot: the avatar clips its content to the circle, and an outline is drawn
171
181
  outside the box, so the ring survives the clip and the overlap in an Avatar Group. */
172
- [data-component~="ui-avatar"][data-ui-avatar-state~="active"][data-v-925a362e] {
182
+ [data-component~="ui-avatar"][data-ui-avatar-state~="active"][data-v-4934b13f] {
173
183
  outline: 1px solid var(--ui-avatar-active-ring, var(--ui-accent-solid));
174
184
  outline-offset: 1px;
175
185
  }
176
- .image[data-v-925a362e],img[data-v-925a362e-s] {
186
+ .image[data-v-4934b13f],img[data-v-4934b13f-s] {
177
187
  grid-area: 1 / 1;
178
188
  inline-size: 100%;
179
189
  block-size: 100%;
180
190
  object-fit: cover;
181
191
  }
182
- .fallback[data-v-925a362e] {
192
+ .fallback[data-v-4934b13f] {
183
193
  grid-area: 1 / 1;
184
194
  display: inline-flex;
185
195
  align-items: center;
@@ -192,7 +202,7 @@ svg[data-v-fdb3ee4b] {
192
202
  /* Centre the glyphs, not the line box: a label without descenders otherwise reads high.
193
203
  * Trimming applies to block containers, so the box is a block with centred content. */
194
204
  @supports (text-box-trim: trim-both) {
195
- .fallback[data-v-925a362e] {
205
+ .fallback[data-v-4934b13f] {
196
206
  display: block;
197
207
  text-align: center;
198
208
  align-content: center;
@@ -200,12 +210,12 @@ svg[data-v-fdb3ee4b] {
200
210
  text-box-edge: cap alphabetic;
201
211
  }
202
212
  }
203
- [hidden][data-v-925a362e] {
213
+ [hidden][data-v-4934b13f] {
204
214
  display: none;
205
215
  }
206
216
 
207
217
  /* A component that sets its display still honours the hidden attribute on its root. */
208
- [data-component~="ui-avatar"][hidden][data-v-925a362e] {
218
+ [data-component~="ui-avatar"][hidden][data-v-4934b13f] {
209
219
  display: none;
210
220
  }
211
221