@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
@@ -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",
@@ -2,6 +2,7 @@ import { BASE_STYLES } from "../styles/shared.js";
2
2
  import { JlElement } from "../base/jl-element.js";
3
3
  import { registerIcons } from "../lib/icons.js";
4
4
  import { JlIcon } from "../atoms/jl-icon.js";
5
+ import { setAriaFlag } from "../lib/dom.js";
5
6
  import jl_accordion_item_default from "./jl-accordion-item.css.js";
6
7
  import { css } from "@jadis/core";
7
8
  import { ChevronDown } from "lucide";
@@ -32,7 +33,7 @@ var JlAccordionItem = class extends JlElement {
32
33
  /** Cannot be opened or closed by people. */
33
34
  disabled = this.useChange(false, (value) => {
34
35
  this.reflect("disabled", value);
35
- this._refs.summary.toggleAttribute("aria-disabled", value);
36
+ setAriaFlag(this._refs.summary, "aria-disabled", value);
36
37
  this._refs.summary.tabIndex = value ? -1 : 0;
37
38
  }, { attribute: "disabled" });
38
39
  _refs = this.useRefs((ref) => ({
@@ -93,6 +93,8 @@ export declare class JlCalendar extends JlFormControl {
93
93
  /** The day the grid lets focus on: the remembered one when it is on the page, else the first day it can. */
94
94
  private rovingDate;
95
95
  private renderPage;
96
+ /** The day the Tab key reaches: the one the arrows move from. */
97
+ private tabStop;
96
98
  /** The title is a live region: written only when the month changes, so it is announced once. */
97
99
  private renderTitle;
98
100
  private renderWeekdays;
@@ -108,4 +110,6 @@ export declare class JlCalendar extends JlFormControl {
108
110
  private renderNavigation;
109
111
  private renderValidity;
110
112
  private renderDisabled;
113
+ /** Without the attribute: the form says its state before the `disabled` input has taken the attribute's change. */
114
+ private drawDisabled;
111
115
  }
@@ -6,7 +6,7 @@ import { clampedNumber, oneOf } from "../lib/attributes.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 { addMonths, calendarDateOf, clampDate, dateAfterKey, dateFormatter, formatMonthTitle, isSameDate, isSameMonth, isWithin, monthGrid, monthHasDaysWithin, parseIsoDate, toIsoDate, weekdayNames } from "../lib/calendar.js";
11
11
  import jl_calendar_default from "./jl-calendar.css.js";
12
12
  import { css } from "@jadis/core";
@@ -23,6 +23,7 @@ var SUNDAY = 0;
23
23
  var SATURDAY = 6;
24
24
  var DAYS_PER_WEEK = 7;
25
25
  var SELECT_KEYS = ["Enter", " "];
26
+ var TAB_STOP = "[tabindex=\"0\"]";
26
27
  var FULL_DATE = { dateStyle: "full" };
27
28
  /** The first day of the week from its attribute: 0 (Sunday) to 6 (Saturday), Monday when absent. */
28
29
  var parseWeekday = (value) => Math.round(clampedNumber(MONDAY, SUNDAY, SATURDAY)(value));
@@ -90,7 +91,7 @@ var JlCalendar = class extends JlFormControl {
90
91
  }));
91
92
  /** Focuses the day the arrows move from: the chosen one, or today, or the first of the month. */
92
93
  focus(options) {
93
- this._refs.days.querySelector("[tabindex=\"0\"]")?.focus(options);
94
+ this.tabStop()?.focus(options);
94
95
  }
95
96
  /** Shows the month of a date (ISO), without choosing it. */
96
97
  showMonth(iso) {
@@ -154,7 +155,7 @@ var JlCalendar = class extends JlFormControl {
154
155
  }
155
156
  setDisabledByForm(disabled) {
156
157
  this._state.formDisabled = disabled;
157
- this.whenRendered(() => this.renderDisabled(this.disabled.get()));
158
+ this.whenRendered(() => this.drawDisabled());
158
159
  }
159
160
  bounds() {
160
161
  return {
@@ -247,6 +248,11 @@ var JlCalendar = class extends JlFormControl {
247
248
  this.renderDays(locale);
248
249
  this.renderStates(min, max);
249
250
  this.renderNavigation(min, max);
251
+ this.renderValidity();
252
+ }
253
+ /** The day the Tab key reaches: the one the arrows move from. */
254
+ tabStop() {
255
+ return this._refs.days.querySelector(TAB_STOP);
250
256
  }
251
257
  /** The title is a live region: written only when the month changes, so it is announced once. */
252
258
  renderTitle(text) {
@@ -333,14 +339,19 @@ var JlCalendar = class extends JlFormControl {
333
339
  }
334
340
  renderValidity() {
335
341
  if (this.required.get() && parseIsoDate(this.value.get()) === null) {
336
- this.internals.setValidity({ valueMissing: true }, jlText("chooseDateMissing"));
342
+ this.internals.setValidity({ valueMissing: true }, jlText("chooseDateMissing"), this.tabStop() ?? void 0);
337
343
  return;
338
344
  }
339
345
  this.internals.setValidity({});
340
346
  }
341
347
  renderDisabled(disabled) {
342
348
  this.reflect("disabled", disabled);
343
- this._refs.grid.toggleAttribute("aria-disabled", this.isOff());
349
+ this.drawDisabled();
350
+ }
351
+ /** Without the attribute: the form says its state before the `disabled` input has taken the attribute's change. */
352
+ drawDisabled() {
353
+ setAriaFlag(this._refs.base, "aria-disabled", this.isOff());
354
+ setAriaFlag(this._refs.grid, "aria-disabled", this.isOff());
344
355
  this.renderPage();
345
356
  }
346
357
  };
@@ -1,3 +1,3 @@
1
1
  // src/molecules/jl-chip-group.css?inline
2
- var jl_chip_group_default = ":host{--height:28px;--pad:10px;--font-size:var(--jl-font-sm);min-width:0;display:block}:host([size=sm]){--height:24px;--pad:8px;--font-size:var(--jl-font-xs)}:host([size=lg]){--height:36px;--pad:14px;--font-size:var(--jl-font-md)}.group{scrollbar-width:none;contain:inline-size;gap:8px;min-width:0;margin:-3px;padding:3px;display:flex;overflow-x:auto}.group::-webkit-scrollbar{display:none}:host([wrap]) .group{contain:none;flex-wrap:wrap;overflow:visible}.chip{max-width:100%;height:var(--height);padding:0 var(--pad);border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-pill);background:var(--jl-surface);color:var(--jl-text-2);font-size:var(--font-size);white-space:nowrap;cursor:pointer;transition:background var(--jl-fast) var(--jl-ease), border-color var(--jl-fast) var(--jl-ease), color var(--jl-fast) var(--jl-ease);flex:none;align-items:center;gap:6px;font-weight:600;line-height:1;display:inline-flex}.chip:hover:not(:disabled){background:var(--jl-surface-2)}.chip:is([aria-checked=true],[aria-pressed=true]),.chip:is([aria-checked=true],[aria-pressed=true]):hover:not(:disabled){border-color:var(--jl-accent-line);background:var(--jl-accent-soft);color:var(--jl-accent)}.chip:not([data-icon],[aria-checked=true],[aria-pressed=true]) .icon{display:none}.chip:disabled{cursor:not-allowed;opacity:.5}.label{text-overflow:ellipsis;line-height:1.4;overflow:hidden}.badge{border-radius:var(--jl-radius-pill);background:var(--jl-surface-3);min-width:18px;color:var(--jl-muted);font-size:var(--jl-font-xs);font-variant-numeric:tabular-nums;text-align:center;margin-right:-4px;padding:0 6px;font-weight:650;line-height:18px}.chip:is([aria-checked=true],[aria-pressed=true]) .badge{background:color-mix(in srgb, var(--jl-accent) 14%, transparent);color:var(--jl-accent)}jl-icon{--icon-size:14px}:host([size=sm]) jl-icon{--icon-size:12px}:host([size=lg]) jl-icon{--icon-size:16px}";
2
+ var jl_chip_group_default = ":host{--height:28px;--pad:10px;--font-size:var(--jl-font-sm);min-width:0;display:block}:host([size=sm]){--height:24px;--pad:8px;--font-size:var(--jl-font-xs)}:host([size=lg]){--height:36px;--pad:14px;--font-size:var(--jl-font-md)}.group{scrollbar-width:none;contain:inline-size;gap:8px;min-width:0;margin:-3px;padding:3px;display:flex;overflow-x:auto}.group::-webkit-scrollbar{display:none}:host([wrap]) .group{contain:none;flex-wrap:wrap;overflow:visible}.chip{max-width:100%;height:var(--height);padding:0 var(--pad);border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-pill);background:var(--jl-surface);color:var(--jl-text-2);font-size:var(--font-size);white-space:nowrap;cursor:pointer;transition:background var(--jl-fast) var(--jl-ease), border-color var(--jl-fast) var(--jl-ease), color var(--jl-fast) var(--jl-ease);flex:none;align-items:center;gap:6px;font-weight:600;line-height:1;display:inline-flex}.chip:hover:not(:disabled){background:var(--jl-surface-2)}.chip:is([aria-checked=true],[aria-pressed=true]),.chip:is([aria-checked=true],[aria-pressed=true]):hover:not(:disabled){border-color:var(--jl-accent-line);background:var(--jl-accent-soft);color:var(--jl-accent)}.chip:not([data-icon],[aria-checked=true],[aria-pressed=true]) .icon{display:none}.chip:disabled{cursor:not-allowed;opacity:.5}.label{text-overflow:ellipsis;line-height:1.4;overflow:hidden}.badge{border-radius:var(--jl-radius-pill);background:var(--jl-surface-3);min-width:18px;color:var(--jl-muted);font-size:var(--jl-font-xs);font-variant-numeric:tabular-nums;text-align:center;margin-right:-4px;padding:0 6px;font-weight:650;line-height:18px}.chip:is([aria-checked=true],[aria-pressed=true]) .badge{background:color-mix(in srgb, var(--jl-accent) 14%, transparent);color:var(--jl-accent-strong)}jl-icon{--icon-size:14px}:host([size=sm]) jl-icon{--icon-size:12px}:host([size=lg]) jl-icon{--icon-size:16px}";
3
3
  export { jl_chip_group_default as default };
@@ -5,8 +5,8 @@ import { jsonOf, oneOf, textListOf } 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";
9
- import { rovingIndex } from "../lib/roving-index.js";
8
+ import { setAriaFlag, setOrRemove } from "../lib/dom.js";
9
+ import { rovingIndex } from "../lib/roving.js";
10
10
  import jl_chip_group_default from "./jl-chip-group.css.js";
11
11
  import { css } from "@jadis/core";
12
12
  import { Check } from "lucide";
@@ -65,7 +65,7 @@ var JlChipGroup = class extends JlFormControl {
65
65
  /** A form refuses to submit while nothing is chosen. */
66
66
  required = this.useChange(false, (value) => {
67
67
  this.reflect("required", value);
68
- this._refs.group.toggleAttribute("aria-required", value);
68
+ setAriaFlag(this._refs.group, "aria-required", value);
69
69
  this.renderValidity();
70
70
  }, { attribute: "required" });
71
71
  disabled = this.useChange(false, (value) => {
@@ -209,7 +209,7 @@ var JlChipGroup = class extends JlFormControl {
209
209
  const multiple = this.multiple.get();
210
210
  const groupDisabled = this.isDisabled();
211
211
  this._refs.group.setAttribute("role", multiple ? "group" : "radiogroup");
212
- this._refs.group.toggleAttribute("aria-disabled", groupDisabled);
212
+ setAriaFlag(this._refs.group, "aria-disabled", groupDisabled);
213
213
  for (const chip of this.chips()) {
214
214
  const selected = chosen.has(chip.dataset.value ?? "");
215
215
  chip.disabled = groupDisabled || chip.dataset.disabled !== void 0;
@@ -1,3 +1,3 @@
1
1
  // src/molecules/jl-code-block.css?inline
2
- var jl_code_block_default = ":host{--max-height:none;min-width:0;display:block}figure{border:1px solid var(--jl-line);border-radius:var(--jl-radius);background:var(--jl-surface-2);position:relative;overflow:hidden}header{border-bottom:1px solid var(--jl-line);height:38px;color:var(--jl-muted);font-size:var(--jl-font-xs);justify-content:space-between;align-items:center;gap:12px;padding:0 52px 0 14px;display:flex}.heading{color:var(--jl-text-2);font-family:var(--jl-font-mono);text-overflow:ellipsis;white-space:nowrap;font-weight:500;overflow:hidden}.language{letter-spacing:.06em;text-transform:uppercase;font-weight:600}.body{min-width:0;max-height:var(--max-height);display:flex;overflow-y:auto}.gutter,pre{font-family:var(--jl-font-mono);font-variant-ligatures:no-contextual;padding:14px 16px;font-size:12.5px;line-height:1.7}.gutter{color:var(--jl-faint);text-align:right;white-space:pre;-webkit-user-select:none;user-select:none;flex:none;padding-right:4px;display:none}pre{min-width:0;color:var(--jl-text);tab-size:2;flex:1;margin:0;padding-right:48px;overflow-x:auto}:host([line-numbers]) .gutter{display:block}:host(:not([has-header])) header{display:none}:host([wrap]) pre{white-space:pre-wrap;overflow-wrap:anywhere}.copy{background:var(--jl-surface-2);border-radius:var(--jl-radius-sm);position:absolute;top:6px;right:6px}:host(:not([has-header])) .copy{opacity:.6;transition:opacity var(--jl-fast) var(--jl-ease)}:host(:not([has-header])) figure:hover .copy,.copy:focus-within{opacity:1}.tok-comment{color:var(--jl-code-comment);font-style:italic}.tok-string{color:var(--jl-code-string)}.tok-number{color:var(--jl-code-number)}.tok-keyword{color:var(--jl-code-keyword)}.tok-tag{color:var(--jl-code-tag)}.tok-attribute{color:var(--jl-code-attribute)}.tok-property{color:var(--jl-code-property)}.tok-function{color:var(--jl-code-function)}.tok-punctuation{color:var(--jl-muted)}";
2
+ var jl_code_block_default = ":host{--max-height:none;min-width:0;display:block}figure{border:1px solid var(--jl-line);border-radius:var(--jl-radius);background:var(--jl-surface-2);position:relative;overflow:hidden}header{border-bottom:1px solid var(--jl-line);height:38px;color:var(--jl-muted);font-size:var(--jl-font-xs);justify-content:space-between;align-items:center;gap:12px;padding:0 52px 0 14px;display:flex}.heading{color:var(--jl-text-2);font-family:var(--jl-font-mono);text-overflow:ellipsis;white-space:nowrap;font-weight:500;overflow:hidden}.language{letter-spacing:.06em;text-transform:uppercase;font-weight:600}.body{min-width:0;max-height:var(--max-height);display:flex;overflow-y:auto}.gutter,pre{font-family:var(--jl-font-mono);font-variant-ligatures:no-contextual;padding:14px 16px;font-size:12.5px;line-height:1.7}.gutter{color:var(--jl-muted);text-align:right;white-space:pre;-webkit-user-select:none;user-select:none;flex:none;padding-right:4px;display:none}pre{min-width:0;color:var(--jl-text);tab-size:2;flex:1;margin:0;padding-right:48px;overflow-x:auto}:host([line-numbers]) .gutter{display:block}:host(:not([has-header])) header{display:none}:host([wrap]) pre{white-space:pre-wrap;overflow-wrap:anywhere}.copy{background:var(--jl-surface-2);border-radius:var(--jl-radius-sm);position:absolute;top:6px;right:6px}:host(:not([has-header])) .copy{opacity:.6;transition:opacity var(--jl-fast) var(--jl-ease)}:host(:not([has-header])) figure:hover .copy,.copy:focus-within{opacity:1}.tok-comment{color:var(--jl-code-comment);font-style:italic}.tok-string{color:var(--jl-code-string)}.tok-number{color:var(--jl-code-number)}.tok-keyword{color:var(--jl-code-keyword)}.tok-tag{color:var(--jl-code-tag)}.tok-attribute{color:var(--jl-code-attribute)}.tok-property{color:var(--jl-code-property)}.tok-function{color:var(--jl-code-function)}.tok-punctuation{color:var(--jl-muted)}";
3
3
  export { jl_code_block_default as default };
@@ -73,6 +73,8 @@ export declare class JlCombobox extends JlFormControl {
73
73
  onDisconnect(): void;
74
74
  protected resetValue(): void;
75
75
  protected setDisabledByForm(disabled: boolean): void;
76
+ /** Disabled by its own input, or by a `<fieldset disabled>` around it. */
77
+ private isOff;
76
78
  protected drawTexts(): void;
77
79
  private renderEmptyText;
78
80
  private isOpen;
@@ -123,4 +125,6 @@ export declare class JlCombobox extends JlFormControl {
123
125
  private renderValidity;
124
126
  private renderClear;
125
127
  private renderDisabled;
128
+ /** Without the attribute: the form says its state before the `disabled` input has taken the attribute's change. */
129
+ private drawDisabled;
126
130
  }
@@ -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 { edgeEnabledIndex, filterOptions, foldText, matchParts, nextEnabledIndex } from "../lib/option-filter.js";
12
12
  import jl_combobox_default from "./jl-combobox.css.js";
@@ -58,7 +58,7 @@ var JlCombobox = class extends JlFormControl {
58
58
  /** What the list says when no option matches; jlib's own when empty. */
59
59
  emptyText = this.useChange("", () => this.renderEmptyText(), { attribute: "empty-text" });
60
60
  required = this.useChange(false, (value) => {
61
- this._refs.native.toggleAttribute("aria-required", value);
61
+ setAriaFlag(this._refs.native, "aria-required", value);
62
62
  this.reflect("required", value);
63
63
  this.renderValidity();
64
64
  }, { attribute: "required" });
@@ -66,7 +66,7 @@ var JlCombobox = class extends JlFormControl {
66
66
  /** Draws the field in the danger colour, for an error the page found itself. */
67
67
  invalid = this.useChange(false, (value) => {
68
68
  this.reflect("invalid", value);
69
- this._refs.native.toggleAttribute("aria-invalid", value);
69
+ setAriaFlag(this._refs.native, "aria-invalid", value);
70
70
  }, { attribute: "invalid" });
71
71
  size = this.useChange("md", (value) => this.reflect("size", value), {
72
72
  attribute: "size",
@@ -77,6 +77,7 @@ var JlCombobox = class extends JlFormControl {
77
77
  active: NONE,
78
78
  /** The option element the arrows reached: it alone is marked, wherever the filter put it. */
79
79
  activeItem: null,
80
+ disabledByForm: false,
80
81
  matches: [],
81
82
  opening: new AbortController(),
82
83
  /** What people typed since the last choice; empty shows every option. */
@@ -174,9 +175,12 @@ var JlCombobox = class extends JlFormControl {
174
175
  this.value.set(this.getAttribute("value") ?? "");
175
176
  }
176
177
  setDisabledByForm(disabled) {
177
- this.whenRendered(() => {
178
- this._refs.native.disabled = disabled || this.disabled.get();
179
- });
178
+ this._state.disabledByForm = disabled;
179
+ this.whenRendered(() => this.drawDisabled());
180
+ }
181
+ /** Disabled by its own input, or by a `<fieldset disabled>` around it. */
182
+ isOff() {
183
+ return this.disabled.get() || this._state.disabledByForm;
180
184
  }
181
185
  drawTexts() {
182
186
  this._refs.clear.setAttribute("aria-label", jlText("clear"));
@@ -280,7 +284,7 @@ var JlCombobox = class extends JlFormControl {
280
284
  * it; otherwise the chosen option is. With free text allowed and nothing matching, the list stays closed.
281
285
  */
282
286
  openList(typing) {
283
- if (this.disabled.get() || this.options.get().length === 0 && this._state.query === "") return;
287
+ if (this.isOff() || this.options.get().length === 0 && this._state.query === "") return;
284
288
  this.renderOptions();
285
289
  const matches = this._state.matches;
286
290
  const autoActive = typing && this._state.query.trim() !== "" && !this.allowCustom.get();
@@ -348,8 +352,12 @@ var JlCombobox = class extends JlFormControl {
348
352
  commitText() {
349
353
  this.closeList();
350
354
  const text = this._refs.native.value.trim();
351
- const exact = this.optionWithLabel(text);
352
355
  this._state.query = "";
356
+ if (text === this.displayOf(this.value.get()).trim()) {
357
+ this.renderValue();
358
+ return;
359
+ }
360
+ const exact = this.optionWithLabel(text);
353
361
  if (exact !== void 0) {
354
362
  this.commit(exact.value);
355
363
  return;
@@ -461,12 +469,16 @@ var JlCombobox = class extends JlFormControl {
461
469
  }
462
470
  renderClear() {
463
471
  const native = this._refs.native;
464
- this._refs.clear.hidden = !(this.clearable.get() && !this.disabled.get() && native.value !== "");
472
+ this._refs.clear.hidden = !(this.clearable.get() && !this.isOff() && native.value !== "");
465
473
  }
466
474
  renderDisabled(disabled) {
467
- this._refs.native.disabled = disabled;
468
- this._refs.toggle.disabled = disabled;
469
475
  this.reflect("disabled", disabled);
476
+ this.drawDisabled();
477
+ }
478
+ /** Without the attribute: the form says its state before the `disabled` input has taken the attribute's change. */
479
+ drawDisabled() {
480
+ this._refs.native.disabled = this.isOff();
481
+ this._refs.toggle.disabled = this.isOff();
470
482
  this.closeList();
471
483
  this.renderClear();
472
484
  }
@@ -1,3 +1,3 @@
1
1
  // src/molecules/jl-copy-button.css?inline
2
- var jl_copy_button_default = ":host{display:inline-flex}:host([copied]) jl-button{--jl-accent:var(--jl-ok);--jl-accent-soft:var(--jl-ok-soft)}";
2
+ var jl_copy_button_default = ":host{display:inline-flex}:host([copied]) jl-button{--jl-accent:var(--jl-ok);--jl-accent-soft:var(--jl-ok-soft)}:host([failed]) jl-button{--jl-accent:var(--jl-danger);--jl-accent-soft:var(--jl-danger-soft)}";
3
3
  export { jl_copy_button_default as default };
@@ -1,6 +1,9 @@
1
1
  import { JlElement } from '../base/jl-element';
2
2
  import type { ControlSize } from '../types/options.types';
3
- /** Copies a text to the clipboard, and says so for a moment. Fires `copy` with the text. */
3
+ /**
4
+ * Copies a text to the clipboard, and says so for a moment. Fires `copy` with the text. Where the clipboard refuses
5
+ * (a page served without https has none, a permission denied), the button says that it could not copy.
6
+ */
4
7
  export declare class JlCopyButton extends JlElement {
5
8
  static readonly selector = "jl-copy-button";
6
9
  readonly events: Readonly<import("@jadis/core").UseEventsHandler<{
@@ -19,14 +22,18 @@ export declare class JlCopyButton extends JlElement {
19
22
  get(): ControlSize;
20
23
  set(setter: ((prevState: ControlSize) => ControlSize) | ControlSize): void;
21
24
  }>>;
22
- private readonly _timer;
25
+ private readonly _state;
23
26
  private readonly _refs;
24
27
  templateHtml(): Node;
25
28
  templateCss(): string;
26
29
  onConnect(): void;
30
+ /** The timer goes, and what it would have taken back with it: the button returns as a copy button. */
27
31
  onDisconnect(): void;
28
- /** Copies the value now; resolves once the clipboard has it. */
32
+ /** Copies the value now; resolves once the clipboard has it, and rejects when the clipboard refuses. */
29
33
  copy(): Promise<void>;
30
34
  protected drawTexts(): void;
31
- private confirm;
35
+ /** A press has no caller to tell of a refusal: the button says it, where `copy()` rejects. */
36
+ private copyOnPress;
37
+ /** Shows what the press came to, for a moment when there is something to say. */
38
+ private say;
32
39
  }
@@ -7,17 +7,33 @@ import { CONTROL_SIZES } from "../lib/options.js";
7
7
  import { JlButton } from "../atoms/jl-button.js";
8
8
  import jl_copy_button_default from "./jl-copy-button.css.js";
9
9
  import { css } from "@jadis/core";
10
- import { Check, Copy } from "lucide";
10
+ import { Check, Copy, X } from "lucide";
11
11
  import { jsx } from "@jadis/core/jsx-runtime";
12
12
  // src/molecules/jl-copy-button.tsx
13
13
  registerIcons({
14
14
  check: Check,
15
- copy: Copy
15
+ copy: Copy,
16
+ x: X
16
17
  });
17
18
  var CONFIRM_MS = 1600;
18
- var COPY_ICON = "copy";
19
- var DONE_ICON = "check";
20
- /** Copies a text to the clipboard, and says so for a moment. Fires `copy` with the text. */
19
+ var OUTCOME_LOOKS = {
20
+ copied: {
21
+ icon: "check",
22
+ text: "copied"
23
+ },
24
+ failed: {
25
+ icon: "x",
26
+ text: "copyFailed"
27
+ },
28
+ idle: {
29
+ icon: "copy",
30
+ text: "copy"
31
+ }
32
+ };
33
+ /**
34
+ * Copies a text to the clipboard, and says so for a moment. Fires `copy` with the text. Where the clipboard refuses
35
+ * (a page served without https has none, a permission denied), the button says that it could not copy.
36
+ */
21
37
  var JlCopyButton = class extends JlElement {
22
38
  static selector = "jl-copy-button";
23
39
  events = this.useEvents();
@@ -28,44 +44,54 @@ var JlCopyButton = class extends JlElement {
28
44
  attribute: "size",
29
45
  parse: oneOf(CONTROL_SIZES, "sm")
30
46
  });
31
- _timer = { id: 0 };
47
+ _state = {
48
+ outcome: "idle",
49
+ timer: 0
50
+ };
32
51
  _refs = this.useRefs((ref) => ({ button: ref(JlButton) }));
33
52
  templateHtml() {
34
53
  return /* @__PURE__ */ jsx(JlButton, {
35
54
  variant: "ghost",
36
- icon: COPY_ICON
55
+ icon: OUTCOME_LOOKS.idle.icon
37
56
  });
38
57
  }
39
58
  templateCss() {
40
59
  return css`${BASE_STYLES}${jl_copy_button_default}`;
41
60
  }
42
61
  onConnect() {
43
- this._refs.button.events.register("press", () => void this.copy());
62
+ this._refs.button.events.register("press", () => void this.copyOnPress());
44
63
  }
64
+ /** The timer goes, and what it would have taken back with it: the button returns as a copy button. */
45
65
  onDisconnect() {
46
- window.clearTimeout(this._timer.id);
66
+ this.say("idle");
47
67
  }
48
- /** Copies the value now; resolves once the clipboard has it. */
68
+ /** Copies the value now; resolves once the clipboard has it, and rejects when the clipboard refuses. */
49
69
  async copy() {
50
70
  const text = this.value.get();
51
71
  await navigator.clipboard.writeText(text);
52
72
  this.events.emit("copy", text);
53
- this.confirm();
73
+ this.say("copied");
54
74
  }
55
75
  drawTexts() {
56
- this._refs.button.hint.set(jlText(this.hasAttribute("copied") ? "copied" : "copy"));
76
+ this._refs.button.hint.set(jlText(OUTCOME_LOOKS[this._state.outcome].text));
77
+ }
78
+ /** A press has no caller to tell of a refusal: the button says it, where `copy()` rejects. */
79
+ async copyOnPress() {
80
+ try {
81
+ await this.copy();
82
+ } catch {
83
+ this.say("failed");
84
+ }
57
85
  }
58
- confirm() {
59
- const button = this._refs.button;
60
- button.icon.set(DONE_ICON);
61
- this.reflect("copied", true);
86
+ /** Shows what the press came to, for a moment when there is something to say. */
87
+ say(outcome) {
88
+ this._state.outcome = outcome;
89
+ this._refs.button.icon.set(OUTCOME_LOOKS[outcome].icon);
90
+ this.reflect("copied", outcome === "copied");
91
+ this.reflect("failed", outcome === "failed");
62
92
  this.drawTexts();
63
- window.clearTimeout(this._timer.id);
64
- this._timer.id = window.setTimeout(() => {
65
- button.icon.set(COPY_ICON);
66
- this.reflect("copied", false);
67
- this.drawTexts();
68
- }, CONFIRM_MS);
93
+ window.clearTimeout(this._state.timer);
94
+ if (outcome !== "idle") this._state.timer = window.setTimeout(() => this.say("idle"), CONFIRM_MS);
69
95
  }
70
96
  };
71
97
  JlCopyButton.register();
@@ -84,6 +84,8 @@ export declare class JlDatePicker extends JlFormControl {
84
84
  onDisconnect(): void;
85
85
  protected resetValue(): void;
86
86
  protected setDisabledByForm(disabled: boolean): void;
87
+ /** Disabled by its own input, or by a `<fieldset disabled>` around it. */
88
+ private isOff;
87
89
  private isOpen;
88
90
  /** Down (with or without Alt) opens the calendar. */
89
91
  private onKey;
@@ -119,4 +121,6 @@ export declare class JlDatePicker extends JlFormControl {
119
121
  private renderMissing;
120
122
  private renderClear;
121
123
  private renderDisabled;
124
+ /** Without the attribute: the form says its state before the `disabled` input has taken the attribute's change. */
125
+ private drawDisabled;
122
126
  }