@syware/jlib 0.8.0 → 0.9.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 (91) hide show
  1. package/README.md +2 -1
  2. package/dist/all.js +2 -2
  3. package/dist/atoms/jl-chip.d.ts +1 -0
  4. package/dist/atoms/jl-chip.js +4 -2
  5. package/dist/atoms/jl-input.d.ts +2 -0
  6. package/dist/atoms/jl-input.js +9 -3
  7. package/dist/atoms/jl-rating.d.ts +2 -0
  8. package/dist/atoms/jl-rating.js +13 -5
  9. package/dist/atoms/jl-spinner.d.ts +2 -0
  10. package/dist/atoms/jl-spinner.js +6 -2
  11. package/dist/base/jl-element.d.ts +6 -0
  12. package/dist/base/jl-element.js +5 -0
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.js +2 -2
  15. package/dist/lib/texts-de.d.ts +108 -0
  16. package/dist/lib/texts-de.js +111 -0
  17. package/dist/lib/texts-fr.d.ts +108 -0
  18. package/dist/lib/texts-fr.js +111 -0
  19. package/dist/lib/texts.d.ts +177 -91
  20. package/dist/lib/texts.js +174 -9
  21. package/dist/molecules/jl-alert.d.ts +1 -0
  22. package/dist/molecules/jl-alert.js +4 -2
  23. package/dist/molecules/jl-breadcrumb.d.ts +2 -0
  24. package/dist/molecules/jl-breadcrumb.js +12 -6
  25. package/dist/molecules/jl-calendar.d.ts +1 -0
  26. package/dist/molecules/jl-calendar.js +7 -4
  27. package/dist/molecules/jl-chip-group.d.ts +1 -0
  28. package/dist/molecules/jl-chip-group.js +4 -1
  29. package/dist/molecules/jl-code-block.js +1 -1
  30. package/dist/molecules/jl-combobox.d.ts +3 -1
  31. package/dist/molecules/jl-combobox.js +12 -7
  32. package/dist/molecules/jl-copy-button.d.ts +1 -0
  33. package/dist/molecules/jl-copy-button.js +7 -5
  34. package/dist/molecules/jl-date-picker.d.ts +1 -0
  35. package/dist/molecules/jl-date-picker.js +10 -7
  36. package/dist/molecules/jl-file-drop.d.ts +1 -0
  37. package/dist/molecules/jl-file-drop.js +15 -6
  38. package/dist/molecules/jl-input-list.d.ts +3 -2
  39. package/dist/molecules/jl-input-list.js +10 -7
  40. package/dist/molecules/jl-load-more.d.ts +4 -2
  41. package/dist/molecules/jl-load-more.js +15 -8
  42. package/dist/molecules/jl-load-state.d.ts +4 -0
  43. package/dist/molecules/jl-load-state.js +13 -9
  44. package/dist/molecules/jl-number-input.d.ts +1 -0
  45. package/dist/molecules/jl-number-input.js +6 -3
  46. package/dist/molecules/jl-pagination.d.ts +2 -0
  47. package/dist/molecules/jl-pagination.js +17 -9
  48. package/dist/molecules/jl-radio-group.d.ts +1 -0
  49. package/dist/molecules/jl-radio-group.js +4 -1
  50. package/dist/molecules/jl-search-button.d.ts +2 -1
  51. package/dist/molecules/jl-search-button.js +6 -4
  52. package/dist/molecules/jl-search.d.ts +2 -0
  53. package/dist/molecules/jl-search.js +9 -3
  54. package/dist/molecules/jl-steps.d.ts +2 -0
  55. package/dist/molecules/jl-steps.js +9 -4
  56. package/dist/molecules/jl-tag-input.d.ts +1 -0
  57. package/dist/molecules/jl-tag-input.js +8 -4
  58. package/dist/molecules/jl-toast.d.ts +1 -0
  59. package/dist/molecules/jl-toast.js +4 -2
  60. package/dist/organisms/jl-command-palette.d.ts +3 -1
  61. package/dist/organisms/jl-command-palette.js +13 -11
  62. package/dist/organisms/jl-confirm.d.ts +3 -0
  63. package/dist/organisms/jl-confirm.js +12 -11
  64. package/dist/organisms/jl-dialog.d.ts +1 -0
  65. package/dist/organisms/jl-dialog.js +4 -2
  66. package/dist/organisms/jl-drawer.d.ts +1 -0
  67. package/dist/organisms/jl-drawer.js +4 -2
  68. package/dist/organisms/jl-flow.d.ts +2 -0
  69. package/dist/organisms/jl-flow.js +25 -16
  70. package/dist/organisms/jl-navbar.d.ts +3 -0
  71. package/dist/organisms/jl-navbar.js +16 -7
  72. package/dist/organisms/jl-side-nav.d.ts +4 -2
  73. package/dist/organisms/jl-side-nav.js +17 -11
  74. package/dist/organisms/jl-tab-bar.d.ts +1 -0
  75. package/dist/organisms/jl-tab-bar.js +5 -2
  76. package/dist/organisms/jl-table.d.ts +2 -1
  77. package/dist/organisms/jl-table.js +9 -6
  78. package/dist/organisms/jl-toaster.d.ts +2 -1
  79. package/dist/organisms/jl-toaster.js +12 -9
  80. package/dist/organisms/jl-tree.d.ts +6 -4
  81. package/dist/organisms/jl-tree.js +21 -15
  82. package/dist/templates/jl-app-shell.d.ts +1 -0
  83. package/dist/templates/jl-app-shell.js +4 -2
  84. package/dist/templates/jl-auth-layout.d.ts +4 -3
  85. package/dist/templates/jl-auth-layout.js +13 -11
  86. package/dist/templates/jl-page.d.ts +1 -0
  87. package/dist/templates/jl-page.js +4 -1
  88. package/dist/templates/jl-split-view.d.ts +1 -0
  89. package/dist/templates/jl-split-view.js +5 -4
  90. package/dist/types/texts.types.d.ts +29 -4
  91. package/package.json +3 -3
@@ -1,9 +1,9 @@
1
+ import { jlText } from "../lib/texts.js";
1
2
  import { BASE_STYLES } from "../styles/shared.js";
2
3
  import { JlElement } from "../base/jl-element.js";
3
4
  import { clampedNumber, oneOf } from "../lib/attributes.js";
4
5
  import { define } from "../lib/define.js";
5
6
  import { registerIcons } from "../lib/icons.js";
6
- import { jlText } from "../lib/texts.js";
7
7
  import { JlButton } from "../atoms/jl-button.js";
8
8
  import { JlSkeleton } from "../atoms/jl-skeleton.js";
9
9
  import { JlEmpty } from "./jl-empty.js";
@@ -28,7 +28,6 @@ var LOAD_SKELETONS = [
28
28
  "cards",
29
29
  "lines"
30
30
  ];
31
- var DEFAULT_ERROR_HEADING = "This could not be loaded";
32
31
  var DEFAULT_DELAY_MS = 300;
33
32
  var MAX_DELAY_MS = 5e3;
34
33
  var DEFAULT_COUNT = 3;
@@ -93,9 +92,12 @@ var JlLoadState = class extends JlElement {
93
92
  attribute: "delay",
94
93
  parse: clampedNumber(DEFAULT_DELAY_MS, 0, MAX_DELAY_MS)
95
94
  });
96
- errorHeading = this.useChange(DEFAULT_ERROR_HEADING, (value) => this._refs.error.heading.set(value), { attribute: "error-heading" });
97
- errorText = this.useChange(jlText("loadStateError"), (value) => this._refs.error.description.set(value), { attribute: "error-text" });
98
- retryLabel = this.useChange(jlText("retry"), (value) => this._refs.retry.label.set(value), { attribute: "retry-label" });
95
+ /** The heading of a failed load; jlib's own when empty. */
96
+ errorHeading = this.useChange("", () => this.drawTexts(), { attribute: "error-heading" });
97
+ /** What a failed load says under its heading; jlib's own when empty. */
98
+ errorText = this.useChange("", () => this.drawTexts(), { attribute: "error-text" });
99
+ /** The button that runs the load again; jlib's own text when empty. */
100
+ retryLabel = this.useChange("", () => this.drawTexts(), { attribute: "retry-label" });
99
101
  _work = { latest: 0 };
100
102
  _refs = this.useRefs((ref) => ({
101
103
  bones: ref(".bones"),
@@ -150,13 +152,10 @@ var JlLoadState = class extends JlElement {
150
152
  /* @__PURE__ */ jsx("jl-empty", {
151
153
  class: "error",
152
154
  icon: "circle-alert",
153
- heading: DEFAULT_ERROR_HEADING,
154
- description: jlText("loadStateError"),
155
155
  hidden: true,
156
156
  children: /* @__PURE__ */ jsx(JlButton, {
157
157
  class: "retry",
158
- icon: "refresh",
159
- label: jlText("retry")
158
+ icon: "refresh"
160
159
  })
161
160
  }),
162
161
  /* @__PURE__ */ jsx("div", {
@@ -175,6 +174,11 @@ var JlLoadState = class extends JlElement {
175
174
  templateCss() {
176
175
  return css`${BASE_STYLES}${jl_load_state_default}`;
177
176
  }
177
+ drawTexts() {
178
+ this._refs.error.heading.set(this.errorHeading.get() || jlText("loadStateHeading"));
179
+ this._refs.error.description.set(this.errorText.get() || jlText("loadStateError"));
180
+ this._refs.retry.label.set(this.retryLabel.get() || jlText("retry"));
181
+ }
178
182
  onConnect() {
179
183
  this.renderSkeleton();
180
184
  this.renderState(this.state.get());
@@ -77,5 +77,6 @@ export declare class JlNumberInput extends JlFormControl {
77
77
  private renderDisabled;
78
78
  /** A button that cannot move the value further is disabled. */
79
79
  private renderButtons;
80
+ protected drawTexts(): void;
80
81
  private renderValidity;
81
82
  }
@@ -1,9 +1,9 @@
1
+ import { jlText } from "../lib/texts.js";
1
2
  import { BASE_STYLES, CONTROL_STYLES } from "../styles/shared.js";
2
3
  import { JlFormControl } from "../base/jl-form-control.js";
3
4
  import { oneOf } from "../lib/attributes.js";
4
5
  import { registerIcons } from "../lib/icons.js";
5
6
  import { CONTROL_SIZES } from "../lib/options.js";
6
- import { jlText } from "../lib/texts.js";
7
7
  import { JlIcon } from "../atoms/jl-icon.js";
8
8
  import { setOrRemove } from "../lib/dom.js";
9
9
  import { clamp, parseNumber, stepValue } from "../lib/numeric.js";
@@ -89,7 +89,6 @@ var JlNumberInput = class extends JlFormControl {
89
89
  class: "action step down",
90
90
  type: "button",
91
91
  tabIndex: -1,
92
- "aria-label": jlText("decrease"),
93
92
  children: /* @__PURE__ */ jsx(JlIcon, {
94
93
  name: "minus",
95
94
  size: ICON_SIZE
@@ -106,7 +105,6 @@ var JlNumberInput = class extends JlFormControl {
106
105
  class: "action step up",
107
106
  type: "button",
108
107
  tabIndex: -1,
109
- "aria-label": jlText("increase"),
110
108
  children: /* @__PURE__ */ jsx(JlIcon, {
111
109
  name: "plus",
112
110
  size: ICON_SIZE
@@ -208,6 +206,11 @@ var JlNumberInput = class extends JlFormControl {
208
206
  this._refs.down.disabled = off || value !== null && min !== null && value <= min;
209
207
  this._refs.up.disabled = off || value !== null && max !== null && value >= max;
210
208
  }
209
+ drawTexts() {
210
+ this._refs.down.setAttribute("aria-label", jlText("decrease"));
211
+ this._refs.up.setAttribute("aria-label", jlText("increase"));
212
+ this.renderValidity();
213
+ }
211
214
  renderValidity() {
212
215
  if (!(this.required.get() && this.value.get() === null)) {
213
216
  this.internals.setValidity({});
@@ -46,6 +46,8 @@ export declare class JlPagination extends JlElement {
46
46
  private readonly _refs;
47
47
  templateHtml(): Node;
48
48
  templateCss(): string;
49
+ protected drawTexts(): void;
50
+ private renderLabel;
49
51
  onConnect(): void;
50
52
  /** The current page, kept within the pages there are. */
51
53
  private currentPage;
@@ -1,9 +1,9 @@
1
+ import { jlText } from "../lib/texts.js";
1
2
  import { BASE_STYLES } from "../styles/shared.js";
2
3
  import { JlElement } from "../base/jl-element.js";
3
4
  import { clampedNumber, oneOf } from "../lib/attributes.js";
4
5
  import { registerIcons } from "../lib/icons.js";
5
6
  import { CONTROL_SIZES } from "../lib/options.js";
6
- import { jlText } from "../lib/texts.js";
7
7
  import { JlIcon } from "../atoms/jl-icon.js";
8
8
  import { clampPage, pageItems } from "../lib/pagination.js";
9
9
  import jl_pagination_default from "./jl-pagination.css_raw.js";
@@ -61,9 +61,7 @@ var JlPagination = class extends JlElement {
61
61
  parse: oneOf(CONTROL_SIZES, "md")
62
62
  });
63
63
  /** The navigation's name for screen readers, when a page has more than one. */
64
- label = this.useChange(jlText("pagination"), (value) => {
65
- this._refs.nav.setAttribute("aria-label", value || jlText("pagination"));
66
- }, { attribute: "label" });
64
+ label = this.useChange("", () => this.renderLabel(), { attribute: "label" });
67
65
  _refs = this.useRefs((ref) => ({
68
66
  list: ref(".pages"),
69
67
  nav: ref("nav"),
@@ -80,7 +78,6 @@ var JlPagination = class extends JlElement {
80
78
  /* @__PURE__ */ jsx("button", {
81
79
  type: "button",
82
80
  class: "button previous",
83
- "aria-label": jlText("previousPage"),
84
81
  children: /* @__PURE__ */ jsx(JlIcon, { name: "chevron-left" })
85
82
  }),
86
83
  /* @__PURE__ */ jsx("ol", { class: "pages" }),
@@ -91,7 +88,6 @@ var JlPagination = class extends JlElement {
91
88
  /* @__PURE__ */ jsx("button", {
92
89
  type: "button",
93
90
  class: "button next",
94
- "aria-label": jlText("nextPage"),
95
91
  children: /* @__PURE__ */ jsx(JlIcon, { name: "chevron-right" })
96
92
  })
97
93
  ]
@@ -100,6 +96,15 @@ var JlPagination = class extends JlElement {
100
96
  templateCss() {
101
97
  return css`${BASE_STYLES}${jl_pagination_default}`;
102
98
  }
99
+ drawTexts() {
100
+ this._refs.previous.setAttribute("aria-label", jlText("previousPage"));
101
+ this._refs.next.setAttribute("aria-label", jlText("nextPage"));
102
+ this.renderLabel();
103
+ this.render();
104
+ }
105
+ renderLabel() {
106
+ this._refs.nav.setAttribute("aria-label", this.label.get() || jlText("pagination"));
107
+ }
103
108
  onConnect() {
104
109
  this.on(this._refs.previous, "click", () => this.step(STEP_BACK));
105
110
  this.on(this._refs.next, "click", () => this.step(STEP_FORWARD));
@@ -125,8 +130,11 @@ var JlPagination = class extends JlElement {
125
130
  this._refs.status.hidden = !compact;
126
131
  this._refs.status.replaceChildren(/* @__PURE__ */ jsx("span", {
127
132
  class: "sr-only",
128
- children: "Page "
129
- }), `${page} of ${Math.max(pages, 1)}`);
133
+ children: `${jlText("page")} `
134
+ }), jlText("pageOfTotal", {
135
+ page,
136
+ total: Math.max(pages, 1)
137
+ }));
130
138
  if (!compact) {
131
139
  const items = pageItems(page, pages, this.siblings.get(), this.boundaries.get());
132
140
  this._refs.list.replaceChildren(...items.map((item) => this.entry(item, page)));
@@ -143,7 +151,7 @@ var JlPagination = class extends JlElement {
143
151
  type: "button",
144
152
  class: "button page",
145
153
  "data-page": item.page,
146
- "aria-label": `Page ${item.page}`,
154
+ "aria-label": jlText("pageNumber", { page: item.page }),
147
155
  "aria-current": isCurrent ? "page" : void 0,
148
156
  children: String(item.page)
149
157
  }) });
@@ -68,5 +68,6 @@ export declare class JlRadioGroup<Value extends string = string> extends JlFormC
68
68
  /** Checks the option with the value, and gives the Tab stop to it, or else to the first option enabled. */
69
69
  private renderValue;
70
70
  private tabStop;
71
+ protected drawTexts(): void;
71
72
  private renderValidity;
72
73
  }
@@ -1,7 +1,7 @@
1
+ import { jlText } from "../lib/texts.js";
1
2
  import { BASE_STYLES } from "../styles/shared.js";
2
3
  import { JlFormControl } from "../base/jl-form-control.js";
3
4
  import { jsonOf, oneOf, textOf } from "../lib/attributes.js";
4
- import { jlText } from "../lib/texts.js";
5
5
  import { rovingIndex } from "../lib/roving-index.js";
6
6
  import jl_radio_group_default from "./jl-radio-group.css_raw.js";
7
7
  import { css } from "@jadis/core";
@@ -194,6 +194,9 @@ var JlRadioGroup = class extends JlFormControl {
194
194
  const enabled = radios.filter((radio) => this.isEnabled(radio));
195
195
  return enabled.find((radio) => radio.dataset.value === value) ?? enabled[0];
196
196
  }
197
+ drawTexts() {
198
+ this.renderValidity();
199
+ }
197
200
  renderValidity() {
198
201
  if (!(this.required.get() && this.value.get() === NO_VALUE)) {
199
202
  this.internals.setValidity({});
@@ -9,7 +9,7 @@ export declare class JlSearchButton extends JlElement {
9
9
  readonly events: Readonly<import("@jadis/core").UseEventsHandler<{
10
10
  press: undefined;
11
11
  }>>;
12
- /** The text, and the button's name: "Search". */
12
+ /** The text, and the button's name; jlib's own when empty. */
13
13
  readonly label: Readonly<Readonly<{
14
14
  get(): string;
15
15
  set(setter: string | ((prevState: string) => string)): void;
@@ -28,6 +28,7 @@ export declare class JlSearchButton extends JlElement {
28
28
  focus(options?: FocusOptions): void;
29
29
  templateHtml(): Node;
30
30
  templateCss(): string;
31
+ protected drawTexts(): void;
31
32
  onConnect(): void;
32
33
  private renderLabel;
33
34
  private renderHotkey;
@@ -1,7 +1,7 @@
1
+ import { jlText } from "../lib/texts.js";
1
2
  import { BASE_STYLES } from "../styles/shared.js";
2
3
  import { JlElement } from "../base/jl-element.js";
3
4
  import { registerIcons } from "../lib/icons.js";
4
- import { jlText } from "../lib/texts.js";
5
5
  import { JlIcon } from "../atoms/jl-icon.js";
6
6
  import { setOrRemove } from "../lib/dom.js";
7
7
  import { JlKbd } from "../atoms/jl-kbd.js";
@@ -25,8 +25,8 @@ var isMac = () => MAC_PATTERN.test(navigator.userAgent);
25
25
  var JlSearchButton = class extends JlElement {
26
26
  static selector = "jl-search-button";
27
27
  events = this.useEvents();
28
- /** The text, and the button's name: "Search". */
29
- label = this.useChange(jlText("search"), () => this.renderLabel(), { attribute: "label" });
28
+ /** The text, and the button's name; jlib's own when empty. */
29
+ label = this.useChange("", () => this.renderLabel(), { attribute: "label" });
30
30
  /** The keys that open the palette, as `jl-kbd` writes them: `mod+k`; `none` for no keys. */
31
31
  hotkey = this.useChange(DEFAULT_HOTKEY, () => this.renderHotkey(), { attribute: "hotkey" });
32
32
  /** The icon alone, the label as its tooltip. */
@@ -57,8 +57,10 @@ var JlSearchButton = class extends JlElement {
57
57
  templateCss() {
58
58
  return css`${BASE_STYLES}${jl_search_button_default}`;
59
59
  }
60
- onConnect() {
60
+ drawTexts() {
61
61
  this.renderLabel();
62
+ }
63
+ onConnect() {
62
64
  this.renderHotkey();
63
65
  this.on(this._refs.button, "click", () => this.events.emit("press"));
64
66
  }
@@ -57,6 +57,8 @@ export declare class JlSearch extends JlFormControl {
57
57
  clear(): void;
58
58
  templateHtml(): Node;
59
59
  templateCss(): string;
60
+ protected drawTexts(): void;
61
+ private renderLabel;
60
62
  onConnect(): void;
61
63
  onDisconnect(): void;
62
64
  protected resetValue(): void;
@@ -1,9 +1,9 @@
1
+ import { jlText } from "../lib/texts.js";
1
2
  import { BASE_STYLES, CONTROL_STYLES } from "../styles/shared.js";
2
3
  import { JlFormControl } from "../base/jl-form-control.js";
3
4
  import { oneOf } from "../lib/attributes.js";
4
5
  import { registerIcons } from "../lib/icons.js";
5
6
  import { CONTROL_SIZES } from "../lib/options.js";
6
- import { jlText } from "../lib/texts.js";
7
7
  import { JlIcon } from "../atoms/jl-icon.js";
8
8
  import { setOrRemove } from "../lib/dom.js";
9
9
  import { JlSpinner } from "../atoms/jl-spinner.js";
@@ -38,7 +38,7 @@ var JlSearch = class extends JlFormControl {
38
38
  value = this.useChange("", (value) => this.renderValue(value), { attribute: "value" });
39
39
  placeholder = this.useChange("", (value) => setOrRemove(this._refs.native, "placeholder", value), { attribute: "placeholder" });
40
40
  /** The field's name for screen readers; "Search" when nothing else names it. */
41
- label = this.useChange("", (value) => this._refs.native.setAttribute("aria-label", value || jlText("search")), { attribute: "label" });
41
+ label = this.useChange("", () => this.renderLabel(), { attribute: "label" });
42
42
  /** How long typing must pause, in milliseconds, before `search` fires. */
43
43
  debounce = this.useChange(DEFAULT_DEBOUNCE_MS, () => void 0, { attribute: "debounce" });
44
44
  /** Keys that focus the field from anywhere: "/" or "mod+k" (⌘ on a Mac, Ctrl elsewhere). */
@@ -108,7 +108,6 @@ var JlSearch = class extends JlFormControl {
108
108
  /* @__PURE__ */ jsx("button", {
109
109
  class: "action clear",
110
110
  type: "button",
111
- "aria-label": jlText("clearSearch"),
112
111
  tabIndex: -1,
113
112
  hidden: true,
114
113
  children: /* @__PURE__ */ jsx(JlIcon, {
@@ -127,6 +126,13 @@ var JlSearch = class extends JlFormControl {
127
126
  templateCss() {
128
127
  return css`${BASE_STYLES}${CONTROL_STYLES}${jl_search_default}`;
129
128
  }
129
+ drawTexts() {
130
+ this._refs.clear.setAttribute("aria-label", jlText("clearSearch"));
131
+ this.renderLabel();
132
+ }
133
+ renderLabel() {
134
+ this._refs.native.setAttribute("aria-label", this.label.get() || jlText("search"));
135
+ }
130
136
  onConnect() {
131
137
  const native = this._refs.native;
132
138
  this.on(native, "input", (event) => {
@@ -37,6 +37,8 @@ export declare class JlSteps extends JlElement {
37
37
  templateHtml(): Node;
38
38
  templateCss(): string;
39
39
  onConnect(): void;
40
+ protected drawTexts(): void;
41
+ private renderLabel;
40
42
  private render;
41
43
  /** A failed step's ×, a done one's check, or the step's number. */
42
44
  private markerOf;
@@ -1,8 +1,8 @@
1
+ import { jlText } from "../lib/texts.js";
1
2
  import { BASE_STYLES } from "../styles/shared.js";
2
3
  import { JlElement } from "../base/jl-element.js";
3
4
  import { clampedNumber, jsonOf, oneOf } from "../lib/attributes.js";
4
5
  import { registerIcons } from "../lib/icons.js";
5
- import { jlText } from "../lib/texts.js";
6
6
  import { JlIcon } from "../atoms/jl-icon.js";
7
7
  import jl_steps_default from "./jl-steps.css_raw.js";
8
8
  import { css } from "@jadis/core";
@@ -52,9 +52,7 @@ var JlSteps = class extends JlElement {
52
52
  /** Done steps become buttons that go back to them. */
53
53
  clickable = this.useChange(false, () => this.render(), { attribute: "clickable" });
54
54
  /** The list's name for screen readers. */
55
- label = this.useChange(jlText("progress"), (value) => {
56
- this._refs.list.setAttribute("aria-label", value || jlText("progress"));
57
- }, { attribute: "label" });
55
+ label = this.useChange("", () => this.renderLabel(), { attribute: "label" });
58
56
  _refs = this.useRefs((ref) => ({ list: ref("ol") }));
59
57
  templateHtml() {
60
58
  return /* @__PURE__ */ jsx("ol", { attrs: { part: "base" } });
@@ -68,6 +66,13 @@ var JlSteps = class extends JlElement {
68
66
  if (target !== null) this.goBackTo(Number(target.dataset.index));
69
67
  });
70
68
  }
69
+ drawTexts() {
70
+ this.renderLabel();
71
+ this.render();
72
+ }
73
+ renderLabel() {
74
+ this._refs.list.setAttribute("aria-label", this.label.get() || jlText("progress"));
75
+ }
71
76
  render() {
72
77
  const current = this.current.get();
73
78
  this._refs.list.replaceChildren(...this.items.get().map((item, index) => this.step(item, index, statusOf(index, current))));
@@ -56,6 +56,7 @@ export declare class JlTagInput extends JlFormControl {
56
56
  focus(options?: FocusOptions): void;
57
57
  templateHtml(): Node;
58
58
  templateCss(): string;
59
+ protected drawTexts(): void;
59
60
  onConnect(): void;
60
61
  onDisconnect(): void;
61
62
  protected resetValue(): void;
@@ -1,10 +1,10 @@
1
+ import { jlText } from "../lib/texts.js";
1
2
  import { BASE_STYLES, CONTROL_STYLES, FLOATING_STYLES } from "../styles/shared.js";
2
3
  import { JlFormControl } from "../base/jl-form-control.js";
3
4
  import { clampedNumber, jsonOf, oneOf } from "../lib/attributes.js";
4
5
  import { followAnchor } from "../lib/floating.js";
5
6
  import { registerIcons } from "../lib/icons.js";
6
7
  import { CONTROL_SIZES } from "../lib/options.js";
7
- import { jlText } from "../lib/texts.js";
8
8
  import { JlIcon } from "../atoms/jl-icon.js";
9
9
  import { setOrRemove, uniqueId } from "../lib/dom.js";
10
10
  import { keepInView } from "../lib/keep-in-view.js";
@@ -118,6 +118,10 @@ var JlTagInput = class extends JlFormControl {
118
118
  templateCss() {
119
119
  return css`${BASE_STYLES}${CONTROL_STYLES}${FLOATING_STYLES}${jl_tag_input_default}`;
120
120
  }
121
+ drawTexts() {
122
+ this.renderTags();
123
+ this.renderValidity();
124
+ }
121
125
  onConnect() {
122
126
  const native = this._refs.native;
123
127
  this._nameWatch.observe(this, {
@@ -232,7 +236,7 @@ var JlTagInput = class extends JlFormControl {
232
236
  this.closeList();
233
237
  if (added.length > 0) {
234
238
  this.value.set(result.tags);
235
- this.announce(`Added ${added.join(", ")}`);
239
+ this.announce(jlText("addedNamed", { names: added.join(", ") }));
236
240
  this.events.emit("change", result.tags);
237
241
  }
238
242
  this.flash(result.duplicates);
@@ -243,7 +247,7 @@ var JlTagInput = class extends JlFormControl {
243
247
  if (removed === void 0 || this.disabled.get()) return;
244
248
  const next = tags.filter((_, position) => position !== index);
245
249
  this.value.set(next);
246
- this.announce(`Removed ${removed}`);
250
+ this.announce(jlText("removedNamed", { name: removed }));
247
251
  this.events.emit("change", next);
248
252
  }
249
253
  removeAndFocus(index) {
@@ -381,7 +385,7 @@ var JlTagInput = class extends JlFormControl {
381
385
  class: "tag-remove",
382
386
  type: "button",
383
387
  tabIndex: -1,
384
- "aria-label": `Remove ${tag}`,
388
+ "aria-label": jlText("removeNamed", { name: tag }),
385
389
  "data-index": String(index),
386
390
  children: /* @__PURE__ */ jsx(JlIcon, {
387
391
  name: "x",
@@ -65,6 +65,7 @@ export declare class JlToast extends JlElement {
65
65
  show(): void;
66
66
  templateHtml(): Node;
67
67
  templateCss(): string;
68
+ protected drawTexts(): void;
68
69
  onConnect(): void;
69
70
  onDisconnect(): void;
70
71
  /** The way in, once per showing; WAAPI so that the toaster moving in the top layer does not replay it. */
@@ -1,9 +1,9 @@
1
+ import { jlText } from "../lib/texts.js";
1
2
  import { BASE_STYLES } from "../styles/shared.js";
2
3
  import { JlElement } from "../base/jl-element.js";
3
4
  import { oneOf } from "../lib/attributes.js";
4
5
  import { registerIcons } from "../lib/icons.js";
5
6
  import { TONE_ICONS, TONE_ICON_FILLED } from "../lib/options.js";
6
- import { jlText } from "../lib/texts.js";
7
7
  import { JlIcon } from "../atoms/jl-icon.js";
8
8
  import { JlButton } from "../atoms/jl-button.js";
9
9
  import { optionalNumber } from "../lib/progress.js";
@@ -181,7 +181,6 @@ var JlToast = class extends JlElement {
181
181
  variant: "ghost",
182
182
  size: "sm",
183
183
  icon: "x",
184
- hint: jlText("close"),
185
184
  hidden: true
186
185
  })]
187
186
  }),
@@ -197,6 +196,9 @@ var JlToast = class extends JlElement {
197
196
  templateCss() {
198
197
  return css`${BASE_STYLES}${jl_toast_default}`;
199
198
  }
199
+ drawTexts() {
200
+ this._refs.close.hint.set(jlText("close"));
201
+ }
200
202
  onConnect() {
201
203
  this._refs.close.events.register("press", () => this.dismiss());
202
204
  this._refs.action.events.register("press", () => {
@@ -24,6 +24,7 @@ export declare class JlCommandPalette<Id extends string = string> extends JlElem
24
24
  get(): boolean;
25
25
  set(setter: boolean | ((prevState: boolean) => boolean)): void;
26
26
  }>>;
27
+ /** What the field says before anything is typed; jlib's own text when empty. */
27
28
  readonly placeholder: Readonly<Readonly<{
28
29
  get(): string;
29
30
  set(setter: string | ((prevState: string) => string)): void;
@@ -33,7 +34,7 @@ export declare class JlCommandPalette<Id extends string = string> extends JlElem
33
34
  get(): string;
34
35
  set(setter: string | ((prevState: string) => string)): void;
35
36
  }>>;
36
- /** What it says when nothing matches. */
37
+ /** What it says when nothing matches; jlib's own text when empty. */
37
38
  readonly emptyText: Readonly<Readonly<{
38
39
  get(): string;
39
40
  set(setter: string | ((prevState: string) => string)): void;
@@ -59,6 +60,7 @@ export declare class JlCommandPalette<Id extends string = string> extends JlElem
59
60
  close(): void;
60
61
  templateHtml(): Node;
61
62
  templateCss(): string;
63
+ protected drawTexts(): void;
62
64
  onConnect(): void;
63
65
  private toggleOnHotkey;
64
66
  private navigate;
@@ -1,8 +1,8 @@
1
+ import { jlText } from "../lib/texts.js";
1
2
  import { BASE_STYLES } from "../styles/shared.js";
2
3
  import { JlElement } from "../base/jl-element.js";
3
4
  import { jsonOf } from "../lib/attributes.js";
4
5
  import { registerIcons } from "../lib/icons.js";
5
- import { jlText } from "../lib/texts.js";
6
6
  import { JlIcon } from "../atoms/jl-icon.js";
7
7
  import { setOrRemove } from "../lib/dom.js";
8
8
  import { JlSpinner } from "../atoms/jl-spinner.js";
@@ -46,15 +46,12 @@ var JlCommandPalette = class extends JlElement {
46
46
  parse: jsonOf([])
47
47
  });
48
48
  open = this.useChange(false, (value) => this.renderOpen(value), { attribute: "open" });
49
- placeholder = this.useChange(jlText("commandPlaceholder"), (value) => {
50
- this._refs.input.placeholder = value;
51
- }, { attribute: "placeholder" });
49
+ /** What the field says before anything is typed; jlib's own text when empty. */
50
+ placeholder = this.useChange("", () => this.drawTexts(), { attribute: "placeholder" });
52
51
  /** The keys that open and close it from anywhere on the page; `none` for no keys. `mod` is ⌘ or Ctrl. */
53
52
  hotkey = this.useChange(DEFAULT_HOTKEY, () => this.renderHotkey(), { attribute: "hotkey" });
54
- /** What it says when nothing matches. */
55
- emptyText = this.useChange(jlText("noCommands"), (value) => {
56
- this._refs.empty.textContent = value;
57
- }, { attribute: "empty-text" });
53
+ /** What it says when nothing matches; jlib's own text when empty. */
54
+ emptyText = this.useChange("", () => this.drawTexts(), { attribute: "empty-text" });
58
55
  /** How long typing pauses, in milliseconds, before `search` fires. */
59
56
  debounce = this.useChange(DEFAULT_DEBOUNCE_MS, () => void 0, { attribute: "debounce" });
60
57
  /** Shows a spinner in place of the search icon, while the page looks for what was typed. */
@@ -63,7 +60,7 @@ var JlCommandPalette = class extends JlElement {
63
60
  this._refs.spinner.hidden = !value;
64
61
  }, { attribute: "loading" });
65
62
  /** The dialog's name for screen readers. */
66
- label = this.useChange(jlText("commandPalette"), (value) => this._refs.dialog.setAttribute("aria-label", value), { attribute: "label" });
63
+ label = this.useChange("", () => this.drawTexts(), { attribute: "label" });
67
64
  _state = {
68
65
  active: 0,
69
66
  matches: [],
@@ -120,8 +117,7 @@ var JlCommandPalette = class extends JlElement {
120
117
  /* @__PURE__ */ jsx("div", {
121
118
  class: "results",
122
119
  id: "results",
123
- role: "listbox",
124
- "aria-label": jlText("commands")
120
+ role: "listbox"
125
121
  }),
126
122
  /* @__PURE__ */ jsx("p", {
127
123
  class: "empty",
@@ -155,6 +151,12 @@ var JlCommandPalette = class extends JlElement {
155
151
  templateCss() {
156
152
  return css`${BASE_STYLES}${jl_command_palette_default}`;
157
153
  }
154
+ drawTexts() {
155
+ this._refs.input.placeholder = this.placeholder.get() || jlText("commandPlaceholder");
156
+ this._refs.empty.textContent = this.emptyText.get() || jlText("noCommands");
157
+ this._refs.dialog.setAttribute("aria-label", this.label.get() || jlText("commandPalette"));
158
+ this._refs.results.setAttribute("aria-label", jlText("commands"));
159
+ }
158
160
  onConnect() {
159
161
  const dialog = this._refs.dialog;
160
162
  const input = this._refs.input;
@@ -20,10 +20,12 @@ export declare class JlConfirm extends JlElement {
20
20
  get(): string;
21
21
  set(setter: string | ((prevState: string) => string)): void;
22
22
  }>>;
23
+ /** The confirm button's text; jlib's own when empty. */
23
24
  readonly confirmLabel: Readonly<Readonly<{
24
25
  get(): string;
25
26
  set(setter: string | ((prevState: string) => string)): void;
26
27
  }>>;
28
+ /** The cancel button's text; jlib's own when empty. */
27
29
  readonly cancelLabel: Readonly<Readonly<{
28
30
  get(): string;
29
31
  set(setter: string | ((prevState: string) => string)): void;
@@ -38,6 +40,7 @@ export declare class JlConfirm extends JlElement {
38
40
  ask(): Promise<boolean>;
39
41
  templateHtml(): Node;
40
42
  templateCss(): string;
43
+ protected drawTexts(): void;
41
44
  onConnect(): void;
42
45
  /** Every way the dialog closes ends in its close event: that is where the answer is given. */
43
46
  private openFor;
@@ -1,8 +1,8 @@
1
+ import { jlText } from "../lib/texts.js";
1
2
  import { BASE_STYLES } from "../styles/shared.js";
2
3
  import { JlElement } from "../base/jl-element.js";
3
4
  import { oneOf } from "../lib/attributes.js";
4
5
  import { define } from "../lib/define.js";
5
- import { jlText } from "../lib/texts.js";
6
6
  import { JlButton } from "../atoms/jl-button.js";
7
7
  import jl_confirm_default from "./jl-confirm.css_raw.js";
8
8
  import { JlDialog } from "./jl-dialog.js";
@@ -15,8 +15,6 @@ var CONFIRM_VARIANTS = {
15
15
  accent: "primary",
16
16
  danger: "danger"
17
17
  };
18
- var DEFAULT_CONFIRM = "Confirm";
19
- var DEFAULT_CANCEL = "Cancel";
20
18
  var CLOSE = "close";
21
19
  /**
22
20
  * A yes-or-no question in a small modal dialog. `ask()` opens it and resolves `true` on confirm, `false` on cancel,
@@ -31,8 +29,10 @@ var JlConfirm = class extends JlElement {
31
29
  this._refs.text.textContent = value;
32
30
  this._refs.text.hidden = value === "";
33
31
  }, { attribute: "text" });
34
- confirmLabel = this.useChange(DEFAULT_CONFIRM, (value) => this._refs.confirm.label.set(value), { attribute: "confirm-label" });
35
- cancelLabel = this.useChange(DEFAULT_CANCEL, (value) => this._refs.cancel.label.set(value), { attribute: "cancel-label" });
32
+ /** The confirm button's text; jlib's own when empty. */
33
+ confirmLabel = this.useChange("", () => this.drawTexts(), { attribute: "confirm-label" });
34
+ /** The cancel button's text; jlib's own when empty. */
35
+ cancelLabel = this.useChange("", () => this.drawTexts(), { attribute: "cancel-label" });
36
36
  tone = this.useChange("accent", (value) => {
37
37
  this.reflect("tone", value);
38
38
  this._refs.confirm.variant.set(CONFIRM_VARIANTS[value]);
@@ -67,14 +67,12 @@ var JlConfirm = class extends JlElement {
67
67
  /* @__PURE__ */ jsx("slot", {}),
68
68
  /* @__PURE__ */ jsx(JlButton, {
69
69
  slot: "actions",
70
- class: "cancel",
71
- label: DEFAULT_CANCEL
70
+ class: "cancel"
72
71
  }),
73
72
  /* @__PURE__ */ jsx(JlButton, {
74
73
  slot: "actions",
75
74
  class: "confirm",
76
- variant: "primary",
77
- label: DEFAULT_CONFIRM
75
+ variant: "primary"
78
76
  })
79
77
  ]
80
78
  });
@@ -82,6 +80,10 @@ var JlConfirm = class extends JlElement {
82
80
  templateCss() {
83
81
  return css`${BASE_STYLES}${jl_confirm_default}`;
84
82
  }
83
+ drawTexts() {
84
+ this._refs.confirm.label.set(this.confirmLabel.get() || jlText("confirm"));
85
+ this._refs.cancel.label.set(this.cancelLabel.get() || jlText("cancel"));
86
+ }
85
87
  onConnect() {
86
88
  this._refs.cancel.events.register("press", () => this._refs.dialog.close());
87
89
  this._refs.confirm.events.register("press", () => {
@@ -130,7 +132,6 @@ function confirmDialog(options) {
130
132
  document.body.append(element);
131
133
  return element.ask().finally(() => element.remove());
132
134
  }
133
- var LEAVE_HEADING = "Leave without saving?";
134
135
  /**
135
136
  * Guards a form or an editor against leaving with changes not saved. Closing or reloading the tab asks the
136
137
  * browser's own question; the function it returns asks in the page, for the app's router to call before it moves
@@ -147,7 +148,7 @@ function guardLeave(options) {
147
148
  asking.pending ??= confirmDialog({
148
149
  cancelLabel: options.stayLabel ?? jlText("stay"),
149
150
  confirmLabel: options.leaveLabel ?? jlText("leave"),
150
- heading: options.heading ?? LEAVE_HEADING,
151
+ heading: options.heading ?? jlText("leaveHeading"),
151
152
  text: options.text ?? jlText("leaveText"),
152
153
  tone: "danger"
153
154
  }).finally(() => {