@threadlabs/looma 0.10.7 → 0.10.9

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.
@@ -31,7 +31,7 @@
31
31
  border-radius: 999px;
32
32
  border: 1px solid var(--ui-avatar-border, var(--ui-border-strong));
33
33
  background: var(--ui-avatar-surface, var(--ui-accent-soft));
34
- color: var(--ui-avatar-text, var(--ui-accent-solid));
34
+ color: var(--ui-avatar-text, var(--ui-accent-subtle-text, var(--ui-accent-solid)));
35
35
  font: inherit;
36
36
  font-size: var(--ui-font-size-sm);
37
37
  font-weight: 600;
@@ -223,7 +223,7 @@ export default function controller(host) {
223
223
  search("selection");
224
224
  input.focus();
225
225
  return;
226
- } else if (option) commit(option.value, option.label, option, "selection", trigger);
226
+ } else if (option) commit(option.value, option.label, asItem(option), "selection", trigger);
227
227
  else if (canCreate() && index === host.state.rows.length) commit(null, host.state.raw, null, "create", trigger);
228
228
  else return;
229
229
  close();
@@ -9,6 +9,14 @@ function parentItem(element) {
9
9
  }
10
10
 
11
11
  /** Synchronizes an inferred tree hierarchy after nested component lowering. */
12
+ // What a row click leaves alone: a control, or anything inside one, such as an item of the options
13
+ // menu a row holds. Clicking those neither follows the row's link nor toggles a branch.
14
+ const CONTROLS = [
15
+ "a", "button", "input", "select", "textarea", "label", "summary", '[contenteditable=""]', '[contenteditable="true"]',
16
+ ...["button", "link", "menu", "menuitem", "menuitemcheckbox", "menuitemradio", "listbox", "option", "checkbox",
17
+ "radio", "switch", "tab", "slider", "spinbutton", "combobox", "textbox", "dialog"].map((role) => `[role="${role}"]`),
18
+ ].join(", ");
19
+
12
20
  export default function controller(host) {
13
21
  const element = host.element;
14
22
  const { row, disclosure, children, actions, labelText } = host.refs;
@@ -60,7 +68,7 @@ export default function controller(host) {
60
68
  const onDisclosureClick = (event) => { event.stopPropagation(); setExpanded(!Boolean(host.state.internalExpanded), triggerFor(event)); };
61
69
  const onRowClick = (event) => {
62
70
  if (host.state.disabled) return;
63
- const interactive = event.composedPath().some((node) => node instanceof HTMLElement && node.matches?.('a, button, input, select, textarea, [role="button"], [role="link"]'));
71
+ const interactive = event.composedPath().some((node) => node instanceof HTMLElement && node.matches?.(CONTROLS));
64
72
  if (interactive) return;
65
73
  if (isContainer()) {
66
74
  setExpanded(!Boolean(host.state.internalExpanded), triggerFor(event));