@syware/jlib 0.12.1 → 0.13.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.
Files changed (141) hide show
  1. package/dist/atoms/jl-avatar.css.js +1 -1
  2. package/dist/atoms/jl-avatar.js +1 -8
  3. package/dist/atoms/jl-button.css.js +1 -1
  4. package/dist/atoms/jl-button.js +4 -6
  5. package/dist/atoms/jl-checkbox.css.js +1 -1
  6. package/dist/atoms/jl-checkbox.js +8 -10
  7. package/dist/atoms/jl-chip.css.js +1 -1
  8. package/dist/atoms/jl-chip.js +3 -11
  9. package/dist/atoms/jl-divider.css.js +1 -1
  10. package/dist/atoms/jl-divider.js +1 -5
  11. package/dist/atoms/jl-icon.css.js +1 -1
  12. package/dist/atoms/jl-icon.d.ts +2 -0
  13. package/dist/atoms/jl-icon.js +5 -1
  14. package/dist/atoms/jl-input.d.ts +7 -2
  15. package/dist/atoms/jl-input.js +36 -31
  16. package/dist/atoms/jl-link.css.js +1 -1
  17. package/dist/atoms/jl-link.js +3 -6
  18. package/dist/atoms/jl-rating.css.js +1 -1
  19. package/dist/atoms/jl-rating.d.ts +2 -2
  20. package/dist/atoms/jl-rating.js +17 -35
  21. package/dist/atoms/jl-select.d.ts +8 -3
  22. package/dist/atoms/jl-select.js +26 -13
  23. package/dist/atoms/jl-skeleton.d.ts +1 -0
  24. package/dist/atoms/jl-skeleton.js +4 -1
  25. package/dist/atoms/jl-slider.d.ts +4 -0
  26. package/dist/atoms/jl-slider.js +29 -15
  27. package/dist/atoms/jl-switch.css.js +1 -1
  28. package/dist/atoms/jl-switch.js +2 -8
  29. package/dist/atoms/jl-textarea.css.js +1 -1
  30. package/dist/atoms/jl-textarea.d.ts +4 -5
  31. package/dist/atoms/jl-textarea.js +15 -30
  32. package/dist/lib/calendar.js +3 -2
  33. package/dist/lib/floating.d.ts +10 -0
  34. package/dist/lib/floating.js +27 -8
  35. package/dist/lib/flow.d.ts +7 -3
  36. package/dist/lib/flow.js +19 -8
  37. package/dist/lib/indicator.d.ts +16 -0
  38. package/dist/lib/indicator.js +32 -6
  39. package/dist/lib/intl.d.ts +6 -0
  40. package/dist/lib/intl.js +19 -0
  41. package/dist/lib/palette.js +1 -6
  42. package/dist/lib/table.d.ts +14 -2
  43. package/dist/lib/table.js +50 -39
  44. package/dist/molecules/jl-accordion-item.css.js +1 -1
  45. package/dist/molecules/jl-accordion-item.js +1 -5
  46. package/dist/molecules/jl-account-button.css.js +1 -1
  47. package/dist/molecules/jl-account-button.js +1 -5
  48. package/dist/molecules/jl-alert.css.js +1 -1
  49. package/dist/molecules/jl-alert.d.ts +5 -5
  50. package/dist/molecules/jl-alert.js +4 -13
  51. package/dist/molecules/jl-avatar-group.d.ts +7 -5
  52. package/dist/molecules/jl-avatar-group.js +15 -5
  53. package/dist/molecules/jl-breadcrumb.d.ts +7 -4
  54. package/dist/molecules/jl-breadcrumb.js +32 -8
  55. package/dist/molecules/jl-calendar.d.ts +12 -3
  56. package/dist/molecules/jl-calendar.js +79 -48
  57. package/dist/molecules/jl-card.css.js +1 -1
  58. package/dist/molecules/jl-card.js +2 -8
  59. package/dist/molecules/jl-chip-group.css.js +1 -1
  60. package/dist/molecules/jl-chip-group.d.ts +6 -2
  61. package/dist/molecules/jl-chip-group.js +13 -18
  62. package/dist/molecules/jl-code-block.css.js +1 -1
  63. package/dist/molecules/jl-code-block.d.ts +7 -5
  64. package/dist/molecules/jl-code-block.js +19 -22
  65. package/dist/molecules/jl-combobox.css.js +1 -1
  66. package/dist/molecules/jl-combobox.d.ts +4 -0
  67. package/dist/molecules/jl-combobox.js +33 -19
  68. package/dist/molecules/jl-date-picker.d.ts +6 -0
  69. package/dist/molecules/jl-date-picker.js +29 -9
  70. package/dist/molecules/jl-empty.css.js +1 -1
  71. package/dist/molecules/jl-empty.js +4 -19
  72. package/dist/molecules/jl-field.css.js +1 -1
  73. package/dist/molecules/jl-field.d.ts +7 -1
  74. package/dist/molecules/jl-field.js +35 -23
  75. package/dist/molecules/jl-file-drop.css.js +1 -1
  76. package/dist/molecules/jl-file-drop.js +1 -3
  77. package/dist/molecules/jl-input-list.css.js +1 -1
  78. package/dist/molecules/jl-input-list.d.ts +12 -1
  79. package/dist/molecules/jl-input-list.js +81 -51
  80. package/dist/molecules/jl-list-item.css.js +1 -1
  81. package/dist/molecules/jl-list-item.d.ts +3 -1
  82. package/dist/molecules/jl-list-item.js +26 -27
  83. package/dist/molecules/jl-load-state.css.js +1 -1
  84. package/dist/molecules/jl-load-state.d.ts +6 -1
  85. package/dist/molecules/jl-load-state.js +15 -18
  86. package/dist/molecules/jl-menu.d.ts +1 -0
  87. package/dist/molecules/jl-menu.js +9 -2
  88. package/dist/molecules/jl-pagination.css.js +1 -1
  89. package/dist/molecules/jl-pagination.d.ts +7 -1
  90. package/dist/molecules/jl-pagination.js +43 -35
  91. package/dist/molecules/jl-search.css.js +1 -1
  92. package/dist/molecules/jl-search.js +4 -12
  93. package/dist/molecules/jl-segmented.css.js +1 -1
  94. package/dist/molecules/jl-segmented.d.ts +4 -2
  95. package/dist/molecules/jl-segmented.js +19 -26
  96. package/dist/molecules/jl-stat.css.js +1 -1
  97. package/dist/molecules/jl-stat.js +2 -8
  98. package/dist/molecules/jl-steps.d.ts +10 -3
  99. package/dist/molecules/jl-steps.js +82 -49
  100. package/dist/molecules/jl-tabs.d.ts +5 -2
  101. package/dist/molecules/jl-tabs.js +31 -25
  102. package/dist/molecules/jl-tag-input.css.js +1 -1
  103. package/dist/molecules/jl-tag-input.d.ts +13 -1
  104. package/dist/molecules/jl-tag-input.js +57 -30
  105. package/dist/molecules/jl-timeline.css.js +1 -1
  106. package/dist/molecules/jl-timeline.d.ts +3 -1
  107. package/dist/molecules/jl-timeline.js +9 -14
  108. package/dist/molecules/jl-toast.css.js +1 -1
  109. package/dist/molecules/jl-toast.js +2 -10
  110. package/dist/molecules/jl-tooltip.d.ts +2 -1
  111. package/dist/molecules/jl-tooltip.js +11 -15
  112. package/dist/organisms/jl-command-palette.css.js +1 -1
  113. package/dist/organisms/jl-command-palette.d.ts +8 -1
  114. package/dist/organisms/jl-command-palette.js +73 -42
  115. package/dist/organisms/jl-confirm.css.js +1 -1
  116. package/dist/organisms/jl-confirm.js +1 -5
  117. package/dist/organisms/jl-dialog.css.js +1 -1
  118. package/dist/organisms/jl-dialog.js +1 -5
  119. package/dist/organisms/jl-drawer.css.js +1 -1
  120. package/dist/organisms/jl-drawer.js +1 -3
  121. package/dist/organisms/jl-flow.d.ts +18 -2
  122. package/dist/organisms/jl-flow.js +128 -44
  123. package/dist/organisms/jl-navbar.css.js +1 -1
  124. package/dist/organisms/jl-navbar.d.ts +1 -1
  125. package/dist/organisms/jl-navbar.js +3 -5
  126. package/dist/organisms/jl-page-header.css.js +1 -1
  127. package/dist/organisms/jl-page-header.js +1 -5
  128. package/dist/organisms/jl-page-outlet.d.ts +4 -3
  129. package/dist/organisms/jl-page-outlet.js +7 -8
  130. package/dist/organisms/jl-side-nav.css.js +1 -1
  131. package/dist/organisms/jl-side-nav.d.ts +9 -2
  132. package/dist/organisms/jl-side-nav.js +44 -16
  133. package/dist/organisms/jl-tab-bar.css.js +1 -1
  134. package/dist/organisms/jl-tab-bar.js +0 -2
  135. package/dist/organisms/jl-table.css.js +1 -1
  136. package/dist/organisms/jl-table.d.ts +18 -6
  137. package/dist/organisms/jl-table.js +91 -57
  138. package/dist/organisms/jl-tree.css.js +1 -1
  139. package/dist/organisms/jl-tree.d.ts +16 -13
  140. package/dist/organisms/jl-tree.js +72 -70
  141. package/package.json +1 -1
@@ -44,7 +44,7 @@ var JlSideNav = class extends JlElement {
44
44
  static selector = "jl-side-nav";
45
45
  /** `collapse`: people folded the side nav into its rail (true) or unfolded it (false), for the app to remember. */
46
46
  events = this.useEvents();
47
- sections = this.useChange([], () => this.render(), {
47
+ sections = this.useChange([], () => this.schedule(), {
48
48
  attribute: "sections",
49
49
  parse: parseSections
50
50
  });
@@ -56,24 +56,33 @@ var JlSideNav = class extends JlElement {
56
56
  /** Shows only the icons, in a narrow rail; the labels become tooltips. */
57
57
  collapsed = this.useChange(false, (value) => {
58
58
  this.reflect("collapsed", value);
59
- this.renderRail();
59
+ this.schedule();
60
60
  }, { attribute: "collapsed" });
61
61
  /** Adds a button at the bottom that folds the side nav into its rail and unfolds it. */
62
- collapsible = this.useChange(false, () => this.renderFold(), { attribute: "collapsible" });
62
+ collapsible = this.useChange(false, (value) => this.reflect("collapsible", value), { attribute: "collapsible" });
63
63
  /** The fold button's text while the side nav is open; jlib's own when empty. */
64
- collapseLabel = this.useChange("", () => this.renderFold(), { attribute: "collapse-label" });
64
+ collapseLabel = this.useChange("", () => this.schedule(), { attribute: "collapse-label" });
65
65
  /** Its hint while the side nav is a rail; jlib's own when empty. */
66
- expandLabel = this.useChange("", () => this.renderFold(), { attribute: "expand-label" });
66
+ expandLabel = this.useChange("", () => this.schedule(), { attribute: "expand-label" });
67
67
  /**
68
68
  * Set by `jl-app-shell` while the side nav is its drawer, on a narrow screen: the drawer shows it whole, and its
69
69
  * fold button hides, `collapsed` waiting for a wide screen again.
70
70
  */
71
- inDrawer = this.useChange(false, () => this.renderRail(), { attribute: "in-drawer" });
71
+ inDrawer = this.useChange(false, (value) => {
72
+ this.reflect("in-drawer", value);
73
+ this.schedule();
74
+ }, { attribute: "in-drawer" });
72
75
  /** The name of the navigation for screen readers. */
73
76
  label = this.useChange("", () => this.renderLabel(), { attribute: "label" });
74
77
  _prefix = uniqueId("jl-side-nav");
75
78
  /** The parents people opened, or that hold the active item. */
76
79
  _state = { open: /* @__PURE__ */ new Set() };
80
+ /** The sections and the form (rail or whole) the items were drawn for, and whether a drawing waits. */
81
+ _drawn = {
82
+ queued: false,
83
+ rail: false,
84
+ sections: void 0
85
+ };
77
86
  _refs = this.useRefs((ref) => ({
78
87
  fold: ref(JlButton),
79
88
  nav: ref("nav"),
@@ -90,8 +99,7 @@ var JlSideNav = class extends JlElement {
90
99
  children: [/* @__PURE__ */ jsx("slot", { name: "footer" }), /* @__PURE__ */ jsx(JlButton, {
91
100
  class: "fold",
92
101
  variant: "ghost",
93
- block: true,
94
- hidden: true
102
+ block: true
95
103
  })]
96
104
  })
97
105
  ]
@@ -136,24 +144,45 @@ var JlSideNav = class extends JlElement {
136
144
  this.collapsed.set(collapsed);
137
145
  this.events.emit("collapse", collapsed);
138
146
  }
139
- /** The rail, or the whole side nav: drawn again, said on the host (`rail`) for the styles and the page. */
140
- renderRail() {
141
- this.reflect("rail", this.isRail());
142
- this.render();
147
+ /** Draws on the next microtask: the inputs set while connecting give one drawing, not one each. */
148
+ schedule() {
149
+ if (this._drawn.queued) return;
150
+ this._drawn.queued = true;
151
+ queueMicrotask(() => this.flush());
152
+ }
153
+ /** The rail, or the whole side nav, said on the host (`rail`) for the styles and the page. */
154
+ flush() {
155
+ this._drawn.queued = false;
156
+ const rail = this.isRail();
157
+ this.reflect("rail", rail);
143
158
  this.renderFold();
159
+ this.renderItems(rail);
160
+ }
161
+ /** Draws the items again only for other sections or the other form: the rail's rows lead elsewhere. */
162
+ renderItems(rail) {
163
+ const sections = this.sections.get();
164
+ if (sections === this._drawn.sections && rail === this._drawn.rail) return;
165
+ Object.assign(this._drawn, {
166
+ rail,
167
+ sections
168
+ });
169
+ this.render();
144
170
  }
145
171
  drawTexts() {
146
172
  this.renderLabel();
147
- this.renderFold();
148
- this.render();
173
+ for (const expander of this._refs.sections.querySelectorAll(".expander")) {
174
+ const name = findItem(this.sections.get(), expander.dataset.id ?? "")?.label ?? "";
175
+ expander.setAttribute("aria-label", jlText("showPagesOf", { name }));
176
+ }
177
+ this.schedule();
149
178
  }
150
179
  renderLabel() {
151
180
  this._refs.nav.setAttribute("aria-label", this.label.get() || jlText("mainNavigation"));
152
181
  }
182
+ /** The fold button's icon and text; the CSS hides it unless `collapsible`, and in a drawer. */
153
183
  renderFold() {
154
184
  const fold = this._refs.fold;
155
185
  const rail = this.isRail();
156
- fold.hidden = !this.collapsible.get() || this.inDrawer.get();
157
186
  fold.icon.set(rail ? EXPAND_ICON : COLLAPSE_ICON);
158
187
  fold.label.set(rail ? "" : this.collapseLabel.get() || jlText("collapseMenu"));
159
188
  fold.hint.set(rail ? this.expandLabel.get() || jlText("expandMenu") : "");
@@ -315,7 +344,6 @@ var JlSideNav = class extends JlElement {
315
344
  const id = (entry?.querySelector(ROW_SELECTOR))?.dataset.id ?? "";
316
345
  const open = this._state.open.has(id);
317
346
  list.hidden = !open;
318
- entry?.classList.toggle("open", open);
319
347
  for (const control of entry?.querySelectorAll(`[aria-controls="${list.id}"]`) ?? []) control.setAttribute("aria-expanded", String(open));
320
348
  }
321
349
  }
@@ -1,3 +1,3 @@
1
1
  // src/organisms/jl-tab-bar.css?inline
2
- var jl_tab_bar_default = ":host{--height:60px;display:block}nav{min-height:var(--height);padding-bottom:env(safe-area-inset-bottom);border-top:1px solid var(--jl-line);background:var(--jl-surface);grid-auto-columns:minmax(0,1fr);grid-auto-flow:column;display:grid}.items{display:contents}.item{min-width:0;color:var(--jl-muted);cursor:pointer;transition:color var(--jl-fast) var(--jl-ease);background:0 0;border:none;flex-direction:column;justify-content:center;align-items:center;gap:2px;padding:6px 2px;font-size:11px;font-weight:600;line-height:1.4;text-decoration:none;display:flex}.item:hover{color:var(--jl-text)}.item[aria-current=page]{color:var(--jl-accent)}.item:focus-visible{box-shadow:none}.icon{border-radius:var(--jl-radius-pill);width:52px;height:28px;transition:background var(--jl-fast) var(--jl-ease);place-items:center;display:inline-grid;position:relative}.item:focus-visible .icon{box-shadow:var(--jl-focus-ring)}.item[aria-current=page] .icon{background:var(--jl-accent-soft)}.label{text-overflow:ellipsis;white-space:nowrap;max-width:100%;padding:0 2px;overflow:hidden}.badge{border:2px solid var(--jl-surface);border-radius:var(--jl-radius-pill);background:var(--jl-accent);min-width:18px;height:18px;color:var(--jl-on-accent);text-align:center;padding:0 5px;font-size:10px;font-weight:700;line-height:14px;position:absolute;top:-4px;left:calc(50% + 4px)}";
2
+ var jl_tab_bar_default = ":host{--height:60px;display:block}nav{min-height:var(--height);padding-bottom:env(safe-area-inset-bottom);border-top:1px solid var(--jl-line);background:var(--jl-surface);grid-auto-columns:minmax(0,1fr);grid-auto-flow:column;display:grid}.items{display:contents}.item{min-width:0;color:var(--jl-muted);cursor:pointer;transition:color var(--jl-fast) var(--jl-ease);background:0 0;border:none;flex-direction:column;justify-content:center;align-items:center;gap:2px;padding:6px 2px;font-size:11px;font-weight:600;line-height:1.4;text-decoration:none;display:flex}.item:hover{color:var(--jl-text)}.item[aria-current=page]{color:var(--jl-accent)}.more:has(.label:empty){display:none}.item:focus-visible{box-shadow:none}.icon{border-radius:var(--jl-radius-pill);width:52px;height:28px;transition:background var(--jl-fast) var(--jl-ease);place-items:center;display:inline-grid;position:relative}.item:focus-visible .icon{box-shadow:var(--jl-focus-ring)}.item[aria-current=page] .icon{background:var(--jl-accent-soft)}.label{text-overflow:ellipsis;white-space:nowrap;max-width:100%;padding:0 2px;overflow:hidden}.badge{border:2px solid var(--jl-surface);border-radius:var(--jl-radius-pill);background:var(--jl-accent);min-width:18px;height:18px;color:var(--jl-on-accent);text-align:center;padding:0 5px;font-size:10px;font-weight:700;line-height:14px;position:absolute;top:-4px;left:calc(50% + 4px)}";
3
3
  export { jl_tab_bar_default as default };
@@ -47,7 +47,6 @@ var JlTabBar = class extends JlElement {
47
47
  /** The label of a last button for the other places (`More`); empty shows none. */
48
48
  more = this.useChange("", (value) => {
49
49
  this._refs.moreLabel.textContent = value;
50
- this._refs.more.hidden = value === "";
51
50
  }, { attribute: "more" });
52
51
  /** The name of the navigation for screen readers. */
53
52
  label = this.useChange("", () => this.drawTexts(), { attribute: "label" });
@@ -63,7 +62,6 @@ var JlTabBar = class extends JlElement {
63
62
  children: [/* @__PURE__ */ jsx("div", { class: "items" }), /* @__PURE__ */ jsxs("button", {
64
63
  class: "item more",
65
64
  type: "button",
66
- hidden: true,
67
65
  children: [/* @__PURE__ */ jsx("span", {
68
66
  class: "icon",
69
67
  children: /* @__PURE__ */ jsx(JlIcon, {
@@ -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;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}";
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[aria-sort]{color:var(--jl-text)}th[aria-sort] .sort-icon{color:var(--jl-accent)}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:has(>.select-cell .checkbox:checked) td{background:var(--jl-accent-soft)}tbody tr:not(.empty,.skeleton,.detail,:has(>.select-cell .checkbox:checked)):hover td,:host([striped]) tbody tr:nth-child(2n of :where(:not(.detail))):not(.empty,[data-marked],:has(>.select-cell .checkbox:checked)) td{background:var(--jl-surface-2)}:host([striped]) tbody tr:not(.empty,.skeleton,.detail,:has(>.select-cell .checkbox:checked)):hover td{background:var(--jl-surface-3)}:host([striped]) tbody tr:nth-child(2n of :where(:not(.detail))):not([data-marked],:has(>.select-cell .checkbox:checked))+.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 };
@@ -104,7 +104,10 @@ export declare class JlTable<Row extends object = TableRow, Extra extends string
104
104
  }>>;
105
105
  private readonly _source;
106
106
  private readonly _pending;
107
- /** The rows as drawn and their keys, by their place: the rows and their checkboxes carry the place. */
107
+ /**
108
+ * The rows as drawn in the order of `rows` (the rows and their checkboxes carry their place), by key, and their
109
+ * keys in the order shown; the keys each state was last drawn for, so a change redraws only the rows it concerns.
110
+ */
108
111
  private readonly _view;
109
112
  private readonly _refs;
110
113
  /** Draws what an open row shows under it, from the row: `(row) => <JlFacts items={…} />`. */
@@ -132,26 +135,35 @@ export declare class JlTable<Row extends object = TableRow, Extra extends string
132
135
  private span;
133
136
  private renderHead;
134
137
  private headerCell;
135
- /** The arrows and `aria-sort` of the headings, changed in place so a pressed heading keeps the focus. */
138
+ /** The arrows and `aria-sort` of the sortable headings, changed in place so a pressed heading keeps the focus. */
136
139
  private renderSortState;
137
- private sortedRows;
140
+ /** The drawn rows in the order of the sort; each row's sort value is read once, not at every comparison. */
141
+ private sortedView;
138
142
  private renderBody;
143
+ /** New rows, which show no state yet: the flush draws the selection, the marks and the open rows on them. */
139
144
  private setView;
145
+ /** The rows in the order of the sort, whose keys the select-all box goes by from now on. */
146
+ private placeInOrder;
147
+ /** Moves the rows into the order of the sort, each open row's detail with it: no row is drawn again. */
148
+ private renderOrder;
140
149
  private bodyRow;
141
150
  /** A cell's value, drawn by its renderer or in its format, with the row's description under it when it has one. */
142
151
  private cell;
143
152
  private cellValue;
144
153
  private skeletonRows;
145
154
  private emptyRow;
146
- /** The rows of data, without the details under the open ones. */
147
- private dataRows;
148
155
  private keyOf;
156
+ /**
157
+ * Draws a state on the rows whose keys came into it or left it since it was last drawn: checking or opening one
158
+ * row changes that row alone, whatever the number of rows.
159
+ */
160
+ private redraw;
149
161
  /** The bar and the shade of marked rows, changed in place. */
150
162
  private renderMarks;
151
163
  /** The details of the open rows, added under them and taken away in place: one that stays open keeps its content. */
152
164
  private renderExpansion;
153
165
  private renderRowOpen;
154
166
  private detailRow;
155
- /** The checkboxes and the shading of selected rows, changed in place. */
167
+ /** The checkboxes of the rows whose selection changed, and the select-all box. */
156
168
  private renderSelection;
157
169
  }
@@ -3,7 +3,7 @@ import { BASE_STYLES } from "../styles/shared.js";
3
3
  import { JlElement } from "../base/jl-element.js";
4
4
  import { jsonOf, oneOf, textOf } from "../lib/attributes.js";
5
5
  import { registerIcons } from "../lib/icons.js";
6
- import { columnAlign, columnWidth, fieldOf, formatCell, nextSortDirection, openRows, rowKeyOf, rowToggles, selectionState, sortRows, toggleAll, toggleKey, withRowOpen } from "../lib/table.js";
6
+ import { columnAlign, columnWidth, fieldOf, formatCell, nextSortDirection, openRows, rowKeyOf, rowToggles, selectionState, sortBy, toggleAll, toggleKey, withRowOpen } from "../lib/table.js";
7
7
  import { JlIcon } from "../atoms/jl-icon.js";
8
8
  import { setOrRemove } from "../lib/dom.js";
9
9
  import { JlBadge } from "../atoms/jl-badge.js";
@@ -31,7 +31,6 @@ var TABLE_EXPANSIONS = [
31
31
  "multiple"
32
32
  ];
33
33
  var MARKED_ATTRIBUTE = "data-marked";
34
- var EXPANDED_ATTRIBUTE = "data-expanded";
35
34
  var DETAIL_ID_PREFIX = "detail-";
36
35
  var DEFAULT_ROW_KEY = "id";
37
36
  var NO_SORT_KEY = "";
@@ -87,6 +86,17 @@ function detailOf(row) {
87
86
  }
88
87
  /** Whether a press ends a drag that selected text, which leaves the row as it was. */
89
88
  var isSelectingText = () => (document.getSelection()?.toString() ?? "") !== "";
89
+ var NO_ROW_STATES = () => ({
90
+ marked: [],
91
+ open: [],
92
+ selected: []
93
+ });
94
+ /** Ticks or clears a row's own checkbox, whose state the row's shade follows in CSS. */
95
+ function checkRow(element, on) {
96
+ const input = element.querySelector(":scope > .select-cell .checkbox");
97
+ if (input !== null) input.checked = on;
98
+ }
99
+ var isOpen = (row) => row.querySelector(":scope > .expand-cell > .expand")?.getAttribute("aria-expanded") === "true";
90
100
  /**
91
101
  * Rows of data under column headings. `columns` say what each column shows and how (`format`: text, number, date,
92
102
  * badge, code); `rows` are plain objects. Sortable headings cycle ascending, descending and unsorted, and sort the
@@ -115,11 +125,11 @@ var JlTable = class extends JlElement {
115
125
  parse: textOf(DEFAULT_ROW_KEY)
116
126
  });
117
127
  /** The column the rows are sorted by. */
118
- sortKey = this.useChange(NO_SORT_KEY, () => this.schedule("body"), {
128
+ sortKey = this.useChange(NO_SORT_KEY, () => this.schedule("order"), {
119
129
  attribute: "sort-key",
120
130
  parse: textOf(NO_SORT_KEY)
121
131
  });
122
- sortDirection = this.useChange(NO_SORT, () => this.schedule("body"), {
132
+ sortDirection = this.useChange(NO_SORT, () => this.schedule("order"), {
123
133
  attribute: "sort-direction",
124
134
  parse: oneOf(TABLE_SORT_DIRECTIONS, NO_SORT)
125
135
  });
@@ -173,12 +183,18 @@ var JlTable = class extends JlElement {
173
183
  _pending = {
174
184
  body: false,
175
185
  head: false,
186
+ order: false,
176
187
  queued: false
177
188
  };
178
- /** The rows as drawn and their keys, by their place: the rows and their checkboxes carry the place. */
189
+ /**
190
+ * The rows as drawn in the order of `rows` (the rows and their checkboxes carry their place), by key, and their
191
+ * keys in the order shown; the keys each state was last drawn for, so a change redraws only the rows it concerns.
192
+ */
179
193
  _view = {
194
+ byKey: /* @__PURE__ */ new Map(),
195
+ drawn: [],
180
196
  keys: [],
181
- rows: []
197
+ shown: NO_ROW_STATES()
182
198
  };
183
199
  _refs = this.useRefs((ref) => ({
184
200
  body: ref("tbody"),
@@ -233,13 +249,18 @@ var JlTable = class extends JlElement {
233
249
  queueMicrotask(() => this.flush());
234
250
  }
235
251
  flush() {
236
- const { body, head } = this._pending;
237
- this._pending.body = false;
238
- this._pending.head = false;
239
- this._pending.queued = false;
252
+ const { body, head, order } = this._pending;
253
+ Object.assign(this._pending, {
254
+ body: false,
255
+ head: false,
256
+ order: false,
257
+ queued: false
258
+ });
240
259
  if (head) this.renderHead();
241
- this.renderSortState();
260
+ if (head || order) this.renderSortState();
242
261
  if (body) this.renderBody();
262
+ if (order && !body) this.renderOrder();
263
+ this.renderMarks();
243
264
  this.renderSelection();
244
265
  this.renderExpansion();
245
266
  }
@@ -258,7 +279,7 @@ var JlTable = class extends JlElement {
258
279
  changeSelection(input) {
259
280
  const index = input.dataset.index;
260
281
  const selected = this.selected.get();
261
- const keys = index === void 0 ? toggleAll(this._view.keys, new Set(selected)) : toggleKey(selected, this._view.keys[Number(index)] ?? Number(index), input.checked);
282
+ const keys = index === void 0 ? toggleAll(this._view.keys, new Set(selected)) : toggleKey(selected, this._view.drawn[Number(index)]?.key ?? Number(index), input.checked);
262
283
  this.selected.set(keys);
263
284
  this.events.emit("selection", keys);
264
285
  }
@@ -267,7 +288,7 @@ var JlTable = class extends JlElement {
267
288
  const row = this.dataRowOf(event);
268
289
  const key = row === void 0 ? void 0 : this.keyOf(row);
269
290
  if (row === void 0 || key === void 0 || !this.opensOnPress(event, row)) return;
270
- this.toggle(key, !row.hasAttribute(EXPANDED_ATTRIBUTE));
291
+ this.toggle(key, !isOpen(row));
271
292
  }
272
293
  /** The row of data a press is on: one of the table's, not a row in the content of a detail. */
273
294
  dataRowOf(event) {
@@ -333,45 +354,68 @@ var JlTable = class extends JlElement {
333
354
  cell.style.width = columnWidth(column.width);
334
355
  return cell;
335
356
  }
336
- /** The arrows and `aria-sort` of the headings, changed in place so a pressed heading keeps the focus. */
357
+ /** The arrows and `aria-sort` of the sortable headings, changed in place so a pressed heading keeps the focus. */
337
358
  renderSortState() {
338
359
  const sortKey = this.sortKey.get();
339
- for (const cell of this._refs.head.querySelectorAll("th[data-key]")) {
360
+ for (const cell of this._refs.head.querySelectorAll("th[data-key]:has(> .sort)")) {
340
361
  const direction = cell.dataset.key === sortKey ? this.sortDirection.get() : NO_SORT;
341
- const sortable = cell.querySelector(".sort") !== null;
342
- setOrRemove(cell, "aria-sort", sortable ? ARIA_SORT[direction] : "");
362
+ setOrRemove(cell, "aria-sort", ARIA_SORT[direction]);
343
363
  cell.querySelector(".sort-icon")?.name.set(SORT_ICONS[direction]);
344
- cell.toggleAttribute("data-sorted", direction !== NO_SORT);
345
364
  }
346
365
  }
347
- sortedRows() {
366
+ /** The drawn rows in the order of the sort; each row's sort value is read once, not at every comparison. */
367
+ sortedView() {
348
368
  const key = this.sortKey.get();
369
+ if (key === NO_SORT_KEY) return [...this._view.drawn];
349
370
  const format = this.columns.get().find((column) => column.key === key)?.format;
350
- return sortRows(this.rows.get(), key, this.sortDirection.get(), format);
371
+ return sortBy(this._view.drawn, ({ row }) => fieldOf(row, key), {
372
+ direction: this.sortDirection.get(),
373
+ format
374
+ });
351
375
  }
352
376
  renderBody() {
353
377
  const columns = this.columns.get();
354
378
  if (this.loading.get()) {
355
- this.setView([], []);
379
+ this.setView([]);
356
380
  this._refs.body.replaceChildren(...this.skeletonRows(columns));
357
381
  return;
358
382
  }
359
383
  const rows = this.rows.get();
360
384
  if (rows.length === 0) {
361
- this.setView([], []);
385
+ this.setView([]);
362
386
  this._refs.body.replaceChildren(this.emptyRow(this.span(columns)));
363
387
  return;
364
388
  }
365
389
  const keyField = this.rowKey.get();
366
- const keys = new Map(rows.map((row, index) => [row, rowKeyOf(row, keyField, index)]));
367
- const sorted = this.sortedRows();
368
- this.setView(sorted, sorted.map((row, index) => keys.get(row) ?? index));
369
- this._refs.body.replaceChildren(...sorted.map((row, index) => this.bodyRow(row, index, columns)));
370
- this.renderMarks();
371
- }
372
- setView(rows, keys) {
373
- this._view.rows = rows;
374
- this._view.keys = keys;
390
+ this.setView(rows.map((row, index) => ({
391
+ element: this.bodyRow(row, index, columns),
392
+ key: rowKeyOf(row, keyField, index),
393
+ row
394
+ })));
395
+ this._refs.body.replaceChildren(...this.placeInOrder().map(({ element }) => element));
396
+ }
397
+ /** New rows, which show no state yet: the flush draws the selection, the marks and the open rows on them. */
398
+ setView(drawn) {
399
+ this._view.drawn = drawn;
400
+ this._view.byKey = Map.groupBy(drawn, ({ key }) => key);
401
+ this._view.shown = NO_ROW_STATES();
402
+ }
403
+ /** The rows in the order of the sort, whose keys the select-all box goes by from now on. */
404
+ placeInOrder() {
405
+ const sorted = this.sortedView();
406
+ this._view.keys = sorted.map(({ key }) => key);
407
+ return sorted;
408
+ }
409
+ /** Moves the rows into the order of the sort, each open row's detail with it: no row is drawn again. */
410
+ renderOrder() {
411
+ const body = this._refs.body;
412
+ this.placeInOrder().flatMap(({ element }) => {
413
+ const detail = detailOf(element);
414
+ return detail === null ? [element] : [element, detail];
415
+ }).forEach((node, index) => {
416
+ const current = body.children.item(index);
417
+ if (current !== node) body.insertBefore(node, current);
418
+ });
375
419
  }
376
420
  bodyRow(row, index, columns) {
377
421
  const first = columns[0];
@@ -458,33 +502,29 @@ var JlTable = class extends JlElement {
458
502
  })
459
503
  });
460
504
  }
461
- /** The rows of data, without the details under the open ones. */
462
- dataRows() {
463
- return [...this._refs.body.querySelectorAll(":scope > tr[data-index]")];
464
- }
465
505
  keyOf(row) {
466
- return this._view.keys[Number(row.dataset.index)];
506
+ return this._view.drawn[Number(row.dataset.index)]?.key;
507
+ }
508
+ /**
509
+ * Draws a state on the rows whose keys came into it or left it since it was last drawn: checking or opening one
510
+ * row changes that row alone, whatever the number of rows.
511
+ */
512
+ redraw(state, keys, draw) {
513
+ const changes = rowToggles(this._view.shown[state], keys);
514
+ this._view.shown[state] = keys;
515
+ for (const { key, open } of changes) for (const { element } of this._view.byKey.get(key) ?? []) draw(element, open);
467
516
  }
468
517
  /** The bar and the shade of marked rows, changed in place. */
469
518
  renderMarks() {
470
- const marked = new Set(this.marked.get());
471
- for (const row of this.dataRows()) {
472
- const key = this.keyOf(row);
473
- row.toggleAttribute(MARKED_ATTRIBUTE, key !== void 0 && marked.has(key));
474
- }
519
+ this.redraw("marked", this.marked.get(), (element, on) => element.toggleAttribute(MARKED_ATTRIBUTE, on));
475
520
  }
476
521
  /** The details of the open rows, added under them and taken away in place: one that stays open keeps its content. */
477
522
  renderExpansion() {
478
- const open = new Set(openRows(this.expanded.get(), this.expandable.get()));
479
- for (const row of this.dataRows()) {
480
- const key = this.keyOf(row);
481
- this.renderRowOpen(row, key !== void 0 && open.has(key));
482
- }
523
+ this.redraw("open", openRows(this.expanded.get(), this.expandable.get()), (element, open) => this.renderRowOpen(element, open));
483
524
  }
484
525
  renderRowOpen(row, open) {
485
526
  const chevron = row.querySelector("button.expand");
486
527
  if (chevron === null) return;
487
- row.toggleAttribute(EXPANDED_ATTRIBUTE, open);
488
528
  chevron.setAttribute("aria-expanded", String(open));
489
529
  const detail = detailOf(row);
490
530
  if (!open) {
@@ -498,7 +538,7 @@ var JlTable = class extends JlElement {
498
538
  chevron.setAttribute("aria-controls", id);
499
539
  }
500
540
  detailRow(row, id) {
501
- const data = this._view.rows[Number(row.dataset.index)];
541
+ const data = this._view.drawn[Number(row.dataset.index)]?.row;
502
542
  const draw = this._source.detail;
503
543
  return /* @__PURE__ */ jsx("tr", {
504
544
  class: "detail",
@@ -512,18 +552,12 @@ var JlTable = class extends JlElement {
512
552
  })
513
553
  });
514
554
  }
515
- /** The checkboxes and the shading of selected rows, changed in place. */
555
+ /** The checkboxes of the rows whose selection changed, and the select-all box. */
516
556
  renderSelection() {
517
- const selected = new Set(this.selected.get());
518
- for (const input of this._refs.body.querySelectorAll(":scope > tr > .select-cell .checkbox")) {
519
- const key = this._view.keys[Number(input.dataset.index)];
520
- const on = key !== void 0 && selected.has(key);
521
- input.checked = on;
522
- input.closest("tr")?.toggleAttribute("data-selected", on);
523
- }
557
+ this.redraw("selected", this.selected.get(), checkRow);
524
558
  const all = this._refs.head.querySelector("input.checkbox");
525
559
  if (all === null) return;
526
- const state = selectionState(this._view.keys, selected);
560
+ const state = selectionState(this._view.keys, new Set(this.selected.get()));
527
561
  all.checked = state === "all";
528
562
  all.indeterminate = state === "some";
529
563
  all.disabled = this._view.keys.length === 0;
@@ -1,3 +1,3 @@
1
1
  // src/organisms/jl-tree.css?inline
2
- var jl_tree_default = ":host{--indent:16px;--row-height:30px;display:block}.tree{color:var(--jl-text-2);font-size:var(--jl-font-md)}.group{position:relative}.group:before{top:0;bottom:4px;left:calc(8px + var(--level) * var(--indent) + 6.5px);background:var(--jl-line);content:\"\";width:1px;position:absolute}.item:focus-visible{box-shadow:none}.row{height:var(--row-height);padding:0 8px 0 calc(8px + var(--level) * var(--indent));border-radius:var(--jl-radius-sm);cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:6px;display:flex}.row:hover{background:var(--jl-surface-2);color:var(--jl-text)}.item:focus-visible>.row{box-shadow:var(--jl-focus-ring)}.item[aria-selected=true]>.row{background:var(--jl-accent-soft);color:var(--jl-text);font-weight:600}.chevron{width:14px;color:var(--jl-faint);transition:rotate var(--jl-fast) var(--jl-ease);flex:none;justify-content:center;display:inline-flex}.item[aria-expanded=true]>.row>.chevron{rotate:90deg}.icon{color:var(--jl-muted)}.item[aria-selected=true]>.row>.icon{color:var(--jl-accent)}.label{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}a.row{color:inherit;text-decoration:none}.item.level-end>.row{color:var(--jl-muted)}.level-end[aria-disabled=true]>.row{cursor:default}.level-end[aria-disabled=true]>.row:hover{background:0 0}.spinner{color:var(--jl-muted);flex:none}.more,.retry{color:var(--jl-accent);flex:none;font-weight:500}.level-end>.row:hover .more,.level-end>.row:hover .retry{color:var(--jl-accent-strong)}.icon.error{color:var(--jl-danger)}.note{min-height:var(--row-height);padding:0 8px 0 calc(8px + var(--level) * var(--indent));color:var(--jl-muted);align-items:center;gap:6px;display:flex}.badge{color:var(--jl-faint);font-size:var(--jl-font-xs);font-variant-numeric:tabular-nums;flex:none;margin-left:auto}";
2
+ var jl_tree_default = ":host{--indent:16px;--row-height:30px;display:block}.tree{--level:0;color:var(--jl-text-2);font-size:var(--jl-font-md)}.group{--group-level:var(--level);position:relative}.group>*{--level:calc(var(--group-level) + 1)}.item[aria-expanded=false]>.group{display:none}.group:before{top:0;bottom:4px;left:calc(8px + var(--level) * var(--indent) + 6.5px);background:var(--jl-line);content:\"\";width:1px;position:absolute}.item:focus-visible{box-shadow:none}.row{height:var(--row-height);padding:0 8px 0 calc(8px + var(--level) * var(--indent));border-radius:var(--jl-radius-sm);cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:6px;display:flex}.row:hover{background:var(--jl-surface-2);color:var(--jl-text)}.item:focus-visible>.row{box-shadow:var(--jl-focus-ring)}.item[aria-selected=true]>.row{background:var(--jl-accent-soft);color:var(--jl-text);font-weight:600}.chevron{width:14px;color:var(--jl-faint);transition:rotate var(--jl-fast) var(--jl-ease);flex:none;justify-content:center;display:inline-flex}.item[aria-expanded=true]>.row>.chevron{rotate:90deg}.icon{color:var(--jl-muted)}.item[aria-selected=true]>.row>.icon{color:var(--jl-accent)}.label{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}a.row{color:inherit;text-decoration:none}.item.level-end>.row{color:var(--jl-muted)}.level-end[aria-disabled=true]>.row{cursor:default}.level-end[aria-disabled=true]>.row:hover{background:0 0}.spinner{color:var(--jl-muted);flex:none}.more,.retry{color:var(--jl-accent);flex:none;font-weight:500}.level-end>.row:hover .more,.level-end>.row:hover .retry{color:var(--jl-accent-strong)}.icon.error{color:var(--jl-danger)}.note{min-height:var(--row-height);padding:0 8px 0 calc(8px + var(--level) * var(--indent));color:var(--jl-muted);align-items:center;gap:6px;display:flex}.badge{color:var(--jl-faint);font-size:var(--jl-font-xs);font-variant-numeric:tabular-nums;flex:none;margin-left:auto}";
3
3
  export { jl_tree_default as default };
@@ -94,7 +94,7 @@ export declare class JlTree extends JlElement {
94
94
  /** Marks the item; one that is not a link says so with `select`. */
95
95
  private select;
96
96
  private findItem;
97
- /** One item takes the Tab stop: the focused one, else the selected one, else the first. */
97
+ /** Gives an item the Tab stop, which one item holds, and the focus when asked. */
98
98
  private moveFocus;
99
99
  private hasFocusInside;
100
100
  private scrollToRow;
@@ -102,6 +102,11 @@ export declare class JlTree extends JlElement {
102
102
  private loadLevel;
103
103
  private loadNextPage;
104
104
  private addPage;
105
+ /**
106
+ * Shows the items with a page added: only the page's rows when its level is drawn, so a tree of thousands of rows
107
+ * is not drawn and laid out again for each page; the whole tree otherwise.
108
+ */
109
+ private drawPage;
105
110
  private failLevel;
106
111
  /** The open folders whose children the loader has not given yet: their first page. */
107
112
  private loadOpenFolders;
@@ -112,20 +117,19 @@ export declare class JlTree extends JlElement {
112
117
  private hasLevelEndRow;
113
118
  protected drawTexts(): void;
114
119
  private errorLabel;
115
- private itemsChanged;
120
+ private renderItemsUnlessQuiet;
121
+ /** Sets `items` without drawing every row again, which its callback does on each set(), even of an equal value. */
122
+ private setItemsQuietly;
116
123
  private renderItems;
117
124
  /** Where the Tab stop goes once rows are drawn: where it was, else the selected item, else the first. */
118
125
  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
+ /** Draws again the row that ends a level (its spinner, its error), and only it; the whole tree when it is not drawn. */
127
+ private redrawLevelEnd;
128
+ /** Draws items at the end of a drawn level, then the row that ends it again; the tree's other rows stay as they are. */
129
+ private appendToLevel;
130
+ /** The element holding a level's rows; null when they are not drawn, and for an empty tree, whose note only `renderItems` draws. */
126
131
  private levelContainer;
127
- /** The depth of a level's rows: 1 for the roots. */
128
- private levelOf;
132
+ /** An item's row, and its children's under a folder: the CSS indents each by its depth. */
129
133
  private itemNode;
130
134
  /** The row that ends a level, if it has one. */
131
135
  private levelEndNodes;
@@ -135,11 +139,10 @@ export declare class JlTree extends JlElement {
135
139
  private errorNode;
136
140
  private noteNode;
137
141
  private renderExpanded;
138
- /** Opens or closes the groups of these rows, as `expanded` says. */
142
+ /** Opens or closes the groups of these rows, as `expanded` says; a folder already in that state is left alone. */
139
143
  private drawExpanded;
140
144
  private isVisible;
141
145
  /** The item itself when it shows, else the nearest folder around it that does: the focus goes there. */
142
146
  private visibleAncestor;
143
- private renderSelection;
144
147
  private drawSelection;
145
148
  }