@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.
- package/README.md +2 -1
- package/dist/all.js +2 -2
- package/dist/atoms/jl-chip.d.ts +1 -0
- package/dist/atoms/jl-chip.js +4 -2
- package/dist/atoms/jl-input.d.ts +2 -0
- package/dist/atoms/jl-input.js +9 -3
- package/dist/atoms/jl-rating.d.ts +2 -0
- package/dist/atoms/jl-rating.js +13 -5
- package/dist/atoms/jl-spinner.d.ts +2 -0
- package/dist/atoms/jl-spinner.js +6 -2
- package/dist/base/jl-element.d.ts +6 -0
- package/dist/base/jl-element.js +5 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/lib/texts-de.d.ts +108 -0
- package/dist/lib/texts-de.js +111 -0
- package/dist/lib/texts-fr.d.ts +108 -0
- package/dist/lib/texts-fr.js +111 -0
- package/dist/lib/texts.d.ts +177 -91
- package/dist/lib/texts.js +174 -9
- package/dist/molecules/jl-alert.d.ts +1 -0
- package/dist/molecules/jl-alert.js +4 -2
- package/dist/molecules/jl-breadcrumb.d.ts +2 -0
- package/dist/molecules/jl-breadcrumb.js +12 -6
- package/dist/molecules/jl-calendar.d.ts +1 -0
- package/dist/molecules/jl-calendar.js +7 -4
- package/dist/molecules/jl-chip-group.d.ts +1 -0
- package/dist/molecules/jl-chip-group.js +4 -1
- package/dist/molecules/jl-code-block.js +1 -1
- package/dist/molecules/jl-combobox.d.ts +3 -1
- package/dist/molecules/jl-combobox.js +12 -7
- package/dist/molecules/jl-copy-button.d.ts +1 -0
- package/dist/molecules/jl-copy-button.js +7 -5
- package/dist/molecules/jl-date-picker.d.ts +1 -0
- package/dist/molecules/jl-date-picker.js +10 -7
- package/dist/molecules/jl-file-drop.d.ts +1 -0
- package/dist/molecules/jl-file-drop.js +15 -6
- package/dist/molecules/jl-input-list.d.ts +3 -2
- package/dist/molecules/jl-input-list.js +10 -7
- package/dist/molecules/jl-load-more.d.ts +4 -2
- package/dist/molecules/jl-load-more.js +15 -8
- package/dist/molecules/jl-load-state.d.ts +4 -0
- package/dist/molecules/jl-load-state.js +13 -9
- package/dist/molecules/jl-number-input.d.ts +1 -0
- package/dist/molecules/jl-number-input.js +6 -3
- package/dist/molecules/jl-pagination.d.ts +2 -0
- package/dist/molecules/jl-pagination.js +17 -9
- package/dist/molecules/jl-radio-group.d.ts +1 -0
- package/dist/molecules/jl-radio-group.js +4 -1
- package/dist/molecules/jl-search-button.d.ts +2 -1
- package/dist/molecules/jl-search-button.js +6 -4
- package/dist/molecules/jl-search.d.ts +2 -0
- package/dist/molecules/jl-search.js +9 -3
- package/dist/molecules/jl-steps.d.ts +2 -0
- package/dist/molecules/jl-steps.js +9 -4
- package/dist/molecules/jl-tag-input.d.ts +1 -0
- package/dist/molecules/jl-tag-input.js +8 -4
- package/dist/molecules/jl-toast.d.ts +1 -0
- package/dist/molecules/jl-toast.js +4 -2
- package/dist/organisms/jl-command-palette.d.ts +3 -1
- package/dist/organisms/jl-command-palette.js +13 -11
- package/dist/organisms/jl-confirm.d.ts +3 -0
- package/dist/organisms/jl-confirm.js +12 -11
- package/dist/organisms/jl-dialog.d.ts +1 -0
- package/dist/organisms/jl-dialog.js +4 -2
- package/dist/organisms/jl-drawer.d.ts +1 -0
- package/dist/organisms/jl-drawer.js +4 -2
- package/dist/organisms/jl-flow.d.ts +2 -0
- package/dist/organisms/jl-flow.js +25 -16
- package/dist/organisms/jl-navbar.d.ts +3 -0
- package/dist/organisms/jl-navbar.js +16 -7
- package/dist/organisms/jl-side-nav.d.ts +4 -2
- package/dist/organisms/jl-side-nav.js +17 -11
- package/dist/organisms/jl-tab-bar.d.ts +1 -0
- package/dist/organisms/jl-tab-bar.js +5 -2
- package/dist/organisms/jl-table.d.ts +2 -1
- package/dist/organisms/jl-table.js +9 -6
- package/dist/organisms/jl-toaster.d.ts +2 -1
- package/dist/organisms/jl-toaster.js +12 -9
- package/dist/organisms/jl-tree.d.ts +6 -4
- package/dist/organisms/jl-tree.js +21 -15
- package/dist/templates/jl-app-shell.d.ts +1 -0
- package/dist/templates/jl-app-shell.js +4 -2
- package/dist/templates/jl-auth-layout.d.ts +4 -3
- package/dist/templates/jl-auth-layout.js +13 -11
- package/dist/templates/jl-page.d.ts +1 -0
- package/dist/templates/jl-page.js +4 -1
- package/dist/templates/jl-split-view.d.ts +1 -0
- package/dist/templates/jl-split-view.js +5 -4
- package/dist/types/texts.types.d.ts +29 -4
- package/package.json +3 -3
|
@@ -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 { registerIcons } from "../lib/icons.js";
|
|
5
|
-
import { jlText } from "../lib/texts.js";
|
|
6
6
|
import { JlButton } from "../atoms/jl-button.js";
|
|
7
7
|
import jl_dialog_default from "./jl-dialog.css_raw.js";
|
|
8
8
|
import { css } from "@jadis/core";
|
|
@@ -68,7 +68,6 @@ var JlDialog = class extends JlElement {
|
|
|
68
68
|
class: "close",
|
|
69
69
|
variant: "ghost",
|
|
70
70
|
icon: "x",
|
|
71
|
-
hint: jlText("close"),
|
|
72
71
|
size: "sm"
|
|
73
72
|
})] }),
|
|
74
73
|
/* @__PURE__ */ jsx("div", {
|
|
@@ -85,6 +84,9 @@ var JlDialog = class extends JlElement {
|
|
|
85
84
|
templateCss() {
|
|
86
85
|
return css`${BASE_STYLES}${jl_dialog_default}`;
|
|
87
86
|
}
|
|
87
|
+
drawTexts() {
|
|
88
|
+
this._refs.close.hint.set(jlText("close"));
|
|
89
|
+
}
|
|
88
90
|
onConnect() {
|
|
89
91
|
const dialog = this._refs.dialog;
|
|
90
92
|
this._refs.close.events.register("press", () => this.close());
|
|
@@ -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 { registerIcons } from "../lib/icons.js";
|
|
5
|
-
import { jlText } from "../lib/texts.js";
|
|
6
6
|
import { JlButton } from "../atoms/jl-button.js";
|
|
7
7
|
import jl_drawer_default from "./jl-drawer.css_raw.js";
|
|
8
8
|
import { css } from "@jadis/core";
|
|
@@ -86,7 +86,6 @@ var JlDrawer = class extends JlElement {
|
|
|
86
86
|
class: "close",
|
|
87
87
|
variant: "ghost",
|
|
88
88
|
icon: "x",
|
|
89
|
-
hint: jlText("close"),
|
|
90
89
|
size: "sm"
|
|
91
90
|
})]
|
|
92
91
|
})] }),
|
|
@@ -104,6 +103,9 @@ var JlDrawer = class extends JlElement {
|
|
|
104
103
|
templateCss() {
|
|
105
104
|
return css`${BASE_STYLES}${jl_drawer_default}`;
|
|
106
105
|
}
|
|
106
|
+
drawTexts() {
|
|
107
|
+
this._refs.close.hint.set(jlText("close"));
|
|
108
|
+
}
|
|
107
109
|
onConnect() {
|
|
108
110
|
const dialog = this._refs.dialog;
|
|
109
111
|
this._refs.close.events.register("press", () => this.close());
|
|
@@ -57,6 +57,8 @@ export declare class JlFlow extends JlElement {
|
|
|
57
57
|
layout(): void;
|
|
58
58
|
templateHtml(): Node;
|
|
59
59
|
templateCss(): string;
|
|
60
|
+
protected drawTexts(): void;
|
|
61
|
+
private renderLabel;
|
|
60
62
|
onConnect(): void;
|
|
61
63
|
private show;
|
|
62
64
|
/** An edit: drawn, kept, and sent to the page. */
|
|
@@ -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, svgElement } from "../lib/dom.js";
|
|
8
8
|
import { FLOW_NODE, FLOW_ZOOM, centeredAt, connect, edgeEnds, edgeMidpoint, edgePath, fitView, isEdgeTaken, isPortFree, layoutFlow, moveNode, nodeAt, nodeHeight, outputAnchor, portX, portsOf, positionAfter, removeEdge, removeNode, revealIn, snap, toWorld, zoomAt } from "../lib/flow.js";
|
|
@@ -116,7 +116,7 @@ var JlFlow = class extends JlElement {
|
|
|
116
116
|
*/
|
|
117
117
|
dropType = this.useChange("", () => void 0, { attribute: "drop-type" });
|
|
118
118
|
/** The canvas's name for screen readers. */
|
|
119
|
-
label = this.useChange("", (
|
|
119
|
+
label = this.useChange("", () => this.renderLabel(), { attribute: "label" });
|
|
120
120
|
_state = {
|
|
121
121
|
edge: "",
|
|
122
122
|
fitted: false,
|
|
@@ -139,6 +139,7 @@ var JlFlow = class extends JlElement {
|
|
|
139
139
|
};
|
|
140
140
|
_refs = this.useRefs((ref) => ({
|
|
141
141
|
empty: ref(".empty"),
|
|
142
|
+
emptySlot: ref("slot[name=\"empty\"]"),
|
|
142
143
|
fit: ref(".fit"),
|
|
143
144
|
nodes: ref(".nodes"),
|
|
144
145
|
removeEdge: ref(".remove-edge"),
|
|
@@ -203,7 +204,6 @@ var JlFlow = class extends JlElement {
|
|
|
203
204
|
class: "remove-edge",
|
|
204
205
|
"data-control": "",
|
|
205
206
|
hidden: true,
|
|
206
|
-
"aria-label": jlText("removeEdge"),
|
|
207
207
|
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
208
208
|
name: "x",
|
|
209
209
|
size: ADD_ICON_SIZE
|
|
@@ -215,10 +215,7 @@ var JlFlow = class extends JlElement {
|
|
|
215
215
|
class: "empty",
|
|
216
216
|
"data-control": "",
|
|
217
217
|
hidden: true,
|
|
218
|
-
children: /* @__PURE__ */ jsx("slot", {
|
|
219
|
-
name: "empty",
|
|
220
|
-
children: "Nothing here yet."
|
|
221
|
-
})
|
|
218
|
+
children: /* @__PURE__ */ jsx("slot", { name: "empty" })
|
|
222
219
|
}),
|
|
223
220
|
/* @__PURE__ */ jsxs("div", {
|
|
224
221
|
class: "controls",
|
|
@@ -227,8 +224,6 @@ var JlFlow = class extends JlElement {
|
|
|
227
224
|
/* @__PURE__ */ jsx("button", {
|
|
228
225
|
type: "button",
|
|
229
226
|
class: "control zoom-out",
|
|
230
|
-
title: jlText("zoomOut"),
|
|
231
|
-
"aria-label": jlText("zoomOut"),
|
|
232
227
|
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
233
228
|
name: "minus",
|
|
234
229
|
size: CONTROL_ICON_SIZE
|
|
@@ -238,8 +233,6 @@ var JlFlow = class extends JlElement {
|
|
|
238
233
|
/* @__PURE__ */ jsx("button", {
|
|
239
234
|
type: "button",
|
|
240
235
|
class: "control zoom-in",
|
|
241
|
-
title: jlText("zoomIn"),
|
|
242
|
-
"aria-label": jlText("zoomIn"),
|
|
243
236
|
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
244
237
|
name: "plus",
|
|
245
238
|
size: CONTROL_ICON_SIZE
|
|
@@ -248,8 +241,6 @@ var JlFlow = class extends JlElement {
|
|
|
248
241
|
/* @__PURE__ */ jsx("button", {
|
|
249
242
|
type: "button",
|
|
250
243
|
class: "control fit",
|
|
251
|
-
title: jlText("fitView"),
|
|
252
|
-
"aria-label": jlText("fitView"),
|
|
253
244
|
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
254
245
|
name: "maximize",
|
|
255
246
|
size: CONTROL_ICON_SIZE
|
|
@@ -258,8 +249,6 @@ var JlFlow = class extends JlElement {
|
|
|
258
249
|
/* @__PURE__ */ jsx("button", {
|
|
259
250
|
type: "button",
|
|
260
251
|
class: "control tidy",
|
|
261
|
-
title: jlText("tidyLayout"),
|
|
262
|
-
"aria-label": jlText("tidyLayout"),
|
|
263
252
|
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
264
253
|
name: "wand-sparkles",
|
|
265
254
|
size: CONTROL_ICON_SIZE
|
|
@@ -273,6 +262,26 @@ var JlFlow = class extends JlElement {
|
|
|
273
262
|
templateCss() {
|
|
274
263
|
return css`${BASE_STYLES}${jl_flow_default}`;
|
|
275
264
|
}
|
|
265
|
+
drawTexts() {
|
|
266
|
+
this.renderLabel();
|
|
267
|
+
this._refs.emptySlot.textContent = jlText("flowEmpty");
|
|
268
|
+
this._refs.removeEdge.setAttribute("aria-label", jlText("removeEdge"));
|
|
269
|
+
const controls = [
|
|
270
|
+
[this._refs.zoomOut, jlText("zoomOut")],
|
|
271
|
+
[this._refs.zoomIn, jlText("zoomIn")],
|
|
272
|
+
[this._refs.fit, jlText("fitView")],
|
|
273
|
+
[this._refs.tidy, jlText("tidyLayout")]
|
|
274
|
+
];
|
|
275
|
+
for (const [button, text] of controls) {
|
|
276
|
+
button.title = text;
|
|
277
|
+
button.setAttribute("aria-label", text);
|
|
278
|
+
}
|
|
279
|
+
for (const node of this._nodes.values()) node.setAttribute("aria-roledescription", jlText("node"));
|
|
280
|
+
for (const port of this._refs.nodes.querySelectorAll(".port")) port.title = jlText("dragToConnect");
|
|
281
|
+
}
|
|
282
|
+
renderLabel() {
|
|
283
|
+
this._refs.viewport.setAttribute("aria-label", this.label.get() || jlText("flow"));
|
|
284
|
+
}
|
|
276
285
|
onConnect() {
|
|
277
286
|
const viewport = this._refs.viewport;
|
|
278
287
|
this.on(viewport, "pointerdown", (event) => this.pointerDown(event));
|
|
@@ -584,7 +593,7 @@ var JlFlow = class extends JlElement {
|
|
|
584
593
|
"data-node": id,
|
|
585
594
|
tabIndex: 0,
|
|
586
595
|
role: "group",
|
|
587
|
-
"aria-roledescription": "node",
|
|
596
|
+
"aria-roledescription": jlText("node"),
|
|
588
597
|
attrs: { part: "node" }
|
|
589
598
|
});
|
|
590
599
|
this._nodes.set(id, element);
|
|
@@ -27,6 +27,9 @@ export declare class JlNavbar extends JlElement {
|
|
|
27
27
|
onConnect(): void;
|
|
28
28
|
private renderLinks;
|
|
29
29
|
private link;
|
|
30
|
+
protected drawTexts(): void;
|
|
31
|
+
private renderLabel;
|
|
32
|
+
private renderToggleLabel;
|
|
30
33
|
/** Opens or closes the list of links under the bar, on a narrow bar. */
|
|
31
34
|
private setDrawer;
|
|
32
35
|
}
|
|
@@ -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 jl_navbar_default from "./jl-navbar.css_raw.js";
|
|
8
8
|
import { css } from "@jadis/core";
|
|
@@ -30,10 +30,7 @@ var JlNavbar = class extends JlElement {
|
|
|
30
30
|
/** Stays at the top of the window while the page scrolls. */
|
|
31
31
|
sticky = this.useChange(false, (value) => this.reflect("sticky", value), { attribute: "sticky" });
|
|
32
32
|
/** The navigation's name for screen readers. */
|
|
33
|
-
label = this.useChange(
|
|
34
|
-
this._refs.links.setAttribute("aria-label", value || jlText("mainNavigation"));
|
|
35
|
-
this._refs.drawer.setAttribute("aria-label", value || jlText("mainNavigation"));
|
|
36
|
-
}, { attribute: "label" });
|
|
33
|
+
label = this.useChange("", () => this.renderLabel(), { attribute: "label" });
|
|
37
34
|
_refs = this.useRefs((ref) => ({
|
|
38
35
|
drawer: ref(".drawer"),
|
|
39
36
|
drawerList: ref(".drawer ul"),
|
|
@@ -65,7 +62,6 @@ var JlNavbar = class extends JlElement {
|
|
|
65
62
|
class: "toggle",
|
|
66
63
|
"aria-expanded": "false",
|
|
67
64
|
"aria-controls": "drawer",
|
|
68
|
-
"aria-label": jlText("menu"),
|
|
69
65
|
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
70
66
|
name: MENU_ICON,
|
|
71
67
|
size: ICON_SIZE
|
|
@@ -108,11 +104,24 @@ var JlNavbar = class extends JlElement {
|
|
|
108
104
|
children: link.label
|
|
109
105
|
}) });
|
|
110
106
|
}
|
|
107
|
+
drawTexts() {
|
|
108
|
+
this.renderLabel();
|
|
109
|
+
this.renderToggleLabel();
|
|
110
|
+
}
|
|
111
|
+
renderLabel() {
|
|
112
|
+
const label = this.label.get() || jlText("mainNavigation");
|
|
113
|
+
this._refs.links.setAttribute("aria-label", label);
|
|
114
|
+
this._refs.drawer.setAttribute("aria-label", label);
|
|
115
|
+
}
|
|
116
|
+
renderToggleLabel() {
|
|
117
|
+
const open = !this._refs.drawer.hidden;
|
|
118
|
+
this._refs.toggle.setAttribute("aria-label", open ? jlText("closeMenu") : jlText("menu"));
|
|
119
|
+
}
|
|
111
120
|
/** Opens or closes the list of links under the bar, on a narrow bar. */
|
|
112
121
|
setDrawer(open) {
|
|
113
122
|
this._refs.drawer.hidden = !open;
|
|
114
123
|
this._refs.toggle.setAttribute("aria-expanded", String(open));
|
|
115
|
-
this.
|
|
124
|
+
this.renderToggleLabel();
|
|
116
125
|
this._refs.toggleIcon.name.set(open ? CLOSE_ICON : MENU_ICON);
|
|
117
126
|
this.reflect("expanded", open);
|
|
118
127
|
}
|
|
@@ -33,12 +33,12 @@ export declare class JlSideNav<Id extends string = string> extends JlElement {
|
|
|
33
33
|
get(): boolean;
|
|
34
34
|
set(setter: boolean | ((prevState: boolean) => boolean)): void;
|
|
35
35
|
}>>;
|
|
36
|
-
/** The fold button's text while the side nav is open. */
|
|
36
|
+
/** The fold button's text while the side nav is open; jlib's own when empty. */
|
|
37
37
|
readonly collapseLabel: Readonly<Readonly<{
|
|
38
38
|
get(): string;
|
|
39
39
|
set(setter: string | ((prevState: string) => string)): void;
|
|
40
40
|
}>>;
|
|
41
|
-
/** Its hint while the side nav is a rail. */
|
|
41
|
+
/** Its hint while the side nav is a rail; jlib's own when empty. */
|
|
42
42
|
readonly expandLabel: Readonly<Readonly<{
|
|
43
43
|
get(): string;
|
|
44
44
|
set(setter: string | ((prevState: string) => string)): void;
|
|
@@ -71,6 +71,8 @@ export declare class JlSideNav<Id extends string = string> extends JlElement {
|
|
|
71
71
|
private fold;
|
|
72
72
|
/** The rail, or the whole side nav: drawn again, said on the host (`rail`) for the styles and the page. */
|
|
73
73
|
private renderRail;
|
|
74
|
+
protected drawTexts(): void;
|
|
75
|
+
private renderLabel;
|
|
74
76
|
private renderFold;
|
|
75
77
|
private choose;
|
|
76
78
|
/** Up and Down move between the rows people can see, Right opens a parent, Left closes it or goes up to it. */
|
|
@@ -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, textOf } 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, uniqueId } from "../lib/dom.js";
|
|
8
8
|
import { JlButton } from "../atoms/jl-button.js";
|
|
@@ -60,19 +60,17 @@ var JlSideNav = class extends JlElement {
|
|
|
60
60
|
}, { attribute: "collapsed" });
|
|
61
61
|
/** Adds a button at the bottom that folds the side nav into its rail and unfolds it. */
|
|
62
62
|
collapsible = this.useChange(false, () => this.renderFold(), { attribute: "collapsible" });
|
|
63
|
-
/** The fold button's text while the side nav is open. */
|
|
64
|
-
collapseLabel = this.useChange(
|
|
65
|
-
/** Its hint while the side nav is a rail. */
|
|
66
|
-
expandLabel = this.useChange(
|
|
63
|
+
/** The fold button's text while the side nav is open; jlib's own when empty. */
|
|
64
|
+
collapseLabel = this.useChange("", () => this.renderFold(), { attribute: "collapse-label" });
|
|
65
|
+
/** Its hint while the side nav is a rail; jlib's own when empty. */
|
|
66
|
+
expandLabel = this.useChange("", () => this.renderFold(), { attribute: "expand-label" });
|
|
67
67
|
/**
|
|
68
68
|
* Set by `jl-app-shell` while the side nav is its drawer, on a narrow screen: the drawer shows it whole, and its
|
|
69
69
|
* fold button hides, `collapsed` waiting for a wide screen again.
|
|
70
70
|
*/
|
|
71
71
|
inDrawer = this.useChange(false, () => this.renderRail(), { attribute: "in-drawer" });
|
|
72
72
|
/** The name of the navigation for screen readers. */
|
|
73
|
-
label = this.useChange(
|
|
74
|
-
this._refs.nav.setAttribute("aria-label", value === "" ? jlText("mainNavigation") : value);
|
|
75
|
-
}, { attribute: "label" });
|
|
73
|
+
label = this.useChange("", () => this.renderLabel(), { attribute: "label" });
|
|
76
74
|
_prefix = uniqueId("jl-side-nav");
|
|
77
75
|
/** The parents people opened, or that hold the active item. */
|
|
78
76
|
_state = { open: /* @__PURE__ */ new Set() };
|
|
@@ -144,13 +142,21 @@ var JlSideNav = class extends JlElement {
|
|
|
144
142
|
this.render();
|
|
145
143
|
this.renderFold();
|
|
146
144
|
}
|
|
145
|
+
drawTexts() {
|
|
146
|
+
this.renderLabel();
|
|
147
|
+
this.renderFold();
|
|
148
|
+
this.render();
|
|
149
|
+
}
|
|
150
|
+
renderLabel() {
|
|
151
|
+
this._refs.nav.setAttribute("aria-label", this.label.get() || jlText("mainNavigation"));
|
|
152
|
+
}
|
|
147
153
|
renderFold() {
|
|
148
154
|
const fold = this._refs.fold;
|
|
149
155
|
const rail = this.isRail();
|
|
150
156
|
fold.hidden = !this.collapsible.get() || this.inDrawer.get();
|
|
151
157
|
fold.icon.set(rail ? EXPAND_ICON : COLLAPSE_ICON);
|
|
152
|
-
fold.label.set(rail ? "" : this.collapseLabel.get());
|
|
153
|
-
fold.hint.set(rail ? this.expandLabel.get() : "");
|
|
158
|
+
fold.label.set(rail ? "" : this.collapseLabel.get() || jlText("collapseMenu"));
|
|
159
|
+
fold.hint.set(rail ? this.expandLabel.get() || jlText("expandMenu") : "");
|
|
154
160
|
}
|
|
155
161
|
choose(id) {
|
|
156
162
|
this.value.set(id);
|
|
@@ -225,7 +231,7 @@ var JlSideNav = class extends JlElement {
|
|
|
225
231
|
class: "expander",
|
|
226
232
|
type: "button",
|
|
227
233
|
"data-id": item.id,
|
|
228
|
-
"aria-label":
|
|
234
|
+
"aria-label": jlText("showPagesOf", { name: item.label }),
|
|
229
235
|
"aria-controls": childrenId,
|
|
230
236
|
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
231
237
|
name: "chevron-right",
|
|
@@ -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, textOf } 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 jl_tab_bar_default from "./jl-tab-bar.css_raw.js";
|
|
@@ -50,7 +50,7 @@ var JlTabBar = class extends JlElement {
|
|
|
50
50
|
this._refs.more.hidden = value === "";
|
|
51
51
|
}, { attribute: "more" });
|
|
52
52
|
/** The name of the navigation for screen readers. */
|
|
53
|
-
label = this.useChange(
|
|
53
|
+
label = this.useChange("", () => this.drawTexts(), { attribute: "label" });
|
|
54
54
|
_refs = this.useRefs((ref) => ({
|
|
55
55
|
items: ref(".items"),
|
|
56
56
|
more: ref(".more"),
|
|
@@ -77,6 +77,9 @@ var JlTabBar = class extends JlElement {
|
|
|
77
77
|
templateCss() {
|
|
78
78
|
return css`${BASE_STYLES}${jl_tab_bar_default}`;
|
|
79
79
|
}
|
|
80
|
+
drawTexts() {
|
|
81
|
+
this._refs.nav.setAttribute("aria-label", this.label.get() || jlText("shortcuts"));
|
|
82
|
+
}
|
|
80
83
|
onConnect() {
|
|
81
84
|
this.on(this._refs.items, "click", (event) => this.onClick(event));
|
|
82
85
|
this.on(this._refs.more, "click", () => this.events.emit("more"));
|
|
@@ -82,7 +82,7 @@ export declare class JlTable<Row extends object = TableRow, Extra extends string
|
|
|
82
82
|
get(): string;
|
|
83
83
|
set(setter: string | ((prevState: string) => string)): void;
|
|
84
84
|
}>>;
|
|
85
|
-
/** What the table says when it has no rows. */
|
|
85
|
+
/** What the table says when it has no rows; jlib's own text when empty. */
|
|
86
86
|
readonly emptyText: Readonly<Readonly<{
|
|
87
87
|
get(): string;
|
|
88
88
|
set(setter: string | ((prevState: string) => string)): void;
|
|
@@ -116,6 +116,7 @@ export declare class JlTable<Row extends object = TableRow, Extra extends string
|
|
|
116
116
|
templateCss(): string;
|
|
117
117
|
onConnect(): void;
|
|
118
118
|
/** Draws on the next microtask: the inputs set while connecting give one drawing, not one each. */
|
|
119
|
+
protected drawTexts(): void;
|
|
119
120
|
private schedule;
|
|
120
121
|
private flush;
|
|
121
122
|
private sortBy;
|
|
@@ -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 { jsonOf, oneOf, textOf } from "../lib/attributes.js";
|
|
4
5
|
import { registerIcons } from "../lib/icons.js";
|
|
5
6
|
import { columnAlign, columnWidth, fieldOf, formatCell, nextSortDirection, openRows, rowKeyOf, rowToggles, selectionState, sortRows, toggleAll, toggleKey, withRowOpen } from "../lib/table.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 { JlBadge } from "../atoms/jl-badge.js";
|
|
@@ -156,8 +156,8 @@ var JlTable = class extends JlElement {
|
|
|
156
156
|
striped = this.useChange(false, (value) => this.reflect("striped", value), { attribute: "striped" });
|
|
157
157
|
/** A CSS height past which the rows scroll under the header: `320px`, `50vh`; a number is pixels. */
|
|
158
158
|
maxHeight = this.useChange("", (value) => this.renderMaxHeight(value), { attribute: "max-height" });
|
|
159
|
-
/** What the table says when it has no rows. */
|
|
160
|
-
emptyText = this.useChange(
|
|
159
|
+
/** What the table says when it has no rows; jlib's own text when empty. */
|
|
160
|
+
emptyText = this.useChange("", () => this.schedule("body"), { attribute: "empty-text" });
|
|
161
161
|
/** Shows placeholder rows while the data loads. */
|
|
162
162
|
loading = this.useChange(false, (value) => {
|
|
163
163
|
this.reflect("loading", value);
|
|
@@ -222,6 +222,9 @@ var JlTable = class extends JlElement {
|
|
|
222
222
|
this.on(this._refs.body, "click", (event) => this.pressRow(event));
|
|
223
223
|
}
|
|
224
224
|
/** Draws on the next microtask: the inputs set while connecting give one drawing, not one each. */
|
|
225
|
+
drawTexts() {
|
|
226
|
+
this.schedule("head", "body");
|
|
227
|
+
}
|
|
225
228
|
schedule(...parts) {
|
|
226
229
|
for (const part of parts) this._pending[part] = true;
|
|
227
230
|
if (this._pending.queued) return;
|
|
@@ -294,7 +297,7 @@ var JlTable = class extends JlElement {
|
|
|
294
297
|
const selectAll = this.selectable.get() ? /* @__PURE__ */ jsx("th", {
|
|
295
298
|
class: "select-cell",
|
|
296
299
|
scope: "col",
|
|
297
|
-
children: checkbox("
|
|
300
|
+
children: checkbox(jlText("selectAllRows"), null)
|
|
298
301
|
}) : null;
|
|
299
302
|
const details = this.isExpandable() ? /* @__PURE__ */ jsx("th", {
|
|
300
303
|
class: "expand-cell",
|
|
@@ -374,7 +377,7 @@ var JlTable = class extends JlElement {
|
|
|
374
377
|
const name = first === void 0 ? String(index + 1) : formatCell(fieldOf(row, first.key), first.format);
|
|
375
378
|
const select = this.selectable.get() ? /* @__PURE__ */ jsx("td", {
|
|
376
379
|
class: "select-cell",
|
|
377
|
-
children: checkbox(
|
|
380
|
+
children: checkbox(jlText("selectNamed", { name }), index)
|
|
378
381
|
}) : null;
|
|
379
382
|
const chevron = this.isExpandable() ? /* @__PURE__ */ jsx("td", {
|
|
380
383
|
class: "expand-cell",
|
|
@@ -449,7 +452,7 @@ var JlTable = class extends JlElement {
|
|
|
449
452
|
children: [/* @__PURE__ */ jsx(JlIcon, {
|
|
450
453
|
name: "inbox",
|
|
451
454
|
size: EMPTY_ICON_SIZE
|
|
452
|
-
}), /* @__PURE__ */ jsx("span", { children: this.emptyText.get() })]
|
|
455
|
+
}), /* @__PURE__ */ jsx("span", { children: this.emptyText.get() || jlText("noData") })]
|
|
453
456
|
})
|
|
454
457
|
})
|
|
455
458
|
});
|
|
@@ -31,6 +31,7 @@ export declare class JlToaster extends JlElement {
|
|
|
31
31
|
notify(options: ToastOptions): ToastHandle;
|
|
32
32
|
templateHtml(): Node;
|
|
33
33
|
templateCss(): string;
|
|
34
|
+
protected drawTexts(): void;
|
|
34
35
|
onConnect(): void;
|
|
35
36
|
onDisconnect(): void;
|
|
36
37
|
private toasts;
|
|
@@ -49,7 +50,7 @@ export declare class JlToaster extends JlElement {
|
|
|
49
50
|
* Returns a handle to close it early.
|
|
50
51
|
*/
|
|
51
52
|
export declare function toast(options: ToastOptions): ToastHandle;
|
|
52
|
-
/** A download's texts, in
|
|
53
|
+
/** A download's texts, in jlib's language, their placeholders left to fill: what `download()` says unless told otherwise. */
|
|
53
54
|
export declare const downloadTexts: () => DownloadTexts;
|
|
54
55
|
/**
|
|
55
56
|
* Downloads a file with its progress in a toast of the page's toaster: the time the server takes to prepare it,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { fillText } from "../lib/text.js";
|
|
2
|
+
import { jlTemplate, jlText } from "../lib/texts.js";
|
|
1
3
|
import { BASE_STYLES } from "../styles/shared.js";
|
|
2
4
|
import { JlElement } from "../base/jl-element.js";
|
|
3
5
|
import { clampedNumber, oneOf } from "../lib/attributes.js";
|
|
4
6
|
import { registerIcons } from "../lib/icons.js";
|
|
5
7
|
import { formatDuration } from "../lib/time.js";
|
|
6
|
-
import { fillText } from "../lib/text.js";
|
|
7
|
-
import { jlText } from "../lib/texts.js";
|
|
8
8
|
import { formatFileSize } from "../lib/files.js";
|
|
9
9
|
import { JlToast } from "../molecules/jl-toast.js";
|
|
10
10
|
import { answerError, dispositionFileName, readWithProgress, saveBlob, urlFileName } from "../lib/download.js";
|
|
@@ -63,7 +63,7 @@ var JlToaster = class extends JlElement {
|
|
|
63
63
|
parse: clampedNumber(DEFAULT_MAX, 1, MAX_LIMIT)
|
|
64
64
|
});
|
|
65
65
|
/** The region's name for screen readers. */
|
|
66
|
-
label = this.useChange(
|
|
66
|
+
label = this.useChange("", () => this.drawTexts(), { attribute: "label" });
|
|
67
67
|
_watched = /* @__PURE__ */ new WeakSet();
|
|
68
68
|
_refs = this.useRefs((ref) => ({
|
|
69
69
|
region: ref(".region"),
|
|
@@ -110,6 +110,9 @@ var JlToaster = class extends JlElement {
|
|
|
110
110
|
templateCss() {
|
|
111
111
|
return css`${BASE_STYLES}${jl_toaster_default}`;
|
|
112
112
|
}
|
|
113
|
+
drawTexts() {
|
|
114
|
+
this._refs.region.setAttribute("aria-label", this.label.get() || jlText("notifications"));
|
|
115
|
+
}
|
|
113
116
|
onConnect() {
|
|
114
117
|
this.renderStack();
|
|
115
118
|
this.on(this._refs.slot, "slotchange", () => this.renderStack());
|
|
@@ -185,14 +188,14 @@ var PERCENT = 100;
|
|
|
185
188
|
var FALLBACK_NAME = "download";
|
|
186
189
|
var CONTENT_LENGTH = "content-length";
|
|
187
190
|
var CONTENT_DISPOSITION = "content-disposition";
|
|
188
|
-
/** A download's texts, in
|
|
191
|
+
/** A download's texts, in jlib's language, their placeholders left to fill: what `download()` says unless told otherwise. */
|
|
189
192
|
var downloadTexts = () => ({
|
|
190
193
|
cancel: jlText("downloadCancel"),
|
|
191
|
-
failed:
|
|
192
|
-
preparing:
|
|
193
|
-
received:
|
|
194
|
-
receivedOf:
|
|
195
|
-
saved:
|
|
194
|
+
failed: jlTemplate("downloadFailed"),
|
|
195
|
+
preparing: jlTemplate("downloadPreparing"),
|
|
196
|
+
received: jlTemplate("downloadReceived"),
|
|
197
|
+
receivedOf: jlTemplate("downloadReceivedOf"),
|
|
198
|
+
saved: jlTemplate("downloadSaved")
|
|
196
199
|
});
|
|
197
200
|
/** The toast's text and bar for the bytes received: a share of the size when the server said it. */
|
|
198
201
|
function receiving(received, total, texts) {
|
|
@@ -41,22 +41,22 @@ export declare class JlTree extends JlElement {
|
|
|
41
41
|
get(): string;
|
|
42
42
|
set(setter: string | ((prevState: string) => string)): void;
|
|
43
43
|
}>>;
|
|
44
|
-
/** Said while a page loads. */
|
|
44
|
+
/** Said while a page loads; jlib's own text when empty. */
|
|
45
45
|
readonly loadingText: Readonly<Readonly<{
|
|
46
46
|
get(): string;
|
|
47
47
|
set(setter: string | ((prevState: string) => string)): void;
|
|
48
48
|
}>>;
|
|
49
|
-
/** The button that loads a level's next page
|
|
49
|
+
/** The button that loads a level's next page, `{count}` being how many items are left; jlib's own when empty. */
|
|
50
50
|
readonly moreText: Readonly<Readonly<{
|
|
51
51
|
get(): string;
|
|
52
52
|
set(setter: string | ((prevState: string) => string)): void;
|
|
53
53
|
}>>;
|
|
54
|
-
/** Said where a page could not be loaded. */
|
|
54
|
+
/** Said where a page could not be loaded; jlib's own text when empty. */
|
|
55
55
|
readonly errorText: Readonly<Readonly<{
|
|
56
56
|
get(): string;
|
|
57
57
|
set(setter: string | ((prevState: string) => string)): void;
|
|
58
58
|
}>>;
|
|
59
|
-
/** The action that loads it again. */
|
|
59
|
+
/** The action that loads it again; jlib's own text when empty. */
|
|
60
60
|
readonly retryLabel: Readonly<Readonly<{
|
|
61
61
|
get(): string;
|
|
62
62
|
set(setter: string | ((prevState: string) => string)): void;
|
|
@@ -109,6 +109,8 @@ export declare class JlTree extends JlElement {
|
|
|
109
109
|
private openFolder;
|
|
110
110
|
private levelEnd;
|
|
111
111
|
private hasLevelEndRow;
|
|
112
|
+
protected drawTexts(): void;
|
|
113
|
+
private errorLabel;
|
|
112
114
|
private renderItems;
|
|
113
115
|
private itemNode;
|
|
114
116
|
/** The row that ends a level, if it has one. */
|