@syware/jlib 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -8
- package/dist/all.js +2 -2
- package/dist/atoms/jl-avatar.d.ts +2 -0
- package/dist/atoms/jl-avatar.js +11 -6
- package/dist/atoms/jl-button.d.ts +6 -0
- package/dist/atoms/jl-button.js +22 -8
- package/dist/atoms/jl-chip.js +2 -1
- package/dist/atoms/jl-input.js +3 -3
- package/dist/atoms/jl-link.d.ts +1 -0
- package/dist/atoms/jl-link.js +5 -2
- package/dist/atoms/jl-progress-ring.d.ts +2 -0
- package/dist/atoms/jl-progress-ring.js +6 -2
- package/dist/atoms/jl-progress.d.ts +1 -0
- package/dist/atoms/jl-progress.js +5 -2
- package/dist/atoms/jl-rating.d.ts +2 -0
- package/dist/atoms/jl-rating.js +11 -6
- package/dist/atoms/jl-select.css.js +1 -1
- package/dist/atoms/jl-select.d.ts +4 -0
- package/dist/atoms/jl-select.js +18 -2
- package/dist/atoms/jl-switch.css.js +1 -1
- package/dist/atoms/jl-textarea.js +2 -2
- package/dist/base/jl-form-control.d.ts +3 -2
- package/dist/base/jl-form-control.js +14 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/lib/dom.d.ts +5 -0
- package/dist/lib/dom.js +9 -1
- package/dist/lib/download.js +10 -2
- package/dist/lib/floating.d.ts +5 -0
- package/dist/lib/floating.js +21 -2
- package/dist/lib/fuzzy.d.ts +3 -2
- package/dist/lib/fuzzy.js +15 -4
- package/dist/lib/modal.d.ts +24 -0
- package/dist/lib/modal.js +52 -0
- package/dist/lib/numeric.d.ts +5 -0
- package/dist/lib/numeric.js +11 -1
- package/dist/lib/option-filter.d.ts +2 -0
- package/dist/lib/option-filter.js +1 -1
- package/dist/lib/press.d.ts +11 -0
- package/dist/lib/press.js +31 -0
- package/dist/lib/table.js +12 -4
- package/dist/lib/texts-de.d.ts +12 -0
- package/dist/lib/texts-de.js +12 -0
- package/dist/lib/texts-fr.d.ts +12 -0
- package/dist/lib/texts-fr.js +12 -0
- package/dist/lib/texts.d.ts +12 -0
- package/dist/lib/texts.js +12 -0
- package/dist/molecules/jl-accordion-item.js +2 -1
- package/dist/molecules/jl-calendar.d.ts +4 -0
- package/dist/molecules/jl-calendar.js +16 -5
- package/dist/molecules/jl-chip-group.css.js +1 -1
- package/dist/molecules/jl-chip-group.js +3 -3
- package/dist/molecules/jl-code-block.css.js +1 -1
- package/dist/molecules/jl-combobox.d.ts +4 -0
- package/dist/molecules/jl-combobox.js +23 -11
- package/dist/molecules/jl-copy-button.css.js +1 -1
- package/dist/molecules/jl-copy-button.d.ts +11 -4
- package/dist/molecules/jl-copy-button.js +48 -22
- package/dist/molecules/jl-date-picker.d.ts +4 -0
- package/dist/molecules/jl-date-picker.js +18 -12
- package/dist/molecules/jl-field.d.ts +5 -1
- package/dist/molecules/jl-field.js +24 -5
- package/dist/molecules/jl-file-drop.css.js +1 -1
- package/dist/molecules/jl-file-drop.d.ts +4 -0
- package/dist/molecules/jl-file-drop.js +16 -8
- package/dist/molecules/jl-input-list.js +13 -6
- package/dist/molecules/jl-load-state.d.ts +8 -0
- package/dist/molecules/jl-load-state.js +33 -7
- package/dist/molecules/jl-menu.d.ts +21 -1
- package/dist/molecules/jl-menu.js +58 -6
- package/dist/molecules/jl-number-input.d.ts +2 -0
- package/dist/molecules/jl-number-input.js +12 -8
- package/dist/molecules/jl-radio-group.js +3 -2
- package/dist/molecules/jl-search.js +2 -2
- package/dist/molecules/jl-segmented.js +2 -2
- package/dist/molecules/jl-tabs.js +2 -2
- package/dist/molecules/jl-tag-input.css.js +1 -1
- package/dist/molecules/jl-tag-input.d.ts +4 -0
- package/dist/molecules/jl-tag-input.js +17 -9
- package/dist/molecules/jl-toast.js +8 -4
- package/dist/molecules/jl-tooltip.js +8 -2
- package/dist/organisms/jl-command-palette.css.js +1 -1
- package/dist/organisms/jl-command-palette.d.ts +2 -0
- package/dist/organisms/jl-command-palette.js +9 -3
- package/dist/organisms/jl-dialog.d.ts +3 -0
- package/dist/organisms/jl-dialog.js +13 -3
- package/dist/organisms/jl-drawer.d.ts +3 -0
- package/dist/organisms/jl-drawer.js +13 -3
- package/dist/organisms/jl-flow.d.ts +2 -0
- package/dist/organisms/jl-flow.js +29 -9
- package/dist/organisms/jl-side-nav.css.js +1 -1
- package/dist/organisms/jl-side-nav.d.ts +43 -9
- package/dist/organisms/jl-side-nav.js +164 -24
- package/dist/organisms/jl-table.css.js +1 -1
- package/dist/organisms/jl-table.d.ts +16 -3
- package/dist/organisms/jl-table.js +56 -18
- package/dist/organisms/jl-toaster.d.ts +13 -2
- package/dist/organisms/jl-toaster.js +47 -4
- package/dist/organisms/jl-tree.css.js +1 -1
- package/dist/organisms/jl-tree.d.ts +23 -4
- package/dist/organisms/jl-tree.js +74 -18
- package/dist/styles/base.css.js +1 -1
- package/dist/styles/control.css.js +1 -1
- package/dist/styles/tokens.css.js +1 -1
- package/dist/templates/jl-app-shell.css.js +1 -1
- package/dist/templates/jl-app-shell.js +2 -0
- package/dist/tokens.css +8 -3
- package/dist/types/jl-load-state.types.d.ts +7 -0
- package/dist/types/jl-side-nav.types.d.ts +5 -0
- package/dist/types/jl-table.types.d.ts +12 -0
- package/dist/types/jl-tree.types.d.ts +17 -0
- package/dist/types/press.types.d.ts +6 -0
- package/package.json +6 -4
|
@@ -115,20 +115,24 @@ var JlToast = class extends JlElement {
|
|
|
115
115
|
if (this.hidden || this.hasAttribute("leaving")) return;
|
|
116
116
|
this.stopTimer();
|
|
117
117
|
this.reflect("leaving", true);
|
|
118
|
-
const done = () => this.finishLeaving();
|
|
119
118
|
if (!this.isConnected || prefersReducedMotion()) {
|
|
120
|
-
|
|
119
|
+
this.finishLeaving();
|
|
121
120
|
return;
|
|
122
121
|
}
|
|
123
122
|
const offset = this.enterOffset();
|
|
124
|
-
this._refs.toast.animate([{ opacity: 1 }, {
|
|
123
|
+
const leaving = this._refs.toast.animate([{ opacity: 1 }, {
|
|
125
124
|
opacity: 0,
|
|
126
125
|
transform: `translateY(${offset}) scale(0.97)`
|
|
127
126
|
}], {
|
|
128
127
|
duration: LEAVE_MS,
|
|
129
128
|
easing: EASE,
|
|
130
129
|
fill: "forwards"
|
|
131
|
-
})
|
|
130
|
+
});
|
|
131
|
+
const done = () => {
|
|
132
|
+
this.finishLeaving();
|
|
133
|
+
leaving.cancel();
|
|
134
|
+
};
|
|
135
|
+
leaving.finished.then(done, done);
|
|
132
136
|
}
|
|
133
137
|
/** Shows a dismissed toast again, with its time from the start. */
|
|
134
138
|
show() {
|
|
@@ -255,8 +255,14 @@ var JlTooltip = class extends JlElement {
|
|
|
255
255
|
if (!event.composedPath().includes(this)) this.close();
|
|
256
256
|
}, { signal: following.signal });
|
|
257
257
|
document.addEventListener("keydown", (event) => {
|
|
258
|
-
if (event.key
|
|
259
|
-
|
|
258
|
+
if (event.key !== "Escape") return;
|
|
259
|
+
event.preventDefault();
|
|
260
|
+
event.stopPropagation();
|
|
261
|
+
this.close();
|
|
262
|
+
}, {
|
|
263
|
+
capture: true,
|
|
264
|
+
signal: following.signal
|
|
265
|
+
});
|
|
260
266
|
this.place();
|
|
261
267
|
}
|
|
262
268
|
reposition() {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/organisms/jl-command-palette.css?inline
|
|
2
|
-
var jl_command_palette_default = ":host{display:contents}dialog{border:1px solid var(--jl-line);border-radius:var(--jl-radius-lg);background:var(--jl-surface);width:min(620px,100vw - 24px);max-width:none;max-height:min(520px,100dvh - 24vh);color:var(--jl-text);font-size:var(--jl-font-md);box-shadow:var(--jl-shadow-lg);flex-direction:column;margin:12vh auto auto;padding:0;overflow:hidden}dialog[open]{animation:drop var(--jl-fast) var(--jl-ease);display:flex}dialog::backdrop{background:var(--jl-scrim);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.search{border-bottom:1px solid var(--jl-line);flex:none;align-items:center;gap:10px;height:52px;padding:0 14px 0 16px;display:flex}.search-icon,.search-spinner{color:var(--jl-faint);flex:none}input{min-width:0;height:100%;font-size:max(15px, var(--jl-control-font));background:0 0;border:none;outline:none;flex:1;padding:0}input::placeholder{color:var(--jl-
|
|
2
|
+
var jl_command_palette_default = ":host{display:contents}dialog{border:1px solid var(--jl-line);border-radius:var(--jl-radius-lg);background:var(--jl-surface);width:min(620px,100vw - 24px);max-width:none;max-height:min(520px,100dvh - 24vh);color:var(--jl-text);font-size:var(--jl-font-md);box-shadow:var(--jl-shadow-lg);flex-direction:column;margin:12vh auto auto;padding:0;overflow:hidden}dialog[open]{animation:drop var(--jl-fast) var(--jl-ease);display:flex}dialog::backdrop{background:var(--jl-scrim);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.search{border-bottom:1px solid var(--jl-line);flex:none;align-items:center;gap:10px;height:52px;padding:0 14px 0 16px;display:flex}.search-icon,.search-spinner{color:var(--jl-faint);flex:none}input{min-width:0;height:100%;font-size:max(15px, var(--jl-control-font));background:0 0;border:none;outline:none;flex:1;padding:0}input::placeholder{color:var(--jl-muted)}input:focus-visible{box-shadow:none}kbd{border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-xs);background:var(--jl-surface);min-width:20px;height:20px;color:var(--jl-muted);border-bottom-width:2px;justify-content:center;align-items:center;padding:0 5px;font-size:11px;font-weight:500;line-height:1;display:inline-flex}.results{overscroll-behavior:contain;flex:1;min-height:0;padding:6px;scroll-padding:6px;overflow-y:auto}[role=group]+[role=group]{border-top:1px solid var(--jl-line-soft);margin-top:4px;padding-top:4px}.group-label{color:var(--jl-muted);font-size:var(--jl-font-xs);padding:8px 10px 4px;font-weight:600}.option{border-radius:var(--jl-radius-sm);min-height:38px;color:var(--jl-text-2);cursor:pointer;align-items:center;gap:10px;padding:0 10px;display:flex}.option[aria-selected=true]{background:var(--jl-accent-soft);color:var(--jl-text)}.option-icon{width:16px;color:var(--jl-muted);flex:none}.option[aria-selected=true] .option-icon{color:var(--jl-accent)}.option-label{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.option-description{max-width:40%;color:var(--jl-muted);font-size:var(--jl-font-xs);text-overflow:ellipsis;white-space:nowrap;flex:none;overflow:hidden}mark{color:var(--jl-accent);background:0 0;font-weight:700}.keys{flex:none;gap:3px;display:inline-flex}.empty{color:var(--jl-muted);text-align:center;padding:36px 16px}.results:empty,.results:not(:empty)+.empty{display:none}footer{border-top:1px solid var(--jl-line);background:var(--jl-surface-2);color:var(--jl-muted);font-size:var(--jl-font-xs);flex-wrap:wrap;flex:none;align-items:center;gap:6px 16px;padding:8px 16px;display:flex}.hint,.hotkey-keys{align-items:center;gap:4px;display:inline-flex}.hotkey-hint{margin-left:auto}@media (width<520px){dialog{max-height:calc(100dvh - 24px);margin-top:12px}.hotkey-hint{display:none}}@keyframes drop{0%{opacity:0;transform:translateY(-6px)scale(.98)}}";
|
|
3
3
|
export { jl_command_palette_default as default };
|
|
@@ -63,6 +63,8 @@ export declare class JlCommandPalette<Id extends string = string> extends JlElem
|
|
|
63
63
|
templateCss(): string;
|
|
64
64
|
protected drawTexts(): void;
|
|
65
65
|
onConnect(): void;
|
|
66
|
+
/** A palette taken out of the page while it shows is no longer the modal on top. */
|
|
67
|
+
onDisconnect(): void;
|
|
66
68
|
private toggleOnHotkey;
|
|
67
69
|
private navigate;
|
|
68
70
|
private indexOf;
|
|
@@ -8,6 +8,7 @@ import { setOrRemove } from "../lib/dom.js";
|
|
|
8
8
|
import { JlSpinner } from "../atoms/jl-spinner.js";
|
|
9
9
|
import { hotkeyLabels, isApplePlatform, matchesHotkey, parseHotkey } from "../lib/hotkey.js";
|
|
10
10
|
import { highlightSegments } from "../lib/fuzzy.js";
|
|
11
|
+
import { modalClosed, modalOpened, onBackdropPress } from "../lib/modal.js";
|
|
11
12
|
import { groupMatches, matchCommands } from "../lib/palette.js";
|
|
12
13
|
import jl_command_palette_default from "./jl-command-palette.css.js";
|
|
13
14
|
import { css } from "@jadis/core";
|
|
@@ -187,15 +188,18 @@ var JlCommandPalette = class extends JlElement {
|
|
|
187
188
|
if (index !== null) this.choose(index);
|
|
188
189
|
});
|
|
189
190
|
this.on(dialog, "close", () => {
|
|
191
|
+
modalClosed(dialog);
|
|
190
192
|
this.reflect("open", false);
|
|
191
193
|
this.open.set(false);
|
|
192
194
|
this.events.emit("close");
|
|
193
195
|
});
|
|
194
|
-
|
|
195
|
-
if (event.target === dialog) this.close();
|
|
196
|
-
});
|
|
196
|
+
onBackdropPress(dialog, () => this.close(), this.killSignal);
|
|
197
197
|
this.renderOpen(this.open.get());
|
|
198
198
|
}
|
|
199
|
+
/** A palette taken out of the page while it shows is no longer the modal on top. */
|
|
200
|
+
onDisconnect() {
|
|
201
|
+
modalClosed(this._refs.dialog);
|
|
202
|
+
}
|
|
199
203
|
toggleOnHotkey(event) {
|
|
200
204
|
const hotkey = this.hotkey.get();
|
|
201
205
|
if (hotkey === "" || hotkey === NO_HOTKEY || event.defaultPrevented) return;
|
|
@@ -237,12 +241,14 @@ var JlCommandPalette = class extends JlElement {
|
|
|
237
241
|
if (!open) {
|
|
238
242
|
this.reflect("open", false);
|
|
239
243
|
dialog.close();
|
|
244
|
+
modalClosed(dialog);
|
|
240
245
|
return;
|
|
241
246
|
}
|
|
242
247
|
this._refs.input.value = "";
|
|
243
248
|
this.renderResults();
|
|
244
249
|
this.search("");
|
|
245
250
|
dialog.showModal();
|
|
251
|
+
modalOpened(dialog);
|
|
246
252
|
this._refs.input.focus();
|
|
247
253
|
this.reflect("open", true);
|
|
248
254
|
this.events.emit("open");
|
|
@@ -39,6 +39,9 @@ export declare class JlDialog extends JlElement {
|
|
|
39
39
|
templateCss(): string;
|
|
40
40
|
protected drawTexts(): void;
|
|
41
41
|
onConnect(): void;
|
|
42
|
+
/** A dialog taken out of the page while it shows is no longer the modal on top. */
|
|
43
|
+
onDisconnect(): void;
|
|
44
|
+
private closeUnlessPersistent;
|
|
42
45
|
private renderFooter;
|
|
43
46
|
private renderOpen;
|
|
44
47
|
}
|
|
@@ -4,6 +4,7 @@ import { JlElement } from "../base/jl-element.js";
|
|
|
4
4
|
import { oneOf } from "../lib/attributes.js";
|
|
5
5
|
import { registerIcons } from "../lib/icons.js";
|
|
6
6
|
import { JlButton } from "../atoms/jl-button.js";
|
|
7
|
+
import { modalClosed, modalOpened, onBackdropPress, setPersistent } from "../lib/modal.js";
|
|
7
8
|
import jl_dialog_default from "./jl-dialog.css.js";
|
|
8
9
|
import { css } from "@jadis/core";
|
|
9
10
|
import { X } from "lucide";
|
|
@@ -37,6 +38,7 @@ var JlDialog = class extends JlElement {
|
|
|
37
38
|
/** Keeps the dialog open on Escape and on a click outside: only its own buttons close it. */
|
|
38
39
|
persistent = this.useChange(false, (value) => {
|
|
39
40
|
this._refs.close.hidden = value;
|
|
41
|
+
setPersistent(this._refs.dialog, value);
|
|
40
42
|
}, { attribute: "persistent" });
|
|
41
43
|
_refs = this.useRefs((ref) => ({
|
|
42
44
|
actions: ref("slot[name=\"actions\"]"),
|
|
@@ -87,18 +89,24 @@ var JlDialog = class extends JlElement {
|
|
|
87
89
|
const dialog = this._refs.dialog;
|
|
88
90
|
this._refs.close.events.register("press", () => this.close());
|
|
89
91
|
this.on(dialog, "close", () => {
|
|
92
|
+
modalClosed(dialog);
|
|
90
93
|
this.open.set(false);
|
|
91
94
|
this.events.emit("close");
|
|
92
95
|
});
|
|
93
96
|
this.on(dialog, "cancel", (event) => {
|
|
94
97
|
if (this.persistent.get()) event.preventDefault();
|
|
95
98
|
});
|
|
96
|
-
|
|
97
|
-
if (event.target === dialog && !this.persistent.get()) this.close();
|
|
98
|
-
});
|
|
99
|
+
onBackdropPress(dialog, () => this.closeUnlessPersistent(), this.killSignal);
|
|
99
100
|
this.renderFooter();
|
|
100
101
|
this.on(this._refs.actions, "slotchange", () => this.renderFooter());
|
|
101
102
|
}
|
|
103
|
+
/** A dialog taken out of the page while it shows is no longer the modal on top. */
|
|
104
|
+
onDisconnect() {
|
|
105
|
+
modalClosed(this._refs.dialog);
|
|
106
|
+
}
|
|
107
|
+
closeUnlessPersistent() {
|
|
108
|
+
if (!this.persistent.get()) this.close();
|
|
109
|
+
}
|
|
102
110
|
renderFooter() {
|
|
103
111
|
this._refs.footer.hidden = this._refs.actions.assignedElements().length === 0;
|
|
104
112
|
}
|
|
@@ -109,10 +117,12 @@ var JlDialog = class extends JlElement {
|
|
|
109
117
|
if (open) {
|
|
110
118
|
this.renderFooter();
|
|
111
119
|
dialog.showModal();
|
|
120
|
+
modalOpened(dialog);
|
|
112
121
|
this.events.emit("open");
|
|
113
122
|
return;
|
|
114
123
|
}
|
|
115
124
|
dialog.close();
|
|
125
|
+
modalClosed(dialog);
|
|
116
126
|
}
|
|
117
127
|
};
|
|
118
128
|
JlDialog.register();
|
|
@@ -46,6 +46,9 @@ export declare class JlDrawer extends JlElement {
|
|
|
46
46
|
templateCss(): string;
|
|
47
47
|
protected drawTexts(): void;
|
|
48
48
|
onConnect(): void;
|
|
49
|
+
/** A drawer taken out of the page while it shows is no longer the modal on top. */
|
|
50
|
+
onDisconnect(): void;
|
|
51
|
+
private closeUnlessPersistent;
|
|
49
52
|
private renderFooter;
|
|
50
53
|
private renderOpen;
|
|
51
54
|
}
|
|
@@ -4,6 +4,7 @@ import { JlElement } from "../base/jl-element.js";
|
|
|
4
4
|
import { oneOf } from "../lib/attributes.js";
|
|
5
5
|
import { registerIcons } from "../lib/icons.js";
|
|
6
6
|
import { JlButton } from "../atoms/jl-button.js";
|
|
7
|
+
import { modalClosed, modalOpened, onBackdropPress, setPersistent } from "../lib/modal.js";
|
|
7
8
|
import jl_drawer_default from "./jl-drawer.css.js";
|
|
8
9
|
import { css } from "@jadis/core";
|
|
9
10
|
import { X } from "lucide";
|
|
@@ -47,6 +48,7 @@ var JlDrawer = class extends JlElement {
|
|
|
47
48
|
/** Keeps the drawer open on Escape and on a click outside: only its own buttons close it. */
|
|
48
49
|
persistent = this.useChange(false, (value) => {
|
|
49
50
|
this._refs.close.hidden = value;
|
|
51
|
+
setPersistent(this._refs.dialog, value);
|
|
50
52
|
}, { attribute: "persistent" });
|
|
51
53
|
_refs = this.useRefs((ref) => ({
|
|
52
54
|
close: ref(".close"),
|
|
@@ -108,6 +110,7 @@ var JlDrawer = class extends JlElement {
|
|
|
108
110
|
const dialog = this._refs.dialog;
|
|
109
111
|
this._refs.close.events.register("press", () => this.close());
|
|
110
112
|
this.on(dialog, "close", () => {
|
|
113
|
+
modalClosed(dialog);
|
|
111
114
|
this.reflect("open", false);
|
|
112
115
|
this.open.set(false);
|
|
113
116
|
this.events.emit("close");
|
|
@@ -115,13 +118,18 @@ var JlDrawer = class extends JlElement {
|
|
|
115
118
|
this.on(dialog, "cancel", (event) => {
|
|
116
119
|
if (this.persistent.get()) event.preventDefault();
|
|
117
120
|
});
|
|
118
|
-
|
|
119
|
-
if (event.target === dialog && !this.persistent.get()) this.close();
|
|
120
|
-
});
|
|
121
|
+
onBackdropPress(dialog, () => this.closeUnlessPersistent(), this.killSignal);
|
|
121
122
|
this.renderFooter();
|
|
122
123
|
this.on(this._refs.footerSlot, "slotchange", () => this.renderFooter());
|
|
123
124
|
this.renderOpen(this.open.get());
|
|
124
125
|
}
|
|
126
|
+
/** A drawer taken out of the page while it shows is no longer the modal on top. */
|
|
127
|
+
onDisconnect() {
|
|
128
|
+
modalClosed(this._refs.dialog);
|
|
129
|
+
}
|
|
130
|
+
closeUnlessPersistent() {
|
|
131
|
+
if (!this.persistent.get()) this.close();
|
|
132
|
+
}
|
|
125
133
|
renderFooter() {
|
|
126
134
|
this._refs.footer.hidden = this._refs.footerSlot.assignedElements().length === 0;
|
|
127
135
|
}
|
|
@@ -130,12 +138,14 @@ var JlDrawer = class extends JlElement {
|
|
|
130
138
|
if (open === dialog.open || !this.isConnected) return;
|
|
131
139
|
if (open) {
|
|
132
140
|
dialog.showModal();
|
|
141
|
+
modalOpened(dialog);
|
|
133
142
|
this.reflect("open", true);
|
|
134
143
|
this.events.emit("open");
|
|
135
144
|
return;
|
|
136
145
|
}
|
|
137
146
|
this.reflect("open", false);
|
|
138
147
|
dialog.close();
|
|
148
|
+
modalClosed(dialog);
|
|
139
149
|
}
|
|
140
150
|
};
|
|
141
151
|
JlDrawer.register();
|
|
@@ -59,6 +59,8 @@ export declare class JlFlow extends JlElement {
|
|
|
59
59
|
templateHtml(): Node;
|
|
60
60
|
templateCss(): string;
|
|
61
61
|
protected drawTexts(): void;
|
|
62
|
+
/** What a drawn node says in jlib's language: how it did in the run, and what each of its + buttons adds after. */
|
|
63
|
+
private drawNodeTexts;
|
|
62
64
|
private renderLabel;
|
|
63
65
|
onConnect(): void;
|
|
64
66
|
private show;
|
|
@@ -64,14 +64,16 @@ var STATUS_ICONS = {
|
|
|
64
64
|
running: "loader-circle",
|
|
65
65
|
waiting: "hourglass"
|
|
66
66
|
};
|
|
67
|
-
var
|
|
68
|
-
done: "
|
|
69
|
-
failed: "
|
|
70
|
-
running: "
|
|
71
|
-
waiting: "
|
|
67
|
+
var STATUS_TEXTS = {
|
|
68
|
+
done: "flowDone",
|
|
69
|
+
failed: "flowFailed",
|
|
70
|
+
running: "flowRunning",
|
|
71
|
+
waiting: "flowWaiting"
|
|
72
72
|
};
|
|
73
|
+
/** How a node did in the run, in jlib's language. */
|
|
74
|
+
var statusText = (status) => jlText(STATUS_TEXTS[status]);
|
|
73
75
|
/** What screen readers hear after a node's label: how it did in the run, and what to fix. */
|
|
74
|
-
var noteOf = (node) => [node.status ?
|
|
76
|
+
var noteOf = (node) => [node.status ? statusText(node.status) : "", node.problem ?? ""].filter((part) => part !== "").join(". ");
|
|
75
77
|
var markOf = (element, name) => element?.closest(`[${name}]`)?.getAttribute(name) ?? void 0;
|
|
76
78
|
var isControl = (event) => event.composedPath().some((element) => element instanceof Element && element.hasAttribute("data-control"));
|
|
77
79
|
function targetOf(event) {
|
|
@@ -86,7 +88,10 @@ function targetOf(event) {
|
|
|
86
88
|
}
|
|
87
89
|
var distance = (a, b) => Math.hypot(a.x - b.x, a.y - b.y);
|
|
88
90
|
var newId = (prefix) => `${prefix}_${crypto.randomUUID().replaceAll("-", "").slice(0, ID_LENGTH)}`;
|
|
89
|
-
var addLabel = (node, port) => port.label ?
|
|
91
|
+
var addLabel = (node, port) => port.label ? jlText("addAfterPort", {
|
|
92
|
+
name: node.label,
|
|
93
|
+
port: port.label
|
|
94
|
+
}) : jlText("addAfter", { name: node.label });
|
|
90
95
|
/** Whether a node's new version differs in its position alone, as a drag or the arrows leave it: it only moves. */
|
|
91
96
|
function movedOnly(before, after) {
|
|
92
97
|
return [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])].every((key) => key === "position" || Reflect.get(before, key) === Reflect.get(after, key));
|
|
@@ -285,9 +290,24 @@ var JlFlow = class extends JlElement {
|
|
|
285
290
|
button.title = text;
|
|
286
291
|
button.setAttribute("aria-label", text);
|
|
287
292
|
}
|
|
288
|
-
for (const { element } of this._nodes.values())
|
|
293
|
+
for (const { element, node } of this._nodes.values()) {
|
|
294
|
+
element.setAttribute("aria-roledescription", jlText("node"));
|
|
295
|
+
this.drawNodeTexts(element, node);
|
|
296
|
+
}
|
|
289
297
|
for (const port of this._refs.nodes.querySelectorAll(".port")) port.title = jlText("dragToConnect");
|
|
290
298
|
}
|
|
299
|
+
/** What a drawn node says in jlib's language: how it did in the run, and what each of its + buttons adds after. */
|
|
300
|
+
drawNodeTexts(element, node) {
|
|
301
|
+
if (node === void 0) return;
|
|
302
|
+
setOrRemove(element, "aria-description", noteOf(node));
|
|
303
|
+
const status = element.querySelector(".status");
|
|
304
|
+
if (status !== null && node.status) status.title = statusText(node.status);
|
|
305
|
+
const ports = portsOf(node);
|
|
306
|
+
for (const add of element.querySelectorAll(".add")) {
|
|
307
|
+
const port = ports.find((candidate) => candidate.id === add.dataset.add);
|
|
308
|
+
add.setAttribute("aria-label", port === void 0 ? "" : addLabel(node, port));
|
|
309
|
+
}
|
|
310
|
+
}
|
|
291
311
|
renderLabel() {
|
|
292
312
|
this._refs.viewport.setAttribute("aria-label", this.label.get() || jlText("flow"));
|
|
293
313
|
}
|
|
@@ -692,7 +712,7 @@ var JlFlow = class extends JlElement {
|
|
|
692
712
|
}) : null,
|
|
693
713
|
node.status ? /* @__PURE__ */ jsx("span", {
|
|
694
714
|
class: "status",
|
|
695
|
-
title:
|
|
715
|
+
title: statusText(node.status),
|
|
696
716
|
attrs: { part: "status" },
|
|
697
717
|
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
698
718
|
name: STATUS_ICONS[node.status],
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/organisms/jl-side-nav.css?inline
|
|
2
|
-
var jl_side_nav_default = ":host{width:var(--width,248px);height:100%;min-height:0;transition:width var(--jl-slow) var(--jl-ease);display:block}:host([rail]){width:var(--rail-width,60px)}nav{height:100%;color:var(--jl-text-2);font-size:var(--jl-font-md);flex-direction:column;gap:8px;padding:12px 8px;display:flex;overflow:hidden}.bottom{flex-direction:column;flex:none;gap:8px;margin-top:auto;display:flex}::slotted([slot=header]){flex:none}.fold
|
|
2
|
+
var jl_side_nav_default = ":host{width:var(--width,248px);height:100%;min-height:0;transition:width var(--jl-slow) var(--jl-ease);display:block;position:relative}:host([rail]){width:var(--rail-width,60px)}nav{height:100%;color:var(--jl-text-2);font-size:var(--jl-font-md);flex-direction:column;gap:8px;padding:12px 8px;display:flex;position:relative;overflow:hidden}.bottom{flex-direction:column;flex:none;gap:8px;margin-top:auto;display:flex}::slotted([slot=header]){flex:none}.fold{z-index:1;cursor:w-resize;touch-action:none;background:0 0;border:none;width:16px;padding:0;position:absolute;inset:0 -14px 0 auto}:host([rail]) .fold{cursor:e-resize}.fold:after{background:var(--jl-accent);content:\"\";opacity:0;width:2px;transition:opacity var(--jl-fast) var(--jl-ease);position:absolute;inset:0 13px 0 auto}.grip{border-radius:var(--jl-radius-pill);background:var(--jl-line-strong);width:4px;height:28px;transition:height var(--jl-fast) var(--jl-ease), background var(--jl-fast) var(--jl-ease);position:absolute;top:50%;right:12px;translate:0 -50%}.fold:hover:after,.fold:focus-visible:after{opacity:1}.fold:hover .grip,.fold:focus-visible .grip{background:var(--jl-accent);height:44px}.fold:focus-visible{box-shadow:none}.fold-button{align-self:flex-start}.fold-button::part(base){color:var(--jl-muted)}.fold-button::part(base):hover{background:var(--jl-surface-3);color:var(--jl-text)}:host([rail]) .fold-button{align-self:center}.knob{z-index:1;border:1px solid var(--jl-line-strong);background:var(--jl-surface);width:24px;height:24px;color:var(--jl-muted);cursor:pointer;transition:border-color var(--jl-fast) var(--jl-ease), color var(--jl-fast) var(--jl-ease);border-radius:50%;justify-content:center;align-items:center;padding:0;display:inline-flex;position:absolute;top:4px;right:-12px}.knob:hover{border-color:var(--jl-muted);color:var(--jl-text)}.knob-icon{transition:transform var(--jl-slow) var(--jl-ease);transform:rotate(180deg)}:host([rail]) .knob-icon{transform:none}:host([in-drawer]) :is(.fold,.fold-button,.knob),:host(:not([collapsible=knob])) .knob,:host(:not([collapsible=handle])) .fold,:host(:not([collapsible=button])) .fold-button{display:none}@media (forced-colors:active){.grip{background:buttontext}.fold:after,.fold:hover .grip,.fold:focus-visible .grip{background:highlight}}.sections{scrollbar-gutter:stable;flex:1;align-content:start;gap:14px;min-height:0;display:grid;overflow-y:auto}.section{gap:2px;display:grid}.sections,.section,.items,.children{grid-template-columns:minmax(0,1fr)}.section-label{color:var(--jl-muted);letter-spacing:.08em;text-overflow:ellipsis;text-transform:uppercase;white-space:nowrap;padding:4px 10px 6px;font-size:11px;font-weight:650;overflow:hidden}.items,.children{gap:2px;margin:0;padding:0;list-style:none;display:grid}.children{margin-top:2px}.gliding .children{interpolate-size:allow-keywords;transition:height var(--jl-slow) var(--jl-ease), opacity var(--jl-slow) var(--jl-ease), margin-top var(--jl-slow) var(--jl-ease), display var(--jl-slow) allow-discrete;overflow:clip}.gliding .children[hidden]{opacity:0;height:0;margin-top:0}@starting-style{.gliding .children:not([hidden]){opacity:0;height:0;margin-top:0}}.entry{position:relative}.item{border-radius:var(--jl-radius-sm);width:100%;min-height:34px;color:inherit;font:inherit;text-align:start;white-space:nowrap;cursor:pointer;transition:background var(--jl-fast) var(--jl-ease), color var(--jl-fast) var(--jl-ease);background:0 0;border:none;align-items:center;gap:10px;padding:0 10px;font-weight:550;text-decoration:none;display:flex}.item[data-depth=\"1\"]{padding-left:36px}.item[data-depth=\"2\"]{padding-left:50px}.item[data-depth=\"3\"]{padding-left:64px}.item:hover{background:var(--jl-surface-3);color:var(--jl-text)}.item[aria-current=page]{background:var(--jl-accent-soft);color:var(--jl-accent)}.item.holds-active{color:var(--jl-text)}.item-icon{color:var(--jl-faint)}.item:hover .item-icon,.item.holds-active .item-icon{color:var(--jl-text-2)}.item[aria-current=page] .item-icon{color:var(--jl-accent)}.item-initial{border-radius:var(--jl-radius-xs);background:var(--jl-surface-3);width:20px;height:20px;color:var(--jl-text-2);flex:none;justify-content:center;align-items:center;font-size:11px;font-weight:700;display:none}.item:not([data-depth=\"0\"]) .item-initial{display:none}.item-label{text-overflow:ellipsis;flex:1;min-width:0;overflow:hidden}.item-badge{border-radius:var(--jl-radius-pill);background:var(--jl-surface-3);min-width:20px;color:var(--jl-text-2);text-align:center;flex:none;padding:2px 6px;font-size:11px;font-weight:650;line-height:14px}.item[aria-current=page] .item-badge{background:var(--jl-accent);color:var(--jl-on-accent)}.expander jl-icon{transition:transform var(--jl-fast) var(--jl-ease)}.chevron{color:var(--jl-faint);transition:transform var(--jl-fast) var(--jl-ease)}.entry:has(>.children:not([hidden]))>.item .chevron,.entry:has(>.children:not([hidden]))>.expander jl-icon{transform:rotate(90deg)}.expander{border-radius:var(--jl-radius-xs);width:24px;height:24px;color:var(--jl-faint);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;padding:0;display:inline-flex;position:absolute;top:5px;right:6px}.expander:hover{background:var(--jl-surface-3);color:var(--jl-text)}.entry:has(>.expander)>.item{padding-right:36px}:host([rail]) .sections{scrollbar-gutter:auto;scrollbar-width:none}:host([rail]) .section-label{background:var(--jl-line);color:#0000;height:1px;margin:4px 10px;padding:0;overflow:hidden}:host([rail]) .section:first-child .section-label{display:none}:host([rail]) .item{justify-content:center;padding:0}:host([rail]) .item-label{clip-path:inset(50%);width:1px;height:1px;position:absolute;overflow:hidden}:host([rail]) .item-initial{display:inline-flex}:host([rail]) .item-badge{background:var(--jl-accent);color:#0000;width:8px;min-width:0;height:8px;padding:0;position:absolute;top:5px;right:9px;overflow:hidden}:host([rail]) .children{display:none}";
|
|
3
3
|
export { jl_side_nav_default as default };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { JlElement } from '../base/jl-element';
|
|
2
|
-
import type { SideNavSection } from '../types/jl-side-nav.types';
|
|
2
|
+
import type { SideNavCollapsible, SideNavSection } from '../types/jl-side-nav.types';
|
|
3
|
+
export declare const SIDE_NAV_COLLAPSIBLES: readonly SideNavCollapsible[];
|
|
3
4
|
/**
|
|
4
5
|
* The navigation of an app, down its side: sections of items with icons, badges and nested items that open with
|
|
5
6
|
* a chevron. `value` is the active item (its parents open to show it); `collapsed` makes it a rail of icons, with
|
|
6
|
-
* the labels as tooltips, and `collapsible` lets people fold and unfold it with a button at its bottom. Items with
|
|
7
|
+
* the labels as tooltips, and `collapsible` lets people fold and unfold it, with a button at its bottom, a handle along its edge or a knob on its edge line; the keys of `hotkey` do it too. Items with
|
|
7
8
|
* an `href` are links; the others fire `select`. Typed by its ids, `JlSideNav<'jobs' | 'people'>` takes items of
|
|
8
9
|
* those ids and gives `select` one of them.
|
|
9
10
|
*/
|
|
@@ -28,24 +29,36 @@ export declare class JlSideNav<Id extends string = string> extends JlElement {
|
|
|
28
29
|
get(): boolean;
|
|
29
30
|
set(setter: boolean | ((prevState: boolean) => boolean)): void;
|
|
30
31
|
}>>;
|
|
31
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* What people fold the side nav into its rail with, and unfold it: `none` (the app's own control, setting
|
|
34
|
+
* `collapsed`), an icon `button` at its bottom, a `handle` along its edge, or a round `knob` on its edge line, under
|
|
35
|
+
* the header. The handle is dragged towards the fold, and back; from the keyboard, Enter folds it.
|
|
36
|
+
*/
|
|
32
37
|
readonly collapsible: Readonly<Readonly<{
|
|
33
|
-
get():
|
|
34
|
-
set(setter:
|
|
38
|
+
get(): SideNavCollapsible;
|
|
39
|
+
set(setter: ((prevState: SideNavCollapsible) => SideNavCollapsible) | SideNavCollapsible): void;
|
|
35
40
|
}>>;
|
|
36
|
-
/**
|
|
41
|
+
/** What the handle says while the side nav is open; jlib's own when empty. */
|
|
37
42
|
readonly collapseLabel: Readonly<Readonly<{
|
|
38
43
|
get(): string;
|
|
39
44
|
set(setter: string | ((prevState: string) => string)): void;
|
|
40
45
|
}>>;
|
|
41
|
-
/**
|
|
46
|
+
/** What it says while the side nav is a rail; jlib's own when empty. */
|
|
42
47
|
readonly expandLabel: Readonly<Readonly<{
|
|
43
48
|
get(): string;
|
|
44
49
|
set(setter: string | ((prevState: string) => string)): void;
|
|
45
50
|
}>>;
|
|
51
|
+
/**
|
|
52
|
+
* The keys that fold and unfold it from anywhere in the page, whatever `collapsible` is: `mod+b` for ⌘B on a Mac
|
|
53
|
+
* and Ctrl+B elsewhere. None until the app names some.
|
|
54
|
+
*/
|
|
55
|
+
readonly hotkey: Readonly<Readonly<{
|
|
56
|
+
get(): string;
|
|
57
|
+
set(setter: string | ((prevState: string) => string)): void;
|
|
58
|
+
}>>;
|
|
46
59
|
/**
|
|
47
60
|
* Set by `jl-app-shell` while the side nav is its drawer, on a narrow screen: the drawer shows it whole, and its
|
|
48
|
-
*
|
|
61
|
+
* handle hides, `collapsed` waiting for a wide screen again.
|
|
49
62
|
*/
|
|
50
63
|
readonly inDrawer: Readonly<Readonly<{
|
|
51
64
|
get(): boolean;
|
|
@@ -61,15 +74,30 @@ export declare class JlSideNav<Id extends string = string> extends JlElement {
|
|
|
61
74
|
private readonly _state;
|
|
62
75
|
/** The sections and the form (rail or whole) the items were drawn for, and whether a drawing waits. */
|
|
63
76
|
private readonly _drawn;
|
|
77
|
+
/** Where the drag of the handle counts from: where it began, then where it last folded or turned back. */
|
|
78
|
+
private readonly _drag;
|
|
79
|
+
private readonly _sizes;
|
|
64
80
|
private readonly _refs;
|
|
65
81
|
templateHtml(): Node;
|
|
66
82
|
templateCss(): string;
|
|
67
83
|
onConnect(): void;
|
|
84
|
+
onDisconnect(): void;
|
|
68
85
|
/** Opens or closes a parent item. */
|
|
69
86
|
toggleItem(id: string, force?: boolean): void;
|
|
70
87
|
private onClick;
|
|
71
88
|
/** Whether it shows as the rail now: folded, and not in a drawer. */
|
|
72
89
|
private isRail;
|
|
90
|
+
/** The handle is dragged, not pressed: only the keyboard's Enter or Space, a click with no pointer, folds it. */
|
|
91
|
+
private foldOnKeyboardClick;
|
|
92
|
+
/** The handle keeps the pointer for the drag, wherever it goes. */
|
|
93
|
+
private startDrag;
|
|
94
|
+
/**
|
|
95
|
+
* Dragged far enough towards the fold (or away from it, as a rail), the side nav follows; the drag goes on from
|
|
96
|
+
* there, so coming back the same distance undoes it. A move the other way only takes the starting point along.
|
|
97
|
+
*/
|
|
98
|
+
private foldOnDrag;
|
|
99
|
+
/** The keys fold it wherever the focus is, unless the page used them or a drawer shows it whole. */
|
|
100
|
+
private foldOnHotkey;
|
|
73
101
|
private fold;
|
|
74
102
|
/** Draws on the next microtask: the inputs set while connecting give one drawing, not one each. */
|
|
75
103
|
private schedule;
|
|
@@ -79,8 +107,14 @@ export declare class JlSideNav<Id extends string = string> extends JlElement {
|
|
|
79
107
|
private renderItems;
|
|
80
108
|
protected drawTexts(): void;
|
|
81
109
|
private renderLabel;
|
|
82
|
-
/**
|
|
110
|
+
/** What the handle or the button says and does next; the CSS shows the one `collapsible` names, none in a drawer. */
|
|
83
111
|
private renderFold;
|
|
112
|
+
/** The knob on the edge line, made the first time `collapsible` asks for it. */
|
|
113
|
+
private knob;
|
|
114
|
+
/** Puts the knob's centre in the gap between the header and the first section, wherever the header ends. */
|
|
115
|
+
private placeKnob;
|
|
116
|
+
/** The button at the bottom, made the first time `collapsible` asks for it. */
|
|
117
|
+
private foldButton;
|
|
84
118
|
private choose;
|
|
85
119
|
/** Up and Down move between the rows people can see, Right opens a parent, Left closes it or goes up to it. */
|
|
86
120
|
private onKey;
|