@threadlabs/looma 0.21.2 → 0.21.3

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.3",
4
4
  "type": "module",
5
5
  "description": "Looma components as HTML, Vue, and plain DOM, with design tokens.",
6
6
  "license": "MIT",
@@ -46,6 +46,13 @@
46
46
  font-size: var(--ui-font-size-xs);
47
47
  }
48
48
 
49
+ :scope[data-ui-avatar-state~="size=xs"] {
50
+ --_ui-default-icon-size: 0.75rem;
51
+ inline-size: 1.25rem;
52
+ block-size: 1.25rem;
53
+ font-size: var(--ui-font-size-2xs);
54
+ }
55
+
49
56
  :scope[data-ui-avatar-state~="hasImage"] {
50
57
  border-color: var(--ui-avatar-border, var(--ui-border-strong));
51
58
  }
@@ -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' },
@@ -249,6 +249,13 @@ useComponentHost(() => import('../components/ui-avatar/ui-avatar.js'), {
249
249
  font-size: var(--ui-font-size-xs);
250
250
  }
251
251
 
252
+ [data-component~="ui-avatar"][data-ui-avatar-state~="size=xs"] {
253
+ --_ui-default-icon-size: 0.75rem;
254
+ inline-size: 1.25rem;
255
+ block-size: 1.25rem;
256
+ font-size: var(--ui-font-size-2xs);
257
+ }
258
+
252
259
  [data-component~="ui-avatar"][data-ui-avatar-state~="hasImage"] {
253
260
  border-color: var(--ui-avatar-border, var(--ui-border-strong));
254
261
  }
@@ -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-42e2a578"]]);
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-42e2a578] {
138
138
  --_ui-default-icon-size: 1.25rem;
139
139
  display: inline-grid;
140
140
  place-items: center;
@@ -154,32 +154,38 @@ svg[data-v-fdb3ee4b] {
154
154
  font-weight: 600;
155
155
  text-transform: uppercase;
156
156
  }
157
- [data-component~="ui-avatar"][data-ui-avatar-state~="size=sm"][data-v-925a362e] {
157
+ [data-component~="ui-avatar"][data-ui-avatar-state~="size=sm"][data-v-42e2a578] {
158
158
  --_ui-default-icon-size: 1rem;
159
159
  inline-size: 1.75rem;
160
160
  block-size: 1.75rem;
161
161
  font-size: var(--ui-font-size-xs);
162
162
  }
163
- [data-component~="ui-avatar"][data-ui-avatar-state~="hasImage"][data-v-925a362e] {
163
+ [data-component~="ui-avatar"][data-ui-avatar-state~="size=xs"][data-v-42e2a578] {
164
+ --_ui-default-icon-size: 0.75rem;
165
+ inline-size: 1.25rem;
166
+ block-size: 1.25rem;
167
+ font-size: var(--ui-font-size-2xs);
168
+ }
169
+ [data-component~="ui-avatar"][data-ui-avatar-state~="hasImage"][data-v-42e2a578] {
164
170
  border-color: var(--ui-avatar-border, var(--ui-border-strong));
165
171
  }
166
- [data-component~="ui-avatar"][data-ui-avatar-state~="shape=square"][data-v-925a362e] {
172
+ [data-component~="ui-avatar"][data-ui-avatar-state~="shape=square"][data-v-42e2a578] {
167
173
  border-radius: var(--ui-avatar-radius, var(--ui-radius-md));
168
174
  }
169
175
 
170
176
  /* An outline, not a dot: the avatar clips its content to the circle, and an outline is drawn
171
177
  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] {
178
+ [data-component~="ui-avatar"][data-ui-avatar-state~="active"][data-v-42e2a578] {
173
179
  outline: 1px solid var(--ui-avatar-active-ring, var(--ui-accent-solid));
174
180
  outline-offset: 1px;
175
181
  }
176
- .image[data-v-925a362e],img[data-v-925a362e-s] {
182
+ .image[data-v-42e2a578],img[data-v-42e2a578-s] {
177
183
  grid-area: 1 / 1;
178
184
  inline-size: 100%;
179
185
  block-size: 100%;
180
186
  object-fit: cover;
181
187
  }
182
- .fallback[data-v-925a362e] {
188
+ .fallback[data-v-42e2a578] {
183
189
  grid-area: 1 / 1;
184
190
  display: inline-flex;
185
191
  align-items: center;
@@ -192,7 +198,7 @@ svg[data-v-fdb3ee4b] {
192
198
  /* Centre the glyphs, not the line box: a label without descenders otherwise reads high.
193
199
  * Trimming applies to block containers, so the box is a block with centred content. */
194
200
  @supports (text-box-trim: trim-both) {
195
- .fallback[data-v-925a362e] {
201
+ .fallback[data-v-42e2a578] {
196
202
  display: block;
197
203
  text-align: center;
198
204
  align-content: center;
@@ -200,12 +206,12 @@ svg[data-v-fdb3ee4b] {
200
206
  text-box-edge: cap alphabetic;
201
207
  }
202
208
  }
203
- [hidden][data-v-925a362e] {
209
+ [hidden][data-v-42e2a578] {
204
210
  display: none;
205
211
  }
206
212
 
207
213
  /* A component that sets its display still honours the hidden attribute on its root. */
208
- [data-component~="ui-avatar"][hidden][data-v-925a362e] {
214
+ [data-component~="ui-avatar"][hidden][data-v-42e2a578] {
209
215
  display: none;
210
216
  }
211
217