@syware/jlib 0.12.1 → 0.14.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/atoms/jl-avatar.css.js +1 -1
- package/dist/atoms/jl-avatar.js +1 -8
- package/dist/atoms/jl-button.css.js +1 -1
- package/dist/atoms/jl-button.js +4 -6
- package/dist/atoms/jl-checkbox.css.js +1 -1
- package/dist/atoms/jl-checkbox.js +8 -10
- package/dist/atoms/jl-chip.css.js +1 -1
- package/dist/atoms/jl-chip.js +3 -11
- package/dist/atoms/jl-divider.css.js +1 -1
- package/dist/atoms/jl-divider.js +1 -5
- package/dist/atoms/jl-icon.css.js +1 -1
- package/dist/atoms/jl-icon.d.ts +2 -0
- package/dist/atoms/jl-icon.js +5 -1
- package/dist/atoms/jl-input.d.ts +7 -2
- package/dist/atoms/jl-input.js +36 -31
- package/dist/atoms/jl-link.css.js +1 -1
- package/dist/atoms/jl-link.js +3 -6
- package/dist/atoms/jl-progress-ring.js +3 -2
- package/dist/atoms/jl-progress.js +3 -2
- package/dist/atoms/jl-rating.css.js +1 -1
- package/dist/atoms/jl-rating.d.ts +2 -2
- package/dist/atoms/jl-rating.js +17 -35
- package/dist/atoms/jl-select.d.ts +8 -3
- package/dist/atoms/jl-select.js +26 -13
- package/dist/atoms/jl-skeleton.d.ts +1 -0
- package/dist/atoms/jl-skeleton.js +4 -1
- package/dist/atoms/jl-slider.d.ts +4 -0
- package/dist/atoms/jl-slider.js +29 -15
- package/dist/atoms/jl-switch.css.js +1 -1
- package/dist/atoms/jl-switch.js +2 -8
- package/dist/atoms/jl-textarea.css.js +1 -1
- package/dist/atoms/jl-textarea.d.ts +4 -5
- package/dist/atoms/jl-textarea.js +15 -30
- package/dist/index.d.ts +1 -1
- package/dist/lib/calendar.js +3 -2
- package/dist/lib/floating.d.ts +10 -0
- package/dist/lib/floating.js +27 -8
- package/dist/lib/flow.d.ts +7 -3
- package/dist/lib/flow.js +19 -8
- package/dist/lib/hotkey.d.ts +13 -0
- package/dist/lib/hotkey.js +2 -1
- package/dist/lib/indicator.d.ts +16 -0
- package/dist/lib/indicator.js +32 -6
- package/dist/lib/intl.d.ts +6 -0
- package/dist/lib/intl.js +19 -0
- package/dist/lib/key-shortcut.js +11 -29
- package/dist/lib/palette.js +1 -6
- package/dist/lib/progress.d.ts +0 -5
- package/dist/lib/progress.js +1 -9
- package/dist/lib/roving.d.ts +6 -0
- package/dist/lib/roving.js +14 -1
- package/dist/lib/table.d.ts +14 -2
- package/dist/lib/table.js +50 -39
- package/dist/molecules/jl-accordion-item.css.js +1 -1
- package/dist/molecules/jl-accordion-item.js +1 -5
- package/dist/molecules/jl-account-button.css.js +1 -1
- package/dist/molecules/jl-account-button.js +1 -5
- package/dist/molecules/jl-alert.css.js +1 -1
- package/dist/molecules/jl-alert.d.ts +5 -5
- package/dist/molecules/jl-alert.js +4 -13
- package/dist/molecules/jl-avatar-group.d.ts +7 -5
- package/dist/molecules/jl-avatar-group.js +15 -5
- package/dist/molecules/jl-breadcrumb.d.ts +7 -4
- package/dist/molecules/jl-breadcrumb.js +32 -8
- package/dist/molecules/jl-calendar.d.ts +12 -3
- package/dist/molecules/jl-calendar.js +79 -48
- package/dist/molecules/jl-card.css.js +1 -1
- package/dist/molecules/jl-card.js +2 -8
- package/dist/molecules/jl-chip-group.css.js +1 -1
- package/dist/molecules/jl-chip-group.d.ts +6 -2
- package/dist/molecules/jl-chip-group.js +14 -19
- package/dist/molecules/jl-code-block.css.js +1 -1
- package/dist/molecules/jl-code-block.d.ts +7 -5
- package/dist/molecules/jl-code-block.js +19 -22
- package/dist/molecules/jl-combobox.css.js +1 -1
- package/dist/molecules/jl-combobox.d.ts +4 -0
- package/dist/molecules/jl-combobox.js +33 -19
- package/dist/molecules/jl-date-picker.d.ts +6 -0
- package/dist/molecules/jl-date-picker.js +29 -9
- package/dist/molecules/jl-empty.css.js +1 -1
- package/dist/molecules/jl-empty.js +4 -19
- package/dist/molecules/jl-field.css.js +1 -1
- package/dist/molecules/jl-field.d.ts +7 -1
- package/dist/molecules/jl-field.js +35 -23
- package/dist/molecules/jl-file-drop.css.js +1 -1
- package/dist/molecules/jl-file-drop.js +1 -3
- package/dist/molecules/jl-input-list.css.js +1 -1
- package/dist/molecules/jl-input-list.d.ts +12 -1
- package/dist/molecules/jl-input-list.js +81 -51
- package/dist/molecules/jl-list-item.css.js +1 -1
- package/dist/molecules/jl-list-item.d.ts +3 -1
- package/dist/molecules/jl-list-item.js +26 -27
- package/dist/molecules/jl-load-state.css.js +1 -1
- package/dist/molecules/jl-load-state.d.ts +6 -1
- package/dist/molecules/jl-load-state.js +15 -18
- package/dist/molecules/jl-menu.d.ts +1 -0
- package/dist/molecules/jl-menu.js +9 -2
- package/dist/molecules/jl-pagination.css.js +1 -1
- package/dist/molecules/jl-pagination.d.ts +7 -1
- package/dist/molecules/jl-pagination.js +43 -35
- package/dist/molecules/jl-radio-group.js +1 -1
- package/dist/molecules/jl-search.css.js +1 -1
- package/dist/molecules/jl-search.js +4 -12
- package/dist/molecules/jl-segmented.css.js +1 -1
- package/dist/molecules/jl-segmented.d.ts +4 -2
- package/dist/molecules/jl-segmented.js +19 -26
- package/dist/molecules/jl-stat.css.js +1 -1
- package/dist/molecules/jl-stat.js +2 -8
- package/dist/molecules/jl-steps.d.ts +10 -3
- package/dist/molecules/jl-steps.js +82 -49
- package/dist/molecules/jl-tabs.d.ts +5 -2
- package/dist/molecules/jl-tabs.js +31 -25
- package/dist/molecules/jl-tag-input.css.js +1 -1
- package/dist/molecules/jl-tag-input.d.ts +13 -1
- package/dist/molecules/jl-tag-input.js +57 -30
- package/dist/molecules/jl-timeline.css.js +1 -1
- package/dist/molecules/jl-timeline.d.ts +3 -1
- package/dist/molecules/jl-timeline.js +9 -14
- package/dist/molecules/jl-toast.css.js +1 -1
- package/dist/molecules/jl-toast.js +4 -12
- package/dist/molecules/jl-tooltip.d.ts +2 -1
- package/dist/molecules/jl-tooltip.js +11 -15
- package/dist/organisms/jl-command-palette.css.js +1 -1
- package/dist/organisms/jl-command-palette.d.ts +8 -1
- package/dist/organisms/jl-command-palette.js +74 -43
- package/dist/organisms/jl-confirm.css.js +1 -1
- package/dist/organisms/jl-confirm.js +1 -5
- package/dist/organisms/jl-dialog.css.js +1 -1
- package/dist/organisms/jl-dialog.js +1 -5
- package/dist/organisms/jl-drawer.css.js +1 -1
- package/dist/organisms/jl-drawer.js +1 -3
- package/dist/organisms/jl-flow.d.ts +18 -2
- package/dist/organisms/jl-flow.js +128 -44
- package/dist/organisms/jl-navbar.css.js +1 -1
- package/dist/organisms/jl-navbar.d.ts +1 -1
- package/dist/organisms/jl-navbar.js +3 -5
- package/dist/organisms/jl-page-header.css.js +1 -1
- package/dist/organisms/jl-page-header.js +1 -5
- package/dist/organisms/jl-page-outlet.d.ts +4 -3
- package/dist/organisms/jl-page-outlet.js +7 -8
- package/dist/organisms/jl-side-nav.css.js +1 -1
- package/dist/organisms/jl-side-nav.d.ts +9 -2
- package/dist/organisms/jl-side-nav.js +44 -16
- package/dist/organisms/jl-tab-bar.css.js +1 -1
- package/dist/organisms/jl-tab-bar.js +0 -2
- package/dist/organisms/jl-table.css.js +1 -1
- package/dist/organisms/jl-table.d.ts +19 -7
- package/dist/organisms/jl-table.js +97 -59
- package/dist/organisms/jl-tree.css.js +1 -1
- package/dist/organisms/jl-tree.d.ts +16 -13
- package/dist/organisms/jl-tree.js +72 -70
- package/package.json +4 -2
- package/dist/lib/roving-index.d.ts +0 -10
- package/dist/lib/roving-index.js +0 -32
- /package/dist/types/{roving-index.types.d.ts → roving.types.d.ts} +0 -0
|
@@ -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;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)}}";
|
|
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}.description:empty{display:none}.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 };
|
|
@@ -28,7 +28,6 @@ var JlDialog = class extends JlElement {
|
|
|
28
28
|
}, { attribute: "heading" });
|
|
29
29
|
description = this.useChange("", (value) => {
|
|
30
30
|
this._refs.description.textContent = value;
|
|
31
|
-
this._refs.description.hidden = value === "";
|
|
32
31
|
}, { attribute: "description" });
|
|
33
32
|
size = this.useChange("md", (value) => this.reflect("size", value), {
|
|
34
33
|
attribute: "size",
|
|
@@ -60,10 +59,7 @@ var JlDialog = class extends JlElement {
|
|
|
60
59
|
children: [
|
|
61
60
|
/* @__PURE__ */ jsxs("header", { children: [/* @__PURE__ */ jsxs("div", {
|
|
62
61
|
class: "titles",
|
|
63
|
-
children: [/* @__PURE__ */ jsx("h2", { id: "heading" }), /* @__PURE__ */ jsx("p", {
|
|
64
|
-
class: "description",
|
|
65
|
-
hidden: true
|
|
66
|
-
})]
|
|
62
|
+
children: [/* @__PURE__ */ jsx("h2", { id: "heading" }), /* @__PURE__ */ jsx("p", { class: "description" })]
|
|
67
63
|
}), /* @__PURE__ */ jsx(JlButton, {
|
|
68
64
|
class: "close",
|
|
69
65
|
variant: "ghost",
|
|
@@ -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;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))}";
|
|
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}.description:empty{display:none}.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 };
|
|
@@ -34,7 +34,6 @@ var JlDrawer = class extends JlElement {
|
|
|
34
34
|
}, { attribute: "heading" });
|
|
35
35
|
description = this.useChange("", (value) => {
|
|
36
36
|
this._refs.description.textContent = value;
|
|
37
|
-
this._refs.description.hidden = value === "";
|
|
38
37
|
}, { attribute: "description" });
|
|
39
38
|
placement = this.useChange("right", (value) => this.reflect("placement", value), {
|
|
40
39
|
attribute: "placement",
|
|
@@ -77,8 +76,7 @@ var JlDrawer = class extends JlElement {
|
|
|
77
76
|
class: "titles",
|
|
78
77
|
children: [/* @__PURE__ */ jsx("h2", { id: "heading" }), /* @__PURE__ */ jsx("p", {
|
|
79
78
|
class: "description",
|
|
80
|
-
id: "description"
|
|
81
|
-
hidden: true
|
|
79
|
+
id: "description"
|
|
82
80
|
})]
|
|
83
81
|
}), /* @__PURE__ */ jsxs("div", {
|
|
84
82
|
class: "actions",
|
|
@@ -43,6 +43,7 @@ export declare class JlFlow extends JlElement {
|
|
|
43
43
|
}>>;
|
|
44
44
|
private readonly _state;
|
|
45
45
|
private readonly _nodes;
|
|
46
|
+
private readonly _edges;
|
|
46
47
|
private readonly _svg;
|
|
47
48
|
private readonly _refs;
|
|
48
49
|
/** Moves and zooms the view to show every node, never larger than life. */
|
|
@@ -61,6 +62,9 @@ export declare class JlFlow extends JlElement {
|
|
|
61
62
|
private renderLabel;
|
|
62
63
|
onConnect(): void;
|
|
63
64
|
private show;
|
|
65
|
+
private keep;
|
|
66
|
+
/** Draws on the next microtask: the inputs set while connecting, or an edit and its echo, give one drawing. */
|
|
67
|
+
private schedule;
|
|
64
68
|
/** An edit: drawn, kept, and sent to the page. */
|
|
65
69
|
private commit;
|
|
66
70
|
private select;
|
|
@@ -91,8 +95,13 @@ export declare class JlFlow extends JlElement {
|
|
|
91
95
|
private screenPoint;
|
|
92
96
|
private worldPoint;
|
|
93
97
|
private render;
|
|
94
|
-
/**
|
|
98
|
+
/**
|
|
99
|
+
* The nodes' elements stay from one drawing to the next: the focused one keeps the focus. A node is drawn again
|
|
100
|
+
* only when its object or its free exits changed: moving one node draws that one.
|
|
101
|
+
*/
|
|
95
102
|
private renderNodes;
|
|
103
|
+
/** Draws a node again only when more than its position changed: a node that only moved is moved. */
|
|
104
|
+
private drawNodeIfChanged;
|
|
96
105
|
private createNode;
|
|
97
106
|
private drawNode;
|
|
98
107
|
/** A colour of the page's own for the icon wins over the tone's. */
|
|
@@ -100,12 +109,19 @@ export declare class JlFlow extends JlElement {
|
|
|
100
109
|
private portElement;
|
|
101
110
|
private place;
|
|
102
111
|
private renderSelection;
|
|
112
|
+
/** The edges' groups stay from one drawing to the next, changed in place; those of removed edges go. */
|
|
103
113
|
private renderEdges;
|
|
114
|
+
/** Puts the edges in the graph's order, the draft last: those already in place stay. */
|
|
115
|
+
private placeInOrder;
|
|
116
|
+
/** The edges of a node being dragged follow it; the others stay as they are. */
|
|
117
|
+
private renderEdgesOf;
|
|
104
118
|
/**
|
|
105
119
|
* An edge, with a wide invisible twin that catches the pointer: a thin line is still easy to press. One a run took
|
|
106
120
|
* stands out.
|
|
107
121
|
*/
|
|
108
|
-
private
|
|
122
|
+
private drawEdge;
|
|
123
|
+
private createEdge;
|
|
124
|
+
private drawPath;
|
|
109
125
|
/** The button that removes the selected edge, in its middle. */
|
|
110
126
|
private renderEdgeTool;
|
|
111
127
|
}
|
|
@@ -5,7 +5,7 @@ import { jsonOf } from "../lib/attributes.js";
|
|
|
5
5
|
import { registerIcons } from "../lib/icons.js";
|
|
6
6
|
import { JlIcon } from "../atoms/jl-icon.js";
|
|
7
7
|
import { setOrRemove, svgElement } from "../lib/dom.js";
|
|
8
|
-
import { FLOW_NODE, FLOW_ZOOM, centeredAt, connect, edgeEnds, edgeMidpoint, edgePath, fitView, isEdgeTaken, isPortFree, layoutFlow, moveNode, nodeAt, nodeHeight, outputAnchor, portX, portsOf, positionAfter, removeEdge, removeNode, revealIn, snap, toWorld, zoomAt } from "../lib/flow.js";
|
|
8
|
+
import { FLOW_NODE, FLOW_ZOOM, centeredAt, connect, edgeEnds, edgeMidpoint, edgePath, fitView, isEdgeTaken, isPortFree, layoutFlow, moveNode, nodeAt, nodeHeight, nodesById, outputAnchor, portX, portsOf, positionAfter, removeEdge, removeNode, revealIn, snap, toWorld, usedPorts, zoomAt } from "../lib/flow.js";
|
|
9
9
|
import jl_flow_default from "./jl-flow.css.js";
|
|
10
10
|
import { css } from "@jadis/core";
|
|
11
11
|
import { Check, CircleAlert, Hourglass, LoaderCircle, Maximize, Minus, Plus, WandSparkles, X } from "lucide";
|
|
@@ -87,6 +87,11 @@ function targetOf(event) {
|
|
|
87
87
|
var distance = (a, b) => Math.hypot(a.x - b.x, a.y - b.y);
|
|
88
88
|
var newId = (prefix) => `${prefix}_${crypto.randomUUID().replaceAll("-", "").slice(0, ID_LENGTH)}`;
|
|
89
89
|
var addLabel = (node, port) => port.label ? `Add after ${node.label}, ${port.label}` : `Add after ${node.label}`;
|
|
90
|
+
/** Whether a node's new version differs in its position alone, as a drag or the arrows leave it: it only moves. */
|
|
91
|
+
function movedOnly(before, after) {
|
|
92
|
+
return [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])].every((key) => key === "position" || Reflect.get(before, key) === Reflect.get(after, key));
|
|
93
|
+
}
|
|
94
|
+
var PORT_SEPARATOR = "\n";
|
|
90
95
|
/**
|
|
91
96
|
* A flow of nodes joined by edges, to edit: people move the nodes, draw an edge from a node's exit to another node,
|
|
92
97
|
* press + on a free exit to ask for the next node, and move and zoom the view. Every edit goes out as a new graph
|
|
@@ -108,7 +113,7 @@ var JlFlow = class extends JlElement {
|
|
|
108
113
|
/** View only: nodes can be selected, not moved, joined or removed. */
|
|
109
114
|
readonly = this.useChange(false, (value) => {
|
|
110
115
|
this.reflect("readonly", value);
|
|
111
|
-
this.
|
|
116
|
+
this.schedule();
|
|
112
117
|
}, { attribute: "readonly" });
|
|
113
118
|
/**
|
|
114
119
|
* The drag-and-drop type the canvas takes (`application/x-step`): something dragged in carrying it asks for a node
|
|
@@ -122,6 +127,8 @@ var JlFlow = class extends JlElement {
|
|
|
122
127
|
fitted: false,
|
|
123
128
|
gesture: IDLE,
|
|
124
129
|
graph: EMPTY,
|
|
130
|
+
nodes: nodesById(EMPTY),
|
|
131
|
+
queued: false,
|
|
125
132
|
viewport: {
|
|
126
133
|
x: 0,
|
|
127
134
|
y: 0,
|
|
@@ -129,6 +136,7 @@ var JlFlow = class extends JlElement {
|
|
|
129
136
|
}
|
|
130
137
|
};
|
|
131
138
|
_nodes = /* @__PURE__ */ new Map();
|
|
139
|
+
_edges = /* @__PURE__ */ new Map();
|
|
132
140
|
_svg = {
|
|
133
141
|
draft: svgElement("path", { class: "edge draft" }),
|
|
134
142
|
root: svgElement("svg", {
|
|
@@ -163,8 +171,9 @@ var JlFlow = class extends JlElement {
|
|
|
163
171
|
reveal(id) {
|
|
164
172
|
this.whenRendered(() => {
|
|
165
173
|
const node = this.nodeOf(id);
|
|
174
|
+
if (!node) return;
|
|
166
175
|
const { width, height } = this._refs.viewport.getBoundingClientRect();
|
|
167
|
-
if (
|
|
176
|
+
if (width === 0) return;
|
|
168
177
|
this.setViewport(revealIn(this._state.viewport, node, width, height));
|
|
169
178
|
});
|
|
170
179
|
}
|
|
@@ -276,7 +285,7 @@ var JlFlow = class extends JlElement {
|
|
|
276
285
|
button.title = text;
|
|
277
286
|
button.setAttribute("aria-label", text);
|
|
278
287
|
}
|
|
279
|
-
for (const
|
|
288
|
+
for (const { element } of this._nodes.values()) element.setAttribute("aria-roledescription", jlText("node"));
|
|
280
289
|
for (const port of this._refs.nodes.querySelectorAll(".port")) port.title = jlText("dragToConnect");
|
|
281
290
|
}
|
|
282
291
|
renderLabel() {
|
|
@@ -305,10 +314,23 @@ var JlFlow = class extends JlElement {
|
|
|
305
314
|
this.applyViewport();
|
|
306
315
|
}
|
|
307
316
|
show(graph) {
|
|
308
|
-
this.
|
|
309
|
-
this.
|
|
317
|
+
this.keep(graph);
|
|
318
|
+
this.schedule();
|
|
310
319
|
if (!this._state.fitted && graph.nodes.length > 0) requestAnimationFrame(() => this.fit());
|
|
311
320
|
}
|
|
321
|
+
keep(graph) {
|
|
322
|
+
this._state.graph = graph;
|
|
323
|
+
this._state.nodes = nodesById(graph);
|
|
324
|
+
}
|
|
325
|
+
/** Draws on the next microtask: the inputs set while connecting, or an edit and its echo, give one drawing. */
|
|
326
|
+
schedule() {
|
|
327
|
+
if (this._state.queued) return;
|
|
328
|
+
this._state.queued = true;
|
|
329
|
+
queueMicrotask(() => {
|
|
330
|
+
this._state.queued = false;
|
|
331
|
+
this.render();
|
|
332
|
+
});
|
|
333
|
+
}
|
|
312
334
|
/** An edit: drawn, kept, and sent to the page. */
|
|
313
335
|
commit(graph) {
|
|
314
336
|
this.graph.set(graph);
|
|
@@ -341,7 +363,7 @@ var JlFlow = class extends JlElement {
|
|
|
341
363
|
this.commit(removeNode(graph, node));
|
|
342
364
|
}
|
|
343
365
|
nodeOf(id) {
|
|
344
|
-
return this._state.
|
|
366
|
+
return this._state.nodes.get(id);
|
|
345
367
|
}
|
|
346
368
|
pointerDown(event) {
|
|
347
369
|
const target = targetOf(event);
|
|
@@ -420,10 +442,10 @@ var JlFlow = class extends JlElement {
|
|
|
420
442
|
x: world.x - gesture.offset.x,
|
|
421
443
|
y: world.y - gesture.offset.y
|
|
422
444
|
});
|
|
423
|
-
this.
|
|
424
|
-
const
|
|
425
|
-
if (
|
|
426
|
-
this.
|
|
445
|
+
this.keep(moveNode(this._state.graph, gesture.node, position));
|
|
446
|
+
const drawn = this._nodes.get(gesture.node);
|
|
447
|
+
if (drawn) this.place(drawn.element, position);
|
|
448
|
+
this.renderEdgesOf(gesture.node);
|
|
427
449
|
}
|
|
428
450
|
drawDraft(gesture, event) {
|
|
429
451
|
const node = this.nodeOf(gesture.node);
|
|
@@ -576,17 +598,37 @@ var JlFlow = class extends JlElement {
|
|
|
576
598
|
this.renderNodes();
|
|
577
599
|
this.renderEdges();
|
|
578
600
|
}
|
|
579
|
-
/**
|
|
601
|
+
/**
|
|
602
|
+
* The nodes' elements stay from one drawing to the next: the focused one keeps the focus. A node is drawn again
|
|
603
|
+
* only when its object or its free exits changed: moving one node draws that one.
|
|
604
|
+
*/
|
|
580
605
|
renderNodes() {
|
|
581
|
-
const nodes = this._state
|
|
582
|
-
const
|
|
583
|
-
for (const [id, element] of this._nodes) if (!ids.has(id)) {
|
|
606
|
+
const { graph, nodes } = this._state;
|
|
607
|
+
for (const [id, { element }] of this._nodes) if (!nodes.has(id)) {
|
|
584
608
|
element.remove();
|
|
585
609
|
this._nodes.delete(id);
|
|
586
610
|
}
|
|
587
|
-
|
|
611
|
+
const used = usedPorts(graph, nodes);
|
|
612
|
+
for (const node of graph.nodes) {
|
|
613
|
+
const free = this.readonly.get() ? [] : portsOf(node).filter((port) => isPortFree(used, node, port.id));
|
|
614
|
+
this.drawNodeIfChanged(this._nodes.get(node.id) ?? this.createNode(node.id), node, new Set(free));
|
|
615
|
+
}
|
|
588
616
|
this.renderSelection();
|
|
589
617
|
}
|
|
618
|
+
/** Draws a node again only when more than its position changed: a node that only moved is moved. */
|
|
619
|
+
drawNodeIfChanged(drawn, node, free) {
|
|
620
|
+
const freePorts = [...free].map((port) => port.id).join(PORT_SEPARATOR);
|
|
621
|
+
const moves = drawn.node !== void 0 && drawn.freePorts === freePorts && movedOnly(drawn.node, node);
|
|
622
|
+
Object.assign(drawn, {
|
|
623
|
+
freePorts,
|
|
624
|
+
node
|
|
625
|
+
});
|
|
626
|
+
if (moves) {
|
|
627
|
+
this.place(drawn.element, node.position);
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
this.drawNode(drawn.element, node, free);
|
|
631
|
+
}
|
|
590
632
|
createNode(id) {
|
|
591
633
|
const element = /* @__PURE__ */ jsx("div", {
|
|
592
634
|
class: "node",
|
|
@@ -596,11 +638,16 @@ var JlFlow = class extends JlElement {
|
|
|
596
638
|
"aria-roledescription": jlText("node"),
|
|
597
639
|
attrs: { part: "node" }
|
|
598
640
|
});
|
|
599
|
-
|
|
641
|
+
const drawn = {
|
|
642
|
+
element,
|
|
643
|
+
freePorts: "",
|
|
644
|
+
node: void 0
|
|
645
|
+
};
|
|
646
|
+
this._nodes.set(id, drawn);
|
|
600
647
|
this._refs.nodes.append(element);
|
|
601
|
-
return
|
|
648
|
+
return drawn;
|
|
602
649
|
}
|
|
603
|
-
drawNode(element, node) {
|
|
650
|
+
drawNode(element, node, free) {
|
|
604
651
|
const ports = portsOf(node);
|
|
605
652
|
element.setAttribute("aria-label", node.label);
|
|
606
653
|
setOrRemove(element, "aria-description", noteOf(node));
|
|
@@ -662,7 +709,11 @@ var JlFlow = class extends JlElement {
|
|
|
662
709
|
}) : null,
|
|
663
710
|
/* @__PURE__ */ jsx("span", {
|
|
664
711
|
class: "ports",
|
|
665
|
-
children: ports.map((port, index) => this.portElement(node, port,
|
|
712
|
+
children: ports.map((port, index) => this.portElement(node, port, {
|
|
713
|
+
count: ports.length,
|
|
714
|
+
free: free.has(port),
|
|
715
|
+
index
|
|
716
|
+
}))
|
|
666
717
|
})
|
|
667
718
|
] }));
|
|
668
719
|
this.place(element, node.position);
|
|
@@ -675,8 +726,7 @@ var JlFlow = class extends JlElement {
|
|
|
675
726
|
}
|
|
676
727
|
element.style.setProperty("--tone", color);
|
|
677
728
|
}
|
|
678
|
-
portElement(node, port,
|
|
679
|
-
const free = !this.readonly.get() && isPortFree(this._state.graph, node, port.id);
|
|
729
|
+
portElement(node, port, { count, free, index }) {
|
|
680
730
|
const element = /* @__PURE__ */ jsxs("span", {
|
|
681
731
|
class: "port",
|
|
682
732
|
"data-port": port.id,
|
|
@@ -711,48 +761,82 @@ var JlFlow = class extends JlElement {
|
|
|
711
761
|
}
|
|
712
762
|
renderSelection() {
|
|
713
763
|
const selected = this.selected.get();
|
|
714
|
-
for (const [id, element] of this._nodes) {
|
|
764
|
+
for (const [id, { element }] of this._nodes) {
|
|
715
765
|
element.classList.toggle("selected", id === selected);
|
|
716
766
|
element.part.toggle("selected", id === selected);
|
|
717
767
|
setOrRemove(element, "aria-current", id === selected ? "true" : "");
|
|
718
768
|
}
|
|
719
769
|
}
|
|
770
|
+
/** The edges' groups stay from one drawing to the next, changed in place; those of removed edges go. */
|
|
720
771
|
renderEdges() {
|
|
721
|
-
const { edge: selected, graph } = this._state;
|
|
772
|
+
const { edge: selected, graph, nodes } = this._state;
|
|
722
773
|
const groups = graph.edges.flatMap((edge) => {
|
|
723
|
-
const ends = edgeEnds(
|
|
724
|
-
return ends ? [this.
|
|
774
|
+
const ends = edgeEnds(nodes, edge);
|
|
775
|
+
return ends ? [this.drawEdge(edge.id, ends, {
|
|
776
|
+
selected: edge.id === selected,
|
|
777
|
+
taken: isEdgeTaken(nodes, edge)
|
|
778
|
+
})] : [];
|
|
725
779
|
});
|
|
726
|
-
|
|
780
|
+
const kept = new Set(groups);
|
|
781
|
+
for (const [id, { group }] of this._edges) if (!kept.has(group)) {
|
|
782
|
+
group.remove();
|
|
783
|
+
this._edges.delete(id);
|
|
784
|
+
}
|
|
785
|
+
this.placeInOrder([...groups, this._svg.draft]);
|
|
786
|
+
this.renderEdgeTool();
|
|
787
|
+
}
|
|
788
|
+
/** Puts the edges in the graph's order, the draft last: those already in place stay. */
|
|
789
|
+
placeInOrder(elements) {
|
|
790
|
+
const root = this._svg.root;
|
|
791
|
+
elements.forEach((element, index) => {
|
|
792
|
+
const current = root.children.item(index);
|
|
793
|
+
if (current !== element) root.insertBefore(element, current);
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
/** The edges of a node being dragged follow it; the others stay as they are. */
|
|
797
|
+
renderEdgesOf(id) {
|
|
798
|
+
const { graph, nodes } = this._state;
|
|
799
|
+
for (const edge of graph.edges.filter((candidate) => candidate.from === id || candidate.to === id)) {
|
|
800
|
+
const ends = edgeEnds(nodes, edge);
|
|
801
|
+
const drawn = this._edges.get(edge.id);
|
|
802
|
+
if (ends && drawn) this.drawPath(drawn, ends);
|
|
803
|
+
}
|
|
727
804
|
this.renderEdgeTool();
|
|
728
805
|
}
|
|
729
806
|
/**
|
|
730
807
|
* An edge, with a wide invisible twin that catches the pointer: a thin line is still easy to press. One a run took
|
|
731
808
|
* stands out.
|
|
732
809
|
*/
|
|
733
|
-
|
|
734
|
-
const
|
|
810
|
+
drawEdge(id, ends, { selected, taken }) {
|
|
811
|
+
const drawn = this._edges.get(id) ?? this.createEdge(id);
|
|
735
812
|
const states = [selected ? "selected" : "", taken ? "taken" : ""].filter((state) => state !== "");
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
group
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
"
|
|
747
|
-
|
|
748
|
-
}
|
|
749
|
-
|
|
813
|
+
drawn.group.setAttribute("class", ["edge-group", ...states].join(" "));
|
|
814
|
+
drawn.line.setAttribute("data-tone", ends.tone);
|
|
815
|
+
drawn.line.setAttribute("part", ["edge", ...states].join(" "));
|
|
816
|
+
this.drawPath(drawn, ends);
|
|
817
|
+
return drawn.group;
|
|
818
|
+
}
|
|
819
|
+
createEdge(id) {
|
|
820
|
+
const group = svgElement("g", { "data-edge": id });
|
|
821
|
+
const drawn = {
|
|
822
|
+
group,
|
|
823
|
+
hit: svgElement("path", { class: "edge-hit" }),
|
|
824
|
+
line: svgElement("path", { class: "edge" })
|
|
825
|
+
};
|
|
826
|
+
group.append(drawn.hit, drawn.line);
|
|
827
|
+
this._edges.set(id, drawn);
|
|
828
|
+
return drawn;
|
|
829
|
+
}
|
|
830
|
+
drawPath({ hit, line }, ends) {
|
|
831
|
+
const d = edgePath(ends.from, ends.to);
|
|
832
|
+
hit.setAttribute("d", d);
|
|
833
|
+
line.setAttribute("d", d);
|
|
750
834
|
}
|
|
751
835
|
/** The button that removes the selected edge, in its middle. */
|
|
752
836
|
renderEdgeTool() {
|
|
753
837
|
const { edge: selected, graph } = this._state;
|
|
754
838
|
const edge = graph.edges.find((candidate) => candidate.id === selected);
|
|
755
|
-
const ends = edge ? edgeEnds(
|
|
839
|
+
const ends = edge ? edgeEnds(this._state.nodes, edge) : void 0;
|
|
756
840
|
const button = this._refs.removeEdge;
|
|
757
841
|
button.hidden = ends === void 0 || this.readonly.get();
|
|
758
842
|
if (!ends) return;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/organisms/jl-navbar.css?inline
|
|
2
|
-
var jl_navbar_default = ":host{--max-width:none;display:block;container-type:inline-size}:host([sticky]){z-index:10;position:sticky;top:0}header{border-bottom:1px solid var(--jl-line);background:var(--jl-surface)}.bar{max-width:var(--max-width);align-items:center;gap:24px;height:60px;margin:0 auto;padding:0 20px;display:flex}.brand{color:var(--jl-text);font-size:var(--jl-font-lg);letter-spacing:-.01em;flex:none;align-items:center;font-weight:700;display:flex}::slotted([slot=brand]){color:inherit;align-items:center;gap:8px;text-decoration:none;display:inline-flex}ul{margin:0;padding:0;list-style:none;display:flex}.links{flex:1;min-width:0}.links ul{align-items:center;gap:2px}.link{border-radius:var(--jl-radius-sm);height:34px;color:var(--jl-text-2);font-size:var(--jl-font-md);white-space:nowrap;transition:background var(--jl-fast) var(--jl-ease), color var(--jl-fast) var(--jl-ease);align-items:center;padding:0 12px;font-weight:600;text-decoration:none;display:inline-flex}.link:hover{background:var(--jl-surface-2);color:var(--jl-text)}.link[aria-current=page]{color:var(--jl-accent)}.actions{flex:none;align-items:center;gap:8px;display:flex}.toggle{width:var(--jl-control-md);height:var(--jl-control-md);border-radius:var(--jl-radius-sm);color:var(--jl-text);cursor:pointer;background:0 0;border:none;flex:none;justify-content:center;align-items:center;margin-right:-6px;padding:0;display:none}.toggle:hover{background:var(--jl-surface-2)}.drawer{display:none}@container (width<720px){.bar{gap:12px;padding:0 16px}.links{display:none}.actions{margin-left:auto}.toggle{display:inline-flex}
|
|
2
|
+
var jl_navbar_default = ":host{--max-width:none;display:block;container-type:inline-size}:host([sticky]){z-index:10;position:sticky;top:0}header{border-bottom:1px solid var(--jl-line);background:var(--jl-surface)}.bar{max-width:var(--max-width);align-items:center;gap:24px;height:60px;margin:0 auto;padding:0 20px;display:flex}.brand{color:var(--jl-text);font-size:var(--jl-font-lg);letter-spacing:-.01em;flex:none;align-items:center;font-weight:700;display:flex}::slotted([slot=brand]){color:inherit;align-items:center;gap:8px;text-decoration:none;display:inline-flex}ul{margin:0;padding:0;list-style:none;display:flex}.links{flex:1;min-width:0}.links ul{align-items:center;gap:2px}.link{border-radius:var(--jl-radius-sm);height:34px;color:var(--jl-text-2);font-size:var(--jl-font-md);white-space:nowrap;transition:background var(--jl-fast) var(--jl-ease), color var(--jl-fast) var(--jl-ease);align-items:center;padding:0 12px;font-weight:600;text-decoration:none;display:inline-flex}.link:hover{background:var(--jl-surface-2);color:var(--jl-text)}.link[aria-current=page]{color:var(--jl-accent)}.actions{flex:none;align-items:center;gap:8px;display:flex}.toggle{width:var(--jl-control-md);height:var(--jl-control-md);border-radius:var(--jl-radius-sm);color:var(--jl-text);cursor:pointer;background:0 0;border:none;flex:none;justify-content:center;align-items:center;margin-right:-6px;padding:0;display:none}.toggle:hover{background:var(--jl-surface-2)}.drawer{display:none}@container (width<720px){.bar{gap:12px;padding:0 16px}.links{display:none}.actions{margin-left:auto}.toggle{display:inline-flex}:host([expanded]) .drawer{border-top:1px solid var(--jl-line);animation:drop var(--jl-fast) var(--jl-ease);padding:8px 12px 12px;display:block}.drawer ul{flex-direction:column;gap:2px}.drawer .link{height:40px;display:flex}.drawer .link[aria-current=page]{background:var(--jl-accent-soft)}}@keyframes drop{0%{opacity:0;transform:translateY(-4px)}}";
|
|
3
3
|
export { jl_navbar_default as default };
|
|
@@ -30,6 +30,6 @@ export declare class JlNavbar extends JlElement {
|
|
|
30
30
|
protected drawTexts(): void;
|
|
31
31
|
private renderLabel;
|
|
32
32
|
private renderToggleLabel;
|
|
33
|
-
/** Opens or closes the list of links under the bar, on a narrow bar
|
|
33
|
+
/** Opens or closes the list of links under the bar, on a narrow bar: the CSS shows it while `expanded`. */
|
|
34
34
|
private setDrawer;
|
|
35
35
|
}
|
|
@@ -71,7 +71,6 @@ var JlNavbar = class extends JlElement {
|
|
|
71
71
|
}), /* @__PURE__ */ jsx("nav", {
|
|
72
72
|
class: "drawer",
|
|
73
73
|
id: "drawer",
|
|
74
|
-
hidden: true,
|
|
75
74
|
children: /* @__PURE__ */ jsx("ul", {})
|
|
76
75
|
})]
|
|
77
76
|
});
|
|
@@ -114,16 +113,15 @@ var JlNavbar = class extends JlElement {
|
|
|
114
113
|
this._refs.drawer.setAttribute("aria-label", label);
|
|
115
114
|
}
|
|
116
115
|
renderToggleLabel() {
|
|
117
|
-
const open =
|
|
116
|
+
const open = this.hasAttribute("expanded");
|
|
118
117
|
this._refs.toggle.setAttribute("aria-label", open ? jlText("closeMenu") : jlText("menu"));
|
|
119
118
|
}
|
|
120
|
-
/** Opens or closes the list of links under the bar, on a narrow bar
|
|
119
|
+
/** Opens or closes the list of links under the bar, on a narrow bar: the CSS shows it while `expanded`. */
|
|
121
120
|
setDrawer(open) {
|
|
122
|
-
this.
|
|
121
|
+
this.reflect("expanded", open);
|
|
123
122
|
this._refs.toggle.setAttribute("aria-expanded", String(open));
|
|
124
123
|
this.renderToggleLabel();
|
|
125
124
|
this._refs.toggleIcon.name.set(open ? CLOSE_ICON : MENU_ICON);
|
|
126
|
-
this.reflect("expanded", open);
|
|
127
125
|
}
|
|
128
126
|
};
|
|
129
127
|
JlNavbar.register();
|
|
@@ -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: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}";
|
|
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}.description:empty{display:none}.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 };
|
|
@@ -16,7 +16,6 @@ var JlPageHeader = class extends JlElement {
|
|
|
16
16
|
}, { attribute: "heading" });
|
|
17
17
|
description = this.useChange("", (value) => {
|
|
18
18
|
this._refs.description.textContent = value;
|
|
19
|
-
this._refs.description.hidden = value === "";
|
|
20
19
|
}, { attribute: "description" });
|
|
21
20
|
/** Draws a line under the header, between it and the page's content. */
|
|
22
21
|
divided = this.useChange(false, (value) => this.reflect("divided", value), { attribute: "divided" });
|
|
@@ -44,10 +43,7 @@ var JlPageHeader = class extends JlElement {
|
|
|
44
43
|
class: "main",
|
|
45
44
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
46
45
|
class: "titles",
|
|
47
|
-
children: [/* @__PURE__ */ jsx("h1", {}), /* @__PURE__ */ jsx("p", {
|
|
48
|
-
class: "description",
|
|
49
|
-
hidden: true
|
|
50
|
-
})]
|
|
46
|
+
children: [/* @__PURE__ */ jsx("h1", {}), /* @__PURE__ */ jsx("p", { class: "description" })]
|
|
51
47
|
}), /* @__PURE__ */ jsx("div", {
|
|
52
48
|
class: "actions",
|
|
53
49
|
hidden: true,
|
|
@@ -25,10 +25,11 @@ export declare class JlPageOutlet extends JlElement {
|
|
|
25
25
|
templateHtml(): Node;
|
|
26
26
|
templateCss(): string;
|
|
27
27
|
private showOnceLoaded;
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Puts the page in the current one's place, and brings its top into view when the current one's was scrolled past,
|
|
30
|
+
* as a page loaded by the browser starts at its top.
|
|
31
|
+
*/
|
|
29
32
|
private reveal;
|
|
30
33
|
private pages;
|
|
31
34
|
private drawWaiting;
|
|
32
|
-
/** Brings the top of the new page into view, as a page loaded by the browser starts at its top. */
|
|
33
|
-
private scrollToTop;
|
|
34
35
|
}
|
|
@@ -47,7 +47,6 @@ var JlPageOutlet = class extends JlElement {
|
|
|
47
47
|
this._swap.pending?.abort();
|
|
48
48
|
for (const dropped of this.pages().filter((child) => child.slot === NEXT_SLOT)) dropped.remove();
|
|
49
49
|
if (this.pages().length === 0) {
|
|
50
|
-
this.append(page);
|
|
51
50
|
this.reveal(page);
|
|
52
51
|
return;
|
|
53
52
|
}
|
|
@@ -82,12 +81,17 @@ var JlPageOutlet = class extends JlElement {
|
|
|
82
81
|
pending.abort();
|
|
83
82
|
this.reveal(page);
|
|
84
83
|
}
|
|
85
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Puts the page in the current one's place, and brings its top into view when the current one's was scrolled past,
|
|
86
|
+
* as a page loaded by the browser starts at its top.
|
|
87
|
+
*/
|
|
86
88
|
reveal(page) {
|
|
89
|
+
const scrolledPast = this.getBoundingClientRect().top < 0;
|
|
87
90
|
for (const left of this.pages().filter((child) => child !== page)) left.remove();
|
|
88
91
|
page.removeAttribute("slot");
|
|
92
|
+
if (page.parentElement !== this) this.append(page);
|
|
89
93
|
this.drawWaiting(false);
|
|
90
|
-
this.
|
|
94
|
+
if (scrolledPast) this.scrollIntoView({ block: "start" });
|
|
91
95
|
this.events.emit("show", page);
|
|
92
96
|
}
|
|
93
97
|
pages() {
|
|
@@ -97,11 +101,6 @@ var JlPageOutlet = class extends JlElement {
|
|
|
97
101
|
setOrRemove(this, "aria-busy", waiting ? "true" : "");
|
|
98
102
|
this.whenRendered(() => this._refs.line.active.set(waiting));
|
|
99
103
|
}
|
|
100
|
-
/** Brings the top of the new page into view, as a page loaded by the browser starts at its top. */
|
|
101
|
-
scrollToTop() {
|
|
102
|
-
if (this.getBoundingClientRect().top >= 0) return;
|
|
103
|
-
this.scrollIntoView({ block: "start" });
|
|
104
|
-
}
|
|
105
104
|
};
|
|
106
105
|
JlPageOutlet.register();
|
|
107
106
|
export { JlPageOutlet };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/organisms/jl-side-nav.css?inline
|
|
2
|
-
var jl_side_nav_default = ":host{width:var(--width,248px);height:100%;min-height:0;transition:width var(--jl-slow) var(--jl-ease);display:block}:host([rail]){width:var(--rail-width,60px)}nav{height:100%;color:var(--jl-text-2);font-size:var(--jl-font-md);flex-direction:column;gap:8px;padding:12px 8px;display:flex;overflow:hidden}.bottom{flex-direction:column;flex:none;gap:8px;margin-top:auto;display:flex}::slotted([slot=header]){flex:none}.fold::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
|
|
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(:not([collapsible])) .fold,:host([in-drawer]) .fold{display:none}: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:has(>.children:not([hidden]))>.item .chevron,.entry:has(>.children:not([hidden]))>.expander jl-icon{transform:rotate(90deg)}.expander{border-radius:var(--jl-radius-xs);width:24px;height:24px;color:var(--jl-faint);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;padding:0;display:inline-flex;position:absolute;top:5px;right:6px}.expander:hover{background:var(--jl-surface-3);color:var(--jl-text)}.entry:has(>.expander)>.item{padding-right:36px}:host([rail]) .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 };
|
|
@@ -59,6 +59,8 @@ export declare class JlSideNav<Id extends string = string> extends JlElement {
|
|
|
59
59
|
private readonly _prefix;
|
|
60
60
|
/** The parents people opened, or that hold the active item. */
|
|
61
61
|
private readonly _state;
|
|
62
|
+
/** The sections and the form (rail or whole) the items were drawn for, and whether a drawing waits. */
|
|
63
|
+
private readonly _drawn;
|
|
62
64
|
private readonly _refs;
|
|
63
65
|
templateHtml(): Node;
|
|
64
66
|
templateCss(): string;
|
|
@@ -69,10 +71,15 @@ export declare class JlSideNav<Id extends string = string> extends JlElement {
|
|
|
69
71
|
/** Whether it shows as the rail now: folded, and not in a drawer. */
|
|
70
72
|
private isRail;
|
|
71
73
|
private fold;
|
|
72
|
-
/**
|
|
73
|
-
private
|
|
74
|
+
/** Draws on the next microtask: the inputs set while connecting give one drawing, not one each. */
|
|
75
|
+
private schedule;
|
|
76
|
+
/** The rail, or the whole side nav, said on the host (`rail`) for the styles and the page. */
|
|
77
|
+
private flush;
|
|
78
|
+
/** Draws the items again only for other sections or the other form: the rail's rows lead elsewhere. */
|
|
79
|
+
private renderItems;
|
|
74
80
|
protected drawTexts(): void;
|
|
75
81
|
private renderLabel;
|
|
82
|
+
/** The fold button's icon and text; the CSS hides it unless `collapsible`, and in a drawer. */
|
|
76
83
|
private renderFold;
|
|
77
84
|
private choose;
|
|
78
85
|
/** Up and Down move between the rows people can see, Right opens a parent, Left closes it or goes up to it. */
|