@syware/jlib 0.14.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 (105) 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 +6 -2
  12. package/dist/atoms/jl-progress.d.ts +1 -0
  13. package/dist/atoms/jl-progress.js +5 -2
  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 +1 -0
  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/modal.d.ts +24 -0
  32. package/dist/lib/modal.js +52 -0
  33. package/dist/lib/numeric.d.ts +5 -0
  34. package/dist/lib/numeric.js +11 -1
  35. package/dist/lib/option-filter.d.ts +2 -0
  36. package/dist/lib/option-filter.js +1 -1
  37. package/dist/lib/press.d.ts +11 -0
  38. package/dist/lib/press.js +31 -0
  39. package/dist/lib/table.js +12 -4
  40. package/dist/lib/texts-de.d.ts +12 -0
  41. package/dist/lib/texts-de.js +12 -0
  42. package/dist/lib/texts-fr.d.ts +12 -0
  43. package/dist/lib/texts-fr.js +12 -0
  44. package/dist/lib/texts.d.ts +12 -0
  45. package/dist/lib/texts.js +12 -0
  46. package/dist/molecules/jl-accordion-item.js +2 -1
  47. package/dist/molecules/jl-calendar.d.ts +4 -0
  48. package/dist/molecules/jl-calendar.js +16 -5
  49. package/dist/molecules/jl-chip-group.css.js +1 -1
  50. package/dist/molecules/jl-chip-group.js +3 -3
  51. package/dist/molecules/jl-code-block.css.js +1 -1
  52. package/dist/molecules/jl-combobox.d.ts +4 -0
  53. package/dist/molecules/jl-combobox.js +23 -11
  54. package/dist/molecules/jl-copy-button.css.js +1 -1
  55. package/dist/molecules/jl-copy-button.d.ts +11 -4
  56. package/dist/molecules/jl-copy-button.js +48 -22
  57. package/dist/molecules/jl-date-picker.d.ts +4 -0
  58. package/dist/molecules/jl-date-picker.js +18 -12
  59. package/dist/molecules/jl-field.d.ts +5 -1
  60. package/dist/molecules/jl-field.js +24 -5
  61. package/dist/molecules/jl-file-drop.css.js +1 -1
  62. package/dist/molecules/jl-file-drop.d.ts +4 -0
  63. package/dist/molecules/jl-file-drop.js +16 -8
  64. package/dist/molecules/jl-input-list.js +13 -6
  65. package/dist/molecules/jl-load-state.d.ts +8 -0
  66. package/dist/molecules/jl-load-state.js +33 -7
  67. package/dist/molecules/jl-menu.d.ts +21 -1
  68. package/dist/molecules/jl-menu.js +58 -6
  69. package/dist/molecules/jl-number-input.d.ts +2 -0
  70. package/dist/molecules/jl-number-input.js +12 -8
  71. package/dist/molecules/jl-radio-group.js +3 -2
  72. package/dist/molecules/jl-search.js +2 -2
  73. package/dist/molecules/jl-segmented.js +2 -2
  74. package/dist/molecules/jl-tabs.js +2 -2
  75. package/dist/molecules/jl-tag-input.css.js +1 -1
  76. package/dist/molecules/jl-tag-input.d.ts +4 -0
  77. package/dist/molecules/jl-tag-input.js +17 -9
  78. package/dist/molecules/jl-toast.js +8 -4
  79. package/dist/molecules/jl-tooltip.js +8 -2
  80. package/dist/organisms/jl-command-palette.css.js +1 -1
  81. package/dist/organisms/jl-command-palette.d.ts +2 -0
  82. package/dist/organisms/jl-command-palette.js +9 -3
  83. package/dist/organisms/jl-dialog.d.ts +3 -0
  84. package/dist/organisms/jl-dialog.js +13 -3
  85. package/dist/organisms/jl-drawer.d.ts +3 -0
  86. package/dist/organisms/jl-drawer.js +13 -3
  87. package/dist/organisms/jl-flow.d.ts +2 -0
  88. package/dist/organisms/jl-flow.js +29 -9
  89. package/dist/organisms/jl-table.css.js +1 -1
  90. package/dist/organisms/jl-table.d.ts +14 -3
  91. package/dist/organisms/jl-table.js +34 -15
  92. package/dist/organisms/jl-toaster.d.ts +13 -2
  93. package/dist/organisms/jl-toaster.js +47 -4
  94. package/dist/organisms/jl-tree.css.js +1 -1
  95. package/dist/organisms/jl-tree.d.ts +23 -4
  96. package/dist/organisms/jl-tree.js +74 -18
  97. package/dist/styles/base.css.js +1 -1
  98. package/dist/styles/control.css.js +1 -1
  99. package/dist/styles/tokens.css.js +1 -1
  100. package/dist/tokens.css +4 -3
  101. package/dist/types/jl-load-state.types.d.ts +7 -0
  102. package/dist/types/jl-table.types.d.ts +12 -0
  103. package/dist/types/jl-tree.types.d.ts +17 -0
  104. package/dist/types/press.types.d.ts +6 -0
  105. package/package.json +6 -4
@@ -1,12 +1,13 @@
1
1
  import { JlElement } from '../base/jl-element';
2
- import type { TreeItem, TreeLoader } from '../types/jl-tree.types';
2
+ import type { TreeItem, TreeLoader, TreePress } from '../types/jl-tree.types';
3
3
  /**
4
4
  * Nested items that open and close, as files in folders: `items` holds them, `expanded` lists the open folders and
5
5
  * `value` is the selected item. With a `loader`, the tree loads itself a level at a time and a page at a time, so a
6
6
  * large archive opens without loading everything: the roots first, a `lazy` folder's children when it opens, and
7
7
  * the next page of a level from the button that ends it. The keyboard follows the tree pattern: Up and Down move,
8
8
  * Right opens or enters a folder, Left closes it or goes to the parent, Home and End jump, Enter selects. Emits
9
- * `select` and `toggle`; an item with an `href` is a link instead.
9
+ * `select` and `toggle`; an item with an `href` is a link instead. A press on an item fires `press` first, with
10
+ * the item, the button and the browser's event, which a page cancels to refuse it: its own menu on a right click.
10
11
  */
11
12
  export declare class JlTree extends JlElement {
12
13
  static readonly selector = "jl-tree";
@@ -16,6 +17,7 @@ export declare class JlTree extends JlElement {
16
17
  id: string;
17
18
  open: boolean;
18
19
  };
20
+ press: TreePress;
19
21
  }>>;
20
22
  readonly items: Readonly<Readonly<{
21
23
  get(): TreeItem[];
@@ -84,10 +86,21 @@ export declare class JlTree extends JlElement {
84
86
  onConnect(): void;
85
87
  private idOf;
86
88
  /**
87
- * A press selects the item; on a folder it also opens or closes it, and the chevron only does that. A link's row
88
- * leaves a modified click (a new tab) to the browser.
89
+ * A press on a row. The main button selects the item; on a folder it also opens or closes it, and the chevron
90
+ * only does that. A link's row leaves a modified click (a new tab) to the browser. The page hears of a press on
91
+ * an item first, whatever its button (`press`), and refuses it by cancelling the event.
89
92
  */
90
93
  private press;
94
+ /** A press on what the tree handles alone, with the main button: the row that ends a level, a folder's chevron. */
95
+ private pressOwnControl;
96
+ private toggleFolder;
97
+ /**
98
+ * Tells the page of a press on an item.
99
+ * @returns Whether the page refused it, by cancelling the event
100
+ */
101
+ private tellItemPress;
102
+ /** Enter or Space on an item is a press too, of the main button: the page hears of it, and may refuse it. */
103
+ private tellKeyPress;
91
104
  private handleKey;
92
105
  /** Enter on an item: the row that ends a level loads its page, a link is followed, an item is selected. */
93
106
  private activate;
@@ -116,6 +129,12 @@ export declare class JlTree extends JlElement {
116
129
  private levelEnd;
117
130
  private hasLevelEndRow;
118
131
  protected drawTexts(): void;
132
+ /**
133
+ * The tree's own texts show only in the rows that end a level (a note, a spinner, "show more", an error): those
134
+ * are drawn again, the items stay. Every input's callback runs as the tree appears: each one building every row,
135
+ * a tree built its rows seven times.
136
+ */
137
+ private drawLevelEnds;
119
138
  private errorLabel;
120
139
  private renderItemsUnlessQuiet;
121
140
  /** Sets `items` without drawing every row again, which its callback does on each set(), even of an equal value. */
@@ -7,6 +7,7 @@ import { registerIcons } from "../lib/icons.js";
7
7
  import { JlIcon } from "../atoms/jl-icon.js";
8
8
  import { isModifiedClick, setOrRemove, uniqueId } from "../lib/dom.js";
9
9
  import { JlSpinner } from "../atoms/jl-spinner.js";
10
+ import { PRESS_EVENTS, pressButtonOf, tellPress } from "../lib/press.js";
10
11
  import { allItems, childrenOf, isFolder, treeKeyAction, withExpanded, withExtraRows, withPage } from "../lib/tree.js";
11
12
  import jl_tree_default from "./jl-tree.css.js";
12
13
  import { css } from "@jadis/core";
@@ -41,7 +42,8 @@ var rowsIn = (nodes) => new Map(nodes.filter((node) => node instanceof HTMLEleme
41
42
  * large archive opens without loading everything: the roots first, a `lazy` folder's children when it opens, and
42
43
  * the next page of a level from the button that ends it. The keyboard follows the tree pattern: Up and Down move,
43
44
  * Right opens or enters a folder, Left closes it or goes to the parent, Home and End jump, Enter selects. Emits
44
- * `select` and `toggle`; an item with an `href` is a link instead.
45
+ * `select` and `toggle`; an item with an `href` is a link instead. A press on an item fires `press` first, with
46
+ * the item, the button and the browser's event, which a page cancels to refuse it: its own menu on a right click.
45
47
  */
46
48
  var JlTree = class extends JlElement {
47
49
  static selector = "jl-tree";
@@ -63,15 +65,15 @@ var JlTree = class extends JlElement {
63
65
  /** The tree's name for screen readers. */
64
66
  label = this.useChange("", (value) => setOrRemove(this._refs.tree, "aria-label", value), { attribute: "label" });
65
67
  /** What an empty tree says, such as "No object yet"; none by default. */
66
- emptyText = this.useChange("", () => this.renderItems(), { attribute: "empty-text" });
68
+ emptyText = this.useChange("", () => this.drawLevelEnds(), { attribute: "empty-text" });
67
69
  /** Said while a page loads; jlib's own text when empty. */
68
- loadingText = this.useChange("", () => this.renderItems(), { attribute: "loading-text" });
70
+ loadingText = this.useChange("", () => this.drawLevelEnds(), { attribute: "loading-text" });
69
71
  /** The button that loads a level's next page, `{count}` being how many items are left; jlib's own when empty. */
70
- moreText = this.useChange("", () => this.renderItems(), { attribute: "more-text" });
72
+ moreText = this.useChange("", () => this.drawLevelEnds(), { attribute: "more-text" });
71
73
  /** Said where a page could not be loaded; jlib's own text when empty. */
72
- errorText = this.useChange("", () => this.renderItems(), { attribute: "error-text" });
74
+ errorText = this.useChange("", () => this.drawLevelEnds(), { attribute: "error-text" });
73
75
  /** The action that loads it again; jlib's own text when empty. */
74
- retryLabel = this.useChange("", () => this.renderItems(), { attribute: "retry-label" });
76
+ retryLabel = this.useChange("", () => this.drawLevelEnds(), { attribute: "retry-label" });
75
77
  _source = { loader: null };
76
78
  _rows = /* @__PURE__ */ new Map();
77
79
  _focus = { id: "" };
@@ -133,7 +135,7 @@ var JlTree = class extends JlElement {
133
135
  }
134
136
  onConnect() {
135
137
  const tree = this._refs.tree;
136
- this.on(tree, "click", (event) => this.press(event));
138
+ for (const type of PRESS_EVENTS) this.on(tree, type, (event) => this.press(event));
137
139
  this.on(tree, "keydown", (event) => this.handleKey(event));
138
140
  this.on(tree, "focusin", (event) => {
139
141
  const id = this.idOf(event.target);
@@ -144,30 +146,71 @@ var JlTree = class extends JlElement {
144
146
  return (target instanceof Element ? target.closest("[role=\"treeitem\"]") : null)?.dataset.id ?? null;
145
147
  }
146
148
  /**
147
- * A press selects the item; on a folder it also opens or closes it, and the chevron only does that. A link's row
148
- * leaves a modified click (a new tab) to the browser.
149
+ * A press on a row. The main button selects the item; on a folder it also opens or closes it, and the chevron
150
+ * only does that. A link's row leaves a modified click (a new tab) to the browser. The page hears of a press on
151
+ * an item first, whatever its button (`press`), and refuses it by cancelling the event.
149
152
  */
150
153
  press(event) {
151
154
  const id = this.idOf(event.target);
152
- if (id !== null && isLevelEnd(id)) {
155
+ const button = pressButtonOf(event);
156
+ if (id === null || button === null) return;
157
+ const item = isLevelEnd(id) ? void 0 : this.findItem(id);
158
+ const onChevron = event.target instanceof Element && event.target.closest(".chevron") !== null;
159
+ if (item === void 0 || onChevron) {
160
+ this.pressOwnControl(event, id, button);
161
+ return;
162
+ }
163
+ if (item.href !== void 0 && button === "main" && isModifiedClick(event) || this.tellItemPress({
164
+ button,
165
+ event,
166
+ id,
167
+ item
168
+ }) || button !== "main") return;
169
+ this.toggleFolder(item);
170
+ this.select(item);
171
+ this.moveFocus(id, true);
172
+ }
173
+ /** A press on what the tree handles alone, with the main button: the row that ends a level, a folder's chevron. */
174
+ pressOwnControl(event, id, button) {
175
+ if (button !== "main") return;
176
+ if (isLevelEnd(id)) {
153
177
  this.loadNextPage(parentOfLevelEnd(id));
154
178
  return;
155
179
  }
156
- const item = id === null ? void 0 : this.findItem(id);
157
- if (id === null || item === void 0) return;
158
- const onChevron = event.target instanceof Element && event.target.closest(".chevron") !== null;
159
- if (onChevron) event.preventDefault();
160
- if (item.href !== void 0 && !onChevron && isModifiedClick(event)) return;
161
- if (isFolder(item)) this.toggle(id, !this.expanded.get().includes(id));
162
- if (!onChevron) this.select(item);
180
+ const item = this.findItem(id);
181
+ if (item === void 0) return;
182
+ event.preventDefault();
183
+ this.toggleFolder(item);
163
184
  this.moveFocus(id, true);
164
185
  }
186
+ toggleFolder(item) {
187
+ if (isFolder(item)) this.toggle(item.id, !this.expanded.get().includes(item.id));
188
+ }
189
+ /**
190
+ * Tells the page of a press on an item.
191
+ * @returns Whether the page refused it, by cancelling the event
192
+ */
193
+ tellItemPress(press) {
194
+ return tellPress(press.event, () => this.events.emit("press", press));
195
+ }
196
+ /** Enter or Space on an item is a press too, of the main button: the page hears of it, and may refuse it. */
197
+ tellKeyPress(id, event) {
198
+ const item = isLevelEnd(id) ? void 0 : this.findItem(id);
199
+ return item !== void 0 && this.tellItemPress({
200
+ button: "main",
201
+ event,
202
+ id,
203
+ item
204
+ });
205
+ }
165
206
  handleKey(event) {
166
207
  const focused = this._focus.id;
167
208
  const keyboardItems = withExtraRows(this.items.get(), (parent) => this.hasLevelEndRow(parent) ? levelEndId(parent) : null);
168
209
  const action = treeKeyAction(keyboardItems, new Set(this.expanded.get()), focused, event.key);
169
210
  if (action === null) return;
211
+ const refused = action.kind === "select" && this.tellKeyPress(action.id, event);
170
212
  event.preventDefault();
213
+ if (refused) return;
171
214
  ({
172
215
  focus: () => this.moveFocus(action.id, true),
173
216
  select: () => this.activate(action.id),
@@ -295,7 +338,20 @@ var JlTree = class extends JlElement {
295
338
  return end !== "none" && end !== "empty";
296
339
  }
297
340
  drawTexts() {
298
- this.renderItems();
341
+ this.drawLevelEnds();
342
+ }
343
+ /**
344
+ * The tree's own texts show only in the rows that end a level (a note, a spinner, "show more", an error): those
345
+ * are drawn again, the items stay. Every input's callback runs as the tree appears: each one building every row,
346
+ * a tree built its rows seven times.
347
+ */
348
+ drawLevelEnds() {
349
+ if (this.items.get().length === 0) {
350
+ this.renderItems();
351
+ return;
352
+ }
353
+ const drawnLevels = [...this._loading.levels.keys()].filter((parent) => this.levelContainer(parent) !== null);
354
+ for (const parent of drawnLevels) this.redrawLevelEnd(parent);
299
355
  }
300
356
  errorLabel() {
301
357
  return this.errorText.get() || jlText("loadError");
@@ -1,3 +1,3 @@
1
1
  // src/styles/base.css?inline
2
- var base_default = ":host{box-sizing:border-box;font-family:var(--jl-font-sans);-webkit-tap-highlight-color:transparent}:host([hidden]){display:none!important}*,:before,:after{box-sizing:inherit}[hidden]{display:none!important}button,input,select,textarea{font:inherit;color:inherit}:focus-visible{box-shadow:var(--jl-focus-ring);outline:none}h1,h2,h3,h4,p,ul,ol,figure{margin:0}code,kbd,pre{font-family:var(--jl-font-mono)}.sr-only{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){*,:before,:after{transition-duration:1ms!important;animation-duration:1ms!important;animation-iteration-count:1!important}}";
2
+ var base_default = ":host{box-sizing:border-box;font-family:var(--jl-font-sans);-webkit-tap-highlight-color:transparent}:host([hidden]){display:none!important}*,:before,:after{box-sizing:inherit}[hidden]{display:none!important}button,input,select,textarea{font:inherit;color:inherit}:focus-visible{box-shadow:var(--jl-focus-ring);outline:none}h1,h2,h3,h4,p,ul,ol,figure{margin:0}code,kbd,pre{font-family:var(--jl-font-mono)}.sr-only{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}@media (forced-colors:active){:focus-visible{outline-offset:2px!important;outline:2px solid highlight!important}}@media (prefers-reduced-motion:reduce){*,:before,:after{transition-duration:1ms!important;animation-duration:1ms!important;animation-iteration-count:1!important}}";
3
3
  export { base_default as default };
@@ -1,3 +1,3 @@
1
1
  // src/styles/control.css?inline
2
- var control_default = ".control{width:100%;min-height:var(--height,var(--jl-control-md));border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-sm);background:var(--jl-surface);color:var(--jl-text);font-size:var(--jl-control-font);transition:border-color var(--jl-fast) var(--jl-ease), box-shadow var(--jl-fast) var(--jl-ease);align-items:center;gap:8px;padding:0 12px;line-height:20px;display:flex}.control:hover{border-color:color-mix(in srgb, var(--jl-line-strong) 60%, var(--jl-text) 18%)}.control:focus-within{border-color:var(--jl-accent);box-shadow:var(--jl-focus-ring)}:host([invalid]) .control{border-color:var(--jl-danger)}:host([invalid]) .control:focus-within{box-shadow:0 0 0 3px color-mix(in srgb, var(--jl-danger) 25%, transparent)}:host([disabled]) .control,:host(:disabled) .control{background:var(--jl-surface-2);color:var(--jl-muted);cursor:not-allowed}:host([size=sm]){--height:var(--jl-control-sm)}:host([size=lg]){--height:var(--jl-control-lg)}.native{min-width:0;height:calc(var(--height,var(--jl-control-md)) - 2px);color:inherit;font:inherit;background:0 0;border:none;outline:none;flex:1;padding:0}.native::placeholder{color:var(--jl-faint)}.native:focus-visible{box-shadow:none}.native:disabled{cursor:not-allowed}.adornment{color:var(--jl-faint);flex:none;align-items:center;display:inline-flex}.action{border-radius:var(--jl-radius-xs);width:24px;height:24px;color:var(--jl-faint);cursor:pointer;background:0 0;border:none;flex:none;justify-content:center;align-items:center;margin-right:-4px;padding:0;display:inline-flex}.action:hover{background:var(--jl-surface-3);color:var(--jl-text)}";
2
+ var control_default = ".control{width:100%;min-height:var(--height,var(--jl-control-md));border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-sm);background:var(--jl-surface);color:var(--jl-text);font-size:var(--jl-control-font);transition:border-color var(--jl-fast) var(--jl-ease), box-shadow var(--jl-fast) var(--jl-ease);align-items:center;gap:8px;padding:0 12px;line-height:20px;display:flex}.control:hover{border-color:color-mix(in srgb, var(--jl-line-strong) 60%, var(--jl-text) 18%)}.control:focus-within{border-color:var(--jl-accent);box-shadow:var(--jl-focus-ring)}:host([invalid]) .control{border-color:var(--jl-danger)}:host([invalid]) .control:focus-within{box-shadow:0 0 0 3px color-mix(in srgb, var(--jl-danger) 25%, transparent)}:host([disabled]) .control,:host(:disabled) .control{background:var(--jl-surface-2);color:var(--jl-muted);cursor:not-allowed}:host([size=sm]){--height:var(--jl-control-sm)}:host([size=lg]){--height:var(--jl-control-lg)}.native{min-width:0;height:calc(var(--height,var(--jl-control-md)) - 2px);color:inherit;font:inherit;background:0 0;border:none;outline:none;flex:1;padding:0}.native::placeholder{color:var(--jl-muted)}.native:focus-visible{box-shadow:none}.native:disabled{cursor:not-allowed}.adornment{color:var(--jl-faint);flex:none;align-items:center;display:inline-flex}.action{border-radius:var(--jl-radius-xs);width:24px;height:24px;color:var(--jl-faint);cursor:pointer;background:0 0;border:none;flex:none;justify-content:center;align-items:center;margin-right:-4px;padding:0;display:inline-flex}.action:hover{background:var(--jl-surface-3);color:var(--jl-text)}";
3
3
  export { control_default as default };
@@ -1,3 +1,3 @@
1
1
  // src/styles/tokens.css?inline
2
- var tokens_default = "@layer jlib{:root,[data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--jl-font-sans:\"Manrope Variable\", \"Manrope\", system-ui, -apple-system, \"Segoe UI\", sans-serif;--jl-font-mono:\"JetBrains Mono Variable\", \"JetBrains Mono\", ui-monospace, \"SF Mono\", Menlo, monospace;--jl-font-xs:12px;--jl-font-sm:13px;--jl-font-md:14px;--jl-font-lg:16px;--jl-font-xl:20px;--jl-font-2xl:28px;--jl-text:#0b0b0c;--jl-text-2:#3a3f47;--jl-muted:#5b616b;--jl-faint:#8a9099;--jl-bg:#fff;--jl-surface:#fff;--jl-surface-2:#f7f8f9;--jl-surface-3:#eef0f2;--jl-code-bg:#f0f2f4;--jl-line:#e6e8eb;--jl-line-soft:#eef0f2;--jl-line-strong:#d5d9de;--jl-brand:#0e88d3;--jl-accent:#0c72b0;--jl-accent-strong:#095a8b;--jl-accent-soft:#e9f4fb;--jl-accent-line:#b7dbf2;--jl-on-accent:#fff;--jl-on-brand:#fff;--jl-ok:#17784a;--jl-ok-soft:#ecf6f0;--jl-warn:#9a5b00;--jl-warn-soft:#fcf4e6;--jl-danger:#b42318;--jl-danger-soft:#fdf0ef;--jl-on-danger:#fff;--jl-info:#0c72b0;--jl-info-soft:#e9f4fb;--jl-code-keyword:#0c72b0;--jl-code-tag:#095a8b;--jl-code-attribute:#5b48c8;--jl-code-string:#17784a;--jl-code-number:#9a5b00;--jl-code-function:#3d5a80;--jl-code-property:#127a72;--jl-code-comment:#8a9099;--jl-radius-xs:6px;--jl-radius-sm:8px;--jl-radius:10px;--jl-radius-lg:12px;--jl-radius-xl:20px;--jl-radius-pill:999px;--jl-space-1:4px;--jl-space-2:8px;--jl-space-3:12px;--jl-space-4:16px;--jl-space-5:20px;--jl-space-6:24px;--jl-space-8:32px;--jl-space-10:40px;--jl-space-12:48px;--jl-space-16:64px;--jl-control-sm:30px;--jl-control-md:36px;--jl-control-lg:44px;--jl-control-font:var(--jl-font-md);--jl-page-form:720px;--jl-page-standard:1120px;--jl-page-wide:1400px;--jl-shadow-sm:0 1px 2px #0b0b0c0d;--jl-shadow:0 6px 16px -6px #0b0b0c1f;--jl-shadow-lg:0 18px 44px -14px #0b0b0c38;--jl-focus-ring:0 0 0 3px color-mix(in srgb, var(--jl-brand) 35%, transparent);--jl-scrim:#0b0b0c61;--jl-ease:cubic-bezier(.2, .7, .2, 1);--jl-fast:.12s;--jl-slow:.24s}@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--jl-text:#eceef1;--jl-text-2:#c3c8cf;--jl-muted:#959ca6;--jl-faint:#6b727c;--jl-bg:#0f1113;--jl-surface:#0f1113;--jl-surface-2:#16191c;--jl-surface-3:#1d2125;--jl-code-bg:#1d2125;--jl-line:#262a2f;--jl-line-soft:#1f2327;--jl-line-strong:#343a41;--jl-brand:#1a9be0;--jl-accent:#3ea6e8;--jl-accent-strong:#6cc0f2;--jl-accent-soft:#0f2a3b;--jl-accent-line:#1e4a66;--jl-on-accent:#04131c;--jl-ok:#4cc38a;--jl-ok-soft:#10261c;--jl-warn:#e5a54b;--jl-warn-soft:#2a2012;--jl-danger:#f0786c;--jl-danger-soft:#3a1a17;--jl-on-danger:#1c0604;--jl-info:#3ea6e8;--jl-info-soft:#0f2a3b;--jl-code-keyword:#3ea6e8;--jl-code-tag:#6cc0f2;--jl-code-attribute:#a99bf0;--jl-code-string:#4cc38a;--jl-code-number:#e5a54b;--jl-code-function:#8fb0d6;--jl-code-property:#4fc1b5;--jl-code-comment:#6b727c;--jl-shadow-sm:0 1px 2px #0006;--jl-shadow:0 6px 18px -6px #0009;--jl-shadow-lg:0 18px 44px -12px #000000b3;--jl-scrim:#0000008c}}[data-theme=dark]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--jl-text:#eceef1;--jl-text-2:#c3c8cf;--jl-muted:#959ca6;--jl-faint:#6b727c;--jl-bg:#0f1113;--jl-surface:#0f1113;--jl-surface-2:#16191c;--jl-surface-3:#1d2125;--jl-code-bg:#1d2125;--jl-line:#262a2f;--jl-line-soft:#1f2327;--jl-line-strong:#343a41;--jl-brand:#1a9be0;--jl-accent:#3ea6e8;--jl-accent-strong:#6cc0f2;--jl-accent-soft:#0f2a3b;--jl-accent-line:#1e4a66;--jl-on-accent:#04131c;--jl-ok:#4cc38a;--jl-ok-soft:#10261c;--jl-warn:#e5a54b;--jl-warn-soft:#2a2012;--jl-danger:#f0786c;--jl-danger-soft:#3a1a17;--jl-on-danger:#1c0604;--jl-info:#3ea6e8;--jl-info-soft:#0f2a3b;--jl-code-keyword:#3ea6e8;--jl-code-tag:#6cc0f2;--jl-code-attribute:#a99bf0;--jl-code-string:#4cc38a;--jl-code-number:#e5a54b;--jl-code-function:#8fb0d6;--jl-code-property:#4fc1b5;--jl-code-comment:#6b727c;--jl-shadow-sm:0 1px 2px #0006;--jl-shadow:0 6px 18px -6px #0009;--jl-shadow-lg:0 18px 44px -12px #000000b3;--jl-scrim:#0000008c}@media (pointer:coarse){:root,[data-theme=light],[data-theme=dark]{--jl-control-sm:36px;--jl-control-md:44px;--jl-control-lg:48px;--jl-control-font:16px}}}";
2
+ var tokens_default = "@layer jlib{:root,[data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--jl-font-sans:\"Manrope Variable\", \"Manrope\", system-ui, -apple-system, \"Segoe UI\", sans-serif;--jl-font-mono:\"JetBrains Mono Variable\", \"JetBrains Mono\", ui-monospace, \"SF Mono\", Menlo, monospace;--jl-font-xs:12px;--jl-font-sm:13px;--jl-font-md:14px;--jl-font-lg:16px;--jl-font-xl:20px;--jl-font-2xl:28px;--jl-text:#0b0b0c;--jl-text-2:#3a3f47;--jl-muted:#5b616b;--jl-faint:#8a9099;--jl-bg:#fff;--jl-surface:#fff;--jl-surface-2:#f7f8f9;--jl-surface-3:#eef0f2;--jl-code-bg:#f0f2f4;--jl-line:#e6e8eb;--jl-line-soft:#eef0f2;--jl-line-strong:#d5d9de;--jl-brand:#0e88d3;--jl-accent:#0c72b0;--jl-accent-strong:#095a8b;--jl-accent-soft:#e9f4fb;--jl-accent-line:#b7dbf2;--jl-on-accent:#fff;--jl-on-brand:#fff;--jl-ok:#17784a;--jl-ok-soft:#ecf6f0;--jl-warn:#9a5b00;--jl-warn-soft:#fcf4e6;--jl-danger:#b42318;--jl-danger-soft:#fdf0ef;--jl-on-danger:#fff;--jl-info:#0c72b0;--jl-info-soft:#e9f4fb;--jl-code-keyword:#0c72b0;--jl-code-tag:#095a8b;--jl-code-attribute:#5b48c8;--jl-code-string:#17784a;--jl-code-number:#9a5b00;--jl-code-function:#3d5a80;--jl-code-property:#127a72;--jl-code-comment:var(--jl-muted);--jl-radius-xs:6px;--jl-radius-sm:8px;--jl-radius:10px;--jl-radius-lg:12px;--jl-radius-xl:20px;--jl-radius-pill:999px;--jl-space-1:4px;--jl-space-2:8px;--jl-space-3:12px;--jl-space-4:16px;--jl-space-5:20px;--jl-space-6:24px;--jl-space-8:32px;--jl-space-10:40px;--jl-space-12:48px;--jl-space-16:64px;--jl-control-sm:30px;--jl-control-md:36px;--jl-control-lg:44px;--jl-control-font:var(--jl-font-md);--jl-page-form:720px;--jl-page-standard:1120px;--jl-page-wide:1400px;--jl-shadow-sm:0 1px 2px #0b0b0c0d;--jl-shadow:0 6px 16px -6px #0b0b0c1f;--jl-shadow-lg:0 18px 44px -14px #0b0b0c38;--jl-focus-ring:0 0 0 3px color-mix(in srgb, var(--jl-brand) 35%, transparent);--jl-scrim:#0b0b0c61;--jl-ease:cubic-bezier(.2, .7, .2, 1);--jl-fast:.12s;--jl-slow:.24s}@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--jl-text:#eceef1;--jl-text-2:#c3c8cf;--jl-muted:#959ca6;--jl-faint:#6b727c;--jl-bg:#0f1113;--jl-surface:#0f1113;--jl-surface-2:#16191c;--jl-surface-3:#1d2125;--jl-code-bg:#1d2125;--jl-line:#262a2f;--jl-line-soft:#1f2327;--jl-line-strong:#343a41;--jl-brand:#1a9be0;--jl-accent:#3ea6e8;--jl-accent-strong:#6cc0f2;--jl-accent-soft:#0f2a3b;--jl-accent-line:#1e4a66;--jl-on-accent:#04131c;--jl-ok:#4cc38a;--jl-ok-soft:#10261c;--jl-warn:#e5a54b;--jl-warn-soft:#2a2012;--jl-danger:#f0786c;--jl-danger-soft:#3a1a17;--jl-on-danger:#1c0604;--jl-info:#3ea6e8;--jl-info-soft:#0f2a3b;--jl-code-keyword:#3ea6e8;--jl-code-tag:#6cc0f2;--jl-code-attribute:#a99bf0;--jl-code-string:#4cc38a;--jl-code-number:#e5a54b;--jl-code-function:#8fb0d6;--jl-code-property:#4fc1b5;--jl-code-comment:var(--jl-muted);--jl-shadow-sm:0 1px 2px #0006;--jl-shadow:0 6px 18px -6px #0009;--jl-shadow-lg:0 18px 44px -12px #000000b3;--jl-scrim:#0000008c}}[data-theme=dark]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--jl-text:#eceef1;--jl-text-2:#c3c8cf;--jl-muted:#959ca6;--jl-faint:#6b727c;--jl-bg:#0f1113;--jl-surface:#0f1113;--jl-surface-2:#16191c;--jl-surface-3:#1d2125;--jl-code-bg:#1d2125;--jl-line:#262a2f;--jl-line-soft:#1f2327;--jl-line-strong:#343a41;--jl-brand:#1a9be0;--jl-accent:#3ea6e8;--jl-accent-strong:#6cc0f2;--jl-accent-soft:#0f2a3b;--jl-accent-line:#1e4a66;--jl-on-accent:#04131c;--jl-ok:#4cc38a;--jl-ok-soft:#10261c;--jl-warn:#e5a54b;--jl-warn-soft:#2a2012;--jl-danger:#f0786c;--jl-danger-soft:#3a1a17;--jl-on-danger:#1c0604;--jl-info:#3ea6e8;--jl-info-soft:#0f2a3b;--jl-code-keyword:#3ea6e8;--jl-code-tag:#6cc0f2;--jl-code-attribute:#a99bf0;--jl-code-string:#4cc38a;--jl-code-number:#e5a54b;--jl-code-function:#8fb0d6;--jl-code-property:#4fc1b5;--jl-code-comment:var(--jl-muted);--jl-shadow-sm:0 1px 2px #0006;--jl-shadow:0 6px 18px -6px #0009;--jl-shadow-lg:0 18px 44px -12px #000000b3;--jl-scrim:#0000008c}@media (pointer:coarse){:root,[data-theme=light],[data-theme=dark]{--jl-control-sm:36px;--jl-control-md:44px;--jl-control-lg:48px;--jl-control-font:16px}}}";
3
3
  export { tokens_default as default };
package/dist/tokens.css CHANGED
@@ -62,7 +62,8 @@
62
62
  --jl-code-number: #9a5b00;
63
63
  --jl-code-function: #3d5a80;
64
64
  --jl-code-property: #127a72;
65
- --jl-code-comment: #8a9099;
65
+ /* Comments are text: the lightest ink text may have, not the fainter one of icons. */
66
+ --jl-code-comment: var(--jl-muted);
66
67
 
67
68
  --jl-radius-xs: 6px;
68
69
  --jl-radius-sm: 8px;
@@ -143,7 +144,7 @@
143
144
  --jl-code-number: #e5a54b;
144
145
  --jl-code-function: #8fb0d6;
145
146
  --jl-code-property: #4fc1b5;
146
- --jl-code-comment: #6b727c;
147
+ --jl-code-comment: var(--jl-muted);
147
148
  --jl-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
148
149
  --jl-shadow: 0 6px 18px -6px rgb(0 0 0 / 0.6);
149
150
  --jl-shadow-lg: 0 18px 44px -12px rgb(0 0 0 / 0.7);
@@ -188,7 +189,7 @@
188
189
  --jl-code-number: #e5a54b;
189
190
  --jl-code-function: #8fb0d6;
190
191
  --jl-code-property: #4fc1b5;
191
- --jl-code-comment: #6b727c;
192
+ --jl-code-comment: var(--jl-muted);
192
193
  --jl-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
193
194
  --jl-shadow: 0 6px 18px -6px rgb(0 0 0 / 0.6);
194
195
  --jl-shadow-lg: 0 18px 44px -12px rgb(0 0 0 / 0.7);
@@ -8,3 +8,10 @@ export type LoadTask<Value> = {
8
8
  draw: (value: Value) => void;
9
9
  isEmpty?: (value: Value) => boolean;
10
10
  };
11
+ /** What a load's fetch came to: its value, or that it failed. */
12
+ export type Fetched<Value> = {
13
+ failed: false;
14
+ value: Value;
15
+ } | {
16
+ failed: true;
17
+ };
@@ -1,4 +1,5 @@
1
1
  import type { Tone } from './options.types';
2
+ import type { PressButton } from './press.types';
2
3
  /** How a cell shows its value: as it is, a localised number, date or date and time, a badge, or code. */
3
4
  export type TableCellFormat = 'text' | 'number' | 'date' | 'datetime' | 'badge' | 'code';
4
5
  export type TableAlign = 'left' | 'center' | 'right';
@@ -61,3 +62,14 @@ export type TableToggle = {
61
62
  key: TableRowKey;
62
63
  open: boolean;
63
64
  };
65
+ /**
66
+ * A press on a row: which row, with which button, and the browser's event. The event says where the pointer is
67
+ * (`clientX`, `clientY`); cancelling it (`event.preventDefault()`) refuses the press: the browser's menu does not
68
+ * show for the secondary button, and an expandable row stays as it is for the main one.
69
+ */
70
+ export type TablePress<Row extends object = TableRow> = {
71
+ key: TableRowKey;
72
+ row: Row;
73
+ button: PressButton;
74
+ event: MouseEvent;
75
+ };
@@ -1,3 +1,4 @@
1
+ import type { PressButton } from './press.types';
1
2
  export type TreeItem = {
2
3
  id: string;
3
4
  label: string;
@@ -14,6 +15,22 @@ export type TreeItem = {
14
15
  /** A count or a short word after the label: how many items a folder holds. */
15
16
  badge?: string | number;
16
17
  };
18
+ /**
19
+ * A press on an item: which one, with which button, and the browser's event. The main button is a pointer's or the
20
+ * keyboard's (Enter, Space); the others are always a pointer's event, which says where it is (`clientX`,
21
+ * `clientY`). Cancelling the event (`event.preventDefault()`) refuses the press: the item is not selected, its
22
+ * folder stays as it is, a link is not followed, and the browser's menu does not show.
23
+ */
24
+ export type TreePress = {
25
+ id: string;
26
+ item: TreeItem;
27
+ } & ({
28
+ button: Extract<PressButton, 'main'>;
29
+ event: MouseEvent | KeyboardEvent;
30
+ } | {
31
+ button: Exclude<PressButton, 'main'>;
32
+ event: MouseEvent;
33
+ });
17
34
  /** One page of a level, as a loader answers it: some of its items, and how many the level has in all. */
18
35
  export type TreePage = {
19
36
  items: TreeItem[];
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The button of a press on a row or an item: the main one (a click, a tap, Enter), the auxiliary one (a middle
3
+ * click), or the secondary one, which asks for a menu (a right click, the keyboard's menu key, a long press on a
4
+ * touch screen).
5
+ */
6
+ export type PressButton = 'main' | 'auxiliary' | 'secondary';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syware/jlib",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "A tree-shakeable component library on Jadis and native Web Components, organised in atomic design",
5
5
  "keywords": [
6
6
  "web-components",
@@ -75,19 +75,20 @@
75
75
  "size": "npm run build:lib && npm run size:report",
76
76
  "size:report": "node scripts/size-report.mjs",
77
77
  "test": "vitest run",
78
- "postinstall": "npx skills update -p -y",
78
+ "prepare": "node scripts/refresh-skills.mjs",
79
79
  "test:watch": "vitest",
80
80
  "test:e2e": "npm run build:site && vitest run --config vitest.e2e.config.ts",
81
81
  "typecheck": "tsc --noEmit -p tsconfig.json",
82
82
  "lint": "biome check .",
83
83
  "format": "biome check --write .",
84
84
  "check": "npm run generate -- --check && npm run lint && npm run typecheck && npm run test",
85
+ "check:pack": "node scripts/pack-check.mjs",
85
86
  "prepack": "npm run build:lib",
86
87
  "prepublishOnly": "npm run check",
87
88
  "version": "node scripts/plugin-version.mjs"
88
89
  },
89
90
  "peerDependencies": {
90
- "@jadis/core": "^1.8.0"
91
+ "@jadis/core": "^1.9.0"
91
92
  },
92
93
  "dependencies": {
93
94
  "lucide": "^1.61.0"
@@ -96,8 +97,9 @@
96
97
  "@biomejs/biome": "^2.6.3",
97
98
  "@fontsource-variable/jetbrains-mono": "^5.3.0",
98
99
  "@fontsource-variable/manrope": "^5.3.0",
99
- "@jadis/core": "^1.8.0",
100
+ "@jadis/core": "^1.9.0",
100
101
  "@types/node": "^24.13.3",
102
+ "axe-core": "^4.14.0",
101
103
  "happy-dom": "^21.0.4",
102
104
  "playwright-core": "^1.64.1",
103
105
  "typescript": "^7.0.2",