@syware/jlib 0.14.0 → 0.16.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 (113) hide show
  1. package/README.md +12 -8
  2. package/dist/all.js +2 -2
  3. package/dist/atoms/jl-avatar.d.ts +2 -0
  4. package/dist/atoms/jl-avatar.js +11 -6
  5. package/dist/atoms/jl-button.d.ts +6 -0
  6. package/dist/atoms/jl-button.js +22 -8
  7. package/dist/atoms/jl-chip.js +2 -1
  8. package/dist/atoms/jl-input.js +3 -3
  9. package/dist/atoms/jl-link.d.ts +1 -0
  10. package/dist/atoms/jl-link.js +5 -2
  11. package/dist/atoms/jl-progress-ring.d.ts +2 -0
  12. package/dist/atoms/jl-progress-ring.js +6 -2
  13. package/dist/atoms/jl-progress.d.ts +1 -0
  14. package/dist/atoms/jl-progress.js +5 -2
  15. package/dist/atoms/jl-rating.d.ts +2 -0
  16. package/dist/atoms/jl-rating.js +11 -6
  17. package/dist/atoms/jl-select.css.js +1 -1
  18. package/dist/atoms/jl-select.d.ts +4 -0
  19. package/dist/atoms/jl-select.js +18 -2
  20. package/dist/atoms/jl-switch.css.js +1 -1
  21. package/dist/atoms/jl-textarea.js +2 -2
  22. package/dist/base/jl-form-control.d.ts +3 -2
  23. package/dist/base/jl-form-control.js +14 -4
  24. package/dist/index.d.ts +1 -0
  25. package/dist/index.js +2 -2
  26. package/dist/lib/dom.d.ts +5 -0
  27. package/dist/lib/dom.js +9 -1
  28. package/dist/lib/download.js +10 -2
  29. package/dist/lib/floating.d.ts +5 -0
  30. package/dist/lib/floating.js +21 -2
  31. package/dist/lib/fuzzy.d.ts +3 -2
  32. package/dist/lib/fuzzy.js +15 -4
  33. package/dist/lib/modal.d.ts +24 -0
  34. package/dist/lib/modal.js +52 -0
  35. package/dist/lib/numeric.d.ts +5 -0
  36. package/dist/lib/numeric.js +11 -1
  37. package/dist/lib/option-filter.d.ts +2 -0
  38. package/dist/lib/option-filter.js +1 -1
  39. package/dist/lib/press.d.ts +11 -0
  40. package/dist/lib/press.js +31 -0
  41. package/dist/lib/table.js +12 -4
  42. package/dist/lib/texts-de.d.ts +12 -0
  43. package/dist/lib/texts-de.js +12 -0
  44. package/dist/lib/texts-fr.d.ts +12 -0
  45. package/dist/lib/texts-fr.js +12 -0
  46. package/dist/lib/texts.d.ts +12 -0
  47. package/dist/lib/texts.js +12 -0
  48. package/dist/molecules/jl-accordion-item.js +2 -1
  49. package/dist/molecules/jl-calendar.d.ts +4 -0
  50. package/dist/molecules/jl-calendar.js +16 -5
  51. package/dist/molecules/jl-chip-group.css.js +1 -1
  52. package/dist/molecules/jl-chip-group.js +3 -3
  53. package/dist/molecules/jl-code-block.css.js +1 -1
  54. package/dist/molecules/jl-combobox.d.ts +4 -0
  55. package/dist/molecules/jl-combobox.js +23 -11
  56. package/dist/molecules/jl-copy-button.css.js +1 -1
  57. package/dist/molecules/jl-copy-button.d.ts +11 -4
  58. package/dist/molecules/jl-copy-button.js +48 -22
  59. package/dist/molecules/jl-date-picker.d.ts +4 -0
  60. package/dist/molecules/jl-date-picker.js +18 -12
  61. package/dist/molecules/jl-field.d.ts +5 -1
  62. package/dist/molecules/jl-field.js +24 -5
  63. package/dist/molecules/jl-file-drop.css.js +1 -1
  64. package/dist/molecules/jl-file-drop.d.ts +4 -0
  65. package/dist/molecules/jl-file-drop.js +16 -8
  66. package/dist/molecules/jl-input-list.js +13 -6
  67. package/dist/molecules/jl-load-state.d.ts +8 -0
  68. package/dist/molecules/jl-load-state.js +33 -7
  69. package/dist/molecules/jl-menu.d.ts +21 -1
  70. package/dist/molecules/jl-menu.js +58 -6
  71. package/dist/molecules/jl-number-input.d.ts +2 -0
  72. package/dist/molecules/jl-number-input.js +12 -8
  73. package/dist/molecules/jl-radio-group.js +3 -2
  74. package/dist/molecules/jl-search.js +2 -2
  75. package/dist/molecules/jl-segmented.js +2 -2
  76. package/dist/molecules/jl-tabs.js +2 -2
  77. package/dist/molecules/jl-tag-input.css.js +1 -1
  78. package/dist/molecules/jl-tag-input.d.ts +4 -0
  79. package/dist/molecules/jl-tag-input.js +17 -9
  80. package/dist/molecules/jl-toast.js +8 -4
  81. package/dist/molecules/jl-tooltip.js +8 -2
  82. package/dist/organisms/jl-command-palette.css.js +1 -1
  83. package/dist/organisms/jl-command-palette.d.ts +2 -0
  84. package/dist/organisms/jl-command-palette.js +9 -3
  85. package/dist/organisms/jl-dialog.d.ts +3 -0
  86. package/dist/organisms/jl-dialog.js +13 -3
  87. package/dist/organisms/jl-drawer.d.ts +3 -0
  88. package/dist/organisms/jl-drawer.js +13 -3
  89. package/dist/organisms/jl-flow.d.ts +2 -0
  90. package/dist/organisms/jl-flow.js +29 -9
  91. package/dist/organisms/jl-side-nav.css.js +1 -1
  92. package/dist/organisms/jl-side-nav.d.ts +43 -9
  93. package/dist/organisms/jl-side-nav.js +164 -24
  94. package/dist/organisms/jl-table.css.js +1 -1
  95. package/dist/organisms/jl-table.d.ts +16 -3
  96. package/dist/organisms/jl-table.js +56 -18
  97. package/dist/organisms/jl-toaster.d.ts +13 -2
  98. package/dist/organisms/jl-toaster.js +47 -4
  99. package/dist/organisms/jl-tree.css.js +1 -1
  100. package/dist/organisms/jl-tree.d.ts +23 -4
  101. package/dist/organisms/jl-tree.js +74 -18
  102. package/dist/styles/base.css.js +1 -1
  103. package/dist/styles/control.css.js +1 -1
  104. package/dist/styles/tokens.css.js +1 -1
  105. package/dist/templates/jl-app-shell.css.js +1 -1
  106. package/dist/templates/jl-app-shell.js +2 -0
  107. package/dist/tokens.css +8 -3
  108. package/dist/types/jl-load-state.types.d.ts +7 -0
  109. package/dist/types/jl-side-nav.types.d.ts +5 -0
  110. package/dist/types/jl-table.types.d.ts +12 -0
  111. package/dist/types/jl-tree.types.d.ts +17 -0
  112. package/dist/types/press.types.d.ts +6 -0
  113. package/package.json +6 -4
package/dist/lib/dom.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  /** Sets an attribute, or removes it when the value is empty. */
2
2
  export declare function setOrRemove(element: Element, name: string, value: string): void;
3
+ /**
4
+ * Says an ARIA state is on, or removes it: `aria-invalid`, `aria-required`, `aria-disabled`, `aria-busy`. A bare
5
+ * attribute, as `toggleAttribute` writes it (`aria-invalid=""`), is one browsers read as false.
6
+ */
7
+ export declare function setAriaFlag(element: Element, name: `aria-${string}`, on: boolean): void;
3
8
  /** A unique id within the page, for wiring `aria-controls`, `aria-labelledby` and the like inside a shadow root. */
4
9
  export declare function uniqueId(prefix: string): string;
5
10
  /** An SVG element with its attributes: JSX makes HTML elements only. */
package/dist/lib/dom.js CHANGED
@@ -7,6 +7,14 @@ function setOrRemove(element, name, value) {
7
7
  }
8
8
  element.setAttribute(name, value);
9
9
  }
10
+ var ARIA_TRUE = "true";
11
+ /**
12
+ * Says an ARIA state is on, or removes it: `aria-invalid`, `aria-required`, `aria-disabled`, `aria-busy`. A bare
13
+ * attribute, as `toggleAttribute` writes it (`aria-invalid=""`), is one browsers read as false.
14
+ */
15
+ function setAriaFlag(element, name, on) {
16
+ setOrRemove(element, name, on ? ARIA_TRUE : "");
17
+ }
10
18
  var sequence = { next: 0 };
11
19
  /** A unique id within the page, for wiring `aria-controls`, `aria-labelledby` and the like inside a shadow root. */
12
20
  function uniqueId(prefix) {
@@ -22,4 +30,4 @@ function svgElement(tag, attributes) {
22
30
  }
23
31
  /** Whether a click asks the browser for something of its own: a new tab or window, a download. */
24
32
  var isModifiedClick = (event) => event.ctrlKey || event.metaKey || event.shiftKey || event.altKey || event.button !== 0;
25
- export { isModifiedClick, setOrRemove, svgElement, uniqueId };
33
+ export { isModifiedClick, setAriaFlag, setOrRemove, svgElement, uniqueId };
@@ -3,16 +3,24 @@ var FILE_NAME_UTF8 = /filename\*\s*=\s*(?:UTF-8|utf-8)''([^;]+)/;
3
3
  var FILE_NAME = /filename\s*=\s*"?([^";]+)"?/;
4
4
  var REVOKE_DELAY_MS = 1e3;
5
5
  var ADDRESS_BASE = "http://localhost/";
6
+ /** A percent-encoded name, decoded; one that is not well formed (a lone `%`) is the name as it is written. */
7
+ function decodedName(name) {
8
+ try {
9
+ return decodeURIComponent(name);
10
+ } catch {
11
+ return name;
12
+ }
13
+ }
6
14
  /** The file name a Content-Disposition header gives (its UTF-8 form first), or none. */
7
15
  function dispositionFileName(header) {
8
16
  const utf8 = FILE_NAME_UTF8.exec(header ?? "")?.[1];
9
- if (utf8 !== void 0) return decodeURIComponent(utf8.trim());
17
+ if (utf8 !== void 0) return decodedName(utf8.trim());
10
18
  return FILE_NAME.exec(header ?? "")?.[1]?.trim() || void 0;
11
19
  }
12
20
  /** A file name for an address: its last path segment, or the fallback when it has none. */
13
21
  function urlFileName(url, fallback) {
14
22
  const segment = new URL(url, ADDRESS_BASE).pathname.split("/").at(-1) ?? "";
15
- return segment === "" ? fallback : decodeURIComponent(segment);
23
+ return segment === "" ? fallback : decodedName(segment);
16
24
  }
17
25
  /** What a failed answer's body says: `{ error: { message } }`, `{ error: "…" }`, `{ message }`, or its status. */
18
26
  function answerError(body, status) {
@@ -17,6 +17,11 @@ export declare function positionFloating(anchor: Element, floating: HTMLElement,
17
17
  floating: Rect;
18
18
  placement: Placement;
19
19
  };
20
+ /**
21
+ * Puts a fixed-position element at a point of the window, as a menu opens where the pointer asked for it: its top
22
+ * left corner there, above the point when there is no room under it, and kept inside the window.
23
+ */
24
+ export declare function placeAtPoint(point: Point, floating: HTMLElement): void;
20
25
  /** Puts a fixed-position element next to its anchor; returns the placement it got after flipping. */
21
26
  export declare function placeFloating(anchor: Element, floating: HTMLElement, placement: Placement, gap?: number): Placement;
22
27
  /** Keeps a floating element by its anchor while the page scrolls or resizes, until the signal aborts. */
@@ -99,6 +99,13 @@ function computePosition(anchor, floating, viewport, placement, gap = DEFAULT_GA
99
99
  */
100
100
  function positionFloating(anchor, floating, placement, gap) {
101
101
  const rect = anchor.getBoundingClientRect();
102
+ return {
103
+ anchor: rect,
104
+ ...positionBy(rect, floating, placement, gap)
105
+ };
106
+ }
107
+ /** Puts a fixed-position element next to a rectangle of the window, and gives where it went. */
108
+ function positionBy(rect, floating, placement, gap) {
102
109
  const viewport = {
103
110
  height: window.innerHeight,
104
111
  width: document.documentElement.clientWidth
@@ -114,7 +121,6 @@ function positionFloating(anchor, floating, placement, gap) {
114
121
  floating.style.top = `${top}px`;
115
122
  floating.dataset.placement = result.placement;
116
123
  return {
117
- anchor: rect,
118
124
  floating: {
119
125
  ...size,
120
126
  left,
@@ -123,6 +129,19 @@ function positionFloating(anchor, floating, placement, gap) {
123
129
  placement: result.placement
124
130
  };
125
131
  }
132
+ var AT_POINT = "bottom-start";
133
+ var NO_GAP = 0;
134
+ /**
135
+ * Puts a fixed-position element at a point of the window, as a menu opens where the pointer asked for it: its top
136
+ * left corner there, above the point when there is no room under it, and kept inside the window.
137
+ */
138
+ function placeAtPoint(point, floating) {
139
+ positionBy({
140
+ ...point,
141
+ height: 0,
142
+ width: 0
143
+ }, floating, AT_POINT, NO_GAP);
144
+ }
126
145
  /** Puts a fixed-position element next to its anchor; returns the placement it got after flipping. */
127
146
  function placeFloating(anchor, floating, placement, gap) {
128
147
  return positionFloating(anchor, floating, placement, gap).placement;
@@ -143,4 +162,4 @@ function followAnchor(anchor, floating, placement, signal, gap) {
143
162
  });
144
163
  update();
145
164
  }
146
- export { PLACEMENTS, computePosition, followAnchor, placeFloating, positionFloating };
165
+ export { PLACEMENTS, computePosition, followAnchor, placeAtPoint, placeFloating, positionFloating };
@@ -18,8 +18,9 @@ export declare const FUZZY_SCORE: {
18
18
  /** Whether the letter at `index` starts a word of the text. */
19
19
  export declare function isWordStart(text: string, index: number): boolean;
20
20
  /**
21
- * Whether the letters of the query appear in the text in order (spaces ignored, any case), and how well: the
22
- * best placement by contiguity and word starts. `null` when they do not; an empty query matches with 0.
21
+ * Whether the letters of the query appear in the text in order (spaces ignored, any case, with or without their
22
+ * accents), and how well: the best placement by contiguity and word starts. `null` when they do not; an empty query
23
+ * matches with 0.
23
24
  */
24
25
  export declare function fuzzyMatch(query: string, text: string): FuzzyMatch | null;
25
26
  /** The text cut into runs of matched and unmatched letters, for drawing the matches in `<mark>`. */
package/dist/lib/fuzzy.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { foldCharacter } from "./option-filter.js";
1
2
  // src/lib/fuzzy.ts
2
3
  /**
3
4
  * What a matched letter is worth. Letters next to each other and letters that start a word count most, so "ofi"
@@ -18,6 +19,15 @@ var FUZZY_SCORE = {
18
19
  var NO_MATCH = Number.NEGATIVE_INFINITY;
19
20
  var NO_INDEX = -1;
20
21
  var WHITESPACE = /\s+/g;
22
+ /**
23
+ * A character as the search compares it: without its accent and in lower case, as the options' filter folds it, so
24
+ * "parametres" finds "Paramètres". Kept as it is when folding it gives more or fewer characters: a match's
25
+ * positions are those of the text.
26
+ */
27
+ function comparable(character) {
28
+ const folded = foldCharacter(character);
29
+ return folded.length === 1 ? folded : character.toLowerCase();
30
+ }
21
31
  var SEPARATORS = /* @__PURE__ */ new Set([
22
32
  " ",
23
33
  "-",
@@ -103,12 +113,13 @@ function backtrack(rows, end) {
103
113
  return positions;
104
114
  }
105
115
  /**
106
- * Whether the letters of the query appear in the text in order (spaces ignored, any case), and how well: the
107
- * best placement by contiguity and word starts. `null` when they do not; an empty query matches with 0.
116
+ * Whether the letters of the query appear in the text in order (spaces ignored, any case, with or without their
117
+ * accents), and how well: the best placement by contiguity and word starts. `null` when they do not; an empty query
118
+ * matches with 0.
108
119
  */
109
120
  function fuzzyMatch(query, text) {
110
- const needle = query.replace(WHITESPACE, "").toLowerCase().split("");
111
- const haystack = text.split("").map((char) => char.toLowerCase());
121
+ const needle = query.replace(WHITESPACE, "").split("").map(comparable);
122
+ const haystack = text.split("").map(comparable);
112
123
  const [first, ...rest] = needle;
113
124
  if (first === void 0) return {
114
125
  positions: [],
@@ -0,0 +1,24 @@
1
+ import { Bus } from '@jadis/core';
2
+ /** Emits `change` when one of jlib's modals opens or closes. */
3
+ export declare const modalBus: Bus<{
4
+ change: undefined;
5
+ }>;
6
+ /**
7
+ * The modal on top, when one is open. A modal makes everything outside it inert, the top layer included: what must
8
+ * stay usable over it, as the toaster's notifications must, sits inside this element meanwhile.
9
+ */
10
+ export declare const topModal: () => HTMLDialogElement | undefined;
11
+ /** Says a modal shows, on top of the others: called after its `showModal()`. */
12
+ export declare function modalOpened(dialog: HTMLDialogElement): void;
13
+ /** Says a modal shows no more: it closed, or left the page. Nothing for one that was not showing. */
14
+ export declare function modalClosed(dialog: HTMLDialogElement): void;
15
+ /**
16
+ * Calls back for a press on a modal's backdrop: a click that started and ended on the dialog element itself, around
17
+ * its content. A selection dragged out of a field ends its click on the dialog too, and is not a press outside.
18
+ */
19
+ export declare function onBackdropPress(dialog: HTMLDialogElement, pressed: () => void, signal: AbortSignal): void;
20
+ /**
21
+ * Keeps a persistent modal open on Escape. Refusing its `cancel` event is not enough: a browser lets a page refuse
22
+ * a close request only a few times in a row, then closes the dialog. `closedby="none"` asks for no request at all.
23
+ */
24
+ export declare function setPersistent(dialog: HTMLDialogElement, persistent: boolean): void;
@@ -0,0 +1,52 @@
1
+ import { setOrRemove } from "./dom.js";
2
+ import { Bus } from "@jadis/core";
3
+ // src/lib/modal.ts
4
+ var shown = [];
5
+ /** Emits `change` when one of jlib's modals opens or closes. */
6
+ var modalBus = new Bus();
7
+ /**
8
+ * The modal on top, when one is open. A modal makes everything outside it inert, the top layer included: what must
9
+ * stay usable over it, as the toaster's notifications must, sits inside this element meanwhile.
10
+ */
11
+ var topModal = () => shown.at(-1);
12
+ function forget(dialog) {
13
+ const index = shown.indexOf(dialog);
14
+ if (index !== -1) shown.splice(index, 1);
15
+ }
16
+ /** Says a modal shows, on top of the others: called after its `showModal()`. */
17
+ function modalOpened(dialog) {
18
+ forget(dialog);
19
+ shown.push(dialog);
20
+ modalBus.emit("change");
21
+ }
22
+ /** Says a modal shows no more: it closed, or left the page. Nothing for one that was not showing. */
23
+ function modalClosed(dialog) {
24
+ if (!shown.includes(dialog)) return;
25
+ forget(dialog);
26
+ modalBus.emit("change");
27
+ }
28
+ /**
29
+ * Calls back for a press on a modal's backdrop: a click that started and ended on the dialog element itself, around
30
+ * its content. A selection dragged out of a field ends its click on the dialog too, and is not a press outside.
31
+ */
32
+ function onBackdropPress(dialog, pressed, signal) {
33
+ const press = { startedOutside: false };
34
+ dialog.addEventListener("pointerdown", (event) => {
35
+ press.startedOutside = event.target === dialog;
36
+ }, { signal });
37
+ dialog.addEventListener("click", (event) => {
38
+ const outside = press.startedOutside && event.target === dialog;
39
+ press.startedOutside = false;
40
+ if (outside) pressed();
41
+ }, { signal });
42
+ }
43
+ var CLOSED_BY = "closedby";
44
+ var CLOSED_BY_NOTHING = "none";
45
+ /**
46
+ * Keeps a persistent modal open on Escape. Refusing its `cancel` event is not enough: a browser lets a page refuse
47
+ * a close request only a few times in a row, then closes the dialog. `closedby="none"` asks for no request at all.
48
+ */
49
+ function setPersistent(dialog, persistent) {
50
+ setOrRemove(dialog, CLOSED_BY, persistent ? CLOSED_BY_NOTHING : "");
51
+ }
52
+ export { modalBus, modalClosed, modalOpened, onBackdropPress, setPersistent, topModal };
@@ -1,6 +1,11 @@
1
1
  import type { SliderMark } from '../types/jl-slider.types';
2
2
  /** A number written in a field or an attribute; empty or unreadable text gives null. */
3
3
  export declare function parseNumber(text: string | null): number | null;
4
+ /**
5
+ * A number as people type it: with a point, or with the decimal comma of French and German keyboards ("1,5"). Several
6
+ * commas, or a comma beside a point, would be a grouping this cannot tell from decimals: unreadable, so null.
7
+ */
8
+ export declare function parseTypedNumber(text: string): number | null;
4
9
  /** A number kept within bounds; a null bound does not limit that side. */
5
10
  export declare function clamp(value: number, min: number | null, max: number | null): number;
6
11
  /** How many decimals a number has as written: 0.25 has 2, so sums of steps print without float noise. */
@@ -6,6 +6,16 @@ function parseNumber(text) {
6
6
  const parsed = Number(text.trim());
7
7
  return Number.isFinite(parsed) ? parsed : null;
8
8
  }
9
+ var DECIMAL_COMMA = ",";
10
+ var DECIMAL_POINT = ".";
11
+ /**
12
+ * A number as people type it: with a point, or with the decimal comma of French and German keyboards ("1,5"). Several
13
+ * commas, or a comma beside a point, would be a grouping this cannot tell from decimals: unreadable, so null.
14
+ */
15
+ function parseTypedNumber(text) {
16
+ if (text.split(DECIMAL_COMMA).length - 1 !== 1 || text.includes(DECIMAL_POINT)) return parseNumber(text);
17
+ return parseNumber(text.replace(DECIMAL_COMMA, DECIMAL_POINT));
18
+ }
9
19
  /** A number kept within bounds; a null bound does not limit that side. */
10
20
  function clamp(value, min, max) {
11
21
  const floored = min === null ? value : Math.max(min, value);
@@ -47,4 +57,4 @@ function marksOf(raw, min, max) {
47
57
  return isMarkObject(mark) ? mark : null;
48
58
  }).filter((mark) => mark !== null && mark.value >= min && mark.value <= max);
49
59
  }
50
- export { clamp, decimalsOf, fractionOf, marksOf, parseNumber, roundTo, stepValue };
60
+ export { clamp, decimalsOf, fractionOf, marksOf, parseNumber, parseTypedNumber, roundTo, stepValue };
@@ -1,4 +1,6 @@
1
1
  import type { TextMatch, TextMatchPart } from '../types/option-filter.types';
2
+ /** One character as matching sees it: lower case, without its accents ("É" gives "e"). */
3
+ export declare const foldCharacter: (character: string) => string;
2
4
  /** A text as matching sees it: "Crème Brûlée" gives "creme brulee". */
3
5
  export declare const foldText: (text: string) => string;
4
6
  /**
@@ -105,4 +105,4 @@ function nextEnabledIndex(options, current, direction) {
105
105
  }
106
106
  /** The first (1) or last (-1) option that can be chosen; -1 when none can. */
107
107
  var edgeEnabledIndex = (options, from) => nextEnabledIndex(options, -1, from);
108
- export { edgeEnabledIndex, filterOptions, findMatch, foldText, matchParts, nextEnabledIndex };
108
+ export { edgeEnabledIndex, filterOptions, findMatch, foldCharacter, foldText, matchParts, nextEnabledIndex };
@@ -0,0 +1,11 @@
1
+ import type { PressButton } from '../types/press.types';
2
+ /** The button of the press an event of the browser is; null for an event that is no press. */
3
+ export declare const pressButtonOf: (event: Pick<MouseEvent, 'button' | 'type'>) => PressButton | null;
4
+ /** The browser's events a press on a row or an item comes as: the main button, the middle one, the request for a menu. */
5
+ export declare const PRESS_EVENTS: readonly ['click', 'auxclick', 'contextmenu'];
6
+ /**
7
+ * Tells a press to the page.
8
+ * @returns Whether the page refused it: a listener cancelled the browser's event (`event.preventDefault()`), which
9
+ * keeps the browser's own menu away too. An event cancelled before it was told is not a refusal.
10
+ */
11
+ export declare function tellPress(event: Event, tell: () => void): boolean;
@@ -0,0 +1,31 @@
1
+ // src/lib/press.ts
2
+ var MIDDLE_BUTTON = 1;
3
+ /**
4
+ * The button each of the browser's events stands for. The secondary one is its `contextmenu`, which the keyboard's
5
+ * menu key and a long press fire too, with no button of their own; an `auxclick` is told for the middle button
6
+ * only, the right one having said its press already.
7
+ */
8
+ var PRESS_BUTTONS = {
9
+ auxclick: (event) => event.button === MIDDLE_BUTTON ? "auxiliary" : null,
10
+ click: () => "main",
11
+ contextmenu: () => "secondary"
12
+ };
13
+ /** The button of the press an event of the browser is; null for an event that is no press. */
14
+ var pressButtonOf = (event) => PRESS_BUTTONS[event.type]?.(event) ?? null;
15
+ /** The browser's events a press on a row or an item comes as: the main button, the middle one, the request for a menu. */
16
+ var PRESS_EVENTS = [
17
+ "click",
18
+ "auxclick",
19
+ "contextmenu"
20
+ ];
21
+ /**
22
+ * Tells a press to the page.
23
+ * @returns Whether the page refused it: a listener cancelled the browser's event (`event.preventDefault()`), which
24
+ * keeps the browser's own menu away too. An event cancelled before it was told is not a refusal.
25
+ */
26
+ function tellPress(event, tell) {
27
+ const cancelledBefore = event.defaultPrevented;
28
+ tell();
29
+ return !cancelledBefore && event.defaultPrevented;
30
+ }
31
+ export { PRESS_EVENTS, pressButtonOf, tellPress };
package/dist/lib/table.js CHANGED
@@ -32,14 +32,22 @@ function toTime(value) {
32
32
  if (typeof value === "string" && value.trim() !== "") return Date.parse(value);
33
33
  return NaN;
34
34
  }
35
- /** What a column orders its values by: numbers for numbers and dates, text for the rest. */
35
+ /**
36
+ * A value of a column that names no number or date format: a number keeps its value and a `Date` its time, so a
37
+ * column of numbers left as `text` does not order 10 before 2; anything else is ordered as text.
38
+ */
39
+ function ownOrder(value) {
40
+ if (typeof value === "number") return value;
41
+ return value instanceof Date ? value.getTime() : String(value);
42
+ }
43
+ /** What a column orders its values by: numbers for numbers and dates, the value's own order for the rest. */
36
44
  var SORT_VALUES = {
37
- badge: String,
38
- code: String,
45
+ badge: ownOrder,
46
+ code: ownOrder,
39
47
  date: toTime,
40
48
  datetime: toTime,
41
49
  number: toNumber,
42
- text: String
50
+ text: ownOrder
43
51
  };
44
52
  var TEXT_ORDERS = {
45
53
  badge: void 0,
@@ -1,5 +1,7 @@
1
1
  /** jlib's texts in German. */
2
2
  declare const _default: {
3
+ readonly addAfter: "Nach {name} hinzufügen";
4
+ readonly addAfterPort: "Nach {name}, {port} hinzufügen";
3
5
  readonly addedNamed: "Hinzugefügt: {names}";
4
6
  readonly addTag: "Fügen Sie mindestens ein Schlagwort hinzu.";
5
7
  readonly addValue: "Wert hinzufügen";
@@ -30,6 +32,7 @@ declare const _default: {
30
32
  readonly confirm: "Bestätigen";
31
33
  readonly copied: "Kopiert";
32
34
  readonly copy: "Kopieren";
35
+ readonly copyFailed: "Kopieren nicht möglich";
33
36
  readonly decrease: "Verringern";
34
37
  readonly details: "Details";
35
38
  readonly detailsOf: "Details zu {name}";
@@ -52,7 +55,11 @@ declare const _default: {
52
55
  readonly fillField: "Bitte füllen Sie dieses Feld aus.";
53
56
  readonly fitView: "Alle Knoten anzeigen";
54
57
  readonly flow: "Ablauf";
58
+ readonly flowDone: "Erledigt";
55
59
  readonly flowEmpty: "Noch nichts hier.";
60
+ readonly flowFailed: "Fehlgeschlagen";
61
+ readonly flowRunning: "Läuft";
62
+ readonly flowWaiting: "Wartet";
56
63
  readonly hidePassword: "Passwort verbergen";
57
64
  readonly increase: "Erhöhen";
58
65
  readonly leave: "Verlassen";
@@ -74,6 +81,7 @@ declare const _default: {
74
81
  readonly noRating: "Keine Bewertung";
75
82
  readonly noResults: "Keine Ergebnisse";
76
83
  readonly notifications: "Benachrichtigungen";
84
+ readonly opensInNewTab: "(öffnet in neuem Tab)";
77
85
  readonly page: "Seite";
78
86
  readonly pageNumber: "Seite {page}";
79
87
  readonly pageOfTotal: "{page} von {total}";
@@ -101,6 +109,10 @@ declare const _default: {
101
109
  readonly showOptions: "Optionen anzeigen";
102
110
  readonly showPagesOf: "Seiten von {name} anzeigen";
103
111
  readonly showPassword: "Passwort anzeigen";
112
+ readonly statusAway: "abwesend";
113
+ readonly statusBusy: "beschäftigt";
114
+ readonly statusOffline: "offline";
115
+ readonly statusOnline: "online";
104
116
  readonly stay: "Weiter bearbeiten";
105
117
  readonly stepCurrent: ", aktueller Schritt";
106
118
  readonly stepDone: ", abgeschlossen";
@@ -3,6 +3,8 @@ import { defineTranslations } from "@jadis/core";
3
3
  // src/lib/texts-de.ts
4
4
  /** jlib's texts in German. */
5
5
  var texts_de_default = defineTranslations(DEFAULT_TEXTS, {
6
+ addAfter: "Nach {name} hinzufügen",
7
+ addAfterPort: "Nach {name}, {port} hinzufügen",
6
8
  addedNamed: "Hinzugefügt: {names}",
7
9
  addTag: "Fügen Sie mindestens ein Schlagwort hinzu.",
8
10
  addValue: "Wert hinzufügen",
@@ -33,6 +35,7 @@ var texts_de_default = defineTranslations(DEFAULT_TEXTS, {
33
35
  confirm: "Bestätigen",
34
36
  copied: "Kopiert",
35
37
  copy: "Kopieren",
38
+ copyFailed: "Kopieren nicht möglich",
36
39
  decrease: "Verringern",
37
40
  details: "Details",
38
41
  detailsOf: "Details zu {name}",
@@ -55,7 +58,11 @@ var texts_de_default = defineTranslations(DEFAULT_TEXTS, {
55
58
  fillField: "Bitte füllen Sie dieses Feld aus.",
56
59
  fitView: "Alle Knoten anzeigen",
57
60
  flow: "Ablauf",
61
+ flowDone: "Erledigt",
58
62
  flowEmpty: "Noch nichts hier.",
63
+ flowFailed: "Fehlgeschlagen",
64
+ flowRunning: "Läuft",
65
+ flowWaiting: "Wartet",
59
66
  hidePassword: "Passwort verbergen",
60
67
  increase: "Erhöhen",
61
68
  leave: "Verlassen",
@@ -77,6 +84,7 @@ var texts_de_default = defineTranslations(DEFAULT_TEXTS, {
77
84
  noRating: "Keine Bewertung",
78
85
  noResults: "Keine Ergebnisse",
79
86
  notifications: "Benachrichtigungen",
87
+ opensInNewTab: "(öffnet in neuem Tab)",
80
88
  page: "Seite",
81
89
  pageNumber: "Seite {page}",
82
90
  pageOfTotal: "{page} von {total}",
@@ -104,6 +112,10 @@ var texts_de_default = defineTranslations(DEFAULT_TEXTS, {
104
112
  showOptions: "Optionen anzeigen",
105
113
  showPagesOf: "Seiten von {name} anzeigen",
106
114
  showPassword: "Passwort anzeigen",
115
+ statusAway: "abwesend",
116
+ statusBusy: "beschäftigt",
117
+ statusOffline: "offline",
118
+ statusOnline: "online",
107
119
  stay: "Weiter bearbeiten",
108
120
  stepCurrent: ", aktueller Schritt",
109
121
  stepDone: ", abgeschlossen",
@@ -1,5 +1,7 @@
1
1
  /** jlib's texts in French. */
2
2
  declare const _default: {
3
+ readonly addAfter: "Ajouter après {name}";
4
+ readonly addAfterPort: "Ajouter après {name}, {port}";
3
5
  readonly addedNamed: "Ajouté : {names}";
4
6
  readonly addTag: "Ajoutez au moins une étiquette.";
5
7
  readonly addValue: "Ajouter une valeur";
@@ -30,6 +32,7 @@ declare const _default: {
30
32
  readonly confirm: "Confirmer";
31
33
  readonly copied: "Copié";
32
34
  readonly copy: "Copier";
35
+ readonly copyFailed: "Copie impossible";
33
36
  readonly decrease: "Diminuer";
34
37
  readonly details: "Détails";
35
38
  readonly detailsOf: "Détails de {name}";
@@ -52,7 +55,11 @@ declare const _default: {
52
55
  readonly fillField: "Veuillez remplir ce champ.";
53
56
  readonly fitView: "Afficher tous les nœuds";
54
57
  readonly flow: "Flux";
58
+ readonly flowDone: "Terminé";
55
59
  readonly flowEmpty: "Rien ici pour l'instant.";
60
+ readonly flowFailed: "Échoué";
61
+ readonly flowRunning: "En cours";
62
+ readonly flowWaiting: "En attente";
56
63
  readonly hidePassword: "Masquer le mot de passe";
57
64
  readonly increase: "Augmenter";
58
65
  readonly leave: "Quitter";
@@ -74,6 +81,7 @@ declare const _default: {
74
81
  readonly noRating: "Aucune note";
75
82
  readonly noResults: "Aucun résultat";
76
83
  readonly notifications: "Notifications";
84
+ readonly opensInNewTab: "(s'ouvre dans un nouvel onglet)";
77
85
  readonly page: "Page";
78
86
  readonly pageNumber: "Page {page}";
79
87
  readonly pageOfTotal: "{page} sur {total}";
@@ -101,6 +109,10 @@ declare const _default: {
101
109
  readonly showOptions: "Afficher les options";
102
110
  readonly showPagesOf: "Afficher les pages de {name}";
103
111
  readonly showPassword: "Afficher le mot de passe";
112
+ readonly statusAway: "absent";
113
+ readonly statusBusy: "occupé";
114
+ readonly statusOffline: "hors ligne";
115
+ readonly statusOnline: "en ligne";
104
116
  readonly stay: "Continuer l'édition";
105
117
  readonly stepCurrent: ", étape en cours";
106
118
  readonly stepDone: ", terminée";
@@ -3,6 +3,8 @@ import { defineTranslations } from "@jadis/core";
3
3
  // src/lib/texts-fr.ts
4
4
  /** jlib's texts in French. */
5
5
  var texts_fr_default = defineTranslations(DEFAULT_TEXTS, {
6
+ addAfter: "Ajouter après {name}",
7
+ addAfterPort: "Ajouter après {name}, {port}",
6
8
  addedNamed: "Ajouté : {names}",
7
9
  addTag: "Ajoutez au moins une étiquette.",
8
10
  addValue: "Ajouter une valeur",
@@ -33,6 +35,7 @@ var texts_fr_default = defineTranslations(DEFAULT_TEXTS, {
33
35
  confirm: "Confirmer",
34
36
  copied: "Copié",
35
37
  copy: "Copier",
38
+ copyFailed: "Copie impossible",
36
39
  decrease: "Diminuer",
37
40
  details: "Détails",
38
41
  detailsOf: "Détails de {name}",
@@ -55,7 +58,11 @@ var texts_fr_default = defineTranslations(DEFAULT_TEXTS, {
55
58
  fillField: "Veuillez remplir ce champ.",
56
59
  fitView: "Afficher tous les nœuds",
57
60
  flow: "Flux",
61
+ flowDone: "Terminé",
58
62
  flowEmpty: "Rien ici pour l'instant.",
63
+ flowFailed: "Échoué",
64
+ flowRunning: "En cours",
65
+ flowWaiting: "En attente",
59
66
  hidePassword: "Masquer le mot de passe",
60
67
  increase: "Augmenter",
61
68
  leave: "Quitter",
@@ -77,6 +84,7 @@ var texts_fr_default = defineTranslations(DEFAULT_TEXTS, {
77
84
  noRating: "Aucune note",
78
85
  noResults: "Aucun résultat",
79
86
  notifications: "Notifications",
87
+ opensInNewTab: "(s'ouvre dans un nouvel onglet)",
80
88
  page: "Page",
81
89
  pageNumber: "Page {page}",
82
90
  pageOfTotal: "{page} sur {total}",
@@ -104,6 +112,10 @@ var texts_fr_default = defineTranslations(DEFAULT_TEXTS, {
104
112
  showOptions: "Afficher les options",
105
113
  showPagesOf: "Afficher les pages de {name}",
106
114
  showPassword: "Afficher le mot de passe",
115
+ statusAway: "absent",
116
+ statusBusy: "occupé",
117
+ statusOffline: "hors ligne",
118
+ statusOnline: "en ligne",
107
119
  stay: "Continuer l'édition",
108
120
  stepCurrent: ", étape en cours",
109
121
  stepDone: ", terminée",
@@ -8,6 +8,8 @@ export declare const JL_LANGUAGES: readonly ['en', 'fr', 'de'];
8
8
  * the defaults of their text inputs. `{placeholders}` are filled when the text is shown.
9
9
  */
10
10
  export declare const DEFAULT_TEXTS: {
11
+ readonly addAfter: "Add after {name}";
12
+ readonly addAfterPort: "Add after {name}, {port}";
11
13
  readonly addedNamed: "Added {names}";
12
14
  readonly addTag: "Add at least one tag.";
13
15
  readonly addValue: "Add a value";
@@ -38,6 +40,7 @@ export declare const DEFAULT_TEXTS: {
38
40
  readonly confirm: "Confirm";
39
41
  readonly copied: "Copied";
40
42
  readonly copy: "Copy";
43
+ readonly copyFailed: "Could not copy";
41
44
  readonly decrease: "Decrease";
42
45
  readonly details: "Details";
43
46
  readonly detailsOf: "Details of {name}";
@@ -60,7 +63,11 @@ export declare const DEFAULT_TEXTS: {
60
63
  readonly fillField: "Please fill in this field.";
61
64
  readonly fitView: "Show every node";
62
65
  readonly flow: "Flow";
66
+ readonly flowDone: "Done";
63
67
  readonly flowEmpty: "Nothing here yet.";
68
+ readonly flowFailed: "Failed";
69
+ readonly flowRunning: "Running";
70
+ readonly flowWaiting: "Waiting";
64
71
  readonly hidePassword: "Hide the password";
65
72
  readonly increase: "Increase";
66
73
  readonly leave: "Leave";
@@ -82,6 +89,7 @@ export declare const DEFAULT_TEXTS: {
82
89
  readonly noRating: "No rating";
83
90
  readonly noResults: "No results";
84
91
  readonly notifications: "Notifications";
92
+ readonly opensInNewTab: "(opens in a new tab)";
85
93
  readonly page: "Page";
86
94
  readonly pageNumber: "Page {page}";
87
95
  readonly pageOfTotal: "{page} of {total}";
@@ -109,6 +117,10 @@ export declare const DEFAULT_TEXTS: {
109
117
  readonly showOptions: "Show the options";
110
118
  readonly showPagesOf: "Show the pages of {name}";
111
119
  readonly showPassword: "Show the password";
120
+ readonly statusAway: "away";
121
+ readonly statusBusy: "busy";
122
+ readonly statusOffline: "offline";
123
+ readonly statusOnline: "online";
112
124
  readonly stay: "Keep editing";
113
125
  readonly stepCurrent: ", current step";
114
126
  readonly stepDone: ", completed";
package/dist/lib/texts.js CHANGED
@@ -15,6 +15,8 @@ var LOCALE_SEPARATOR = "-";
15
15
  * the defaults of their text inputs. `{placeholders}` are filled when the text is shown.
16
16
  */
17
17
  var DEFAULT_TEXTS = defineTranslations({
18
+ addAfter: "Add after {name}",
19
+ addAfterPort: "Add after {name}, {port}",
18
20
  addedNamed: "Added {names}",
19
21
  addTag: "Add at least one tag.",
20
22
  addValue: "Add a value",
@@ -45,6 +47,7 @@ var DEFAULT_TEXTS = defineTranslations({
45
47
  confirm: "Confirm",
46
48
  copied: "Copied",
47
49
  copy: "Copy",
50
+ copyFailed: "Could not copy",
48
51
  decrease: "Decrease",
49
52
  details: "Details",
50
53
  detailsOf: "Details of {name}",
@@ -67,7 +70,11 @@ var DEFAULT_TEXTS = defineTranslations({
67
70
  fillField: "Please fill in this field.",
68
71
  fitView: "Show every node",
69
72
  flow: "Flow",
73
+ flowDone: "Done",
70
74
  flowEmpty: "Nothing here yet.",
75
+ flowFailed: "Failed",
76
+ flowRunning: "Running",
77
+ flowWaiting: "Waiting",
71
78
  hidePassword: "Hide the password",
72
79
  increase: "Increase",
73
80
  leave: "Leave",
@@ -89,6 +96,7 @@ var DEFAULT_TEXTS = defineTranslations({
89
96
  noRating: "No rating",
90
97
  noResults: "No results",
91
98
  notifications: "Notifications",
99
+ opensInNewTab: "(opens in a new tab)",
92
100
  page: "Page",
93
101
  pageNumber: "Page {page}",
94
102
  pageOfTotal: "{page} of {total}",
@@ -116,6 +124,10 @@ var DEFAULT_TEXTS = defineTranslations({
116
124
  showOptions: "Show the options",
117
125
  showPagesOf: "Show the pages of {name}",
118
126
  showPassword: "Show the password",
127
+ statusAway: "away",
128
+ statusBusy: "busy",
129
+ statusOffline: "offline",
130
+ statusOnline: "online",
119
131
  stay: "Keep editing",
120
132
  stepCurrent: ", current step",
121
133
  stepDone: ", completed",