@syware/jlib 0.13.0 → 0.15.0

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.
Files changed (115) hide show
  1. package/README.md +12 -8
  2. package/dist/atoms/jl-avatar.d.ts +2 -0
  3. package/dist/atoms/jl-avatar.js +11 -6
  4. package/dist/atoms/jl-button.d.ts +6 -0
  5. package/dist/atoms/jl-button.js +22 -8
  6. package/dist/atoms/jl-chip.js +2 -1
  7. package/dist/atoms/jl-input.js +3 -3
  8. package/dist/atoms/jl-link.d.ts +1 -0
  9. package/dist/atoms/jl-link.js +5 -2
  10. package/dist/atoms/jl-progress-ring.d.ts +2 -0
  11. package/dist/atoms/jl-progress-ring.js +9 -4
  12. package/dist/atoms/jl-progress.d.ts +1 -0
  13. package/dist/atoms/jl-progress.js +8 -4
  14. package/dist/atoms/jl-rating.d.ts +2 -0
  15. package/dist/atoms/jl-rating.js +11 -6
  16. package/dist/atoms/jl-select.css.js +1 -1
  17. package/dist/atoms/jl-select.d.ts +4 -0
  18. package/dist/atoms/jl-select.js +18 -2
  19. package/dist/atoms/jl-switch.css.js +1 -1
  20. package/dist/atoms/jl-textarea.js +2 -2
  21. package/dist/base/jl-form-control.d.ts +3 -2
  22. package/dist/base/jl-form-control.js +14 -4
  23. package/dist/index.d.ts +2 -1
  24. package/dist/lib/dom.d.ts +5 -0
  25. package/dist/lib/dom.js +9 -1
  26. package/dist/lib/download.js +10 -2
  27. package/dist/lib/floating.d.ts +5 -0
  28. package/dist/lib/floating.js +21 -2
  29. package/dist/lib/fuzzy.d.ts +3 -2
  30. package/dist/lib/fuzzy.js +15 -4
  31. package/dist/lib/hotkey.d.ts +13 -0
  32. package/dist/lib/hotkey.js +2 -1
  33. package/dist/lib/key-shortcut.js +11 -29
  34. package/dist/lib/modal.d.ts +24 -0
  35. package/dist/lib/modal.js +52 -0
  36. package/dist/lib/numeric.d.ts +5 -0
  37. package/dist/lib/numeric.js +11 -1
  38. package/dist/lib/option-filter.d.ts +2 -0
  39. package/dist/lib/option-filter.js +1 -1
  40. package/dist/lib/press.d.ts +11 -0
  41. package/dist/lib/press.js +31 -0
  42. package/dist/lib/progress.d.ts +0 -5
  43. package/dist/lib/progress.js +1 -9
  44. package/dist/lib/roving.d.ts +6 -0
  45. package/dist/lib/roving.js +14 -1
  46. package/dist/lib/table.js +12 -4
  47. package/dist/lib/texts-de.d.ts +12 -0
  48. package/dist/lib/texts-de.js +12 -0
  49. package/dist/lib/texts-fr.d.ts +12 -0
  50. package/dist/lib/texts-fr.js +12 -0
  51. package/dist/lib/texts.d.ts +12 -0
  52. package/dist/lib/texts.js +12 -0
  53. package/dist/molecules/jl-accordion-item.js +2 -1
  54. package/dist/molecules/jl-calendar.d.ts +4 -0
  55. package/dist/molecules/jl-calendar.js +16 -5
  56. package/dist/molecules/jl-chip-group.css.js +1 -1
  57. package/dist/molecules/jl-chip-group.js +4 -4
  58. package/dist/molecules/jl-code-block.css.js +1 -1
  59. package/dist/molecules/jl-combobox.d.ts +4 -0
  60. package/dist/molecules/jl-combobox.js +23 -11
  61. package/dist/molecules/jl-copy-button.css.js +1 -1
  62. package/dist/molecules/jl-copy-button.d.ts +11 -4
  63. package/dist/molecules/jl-copy-button.js +48 -22
  64. package/dist/molecules/jl-date-picker.d.ts +4 -0
  65. package/dist/molecules/jl-date-picker.js +18 -12
  66. package/dist/molecules/jl-field.d.ts +5 -1
  67. package/dist/molecules/jl-field.js +24 -5
  68. package/dist/molecules/jl-file-drop.css.js +1 -1
  69. package/dist/molecules/jl-file-drop.d.ts +4 -0
  70. package/dist/molecules/jl-file-drop.js +16 -8
  71. package/dist/molecules/jl-input-list.js +13 -6
  72. package/dist/molecules/jl-load-state.d.ts +8 -0
  73. package/dist/molecules/jl-load-state.js +33 -7
  74. package/dist/molecules/jl-menu.d.ts +21 -1
  75. package/dist/molecules/jl-menu.js +58 -6
  76. package/dist/molecules/jl-number-input.d.ts +2 -0
  77. package/dist/molecules/jl-number-input.js +12 -8
  78. package/dist/molecules/jl-radio-group.js +4 -3
  79. package/dist/molecules/jl-search.js +2 -2
  80. package/dist/molecules/jl-segmented.js +2 -2
  81. package/dist/molecules/jl-tabs.js +2 -2
  82. package/dist/molecules/jl-tag-input.css.js +1 -1
  83. package/dist/molecules/jl-tag-input.d.ts +4 -0
  84. package/dist/molecules/jl-tag-input.js +17 -9
  85. package/dist/molecules/jl-toast.js +10 -6
  86. package/dist/molecules/jl-tooltip.js +8 -2
  87. package/dist/organisms/jl-command-palette.css.js +1 -1
  88. package/dist/organisms/jl-command-palette.d.ts +2 -0
  89. package/dist/organisms/jl-command-palette.js +10 -4
  90. package/dist/organisms/jl-dialog.d.ts +3 -0
  91. package/dist/organisms/jl-dialog.js +13 -3
  92. package/dist/organisms/jl-drawer.d.ts +3 -0
  93. package/dist/organisms/jl-drawer.js +13 -3
  94. package/dist/organisms/jl-flow.d.ts +2 -0
  95. package/dist/organisms/jl-flow.js +29 -9
  96. package/dist/organisms/jl-table.css.js +1 -1
  97. package/dist/organisms/jl-table.d.ts +15 -4
  98. package/dist/organisms/jl-table.js +40 -17
  99. package/dist/organisms/jl-toaster.d.ts +13 -2
  100. package/dist/organisms/jl-toaster.js +47 -4
  101. package/dist/organisms/jl-tree.css.js +1 -1
  102. package/dist/organisms/jl-tree.d.ts +23 -4
  103. package/dist/organisms/jl-tree.js +74 -18
  104. package/dist/styles/base.css.js +1 -1
  105. package/dist/styles/control.css.js +1 -1
  106. package/dist/styles/tokens.css.js +1 -1
  107. package/dist/tokens.css +4 -3
  108. package/dist/types/jl-load-state.types.d.ts +7 -0
  109. package/dist/types/jl-table.types.d.ts +12 -0
  110. package/dist/types/jl-tree.types.d.ts +17 -0
  111. package/dist/types/press.types.d.ts +6 -0
  112. package/package.json +7 -3
  113. package/dist/lib/roving-index.d.ts +0 -10
  114. package/dist/lib/roving-index.js +0 -32
  115. /package/dist/types/{roving-index.types.d.ts → roving.types.d.ts} +0 -0
@@ -2,7 +2,8 @@ import { jlText } from "../lib/texts.js";
2
2
  import { BASE_STYLES } from "../styles/shared.js";
3
3
  import { JlFormControl } from "../base/jl-form-control.js";
4
4
  import { jsonOf, oneOf, textOf } from "../lib/attributes.js";
5
- import { rovingIndex } from "../lib/roving-index.js";
5
+ import { setAriaFlag } from "../lib/dom.js";
6
+ import { rovingIndex } from "../lib/roving.js";
6
7
  import jl_radio_group_default from "./jl-radio-group.css.js";
7
8
  import { css } from "@jadis/core";
8
9
  import { jsx, jsxs } from "@jadis/core/jsx-runtime";
@@ -58,7 +59,7 @@ var JlRadioGroup = class extends JlFormControl {
58
59
  }, { attribute: "legend" });
59
60
  required = this.useChange(false, (value) => {
60
61
  this.reflect("required", value);
61
- this._refs.group.toggleAttribute("aria-required", value);
62
+ setAriaFlag(this._refs.group, "aria-required", value);
62
63
  this.renderValidity();
63
64
  }, { attribute: "required" });
64
65
  disabled = this.useChange(false, (value) => {
@@ -184,7 +185,7 @@ var JlRadioGroup = class extends JlFormControl {
184
185
  radio.setAttribute("aria-disabled", String(disabled));
185
186
  radio.tabIndex = -1;
186
187
  }
187
- this._refs.group.toggleAttribute("aria-disabled", groupDisabled);
188
+ setAriaFlag(this._refs.group, "aria-disabled", groupDisabled);
188
189
  const stop = this.tabStop(radios, value);
189
190
  if (stop !== void 0) stop.tabIndex = 0;
190
191
  this.internals.setFormValue(value === NO_VALUE ? null : value);
@@ -5,7 +5,7 @@ import { oneOf } from "../lib/attributes.js";
5
5
  import { registerIcons } from "../lib/icons.js";
6
6
  import { CONTROL_SIZES } from "../lib/options.js";
7
7
  import { JlIcon } from "../atoms/jl-icon.js";
8
- import { setOrRemove } from "../lib/dom.js";
8
+ import { setAriaFlag, setOrRemove } from "../lib/dom.js";
9
9
  import { JlSpinner } from "../atoms/jl-spinner.js";
10
10
  import { hasCommandModifier, matchesShortcut, parseShortcut, shortcutAria, shortcutLabels } from "../lib/key-shortcut.js";
11
11
  import jl_search_default from "./jl-search.css.js";
@@ -49,7 +49,7 @@ var JlSearch = class extends JlFormControl {
49
49
  });
50
50
  /** Shows a spinner in place of the search icon, while results are on their way. */
51
51
  loading = this.useChange(false, (value) => {
52
- this._refs.native.toggleAttribute("aria-busy", value);
52
+ setAriaFlag(this._refs.native, "aria-busy", value);
53
53
  this.reflect("loading", value);
54
54
  }, { attribute: "loading" });
55
55
  disabled = this.useChange(false, (value) => {
@@ -3,7 +3,7 @@ import { JlFormControl } from "../base/jl-form-control.js";
3
3
  import { jsonOf, oneOf, textOf } from "../lib/attributes.js";
4
4
  import { CONTROL_SIZES } from "../lib/options.js";
5
5
  import { JlIcon } from "../atoms/jl-icon.js";
6
- import { setOrRemove } from "../lib/dom.js";
6
+ import { setAriaFlag, setOrRemove } from "../lib/dom.js";
7
7
  import { firstIndex, lastIndex, stepIndex } from "../lib/roving.js";
8
8
  import { followTarget } from "../lib/indicator.js";
9
9
  import jl_segmented_default from "./jl-segmented.css.js";
@@ -167,7 +167,7 @@ var JlSegmented = class extends JlFormControl {
167
167
  }
168
168
  renderDisabled() {
169
169
  const disabled = this.isDisabled();
170
- this._refs.group.toggleAttribute("aria-disabled", disabled);
170
+ setAriaFlag(this._refs.group, "aria-disabled", disabled);
171
171
  for (const segment of this.segments()) segment.disabled = disabled || segment.hasAttribute("data-disabled");
172
172
  }
173
173
  onKeydown(event) {
@@ -3,7 +3,7 @@ import { JlElement } from "../base/jl-element.js";
3
3
  import { oneOf } from "../lib/attributes.js";
4
4
  import { define } from "../lib/define.js";
5
5
  import { JlIcon } from "../atoms/jl-icon.js";
6
- import { setOrRemove, uniqueId } from "../lib/dom.js";
6
+ import { setAriaFlag, setOrRemove, uniqueId } from "../lib/dom.js";
7
7
  import { firstIndex, lastIndex, stepIndex } from "../lib/roving.js";
8
8
  import { followTarget } from "../lib/indicator.js";
9
9
  import { JlTabPanel } from "./jl-tab-panel.js";
@@ -144,7 +144,7 @@ var JlTabs = class extends JlElement {
144
144
  this.renderTabContent(tab, panel);
145
145
  tab.setAttribute("aria-selected", String(selected));
146
146
  tab.tabIndex = selected ? 0 : -1;
147
- tab.toggleAttribute("aria-disabled", isDisabled(panel));
147
+ setAriaFlag(tab, "aria-disabled", isDisabled(panel));
148
148
  if (panel.id === "") panel.id = uniqueId("jl-tab-panel");
149
149
  tab.ariaControlsElements = [panel];
150
150
  panel.toggleAttribute("selected", selected);
@@ -1,3 +1,3 @@
1
1
  // src/molecules/jl-tag-input.css?inline
2
- var jl_tag_input_default = ":host{--chip-height:calc(var(--height,var(--jl-control-md)) - 12px);min-width:0;display:block}.control{cursor:text;flex-wrap:wrap;gap:4px;padding:4px 6px}.tags{margin:0;padding:0;list-style:none;display:contents}.tag{max-width:100%;height:var(--chip-height);border:1px solid var(--jl-line);border-radius:var(--jl-radius-xs);background:var(--jl-surface-2);color:var(--jl-text);font-size:var(--jl-font-sm);cursor:default;align-items:center;gap:2px;padding:0 3px 0 8px;line-height:1;display:inline-flex}:host([size=sm]) .tag{font-size:var(--jl-font-xs);padding-left:6px}.tag.flash{animation:flash .6s var(--jl-ease)}.tag-text{text-overflow:ellipsis;white-space:nowrap;line-height:1.4;overflow:hidden}.tag-remove{width:18px;height:18px;color:var(--jl-faint);cursor:pointer;background:0 0;border:none;border-radius:4px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.tag-remove:hover,.tag-remove:focus-visible{background:var(--jl-surface-3);color:var(--jl-text)}.native{height:calc(var(--height,var(--jl-control-md)) - 10px);flex:1 0 80px;padding-left:6px}:host([disabled]) .tag{color:var(--jl-muted);padding-right:8px}:host([disabled]) .tag-remove{display:none}.popup{min-width:180px;padding:4px}.listbox{max-height:240px;margin:0;padding:0;list-style:none;position:relative;overflow-y:auto}.option{border-radius:var(--jl-radius-xs);color:var(--jl-text);font-size:var(--jl-font-md);white-space:nowrap;cursor:pointer;-webkit-user-select:none;user-select:none;padding:6px 10px;line-height:1.4}.option[aria-selected=true],.option:hover{background:var(--jl-surface-3)}mark{color:var(--jl-accent);background:0 0;font-weight:700}@keyframes flash{30%{border-color:var(--jl-accent-line);background:var(--jl-accent-soft);color:var(--jl-accent-strong)}}";
2
+ var jl_tag_input_default = ":host{--chip-height:calc(var(--height,var(--jl-control-md)) - 12px);min-width:0;display:block}.control{cursor:text;flex-wrap:wrap;gap:4px;padding:4px 6px}.tags{margin:0;padding:0;list-style:none;display:contents}.tag{max-width:100%;height:var(--chip-height);border:1px solid var(--jl-line);border-radius:var(--jl-radius-xs);background:var(--jl-surface-2);color:var(--jl-text);font-size:var(--jl-font-sm);cursor:default;align-items:center;gap:2px;padding:0 3px 0 8px;line-height:1;display:inline-flex}:host([size=sm]) .tag{font-size:var(--jl-font-xs);padding-left:6px}.tag.flash{animation:flash .6s var(--jl-ease)}.tag-text{text-overflow:ellipsis;white-space:nowrap;line-height:1.4;overflow:hidden}.tag-remove{width:18px;height:18px;color:var(--jl-faint);cursor:pointer;background:0 0;border:none;border-radius:4px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.tag-remove:hover,.tag-remove:focus-visible{background:var(--jl-surface-3);color:var(--jl-text)}.native{height:calc(var(--height,var(--jl-control-md)) - 10px);flex:1 0 80px;padding-left:6px}:host(:disabled) .tag{color:var(--jl-muted);padding-right:8px}:host(:disabled) .tag-remove{display:none}.popup{min-width:180px;padding:4px}.listbox{max-height:240px;margin:0;padding:0;list-style:none;position:relative;overflow-y:auto}.option{border-radius:var(--jl-radius-xs);color:var(--jl-text);font-size:var(--jl-font-md);white-space:nowrap;cursor:pointer;-webkit-user-select:none;user-select:none;padding:6px 10px;line-height:1.4}.option[aria-selected=true],.option:hover{background:var(--jl-surface-3)}mark{color:var(--jl-accent);background:0 0;font-weight:700}@keyframes flash{30%{border-color:var(--jl-accent-line);background:var(--jl-accent-soft);color:var(--jl-accent-strong)}}";
3
3
  export { jl_tag_input_default as default };
@@ -61,6 +61,8 @@ export declare class JlTagInput extends JlFormControl {
61
61
  onDisconnect(): void;
62
62
  protected resetValue(): void;
63
63
  protected setDisabledByForm(disabled: boolean): void;
64
+ /** Disabled by its own input, or by a `<fieldset disabled>` around it. */
65
+ private isOff;
64
66
  private onType;
65
67
  private onFieldKey;
66
68
  /** Enter adds the suggestion the arrows reached, or the typed text; in an empty field it submits the form. */
@@ -113,4 +115,6 @@ export declare class JlTagInput extends JlFormControl {
113
115
  private renderFormValue;
114
116
  private renderValidity;
115
117
  private renderDisabled;
118
+ /** Without the attribute: the form says its state before the `disabled` input has taken the attribute's change. */
119
+ private drawDisabled;
116
120
  }
@@ -6,7 +6,7 @@ import { followAnchor } from "../lib/floating.js";
6
6
  import { registerIcons } from "../lib/icons.js";
7
7
  import { CONTROL_SIZES } from "../lib/options.js";
8
8
  import { JlIcon } from "../atoms/jl-icon.js";
9
- import { setOrRemove, uniqueId } from "../lib/dom.js";
9
+ import { setAriaFlag, setOrRemove, uniqueId } from "../lib/dom.js";
10
10
  import { keepInView } from "../lib/keep-in-view.js";
11
11
  import { filterOptions, matchParts, nextEnabledIndex } from "../lib/option-filter.js";
12
12
  import { addTags, hasTag, hasTagSeparator, splitTags } from "../lib/tags.js";
@@ -56,7 +56,7 @@ var JlTagInput = class extends JlFormControl {
56
56
  parse: parseTextList
57
57
  });
58
58
  required = this.useChange(false, (value) => {
59
- this._refs.native.toggleAttribute("aria-required", value);
59
+ setAriaFlag(this._refs.native, "aria-required", value);
60
60
  this.reflect("required", value);
61
61
  this.renderValidity();
62
62
  }, { attribute: "required" });
@@ -64,7 +64,7 @@ var JlTagInput = class extends JlFormControl {
64
64
  /** Draws the field in the danger colour, for an error the page found itself. */
65
65
  invalid = this.useChange(false, (value) => {
66
66
  this.reflect("invalid", value);
67
- this._refs.native.toggleAttribute("aria-invalid", value);
67
+ setAriaFlag(this._refs.native, "aria-invalid", value);
68
68
  }, { attribute: "invalid" });
69
69
  size = this.useChange("md", (value) => this.reflect("size", value), {
70
70
  attribute: "size",
@@ -73,6 +73,7 @@ var JlTagInput = class extends JlFormControl {
73
73
  _listId = uniqueId("jl-tag-input-list");
74
74
  _state = {
75
75
  active: NONE,
76
+ disabledByForm: false,
76
77
  matches: [],
77
78
  opening: new AbortController()
78
79
  };
@@ -153,9 +154,12 @@ var JlTagInput = class extends JlFormControl {
153
154
  this.value.set(parseTextList(this.getAttribute("value")));
154
155
  }
155
156
  setDisabledByForm(disabled) {
156
- this.whenRendered(() => {
157
- this._refs.native.disabled = disabled || this.disabled.get();
158
- });
157
+ this._state.disabledByForm = disabled;
158
+ this.whenRendered(() => this.drawDisabled());
159
+ }
160
+ /** Disabled by its own input, or by a `<fieldset disabled>` around it. */
161
+ isOff() {
162
+ return this.disabled.get() || this._state.disabledByForm;
159
163
  }
160
164
  onType() {
161
165
  const native = this._refs.native;
@@ -253,7 +257,7 @@ var JlTagInput = class extends JlFormControl {
253
257
  removeAt(index) {
254
258
  const tags = this.value.get();
255
259
  const removed = tags[index];
256
- if (removed === void 0 || this.disabled.get()) return;
260
+ if (removed === void 0 || this.isOff()) return;
257
261
  const next = tags.filter((_, position) => position !== index);
258
262
  this.value.set(next);
259
263
  this.announce(jlText("removedNamed", { name: removed }));
@@ -275,7 +279,7 @@ var JlTagInput = class extends JlFormControl {
275
279
  focusLastTag() {
276
280
  const native = this._refs.native;
277
281
  const count = this.value.get().length;
278
- if (native.selectionStart !== 0 || native.selectionEnd !== 0 || count === 0 || this.disabled.get()) return false;
282
+ if (native.selectionStart !== 0 || native.selectionEnd !== 0 || count === 0 || this.isOff()) return false;
279
283
  this.focusTag(count - 1);
280
284
  return true;
281
285
  }
@@ -458,8 +462,12 @@ var JlTagInput = class extends JlFormControl {
458
462
  this.internals.setValidity({});
459
463
  }
460
464
  renderDisabled(disabled) {
461
- this._refs.native.disabled = disabled;
462
465
  this.reflect("disabled", disabled);
466
+ this.drawDisabled();
467
+ }
468
+ /** Without the attribute: the form says its state before the `disabled` input has taken the attribute's change. */
469
+ drawDisabled() {
470
+ this._refs.native.disabled = this.isOff();
463
471
  this.closeList();
464
472
  }
465
473
  };
@@ -6,7 +6,7 @@ import { registerIcons } from "../lib/icons.js";
6
6
  import { TONE_ICONS, TONE_ICON_FILLED } from "../lib/options.js";
7
7
  import { JlIcon } from "../atoms/jl-icon.js";
8
8
  import { JlButton } from "../atoms/jl-button.js";
9
- import { optionalNumber } from "../lib/progress.js";
9
+ import { parseNumber } from "../lib/numeric.js";
10
10
  import { JlProgress } from "../atoms/jl-progress.js";
11
11
  import jl_toast_default from "./jl-toast.css.js";
12
12
  import { css } from "@jadis/core";
@@ -89,7 +89,7 @@ var JlToast = class extends JlElement {
89
89
  /** How far the work is, in percent; `null` (no attribute) for work of unknown length. */
90
90
  progress = this.useChange(null, (value) => this._refs.work.value.set(value), {
91
91
  attribute: "progress",
92
- parse: optionalNumber
92
+ parse: parseNumber
93
93
  });
94
94
  _timer = {
95
95
  animation: null,
@@ -115,20 +115,24 @@ var JlToast = class extends JlElement {
115
115
  if (this.hidden || this.hasAttribute("leaving")) return;
116
116
  this.stopTimer();
117
117
  this.reflect("leaving", true);
118
- const done = () => this.finishLeaving();
119
118
  if (!this.isConnected || prefersReducedMotion()) {
120
- done();
119
+ this.finishLeaving();
121
120
  return;
122
121
  }
123
122
  const offset = this.enterOffset();
124
- this._refs.toast.animate([{ opacity: 1 }, {
123
+ const leaving = this._refs.toast.animate([{ opacity: 1 }, {
125
124
  opacity: 0,
126
125
  transform: `translateY(${offset}) scale(0.97)`
127
126
  }], {
128
127
  duration: LEAVE_MS,
129
128
  easing: EASE,
130
129
  fill: "forwards"
131
- }).finished.then(done, done);
130
+ });
131
+ const done = () => {
132
+ this.finishLeaving();
133
+ leaving.cancel();
134
+ };
135
+ leaving.finished.then(done, done);
132
136
  }
133
137
  /** Shows a dismissed toast again, with its time from the start. */
134
138
  show() {
@@ -255,8 +255,14 @@ var JlTooltip = class extends JlElement {
255
255
  if (!event.composedPath().includes(this)) this.close();
256
256
  }, { signal: following.signal });
257
257
  document.addEventListener("keydown", (event) => {
258
- if (event.key === "Escape") this.close();
259
- }, { signal: following.signal });
258
+ if (event.key !== "Escape") return;
259
+ event.preventDefault();
260
+ event.stopPropagation();
261
+ this.close();
262
+ }, {
263
+ capture: true,
264
+ signal: following.signal
265
+ });
260
266
  this.place();
261
267
  }
262
268
  reposition() {
@@ -1,3 +1,3 @@
1
1
  // src/organisms/jl-command-palette.css?inline
2
- var jl_command_palette_default = ":host{display:contents}dialog{border:1px solid var(--jl-line);border-radius:var(--jl-radius-lg);background:var(--jl-surface);width:min(620px,100vw - 24px);max-width:none;max-height:min(520px,100dvh - 24vh);color:var(--jl-text);font-size:var(--jl-font-md);box-shadow:var(--jl-shadow-lg);flex-direction:column;margin:12vh auto auto;padding:0;overflow:hidden}dialog[open]{animation:drop var(--jl-fast) var(--jl-ease);display:flex}dialog::backdrop{background:var(--jl-scrim);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.search{border-bottom:1px solid var(--jl-line);flex:none;align-items:center;gap:10px;height:52px;padding:0 14px 0 16px;display:flex}.search-icon,.search-spinner{color:var(--jl-faint);flex:none}input{min-width:0;height:100%;font-size:max(15px, var(--jl-control-font));background:0 0;border:none;outline:none;flex:1;padding:0}input::placeholder{color:var(--jl-faint)}input:focus-visible{box-shadow:none}kbd{border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-xs);background:var(--jl-surface);min-width:20px;height:20px;color:var(--jl-muted);border-bottom-width:2px;justify-content:center;align-items:center;padding:0 5px;font-size:11px;font-weight:500;line-height:1;display:inline-flex}.results{overscroll-behavior:contain;flex:1;min-height:0;padding:6px;scroll-padding:6px;overflow-y:auto}[role=group]+[role=group]{border-top:1px solid var(--jl-line-soft);margin-top:4px;padding-top:4px}.group-label{color:var(--jl-muted);font-size:var(--jl-font-xs);padding:8px 10px 4px;font-weight:600}.option{border-radius:var(--jl-radius-sm);min-height:38px;color:var(--jl-text-2);cursor:pointer;align-items:center;gap:10px;padding:0 10px;display:flex}.option[aria-selected=true]{background:var(--jl-accent-soft);color:var(--jl-text)}.option-icon{width:16px;color:var(--jl-muted);flex:none}.option[aria-selected=true] .option-icon{color:var(--jl-accent)}.option-label{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.option-description{max-width:40%;color:var(--jl-muted);font-size:var(--jl-font-xs);text-overflow:ellipsis;white-space:nowrap;flex:none;overflow:hidden}mark{color:var(--jl-accent);background:0 0;font-weight:700}.keys{flex:none;gap:3px;display:inline-flex}.empty{color:var(--jl-muted);text-align:center;padding:36px 16px}.results:empty,.results:not(:empty)+.empty{display:none}footer{border-top:1px solid var(--jl-line);background:var(--jl-surface-2);color:var(--jl-muted);font-size:var(--jl-font-xs);flex-wrap:wrap;flex:none;align-items:center;gap:6px 16px;padding:8px 16px;display:flex}.hint,.hotkey-keys{align-items:center;gap:4px;display:inline-flex}.hotkey-hint{margin-left:auto}@media (width<520px){dialog{max-height:calc(100dvh - 24px);margin-top:12px}.hotkey-hint{display:none}}@keyframes drop{0%{opacity:0;transform:translateY(-6px)scale(.98)}}";
2
+ var jl_command_palette_default = ":host{display:contents}dialog{border:1px solid var(--jl-line);border-radius:var(--jl-radius-lg);background:var(--jl-surface);width:min(620px,100vw - 24px);max-width:none;max-height:min(520px,100dvh - 24vh);color:var(--jl-text);font-size:var(--jl-font-md);box-shadow:var(--jl-shadow-lg);flex-direction:column;margin:12vh auto auto;padding:0;overflow:hidden}dialog[open]{animation:drop var(--jl-fast) var(--jl-ease);display:flex}dialog::backdrop{background:var(--jl-scrim);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.search{border-bottom:1px solid var(--jl-line);flex:none;align-items:center;gap:10px;height:52px;padding:0 14px 0 16px;display:flex}.search-icon,.search-spinner{color:var(--jl-faint);flex:none}input{min-width:0;height:100%;font-size:max(15px, var(--jl-control-font));background:0 0;border:none;outline:none;flex:1;padding:0}input::placeholder{color:var(--jl-muted)}input:focus-visible{box-shadow:none}kbd{border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-xs);background:var(--jl-surface);min-width:20px;height:20px;color:var(--jl-muted);border-bottom-width:2px;justify-content:center;align-items:center;padding:0 5px;font-size:11px;font-weight:500;line-height:1;display:inline-flex}.results{overscroll-behavior:contain;flex:1;min-height:0;padding:6px;scroll-padding:6px;overflow-y:auto}[role=group]+[role=group]{border-top:1px solid var(--jl-line-soft);margin-top:4px;padding-top:4px}.group-label{color:var(--jl-muted);font-size:var(--jl-font-xs);padding:8px 10px 4px;font-weight:600}.option{border-radius:var(--jl-radius-sm);min-height:38px;color:var(--jl-text-2);cursor:pointer;align-items:center;gap:10px;padding:0 10px;display:flex}.option[aria-selected=true]{background:var(--jl-accent-soft);color:var(--jl-text)}.option-icon{width:16px;color:var(--jl-muted);flex:none}.option[aria-selected=true] .option-icon{color:var(--jl-accent)}.option-label{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.option-description{max-width:40%;color:var(--jl-muted);font-size:var(--jl-font-xs);text-overflow:ellipsis;white-space:nowrap;flex:none;overflow:hidden}mark{color:var(--jl-accent);background:0 0;font-weight:700}.keys{flex:none;gap:3px;display:inline-flex}.empty{color:var(--jl-muted);text-align:center;padding:36px 16px}.results:empty,.results:not(:empty)+.empty{display:none}footer{border-top:1px solid var(--jl-line);background:var(--jl-surface-2);color:var(--jl-muted);font-size:var(--jl-font-xs);flex-wrap:wrap;flex:none;align-items:center;gap:6px 16px;padding:8px 16px;display:flex}.hint,.hotkey-keys{align-items:center;gap:4px;display:inline-flex}.hotkey-hint{margin-left:auto}@media (width<520px){dialog{max-height:calc(100dvh - 24px);margin-top:12px}.hotkey-hint{display:none}}@keyframes drop{0%{opacity:0;transform:translateY(-6px)scale(.98)}}";
3
3
  export { jl_command_palette_default as default };
@@ -63,6 +63,8 @@ export declare class JlCommandPalette<Id extends string = string> extends JlElem
63
63
  templateCss(): string;
64
64
  protected drawTexts(): void;
65
65
  onConnect(): void;
66
+ /** A palette taken out of the page while it shows is no longer the modal on top. */
67
+ onDisconnect(): void;
66
68
  private toggleOnHotkey;
67
69
  private navigate;
68
70
  private indexOf;
@@ -6,8 +6,9 @@ import { registerIcons } from "../lib/icons.js";
6
6
  import { JlIcon } from "../atoms/jl-icon.js";
7
7
  import { setOrRemove } from "../lib/dom.js";
8
8
  import { JlSpinner } from "../atoms/jl-spinner.js";
9
- import { highlightSegments } from "../lib/fuzzy.js";
10
9
  import { hotkeyLabels, isApplePlatform, matchesHotkey, parseHotkey } from "../lib/hotkey.js";
10
+ import { highlightSegments } from "../lib/fuzzy.js";
11
+ import { modalClosed, modalOpened, onBackdropPress } from "../lib/modal.js";
11
12
  import { groupMatches, matchCommands } from "../lib/palette.js";
12
13
  import jl_command_palette_default from "./jl-command-palette.css.js";
13
14
  import { css } from "@jadis/core";
@@ -187,15 +188,18 @@ var JlCommandPalette = class extends JlElement {
187
188
  if (index !== null) this.choose(index);
188
189
  });
189
190
  this.on(dialog, "close", () => {
191
+ modalClosed(dialog);
190
192
  this.reflect("open", false);
191
193
  this.open.set(false);
192
194
  this.events.emit("close");
193
195
  });
194
- this.on(dialog, "click", (event) => {
195
- if (event.target === dialog) this.close();
196
- });
196
+ onBackdropPress(dialog, () => this.close(), this.killSignal);
197
197
  this.renderOpen(this.open.get());
198
198
  }
199
+ /** A palette taken out of the page while it shows is no longer the modal on top. */
200
+ onDisconnect() {
201
+ modalClosed(this._refs.dialog);
202
+ }
199
203
  toggleOnHotkey(event) {
200
204
  const hotkey = this.hotkey.get();
201
205
  if (hotkey === "" || hotkey === NO_HOTKEY || event.defaultPrevented) return;
@@ -237,12 +241,14 @@ var JlCommandPalette = class extends JlElement {
237
241
  if (!open) {
238
242
  this.reflect("open", false);
239
243
  dialog.close();
244
+ modalClosed(dialog);
240
245
  return;
241
246
  }
242
247
  this._refs.input.value = "";
243
248
  this.renderResults();
244
249
  this.search("");
245
250
  dialog.showModal();
251
+ modalOpened(dialog);
246
252
  this._refs.input.focus();
247
253
  this.reflect("open", true);
248
254
  this.events.emit("open");
@@ -39,6 +39,9 @@ export declare class JlDialog extends JlElement {
39
39
  templateCss(): string;
40
40
  protected drawTexts(): void;
41
41
  onConnect(): void;
42
+ /** A dialog taken out of the page while it shows is no longer the modal on top. */
43
+ onDisconnect(): void;
44
+ private closeUnlessPersistent;
42
45
  private renderFooter;
43
46
  private renderOpen;
44
47
  }
@@ -4,6 +4,7 @@ import { JlElement } from "../base/jl-element.js";
4
4
  import { oneOf } from "../lib/attributes.js";
5
5
  import { registerIcons } from "../lib/icons.js";
6
6
  import { JlButton } from "../atoms/jl-button.js";
7
+ import { modalClosed, modalOpened, onBackdropPress, setPersistent } from "../lib/modal.js";
7
8
  import jl_dialog_default from "./jl-dialog.css.js";
8
9
  import { css } from "@jadis/core";
9
10
  import { X } from "lucide";
@@ -37,6 +38,7 @@ var JlDialog = class extends JlElement {
37
38
  /** Keeps the dialog open on Escape and on a click outside: only its own buttons close it. */
38
39
  persistent = this.useChange(false, (value) => {
39
40
  this._refs.close.hidden = value;
41
+ setPersistent(this._refs.dialog, value);
40
42
  }, { attribute: "persistent" });
41
43
  _refs = this.useRefs((ref) => ({
42
44
  actions: ref("slot[name=\"actions\"]"),
@@ -87,18 +89,24 @@ var JlDialog = class extends JlElement {
87
89
  const dialog = this._refs.dialog;
88
90
  this._refs.close.events.register("press", () => this.close());
89
91
  this.on(dialog, "close", () => {
92
+ modalClosed(dialog);
90
93
  this.open.set(false);
91
94
  this.events.emit("close");
92
95
  });
93
96
  this.on(dialog, "cancel", (event) => {
94
97
  if (this.persistent.get()) event.preventDefault();
95
98
  });
96
- this.on(dialog, "click", (event) => {
97
- if (event.target === dialog && !this.persistent.get()) this.close();
98
- });
99
+ onBackdropPress(dialog, () => this.closeUnlessPersistent(), this.killSignal);
99
100
  this.renderFooter();
100
101
  this.on(this._refs.actions, "slotchange", () => this.renderFooter());
101
102
  }
103
+ /** A dialog taken out of the page while it shows is no longer the modal on top. */
104
+ onDisconnect() {
105
+ modalClosed(this._refs.dialog);
106
+ }
107
+ closeUnlessPersistent() {
108
+ if (!this.persistent.get()) this.close();
109
+ }
102
110
  renderFooter() {
103
111
  this._refs.footer.hidden = this._refs.actions.assignedElements().length === 0;
104
112
  }
@@ -109,10 +117,12 @@ var JlDialog = class extends JlElement {
109
117
  if (open) {
110
118
  this.renderFooter();
111
119
  dialog.showModal();
120
+ modalOpened(dialog);
112
121
  this.events.emit("open");
113
122
  return;
114
123
  }
115
124
  dialog.close();
125
+ modalClosed(dialog);
116
126
  }
117
127
  };
118
128
  JlDialog.register();
@@ -46,6 +46,9 @@ export declare class JlDrawer extends JlElement {
46
46
  templateCss(): string;
47
47
  protected drawTexts(): void;
48
48
  onConnect(): void;
49
+ /** A drawer taken out of the page while it shows is no longer the modal on top. */
50
+ onDisconnect(): void;
51
+ private closeUnlessPersistent;
49
52
  private renderFooter;
50
53
  private renderOpen;
51
54
  }
@@ -4,6 +4,7 @@ import { JlElement } from "../base/jl-element.js";
4
4
  import { oneOf } from "../lib/attributes.js";
5
5
  import { registerIcons } from "../lib/icons.js";
6
6
  import { JlButton } from "../atoms/jl-button.js";
7
+ import { modalClosed, modalOpened, onBackdropPress, setPersistent } from "../lib/modal.js";
7
8
  import jl_drawer_default from "./jl-drawer.css.js";
8
9
  import { css } from "@jadis/core";
9
10
  import { X } from "lucide";
@@ -47,6 +48,7 @@ var JlDrawer = class extends JlElement {
47
48
  /** Keeps the drawer open on Escape and on a click outside: only its own buttons close it. */
48
49
  persistent = this.useChange(false, (value) => {
49
50
  this._refs.close.hidden = value;
51
+ setPersistent(this._refs.dialog, value);
50
52
  }, { attribute: "persistent" });
51
53
  _refs = this.useRefs((ref) => ({
52
54
  close: ref(".close"),
@@ -108,6 +110,7 @@ var JlDrawer = class extends JlElement {
108
110
  const dialog = this._refs.dialog;
109
111
  this._refs.close.events.register("press", () => this.close());
110
112
  this.on(dialog, "close", () => {
113
+ modalClosed(dialog);
111
114
  this.reflect("open", false);
112
115
  this.open.set(false);
113
116
  this.events.emit("close");
@@ -115,13 +118,18 @@ var JlDrawer = class extends JlElement {
115
118
  this.on(dialog, "cancel", (event) => {
116
119
  if (this.persistent.get()) event.preventDefault();
117
120
  });
118
- this.on(dialog, "click", (event) => {
119
- if (event.target === dialog && !this.persistent.get()) this.close();
120
- });
121
+ onBackdropPress(dialog, () => this.closeUnlessPersistent(), this.killSignal);
121
122
  this.renderFooter();
122
123
  this.on(this._refs.footerSlot, "slotchange", () => this.renderFooter());
123
124
  this.renderOpen(this.open.get());
124
125
  }
126
+ /** A drawer taken out of the page while it shows is no longer the modal on top. */
127
+ onDisconnect() {
128
+ modalClosed(this._refs.dialog);
129
+ }
130
+ closeUnlessPersistent() {
131
+ if (!this.persistent.get()) this.close();
132
+ }
125
133
  renderFooter() {
126
134
  this._refs.footer.hidden = this._refs.footerSlot.assignedElements().length === 0;
127
135
  }
@@ -130,12 +138,14 @@ var JlDrawer = class extends JlElement {
130
138
  if (open === dialog.open || !this.isConnected) return;
131
139
  if (open) {
132
140
  dialog.showModal();
141
+ modalOpened(dialog);
133
142
  this.reflect("open", true);
134
143
  this.events.emit("open");
135
144
  return;
136
145
  }
137
146
  this.reflect("open", false);
138
147
  dialog.close();
148
+ modalClosed(dialog);
139
149
  }
140
150
  };
141
151
  JlDrawer.register();
@@ -59,6 +59,8 @@ export declare class JlFlow extends JlElement {
59
59
  templateHtml(): Node;
60
60
  templateCss(): string;
61
61
  protected drawTexts(): void;
62
+ /** What a drawn node says in jlib's language: how it did in the run, and what each of its + buttons adds after. */
63
+ private drawNodeTexts;
62
64
  private renderLabel;
63
65
  onConnect(): void;
64
66
  private show;
@@ -64,14 +64,16 @@ var STATUS_ICONS = {
64
64
  running: "loader-circle",
65
65
  waiting: "hourglass"
66
66
  };
67
- var STATUS_LABELS = {
68
- done: "Done",
69
- failed: "Failed",
70
- running: "Running",
71
- waiting: "Waiting"
67
+ var STATUS_TEXTS = {
68
+ done: "flowDone",
69
+ failed: "flowFailed",
70
+ running: "flowRunning",
71
+ waiting: "flowWaiting"
72
72
  };
73
+ /** How a node did in the run, in jlib's language. */
74
+ var statusText = (status) => jlText(STATUS_TEXTS[status]);
73
75
  /** What screen readers hear after a node's label: how it did in the run, and what to fix. */
74
- var noteOf = (node) => [node.status ? STATUS_LABELS[node.status] : "", node.problem ?? ""].filter((part) => part !== "").join(". ");
76
+ var noteOf = (node) => [node.status ? statusText(node.status) : "", node.problem ?? ""].filter((part) => part !== "").join(". ");
75
77
  var markOf = (element, name) => element?.closest(`[${name}]`)?.getAttribute(name) ?? void 0;
76
78
  var isControl = (event) => event.composedPath().some((element) => element instanceof Element && element.hasAttribute("data-control"));
77
79
  function targetOf(event) {
@@ -86,7 +88,10 @@ function targetOf(event) {
86
88
  }
87
89
  var distance = (a, b) => Math.hypot(a.x - b.x, a.y - b.y);
88
90
  var newId = (prefix) => `${prefix}_${crypto.randomUUID().replaceAll("-", "").slice(0, ID_LENGTH)}`;
89
- var addLabel = (node, port) => port.label ? `Add after ${node.label}, ${port.label}` : `Add after ${node.label}`;
91
+ var addLabel = (node, port) => port.label ? jlText("addAfterPort", {
92
+ name: node.label,
93
+ port: port.label
94
+ }) : jlText("addAfter", { name: node.label });
90
95
  /** Whether a node's new version differs in its position alone, as a drag or the arrows leave it: it only moves. */
91
96
  function movedOnly(before, after) {
92
97
  return [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])].every((key) => key === "position" || Reflect.get(before, key) === Reflect.get(after, key));
@@ -285,9 +290,24 @@ var JlFlow = class extends JlElement {
285
290
  button.title = text;
286
291
  button.setAttribute("aria-label", text);
287
292
  }
288
- for (const { element } of this._nodes.values()) element.setAttribute("aria-roledescription", jlText("node"));
293
+ for (const { element, node } of this._nodes.values()) {
294
+ element.setAttribute("aria-roledescription", jlText("node"));
295
+ this.drawNodeTexts(element, node);
296
+ }
289
297
  for (const port of this._refs.nodes.querySelectorAll(".port")) port.title = jlText("dragToConnect");
290
298
  }
299
+ /** What a drawn node says in jlib's language: how it did in the run, and what each of its + buttons adds after. */
300
+ drawNodeTexts(element, node) {
301
+ if (node === void 0) return;
302
+ setOrRemove(element, "aria-description", noteOf(node));
303
+ const status = element.querySelector(".status");
304
+ if (status !== null && node.status) status.title = statusText(node.status);
305
+ const ports = portsOf(node);
306
+ for (const add of element.querySelectorAll(".add")) {
307
+ const port = ports.find((candidate) => candidate.id === add.dataset.add);
308
+ add.setAttribute("aria-label", port === void 0 ? "" : addLabel(node, port));
309
+ }
310
+ }
291
311
  renderLabel() {
292
312
  this._refs.viewport.setAttribute("aria-label", this.label.get() || jlText("flow"));
293
313
  }
@@ -692,7 +712,7 @@ var JlFlow = class extends JlElement {
692
712
  }) : null,
693
713
  node.status ? /* @__PURE__ */ jsx("span", {
694
714
  class: "status",
695
- title: STATUS_LABELS[node.status],
715
+ title: statusText(node.status),
696
716
  attrs: { part: "status" },
697
717
  children: /* @__PURE__ */ jsx(JlIcon, {
698
718
  name: STATUS_ICONS[node.status],
@@ -1,3 +1,3 @@
1
1
  // src/organisms/jl-table.css?inline
2
- var jl_table_default = ":host{contain:inline-size;--max-height:none;--cell-y:10px;--cell-x:14px;--select-width:44px;--expand-width:36px;--lead:0px;display:block}:host([expandable]){--lead:var(--expand-width)}:host([expandable][selectable]){--expand-width:28px;--lead:calc(var(--select-width) + var(--expand-width))}:host([dense]){--cell-y:6px;--cell-x:12px}.scroll{max-height:var(--max-height);border:1px solid var(--jl-line);border-radius:var(--jl-radius);background:var(--jl-surface);overscroll-behavior-x:contain;position:relative;overflow:auto}:host([expandable]) .scroll{container-type:inline-size}table{border-collapse:separate;border-spacing:0;width:100%;color:var(--jl-text);font-size:var(--jl-font-md);line-height:20px}th,td{padding:var(--cell-y) var(--cell-x);white-space:nowrap;vertical-align:middle}th{z-index:1;border-bottom:1px solid var(--jl-line);background:var(--jl-surface-2);color:var(--jl-muted);font-size:var(--jl-font-xs);letter-spacing:.01em;text-align:left;font-weight:600;position:sticky;top:0}td{border-top:1px solid var(--jl-line-soft)}tbody tr:first-child td{border-top:none}tbody tr.empty td{padding:40px var(--cell-x);color:var(--jl-muted);text-align:center}tbody tr.detail td{padding:0 var(--cell-x) calc(var(--cell-y) + 6px) calc(var(--lead) + var(--cell-x));white-space:normal;cursor:auto;border-top:none}.detail-body{left:calc(var(--lead) + var(--cell-x));max-width:calc(100cqi - var(--lead) - 2 * var(--cell-x));position:sticky}.align-left{text-align:left}.align-center{text-align:center}.align-right{text-align:right}.sort{border-radius:var(--jl-radius-xs);color:inherit;font-weight:inherit;letter-spacing:inherit;cursor:pointer;background:0 0;border:none;align-items:center;gap:4px;margin:-2px -4px;padding:2px 4px;display:inline-flex}.sort:hover{color:var(--jl-text)}.sort-icon{color:var(--jl-faint)}th[aria-sort]{color:var(--jl-text)}th[aria-sort] .sort-icon{color:var(--jl-accent)}tbody tr[data-marked] td{background:var(--jl-accent-soft)}tbody tr[data-marked] td:first-child{box-shadow:inset 3px 0 0 var(--jl-accent)}tbody tr:has(>.select-cell .checkbox:checked) td{background:var(--jl-accent-soft)}tbody tr:not(.empty,.skeleton,.detail,:has(>.select-cell .checkbox:checked)):hover td,:host([striped]) tbody tr:nth-child(2n of :where(:not(.detail))):not(.empty,[data-marked],:has(>.select-cell .checkbox:checked)) td{background:var(--jl-surface-2)}:host([striped]) tbody tr:not(.empty,.skeleton,.detail,:has(>.select-cell .checkbox:checked)):hover td{background:var(--jl-surface-3)}:host([striped]) tbody tr:nth-child(2n of :where(:not(.detail))):not([data-marked],:has(>.select-cell .checkbox:checked))+.detail td{background:var(--jl-surface-2)}.format-number{font-variant-numeric:tabular-nums}td.wrap{white-space:normal;overflow-wrap:anywhere;min-width:160px}.format-date{color:var(--jl-text-2);font-variant-numeric:tabular-nums}code{border-radius:var(--jl-radius-xs);background:var(--jl-code-bg);font-size:var(--jl-font-xs);padding:2px 6px}.select-cell{width:var(--select-width);padding-right:0;line-height:0}.expand-cell{width:var(--expand-width);padding-right:0;padding-left:calc(var(--cell-x) - 4px);line-height:0}.select-cell+.expand-cell{padding-left:0}:host([expandable]) tbody tr[data-index]{cursor:pointer}.expand{border-radius:var(--jl-radius-xs);width:24px;height:24px;color:var(--jl-muted);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;margin:-2px 0;padding:0;display:inline-flex}.expand:hover{color:var(--jl-text)}.chevron{transition:rotate var(--jl-fast) var(--jl-ease)}.expand[aria-expanded=true] .chevron{rotate:90deg}.check{display:inline-flex;position:relative}.checkbox{border:1.5px solid var(--jl-line-strong);background:var(--jl-surface);cursor:pointer;appearance:none;width:16px;height:16px;transition:background var(--jl-fast) var(--jl-ease), border-color var(--jl-fast) var(--jl-ease);border-radius:4px;margin:0}.checkbox:hover{border-color:var(--jl-muted)}.checkbox:checked,.checkbox:indeterminate{border-color:var(--jl-accent);background:var(--jl-accent)}.checkbox:disabled{cursor:not-allowed;opacity:.5}.mark{pointer-events:none;position:absolute;inset:0}.checkbox:checked+.mark:after{border:solid var(--jl-on-accent);content:\"\";border-width:0 2px 2px 0;width:5px;height:9px;position:absolute;top:2.5px;left:5.5px;rotate:45deg}.checkbox:indeterminate+.mark:after{background:var(--jl-on-accent);content:\"\";border-radius:1px;height:2px;position:absolute;top:7px;left:4px;right:4px}.empty-content{align-items:center;gap:8px;display:inline-flex}.empty jl-icon{color:var(--jl-faint)}.bone{border-radius:var(--jl-radius-pill);background:linear-gradient(90deg, var(--jl-surface-3) 30%, var(--jl-surface-2) 50%, var(--jl-surface-3) 70%) 0 0 / 300% 100%;vertical-align:middle;width:70%;max-width:160px;height:10px;animation:1.4s linear infinite shimmer;display:inline-block}.bone.box{border-radius:4px;width:16px;height:16px}tbody tr.skeleton:nth-child(3n+2) .bone:not(.box){width:50%}tbody tr.skeleton:nth-child(3n) .bone:not(.box){width:85%}@media (prefers-reduced-motion:reduce){.bone{animation:none}}@keyframes shimmer{0%{background-position:100% 0}to{background-position:0 0}}.cell-description{color:var(--jl-muted);font-size:var(--jl-font-xs);margin-top:2px}";
2
+ var jl_table_default = ":host{contain:inline-size;--max-height:none;--cell-y:10px;--cell-x:14px;--select-width:44px;--expand-width:36px;--lead:0px;display:block}:host([expandable]){--lead:var(--expand-width)}:host([expandable][selectable]){--expand-width:28px;--lead:calc(var(--select-width) + var(--expand-width))}:host([dense]){--cell-y:6px;--cell-x:12px}.scroll{max-height:var(--max-height);border:1px solid var(--jl-line);border-radius:var(--jl-radius);background:var(--jl-surface);overscroll-behavior-x:contain;position:relative;overflow:auto}:host([expandable]) .scroll{container-type:inline-size}table{border-collapse:separate;border-spacing:0;width:100%;color:var(--jl-text);font-size:var(--jl-font-md);line-height:20px}th,td{padding:var(--cell-y) var(--cell-x);white-space:nowrap;vertical-align:middle}th{z-index:1;border-bottom:1px solid var(--jl-line);background:var(--jl-surface-2);color:var(--jl-muted);font-size:var(--jl-font-xs);letter-spacing:.01em;text-align:left;font-weight:600;position:sticky;top:0}td{border-top:1px solid var(--jl-line-soft)}tbody tr:first-child td{border-top:none}tbody tr.empty td{padding:40px var(--cell-x);color:var(--jl-muted);text-align:center}tbody tr.detail td{padding:0 var(--cell-x) calc(var(--cell-y) + 6px) calc(var(--lead) + var(--cell-x));white-space:normal;cursor:auto;border-top:none}.detail-body{left:calc(var(--lead) + var(--cell-x));max-width:calc(100cqi - var(--lead) - 2 * var(--cell-x));position:sticky}.align-left{text-align:left}.align-center{text-align:center}.align-right{text-align:right}.sort{border-radius:var(--jl-radius-xs);color:inherit;font-weight:inherit;letter-spacing:inherit;cursor:pointer;background:0 0;border:none;align-items:center;gap:4px;margin:-2px -4px;padding:2px 4px;display:inline-flex}.sort:hover{color:var(--jl-text)}.sort-icon{color:var(--jl-faint)}th[aria-sort]{color:var(--jl-text)}th[aria-sort] .sort-icon{color:var(--jl-accent)}tbody tr[data-marked] td{background:var(--jl-accent-soft)}tbody tr[data-marked] td:first-child{box-shadow:inset 3px 0 0 var(--jl-accent)}tbody tr:has(>.select-cell .checkbox:checked) td{background:var(--jl-accent-soft)}tbody tr:not(.empty,.skeleton,.detail,:has(>.select-cell .checkbox:checked)):hover td,:host([striped]) tbody tr:nth-child(2n of :where(:not(.detail))):not(.empty,[data-marked],:has(>.select-cell .checkbox:checked)) td{background:var(--jl-surface-2)}:host([striped]) tbody tr:not(.empty,.skeleton,.detail,:has(>.select-cell .checkbox:checked)):hover td{background:var(--jl-surface-3)}:host([striped]) tbody tr:nth-child(2n of :where(:not(.detail))):not([data-marked],:has(>.select-cell .checkbox:checked))+.detail td{background:var(--jl-surface-2)}.format-number{font-variant-numeric:tabular-nums}td.wrap{white-space:normal;overflow-wrap:anywhere;min-width:160px}.format-date{color:var(--jl-text-2);font-variant-numeric:tabular-nums}code{border-radius:var(--jl-radius-xs);background:var(--jl-code-bg);font-size:var(--jl-font-xs);padding:2px 6px}.select-cell{width:var(--select-width);padding-right:0;line-height:0}.expand-cell{width:var(--expand-width);padding-right:0;padding-left:calc(var(--cell-x) - 4px);line-height:0}.select-cell+.expand-cell{padding-left:0}tbody tr[data-index]{cursor:var(--row-cursor,auto)}:host([expandable]) tbody tr[data-index]{cursor:pointer}.expand{border-radius:var(--jl-radius-xs);width:24px;height:24px;color:var(--jl-muted);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;margin:-2px 0;padding:0;display:inline-flex}.expand:hover{color:var(--jl-text)}.chevron{transition:rotate var(--jl-fast) var(--jl-ease)}.expand[aria-expanded=true] .chevron{rotate:90deg}.check{display:inline-flex;position:relative}.checkbox{border:1.5px solid var(--jl-line-strong);background:var(--jl-surface);cursor:pointer;appearance:none;width:16px;height:16px;transition:background var(--jl-fast) var(--jl-ease), border-color var(--jl-fast) var(--jl-ease);border-radius:4px;margin:0}.checkbox:hover{border-color:var(--jl-muted)}.checkbox:checked,.checkbox:indeterminate{border-color:var(--jl-accent);background:var(--jl-accent)}.checkbox:disabled{cursor:not-allowed;opacity:.5}.mark{pointer-events:none;position:absolute;inset:0}.checkbox:checked+.mark:after{border:solid var(--jl-on-accent);content:\"\";border-width:0 2px 2px 0;width:5px;height:9px;position:absolute;top:2.5px;left:5.5px;rotate:45deg}.checkbox:indeterminate+.mark:after{background:var(--jl-on-accent);content:\"\";border-radius:1px;height:2px;position:absolute;top:7px;left:4px;right:4px}.empty-content{align-items:center;gap:8px;display:inline-flex}.empty jl-icon{color:var(--jl-faint)}.bone{border-radius:var(--jl-radius-pill);background:linear-gradient(90deg, var(--jl-surface-3) 30%, var(--jl-surface-2) 50%, var(--jl-surface-3) 70%) 0 0 / 300% 100%;vertical-align:middle;width:70%;max-width:160px;height:10px;animation:1.4s linear infinite shimmer;display:inline-block}.bone.box{border-radius:4px;width:16px;height:16px}tbody tr.skeleton:nth-child(3n+2) .bone:not(.box){width:50%}tbody tr.skeleton:nth-child(3n) .bone:not(.box){width:85%}@media (prefers-reduced-motion:reduce){.bone{animation:none}}@keyframes shimmer{0%{background-position:100% 0}to{background-position:0 0}}.cell-description{color:var(--jl-muted);font-size:var(--jl-font-xs);margin-top:2px}";
3
3
  export { jl_table_default as default };
@@ -1,5 +1,5 @@
1
1
  import { JlElement } from '../base/jl-element';
2
- import type { TableColumn, TableColumnKey, TableDetailRenderer, TableExpansion, TableField, TableRenderers, TableRow, TableRowKey, TableSort, TableSortDirection, TableToggle } from '../types/jl-table.types';
2
+ import type { TableColumn, TableColumnKey, TableDetailRenderer, TableExpansion, TableField, TablePress, TableRenderers, TableRow, TableRowKey, TableSort, TableSortDirection, TableToggle } from '../types/jl-table.types';
3
3
  export declare const TABLE_SORT_DIRECTIONS: readonly TableSortDirection[];
4
4
  export declare const TABLE_EXPANSIONS: readonly TableExpansion[];
5
5
  /**
@@ -8,7 +8,8 @@ export declare const TABLE_EXPANSIONS: readonly TableExpansion[];
8
8
  * rows in place; `selectable` adds a checkbox column. The header stays on top while the rows scroll within
9
9
  * `max-height`, and the table scrolls sideways on narrow screens. Cells of a column can be drawn by code with
10
10
  * `renderers`. `expandable` rows open on a press to show their `detail` under them, the row staying as it is: one at
11
- * a time (`single`) or any number (`multiple`).
11
+ * a time (`single`) or any number (`multiple`). A press on a row fires `press` with the row, the button and the
12
+ * browser's event, which a page cancels to refuse it: to open a record on a click, its own menu on a right click.
12
13
  *
13
14
  * Typed by its rows, `JlTable<Order>` checks and completes the fields its columns name, and hands its renderers and
14
15
  * `detail` an order; `JlTable<Order, 'actions'>` adds a column that is not a field, which a renderer draws.
@@ -19,6 +20,7 @@ export declare class JlTable<Row extends object = TableRow, Extra extends string
19
20
  sort: TableSort<Row, Extra>;
20
21
  selection: TableRowKey[];
21
22
  toggle: TableToggle;
23
+ press: TablePress<Row>;
22
24
  }>>;
23
25
  readonly columns: Readonly<Readonly<{
24
26
  get(): TableColumn<Row, Extra>[];
@@ -125,9 +127,19 @@ export declare class JlTable<Row extends object = TableRow, Extra extends string
125
127
  private sortBy;
126
128
  private changeSelection;
127
129
  /** A press on a row's chevron, or on the row anywhere but its controls and its checkbox, opens or closes it. */
130
+ /**
131
+ * A press on a row. The page hears of it first (`press`); then, for a click it did not refuse, an expandable row
132
+ * opens or closes.
133
+ */
128
134
  private pressRow;
129
135
  /** The row of data a press is on: one of the table's, not a row in the content of a detail. */
130
136
  private dataRowOf;
137
+ /**
138
+ * Whether a press is on the row itself: not on a control in it (a link, a button, its chevron), nor in its
139
+ * selection cell, nor the end of a drag that selected text. Those keep their press for themselves.
140
+ */
141
+ private isOnRowItself;
142
+ /** An expandable row opens on a press on itself, and on its chevron. */
131
143
  private opensOnPress;
132
144
  private renderMaxHeight;
133
145
  private isExpandable;
@@ -152,13 +164,12 @@ export declare class JlTable<Row extends object = TableRow, Extra extends string
152
164
  private cellValue;
153
165
  private skeletonRows;
154
166
  private emptyRow;
155
- private keyOf;
156
167
  /**
157
168
  * Draws a state on the rows whose keys came into it or left it since it was last drawn: checking or opening one
158
169
  * row changes that row alone, whatever the number of rows.
159
170
  */
160
171
  private redraw;
161
- /** The bar and the shade of marked rows, changed in place. */
172
+ /** The bar and the shade of marked rows, changed in place; `aria-selected` tells a screen reader the same. */
162
173
  private renderMarks;
163
174
  /** The details of the open rows, added under them and taken away in place: one that stays open keeps its content. */
164
175
  private renderExpansion;