@syware/jlib 0.6.0 → 0.7.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/dist/all.js +9 -4
- package/dist/atoms/jl-app-icon.d.ts +5 -0
- package/dist/atoms/jl-app-icon.js +26 -4
- package/dist/atoms/jl-badge.js +1 -1
- package/dist/atoms/jl-button.d.ts +5 -0
- package/dist/atoms/jl-button.js +4 -1
- package/dist/atoms/jl-chip.js +3 -2
- package/dist/atoms/jl-input.js +4 -3
- package/dist/atoms/jl-link.js +1 -1
- package/dist/atoms/jl-rating.js +4 -5
- package/dist/atoms/jl-select.css_raw.js +1 -1
- package/dist/atoms/jl-select.d.ts +3 -2
- package/dist/atoms/jl-select.js +5 -4
- package/dist/atoms/jl-spinner.js +2 -2
- package/dist/base/jl-form-control.js +2 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -3
- package/dist/lib/app-icon.d.ts +8 -0
- package/dist/lib/app-icon.js +37 -0
- package/dist/lib/dom.d.ts +2 -0
- package/dist/lib/dom.js +3 -1
- package/dist/lib/download.d.ts +10 -0
- package/dist/lib/download.js +62 -0
- package/dist/lib/icons.d.ts +4 -0
- package/dist/lib/icons.js +7 -4
- package/dist/lib/input-list.d.ts +12 -0
- package/dist/lib/input-list.js +14 -0
- package/dist/lib/internals.d.ts +5 -0
- package/dist/lib/internals.js +18 -0
- package/dist/lib/palette.js +6 -0
- package/dist/lib/resize.d.ts +2 -0
- package/dist/lib/resize.js +10 -0
- package/dist/lib/table.d.ts +6 -1
- package/dist/lib/table.js +16 -1
- package/dist/lib/text.d.ts +2 -0
- package/dist/lib/text.js +4 -1
- package/dist/lib/texts.d.ts +97 -0
- package/dist/lib/texts.js +102 -0
- package/dist/lib/tree.d.ts +10 -1
- package/dist/lib/tree.js +37 -3
- package/dist/molecules/jl-account-button.js +1 -1
- package/dist/molecules/jl-alert.js +2 -1
- package/dist/molecules/jl-breadcrumb.js +3 -3
- package/dist/molecules/jl-calendar.js +4 -4
- package/dist/molecules/jl-chip-group.js +2 -2
- package/dist/molecules/jl-code-block.css_raw.js +1 -1
- package/dist/molecules/jl-code-block.d.ts +5 -0
- package/dist/molecules/jl-code-block.js +5 -2
- package/dist/molecules/jl-combobox.js +5 -6
- package/dist/molecules/jl-copy-button.js +5 -4
- package/dist/molecules/jl-date-picker.js +6 -7
- package/dist/molecules/jl-empty.js +1 -1
- package/dist/molecules/jl-facts.css_raw.js +3 -0
- package/dist/molecules/jl-facts.d.ts +35 -0
- package/dist/molecules/jl-facts.js +64 -0
- package/dist/molecules/jl-file-drop.d.ts +5 -0
- package/dist/molecules/jl-file-drop.js +17 -14
- package/dist/molecules/jl-input-list.css_raw.js +3 -0
- package/dist/molecules/jl-input-list.d.ts +79 -0
- package/dist/molecules/jl-input-list.js +177 -0
- package/dist/molecules/jl-load-more.css_raw.js +3 -0
- package/dist/molecules/jl-load-more.d.ts +41 -0
- package/dist/molecules/jl-load-more.js +62 -0
- package/dist/molecules/jl-load-state.js +6 -7
- package/dist/molecules/jl-number-input.js +4 -4
- package/dist/molecules/jl-pagination.js +5 -5
- package/dist/molecules/jl-radio-group.js +2 -2
- package/dist/molecules/jl-search-button.js +4 -4
- package/dist/molecules/jl-search.js +4 -4
- package/dist/molecules/jl-segmented.js +2 -1
- package/dist/molecules/jl-steps.css_raw.js +1 -1
- package/dist/molecules/jl-steps.d.ts +2 -0
- package/dist/molecules/jl-steps.js +30 -14
- package/dist/molecules/jl-tabs.js +2 -1
- package/dist/molecules/jl-tag-input.js +2 -2
- package/dist/molecules/jl-toast.css_raw.js +1 -1
- package/dist/molecules/jl-toast.d.ts +13 -1
- package/dist/molecules/jl-toast.js +23 -3
- package/dist/organisms/jl-command-palette.css_raw.js +1 -1
- package/dist/organisms/jl-command-palette.d.ts +14 -0
- package/dist/organisms/jl-command-palette.js +39 -9
- package/dist/organisms/jl-confirm.js +5 -7
- package/dist/organisms/jl-dialog.js +2 -1
- package/dist/organisms/jl-drawer.js +2 -1
- package/dist/organisms/jl-flow.js +12 -12
- package/dist/organisms/jl-navbar.js +6 -6
- package/dist/organisms/jl-side-nav.css_raw.js +1 -1
- package/dist/organisms/jl-side-nav.d.ts +33 -1
- package/dist/organisms/jl-side-nav.js +70 -13
- package/dist/organisms/jl-tab-bar.js +2 -2
- package/dist/organisms/jl-table.css_raw.js +1 -1
- package/dist/organisms/jl-table.d.ts +9 -0
- package/dist/organisms/jl-table.js +35 -5
- package/dist/organisms/jl-toaster.d.ts +9 -1
- package/dist/organisms/jl-toaster.js +148 -7
- package/dist/organisms/jl-tree.css_raw.js +1 -1
- package/dist/organisms/jl-tree.d.ts +71 -4
- package/dist/organisms/jl-tree.js +303 -40
- package/dist/templates/jl-app-shell.css_raw.js +1 -1
- package/dist/templates/jl-app-shell.d.ts +10 -0
- package/dist/templates/jl-app-shell.js +16 -2
- package/dist/templates/jl-auth-layout.js +1 -1
- package/dist/templates/jl-page.js +3 -3
- package/dist/templates/jl-split-view.js +5 -4
- package/dist/types/jl-app-icon.types.d.ts +5 -0
- package/dist/types/jl-command-palette.types.d.ts +7 -0
- package/dist/types/jl-facts.types.d.ts +17 -0
- package/dist/types/jl-side-nav.types.d.ts +2 -0
- package/dist/types/jl-steps.types.d.ts +2 -0
- package/dist/types/jl-table.types.d.ts +9 -2
- package/dist/types/jl-toaster.types.d.ts +42 -1
- package/dist/types/jl-tree.types.d.ts +26 -0
- package/dist/types/texts.types.d.ts +5 -0
- package/package.json +3 -3
|
@@ -3,6 +3,7 @@ import { JlElement } from "../base/jl-element.js";
|
|
|
3
3
|
import { oneOf } from "../lib/attributes.js";
|
|
4
4
|
import { define } from "../lib/define.js";
|
|
5
5
|
import { registerIcons } from "../lib/icons.js";
|
|
6
|
+
import { jlText } from "../lib/texts.js";
|
|
6
7
|
import { setOrRemove } from "../lib/dom.js";
|
|
7
8
|
import { JlButton } from "../atoms/jl-button.js";
|
|
8
9
|
import { JlPageHeader } from "../organisms/jl-page-header.js";
|
|
@@ -20,7 +21,6 @@ var PAGE_WIDTHS = [
|
|
|
20
21
|
"full"
|
|
21
22
|
];
|
|
22
23
|
var BREADCRUMB_SLOT = "breadcrumb";
|
|
23
|
-
var DEFAULT_BACK_LABEL = "Back";
|
|
24
24
|
var TITLE_SEPARATOR = " · ";
|
|
25
25
|
/**
|
|
26
26
|
* A page of an app: its header (a back link named after the page it leads to, the heading, a sentence on what the
|
|
@@ -48,7 +48,7 @@ var JlPage = class extends JlElement {
|
|
|
48
48
|
appName = this.useChange("", () => this.renderTitle(), { attribute: "app-name" });
|
|
49
49
|
_refs = this.useRefs((ref) => ({
|
|
50
50
|
back: ref(".back"),
|
|
51
|
-
header: ref(
|
|
51
|
+
header: ref(JlPageHeader)
|
|
52
52
|
}));
|
|
53
53
|
templateHtml() {
|
|
54
54
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -88,7 +88,7 @@ var JlPage = class extends JlElement {
|
|
|
88
88
|
const back = this._refs.back;
|
|
89
89
|
const href = this.back.get();
|
|
90
90
|
back.href.set(href);
|
|
91
|
-
back.label.set(this.backLabel.get() ||
|
|
91
|
+
back.label.set(this.backLabel.get() || jlText("back"));
|
|
92
92
|
setOrRemove(back, "slot", href === "" ? "" : BREADCRUMB_SLOT);
|
|
93
93
|
}
|
|
94
94
|
renderTitle() {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BASE_STYLES } from "../styles/shared.js";
|
|
2
2
|
import { JlElement } from "../base/jl-element.js";
|
|
3
3
|
import { clampedNumber, oneOf } from "../lib/attributes.js";
|
|
4
|
+
import { jlText } from "../lib/texts.js";
|
|
5
|
+
import { watchSizes } from "../lib/resize.js";
|
|
4
6
|
import { clampMin, clampSplit, positionAfterKey, positionAt } from "../lib/split.js";
|
|
5
7
|
import jl_split_view_default from "./jl-split-view.css_raw.js";
|
|
6
8
|
import { css } from "@jadis/core";
|
|
@@ -13,7 +15,6 @@ var DEFAULT_MIN = 15;
|
|
|
13
15
|
var FULL = 100;
|
|
14
16
|
var MAX_MIN = 50;
|
|
15
17
|
var PRIMARY_BUTTON = 0;
|
|
16
|
-
var DEFAULT_LABEL = "Resize the panes";
|
|
17
18
|
var STACKED = "stacked";
|
|
18
19
|
var MAX_STACK_WIDTH = 4e3;
|
|
19
20
|
var SEPARATOR_ORIENTATION = {
|
|
@@ -61,11 +62,11 @@ var JlSplitView = class extends JlElement {
|
|
|
61
62
|
parse: oneOf(SPLIT_PANES, "start")
|
|
62
63
|
});
|
|
63
64
|
/** The divider's name for screen readers. */
|
|
64
|
-
label = this.useChange(
|
|
65
|
-
this._refs.divider.setAttribute("aria-label", value === "" ?
|
|
65
|
+
label = this.useChange(jlText("resizePanes"), (value) => {
|
|
66
|
+
this._refs.divider.setAttribute("aria-label", value === "" ? jlText("resizePanes") : value);
|
|
66
67
|
}, { attribute: "label" });
|
|
67
68
|
_drag = { from: DEFAULT_POSITION };
|
|
68
|
-
_resize =
|
|
69
|
+
_resize = watchSizes(() => this.renderStacked());
|
|
69
70
|
/** Whether it shows one pane at a time now. */
|
|
70
71
|
isStacked() {
|
|
71
72
|
return this.hasAttribute(STACKED);
|
|
@@ -4,10 +4,17 @@ export type PaletteCommand = {
|
|
|
4
4
|
/** The heading the command is listed under. */
|
|
5
5
|
group?: string;
|
|
6
6
|
icon?: string;
|
|
7
|
+
/** What it is, beside its label and quieter: a record's type, a person's username. Tells apart two of one name. */
|
|
8
|
+
description?: string;
|
|
7
9
|
/** Keys shown beside it, joined by `+`: `mod+shift+p` (`mod` is ⌘ on Apple, Ctrl elsewhere). */
|
|
8
10
|
shortcut?: string;
|
|
9
11
|
/** Other words that find it: `["preferences", "options"]` for "Settings". */
|
|
10
12
|
keywords?: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Found by the page for what was typed (a record, a person, "Open" with the ID pasted): listed whatever the
|
|
15
|
+
* search, since the page chose it already, after the commands the search matches.
|
|
16
|
+
*/
|
|
17
|
+
result?: boolean;
|
|
11
18
|
};
|
|
12
19
|
/** A command that matches the search, with the places of the matched letters in its label. */
|
|
13
20
|
export type PaletteMatch = {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** One fact about a thing: its label and value. A fact without a value is left out. */
|
|
2
|
+
export type Fact = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string | number | null;
|
|
5
|
+
/** Drawn in the monospace font and broken anywhere: an identifier, a digest, a path. */
|
|
6
|
+
code?: boolean;
|
|
7
|
+
/** An address: the value is a link to it. */
|
|
8
|
+
href?: string;
|
|
9
|
+
/** The value's tooltip. */
|
|
10
|
+
hint?: string;
|
|
11
|
+
/** Names the fact for a renderer of `renderers`, which then draws its value. */
|
|
12
|
+
key?: string;
|
|
13
|
+
};
|
|
14
|
+
/** Draws a fact's value: a badge, links, a list. */
|
|
15
|
+
export type FactRenderer = (fact: Fact) => Node;
|
|
16
|
+
/** `horizontal` puts each label beside its value, `vertical` over it, the facts side by side. */
|
|
17
|
+
export type FactsOrientation = 'horizontal' | 'vertical';
|
|
@@ -6,6 +6,8 @@ export type SideNavItem = {
|
|
|
6
6
|
icon?: string;
|
|
7
7
|
/** A link to follow; without it the item is a button that fires `select`. */
|
|
8
8
|
href?: string;
|
|
9
|
+
/** Where the link opens: `_blank` for a new tab (the API's documentation beside the app). */
|
|
10
|
+
target?: string;
|
|
9
11
|
/** A count or a short word beside the label: `3`, `New`. */
|
|
10
12
|
badge?: string | number;
|
|
11
13
|
children?: SideNavItem[];
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
export type StepItem = {
|
|
3
3
|
label: string;
|
|
4
4
|
description?: string;
|
|
5
|
+
/** The step ended in failure (a payment refused, a transaction rolled back): an × in the danger colour. */
|
|
6
|
+
failed?: boolean;
|
|
5
7
|
};
|
|
6
8
|
export type StepsOrientation = 'horizontal' | 'vertical';
|
|
7
9
|
/** Where a step stands against the current one. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Tone } from './options.types';
|
|
2
|
-
/** How a cell shows its value: as it is, a localised number or date, a badge, or code. */
|
|
3
|
-
export type TableCellFormat = 'text' | 'number' | 'date' | 'badge' | 'code';
|
|
2
|
+
/** How a cell shows its value: as it is, a localised number, date or date and time, a badge, or code. */
|
|
3
|
+
export type TableCellFormat = 'text' | 'number' | 'date' | 'datetime' | 'badge' | 'code';
|
|
4
4
|
export type TableAlign = 'left' | 'center' | 'right';
|
|
5
5
|
/** The order of a sorted column; `none` keeps the rows as they came. */
|
|
6
6
|
export type TableSortDirection = 'asc' | 'desc' | 'none';
|
|
@@ -16,6 +16,13 @@ export type TableColumn = {
|
|
|
16
16
|
format?: TableCellFormat;
|
|
17
17
|
/** For badges: the tone of each value (`{ "Active": "ok" }`); neutral otherwise. */
|
|
18
18
|
tones?: Record<string, Tone>;
|
|
19
|
+
/** The row's field shown as a quieter line under the value: a package's format under its name. */
|
|
20
|
+
description?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Long text, a description or a note, breaks over lines instead of widening the table; cells stay on one line
|
|
23
|
+
* otherwise.
|
|
24
|
+
*/
|
|
25
|
+
wrap?: boolean;
|
|
19
26
|
};
|
|
20
27
|
export type TableRow = Record<string, unknown>;
|
|
21
28
|
/** A row's identity, the value of its `row-key` field. */
|
|
@@ -16,8 +16,49 @@ export type ToastOptions = {
|
|
|
16
16
|
actionLabel?: string;
|
|
17
17
|
/** Called when that button is pressed; the toast then closes. */
|
|
18
18
|
onAction?: () => void;
|
|
19
|
+
/** Shows a progress bar under the text, while the work it tells about runs. */
|
|
20
|
+
working?: boolean;
|
|
21
|
+
/** How far that work is, in percent; `null` for work of unknown length. */
|
|
22
|
+
progress?: number | null;
|
|
19
23
|
};
|
|
20
|
-
/** What `toast()` returns: a way to
|
|
24
|
+
/** What `toast()` returns: a way to change the notification while it shows, and to close it before its time. */
|
|
21
25
|
export type ToastHandle = {
|
|
26
|
+
/** Changes what the toast says (its text, tone, progress, action…): the options given replace those it had. */
|
|
27
|
+
update(changes: ToastOptions): void;
|
|
22
28
|
dismiss(): void;
|
|
23
29
|
};
|
|
30
|
+
/** The texts a download's toast shows: `{time}`, `{received}`, `{total}`, `{name}`, `{size}` and `{error}` are filled. */
|
|
31
|
+
export type DownloadTexts = {
|
|
32
|
+
/** While the server prepares the file: "Preparing the file… {time}". */
|
|
33
|
+
preparing: string;
|
|
34
|
+
/** Bytes received, of a size the server did not say: "{received} received". */
|
|
35
|
+
received: string;
|
|
36
|
+
/** Bytes received of the size the server said: "{received} of {total}". */
|
|
37
|
+
receivedOf: string;
|
|
38
|
+
/** Saved: "Saved as {name}, {size}". */
|
|
39
|
+
saved: string;
|
|
40
|
+
/** Failed: "Not downloaded: {error}". */
|
|
41
|
+
failed: string;
|
|
42
|
+
/** The action that stops it. */
|
|
43
|
+
cancel: string;
|
|
44
|
+
};
|
|
45
|
+
export type DownloadOptions = {
|
|
46
|
+
/** The toast's heading: what is downloaded ("METS of Letters 1902"); the file's name otherwise. */
|
|
47
|
+
title?: string;
|
|
48
|
+
/** The name to save under when the server gives none; the address's last segment otherwise. */
|
|
49
|
+
fileName?: string;
|
|
50
|
+
/** The request's options: headers, credentials… */
|
|
51
|
+
init?: RequestInit;
|
|
52
|
+
texts?: Partial<DownloadTexts>;
|
|
53
|
+
};
|
|
54
|
+
/** How a download ended: saved (under a name, its size in bytes), failed (why), or canceled. */
|
|
55
|
+
export type DownloadResult = {
|
|
56
|
+
outcome: 'saved';
|
|
57
|
+
name: string;
|
|
58
|
+
size: number;
|
|
59
|
+
} | {
|
|
60
|
+
outcome: 'failed';
|
|
61
|
+
error: string;
|
|
62
|
+
} | {
|
|
63
|
+
outcome: 'canceled';
|
|
64
|
+
};
|
|
@@ -5,7 +5,33 @@ export type TreeItem = {
|
|
|
5
5
|
icon?: string;
|
|
6
6
|
/** Present, even empty, the item is a folder that opens. */
|
|
7
7
|
children?: TreeItem[];
|
|
8
|
+
/** A folder whose children the tree's `loader` brings, the first time it opens. */
|
|
9
|
+
lazy?: boolean;
|
|
10
|
+
/** An address: the row is a link, which a middle click opens in a new tab, and it fires no `select`. */
|
|
11
|
+
href?: string;
|
|
12
|
+
/** The row's tooltip, such as the whole name of an item whose label is short. */
|
|
13
|
+
hint?: string;
|
|
14
|
+
/** A count or a short word after the label: how many items a folder holds. */
|
|
15
|
+
badge?: string | number;
|
|
8
16
|
};
|
|
17
|
+
/** One page of a level, as a loader answers it: some of its items, and how many the level has in all. */
|
|
18
|
+
export type TreePage = {
|
|
19
|
+
items: TreeItem[];
|
|
20
|
+
total: number;
|
|
21
|
+
};
|
|
22
|
+
/** Loads a page of a level, from `offset` on: the roots when `parent` is null. */
|
|
23
|
+
export type TreeLoader = (parent: string | null, offset: number) => Promise<TreePage>;
|
|
24
|
+
/** A level the tree loads: how many items it has in all, the page on its way, and the last load's error. */
|
|
25
|
+
export type TreeLevel = {
|
|
26
|
+
total: number;
|
|
27
|
+
pending: Promise<void> | null;
|
|
28
|
+
error: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The row that ends a level of the tree: its page on the way, the error of its last load, the button for its next
|
|
32
|
+
* page, the text of an empty tree, or none.
|
|
33
|
+
*/
|
|
34
|
+
export type TreeLevelEnd = 'loading' | 'error' | 'more' | 'empty' | 'none';
|
|
9
35
|
/** An item as listed: its depth from 1 at the roots, and its parent's id. */
|
|
10
36
|
export type VisibleTreeItem = {
|
|
11
37
|
item: TreeItem;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DEFAULT_TEXTS } from '../lib/texts';
|
|
2
|
+
/** The name of one of the texts jlib's components show on their own. */
|
|
3
|
+
export type JlTextKey = keyof typeof DEFAULT_TEXTS;
|
|
4
|
+
/** The texts in the page's language: some or all of them, the rest staying in English. */
|
|
5
|
+
export type JlTexts = Partial<Record<JlTextKey, string>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syware/jlib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.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",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"prepublishOnly": "npm run check"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
|
-
"@jadis/core": "^1.
|
|
88
|
+
"@jadis/core": "^1.4.0"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
91
|
"lucide": "^1.61.0"
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"@biomejs/biome": "^2.6.3",
|
|
95
95
|
"@fontsource-variable/jetbrains-mono": "^5.3.0",
|
|
96
96
|
"@fontsource-variable/manrope": "^5.3.0",
|
|
97
|
-
"@jadis/core": "^1.
|
|
97
|
+
"@jadis/core": "^1.4.1",
|
|
98
98
|
"@types/node": "^24.13.3",
|
|
99
99
|
"playwright-core": "^1.64.1",
|
|
100
100
|
"typescript": "^7.0.2",
|