@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
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/organisms/jl-tree.css?inline
|
|
2
|
-
var jl_tree_default = ":host{--indent:16px;--row-height:30px;display:block}.tree{--level:0;color:var(--jl-text-2);font-size:var(--jl-font-md)}.group{--group-level:var(--level);position:relative}.group>*{--level:calc(var(--group-level) + 1)}.item[aria-expanded=false]>.group{display:none}.group:before{top:0;bottom:4px;left:calc(8px + var(--level) * var(--indent) + 6.5px);background:var(--jl-line);content:\"\";width:1px;position:absolute}.item:focus-visible{box-shadow:none}.row{height:var(--row-height);padding:0 8px 0 calc(8px + var(--level) * var(--indent));border-radius:var(--jl-radius-sm);cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:6px;display:flex}.row:hover{background:var(--jl-surface-2);color:var(--jl-text)}.item:focus-visible>.row{box-shadow:var(--jl-focus-ring)}.item[aria-selected=true]>.row{background:var(--jl-accent-soft);color:var(--jl-text);font-weight:600}.chevron{width:14px;color:var(--jl-faint);transition:rotate var(--jl-fast) var(--jl-ease);flex:none;justify-content:center;display:inline-flex}.item[aria-expanded=true]>.row>.chevron{rotate:90deg}.icon{color:var(--jl-muted)}.item[aria-selected=true]>.row>.icon{color:var(--jl-accent)}.label{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}a.row{color:inherit;text-decoration:none}.item.level-end>.row{color:var(--jl-muted)}.level-end[aria-disabled=true]>.row{cursor:default}.level-end[aria-disabled=true]>.row:hover{background:0 0}.spinner{color:var(--jl-muted);flex:none}.more,.retry{color:var(--jl-accent);flex:none;font-weight:500}.level-end>.row:hover .more,.level-end>.row:hover .retry{color:var(--jl-accent-strong)}.icon.error{color:var(--jl-danger)}.note{min-height:var(--row-height);padding:0 8px 0 calc(8px + var(--level) * var(--indent));color:var(--jl-muted);align-items:center;gap:6px;display:flex}.badge{color:var(--jl-
|
|
2
|
+
var jl_tree_default = ":host{--indent:16px;--row-height:30px;display:block}.tree{--level:0;color:var(--jl-text-2);font-size:var(--jl-font-md)}.group{--group-level:var(--level);position:relative}.group>*{--level:calc(var(--group-level) + 1)}.item[aria-expanded=false]>.group{display:none}.group:before{top:0;bottom:4px;left:calc(8px + var(--level) * var(--indent) + 6.5px);background:var(--jl-line);content:\"\";width:1px;position:absolute}.item:focus-visible{box-shadow:none}.row{height:var(--row-height);padding:0 8px 0 calc(8px + var(--level) * var(--indent));border-radius:var(--jl-radius-sm);cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:6px;display:flex}.row:hover{background:var(--jl-surface-2);color:var(--jl-text)}.item:focus-visible>.row{box-shadow:var(--jl-focus-ring)}.item[aria-selected=true]>.row{background:var(--jl-accent-soft);color:var(--jl-text);font-weight:600}.chevron{width:14px;color:var(--jl-faint);transition:rotate var(--jl-fast) var(--jl-ease);flex:none;justify-content:center;display:inline-flex}.item[aria-expanded=true]>.row>.chevron{rotate:90deg}.icon{color:var(--jl-muted)}.item[aria-selected=true]>.row>.icon{color:var(--jl-accent)}.label{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}a.row{color:inherit;text-decoration:none}.item.level-end>.row{color:var(--jl-muted)}.level-end[aria-disabled=true]>.row{cursor:default}.level-end[aria-disabled=true]>.row:hover{background:0 0}.spinner{color:var(--jl-muted);flex:none}.more,.retry{color:var(--jl-accent);flex:none;font-weight:500}.level-end>.row:hover .more,.level-end>.row:hover .retry{color:var(--jl-accent-strong)}.icon.error{color:var(--jl-danger)}.note{min-height:var(--row-height);padding:0 8px 0 calc(8px + var(--level) * var(--indent));color:var(--jl-muted);align-items:center;gap:6px;display:flex}.badge{color:var(--jl-muted);font-size:var(--jl-font-xs);font-variant-numeric:tabular-nums;flex:none;margin-left:auto}";
|
|
3
3
|
export { jl_tree_default as default };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { JlElement } from '../base/jl-element';
|
|
2
|
-
import type { TreeItem, TreeLoader } from '../types/jl-tree.types';
|
|
2
|
+
import type { TreeItem, TreeLoader, TreePress } from '../types/jl-tree.types';
|
|
3
3
|
/**
|
|
4
4
|
* Nested items that open and close, as files in folders: `items` holds them, `expanded` lists the open folders and
|
|
5
5
|
* `value` is the selected item. With a `loader`, the tree loads itself a level at a time and a page at a time, so a
|
|
6
6
|
* large archive opens without loading everything: the roots first, a `lazy` folder's children when it opens, and
|
|
7
7
|
* the next page of a level from the button that ends it. The keyboard follows the tree pattern: Up and Down move,
|
|
8
8
|
* Right opens or enters a folder, Left closes it or goes to the parent, Home and End jump, Enter selects. Emits
|
|
9
|
-
* `select` and `toggle`; an item with an `href` is a link instead.
|
|
9
|
+
* `select` and `toggle`; an item with an `href` is a link instead. A press on an item fires `press` first, with
|
|
10
|
+
* the item, the button and the browser's event, which a page cancels to refuse it: its own menu on a right click.
|
|
10
11
|
*/
|
|
11
12
|
export declare class JlTree extends JlElement {
|
|
12
13
|
static readonly selector = "jl-tree";
|
|
@@ -16,6 +17,7 @@ export declare class JlTree extends JlElement {
|
|
|
16
17
|
id: string;
|
|
17
18
|
open: boolean;
|
|
18
19
|
};
|
|
20
|
+
press: TreePress;
|
|
19
21
|
}>>;
|
|
20
22
|
readonly items: Readonly<Readonly<{
|
|
21
23
|
get(): TreeItem[];
|
|
@@ -84,10 +86,21 @@ export declare class JlTree extends JlElement {
|
|
|
84
86
|
onConnect(): void;
|
|
85
87
|
private idOf;
|
|
86
88
|
/**
|
|
87
|
-
* A press selects the item; on a folder it also opens or closes it, and the chevron
|
|
88
|
-
* leaves a modified click (a new tab) to the browser.
|
|
89
|
+
* A press on a row. The main button selects the item; on a folder it also opens or closes it, and the chevron
|
|
90
|
+
* only does that. A link's row leaves a modified click (a new tab) to the browser. The page hears of a press on
|
|
91
|
+
* an item first, whatever its button (`press`), and refuses it by cancelling the event.
|
|
89
92
|
*/
|
|
90
93
|
private press;
|
|
94
|
+
/** A press on what the tree handles alone, with the main button: the row that ends a level, a folder's chevron. */
|
|
95
|
+
private pressOwnControl;
|
|
96
|
+
private toggleFolder;
|
|
97
|
+
/**
|
|
98
|
+
* Tells the page of a press on an item.
|
|
99
|
+
* @returns Whether the page refused it, by cancelling the event
|
|
100
|
+
*/
|
|
101
|
+
private tellItemPress;
|
|
102
|
+
/** Enter or Space on an item is a press too, of the main button: the page hears of it, and may refuse it. */
|
|
103
|
+
private tellKeyPress;
|
|
91
104
|
private handleKey;
|
|
92
105
|
/** Enter on an item: the row that ends a level loads its page, a link is followed, an item is selected. */
|
|
93
106
|
private activate;
|
|
@@ -116,6 +129,12 @@ export declare class JlTree extends JlElement {
|
|
|
116
129
|
private levelEnd;
|
|
117
130
|
private hasLevelEndRow;
|
|
118
131
|
protected drawTexts(): void;
|
|
132
|
+
/**
|
|
133
|
+
* The tree's own texts show only in the rows that end a level (a note, a spinner, "show more", an error): those
|
|
134
|
+
* are drawn again, the items stay. Every input's callback runs as the tree appears: each one building every row,
|
|
135
|
+
* a tree built its rows seven times.
|
|
136
|
+
*/
|
|
137
|
+
private drawLevelEnds;
|
|
119
138
|
private errorLabel;
|
|
120
139
|
private renderItemsUnlessQuiet;
|
|
121
140
|
/** Sets `items` without drawing every row again, which its callback does on each set(), even of an equal value. */
|
|
@@ -7,6 +7,7 @@ import { registerIcons } from "../lib/icons.js";
|
|
|
7
7
|
import { JlIcon } from "../atoms/jl-icon.js";
|
|
8
8
|
import { isModifiedClick, setOrRemove, uniqueId } from "../lib/dom.js";
|
|
9
9
|
import { JlSpinner } from "../atoms/jl-spinner.js";
|
|
10
|
+
import { PRESS_EVENTS, pressButtonOf, tellPress } from "../lib/press.js";
|
|
10
11
|
import { allItems, childrenOf, isFolder, treeKeyAction, withExpanded, withExtraRows, withPage } from "../lib/tree.js";
|
|
11
12
|
import jl_tree_default from "./jl-tree.css.js";
|
|
12
13
|
import { css } from "@jadis/core";
|
|
@@ -41,7 +42,8 @@ var rowsIn = (nodes) => new Map(nodes.filter((node) => node instanceof HTMLEleme
|
|
|
41
42
|
* large archive opens without loading everything: the roots first, a `lazy` folder's children when it opens, and
|
|
42
43
|
* the next page of a level from the button that ends it. The keyboard follows the tree pattern: Up and Down move,
|
|
43
44
|
* Right opens or enters a folder, Left closes it or goes to the parent, Home and End jump, Enter selects. Emits
|
|
44
|
-
* `select` and `toggle`; an item with an `href` is a link instead.
|
|
45
|
+
* `select` and `toggle`; an item with an `href` is a link instead. A press on an item fires `press` first, with
|
|
46
|
+
* the item, the button and the browser's event, which a page cancels to refuse it: its own menu on a right click.
|
|
45
47
|
*/
|
|
46
48
|
var JlTree = class extends JlElement {
|
|
47
49
|
static selector = "jl-tree";
|
|
@@ -63,15 +65,15 @@ var JlTree = class extends JlElement {
|
|
|
63
65
|
/** The tree's name for screen readers. */
|
|
64
66
|
label = this.useChange("", (value) => setOrRemove(this._refs.tree, "aria-label", value), { attribute: "label" });
|
|
65
67
|
/** What an empty tree says, such as "No object yet"; none by default. */
|
|
66
|
-
emptyText = this.useChange("", () => this.
|
|
68
|
+
emptyText = this.useChange("", () => this.drawLevelEnds(), { attribute: "empty-text" });
|
|
67
69
|
/** Said while a page loads; jlib's own text when empty. */
|
|
68
|
-
loadingText = this.useChange("", () => this.
|
|
70
|
+
loadingText = this.useChange("", () => this.drawLevelEnds(), { attribute: "loading-text" });
|
|
69
71
|
/** The button that loads a level's next page, `{count}` being how many items are left; jlib's own when empty. */
|
|
70
|
-
moreText = this.useChange("", () => this.
|
|
72
|
+
moreText = this.useChange("", () => this.drawLevelEnds(), { attribute: "more-text" });
|
|
71
73
|
/** Said where a page could not be loaded; jlib's own text when empty. */
|
|
72
|
-
errorText = this.useChange("", () => this.
|
|
74
|
+
errorText = this.useChange("", () => this.drawLevelEnds(), { attribute: "error-text" });
|
|
73
75
|
/** The action that loads it again; jlib's own text when empty. */
|
|
74
|
-
retryLabel = this.useChange("", () => this.
|
|
76
|
+
retryLabel = this.useChange("", () => this.drawLevelEnds(), { attribute: "retry-label" });
|
|
75
77
|
_source = { loader: null };
|
|
76
78
|
_rows = /* @__PURE__ */ new Map();
|
|
77
79
|
_focus = { id: "" };
|
|
@@ -133,7 +135,7 @@ var JlTree = class extends JlElement {
|
|
|
133
135
|
}
|
|
134
136
|
onConnect() {
|
|
135
137
|
const tree = this._refs.tree;
|
|
136
|
-
this.on(tree,
|
|
138
|
+
for (const type of PRESS_EVENTS) this.on(tree, type, (event) => this.press(event));
|
|
137
139
|
this.on(tree, "keydown", (event) => this.handleKey(event));
|
|
138
140
|
this.on(tree, "focusin", (event) => {
|
|
139
141
|
const id = this.idOf(event.target);
|
|
@@ -144,30 +146,71 @@ var JlTree = class extends JlElement {
|
|
|
144
146
|
return (target instanceof Element ? target.closest("[role=\"treeitem\"]") : null)?.dataset.id ?? null;
|
|
145
147
|
}
|
|
146
148
|
/**
|
|
147
|
-
* A press selects the item; on a folder it also opens or closes it, and the chevron
|
|
148
|
-
* leaves a modified click (a new tab) to the browser.
|
|
149
|
+
* A press on a row. The main button selects the item; on a folder it also opens or closes it, and the chevron
|
|
150
|
+
* only does that. A link's row leaves a modified click (a new tab) to the browser. The page hears of a press on
|
|
151
|
+
* an item first, whatever its button (`press`), and refuses it by cancelling the event.
|
|
149
152
|
*/
|
|
150
153
|
press(event) {
|
|
151
154
|
const id = this.idOf(event.target);
|
|
152
|
-
|
|
155
|
+
const button = pressButtonOf(event);
|
|
156
|
+
if (id === null || button === null) return;
|
|
157
|
+
const item = isLevelEnd(id) ? void 0 : this.findItem(id);
|
|
158
|
+
const onChevron = event.target instanceof Element && event.target.closest(".chevron") !== null;
|
|
159
|
+
if (item === void 0 || onChevron) {
|
|
160
|
+
this.pressOwnControl(event, id, button);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (item.href !== void 0 && button === "main" && isModifiedClick(event) || this.tellItemPress({
|
|
164
|
+
button,
|
|
165
|
+
event,
|
|
166
|
+
id,
|
|
167
|
+
item
|
|
168
|
+
}) || button !== "main") return;
|
|
169
|
+
this.toggleFolder(item);
|
|
170
|
+
this.select(item);
|
|
171
|
+
this.moveFocus(id, true);
|
|
172
|
+
}
|
|
173
|
+
/** A press on what the tree handles alone, with the main button: the row that ends a level, a folder's chevron. */
|
|
174
|
+
pressOwnControl(event, id, button) {
|
|
175
|
+
if (button !== "main") return;
|
|
176
|
+
if (isLevelEnd(id)) {
|
|
153
177
|
this.loadNextPage(parentOfLevelEnd(id));
|
|
154
178
|
return;
|
|
155
179
|
}
|
|
156
|
-
const item =
|
|
157
|
-
if (
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (item.href !== void 0 && !onChevron && isModifiedClick(event)) return;
|
|
161
|
-
if (isFolder(item)) this.toggle(id, !this.expanded.get().includes(id));
|
|
162
|
-
if (!onChevron) this.select(item);
|
|
180
|
+
const item = this.findItem(id);
|
|
181
|
+
if (item === void 0) return;
|
|
182
|
+
event.preventDefault();
|
|
183
|
+
this.toggleFolder(item);
|
|
163
184
|
this.moveFocus(id, true);
|
|
164
185
|
}
|
|
186
|
+
toggleFolder(item) {
|
|
187
|
+
if (isFolder(item)) this.toggle(item.id, !this.expanded.get().includes(item.id));
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Tells the page of a press on an item.
|
|
191
|
+
* @returns Whether the page refused it, by cancelling the event
|
|
192
|
+
*/
|
|
193
|
+
tellItemPress(press) {
|
|
194
|
+
return tellPress(press.event, () => this.events.emit("press", press));
|
|
195
|
+
}
|
|
196
|
+
/** Enter or Space on an item is a press too, of the main button: the page hears of it, and may refuse it. */
|
|
197
|
+
tellKeyPress(id, event) {
|
|
198
|
+
const item = isLevelEnd(id) ? void 0 : this.findItem(id);
|
|
199
|
+
return item !== void 0 && this.tellItemPress({
|
|
200
|
+
button: "main",
|
|
201
|
+
event,
|
|
202
|
+
id,
|
|
203
|
+
item
|
|
204
|
+
});
|
|
205
|
+
}
|
|
165
206
|
handleKey(event) {
|
|
166
207
|
const focused = this._focus.id;
|
|
167
208
|
const keyboardItems = withExtraRows(this.items.get(), (parent) => this.hasLevelEndRow(parent) ? levelEndId(parent) : null);
|
|
168
209
|
const action = treeKeyAction(keyboardItems, new Set(this.expanded.get()), focused, event.key);
|
|
169
210
|
if (action === null) return;
|
|
211
|
+
const refused = action.kind === "select" && this.tellKeyPress(action.id, event);
|
|
170
212
|
event.preventDefault();
|
|
213
|
+
if (refused) return;
|
|
171
214
|
({
|
|
172
215
|
focus: () => this.moveFocus(action.id, true),
|
|
173
216
|
select: () => this.activate(action.id),
|
|
@@ -295,7 +338,20 @@ var JlTree = class extends JlElement {
|
|
|
295
338
|
return end !== "none" && end !== "empty";
|
|
296
339
|
}
|
|
297
340
|
drawTexts() {
|
|
298
|
-
this.
|
|
341
|
+
this.drawLevelEnds();
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* The tree's own texts show only in the rows that end a level (a note, a spinner, "show more", an error): those
|
|
345
|
+
* are drawn again, the items stay. Every input's callback runs as the tree appears: each one building every row,
|
|
346
|
+
* a tree built its rows seven times.
|
|
347
|
+
*/
|
|
348
|
+
drawLevelEnds() {
|
|
349
|
+
if (this.items.get().length === 0) {
|
|
350
|
+
this.renderItems();
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
const drawnLevels = [...this._loading.levels.keys()].filter((parent) => this.levelContainer(parent) !== null);
|
|
354
|
+
for (const parent of drawnLevels) this.redrawLevelEnd(parent);
|
|
299
355
|
}
|
|
300
356
|
errorLabel() {
|
|
301
357
|
return this.errorText.get() || jlText("loadError");
|
package/dist/styles/base.css.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/styles/base.css?inline
|
|
2
|
-
var base_default = ":host{box-sizing:border-box;font-family:var(--jl-font-sans);-webkit-tap-highlight-color:transparent}:host([hidden]){display:none!important}*,:before,:after{box-sizing:inherit}[hidden]{display:none!important}button,input,select,textarea{font:inherit;color:inherit}:focus-visible{box-shadow:var(--jl-focus-ring);outline:none}h1,h2,h3,h4,p,ul,ol,figure{margin:0}code,kbd,pre{font-family:var(--jl-font-mono)}.sr-only{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){*,:before,:after{transition-duration:1ms!important;animation-duration:1ms!important;animation-iteration-count:1!important}}";
|
|
2
|
+
var base_default = ":host{box-sizing:border-box;font-family:var(--jl-font-sans);-webkit-tap-highlight-color:transparent}:host([hidden]){display:none!important}*,:before,:after{box-sizing:inherit}*{scrollbar-width:thin}[hidden]{display:none!important}button,input,select,textarea{font:inherit;color:inherit}:focus-visible{box-shadow:var(--jl-focus-ring);outline:none}h1,h2,h3,h4,p,ul,ol,figure{margin:0}code,kbd,pre{font-family:var(--jl-font-mono)}.sr-only{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}@media (forced-colors:active){:focus-visible{outline-offset:2px!important;outline:2px solid highlight!important}}@media (prefers-reduced-motion:reduce){*,:before,:after{transition-duration:1ms!important;animation-duration:1ms!important;animation-iteration-count:1!important}}";
|
|
3
3
|
export { base_default as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/styles/control.css?inline
|
|
2
|
-
var control_default = ".control{width:100%;min-height:var(--height,var(--jl-control-md));border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-sm);background:var(--jl-surface);color:var(--jl-text);font-size:var(--jl-control-font);transition:border-color var(--jl-fast) var(--jl-ease), box-shadow var(--jl-fast) var(--jl-ease);align-items:center;gap:8px;padding:0 12px;line-height:20px;display:flex}.control:hover{border-color:color-mix(in srgb, var(--jl-line-strong) 60%, var(--jl-text) 18%)}.control:focus-within{border-color:var(--jl-accent);box-shadow:var(--jl-focus-ring)}:host([invalid]) .control{border-color:var(--jl-danger)}:host([invalid]) .control:focus-within{box-shadow:0 0 0 3px color-mix(in srgb, var(--jl-danger) 25%, transparent)}:host([disabled]) .control,:host(:disabled) .control{background:var(--jl-surface-2);color:var(--jl-muted);cursor:not-allowed}:host([size=sm]){--height:var(--jl-control-sm)}:host([size=lg]){--height:var(--jl-control-lg)}.native{min-width:0;height:calc(var(--height,var(--jl-control-md)) - 2px);color:inherit;font:inherit;background:0 0;border:none;outline:none;flex:1;padding:0}.native::placeholder{color:var(--jl-
|
|
2
|
+
var control_default = ".control{width:100%;min-height:var(--height,var(--jl-control-md));border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-sm);background:var(--jl-surface);color:var(--jl-text);font-size:var(--jl-control-font);transition:border-color var(--jl-fast) var(--jl-ease), box-shadow var(--jl-fast) var(--jl-ease);align-items:center;gap:8px;padding:0 12px;line-height:20px;display:flex}.control:hover{border-color:color-mix(in srgb, var(--jl-line-strong) 60%, var(--jl-text) 18%)}.control:focus-within{border-color:var(--jl-accent);box-shadow:var(--jl-focus-ring)}:host([invalid]) .control{border-color:var(--jl-danger)}:host([invalid]) .control:focus-within{box-shadow:0 0 0 3px color-mix(in srgb, var(--jl-danger) 25%, transparent)}:host([disabled]) .control,:host(:disabled) .control{background:var(--jl-surface-2);color:var(--jl-muted);cursor:not-allowed}:host([size=sm]){--height:var(--jl-control-sm)}:host([size=lg]){--height:var(--jl-control-lg)}.native{min-width:0;height:calc(var(--height,var(--jl-control-md)) - 2px);color:inherit;font:inherit;background:0 0;border:none;outline:none;flex:1;padding:0}.native::placeholder{color:var(--jl-muted)}.native:focus-visible{box-shadow:none}.native:disabled{cursor:not-allowed}.adornment{color:var(--jl-faint);flex:none;align-items:center;display:inline-flex}.action{border-radius:var(--jl-radius-xs);width:24px;height:24px;color:var(--jl-faint);cursor:pointer;background:0 0;border:none;flex:none;justify-content:center;align-items:center;margin-right:-4px;padding:0;display:inline-flex}.action:hover{background:var(--jl-surface-3);color:var(--jl-text)}";
|
|
3
3
|
export { control_default as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/styles/tokens.css?inline
|
|
2
|
-
var tokens_default = "@layer jlib{:root,[data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--jl-font-sans:\"Manrope Variable\", \"Manrope\", system-ui, -apple-system, \"Segoe UI\", sans-serif;--jl-font-mono:\"JetBrains Mono Variable\", \"JetBrains Mono\", ui-monospace, \"SF Mono\", Menlo, monospace;--jl-font-xs:12px;--jl-font-sm:13px;--jl-font-md:14px;--jl-font-lg:16px;--jl-font-xl:20px;--jl-font-2xl:28px;--jl-text:#0b0b0c;--jl-text-2:#3a3f47;--jl-muted:#5b616b;--jl-faint:#8a9099;--jl-bg:#fff;--jl-surface:#fff;--jl-surface-2:#f7f8f9;--jl-surface-3:#eef0f2;--jl-code-bg:#f0f2f4;--jl-line:#e6e8eb;--jl-line-soft:#eef0f2;--jl-line-strong:#d5d9de;--jl-brand:#0e88d3;--jl-accent:#0c72b0;--jl-accent-strong:#095a8b;--jl-accent-soft:#e9f4fb;--jl-accent-line:#b7dbf2;--jl-on-accent:#fff;--jl-on-brand:#fff;--jl-ok:#17784a;--jl-ok-soft:#ecf6f0;--jl-warn:#9a5b00;--jl-warn-soft:#fcf4e6;--jl-danger:#b42318;--jl-danger-soft:#fdf0ef;--jl-on-danger:#fff;--jl-info:#0c72b0;--jl-info-soft:#e9f4fb;--jl-code-keyword:#0c72b0;--jl-code-tag:#095a8b;--jl-code-attribute:#5b48c8;--jl-code-string:#17784a;--jl-code-number:#9a5b00;--jl-code-function:#3d5a80;--jl-code-property:#127a72;--jl-code-comment
|
|
2
|
+
var tokens_default = "@layer jlib{:root,[data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--jl-font-sans:\"Manrope Variable\", \"Manrope\", system-ui, -apple-system, \"Segoe UI\", sans-serif;--jl-font-mono:\"JetBrains Mono Variable\", \"JetBrains Mono\", ui-monospace, \"SF Mono\", Menlo, monospace;--jl-font-xs:12px;--jl-font-sm:13px;--jl-font-md:14px;--jl-font-lg:16px;--jl-font-xl:20px;--jl-font-2xl:28px;--jl-text:#0b0b0c;--jl-text-2:#3a3f47;--jl-muted:#5b616b;--jl-faint:#8a9099;--jl-bg:#fff;--jl-surface:#fff;--jl-surface-2:#f7f8f9;--jl-surface-3:#eef0f2;--jl-code-bg:#f0f2f4;--jl-line:#e6e8eb;--jl-line-soft:#eef0f2;--jl-line-strong:#d5d9de;--jl-brand:#0e88d3;--jl-accent:#0c72b0;--jl-accent-strong:#095a8b;--jl-accent-soft:#e9f4fb;--jl-accent-line:#b7dbf2;--jl-on-accent:#fff;--jl-on-brand:#fff;--jl-ok:#17784a;--jl-ok-soft:#ecf6f0;--jl-warn:#9a5b00;--jl-warn-soft:#fcf4e6;--jl-danger:#b42318;--jl-danger-soft:#fdf0ef;--jl-on-danger:#fff;--jl-info:#0c72b0;--jl-info-soft:#e9f4fb;--jl-code-keyword:#0c72b0;--jl-code-tag:#095a8b;--jl-code-attribute:#5b48c8;--jl-code-string:#17784a;--jl-code-number:#9a5b00;--jl-code-function:#3d5a80;--jl-code-property:#127a72;--jl-code-comment:var(--jl-muted);--jl-radius-xs:6px;--jl-radius-sm:8px;--jl-radius:10px;--jl-radius-lg:12px;--jl-radius-xl:20px;--jl-radius-pill:999px;--jl-space-1:4px;--jl-space-2:8px;--jl-space-3:12px;--jl-space-4:16px;--jl-space-5:20px;--jl-space-6:24px;--jl-space-8:32px;--jl-space-10:40px;--jl-space-12:48px;--jl-space-16:64px;--jl-control-sm:30px;--jl-control-md:36px;--jl-control-lg:44px;--jl-control-font:var(--jl-font-md);--jl-page-form:720px;--jl-page-standard:1120px;--jl-page-wide:1400px;--jl-shadow-sm:0 1px 2px #0b0b0c0d;--jl-shadow:0 6px 16px -6px #0b0b0c1f;--jl-shadow-lg:0 18px 44px -14px #0b0b0c38;--jl-focus-ring:0 0 0 3px color-mix(in srgb, var(--jl-brand) 35%, transparent);--jl-scrim:#0b0b0c61;--jl-ease:cubic-bezier(.2, .7, .2, 1);--jl-fast:.12s;--jl-slow:.24s;--jl-scrollbar:color-mix(in srgb, var(--jl-muted) 45%, transparent);scrollbar-color:var(--jl-scrollbar) transparent}@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--jl-text:#eceef1;--jl-text-2:#c3c8cf;--jl-muted:#959ca6;--jl-faint:#6b727c;--jl-bg:#0f1113;--jl-surface:#0f1113;--jl-surface-2:#16191c;--jl-surface-3:#1d2125;--jl-code-bg:#1d2125;--jl-line:#262a2f;--jl-line-soft:#1f2327;--jl-line-strong:#343a41;--jl-brand:#1a9be0;--jl-accent:#3ea6e8;--jl-accent-strong:#6cc0f2;--jl-accent-soft:#0f2a3b;--jl-accent-line:#1e4a66;--jl-on-accent:#04131c;--jl-ok:#4cc38a;--jl-ok-soft:#10261c;--jl-warn:#e5a54b;--jl-warn-soft:#2a2012;--jl-danger:#f0786c;--jl-danger-soft:#3a1a17;--jl-on-danger:#1c0604;--jl-info:#3ea6e8;--jl-info-soft:#0f2a3b;--jl-code-keyword:#3ea6e8;--jl-code-tag:#6cc0f2;--jl-code-attribute:#a99bf0;--jl-code-string:#4cc38a;--jl-code-number:#e5a54b;--jl-code-function:#8fb0d6;--jl-code-property:#4fc1b5;--jl-code-comment:var(--jl-muted);--jl-shadow-sm:0 1px 2px #0006;--jl-shadow:0 6px 18px -6px #0009;--jl-shadow-lg:0 18px 44px -12px #000000b3;--jl-scrim:#0000008c}}[data-theme=dark]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--jl-text:#eceef1;--jl-text-2:#c3c8cf;--jl-muted:#959ca6;--jl-faint:#6b727c;--jl-bg:#0f1113;--jl-surface:#0f1113;--jl-surface-2:#16191c;--jl-surface-3:#1d2125;--jl-code-bg:#1d2125;--jl-line:#262a2f;--jl-line-soft:#1f2327;--jl-line-strong:#343a41;--jl-brand:#1a9be0;--jl-accent:#3ea6e8;--jl-accent-strong:#6cc0f2;--jl-accent-soft:#0f2a3b;--jl-accent-line:#1e4a66;--jl-on-accent:#04131c;--jl-ok:#4cc38a;--jl-ok-soft:#10261c;--jl-warn:#e5a54b;--jl-warn-soft:#2a2012;--jl-danger:#f0786c;--jl-danger-soft:#3a1a17;--jl-on-danger:#1c0604;--jl-info:#3ea6e8;--jl-info-soft:#0f2a3b;--jl-code-keyword:#3ea6e8;--jl-code-tag:#6cc0f2;--jl-code-attribute:#a99bf0;--jl-code-string:#4cc38a;--jl-code-number:#e5a54b;--jl-code-function:#8fb0d6;--jl-code-property:#4fc1b5;--jl-code-comment:var(--jl-muted);--jl-shadow-sm:0 1px 2px #0006;--jl-shadow:0 6px 18px -6px #0009;--jl-shadow-lg:0 18px 44px -12px #000000b3;--jl-scrim:#0000008c}@media (pointer:coarse){:root,[data-theme=light],[data-theme=dark]{--jl-control-sm:36px;--jl-control-md:44px;--jl-control-lg:48px;--jl-control-font:16px}}}";
|
|
3
3
|
export { tokens_default as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/templates/jl-app-shell.css?inline
|
|
2
|
-
var jl_app_shell_default = ":host{--header-height:56px;--drawer-width:min(300px, 86%);height:100%;min-height:0;display:block;container:jl-app-shell/inline-size}.shell{background:var(--jl-bg);height:100%;color:var(--jl-text);grid-template:\"top top top\"\"nav main aside\"minmax(0,1fr)/auto minmax(0,1fr) auto;display:grid;position:relative;overflow:hidden}.top{min-height:var(--header-height);border-bottom:1px solid var(--jl-line);background:var(--jl-surface);grid-area:top;align-items:center;gap:8px;padding:0 16px;display:flex}:host(:not([has-header])) .top,:host([narrow-header]) .top{display:none}::slotted([slot=header]){flex:1;min-width:0}.menu{width:var(--jl-control-md);height:var(--jl-control-md);border-radius:var(--jl-radius-sm);color:var(--jl-text-2);cursor:pointer;background:0 0;border:none;flex:none;justify-content:center;align-items:center;margin-left:-8px;padding:0;display:none}.menu:hover{background:var(--jl-surface-3);color:var(--jl-text)}.nav{border-right:1px solid var(--jl-line);background:var(--jl-surface);grid-area:nav;min-height:0;overflow-y:auto}.nav:focus-visible{box-shadow:none}:host(:not([has-nav])) .nav{display:none}.main{isolation:isolate;grid-area:main;min-width:0;min-height:0;overflow:auto}.aside{border-left:1px solid var(--jl-line);background:var(--jl-surface);grid-area:aside;min-height:0;overflow-y:auto}:host(:not([has-aside])) .aside,.tabs,.scrim{display:none}@container jl-app-shell (width<960px){.shell{grid-template:\"top\"\"main\"minmax(0,1fr)\"tabs\"/minmax(0,1fr)}:host([has-tabs]) .tabs{grid-area:tabs;display:block}:host([has-nav]) .top,:host([narrow-header][has-header]) .top{display:flex}:host([has-nav]) .menu{display:inline-flex}.nav{z-index:2;max-width:var(--drawer-width);box-shadow:var(--jl-shadow-lg);visibility:hidden;transition:transform var(--jl-slow) var(--jl-ease), visibility 0s linear var(--jl-slow);position:absolute;top:0;bottom:0;left:0;transform:translate(-100%)}:host([nav-open]) .nav{visibility:visible;transition:transform var(--jl-slow) var(--jl-ease);transform:none}.scrim{z-index:1;background:var(--jl-scrim);opacity:0;pointer-events:none;transition:opacity var(--jl-slow) var(--jl-ease);display:block;position:absolute;inset:0}:host([nav-open]) .scrim{opacity:1;pointer-events:auto}.aside{display:none}}";
|
|
2
|
+
var jl_app_shell_default = ":host{--header-height:56px;--drawer-width:min(300px, 86%);height:100%;min-height:0;display:block;container:jl-app-shell/inline-size}.shell{background:var(--jl-bg);height:100%;color:var(--jl-text);grid-template:\"top top top\"\"nav main aside\"minmax(0,1fr)/auto minmax(0,1fr) auto;display:grid;position:relative;overflow:hidden}.top{min-height:var(--header-height);border-bottom:1px solid var(--jl-line);background:var(--jl-surface);grid-area:top;align-items:center;gap:8px;padding:0 16px;display:flex}:host(:not([has-header])) .top,:host([narrow-header]) .top{display:none}::slotted([slot=header]){flex:1;min-width:0}.menu{width:var(--jl-control-md);height:var(--jl-control-md);border-radius:var(--jl-radius-sm);color:var(--jl-text-2);cursor:pointer;background:0 0;border:none;flex:none;justify-content:center;align-items:center;margin-left:-8px;padding:0;display:none}.menu:hover{background:var(--jl-surface-3);color:var(--jl-text)}.nav{border-right:1px solid var(--jl-line);background:var(--jl-surface);grid-area:nav;min-height:0;overflow-y:auto}.nav:focus-visible{box-shadow:none}:host(:not([has-nav])) .nav{display:none}.main{isolation:isolate;grid-area:main;min-width:0;min-height:0;overflow:auto}.aside{border-left:1px solid var(--jl-line);background:var(--jl-surface);grid-area:aside;min-height:0;overflow-y:auto}:host(:not([has-aside])) .aside,.tabs,.scrim{display:none}@container jl-app-shell (width>=960px){:host([has-side-nav]) .nav{z-index:1;overflow:visible}}@container jl-app-shell (width<960px){.shell{grid-template:\"top\"\"main\"minmax(0,1fr)\"tabs\"/minmax(0,1fr)}:host([has-tabs]) .tabs{grid-area:tabs;display:block}:host([has-nav]) .top,:host([narrow-header][has-header]) .top{display:flex}:host([has-nav]) .menu{display:inline-flex}.nav{z-index:2;max-width:var(--drawer-width);box-shadow:var(--jl-shadow-lg);visibility:hidden;transition:transform var(--jl-slow) var(--jl-ease), visibility 0s linear var(--jl-slow);position:absolute;top:0;bottom:0;left:0;transform:translate(-100%)}:host([nav-open]) .nav{visibility:visible;transition:transform var(--jl-slow) var(--jl-ease);transform:none}.scrim{z-index:1;background:var(--jl-scrim);opacity:0;pointer-events:none;transition:opacity var(--jl-slow) var(--jl-ease);display:block;position:absolute;inset:0}:host([nav-open]) .scrim{opacity:1;pointer-events:auto}.aside{display:none}}";
|
|
3
3
|
export { jl_app_shell_default as default };
|
|
@@ -12,6 +12,7 @@ import { jsx, jsxs } from "@jadis/core/jsx-runtime";
|
|
|
12
12
|
registerIcons({ menu: Menu });
|
|
13
13
|
var MENU_ICON_SIZE = 18;
|
|
14
14
|
var HIDDEN = "none";
|
|
15
|
+
var SIDE_NAV_TAG = "jl-side-nav";
|
|
15
16
|
var SHELL_BOTTOM = "--jl-shell-bottom";
|
|
16
17
|
/** Whether a click inside the drawer followed a link: the page changes, so the drawer gets out of the way. */
|
|
17
18
|
var followsLink = (event) => event.composedPath().some((node) => node instanceof HTMLAnchorElement && node.href !== "");
|
|
@@ -201,6 +202,7 @@ var JlAppShell = class extends JlElement {
|
|
|
201
202
|
for (const element of tabElements) element.addEventListener("more", () => this.onMore(), { signal: this._state.tabsListeners.signal });
|
|
202
203
|
const navElements = this._refs.navSlot.assignedElements();
|
|
203
204
|
this.reflect("has-nav", navElements.length > 0);
|
|
205
|
+
this.reflect("has-side-nav", navElements.some((element) => element.localName === SIDE_NAV_TAG));
|
|
204
206
|
this._state.navListeners.abort();
|
|
205
207
|
this._state.navListeners = new AbortController();
|
|
206
208
|
const signal = this._state.navListeners.signal;
|
package/dist/tokens.css
CHANGED
|
@@ -62,7 +62,8 @@
|
|
|
62
62
|
--jl-code-number: #9a5b00;
|
|
63
63
|
--jl-code-function: #3d5a80;
|
|
64
64
|
--jl-code-property: #127a72;
|
|
65
|
-
|
|
65
|
+
/* Comments are text: the lightest ink text may have, not the fainter one of icons. */
|
|
66
|
+
--jl-code-comment: var(--jl-muted);
|
|
66
67
|
|
|
67
68
|
--jl-radius-xs: 6px;
|
|
68
69
|
--jl-radius-sm: 8px;
|
|
@@ -104,6 +105,10 @@
|
|
|
104
105
|
--jl-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
|
|
105
106
|
--jl-fast: 120ms;
|
|
106
107
|
--jl-slow: 240ms;
|
|
108
|
+
|
|
109
|
+
/* Scrollbars: a quiet thumb on no track, in both themes. The colour is inherited, into every shadow root. */
|
|
110
|
+
--jl-scrollbar: color-mix(in srgb, var(--jl-muted) 45%, transparent);
|
|
111
|
+
scrollbar-color: var(--jl-scrollbar) transparent;
|
|
107
112
|
}
|
|
108
113
|
|
|
109
114
|
@media (prefers-color-scheme: dark) {
|
|
@@ -143,7 +148,7 @@
|
|
|
143
148
|
--jl-code-number: #e5a54b;
|
|
144
149
|
--jl-code-function: #8fb0d6;
|
|
145
150
|
--jl-code-property: #4fc1b5;
|
|
146
|
-
--jl-code-comment:
|
|
151
|
+
--jl-code-comment: var(--jl-muted);
|
|
147
152
|
--jl-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
|
|
148
153
|
--jl-shadow: 0 6px 18px -6px rgb(0 0 0 / 0.6);
|
|
149
154
|
--jl-shadow-lg: 0 18px 44px -12px rgb(0 0 0 / 0.7);
|
|
@@ -188,7 +193,7 @@
|
|
|
188
193
|
--jl-code-number: #e5a54b;
|
|
189
194
|
--jl-code-function: #8fb0d6;
|
|
190
195
|
--jl-code-property: #4fc1b5;
|
|
191
|
-
--jl-code-comment:
|
|
196
|
+
--jl-code-comment: var(--jl-muted);
|
|
192
197
|
--jl-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
|
|
193
198
|
--jl-shadow: 0 6px 18px -6px rgb(0 0 0 / 0.6);
|
|
194
199
|
--jl-shadow-lg: 0 18px 44px -12px rgb(0 0 0 / 0.7);
|
|
@@ -8,3 +8,10 @@ export type LoadTask<Value> = {
|
|
|
8
8
|
draw: (value: Value) => void;
|
|
9
9
|
isEmpty?: (value: Value) => boolean;
|
|
10
10
|
};
|
|
11
|
+
/** What a load's fetch came to: its value, or that it failed. */
|
|
12
|
+
export type Fetched<Value> = {
|
|
13
|
+
failed: false;
|
|
14
|
+
value: Value;
|
|
15
|
+
} | {
|
|
16
|
+
failed: true;
|
|
17
|
+
};
|
|
@@ -15,6 +15,11 @@ export type SideNavItem<Id extends string = string> = {
|
|
|
15
15
|
badge?: string | number;
|
|
16
16
|
children?: SideNavItem<Id>[];
|
|
17
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* What people fold a side nav with: `none` (it folds only as the app sets `collapsed`), a quiet icon `button` at its
|
|
20
|
+
* bottom, a `handle` along its edge, or a round `knob` on its edge line, under its header.
|
|
21
|
+
*/
|
|
22
|
+
export type SideNavCollapsible = 'none' | 'button' | 'handle' | 'knob';
|
|
18
23
|
/** A group of items under an optional heading. */
|
|
19
24
|
export type SideNavSection<Id extends string = string> = {
|
|
20
25
|
label?: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Tone } from './options.types';
|
|
2
|
+
import type { PressButton } from './press.types';
|
|
2
3
|
/** How a cell shows its value: as it is, a localised number, date or date and time, a badge, or code. */
|
|
3
4
|
export type TableCellFormat = 'text' | 'number' | 'date' | 'datetime' | 'badge' | 'code';
|
|
4
5
|
export type TableAlign = 'left' | 'center' | 'right';
|
|
@@ -61,3 +62,14 @@ export type TableToggle = {
|
|
|
61
62
|
key: TableRowKey;
|
|
62
63
|
open: boolean;
|
|
63
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* A press on a row: which row, with which button, and the browser's event. The event says where the pointer is
|
|
67
|
+
* (`clientX`, `clientY`); cancelling it (`event.preventDefault()`) refuses the press: the browser's menu does not
|
|
68
|
+
* show for the secondary button, and an expandable row stays as it is for the main one.
|
|
69
|
+
*/
|
|
70
|
+
export type TablePress<Row extends object = TableRow> = {
|
|
71
|
+
key: TableRowKey;
|
|
72
|
+
row: Row;
|
|
73
|
+
button: PressButton;
|
|
74
|
+
event: MouseEvent;
|
|
75
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PressButton } from './press.types';
|
|
1
2
|
export type TreeItem = {
|
|
2
3
|
id: string;
|
|
3
4
|
label: string;
|
|
@@ -14,6 +15,22 @@ export type TreeItem = {
|
|
|
14
15
|
/** A count or a short word after the label: how many items a folder holds. */
|
|
15
16
|
badge?: string | number;
|
|
16
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* A press on an item: which one, with which button, and the browser's event. The main button is a pointer's or the
|
|
20
|
+
* keyboard's (Enter, Space); the others are always a pointer's event, which says where it is (`clientX`,
|
|
21
|
+
* `clientY`). Cancelling the event (`event.preventDefault()`) refuses the press: the item is not selected, its
|
|
22
|
+
* folder stays as it is, a link is not followed, and the browser's menu does not show.
|
|
23
|
+
*/
|
|
24
|
+
export type TreePress = {
|
|
25
|
+
id: string;
|
|
26
|
+
item: TreeItem;
|
|
27
|
+
} & ({
|
|
28
|
+
button: Extract<PressButton, 'main'>;
|
|
29
|
+
event: MouseEvent | KeyboardEvent;
|
|
30
|
+
} | {
|
|
31
|
+
button: Exclude<PressButton, 'main'>;
|
|
32
|
+
event: MouseEvent;
|
|
33
|
+
});
|
|
17
34
|
/** One page of a level, as a loader answers it: some of its items, and how many the level has in all. */
|
|
18
35
|
export type TreePage = {
|
|
19
36
|
items: TreeItem[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The button of a press on a row or an item: the main one (a click, a tap, Enter), the auxiliary one (a middle
|
|
3
|
+
* click), or the secondary one, which asks for a menu (a right click, the keyboard's menu key, a long press on a
|
|
4
|
+
* touch screen).
|
|
5
|
+
*/
|
|
6
|
+
export type PressButton = 'main' | 'auxiliary' | 'secondary';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syware/jlib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "A tree-shakeable component library on Jadis and native Web Components, organised in atomic design",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -75,19 +75,20 @@
|
|
|
75
75
|
"size": "npm run build:lib && npm run size:report",
|
|
76
76
|
"size:report": "node scripts/size-report.mjs",
|
|
77
77
|
"test": "vitest run",
|
|
78
|
-
"
|
|
78
|
+
"prepare": "node scripts/refresh-skills.mjs",
|
|
79
79
|
"test:watch": "vitest",
|
|
80
80
|
"test:e2e": "npm run build:site && vitest run --config vitest.e2e.config.ts",
|
|
81
81
|
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
82
82
|
"lint": "biome check .",
|
|
83
83
|
"format": "biome check --write .",
|
|
84
84
|
"check": "npm run generate -- --check && npm run lint && npm run typecheck && npm run test",
|
|
85
|
+
"check:pack": "node scripts/pack-check.mjs",
|
|
85
86
|
"prepack": "npm run build:lib",
|
|
86
87
|
"prepublishOnly": "npm run check",
|
|
87
88
|
"version": "node scripts/plugin-version.mjs"
|
|
88
89
|
},
|
|
89
90
|
"peerDependencies": {
|
|
90
|
-
"@jadis/core": "^1.
|
|
91
|
+
"@jadis/core": "^1.9.0"
|
|
91
92
|
},
|
|
92
93
|
"dependencies": {
|
|
93
94
|
"lucide": "^1.61.0"
|
|
@@ -96,8 +97,9 @@
|
|
|
96
97
|
"@biomejs/biome": "^2.6.3",
|
|
97
98
|
"@fontsource-variable/jetbrains-mono": "^5.3.0",
|
|
98
99
|
"@fontsource-variable/manrope": "^5.3.0",
|
|
99
|
-
"@jadis/core": "^1.
|
|
100
|
+
"@jadis/core": "^1.9.0",
|
|
100
101
|
"@types/node": "^24.13.3",
|
|
102
|
+
"axe-core": "^4.14.0",
|
|
101
103
|
"happy-dom": "^21.0.4",
|
|
102
104
|
"playwright-core": "^1.64.1",
|
|
103
105
|
"typescript": "^7.0.2",
|