@threadlabs/looma 0.6.2 → 0.6.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.6.2",
3
+ "version": "0.6.4",
4
4
  "type": "module",
5
5
  "description": "Looma components as HTML, Vue, and plain DOM, with design tokens.",
6
6
  "license": "MIT",
@@ -2,6 +2,7 @@
2
2
  @scope ([data-component~="ui-tree-item"]) to ([data-component], [data-slotted]) {
3
3
  :scope {
4
4
  --_tree-row-min-height: 32px;
5
+ --_tree-disclosure-size: 16px;
5
6
 
6
7
  position: relative;
7
8
  display: block;
@@ -12,7 +13,7 @@
12
13
  .row {
13
14
  position: relative;
14
15
  display: grid;
15
- grid-template-columns: 20px auto minmax(0, 1fr) auto;
16
+ grid-template-columns: var(--_tree-disclosure-size) auto minmax(0, 1fr);
16
17
  align-items: center;
17
18
  min-block-size: var(--ui-tree-item-min-block-size, var(--_tree-row-min-height));
18
19
  min-inline-size: 0;
@@ -60,13 +61,14 @@
60
61
  .disclosure-spacer {
61
62
  grid-column: 1;
62
63
  grid-row: 1;
63
- inline-size: 20px;
64
+ inline-size: var(--_tree-disclosure-size);
64
65
  block-size: 28px;
65
66
  }
66
67
 
67
68
  .disclosure {
68
69
  display: grid;
69
- place-items: center;
70
+ /* Start-aligned: the chevron's ink, not its hit area, aligns with the content above it. */
71
+ place-items: center start;
70
72
  padding: 0;
71
73
  color: var(--ui-text-muted);
72
74
  background: transparent;
@@ -87,18 +89,18 @@
87
89
  .disclosure-icon {
88
90
  display: grid;
89
91
  place-items: center;
90
- inline-size: 14px;
91
- block-size: 14px;
92
+ inline-size: 12px;
93
+ block-size: 12px;
92
94
  transform: rotate(-90deg);
93
95
  transition: transform var(--ui-motion-fast) var(--ui-motion-ease);
94
96
  }
95
97
 
96
98
  .disclosure-icon::before {
97
99
  display: block;
98
- inline-size: 0.45rem;
99
- block-size: 0.45rem;
100
- border-inline-end: 2px solid currentColor;
101
- border-block-end: 2px solid currentColor;
100
+ inline-size: 0.375rem;
101
+ block-size: 0.375rem;
102
+ border-inline-end: 1.5px solid currentColor;
103
+ border-block-end: 1.5px solid currentColor;
102
104
  content: "";
103
105
  /* A chevron's ink sits below its box centre; lift it so it centres optically (in either rotation). */
104
106
  transform: translateY(-20%) rotate(45deg);
@@ -148,12 +150,61 @@
148
150
  /* Slotted label content fills the cell, so a link is the row's hit area rather than sizing to
149
151
  its own text and reading as overflow. */
150
152
 
153
+ /* The controls sit over the label's end, so the text fades out where they begin. The fade is
154
+ the truncation mark while it shows: an ellipsis under it would read as a second one. */
155
+ .row:hover > .label,
156
+ .row:focus-within > .label {
157
+ text-overflow: clip;
158
+ mask-image: linear-gradient(
159
+ to right,
160
+ #000 calc(100% - var(--_tree-actions-width, 1.75rem) - var(--ui-space-3)),
161
+ transparent calc(100% - var(--_tree-actions-width, 1.75rem))
162
+ );
163
+ }
164
+
165
+ .row:hover > .label:dir(rtl),
166
+ .row:focus-within > .label:dir(rtl) {
167
+ mask-image: linear-gradient(
168
+ to left,
169
+ #000 calc(100% - var(--_tree-actions-width, 1.75rem) - var(--ui-space-3)),
170
+ transparent calc(100% - var(--_tree-actions-width, 1.75rem))
171
+ );
172
+ }
173
+
151
174
  .actions {
152
- grid-column: 4;
153
- grid-row: 1;
175
+ position: absolute;
176
+ z-index: 1;
177
+ inset-block: 0;
178
+ inset-inline-end: 0;
154
179
  display: inline-flex;
155
180
  align-items: center;
156
181
  min-inline-size: 0;
182
+ opacity: 0;
183
+ pointer-events: none;
184
+ transition: opacity var(--ui-motion-fast) var(--ui-motion-ease);
185
+ }
186
+
187
+ .row:hover > .actions,
188
+ .row:focus-within > .actions {
189
+ opacity: 1;
190
+ pointer-events: auto;
191
+ }
192
+
193
+ /* Without hover there is no reveal, so the controls keep their own column. */
194
+ @media (hover: none) {
195
+ .row {
196
+ grid-template-columns: var(--_tree-disclosure-size) auto minmax(0, 1fr) auto;
197
+ }
198
+
199
+ .actions {
200
+ position: static;
201
+ grid-column: 4;
202
+ grid-row: 1;
203
+ padding-inline-start: 0;
204
+ background: none;
205
+ opacity: 1;
206
+ pointer-events: auto;
207
+ }
157
208
  }
158
209
 
159
210
  .drag-handle {
@@ -281,6 +332,18 @@
281
332
  min-inline-size: 0;
282
333
  }
283
334
 
335
+ /* The controls sit over the label's end, so the text fades out where they begin. The fade is
336
+ the truncation mark while it shows: an ellipsis under it would read as a second one. */
337
+
338
+ .row:hover > .label > :where([data-slotted], [data-slotted] *):is(*),
339
+ .row:focus-within > .label > :where([data-slotted], [data-slotted] *):is(*) {
340
+ text-overflow: clip;
341
+ }
342
+
343
+ /* Without hover there is no reveal, so the controls keep their own column. */
344
+ @media (hover: none) {
345
+ }
346
+
284
347
  @media (prefers-reduced-motion: reduce) {
285
348
  }
286
349
 
@@ -3,7 +3,7 @@ import { manageComponentLifecycle } from "@nextwebwg/html-next/runtime";
3
3
  import * as controller from "../components/ui-tree-item/ui-tree-item.js";
4
4
  import "../styles/ui-tree-item.css";
5
5
 
6
- const definition = {...{"contract":{"tag":"ui-tree-item","props":{"accepts":{"type":"string","required":false,"target":{"attribute":"data-accepts"},"default":""},"container":{"type":"boolean","required":false,"target":{"attribute":"container"},"default":false},"disabled":{"type":"boolean","required":false,"target":{"attribute":"aria-disabled"},"default":false},"dragType":{"type":"string","required":false,"target":{"attribute":"data-drag-type"},"default":"item"},"dropDepth":{"type":"number","required":false,"target":{"attribute":"data-drop-depth"}},"dropScope":{"type":"string","required":false,"target":{"attribute":"data-drop-scope"},"default":""},"expanded":{"type":"boolean","required":false,"target":{"attribute":"expanded"},"default":false},"itemId":{"type":"string","required":false,"target":{"attribute":"data-item-id"},"default":""},"label":{"type":"string","required":false,"target":{"attribute":"aria-label"},"default":""},"selected":{"type":"boolean","required":false,"target":{"attribute":"aria-selected"},"default":false},"sortable":{"type":"boolean","required":false,"target":{"attribute":"sortable"},"default":false},"subtreeDepth":{"type":"number","required":false,"target":{"attribute":"data-subtree-depth"}}}},"template":{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"role","value":"treeitem"},{"kind":"attribute","name":"aria-label","expression":"label","expressionPlan":{"source":"label","ast":{"kind":"id","name":"label"},"dependencies":["label"]}},{"kind":"attribute","name":"aria-level","expression":"structuralLevel","expressionPlan":{"source":"structuralLevel","ast":{"kind":"id","name":"structuralLevel"},"dependencies":["structuralLevel"]}},{"kind":"attribute","name":"aria-selected","expression":"selected","expressionPlan":{"source":"selected","ast":{"kind":"id","name":"selected"},"dependencies":["selected"]}},{"kind":"attribute","name":"aria-disabled","expression":"disabled","expressionPlan":{"source":"disabled","ast":{"kind":"id","name":"disabled"},"dependencies":["disabled"]}},{"kind":"attribute","name":"data-item-id","expression":"itemId","expressionPlan":{"source":"itemId","ast":{"kind":"id","name":"itemId"},"dependencies":["itemId"]}},{"kind":"attribute","name":"data-drag-type","expression":"dragType","expressionPlan":{"source":"dragType","ast":{"kind":"id","name":"dragType"},"dependencies":["dragType"]}},{"kind":"attribute","name":"data-drop-scope","expression":"dropScope","expressionPlan":{"source":"dropScope","ast":{"kind":"id","name":"dropScope"},"dependencies":["dropScope"]}},{"kind":"attribute","name":"data-accepts","expression":"accepts","expressionPlan":{"source":"accepts","ast":{"kind":"id","name":"accepts"},"dependencies":["accepts"]}},{"kind":"attribute","name":"data-drop-depth","expression":"dropDepth","expressionPlan":{"source":"dropDepth","ast":{"kind":"id","name":"dropDepth"},"dependencies":["dropDepth"]}},{"kind":"attribute","name":"data-subtree-depth","expression":"subtreeDepth","expressionPlan":{"source":"subtreeDepth","ast":{"kind":"id","name":"subtreeDepth"},"dependencies":["subtreeDepth"]}}],"children":[{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"row"}],"children":[{"kind":"element","name":"button","attributes":[{"kind":"literal","name":"class","value":"drag-handle"},{"kind":"literal","name":"type","value":"button"},{"kind":"literal","name":"draggable","value":"true"},{"kind":"attribute","name":"aria-label","expression":"format('Drag %s to reorder', label)","expressionPlan":{"source":"format('Drag %s to reorder', label)","ast":{"kind":"call","fn":"format","args":[{"kind":"literal","value":"Drag %s to reorder"},{"kind":"id","name":"label"}]},"dependencies":["label"]}}],"children":[{"kind":"element","name":"svg","attributes":[{"kind":"literal","name":"aria-hidden","value":"true"},{"kind":"literal","name":"focusable","value":"false"},{"kind":"literal","name":"viewBox","value":"0 0 24 24"},{"kind":"literal","name":"fill","value":"none"},{"kind":"literal","name":"stroke","value":"currentColor"},{"kind":"literal","name":"stroke-width","value":"2"},{"kind":"literal","name":"stroke-linecap","value":"round"},{"kind":"literal","name":"stroke-linejoin","value":"round"}],"children":[{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"9"},{"kind":"literal","name":"cy","value":"12"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"9"},{"kind":"literal","name":"cy","value":"5"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"9"},{"kind":"literal","name":"cy","value":"19"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"15"},{"kind":"literal","name":"cy","value":"12"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"15"},{"kind":"literal","name":"cy","value":"5"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"15"},{"kind":"literal","name":"cy","value":"19"},{"kind":"literal","name":"r","value":"1"}],"children":[]}]}],"flow":{"kind":"if","test":"sortable and not disabled","testPlan":{"source":"sortable and not disabled","ast":{"kind":"binary","op":"and","left":{"kind":"id","name":"sortable"},"right":{"kind":"unary","op":"not","operand":{"kind":"id","name":"disabled"}}},"dependencies":["disabled","sortable"]}},"ref":"dragHandle"},{"kind":"element","name":"button","attributes":[{"kind":"literal","name":"class","value":"disclosure"},{"kind":"literal","name":"type","value":"button"},{"kind":"attribute","name":"disabled","expression":"disabled","expressionPlan":{"source":"disabled","ast":{"kind":"id","name":"disabled"},"dependencies":["disabled"]}},{"kind":"attribute","name":"hidden","expression":"not isContainer","expressionPlan":{"source":"not isContainer","ast":{"kind":"unary","op":"not","operand":{"kind":"id","name":"isContainer"}},"dependencies":["isContainer"]}}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"disclosure-icon"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[]}],"ref":"disclosure"},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"leading"}],"children":[{"kind":"slot","fallback":[],"name":"leading"}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"label"}],"children":[{"kind":"slot","fallback":[{"kind":"element","name":"template","attributes":[{"kind":"directive","name":"value","expression":"label","expressionPlan":{"source":"label","ast":{"kind":"id","name":"label"},"dependencies":["label"]}}],"children":[]}],"name":"label"}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"actions"}],"children":[{"kind":"slot","fallback":[],"name":"actions"}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"drop-indicator row-drop-indicator"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[]}],"ref":"row"},{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"children"},{"kind":"literal","name":"role","value":"group"},{"kind":"attribute","name":"hidden","expression":"not (isContainer and internalExpanded)","expressionPlan":{"source":"not (isContainer and internalExpanded)","ast":{"kind":"unary","op":"not","operand":{"kind":"binary","op":"and","left":{"kind":"id","name":"isContainer"},"right":{"kind":"id","name":"internalExpanded"}}},"dependencies":["internalExpanded","isContainer"]}}],"children":[{"kind":"slot"}],"ref":"children"},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"drop-indicator subtree-drop-indicator"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[]}]},"declarations":[{"kind":"state","name":"internalExpanded","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"state","name":"structuralLevel","expression":{"source":"1","ast":{"kind":"literal","value":1},"dependencies":[]}},{"kind":"state","name":"tabStop","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"state","name":"isContainer","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"event","name":"expand","type":"object({ id: string, expanded: boolean, trigger: keyboard | pointer | programmatic })","bubbles":false,"composed":true,"cancelable":false}],"root":{"kind":"native","element":"div","choices":["div"]}},source:{file:import.meta.url},css:""};
6
+ const definition = {...{"contract":{"tag":"ui-tree-item","props":{"accepts":{"type":"string","required":false,"target":{"attribute":"data-accepts"},"default":""},"container":{"type":"boolean","required":false,"target":{"attribute":"container"},"default":false},"disabled":{"type":"boolean","required":false,"target":{"attribute":"aria-disabled"},"default":false},"dragType":{"type":"string","required":false,"target":{"attribute":"data-drag-type"},"default":"item"},"dropDepth":{"type":"number","required":false,"target":{"attribute":"data-drop-depth"}},"dropScope":{"type":"string","required":false,"target":{"attribute":"data-drop-scope"},"default":""},"expanded":{"type":"boolean","required":false,"target":{"attribute":"expanded"},"default":false},"itemId":{"type":"string","required":false,"target":{"attribute":"data-item-id"},"default":""},"label":{"type":"string","required":false,"target":{"attribute":"aria-label"},"default":""},"selected":{"type":"boolean","required":false,"target":{"attribute":"aria-selected"},"default":false},"sortable":{"type":"boolean","required":false,"target":{"attribute":"sortable"},"default":false},"subtreeDepth":{"type":"number","required":false,"target":{"attribute":"data-subtree-depth"}}}},"template":{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"role","value":"treeitem"},{"kind":"attribute","name":"aria-label","expression":"label","expressionPlan":{"source":"label","ast":{"kind":"id","name":"label"},"dependencies":["label"]}},{"kind":"attribute","name":"aria-level","expression":"structuralLevel","expressionPlan":{"source":"structuralLevel","ast":{"kind":"id","name":"structuralLevel"},"dependencies":["structuralLevel"]}},{"kind":"attribute","name":"aria-selected","expression":"selected","expressionPlan":{"source":"selected","ast":{"kind":"id","name":"selected"},"dependencies":["selected"]}},{"kind":"attribute","name":"aria-disabled","expression":"disabled","expressionPlan":{"source":"disabled","ast":{"kind":"id","name":"disabled"},"dependencies":["disabled"]}},{"kind":"attribute","name":"data-item-id","expression":"itemId","expressionPlan":{"source":"itemId","ast":{"kind":"id","name":"itemId"},"dependencies":["itemId"]}},{"kind":"attribute","name":"data-drag-type","expression":"dragType","expressionPlan":{"source":"dragType","ast":{"kind":"id","name":"dragType"},"dependencies":["dragType"]}},{"kind":"attribute","name":"data-drop-scope","expression":"dropScope","expressionPlan":{"source":"dropScope","ast":{"kind":"id","name":"dropScope"},"dependencies":["dropScope"]}},{"kind":"attribute","name":"data-accepts","expression":"accepts","expressionPlan":{"source":"accepts","ast":{"kind":"id","name":"accepts"},"dependencies":["accepts"]}},{"kind":"attribute","name":"data-drop-depth","expression":"dropDepth","expressionPlan":{"source":"dropDepth","ast":{"kind":"id","name":"dropDepth"},"dependencies":["dropDepth"]}},{"kind":"attribute","name":"data-subtree-depth","expression":"subtreeDepth","expressionPlan":{"source":"subtreeDepth","ast":{"kind":"id","name":"subtreeDepth"},"dependencies":["subtreeDepth"]}}],"children":[{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"row"}],"children":[{"kind":"element","name":"button","attributes":[{"kind":"literal","name":"class","value":"drag-handle"},{"kind":"literal","name":"type","value":"button"},{"kind":"literal","name":"draggable","value":"true"},{"kind":"attribute","name":"aria-label","expression":"format('Drag %s to reorder', label)","expressionPlan":{"source":"format('Drag %s to reorder', label)","ast":{"kind":"call","fn":"format","args":[{"kind":"literal","value":"Drag %s to reorder"},{"kind":"id","name":"label"}]},"dependencies":["label"]}}],"children":[{"kind":"element","name":"svg","attributes":[{"kind":"literal","name":"aria-hidden","value":"true"},{"kind":"literal","name":"focusable","value":"false"},{"kind":"literal","name":"viewBox","value":"0 0 24 24"},{"kind":"literal","name":"fill","value":"none"},{"kind":"literal","name":"stroke","value":"currentColor"},{"kind":"literal","name":"stroke-width","value":"2"},{"kind":"literal","name":"stroke-linecap","value":"round"},{"kind":"literal","name":"stroke-linejoin","value":"round"}],"children":[{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"9"},{"kind":"literal","name":"cy","value":"12"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"9"},{"kind":"literal","name":"cy","value":"5"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"9"},{"kind":"literal","name":"cy","value":"19"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"15"},{"kind":"literal","name":"cy","value":"12"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"15"},{"kind":"literal","name":"cy","value":"5"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"15"},{"kind":"literal","name":"cy","value":"19"},{"kind":"literal","name":"r","value":"1"}],"children":[]}]}],"flow":{"kind":"if","test":"sortable and not disabled","testPlan":{"source":"sortable and not disabled","ast":{"kind":"binary","op":"and","left":{"kind":"id","name":"sortable"},"right":{"kind":"unary","op":"not","operand":{"kind":"id","name":"disabled"}}},"dependencies":["disabled","sortable"]}},"ref":"dragHandle"},{"kind":"element","name":"button","attributes":[{"kind":"literal","name":"class","value":"disclosure"},{"kind":"literal","name":"type","value":"button"},{"kind":"attribute","name":"disabled","expression":"disabled","expressionPlan":{"source":"disabled","ast":{"kind":"id","name":"disabled"},"dependencies":["disabled"]}},{"kind":"attribute","name":"hidden","expression":"not isContainer","expressionPlan":{"source":"not isContainer","ast":{"kind":"unary","op":"not","operand":{"kind":"id","name":"isContainer"}},"dependencies":["isContainer"]}}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"disclosure-icon"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[]}],"ref":"disclosure"},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"leading"}],"children":[{"kind":"slot","fallback":[],"name":"leading"}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"label"}],"children":[{"kind":"slot","fallback":[{"kind":"element","name":"template","attributes":[{"kind":"directive","name":"value","expression":"label","expressionPlan":{"source":"label","ast":{"kind":"id","name":"label"},"dependencies":["label"]}}],"children":[]}],"name":"label"}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"actions"}],"children":[{"kind":"slot","fallback":[],"name":"actions"}],"ref":"actions"},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"drop-indicator row-drop-indicator"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[]}],"ref":"row"},{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"children"},{"kind":"literal","name":"role","value":"group"},{"kind":"attribute","name":"hidden","expression":"not (isContainer and internalExpanded)","expressionPlan":{"source":"not (isContainer and internalExpanded)","ast":{"kind":"unary","op":"not","operand":{"kind":"binary","op":"and","left":{"kind":"id","name":"isContainer"},"right":{"kind":"id","name":"internalExpanded"}}},"dependencies":["internalExpanded","isContainer"]}}],"children":[{"kind":"slot"}],"ref":"children"},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"drop-indicator subtree-drop-indicator"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[]}]},"declarations":[{"kind":"state","name":"internalExpanded","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"state","name":"structuralLevel","expression":{"source":"1","ast":{"kind":"literal","value":1},"dependencies":[]}},{"kind":"state","name":"tabStop","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"state","name":"isContainer","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"event","name":"expand","type":"object({ id: string, expanded: boolean, trigger: keyboard | pointer | programmatic })","bubbles":false,"composed":true,"cancelable":false}],"root":{"kind":"native","element":"div","choices":["div"]}},source:{file:import.meta.url},css:""};
7
7
 
8
8
  export function createUiTreeItem(options = {}) {
9
9
  const { attributes = {}, children = [], slots = {}, as, ...componentProps } = options;
@@ -56,6 +56,7 @@ const root = ref<HTMLElement | null>(null)
56
56
  const rowElement = useTemplateRef<HTMLElement>('row')
57
57
  const dragHandleElement = useTemplateRef<HTMLElement>('dragHandle')
58
58
  const disclosureElement = useTemplateRef<HTMLElement>('disclosure')
59
+ const actionsElement = useTemplateRef<HTMLElement>('actions')
59
60
  const childrenElement = useTemplateRef<HTMLElement>('children')
60
61
  const internalExpanded = ref(false)
61
62
  const structuralLevel = ref(1)
@@ -145,6 +146,9 @@ const host = {
145
146
  get disclosure(): Element {
146
147
  return disclosureElement.value as Element
147
148
  },
149
+ get actions(): Element {
150
+ return actionsElement.value as Element
151
+ },
148
152
  get children(): Element {
149
153
  return childrenElement.value as Element
150
154
  },
@@ -263,7 +267,7 @@ onBeforeUnmount(() => {
263
267
  </button>
264
268
  <span class="leading"><slot name="leading" /></span>
265
269
  <span class="label"><slot name="label">{{ label }}</slot></span>
266
- <span class="actions"><slot name="actions" /></span>
270
+ <span class="actions" ref="actions"><slot name="actions" /></span>
267
271
  <span class="drop-indicator row-drop-indicator" aria-hidden="true"></span>
268
272
  </div>
269
273
  <div class="children" role="group" :hidden="!(isContainer && internalExpanded)" ref="children">
@@ -276,6 +280,7 @@ onBeforeUnmount(() => {
276
280
  <style scoped>
277
281
  [data-component~="ui-tree-item"] {
278
282
  --_tree-row-min-height: 32px;
283
+ --_tree-disclosure-size: 16px;
279
284
 
280
285
  position: relative;
281
286
  display: block;
@@ -286,7 +291,7 @@ onBeforeUnmount(() => {
286
291
  .row {
287
292
  position: relative;
288
293
  display: grid;
289
- grid-template-columns: 20px auto minmax(0, 1fr) auto;
294
+ grid-template-columns: var(--_tree-disclosure-size) auto minmax(0, 1fr);
290
295
  align-items: center;
291
296
  min-block-size: var(--ui-tree-item-min-block-size, var(--_tree-row-min-height));
292
297
  min-inline-size: 0;
@@ -334,13 +339,14 @@ onBeforeUnmount(() => {
334
339
  .disclosure-spacer {
335
340
  grid-column: 1;
336
341
  grid-row: 1;
337
- inline-size: 20px;
342
+ inline-size: var(--_tree-disclosure-size);
338
343
  block-size: 28px;
339
344
  }
340
345
 
341
346
  .disclosure {
342
347
  display: grid;
343
- place-items: center;
348
+ /* Start-aligned: the chevron's ink, not its hit area, aligns with the content above it. */
349
+ place-items: center start;
344
350
  padding: 0;
345
351
  color: var(--ui-text-muted);
346
352
  background: transparent;
@@ -361,18 +367,18 @@ onBeforeUnmount(() => {
361
367
  .disclosure-icon {
362
368
  display: grid;
363
369
  place-items: center;
364
- inline-size: 14px;
365
- block-size: 14px;
370
+ inline-size: 12px;
371
+ block-size: 12px;
366
372
  transform: rotate(-90deg);
367
373
  transition: transform var(--ui-motion-fast) var(--ui-motion-ease);
368
374
  }
369
375
 
370
376
  .disclosure-icon::before {
371
377
  display: block;
372
- inline-size: 0.45rem;
373
- block-size: 0.45rem;
374
- border-inline-end: 2px solid currentColor;
375
- border-block-end: 2px solid currentColor;
378
+ inline-size: 0.375rem;
379
+ block-size: 0.375rem;
380
+ border-inline-end: 1.5px solid currentColor;
381
+ border-block-end: 1.5px solid currentColor;
376
382
  content: "";
377
383
  /* A chevron's ink sits below its box centre; lift it so it centres optically (in either rotation). */
378
384
  transform: translateY(-20%) rotate(45deg);
@@ -434,12 +440,66 @@ onBeforeUnmount(() => {
434
440
  min-inline-size: 0;
435
441
  }
436
442
 
443
+ /* The controls sit over the label's end, so the text fades out where they begin. The fade is
444
+ the truncation mark while it shows: an ellipsis under it would read as a second one. */
445
+ .row:hover > .label,
446
+ .row:focus-within > .label {
447
+ text-overflow: clip;
448
+ mask-image: linear-gradient(
449
+ to right,
450
+ #000 calc(100% - var(--_tree-actions-width, 1.75rem) - var(--ui-space-3)),
451
+ transparent calc(100% - var(--_tree-actions-width, 1.75rem))
452
+ );
453
+ }
454
+
455
+ .row:hover > .label:dir(rtl),
456
+ .row:focus-within > .label:dir(rtl) {
457
+ mask-image: linear-gradient(
458
+ to left,
459
+ #000 calc(100% - var(--_tree-actions-width, 1.75rem) - var(--ui-space-3)),
460
+ transparent calc(100% - var(--_tree-actions-width, 1.75rem))
461
+ );
462
+ }
463
+
464
+ .row:hover > .label > :slotted(*),
465
+ .row:focus-within > .label > :slotted(*) {
466
+ text-overflow: clip;
467
+ }
468
+
437
469
  .actions {
438
- grid-column: 4;
439
- grid-row: 1;
470
+ position: absolute;
471
+ z-index: 1;
472
+ inset-block: 0;
473
+ inset-inline-end: 0;
440
474
  display: inline-flex;
441
475
  align-items: center;
442
476
  min-inline-size: 0;
477
+ opacity: 0;
478
+ pointer-events: none;
479
+ transition: opacity var(--ui-motion-fast) var(--ui-motion-ease);
480
+ }
481
+
482
+ .row:hover > .actions,
483
+ .row:focus-within > .actions {
484
+ opacity: 1;
485
+ pointer-events: auto;
486
+ }
487
+
488
+ /* Without hover there is no reveal, so the controls keep their own column. */
489
+ @media (hover: none) {
490
+ .row {
491
+ grid-template-columns: var(--_tree-disclosure-size) auto minmax(0, 1fr) auto;
492
+ }
493
+
494
+ .actions {
495
+ position: static;
496
+ grid-column: 4;
497
+ grid-row: 1;
498
+ padding-inline-start: 0;
499
+ background: none;
500
+ opacity: 1;
501
+ pointer-events: auto;
502
+ }
443
503
  }
444
504
 
445
505
  .drag-handle {
@@ -23,7 +23,10 @@ var _hoisted_3 = ["aria-label"];
23
23
  var _hoisted_4 = ["disabled", "hidden"];
24
24
  var _hoisted_5 = { class: "leading" };
25
25
  var _hoisted_6 = { class: "label" };
26
- var _hoisted_7 = { class: "actions" };
26
+ var _hoisted_7 = {
27
+ class: "actions",
28
+ ref: "actions"
29
+ };
27
30
  var _hoisted_8 = ["hidden"];
28
31
  //#endregion
29
32
  //#region .build/vue/UiTreeItem.vue
@@ -67,6 +70,7 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
67
70
  const rowElement = useTemplateRef("row");
68
71
  const dragHandleElement = useTemplateRef("dragHandle");
69
72
  const disclosureElement = useTemplateRef("disclosure");
73
+ const actionsElement = useTemplateRef("actions");
70
74
  const childrenElement = useTemplateRef("children");
71
75
  const internalExpanded = ref(false);
72
76
  const structuralLevel = ref(1);
@@ -142,6 +146,9 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
142
146
  get disclosure() {
143
147
  return disclosureElement.value;
144
148
  },
149
+ get actions() {
150
+ return actionsElement.value;
151
+ },
145
152
  get children() {
146
153
  return childrenElement.value;
147
154
  }
@@ -274,7 +281,7 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
274
281
  }, null, -1)])], 8, _hoisted_4),
275
282
  createElementVNode("span", _hoisted_5, [renderSlot(_ctx.$slots, "leading")]),
276
283
  createElementVNode("span", _hoisted_6, [renderSlot(_ctx.$slots, "label", {}, () => [createTextVNode(toDisplayString(__props.label), 1)])]),
277
- createElementVNode("span", _hoisted_7, [renderSlot(_ctx.$slots, "actions")]),
284
+ createElementVNode("span", _hoisted_7, [renderSlot(_ctx.$slots, "actions")], 512),
278
285
  _cache[2] || (_cache[2] = createElementVNode("span", {
279
286
  class: "drop-indicator row-drop-indicator",
280
287
  "aria-hidden": "true"
@@ -293,6 +300,6 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
293
300
  ], 16, _hoisted_1);
294
301
  };
295
302
  }
296
- }), [["__scopeId", "data-v-b57a29c6"]]);
303
+ }), [["__scopeId", "data-v-07ef6009"]]);
297
304
  //#endregion
298
305
  export { UiTreeItem_default as t };