@syware/jlib 0.11.1 → 0.12.1
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 +31 -11
- package/dist/atoms/jl-input.d.ts +2 -0
- package/dist/atoms/jl-input.js +7 -1
- package/dist/base/jl-form-control.d.ts +7 -0
- package/dist/base/jl-form-control.js +10 -0
- package/dist/molecules/jl-combobox.js +8 -2
- package/dist/molecules/jl-date-picker.js +5 -0
- package/dist/molecules/jl-number-input.js +4 -1
- package/dist/molecules/jl-search.js +1 -0
- package/dist/molecules/jl-tag-input.js +8 -2
- package/dist/organisms/jl-dialog.css.js +1 -1
- package/dist/organisms/jl-drawer.css.js +1 -1
- package/dist/organisms/jl-page-header.css.js +1 -1
- package/dist/organisms/jl-side-nav.css.js +1 -1
- package/dist/organisms/jl-table.css.js +1 -1
- package/dist/organisms/jl-tree.d.ts +17 -0
- package/dist/organisms/jl-tree.js +67 -9
- package/dist/templates/jl-split-view.css.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,18 +83,38 @@ part of the page.
|
|
|
83
83
|
|
|
84
84
|
## Vibe coding
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
Two skills teach coding agents to build on jlib: `jlib-official`, the components (each one's whole API, offline),
|
|
87
|
+
the way an app is written on them, the mistakes agents make and a self-check; and `syware-ux`, how SyWare's apps
|
|
88
|
+
behave, every UX pattern in full and the checklist a page is reviewed against. They build on Jadis's skill,
|
|
89
|
+
`jadis-official`. Install them in one of three ways:
|
|
89
90
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
- **Claude Code**, as plugins that update with each release; `syware-ux` brings `jlib-official`, which brings
|
|
92
|
+
`jadis-official` (for an app that does not follow SyWare's UX, install `jlib-official@jlib`):
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
/plugin marketplace add bioleyl/jadis
|
|
96
|
+
/plugin marketplace add bioleyl/jlib
|
|
97
|
+
/plugin install syware-ux@jlib
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
- **Any agent**, with [skills.sh](https://skills.sh) (Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot,
|
|
101
|
+
OpenCode…):
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npx skills add bioleyl/jlib
|
|
105
|
+
npx skills add bioleyl/jadis
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
- **Any agent**, with the install script, which asks which skills and where: `~/.agents/skills`, `~/.claude/skills`,
|
|
109
|
+
the project's `.agents/skills` or `.claude/skills`, or another folder (`--help` for the options):
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
curl -fsSL https://raw.githubusercontent.com/bioleyl/jlib/main/install-skill.sh | sh
|
|
113
|
+
```
|
|
95
114
|
|
|
96
|
-
|
|
97
|
-
[
|
|
115
|
+
The skills are in [plugins/](plugins): [jlib-official](plugins/jlib-official/skills/jlib-official/SKILL.md) and
|
|
116
|
+
[syware-ux](plugins/syware-ux/skills/syware-ux/SKILL.md). How a team shares them and how to ask well: the site's
|
|
117
|
+
[Vibe coding](https://bioleyl.github.io/jlib/vibe-coding) page.
|
|
98
118
|
|
|
99
119
|
## Development
|
|
100
120
|
|
|
@@ -108,7 +128,7 @@ npm run size # what each component adds to a bundle
|
|
|
108
128
|
```
|
|
109
129
|
|
|
110
130
|
`src/index.ts` and `src/all.ts` are generated from the component folders, and the plugins' lists of components and
|
|
111
|
-
patterns from their documentation pages: run `npm run generate` after adding a component or a pattern. Conventions for contributors are in [
|
|
131
|
+
patterns from their documentation pages: run `npm run generate` after adding a component or a pattern. Conventions for contributors are in [AGENTS.md](AGENTS.md).
|
|
112
132
|
|
|
113
133
|
## Releasing
|
|
114
134
|
|
package/dist/atoms/jl-input.d.ts
CHANGED
|
@@ -102,6 +102,8 @@ export declare class JlInput extends JlFormControl {
|
|
|
102
102
|
templateHtml(): Node;
|
|
103
103
|
templateCss(): string;
|
|
104
104
|
onConnect(): void;
|
|
105
|
+
/** Enter: `enter` for the page, then the form submits, as from a native field. */
|
|
106
|
+
private onKey;
|
|
105
107
|
protected resetValue(): void;
|
|
106
108
|
/** The browser calls it for a disabled fieldset and for the element's own disabled attribute, even before render. */
|
|
107
109
|
protected setDisabledByForm(disabled: boolean): void;
|
package/dist/atoms/jl-input.js
CHANGED
|
@@ -142,10 +142,16 @@ var JlInput = class extends JlFormControl {
|
|
|
142
142
|
this.events.emit("input", native.value);
|
|
143
143
|
});
|
|
144
144
|
this.on(native, "change", () => this.events.emit("change", native.value));
|
|
145
|
-
this.on(native, "keydown", (event) =>
|
|
145
|
+
this.on(native, "keydown", (event) => this.onKey(event));
|
|
146
146
|
this.on(this._refs.clear, "click", () => this.clearValue());
|
|
147
147
|
this.on(this._refs.reveal, "click", () => this.toggleReveal());
|
|
148
148
|
}
|
|
149
|
+
/** Enter: `enter` for the page, then the form submits, as from a native field. */
|
|
150
|
+
onKey(event) {
|
|
151
|
+
if (event.key !== ENTER) return;
|
|
152
|
+
this.events.emit("enter", this._refs.native.value);
|
|
153
|
+
this.submitImplicitly(event);
|
|
154
|
+
}
|
|
149
155
|
resetValue() {
|
|
150
156
|
this.value.set(this.getAttribute("value") ?? "");
|
|
151
157
|
}
|
|
@@ -23,6 +23,13 @@ export declare abstract class JlFormControl extends JlElement {
|
|
|
23
23
|
formDisabledCallback(disabled: boolean): void;
|
|
24
24
|
protected abstract resetValue(): void;
|
|
25
25
|
protected abstract setDisabledByForm(disabled: boolean): void;
|
|
26
|
+
/**
|
|
27
|
+
* Submits the form the field belongs to, as Enter in a native field of one line does. The native field inside the
|
|
28
|
+
* shadow root belongs to no form, so the browser's own implicit submission never reaches the page's: each field of
|
|
29
|
+
* one line calls this for an Enter it did not use itself. Nothing during a composition (an IME choosing a word), or
|
|
30
|
+
* outside a form; `requestSubmit` checks the form's fields first, as a submit button does.
|
|
31
|
+
*/
|
|
32
|
+
protected submitImplicitly(event: KeyboardEvent): void;
|
|
26
33
|
/** Copies the native field's validity, so the form sees the same errors the browser would show. */
|
|
27
34
|
protected mirrorValidity(native: ValidatedElement): void;
|
|
28
35
|
}
|
|
@@ -33,6 +33,16 @@ var JlFormControl = class extends JlElement {
|
|
|
33
33
|
formDisabledCallback(disabled) {
|
|
34
34
|
this.setDisabledByForm(disabled);
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Submits the form the field belongs to, as Enter in a native field of one line does. The native field inside the
|
|
38
|
+
* shadow root belongs to no form, so the browser's own implicit submission never reaches the page's: each field of
|
|
39
|
+
* one line calls this for an Enter it did not use itself. Nothing during a composition (an IME choosing a word), or
|
|
40
|
+
* outside a form; `requestSubmit` checks the form's fields first, as a submit button does.
|
|
41
|
+
*/
|
|
42
|
+
submitImplicitly(event) {
|
|
43
|
+
if (event.isComposing) return;
|
|
44
|
+
this.internals.form?.requestSubmit();
|
|
45
|
+
}
|
|
36
46
|
/** Copies the native field's validity, so the form sees the same errors the browser would show. */
|
|
37
47
|
mirrorValidity(native) {
|
|
38
48
|
if (native.validity.valid) {
|
|
@@ -195,13 +195,19 @@ var JlCombobox = class extends JlFormControl {
|
|
|
195
195
|
this.openList(true);
|
|
196
196
|
}
|
|
197
197
|
onKey(event) {
|
|
198
|
-
|
|
198
|
+
const handler = (/* @__PURE__ */ new Map([
|
|
199
199
|
["ArrowDown", () => this.onArrow(1, event.altKey)],
|
|
200
200
|
["ArrowUp", () => this.onArrow(-1, event.altKey)],
|
|
201
201
|
["Enter", () => this.onEnter()],
|
|
202
202
|
["Escape", () => this.onEscape()],
|
|
203
203
|
["Tab", () => this.onTab()]
|
|
204
|
-
])).get(event.key)
|
|
204
|
+
])).get(event.key);
|
|
205
|
+
if (handler === void 0) return;
|
|
206
|
+
if (handler()) {
|
|
207
|
+
event.preventDefault();
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
if (event.key === "Enter") this.submitImplicitly(event);
|
|
205
211
|
}
|
|
206
212
|
/** Down opens the list or moves down it; Alt + Down opens it as it is, Alt + Up closes it. */
|
|
207
213
|
onArrow(direction, alt) {
|
|
@@ -197,6 +197,11 @@ var JlDatePicker = class extends JlFormControl {
|
|
|
197
197
|
if (event.key === "ArrowDown") {
|
|
198
198
|
event.preventDefault();
|
|
199
199
|
this.openPopup();
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (event.key === "Enter") {
|
|
203
|
+
this.commitText();
|
|
204
|
+
this.submitImplicitly(event);
|
|
200
205
|
}
|
|
201
206
|
}
|
|
202
207
|
onOpenPress() {
|
|
@@ -139,7 +139,10 @@ var JlNumberInput = class extends JlFormControl {
|
|
|
139
139
|
["ArrowDown", () => this.stepBy(-1)],
|
|
140
140
|
["ArrowUp", () => this.stepBy(1)],
|
|
141
141
|
["End", () => this.goToBound(this.max.get())],
|
|
142
|
-
["Enter", () =>
|
|
142
|
+
["Enter", () => {
|
|
143
|
+
this.commitText();
|
|
144
|
+
this.submitImplicitly(event);
|
|
145
|
+
}],
|
|
143
146
|
["Home", () => this.goToBound(this.min.get())],
|
|
144
147
|
["PageDown", () => this.stepBy(-10)],
|
|
145
148
|
["PageUp", () => this.stepBy(PAGE_STEPS)]
|
|
@@ -166,6 +166,7 @@ var JlSearch = class extends JlFormControl {
|
|
|
166
166
|
event.preventDefault();
|
|
167
167
|
this.search(this.value.get());
|
|
168
168
|
this.events.emit("enter", this.value.get());
|
|
169
|
+
this.submitImplicitly(event);
|
|
169
170
|
return;
|
|
170
171
|
}
|
|
171
172
|
if (event.key === "Escape" && this.value.get() !== "") {
|
|
@@ -164,7 +164,7 @@ var JlTagInput = class extends JlFormControl {
|
|
|
164
164
|
this.renderMatches();
|
|
165
165
|
}
|
|
166
166
|
onFieldKey(event) {
|
|
167
|
-
|
|
167
|
+
const handler = (/* @__PURE__ */ new Map([
|
|
168
168
|
[COMMA, () => {
|
|
169
169
|
this.commitText();
|
|
170
170
|
return true;
|
|
@@ -175,7 +175,13 @@ var JlTagInput = class extends JlFormControl {
|
|
|
175
175
|
["Backspace", () => this.removeLastIfEmpty()],
|
|
176
176
|
["Enter", () => this.onEnter()],
|
|
177
177
|
["Escape", () => this.closeList()]
|
|
178
|
-
])).get(event.key)
|
|
178
|
+
])).get(event.key);
|
|
179
|
+
if (handler === void 0) return;
|
|
180
|
+
if (handler()) {
|
|
181
|
+
event.preventDefault();
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (event.key === "Enter") this.submitImplicitly(event);
|
|
179
185
|
}
|
|
180
186
|
/** Enter adds the suggestion the arrows reached, or the typed text; in an empty field it submits the form. */
|
|
181
187
|
onEnter() {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/organisms/jl-dialog.css?inline
|
|
2
|
-
var jl_dialog_default = ":host{--width:520px;display:contents}:host([size=sm]){--width:400px}:host([size=lg]){--width:820px}:host([size=full]){--width:100vw}dialog{width:min(var(--width), calc(100vw - 32px));border:1px solid var(--jl-line);border-radius:var(--jl-radius-lg);background:var(--jl-surface);max-height:min(760px,100dvh - 48px);color:var(--jl-text);font-size:var(--jl-font-md);box-shadow:var(--jl-shadow-lg);flex-direction:column;padding:0;display:flex}dialog:not([open]){display:none}:host([size=full]) dialog{height:calc(100dvh - 32px);max-height:calc(100dvh - 32px)}dialog[open]{animation:rise var(--jl-slow) var(--jl-ease)}dialog::backdrop{background:var(--jl-scrim);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}header{align-items:flex-start;gap:12px;padding:20px 16px 4px 24px;display:flex}.titles{flex:1;gap:4px;padding-top:4px;display:grid}h2{letter-spacing:-.01em;font-size:17px;font-weight:650;line-height:1.3}.description{color:var(--jl-muted);font-size:var(--jl-font-sm);line-height:1.5}.body{flex:1;padding:16px 24px;line-height:1.55;overflow:auto}footer{flex-wrap:wrap;justify-content:flex-end;gap:8px;padding:0 24px 20px;display:flex}@keyframes rise{0%{opacity:0;transform:translateY(8px)scale(.98)}}";
|
|
2
|
+
var jl_dialog_default = ":host{--width:520px;display:contents}:host([size=sm]){--width:400px}:host([size=lg]){--width:820px}:host([size=full]){--width:100vw}dialog{width:min(var(--width), calc(100vw - 32px));border:1px solid var(--jl-line);border-radius:var(--jl-radius-lg);background:var(--jl-surface);max-height:min(760px,100dvh - 48px);color:var(--jl-text);font-size:var(--jl-font-md);box-shadow:var(--jl-shadow-lg);flex-direction:column;padding:0;display:flex}dialog:not([open]){display:none}:host([size=full]) dialog{height:calc(100dvh - 32px);max-height:calc(100dvh - 32px)}dialog[open]{animation:rise var(--jl-slow) var(--jl-ease)}dialog::backdrop{background:var(--jl-scrim);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}header{align-items:flex-start;gap:12px;padding:20px 16px 4px 24px;display:flex}.titles{flex:1;gap:4px;padding-top:4px;display:grid}h2{letter-spacing:-.01em;font-size:17px;font-weight:650;line-height:1.3}.description{color:var(--jl-muted);font-size:var(--jl-font-sm);line-height:1.5}.body{flex:1;padding:16px 24px;line-height:1.55;position:relative;overflow:auto}footer{flex-wrap:wrap;justify-content:flex-end;gap:8px;padding:0 24px 20px;display:flex}@keyframes rise{0%{opacity:0;transform:translateY(8px)scale(.98)}}";
|
|
3
3
|
export { jl_dialog_default as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/organisms/jl-drawer.css?inline
|
|
2
|
-
var jl_drawer_default = ":host{--size:420px;--from:translateX(100%);display:contents}:host([size=sm]){--size:320px}:host([size=lg]){--size:640px}:host([placement=left]){--from:translateX(-100%)}:host([placement=bottom]){--size:60dvh;--from:translateY(100%)}:host([placement=bottom][size=sm]){--size:40dvh}:host([placement=bottom][size=lg]){--size:88dvh}dialog{width:min(var(--size), calc(100vw - 24px));border:none;border-left:1px solid var(--jl-line);background:var(--jl-surface);max-width:none;height:100dvh;max-height:none;color:var(--jl-text);font-size:var(--jl-font-md);box-shadow:var(--jl-shadow-lg);transform:var(--from);transition:transform var(--jl-slow) var(--jl-ease), display var(--jl-slow) allow-discrete, overlay var(--jl-slow) allow-discrete;flex-direction:column;margin:0;padding:0;display:none;position:fixed;inset:0 0 0 auto}dialog[open]{display:flex;transform:none}@starting-style{dialog[open]{transform:var(--from)}}:host([placement=left]) dialog{border-right:1px solid var(--jl-line);border-left:none;inset:0 auto 0 0}:host([placement=bottom]) dialog{width:100%;height:auto;max-height:var(--size);border:1px solid var(--jl-line);border-radius:var(--jl-radius-xl) var(--jl-radius-xl) 0 0;border-bottom:none;inset:auto 0 0}dialog::backdrop{transition:background var(--jl-slow) var(--jl-ease), display var(--jl-slow) allow-discrete, overlay var(--jl-slow) allow-discrete;background:0 0}dialog[open]::backdrop{background:var(--jl-scrim)}@starting-style{dialog[open]::backdrop{background:0 0}}.handle{display:none}:host([placement=bottom]) .handle{border-radius:var(--jl-radius-pill);background:var(--jl-line-strong);flex:none;width:40px;height:4px;margin:10px auto 0;display:block}header{border-bottom:1px solid var(--jl-line);flex:none;align-items:flex-start;gap:12px;padding:18px 16px 14px 24px;display:flex}:host([placement=bottom]) header{padding-top:10px}.titles{flex:1;gap:4px;min-width:0;padding-top:4px;display:grid}h2{letter-spacing:-.01em;font-size:17px;font-weight:650;line-height:1.3}.description{color:var(--jl-muted);font-size:var(--jl-font-sm);line-height:1.5}.actions{flex:none;align-items:center;gap:4px;display:flex}.body{overscroll-behavior:contain;flex:1;min-height:0;padding:20px 24px;line-height:1.55;overflow:auto}footer{border-top:1px solid var(--jl-line);background:var(--jl-surface);flex-wrap:wrap;flex:none;justify-content:flex-end;gap:8px;padding:14px 24px;display:flex}:host([placement=bottom]) footer{padding-bottom:max(14px, env(safe-area-inset-bottom))}";
|
|
2
|
+
var jl_drawer_default = ":host{--size:420px;--from:translateX(100%);display:contents}:host([size=sm]){--size:320px}:host([size=lg]){--size:640px}:host([placement=left]){--from:translateX(-100%)}:host([placement=bottom]){--size:60dvh;--from:translateY(100%)}:host([placement=bottom][size=sm]){--size:40dvh}:host([placement=bottom][size=lg]){--size:88dvh}dialog{width:min(var(--size), calc(100vw - 24px));border:none;border-left:1px solid var(--jl-line);background:var(--jl-surface);max-width:none;height:100dvh;max-height:none;color:var(--jl-text);font-size:var(--jl-font-md);box-shadow:var(--jl-shadow-lg);transform:var(--from);transition:transform var(--jl-slow) var(--jl-ease), display var(--jl-slow) allow-discrete, overlay var(--jl-slow) allow-discrete;flex-direction:column;margin:0;padding:0;display:none;position:fixed;inset:0 0 0 auto}dialog[open]{display:flex;transform:none}@starting-style{dialog[open]{transform:var(--from)}}:host([placement=left]) dialog{border-right:1px solid var(--jl-line);border-left:none;inset:0 auto 0 0}:host([placement=bottom]) dialog{width:100%;height:auto;max-height:var(--size);border:1px solid var(--jl-line);border-radius:var(--jl-radius-xl) var(--jl-radius-xl) 0 0;border-bottom:none;inset:auto 0 0}dialog::backdrop{transition:background var(--jl-slow) var(--jl-ease), display var(--jl-slow) allow-discrete, overlay var(--jl-slow) allow-discrete;background:0 0}dialog[open]::backdrop{background:var(--jl-scrim)}@starting-style{dialog[open]::backdrop{background:0 0}}.handle{display:none}:host([placement=bottom]) .handle{border-radius:var(--jl-radius-pill);background:var(--jl-line-strong);flex:none;width:40px;height:4px;margin:10px auto 0;display:block}header{border-bottom:1px solid var(--jl-line);flex:none;align-items:flex-start;gap:12px;padding:18px 16px 14px 24px;display:flex}:host([placement=bottom]) header{padding-top:10px}.titles{flex:1;gap:4px;min-width:0;padding-top:4px;display:grid}h2{letter-spacing:-.01em;font-size:17px;font-weight:650;line-height:1.3}.description{color:var(--jl-muted);font-size:var(--jl-font-sm);line-height:1.5}.actions{flex:none;align-items:center;gap:4px;display:flex}.body{overscroll-behavior:contain;flex:1;min-height:0;padding:20px 24px;line-height:1.55;position:relative;overflow:auto}footer{border-top:1px solid var(--jl-line);background:var(--jl-surface);flex-wrap:wrap;flex:none;justify-content:flex-end;gap:8px;padding:14px 24px;display:flex}:host([placement=bottom]) footer{padding-bottom:max(14px, env(safe-area-inset-bottom))}";
|
|
3
3
|
export { jl_drawer_default as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/organisms/jl-page-header.css?inline
|
|
2
|
-
var jl_page_header_default = ":host{display:block}.page-header{gap:12px;display:grid}:host([divided]) .page-header{border-bottom:1px solid var(--jl-line);padding-bottom:20px}.breadcrumb{color:var(--jl-muted);font-size:var(--jl-font-sm);line-height:1.4}.main{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:12px 24px;display:flex}.titles{flex:
|
|
2
|
+
var jl_page_header_default = ":host{display:block}.page-header{gap:12px;display:grid}:host([divided]) .page-header{border-bottom:1px solid var(--jl-line);padding-bottom:20px}.breadcrumb{color:var(--jl-muted);font-size:var(--jl-font-sm);line-height:1.4}.main{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:12px 24px;display:flex}.titles{flex:275px;gap:6px;min-width:0;display:grid}h1{color:var(--jl-text);letter-spacing:-.02em;overflow-wrap:anywhere;font-size:26px;font-weight:700;line-height:1.25}.description{max-width:72ch;color:var(--jl-muted);font-size:var(--jl-font-md);line-height:1.55}.actions{flex-wrap:wrap;align-items:center;gap:8px;padding-top:2px;display:flex}.meta{flex-wrap:wrap;align-items:center;gap:8px;display:flex}";
|
|
3
3
|
export { jl_page_header_default as default };
|
|
@@ -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
|
|
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::part(base){justify-content:flex-start;gap:10px;padding:0 9px}:host([rail]) .fold::part(base){justify-content:center;padding:0}.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}.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.open>.item .chevron,.entry.open>.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]) .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,3 +1,3 @@
|
|
|
1
1
|
// src/organisms/jl-table.css?inline
|
|
2
|
-
var jl_table_default = ":host{contain:inline-size;--max-height:none;--cell-y:10px;--cell-x:14px;--select-width:44px;--expand-width:36px;--lead:0px;display:block}:host([expandable]){--lead:var(--expand-width)}:host([expandable][selectable]){--expand-width:28px;--lead:calc(var(--select-width) + var(--expand-width))}:host([dense]){--cell-y:6px;--cell-x:12px}.scroll{max-height:var(--max-height);border:1px solid var(--jl-line);border-radius:var(--jl-radius);background:var(--jl-surface);overscroll-behavior-x:contain;overflow:auto}:host([expandable]) .scroll{container-type:inline-size}table{border-collapse:separate;border-spacing:0;width:100%;color:var(--jl-text);font-size:var(--jl-font-md);line-height:20px}th,td{padding:var(--cell-y) var(--cell-x);white-space:nowrap;vertical-align:middle}th{z-index:1;border-bottom:1px solid var(--jl-line);background:var(--jl-surface-2);color:var(--jl-muted);font-size:var(--jl-font-xs);letter-spacing:.01em;text-align:left;font-weight:600;position:sticky;top:0}td{border-top:1px solid var(--jl-line-soft)}tbody tr:first-child td{border-top:none}tbody tr.empty td{padding:40px var(--cell-x);color:var(--jl-muted);text-align:center}tbody tr.detail td{padding:0 var(--cell-x) calc(var(--cell-y) + 6px) calc(var(--lead) + var(--cell-x));white-space:normal;cursor:auto;border-top:none}.detail-body{left:calc(var(--lead) + var(--cell-x));max-width:calc(100cqi - var(--lead) - 2 * var(--cell-x));position:sticky}.align-left{text-align:left}.align-center{text-align:center}.align-right{text-align:right}.sort{border-radius:var(--jl-radius-xs);color:inherit;font-weight:inherit;letter-spacing:inherit;cursor:pointer;background:0 0;border:none;align-items:center;gap:4px;margin:-2px -4px;padding:2px 4px;display:inline-flex}.sort:hover{color:var(--jl-text)}.sort-icon{color:var(--jl-faint)}th[data-sorted]{color:var(--jl-text)}th[data-sorted] .sort-icon{color:var(--jl-accent)}tbody tr[data-selected] td,tbody tr[data-marked] td{background:var(--jl-accent-soft)}tbody tr[data-marked] td:first-child{box-shadow:inset 3px 0 0 var(--jl-accent)}tbody tr:not(.empty,.skeleton,.detail,[data-selected]):hover td,:host([striped]) tbody tr:nth-child(2n of :where(:not(.detail))):not(.empty,[data-selected],[data-marked]) td{background:var(--jl-surface-2)}:host([striped]) tbody tr:not(.empty,.skeleton,.detail,[data-selected]):hover td{background:var(--jl-surface-3)}:host([striped]) tbody tr:nth-child(2n of :where(:not(.detail))):not([data-selected],[data-marked])+.detail td{background:var(--jl-surface-2)}.format-number{font-variant-numeric:tabular-nums}td.wrap{white-space:normal;overflow-wrap:anywhere;min-width:160px}.format-date{color:var(--jl-text-2);font-variant-numeric:tabular-nums}code{border-radius:var(--jl-radius-xs);background:var(--jl-code-bg);font-size:var(--jl-font-xs);padding:2px 6px}.select-cell{width:var(--select-width);padding-right:0;line-height:0}.expand-cell{width:var(--expand-width);padding-right:0;padding-left:calc(var(--cell-x) - 4px);line-height:0}.select-cell+.expand-cell{padding-left:0}:host([expandable]) tbody tr[data-index]{cursor:pointer}.expand{border-radius:var(--jl-radius-xs);width:24px;height:24px;color:var(--jl-muted);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;margin:-2px 0;padding:0;display:inline-flex}.expand:hover{color:var(--jl-text)}.chevron{transition:rotate var(--jl-fast) var(--jl-ease)}.expand[aria-expanded=true] .chevron{rotate:90deg}.check{display:inline-flex;position:relative}.checkbox{border:1.5px solid var(--jl-line-strong);background:var(--jl-surface);cursor:pointer;appearance:none;width:16px;height:16px;transition:background var(--jl-fast) var(--jl-ease), border-color var(--jl-fast) var(--jl-ease);border-radius:4px;margin:0}.checkbox:hover{border-color:var(--jl-muted)}.checkbox:checked,.checkbox:indeterminate{border-color:var(--jl-accent);background:var(--jl-accent)}.checkbox:disabled{cursor:not-allowed;opacity:.5}.mark{pointer-events:none;position:absolute;inset:0}.checkbox:checked+.mark:after{border:solid var(--jl-on-accent);content:\"\";border-width:0 2px 2px 0;width:5px;height:9px;position:absolute;top:2.5px;left:5.5px;rotate:45deg}.checkbox:indeterminate+.mark:after{background:var(--jl-on-accent);content:\"\";border-radius:1px;height:2px;position:absolute;top:7px;left:4px;right:4px}.empty-content{align-items:center;gap:8px;display:inline-flex}.empty jl-icon{color:var(--jl-faint)}.bone{border-radius:var(--jl-radius-pill);background:linear-gradient(90deg, var(--jl-surface-3) 30%, var(--jl-surface-2) 50%, var(--jl-surface-3) 70%) 0 0 / 300% 100%;vertical-align:middle;width:70%;max-width:160px;height:10px;animation:1.4s linear infinite shimmer;display:inline-block}.bone.box{border-radius:4px;width:16px;height:16px}tbody tr.skeleton:nth-child(3n+2) .bone:not(.box){width:50%}tbody tr.skeleton:nth-child(3n) .bone:not(.box){width:85%}@media (prefers-reduced-motion:reduce){.bone{animation:none}}@keyframes shimmer{0%{background-position:100% 0}to{background-position:0 0}}.cell-description{color:var(--jl-muted);font-size:var(--jl-font-xs);margin-top:2px}";
|
|
2
|
+
var jl_table_default = ":host{contain:inline-size;--max-height:none;--cell-y:10px;--cell-x:14px;--select-width:44px;--expand-width:36px;--lead:0px;display:block}:host([expandable]){--lead:var(--expand-width)}:host([expandable][selectable]){--expand-width:28px;--lead:calc(var(--select-width) + var(--expand-width))}:host([dense]){--cell-y:6px;--cell-x:12px}.scroll{max-height:var(--max-height);border:1px solid var(--jl-line);border-radius:var(--jl-radius);background:var(--jl-surface);overscroll-behavior-x:contain;position:relative;overflow:auto}:host([expandable]) .scroll{container-type:inline-size}table{border-collapse:separate;border-spacing:0;width:100%;color:var(--jl-text);font-size:var(--jl-font-md);line-height:20px}th,td{padding:var(--cell-y) var(--cell-x);white-space:nowrap;vertical-align:middle}th{z-index:1;border-bottom:1px solid var(--jl-line);background:var(--jl-surface-2);color:var(--jl-muted);font-size:var(--jl-font-xs);letter-spacing:.01em;text-align:left;font-weight:600;position:sticky;top:0}td{border-top:1px solid var(--jl-line-soft)}tbody tr:first-child td{border-top:none}tbody tr.empty td{padding:40px var(--cell-x);color:var(--jl-muted);text-align:center}tbody tr.detail td{padding:0 var(--cell-x) calc(var(--cell-y) + 6px) calc(var(--lead) + var(--cell-x));white-space:normal;cursor:auto;border-top:none}.detail-body{left:calc(var(--lead) + var(--cell-x));max-width:calc(100cqi - var(--lead) - 2 * var(--cell-x));position:sticky}.align-left{text-align:left}.align-center{text-align:center}.align-right{text-align:right}.sort{border-radius:var(--jl-radius-xs);color:inherit;font-weight:inherit;letter-spacing:inherit;cursor:pointer;background:0 0;border:none;align-items:center;gap:4px;margin:-2px -4px;padding:2px 4px;display:inline-flex}.sort:hover{color:var(--jl-text)}.sort-icon{color:var(--jl-faint)}th[data-sorted]{color:var(--jl-text)}th[data-sorted] .sort-icon{color:var(--jl-accent)}tbody tr[data-selected] td,tbody tr[data-marked] td{background:var(--jl-accent-soft)}tbody tr[data-marked] td:first-child{box-shadow:inset 3px 0 0 var(--jl-accent)}tbody tr:not(.empty,.skeleton,.detail,[data-selected]):hover td,:host([striped]) tbody tr:nth-child(2n of :where(:not(.detail))):not(.empty,[data-selected],[data-marked]) td{background:var(--jl-surface-2)}:host([striped]) tbody tr:not(.empty,.skeleton,.detail,[data-selected]):hover td{background:var(--jl-surface-3)}:host([striped]) tbody tr:nth-child(2n of :where(:not(.detail))):not([data-selected],[data-marked])+.detail td{background:var(--jl-surface-2)}.format-number{font-variant-numeric:tabular-nums}td.wrap{white-space:normal;overflow-wrap:anywhere;min-width:160px}.format-date{color:var(--jl-text-2);font-variant-numeric:tabular-nums}code{border-radius:var(--jl-radius-xs);background:var(--jl-code-bg);font-size:var(--jl-font-xs);padding:2px 6px}.select-cell{width:var(--select-width);padding-right:0;line-height:0}.expand-cell{width:var(--expand-width);padding-right:0;padding-left:calc(var(--cell-x) - 4px);line-height:0}.select-cell+.expand-cell{padding-left:0}:host([expandable]) tbody tr[data-index]{cursor:pointer}.expand{border-radius:var(--jl-radius-xs);width:24px;height:24px;color:var(--jl-muted);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;margin:-2px 0;padding:0;display:inline-flex}.expand:hover{color:var(--jl-text)}.chevron{transition:rotate var(--jl-fast) var(--jl-ease)}.expand[aria-expanded=true] .chevron{rotate:90deg}.check{display:inline-flex;position:relative}.checkbox{border:1.5px solid var(--jl-line-strong);background:var(--jl-surface);cursor:pointer;appearance:none;width:16px;height:16px;transition:background var(--jl-fast) var(--jl-ease), border-color var(--jl-fast) var(--jl-ease);border-radius:4px;margin:0}.checkbox:hover{border-color:var(--jl-muted)}.checkbox:checked,.checkbox:indeterminate{border-color:var(--jl-accent);background:var(--jl-accent)}.checkbox:disabled{cursor:not-allowed;opacity:.5}.mark{pointer-events:none;position:absolute;inset:0}.checkbox:checked+.mark:after{border:solid var(--jl-on-accent);content:\"\";border-width:0 2px 2px 0;width:5px;height:9px;position:absolute;top:2.5px;left:5.5px;rotate:45deg}.checkbox:indeterminate+.mark:after{background:var(--jl-on-accent);content:\"\";border-radius:1px;height:2px;position:absolute;top:7px;left:4px;right:4px}.empty-content{align-items:center;gap:8px;display:inline-flex}.empty jl-icon{color:var(--jl-faint)}.bone{border-radius:var(--jl-radius-pill);background:linear-gradient(90deg, var(--jl-surface-3) 30%, var(--jl-surface-2) 50%, var(--jl-surface-3) 70%) 0 0 / 300% 100%;vertical-align:middle;width:70%;max-width:160px;height:10px;animation:1.4s linear infinite shimmer;display:inline-block}.bone.box{border-radius:4px;width:16px;height:16px}tbody tr.skeleton:nth-child(3n+2) .bone:not(.box){width:50%}tbody tr.skeleton:nth-child(3n) .bone:not(.box){width:85%}@media (prefers-reduced-motion:reduce){.bone{animation:none}}@keyframes shimmer{0%{background-position:100% 0}to{background-position:0 0}}.cell-description{color:var(--jl-muted);font-size:var(--jl-font-xs);margin-top:2px}";
|
|
3
3
|
export { jl_table_default as default };
|
|
@@ -65,6 +65,7 @@ export declare class JlTree extends JlElement {
|
|
|
65
65
|
private readonly _rows;
|
|
66
66
|
private readonly _focus;
|
|
67
67
|
private readonly _loading;
|
|
68
|
+
private readonly _drawing;
|
|
68
69
|
private readonly _refs;
|
|
69
70
|
/** Loads the items a page at a time; setting it forgets `items` and loads the roots. */
|
|
70
71
|
get loader(): TreeLoader | null;
|
|
@@ -111,7 +112,20 @@ export declare class JlTree extends JlElement {
|
|
|
111
112
|
private hasLevelEndRow;
|
|
112
113
|
protected drawTexts(): void;
|
|
113
114
|
private errorLabel;
|
|
115
|
+
private itemsChanged;
|
|
114
116
|
private renderItems;
|
|
117
|
+
/** Where the Tab stop goes once rows are drawn: where it was, else the selected item, else the first. */
|
|
118
|
+
private tabStop;
|
|
119
|
+
/**
|
|
120
|
+
* Draws the rows a page added to a level, then the row that ends the level again, and nothing else: a spinner, a
|
|
121
|
+
* page or an error leaves the other rows as they are. A level not drawn yet draws the whole tree. The focus that
|
|
122
|
+
* was on the row ending the level moves to the one replacing it.
|
|
123
|
+
*/
|
|
124
|
+
private drawLevelEnd;
|
|
125
|
+
/** The element holding a level's rows; null when they are not drawn, or when the tree shows its empty note. */
|
|
126
|
+
private levelContainer;
|
|
127
|
+
/** The depth of a level's rows: 1 for the roots. */
|
|
128
|
+
private levelOf;
|
|
115
129
|
private itemNode;
|
|
116
130
|
/** The row that ends a level, if it has one. */
|
|
117
131
|
private levelEndNodes;
|
|
@@ -121,8 +135,11 @@ export declare class JlTree extends JlElement {
|
|
|
121
135
|
private errorNode;
|
|
122
136
|
private noteNode;
|
|
123
137
|
private renderExpanded;
|
|
138
|
+
/** Opens or closes the groups of these rows, as `expanded` says. */
|
|
139
|
+
private drawExpanded;
|
|
124
140
|
private isVisible;
|
|
125
141
|
/** The item itself when it shows, else the nearest folder around it that does: the focus goes there. */
|
|
126
142
|
private visibleAncestor;
|
|
127
143
|
private renderSelection;
|
|
144
|
+
private drawSelection;
|
|
128
145
|
}
|
|
@@ -43,7 +43,7 @@ var messageOf = (error) => error instanceof Error ? error.message : String(error
|
|
|
43
43
|
var JlTree = class extends JlElement {
|
|
44
44
|
static selector = "jl-tree";
|
|
45
45
|
events = this.useEvents();
|
|
46
|
-
items = this.useChange([], () => this.
|
|
46
|
+
items = this.useChange([], () => this.itemsChanged(), {
|
|
47
47
|
attribute: "items",
|
|
48
48
|
parse: jsonOf([])
|
|
49
49
|
});
|
|
@@ -76,6 +76,7 @@ var JlTree = class extends JlElement {
|
|
|
76
76
|
generation: 0,
|
|
77
77
|
levels: /* @__PURE__ */ new Map()
|
|
78
78
|
};
|
|
79
|
+
_drawing = { pageOnly: false };
|
|
79
80
|
_refs = this.useRefs((ref) => ({ tree: ref(".tree") }));
|
|
80
81
|
/** Loads the items a page at a time; setting it forgets `items` and loads the roots. */
|
|
81
82
|
get loader() {
|
|
@@ -220,7 +221,7 @@ var JlTree = class extends JlElement {
|
|
|
220
221
|
pending,
|
|
221
222
|
total: level?.total ?? 0
|
|
222
223
|
});
|
|
223
|
-
this.whenRendered(() => this.
|
|
224
|
+
this.whenRendered(() => this.drawLevelEnd(parent));
|
|
224
225
|
return pending;
|
|
225
226
|
}
|
|
226
227
|
loadNextPage(parent) {
|
|
@@ -236,7 +237,18 @@ var JlTree = class extends JlElement {
|
|
|
236
237
|
pending: null,
|
|
237
238
|
total
|
|
238
239
|
});
|
|
239
|
-
|
|
240
|
+
const items = withPage(this.items.get(), parent, page.items);
|
|
241
|
+
if (this.levelContainer(parent) === null) this.items.set(items);
|
|
242
|
+
else {
|
|
243
|
+
this._drawing.pageOnly = true;
|
|
244
|
+
try {
|
|
245
|
+
this.items.set(items);
|
|
246
|
+
} finally {
|
|
247
|
+
this._drawing.pageOnly = false;
|
|
248
|
+
}
|
|
249
|
+
const level = this.levelOf(parent);
|
|
250
|
+
this.drawLevelEnd(parent, page.items.map((item) => this.itemNode(item, level)));
|
|
251
|
+
}
|
|
240
252
|
this.loadOpenFolders();
|
|
241
253
|
const first = page.items[0];
|
|
242
254
|
if (focusFirst && first !== void 0) this.moveFocus(first.id, true);
|
|
@@ -249,7 +261,7 @@ var JlTree = class extends JlElement {
|
|
|
249
261
|
pending: null,
|
|
250
262
|
total
|
|
251
263
|
});
|
|
252
|
-
this.whenRendered(() => this.
|
|
264
|
+
this.whenRendered(() => this.drawLevelEnd(parent));
|
|
253
265
|
}
|
|
254
266
|
/** The open folders whose children the loader has not given yet: their first page. */
|
|
255
267
|
loadOpenFolders() {
|
|
@@ -283,15 +295,54 @@ var JlTree = class extends JlElement {
|
|
|
283
295
|
errorLabel() {
|
|
284
296
|
return this.errorText.get() || jlText("loadError");
|
|
285
297
|
}
|
|
298
|
+
itemsChanged() {
|
|
299
|
+
if (!this._drawing.pageOnly) this.renderItems();
|
|
300
|
+
}
|
|
286
301
|
renderItems() {
|
|
287
302
|
const hadFocus = this.hasFocusInside();
|
|
288
303
|
this._rows.clear();
|
|
289
304
|
this._refs.tree.replaceChildren(...this.items.get().map((item) => this.itemNode(item, 1)), ...this.levelEndNodes(null, 1));
|
|
290
305
|
this.renderExpanded();
|
|
291
306
|
this.renderSelection();
|
|
307
|
+
this.moveFocus(this.tabStop(), hadFocus);
|
|
308
|
+
}
|
|
309
|
+
/** Where the Tab stop goes once rows are drawn: where it was, else the selected item, else the first. */
|
|
310
|
+
tabStop() {
|
|
311
|
+
if (this._rows.has(this._focus.id)) return this._focus.id;
|
|
292
312
|
const first = this._rows.keys().next().value ?? "";
|
|
293
|
-
|
|
294
|
-
|
|
313
|
+
return this._rows.has(this.value.get()) ? this.value.get() : first;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Draws the rows a page added to a level, then the row that ends the level again, and nothing else: a spinner, a
|
|
317
|
+
* page or an error leaves the other rows as they are. A level not drawn yet draws the whole tree. The focus that
|
|
318
|
+
* was on the row ending the level moves to the one replacing it.
|
|
319
|
+
*/
|
|
320
|
+
drawLevelEnd(parent, added = []) {
|
|
321
|
+
const container = this.levelContainer(parent);
|
|
322
|
+
if (container === null) {
|
|
323
|
+
this.renderItems();
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
const hadFocus = this.hasFocusInside();
|
|
327
|
+
const endId = levelEndId(parent);
|
|
328
|
+
this._rows.get(endId)?.remove();
|
|
329
|
+
this._rows.delete(endId);
|
|
330
|
+
const ending = this.levelEndNodes(parent, this.levelOf(parent));
|
|
331
|
+
container.append(...added, ...ending);
|
|
332
|
+
const drawn = [...added, ...ending].filter((node) => node instanceof HTMLElement && node.dataset.id !== void 0).flatMap((row) => [row, ...row.querySelectorAll("[role=\"treeitem\"]")]).map((row) => [row.dataset.id ?? "", row]);
|
|
333
|
+
this.drawExpanded(drawn);
|
|
334
|
+
this.drawSelection(drawn);
|
|
335
|
+
this.moveFocus(this.tabStop(), hadFocus && !this.hasFocusInside());
|
|
336
|
+
}
|
|
337
|
+
/** The element holding a level's rows; null when they are not drawn, or when the tree shows its empty note. */
|
|
338
|
+
levelContainer(parent) {
|
|
339
|
+
if (parent === null) return this.items.get().length > 0 && this._rows.size > 0 ? this._refs.tree : null;
|
|
340
|
+
return this._rows.get(parent)?.querySelector(":scope > .group") ?? null;
|
|
341
|
+
}
|
|
342
|
+
/** The depth of a level's rows: 1 for the roots. */
|
|
343
|
+
levelOf(parent) {
|
|
344
|
+
if (parent === null) return 1;
|
|
345
|
+
return (allItems(this.items.get()).find((entry) => entry.item.id === parent)?.level ?? 0) + 1;
|
|
295
346
|
}
|
|
296
347
|
itemNode(item, level) {
|
|
297
348
|
const folder = isFolder(item);
|
|
@@ -438,8 +489,13 @@ var JlTree = class extends JlElement {
|
|
|
438
489
|
return node;
|
|
439
490
|
}
|
|
440
491
|
renderExpanded() {
|
|
492
|
+
this.drawExpanded(this._rows);
|
|
493
|
+
if (!this.isVisible(this._focus.id)) this.moveFocus(this.visibleAncestor(this._focus.id), false);
|
|
494
|
+
}
|
|
495
|
+
/** Opens or closes the groups of these rows, as `expanded` says. */
|
|
496
|
+
drawExpanded(rows) {
|
|
441
497
|
const expanded = new Set(this.expanded.get());
|
|
442
|
-
for (const [id, row] of
|
|
498
|
+
for (const [id, row] of rows) {
|
|
443
499
|
const group = row.querySelector(":scope > .group");
|
|
444
500
|
if (group === null) continue;
|
|
445
501
|
const open = expanded.has(id);
|
|
@@ -447,7 +503,6 @@ var JlTree = class extends JlElement {
|
|
|
447
503
|
group.hidden = !open;
|
|
448
504
|
row.querySelector(":scope > .row > .icon.auto")?.name.set(open ? OPEN_FOLDER_ICON : FOLDER_ICON);
|
|
449
505
|
}
|
|
450
|
-
if (!this.isVisible(this._focus.id)) this.moveFocus(this.visibleAncestor(this._focus.id), false);
|
|
451
506
|
}
|
|
452
507
|
isVisible(id) {
|
|
453
508
|
const row = this._rows.get(id);
|
|
@@ -459,8 +514,11 @@ var JlTree = class extends JlElement {
|
|
|
459
514
|
return owner?.dataset.id === void 0 ? id : this.visibleAncestor(owner.dataset.id);
|
|
460
515
|
}
|
|
461
516
|
renderSelection() {
|
|
517
|
+
this.drawSelection(this._rows);
|
|
518
|
+
}
|
|
519
|
+
drawSelection(rows) {
|
|
462
520
|
const value = this.value.get();
|
|
463
|
-
for (const [id, row] of
|
|
521
|
+
for (const [id, row] of rows) row.setAttribute("aria-selected", String(id === value));
|
|
464
522
|
}
|
|
465
523
|
};
|
|
466
524
|
JlTree.register();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/templates/jl-split-view.css?inline
|
|
2
|
-
var jl_split_view_default = ":host{height:100%;min-height:0;display:block}.split{grid-template-columns:minmax(0, var(--position,50%)) 1px minmax(0, 1fr);height:100%;display:grid}:host([orientation=vertical]) .split{grid-template-columns:none;grid-template-rows:minmax(0, var(--position,50%)) 1px minmax(0, 1fr)}.pane{min-width:0;min-height:0;overflow:auto}.divider{z-index:1;background:var(--jl-line);cursor:col-resize;touch-action:none;transition:background var(--jl-fast) var(--jl-ease);position:relative}:host([orientation=vertical]) .divider{cursor:row-resize}.divider:before{content:\"\";position:absolute;inset:0 -5px}:host([orientation=vertical]) .divider:before{inset:-5px 0}.divider:hover,.divider:focus-visible,:host([dragging]) .divider{background:var(--jl-accent)}.divider:focus-visible{box-shadow:var(--jl-focus-ring)}.grip{border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-pill);background:var(--jl-surface);width:6px;height:28px;transition:border-color var(--jl-fast) var(--jl-ease);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}:host([orientation=vertical]) .grip{width:28px;height:6px}.divider:hover .grip,.divider:focus-visible .grip,:host([dragging]) .grip{border-color:var(--jl-accent)}:host([dragging]){cursor:col-resize;-webkit-user-select:none;user-select:none}:host([dragging][orientation=vertical]){cursor:row-resize}:host([dragging]) .pane{pointer-events:none}:host([stacked]) .split{grid-template-rows:minmax(0,1fr);grid-template-columns:minmax(0,1fr)}:host([stacked]) .divider,:host([stacked]:not([pane=end])) .end,:host([stacked][pane=end]) .start{display:none}";
|
|
2
|
+
var jl_split_view_default = ":host{height:100%;min-height:0;display:block}.split{grid-template-columns:minmax(0, var(--position,50%)) 1px minmax(0, 1fr);height:100%;display:grid}:host([orientation=vertical]) .split{grid-template-columns:none;grid-template-rows:minmax(0, var(--position,50%)) 1px minmax(0, 1fr)}.pane{min-width:0;min-height:0;position:relative;overflow:auto}.divider{z-index:1;background:var(--jl-line);cursor:col-resize;touch-action:none;transition:background var(--jl-fast) var(--jl-ease);position:relative}:host([orientation=vertical]) .divider{cursor:row-resize}.divider:before{content:\"\";position:absolute;inset:0 -5px}:host([orientation=vertical]) .divider:before{inset:-5px 0}.divider:hover,.divider:focus-visible,:host([dragging]) .divider{background:var(--jl-accent)}.divider:focus-visible{box-shadow:var(--jl-focus-ring)}.grip{border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-pill);background:var(--jl-surface);width:6px;height:28px;transition:border-color var(--jl-fast) var(--jl-ease);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}:host([orientation=vertical]) .grip{width:28px;height:6px}.divider:hover .grip,.divider:focus-visible .grip,:host([dragging]) .grip{border-color:var(--jl-accent)}:host([dragging]){cursor:col-resize;-webkit-user-select:none;user-select:none}:host([dragging][orientation=vertical]){cursor:row-resize}:host([dragging]) .pane{pointer-events:none}:host([stacked]) .split{grid-template-rows:minmax(0,1fr);grid-template-columns:minmax(0,1fr)}:host([stacked]) .divider,:host([stacked]:not([pane=end])) .end,:host([stacked][pane=end]) .start{display:none}";
|
|
3
3
|
export { jl_split_view_default as default };
|