@syware/jlib 0.15.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/all.js CHANGED
@@ -77,7 +77,7 @@ import { JlFlow } from "./organisms/jl-flow.js";
77
77
  import { JlNavbar } from "./organisms/jl-navbar.js";
78
78
  import { JlPageHeader } from "./organisms/jl-page-header.js";
79
79
  import { JlPageOutlet } from "./organisms/jl-page-outlet.js";
80
- import { JlSideNav } from "./organisms/jl-side-nav.js";
80
+ import { JlSideNav, SIDE_NAV_COLLAPSIBLES } from "./organisms/jl-side-nav.js";
81
81
  import { JlTabBar } from "./organisms/jl-tab-bar.js";
82
82
  import { JlTable, TABLE_EXPANSIONS, TABLE_SORT_DIRECTIONS } from "./organisms/jl-table.js";
83
83
  import { JlToaster, TOASTER_PLACEMENTS, download, downloadTexts, toast } from "./organisms/jl-toaster.js";
@@ -90,4 +90,4 @@ import { JlStack, STACK_GAPS } from "./templates/jl-stack.js";
90
90
  // src/all.ts
91
91
  registerIcons(COMMON_ICONS);
92
92
  define(JlAccordion, JlAccordionItem, JlAccountButton, JlAlert, JlAppIcon, JlAppShell, JlAuthLayout, JlAvatar, JlAvatarGroup, JlBadge, JlBreadcrumb, JlButton, JlCalendar, JlCard, JlCheckbox, JlChip, JlChipGroup, JlCodeBlock, JlCombobox, JlCommandPalette, JlConfirm, JlCopyButton, JlDatePicker, JlDialog, JlDivider, JlDrawer, JlEmpty, JlFacts, JlField, JlFileDrop, JlFlow, JlIcon, JlInput, JlInputList, JlKbd, JlLink, JlListItem, JlLoadingBar, JlLoadMore, JlLoadState, JlMenu, JlNavbar, JlNumberInput, JlPage, JlPageHeader, JlPageOutlet, JlPagination, JlPopover, JlProgress, JlProgressRing, JlRadioGroup, JlRating, JlSearch, JlSearchButton, JlSegmented, JlSelect, JlSideNav, JlSkeleton, JlSlider, JlSpinner, JlSplitView, JlStack, JlStat, JlSteps, JlSwitch, JlTabBar, JlTable, JlTabPanel, JlTabs, JlTagInput, JlTextarea, JlTimeline, JlToast, JlToaster, JlTooltip, JlTree);
93
- export { ACCORDION_VARIANTS, AVATAR_SHAPES, AVATAR_SIZES, AVATAR_STATUSES, BASE_STYLES, BUTTON_TYPES, BUTTON_VARIANTS, CARD_PADDINGS, CHIP_SIZES, CODE_LANGUAGES, COMMON_ICONS, CONFIRM_TONES, CONTROL_SIZES, CONTROL_STYLES, DEFAULT_TEXTS, DIALOG_SIZES, DIVIDER_ALIGNS, DRAWER_PLACEMENTS, DRAWER_SIZES, EMPTY_SIZES, FACTS_ORIENTATIONS, FIELD_ORIENTATIONS, FLOATING_STYLES, INPUT_TYPES, JL_LANGUAGES, JlAccordion, JlAccordionItem, JlAccountButton, JlAlert, JlAppIcon, JlAppShell, JlAuthLayout, JlAvatar, JlAvatarGroup, JlBadge, JlBreadcrumb, JlButton, JlCalendar, JlCard, JlCheckbox, JlChip, JlChipGroup, JlCodeBlock, JlCombobox, JlCommandPalette, JlConfirm, JlCopyButton, JlDatePicker, JlDialog, JlDivider, JlDrawer, JlElement, JlEmpty, JlFacts, JlField, JlFileDrop, JlFlow, JlFormControl, JlIcon, JlInput, JlInputList, JlKbd, JlLink, JlListItem, JlLoadMore, JlLoadState, JlLoadingBar, JlMenu, JlNavbar, JlNumberInput, JlPage, JlPageHeader, JlPageOutlet, JlPagination, JlPopover, JlProgress, JlProgressRing, JlRadioGroup, JlRating, JlSearch, JlSearchButton, JlSegmented, JlSelect, JlSideNav, JlSkeleton, JlSlider, JlSpinner, JlSplitView, JlStack, JlStat, JlSteps, JlSwitch, JlTabBar, JlTabPanel, JlTable, JlTabs, JlTagInput, JlTextarea, JlTimeline, JlToast, JlToaster, JlTooltip, JlTree, LINK_VARIANTS, LOAD_SKELETONS, LOAD_STATES, PAGE_WIDTHS, PLACEMENTS, PROGRESS_SIZES, PROGRESS_TONES, RADIO_GROUP_ORIENTATIONS, RADIO_GROUP_VARIANTS, SKELETON_SHAPES, SPLIT_ORIENTATIONS, SPLIT_PANES, STACK_GAPS, STAT_TRENDS, STEPS_ORIENTATIONS, SWITCH_SIZES, TABLE_EXPANSIONS, TABLE_SORT_DIRECTIONS, TAB_VARIANTS, TOASTER_PLACEMENTS, TOAST_TONES, TOKEN_STYLES, TONES, TONE_ICONS, TONE_ICON_FILLED, adoptTokens, cellOf, clampedNumber, computePosition, confirmDialog, define, download, downloadTexts, followAnchor, formatDuration, formatRelativeTime, guardLeave, hasIcon, iconElement, iconNames, jlText, jlTexts, jsonOf, oneOf, placeFloating, registerIcons, setFavicon, toast };
93
+ export { ACCORDION_VARIANTS, AVATAR_SHAPES, AVATAR_SIZES, AVATAR_STATUSES, BASE_STYLES, BUTTON_TYPES, BUTTON_VARIANTS, CARD_PADDINGS, CHIP_SIZES, CODE_LANGUAGES, COMMON_ICONS, CONFIRM_TONES, CONTROL_SIZES, CONTROL_STYLES, DEFAULT_TEXTS, DIALOG_SIZES, DIVIDER_ALIGNS, DRAWER_PLACEMENTS, DRAWER_SIZES, EMPTY_SIZES, FACTS_ORIENTATIONS, FIELD_ORIENTATIONS, FLOATING_STYLES, INPUT_TYPES, JL_LANGUAGES, JlAccordion, JlAccordionItem, JlAccountButton, JlAlert, JlAppIcon, JlAppShell, JlAuthLayout, JlAvatar, JlAvatarGroup, JlBadge, JlBreadcrumb, JlButton, JlCalendar, JlCard, JlCheckbox, JlChip, JlChipGroup, JlCodeBlock, JlCombobox, JlCommandPalette, JlConfirm, JlCopyButton, JlDatePicker, JlDialog, JlDivider, JlDrawer, JlElement, JlEmpty, JlFacts, JlField, JlFileDrop, JlFlow, JlFormControl, JlIcon, JlInput, JlInputList, JlKbd, JlLink, JlListItem, JlLoadMore, JlLoadState, JlLoadingBar, JlMenu, JlNavbar, JlNumberInput, JlPage, JlPageHeader, JlPageOutlet, JlPagination, JlPopover, JlProgress, JlProgressRing, JlRadioGroup, JlRating, JlSearch, JlSearchButton, JlSegmented, JlSelect, JlSideNav, JlSkeleton, JlSlider, JlSpinner, JlSplitView, JlStack, JlStat, JlSteps, JlSwitch, JlTabBar, JlTabPanel, JlTable, JlTabs, JlTagInput, JlTextarea, JlTimeline, JlToast, JlToaster, JlTooltip, JlTree, LINK_VARIANTS, LOAD_SKELETONS, LOAD_STATES, PAGE_WIDTHS, PLACEMENTS, PROGRESS_SIZES, PROGRESS_TONES, RADIO_GROUP_ORIENTATIONS, RADIO_GROUP_VARIANTS, SIDE_NAV_COLLAPSIBLES, SKELETON_SHAPES, SPLIT_ORIENTATIONS, SPLIT_PANES, STACK_GAPS, STAT_TRENDS, STEPS_ORIENTATIONS, SWITCH_SIZES, TABLE_EXPANSIONS, TABLE_SORT_DIRECTIONS, TAB_VARIANTS, TOASTER_PLACEMENTS, TOAST_TONES, TOKEN_STYLES, TONES, TONE_ICONS, TONE_ICON_FILLED, adoptTokens, cellOf, clampedNumber, computePosition, confirmDialog, define, download, downloadTexts, followAnchor, formatDuration, formatRelativeTime, guardLeave, hasIcon, iconElement, iconNames, jlText, jlTexts, jsonOf, oneOf, placeFloating, registerIcons, setFavicon, toast };
@@ -1,3 +1,3 @@
1
1
  // src/atoms/jl-select.css?inline
2
- var jl_select_default = ":host{display:block}.control{padding:0;position:relative}.native{border-radius:inherit;text-overflow:ellipsis;cursor:pointer;appearance:none;padding:0 36px 0 12px}.native:disabled{cursor:not-allowed}:host([placeholder-shown]) .native{color:var(--jl-muted)}option,optgroup{background:var(--jl-surface);color:var(--jl-text)}.chevron{color:var(--jl-muted);pointer-events:none;transition:transform var(--jl-fast) var(--jl-ease);position:absolute;right:12px}.native:open+.chevron{transform:rotate(180deg)}:host([disabled]) .chevron{color:var(--jl-faint)}@media (hover:hover) and (pointer:fine){@supports (appearance:base-select){.control{anchor-name:--frame}.native{appearance:base-select}.native::picker(select){appearance:base-select}.native{-webkit-line-clamp:1;padding-block:calc((var(--height,var(--jl-control-md)) - 2px - 1lh) / 2);overflow-clip-margin:content-box;-webkit-box-orient:vertical;display:-webkit-box;overflow:clip}.native::picker-icon{display:none}.native::picker(select){position-anchor:--frame;position-try-order:normal;box-sizing:border-box;min-inline-size:anchor-size(self-inline);border:1px solid var(--jl-line);border-radius:var(--jl-radius);background:var(--jl-surface);max-block-size:274px;color:var(--jl-text);box-shadow:var(--jl-shadow-lg);animation:jl-float-in var(--jl-fast) var(--jl-ease);margin-block:6px;padding:4px}optgroup{color:var(--jl-muted);font-size:var(--jl-font-xs);text-indent:calc(10px - .5em);padding-block-start:8px;font-weight:600}optgroup>option:first-of-type{margin-block-start:4px}option{box-sizing:border-box;border-radius:var(--jl-radius-xs);min-block-size:34px;font-size:var(--jl-font-md);text-indent:0;cursor:pointer;gap:10px;padding:6px 10px;font-weight:400;line-height:1.35}option:enabled:is(:hover,:focus-visible){background:var(--jl-surface-3);box-shadow:none}option:checked{font-weight:600}option:disabled{color:var(--jl-faint);cursor:not-allowed}option::checkmark{background:var(--jl-accent);content:\"\";order:1;width:14px;height:14px;margin-inline-start:auto;-webkit-mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E\") 50%/contain no-repeat;mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E\") 50%/contain no-repeat}}}";
2
+ var jl_select_default = ":host{display:block}.control{padding:0;position:relative}.native{border-radius:inherit;text-overflow:ellipsis;cursor:pointer;appearance:none;padding:0 36px 0 12px}.native:disabled{cursor:not-allowed}.control:has(.native:open){border-color:var(--jl-accent);box-shadow:var(--jl-focus-ring)}:host([invalid]) .control:has(.native:open){border-color:var(--jl-danger);box-shadow:0 0 0 3px color-mix(in srgb, var(--jl-danger) 25%, transparent)}:host([placeholder-shown]) .native{color:var(--jl-muted)}option,optgroup{background:var(--jl-surface);color:var(--jl-text)}.chevron{color:var(--jl-muted);pointer-events:none;transition:transform var(--jl-fast) var(--jl-ease);position:absolute;right:12px}.native:open+.chevron{transform:rotate(180deg)}:host([disabled]) .chevron{color:var(--jl-faint)}@position-try --jl-fit-below{position-area:self-end span-self-end;min-block-size:calc(50dvh - anchor-size(self-block) / 2 - 12px);max-block-size:calc(100% - 14px)}@position-try --jl-fit-above{position-area:self-start span-self-end;max-block-size:calc(100% - 14px)}@media (hover:hover) and (pointer:fine){@supports (appearance:base-select){.control{anchor-name:--frame}.native{appearance:base-select}.native::picker(select){appearance:base-select}.native{-webkit-line-clamp:1;padding-block:calc((var(--height,var(--jl-control-md)) - 2px - 1lh) / 2);overflow-clip-margin:content-box;-webkit-box-orient:vertical;display:-webkit-box;overflow:clip}.native::picker-icon{display:none}.native::picker(select){position-anchor:--frame;position-try-order:normal;position-try-fallbacks:self-start span-self-end, self-end span-self-start, self-start span-self-start, --jl-fit-below, --jl-fit-above;box-sizing:border-box;min-inline-size:anchor-size(self-inline);border:1px solid var(--jl-line);border-radius:var(--jl-radius);background:var(--jl-surface);max-block-size:274px;color:var(--jl-text);box-shadow:var(--jl-shadow-lg);animation:jl-float-in var(--jl-fast) var(--jl-ease);margin-block:6px;padding:4px}optgroup{color:var(--jl-muted);font-size:var(--jl-font-xs);text-indent:calc(10px - .5em);padding-block-start:8px;font-weight:600}optgroup>option:first-of-type{margin-block-start:4px}option{box-sizing:border-box;border-radius:var(--jl-radius-xs);min-block-size:34px;font-size:var(--jl-font-md);text-indent:0;cursor:pointer;gap:10px;padding:6px 10px;font-weight:400;line-height:1.35}option:enabled:focus{background:var(--jl-surface-3);box-shadow:none}option:checked{font-weight:600}option:disabled{color:var(--jl-faint);cursor:not-allowed}option::checkmark{background:var(--jl-accent);content:\"\";order:1;width:14px;height:14px;margin-inline-start:auto;-webkit-mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E\") 50%/contain no-repeat;mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E\") 50%/contain no-repeat}}}";
3
3
  export { jl_select_default as default };
@@ -59,6 +59,12 @@ export declare class JlSelect<Value extends string = string> extends JlFormContr
59
59
  templateCss(): string;
60
60
  onConnect(): void;
61
61
  onDisconnect(): void;
62
+ /**
63
+ * In a list the page draws (customizable select), the pointer takes the focus to the option under it, as in the
64
+ * combobox and the platform's own lists: one row is lit, the one Enter takes and the arrows go on from. The browser
65
+ * leaves the focus where the keys put it, and a row lit on hover as well made two.
66
+ */
67
+ private focusOptionAt;
62
68
  /** Draws the page's options again when one came, left or changed. The select's own attributes are its inputs. */
63
69
  private onLightChange;
64
70
  protected resetValue(): void;
@@ -102,6 +102,7 @@ var JlSelect = class extends JlFormControl {
102
102
  this.value.set(value);
103
103
  this.events.emit("change", value);
104
104
  });
105
+ this.on(native, "pointermove", (event) => this.focusOptionAt(event));
105
106
  this.renderOptions();
106
107
  this._lightWatch.observe(this, {
107
108
  attributes: true,
@@ -113,6 +114,15 @@ var JlSelect = class extends JlFormControl {
113
114
  onDisconnect() {
114
115
  this._lightWatch.disconnect();
115
116
  }
117
+ /**
118
+ * In a list the page draws (customizable select), the pointer takes the focus to the option under it, as in the
119
+ * combobox and the platform's own lists: one row is lit, the one Enter takes and the arrows go on from. The browser
120
+ * leaves the focus where the keys put it, and a row lit on hover as well made two.
121
+ */
122
+ focusOptionAt(event) {
123
+ const option = event.target instanceof Element ? event.target.closest("option") : null;
124
+ if (option !== null && !option.disabled && !option.matches(":focus")) option.focus({ preventScroll: true });
125
+ }
116
126
  /** Draws the page's options again when one came, left or changed. The select's own attributes are its inputs. */
117
127
  onLightChange(records) {
118
128
  if (records.every((record) => record.target === this && record.type === "attributes")) return;
package/dist/index.js CHANGED
@@ -77,7 +77,7 @@ import { JlFlow } from "./organisms/jl-flow.js";
77
77
  import { JlNavbar } from "./organisms/jl-navbar.js";
78
78
  import { JlPageHeader } from "./organisms/jl-page-header.js";
79
79
  import { JlPageOutlet } from "./organisms/jl-page-outlet.js";
80
- import { JlSideNav } from "./organisms/jl-side-nav.js";
80
+ import { JlSideNav, SIDE_NAV_COLLAPSIBLES } from "./organisms/jl-side-nav.js";
81
81
  import { JlTabBar } from "./organisms/jl-tab-bar.js";
82
82
  import { JlTable, TABLE_EXPANSIONS, TABLE_SORT_DIRECTIONS } from "./organisms/jl-table.js";
83
83
  import { JlToaster, TOASTER_PLACEMENTS, download, downloadTexts, toast } from "./organisms/jl-toaster.js";
@@ -87,4 +87,4 @@ import { JlAuthLayout } from "./templates/jl-auth-layout.js";
87
87
  import { JlPage, PAGE_WIDTHS } from "./templates/jl-page.js";
88
88
  import { JlSplitView, SPLIT_ORIENTATIONS, SPLIT_PANES } from "./templates/jl-split-view.js";
89
89
  import { JlStack, STACK_GAPS } from "./templates/jl-stack.js";
90
- export { ACCORDION_VARIANTS, AVATAR_SHAPES, AVATAR_SIZES, AVATAR_STATUSES, BASE_STYLES, BUTTON_TYPES, BUTTON_VARIANTS, CARD_PADDINGS, CHIP_SIZES, CODE_LANGUAGES, COMMON_ICONS, CONFIRM_TONES, CONTROL_SIZES, CONTROL_STYLES, DEFAULT_TEXTS, DIALOG_SIZES, DIVIDER_ALIGNS, DRAWER_PLACEMENTS, DRAWER_SIZES, EMPTY_SIZES, FACTS_ORIENTATIONS, FIELD_ORIENTATIONS, FLOATING_STYLES, INPUT_TYPES, JL_LANGUAGES, JlAccordion, JlAccordionItem, JlAccountButton, JlAlert, JlAppIcon, JlAppShell, JlAuthLayout, JlAvatar, JlAvatarGroup, JlBadge, JlBreadcrumb, JlButton, JlCalendar, JlCard, JlCheckbox, JlChip, JlChipGroup, JlCodeBlock, JlCombobox, JlCommandPalette, JlConfirm, JlCopyButton, JlDatePicker, JlDialog, JlDivider, JlDrawer, JlElement, JlEmpty, JlFacts, JlField, JlFileDrop, JlFlow, JlFormControl, JlIcon, JlInput, JlInputList, JlKbd, JlLink, JlListItem, JlLoadMore, JlLoadState, JlLoadingBar, JlMenu, JlNavbar, JlNumberInput, JlPage, JlPageHeader, JlPageOutlet, JlPagination, JlPopover, JlProgress, JlProgressRing, JlRadioGroup, JlRating, JlSearch, JlSearchButton, JlSegmented, JlSelect, JlSideNav, JlSkeleton, JlSlider, JlSpinner, JlSplitView, JlStack, JlStat, JlSteps, JlSwitch, JlTabBar, JlTabPanel, JlTable, JlTabs, JlTagInput, JlTextarea, JlTimeline, JlToast, JlToaster, JlTooltip, JlTree, LINK_VARIANTS, LOAD_SKELETONS, LOAD_STATES, PAGE_WIDTHS, PLACEMENTS, PROGRESS_SIZES, PROGRESS_TONES, RADIO_GROUP_ORIENTATIONS, RADIO_GROUP_VARIANTS, SKELETON_SHAPES, SPLIT_ORIENTATIONS, SPLIT_PANES, STACK_GAPS, STAT_TRENDS, STEPS_ORIENTATIONS, SWITCH_SIZES, TABLE_EXPANSIONS, TABLE_SORT_DIRECTIONS, TAB_VARIANTS, TOASTER_PLACEMENTS, TOAST_TONES, TOKEN_STYLES, TONES, TONE_ICONS, TONE_ICON_FILLED, adoptTokens, cellOf, clampedNumber, computePosition, confirmDialog, define, download, downloadTexts, followAnchor, formatDuration, formatRelativeTime, guardLeave, hasIcon, iconElement, iconNames, jlText, jlTexts, jsonOf, oneOf, placeFloating, registerIcons, setFavicon, toast };
90
+ export { ACCORDION_VARIANTS, AVATAR_SHAPES, AVATAR_SIZES, AVATAR_STATUSES, BASE_STYLES, BUTTON_TYPES, BUTTON_VARIANTS, CARD_PADDINGS, CHIP_SIZES, CODE_LANGUAGES, COMMON_ICONS, CONFIRM_TONES, CONTROL_SIZES, CONTROL_STYLES, DEFAULT_TEXTS, DIALOG_SIZES, DIVIDER_ALIGNS, DRAWER_PLACEMENTS, DRAWER_SIZES, EMPTY_SIZES, FACTS_ORIENTATIONS, FIELD_ORIENTATIONS, FLOATING_STYLES, INPUT_TYPES, JL_LANGUAGES, JlAccordion, JlAccordionItem, JlAccountButton, JlAlert, JlAppIcon, JlAppShell, JlAuthLayout, JlAvatar, JlAvatarGroup, JlBadge, JlBreadcrumb, JlButton, JlCalendar, JlCard, JlCheckbox, JlChip, JlChipGroup, JlCodeBlock, JlCombobox, JlCommandPalette, JlConfirm, JlCopyButton, JlDatePicker, JlDialog, JlDivider, JlDrawer, JlElement, JlEmpty, JlFacts, JlField, JlFileDrop, JlFlow, JlFormControl, JlIcon, JlInput, JlInputList, JlKbd, JlLink, JlListItem, JlLoadMore, JlLoadState, JlLoadingBar, JlMenu, JlNavbar, JlNumberInput, JlPage, JlPageHeader, JlPageOutlet, JlPagination, JlPopover, JlProgress, JlProgressRing, JlRadioGroup, JlRating, JlSearch, JlSearchButton, JlSegmented, JlSelect, JlSideNav, JlSkeleton, JlSlider, JlSpinner, JlSplitView, JlStack, JlStat, JlSteps, JlSwitch, JlTabBar, JlTabPanel, JlTable, JlTabs, JlTagInput, JlTextarea, JlTimeline, JlToast, JlToaster, JlTooltip, JlTree, LINK_VARIANTS, LOAD_SKELETONS, LOAD_STATES, PAGE_WIDTHS, PLACEMENTS, PROGRESS_SIZES, PROGRESS_TONES, RADIO_GROUP_ORIENTATIONS, RADIO_GROUP_VARIANTS, SIDE_NAV_COLLAPSIBLES, SKELETON_SHAPES, SPLIT_ORIENTATIONS, SPLIT_PANES, STACK_GAPS, STAT_TRENDS, STEPS_ORIENTATIONS, SWITCH_SIZES, TABLE_EXPANSIONS, TABLE_SORT_DIRECTIONS, TAB_VARIANTS, TOASTER_PLACEMENTS, TOAST_TONES, TOKEN_STYLES, TONES, TONE_ICONS, TONE_ICON_FILLED, adoptTokens, cellOf, clampedNumber, computePosition, confirmDialog, define, download, downloadTexts, followAnchor, formatDuration, formatRelativeTime, guardLeave, hasIcon, iconElement, iconNames, jlText, jlTexts, jsonOf, oneOf, placeFloating, registerIcons, setFavicon, toast };
@@ -2,10 +2,12 @@ import type { Placement, Point, Rect, Size } from '../types/floating.types';
2
2
  export declare const PLACEMENTS: readonly Placement[];
3
3
  /**
4
4
  * Where to put a floating element next to its anchor, in window coordinates: on the asked side when it fits,
5
- * otherwise on the opposite side if that leaves more of it visible; then kept inside the window.
5
+ * otherwise on the opposite side if that leaves more of it visible; then kept inside the window. `room` is the
6
+ * height it can take there without leaving the window.
6
7
  */
7
8
  export declare function computePosition(anchor: Rect, floating: Size, viewport: Size, placement: Placement, gap?: number): Point & {
8
9
  placement: Placement;
10
+ room: number;
9
11
  };
10
12
  /**
11
13
  * Puts a fixed-position element next to its anchor, and gives what it measured: the anchor's rect, the element's
@@ -24,5 +26,11 @@ export declare function positionFloating(anchor: Element, floating: HTMLElement,
24
26
  export declare function placeAtPoint(point: Point, floating: HTMLElement): void;
25
27
  /** Puts a fixed-position element next to its anchor; returns the placement it got after flipping. */
26
28
  export declare function placeFloating(anchor: Element, floating: HTMLElement, placement: Placement, gap?: number): Placement;
29
+ /**
30
+ * Calls `update` whenever the anchor may have moved in the window, until the signal aborts: the window resized, the
31
+ * page scrolled, or one of the elements the anchor is drawn in did. An element's `scroll` event does not bubble, and
32
+ * one in a shadow root (an app shell's main area) never leaves it: the window does not hear it, its element does.
33
+ */
34
+ export declare function whenAnchorMoves(anchor: Element, update: () => void, signal: AbortSignal): void;
27
35
  /** Keeps a floating element by its anchor while the page scrolls or resizes, until the signal aborts. */
28
36
  export declare function followAnchor(anchor: Element, floating: HTMLElement, placement: Placement, signal: AbortSignal, gap?: number): void;
@@ -71,9 +71,21 @@ function overflowOn(point, floating, viewport, side) {
71
71
  return Math.max(0, overflows[side]);
72
72
  }
73
73
  var clamp = (value, min, max) => Math.min(Math.max(value, min), Math.max(min, max));
74
+ /** The height a floating element can take on a side of its anchor without leaving the window. */
75
+ function roomOn(anchor, viewport, side, gap) {
76
+ const besideRoom = viewport.height - 16;
77
+ const rooms = {
78
+ bottom: viewport.height - VIEWPORT_MARGIN - (anchor.top + anchor.height + gap),
79
+ left: besideRoom,
80
+ right: besideRoom,
81
+ top: anchor.top - gap - VIEWPORT_MARGIN
82
+ };
83
+ return Math.max(0, Math.floor(rooms[side]));
84
+ }
74
85
  /**
75
86
  * Where to put a floating element next to its anchor, in window coordinates: on the asked side when it fits,
76
- * otherwise on the opposite side if that leaves more of it visible; then kept inside the window.
87
+ * otherwise on the opposite side if that leaves more of it visible; then kept inside the window. `room` is the
88
+ * height it can take there without leaving the window.
77
89
  */
78
90
  function computePosition(anchor, floating, viewport, placement, gap = DEFAULT_GAP) {
79
91
  const { side, align } = splitPlacement(placement);
@@ -89,6 +101,7 @@ function computePosition(anchor, floating, viewport, placement, gap = DEFAULT_GA
89
101
  return {
90
102
  left: isVertical(finalSide) ? clamp(point.left, VIEWPORT_MARGIN, maxLeft) : point.left,
91
103
  placement: joinPlacement(finalSide, align),
104
+ room: roomOn(anchor, viewport, finalSide, gap),
92
105
  top: isVertical(finalSide) ? point.top : clamp(point.top, VIEWPORT_MARGIN, maxTop)
93
106
  };
94
107
  }
@@ -104,7 +117,12 @@ function positionFloating(anchor, floating, placement, gap) {
104
117
  ...positionBy(rect, floating, placement, gap)
105
118
  };
106
119
  }
107
- /** Puts a fixed-position element next to a rectangle of the window, and gives where it went. */
120
+ /** The room on its side, told to the floating element: a panel that may be taller caps its height with it, and scrolls. */
121
+ var ROOM = "--room";
122
+ /**
123
+ * Puts a fixed-position element next to a rectangle of the window, and gives where it went. It tells the element
124
+ * the room it has there (`--room`); one whose height follows it is placed again by its new height, on the side it got.
125
+ */
108
126
  function positionBy(rect, floating, placement, gap) {
109
127
  const viewport = {
110
128
  height: window.innerHeight,
@@ -114,7 +132,16 @@ function positionBy(rect, floating, placement, gap) {
114
132
  height: floating.offsetHeight,
115
133
  width: floating.offsetWidth
116
134
  };
117
- const result = computePosition(rect, size, viewport, placement, gap);
135
+ let result = computePosition(rect, size, viewport, placement, gap);
136
+ const room = `${result.room}px`;
137
+ if (floating.style.getPropertyValue(ROOM) !== room) {
138
+ floating.style.setProperty(ROOM, room);
139
+ const height = floating.offsetHeight;
140
+ if (height !== size.height) {
141
+ size.height = height;
142
+ result = computePosition(rect, size, viewport, result.placement, gap);
143
+ }
144
+ }
118
145
  const left = Math.round(result.left);
119
146
  const top = Math.round(result.top);
120
147
  floating.style.left = `${left}px`;
@@ -136,30 +163,59 @@ var NO_GAP = 0;
136
163
  * left corner there, above the point when there is no room under it, and kept inside the window.
137
164
  */
138
165
  function placeAtPoint(point, floating) {
166
+ forgetRoom(floating);
139
167
  positionBy({
140
168
  ...point,
141
169
  height: 0,
142
170
  width: 0
143
171
  }, floating, AT_POINT, NO_GAP);
144
172
  }
173
+ /**
174
+ * Lets an element that opens again take its whole height before it is measured: capped by the room of its last
175
+ * opening, it would look as if it fitted on a side with less room than the other.
176
+ */
177
+ function forgetRoom(floating) {
178
+ floating.style.removeProperty(ROOM);
179
+ }
145
180
  /** Puts a fixed-position element next to its anchor; returns the placement it got after flipping. */
146
181
  function placeFloating(anchor, floating, placement, gap) {
147
182
  return positionFloating(anchor, floating, placement, gap).placement;
148
183
  }
184
+ /**
185
+ * The elements a node is drawn in, up to the root element: a slotted element's parent is its slot, a shadow root's
186
+ * is its host.
187
+ */
188
+ function flatAncestors(node) {
189
+ const ancestors = [];
190
+ let current = node;
191
+ while (current !== null) {
192
+ const parent = (current instanceof Element ? current.assignedSlot : null) ?? current.parentNode;
193
+ current = parent instanceof ShadowRoot ? parent.host : parent;
194
+ if (current instanceof Element) ancestors.push(current);
195
+ }
196
+ return ancestors;
197
+ }
198
+ /**
199
+ * Calls `update` whenever the anchor may have moved in the window, until the signal aborts: the window resized, the
200
+ * page scrolled, or one of the elements the anchor is drawn in did. An element's `scroll` event does not bubble, and
201
+ * one in a shadow root (an app shell's main area) never leaves it: the window does not hear it, its element does.
202
+ */
203
+ function whenAnchorMoves(anchor, update, signal) {
204
+ const options = {
205
+ passive: true,
206
+ signal
207
+ };
208
+ window.addEventListener("scroll", update, options);
209
+ window.addEventListener("resize", update, options);
210
+ for (const ancestor of flatAncestors(anchor)) ancestor.addEventListener("scroll", update, options);
211
+ }
149
212
  /** Keeps a floating element by its anchor while the page scrolls or resizes, until the signal aborts. */
150
213
  function followAnchor(anchor, floating, placement, signal, gap) {
151
214
  const update = () => {
152
215
  placeFloating(anchor, floating, placement, gap);
153
216
  };
154
- window.addEventListener("scroll", update, {
155
- capture: true,
156
- passive: true,
157
- signal
158
- });
159
- window.addEventListener("resize", update, {
160
- passive: true,
161
- signal
162
- });
217
+ whenAnchorMoves(anchor, update, signal);
218
+ forgetRoom(floating);
163
219
  update();
164
220
  }
165
- export { PLACEMENTS, computePosition, followAnchor, placeAtPoint, placeFloating, positionFloating };
221
+ export { PLACEMENTS, computePosition, followAnchor, placeAtPoint, placeFloating, positionFloating, whenAnchorMoves };
@@ -1,3 +1,3 @@
1
1
  // src/molecules/jl-combobox.css?inline
2
- var jl_combobox_default = ":host{min-width:0;display:block}.toggle jl-icon{transition:transform var(--jl-fast) var(--jl-ease)}:host([open]) .toggle jl-icon{transform:rotate(180deg)}.toggle:disabled{cursor:not-allowed}.popup{padding:4px}.listbox{max-height:264px;margin:0;padding:0;list-style:none;position:relative;overflow-y:auto}.option{border-radius:var(--jl-radius-xs);min-height:34px;color:var(--jl-text);font-size:var(--jl-font-md);cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:10px;padding:6px 10px;line-height:1.35;display:flex}.option[aria-selected=true]{background:var(--jl-surface-3)}.option-label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.option.chosen .option-label{font-weight:600}.option[aria-disabled=true]{color:var(--jl-faint);cursor:not-allowed}.text{flex:1;gap:1px;min-width:0;display:grid}.description{color:var(--jl-muted);font-size:var(--jl-font-xs)}.check{color:var(--jl-accent);visibility:hidden}.option.chosen .check{visibility:visible}mark{color:var(--jl-accent);background:0 0;font-weight:700}.empty{color:var(--jl-muted);font-size:var(--jl-font-sm);padding:8px 10px}";
2
+ var jl_combobox_default = ":host{min-width:0;display:block}.toggle jl-icon{transition:transform var(--jl-fast) var(--jl-ease)}:host([open]) .toggle jl-icon{transform:rotate(180deg)}.toggle:disabled{cursor:not-allowed}.popup{padding:4px}.listbox{max-height:min(264px, var(--room,100dvh) - 10px);margin:0;padding:0;list-style:none;position:relative;overflow-y:auto}.option{border-radius:var(--jl-radius-xs);min-height:34px;color:var(--jl-text);font-size:var(--jl-font-md);cursor:pointer;-webkit-user-select:none;user-select:none;align-items:center;gap:10px;padding:6px 10px;line-height:1.35;display:flex}.option[aria-selected=true]{background:var(--jl-surface-3)}.option-label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.option.chosen .option-label{font-weight:600}.option[aria-disabled=true]{color:var(--jl-faint);cursor:not-allowed}.text{flex:1;gap:1px;min-width:0;display:grid}.description{color:var(--jl-muted);font-size:var(--jl-font-xs)}.check{color:var(--jl-accent);visibility:hidden}.option.chosen .check{visibility:visible}mark{color:var(--jl-accent);background:0 0;font-weight:700}.empty{color:var(--jl-muted);font-size:var(--jl-font-sm);padding:8px 10px}";
3
3
  export { jl_combobox_default as default };
@@ -1,3 +1,3 @@
1
1
  // src/molecules/jl-date-picker.css?inline
2
- var jl_date_picker_default = ":host{min-width:0;display:block}.open:disabled{cursor:not-allowed}:host([open]) .open{background:var(--jl-surface-3);color:var(--jl-text)}.popup{padding:0}.calendar::part(base){border:none}";
2
+ var jl_date_picker_default = ":host{min-width:0;display:block}.open:disabled{cursor:not-allowed}:host([open]) .open{background:var(--jl-surface-3);color:var(--jl-text)}.popup{max-height:var(--room,none);padding:0;overflow-y:auto}.calendar::part(base){border:none}";
3
3
  export { jl_date_picker_default as default };
@@ -1,3 +1,3 @@
1
1
  // src/molecules/jl-menu.css?inline
2
- var jl_menu_default = ":host{vertical-align:middle;display:inline-flex}.menu{min-width:200px;max-width:min(320px,100vw - 16px);max-height:min(420px,100dvh - 16px);padding:4px;overflow-y:auto}.menu:focus-visible{box-shadow:var(--jl-shadow-lg), var(--jl-focus-ring)}.item{border-radius:var(--jl-radius-xs);min-height:32px;color:var(--jl-text);font-size:var(--jl-font-md);cursor:pointer;-webkit-user-select:none;user-select:none;align-items:flex-start;gap:10px;padding:6px 10px;line-height:20px;display:flex}.item:focus,.item:focus-visible{box-shadow:none;background:var(--jl-surface-3);outline:none}.icon{color:var(--jl-muted);flex:none;margin-top:2px}.text{flex:1;min-width:0;display:grid}.label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.description{color:var(--jl-muted);font-size:var(--jl-font-xs);line-height:1.4}.shortcut{color:var(--jl-muted);font-size:var(--jl-font-xs);letter-spacing:.02em;flex:none;margin-left:12px}.item[data-danger]{color:var(--jl-danger)}.item[data-danger] .icon{color:inherit}.item[data-danger]:focus{background:var(--jl-danger-soft)}.item[aria-disabled]{color:var(--jl-faint);cursor:not-allowed}.item[aria-disabled] .icon,.item[aria-disabled] .description{color:inherit}.heading{color:var(--jl-muted);letter-spacing:.06em;text-transform:uppercase;padding:8px 10px 4px;font-size:11px;font-weight:650}.divider{background:var(--jl-line);border:none;height:1px;margin:4px -4px}";
2
+ var jl_menu_default = ":host{vertical-align:middle;display:inline-flex}.menu{min-width:200px;max-width:min(320px,100vw - 16px);max-height:min(420px, var(--room,calc(100dvh - 16px)));padding:4px;overflow-y:auto}.menu:focus-visible{box-shadow:var(--jl-shadow-lg), var(--jl-focus-ring)}.item{border-radius:var(--jl-radius-xs);min-height:32px;color:var(--jl-text);font-size:var(--jl-font-md);cursor:pointer;-webkit-user-select:none;user-select:none;align-items:flex-start;gap:10px;padding:6px 10px;line-height:20px;display:flex}.item:focus,.item:focus-visible{box-shadow:none;background:var(--jl-surface-3);outline:none}.icon{color:var(--jl-muted);flex:none;margin-top:2px}.text{flex:1;min-width:0;display:grid}.label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.description{color:var(--jl-muted);font-size:var(--jl-font-xs);line-height:1.4}.shortcut{color:var(--jl-muted);font-size:var(--jl-font-xs);letter-spacing:.02em;flex:none;margin-left:12px}.item[data-danger]{color:var(--jl-danger)}.item[data-danger] .icon{color:inherit}.item[data-danger]:focus{background:var(--jl-danger-soft)}.item[aria-disabled]{color:var(--jl-faint);cursor:not-allowed}.item[aria-disabled] .icon,.item[aria-disabled] .description{color:inherit}.heading{color:var(--jl-muted);letter-spacing:.06em;text-transform:uppercase;padding:8px 10px 4px;font-size:11px;font-weight:650}.divider{background:var(--jl-line);border:none;height:1px;margin:4px -4px}";
3
3
  export { jl_menu_default as default };
@@ -1,3 +1,3 @@
1
1
  // src/molecules/jl-popover.css?inline
2
- var jl_popover_default = ":host{vertical-align:middle;display:inline-flex}.panel{width:max-content;min-width:200px;max-width:min(360px,100vw - 16px);font-size:var(--jl-font-md);padding:14px 16px;line-height:1.5}.panel:focus-visible{box-shadow:var(--jl-shadow-lg), var(--jl-focus-ring)}header{margin-bottom:10px}h2{font-size:var(--jl-font-md);font-weight:700;line-height:1.4}";
2
+ var jl_popover_default = ":host{vertical-align:middle;display:inline-flex}.panel{width:max-content;min-width:200px;max-width:min(360px,100vw - 16px);max-height:var(--room,calc(100dvh - 16px));font-size:var(--jl-font-md);padding:14px 16px;line-height:1.5;overflow-y:auto}.panel:focus-visible{box-shadow:var(--jl-shadow-lg), var(--jl-focus-ring)}header{margin-bottom:10px}h2{font-size:var(--jl-font-md);font-weight:700;line-height:1.4}";
3
3
  export { jl_popover_default as default };
@@ -1,3 +1,3 @@
1
1
  // src/molecules/jl-tag-input.css?inline
2
- var jl_tag_input_default = ":host{--chip-height:calc(var(--height,var(--jl-control-md)) - 12px);min-width:0;display:block}.control{cursor:text;flex-wrap:wrap;gap:4px;padding:4px 6px}.tags{margin:0;padding:0;list-style:none;display:contents}.tag{max-width:100%;height:var(--chip-height);border:1px solid var(--jl-line);border-radius:var(--jl-radius-xs);background:var(--jl-surface-2);color:var(--jl-text);font-size:var(--jl-font-sm);cursor:default;align-items:center;gap:2px;padding:0 3px 0 8px;line-height:1;display:inline-flex}:host([size=sm]) .tag{font-size:var(--jl-font-xs);padding-left:6px}.tag.flash{animation:flash .6s var(--jl-ease)}.tag-text{text-overflow:ellipsis;white-space:nowrap;line-height:1.4;overflow:hidden}.tag-remove{width:18px;height:18px;color:var(--jl-faint);cursor:pointer;background:0 0;border:none;border-radius:4px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.tag-remove:hover,.tag-remove:focus-visible{background:var(--jl-surface-3);color:var(--jl-text)}.native{height:calc(var(--height,var(--jl-control-md)) - 10px);flex:1 0 80px;padding-left:6px}:host(:disabled) .tag{color:var(--jl-muted);padding-right:8px}:host(:disabled) .tag-remove{display:none}.popup{min-width:180px;padding:4px}.listbox{max-height:240px;margin:0;padding:0;list-style:none;position:relative;overflow-y:auto}.option{border-radius:var(--jl-radius-xs);color:var(--jl-text);font-size:var(--jl-font-md);white-space:nowrap;cursor:pointer;-webkit-user-select:none;user-select:none;padding:6px 10px;line-height:1.4}.option[aria-selected=true],.option:hover{background:var(--jl-surface-3)}mark{color:var(--jl-accent);background:0 0;font-weight:700}@keyframes flash{30%{border-color:var(--jl-accent-line);background:var(--jl-accent-soft);color:var(--jl-accent-strong)}}";
2
+ var jl_tag_input_default = ":host{--chip-height:calc(var(--height,var(--jl-control-md)) - 12px);min-width:0;display:block}.control{cursor:text;flex-wrap:wrap;gap:4px;padding:4px 6px}.tags{margin:0;padding:0;list-style:none;display:contents}.tag{max-width:100%;height:var(--chip-height);border:1px solid var(--jl-line);border-radius:var(--jl-radius-xs);background:var(--jl-surface-2);color:var(--jl-text);font-size:var(--jl-font-sm);cursor:default;align-items:center;gap:2px;padding:0 3px 0 8px;line-height:1;display:inline-flex}:host([size=sm]) .tag{font-size:var(--jl-font-xs);padding-left:6px}.tag.flash{animation:flash .6s var(--jl-ease)}.tag-text{text-overflow:ellipsis;white-space:nowrap;line-height:1.4;overflow:hidden}.tag-remove{width:18px;height:18px;color:var(--jl-faint);cursor:pointer;background:0 0;border:none;border-radius:4px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.tag-remove:hover,.tag-remove:focus-visible{background:var(--jl-surface-3);color:var(--jl-text)}.native{height:calc(var(--height,var(--jl-control-md)) - 10px);flex:1 0 80px;padding-left:6px}:host(:disabled) .tag{color:var(--jl-muted);padding-right:8px}:host(:disabled) .tag-remove{display:none}.popup{min-width:180px;padding:4px}.listbox{max-height:min(240px, var(--room,100dvh) - 10px);margin:0;padding:0;list-style:none;position:relative;overflow-y:auto}.option{border-radius:var(--jl-radius-xs);color:var(--jl-text);font-size:var(--jl-font-md);white-space:nowrap;cursor:pointer;-webkit-user-select:none;user-select:none;padding:6px 10px;line-height:1.4}.option[aria-selected=true],.option:hover{background:var(--jl-surface-3)}mark{color:var(--jl-accent);background:0 0;font-weight:700}@keyframes flash{30%{border-color:var(--jl-accent-line);background:var(--jl-accent-soft);color:var(--jl-accent-strong)}}";
3
3
  export { jl_tag_input_default as default };
@@ -1,7 +1,7 @@
1
1
  import { BASE_STYLES, FLOATING_STYLES } from "../styles/shared.js";
2
2
  import { JlElement } from "../base/jl-element.js";
3
3
  import { clampedNumber, oneOf } from "../lib/attributes.js";
4
- import { PLACEMENTS, positionFloating } from "../lib/floating.js";
4
+ import { PLACEMENTS, positionFloating, whenAnchorMoves } from "../lib/floating.js";
5
5
  import { accessibleTarget, deepActiveElement } from "../lib/trigger.js";
6
6
  import { arrowOffset } from "../lib/arrow.js";
7
7
  import jl_tooltip_default from "./jl-tooltip.css.js";
@@ -242,15 +242,7 @@ var JlTooltip = class extends JlElement {
242
242
  this._refs.bubble.showPopover();
243
243
  const following = new AbortController();
244
244
  this._state.following = following;
245
- window.addEventListener("scroll", () => this.place(), {
246
- capture: true,
247
- passive: true,
248
- signal: following.signal
249
- });
250
- window.addEventListener("resize", () => this.place(), {
251
- passive: true,
252
- signal: following.signal
253
- });
245
+ whenAnchorMoves(this.trigger(), () => this.place(), following.signal);
254
246
  document.addEventListener("pointerdown", (event) => {
255
247
  if (!event.composedPath().includes(this)) this.close();
256
248
  }, { signal: following.signal });
@@ -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(: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}";
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;position:relative}: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;position:relative;overflow:hidden}.bottom{flex-direction:column;flex:none;gap:8px;margin-top:auto;display:flex}::slotted([slot=header]){flex:none}.fold{z-index:1;cursor:w-resize;touch-action:none;background:0 0;border:none;width:16px;padding:0;position:absolute;inset:0 -14px 0 auto}:host([rail]) .fold{cursor:e-resize}.fold:after{background:var(--jl-accent);content:\"\";opacity:0;width:2px;transition:opacity var(--jl-fast) var(--jl-ease);position:absolute;inset:0 13px 0 auto}.grip{border-radius:var(--jl-radius-pill);background:var(--jl-line-strong);width:4px;height:28px;transition:height var(--jl-fast) var(--jl-ease), background var(--jl-fast) var(--jl-ease);position:absolute;top:50%;right:12px;translate:0 -50%}.fold:hover:after,.fold:focus-visible:after{opacity:1}.fold:hover .grip,.fold:focus-visible .grip{background:var(--jl-accent);height:44px}.fold:focus-visible{box-shadow:none}.fold-button{align-self:flex-start}.fold-button::part(base){color:var(--jl-muted)}.fold-button::part(base):hover{background:var(--jl-surface-3);color:var(--jl-text)}:host([rail]) .fold-button{align-self:center}.knob{z-index:1;border:1px solid var(--jl-line-strong);background:var(--jl-surface);width:24px;height:24px;color:var(--jl-muted);cursor:pointer;transition:border-color var(--jl-fast) var(--jl-ease), color var(--jl-fast) var(--jl-ease);border-radius:50%;justify-content:center;align-items:center;padding:0;display:inline-flex;position:absolute;top:4px;right:-12px}.knob:hover{border-color:var(--jl-muted);color:var(--jl-text)}.knob-icon{transition:transform var(--jl-slow) var(--jl-ease);transform:rotate(180deg)}:host([rail]) .knob-icon{transform:none}:host([in-drawer]) :is(.fold,.fold-button,.knob),:host(:not([collapsible=knob])) .knob,:host(:not([collapsible=handle])) .fold,:host(:not([collapsible=button])) .fold-button{display:none}@media (forced-colors:active){.grip{background:buttontext}.fold:after,.fold:hover .grip,.fold:focus-visible .grip{background:highlight}}.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}.gliding .children{interpolate-size:allow-keywords;transition:height var(--jl-slow) var(--jl-ease), opacity var(--jl-slow) var(--jl-ease), margin-top var(--jl-slow) var(--jl-ease), display var(--jl-slow) allow-discrete;overflow:clip}.gliding .children[hidden]{opacity:0;height:0;margin-top:0}@starting-style{.gliding .children:not([hidden]){opacity:0;height:0;margin-top:0}}.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]) .sections{scrollbar-gutter:auto;scrollbar-width:none}:host([rail]) .section-label{background:var(--jl-line);color:#0000;height:1px;margin:4px 10px;padding:0;overflow:hidden}:host([rail]) .section:first-child .section-label{display:none}:host([rail]) .item{justify-content:center;padding:0}:host([rail]) .item-label{clip-path:inset(50%);width:1px;height:1px;position:absolute;overflow:hidden}:host([rail]) .item-initial{display:inline-flex}:host([rail]) .item-badge{background:var(--jl-accent);color:#0000;width:8px;min-width:0;height:8px;padding:0;position:absolute;top:5px;right:9px;overflow:hidden}:host([rail]) .children{display:none}";
3
3
  export { jl_side_nav_default as default };
@@ -1,9 +1,10 @@
1
1
  import { JlElement } from '../base/jl-element';
2
- import type { SideNavSection } from '../types/jl-side-nav.types';
2
+ import type { SideNavCollapsible, SideNavSection } from '../types/jl-side-nav.types';
3
+ export declare const SIDE_NAV_COLLAPSIBLES: readonly SideNavCollapsible[];
3
4
  /**
4
5
  * The navigation of an app, down its side: sections of items with icons, badges and nested items that open with
5
6
  * a chevron. `value` is the active item (its parents open to show it); `collapsed` makes it a rail of icons, with
6
- * the labels as tooltips, and `collapsible` lets people fold and unfold it with a button at its bottom. Items with
7
+ * the labels as tooltips, and `collapsible` lets people fold and unfold it, with a button at its bottom, a handle along its edge or a knob on its edge line; the keys of `hotkey` do it too. Items with
7
8
  * an `href` are links; the others fire `select`. Typed by its ids, `JlSideNav<'jobs' | 'people'>` takes items of
8
9
  * those ids and gives `select` one of them.
9
10
  */
@@ -28,24 +29,36 @@ export declare class JlSideNav<Id extends string = string> extends JlElement {
28
29
  get(): boolean;
29
30
  set(setter: boolean | ((prevState: boolean) => boolean)): void;
30
31
  }>>;
31
- /** Adds a button at the bottom that folds the side nav into its rail and unfolds it. */
32
+ /**
33
+ * What people fold the side nav into its rail with, and unfold it: `none` (the app's own control, setting
34
+ * `collapsed`), an icon `button` at its bottom, a `handle` along its edge, or a round `knob` on its edge line, under
35
+ * the header. The handle is dragged towards the fold, and back; from the keyboard, Enter folds it.
36
+ */
32
37
  readonly collapsible: Readonly<Readonly<{
33
- get(): boolean;
34
- set(setter: boolean | ((prevState: boolean) => boolean)): void;
38
+ get(): SideNavCollapsible;
39
+ set(setter: ((prevState: SideNavCollapsible) => SideNavCollapsible) | SideNavCollapsible): void;
35
40
  }>>;
36
- /** The fold button's text while the side nav is open; jlib's own when empty. */
41
+ /** What the handle says while the side nav is open; jlib's own when empty. */
37
42
  readonly collapseLabel: Readonly<Readonly<{
38
43
  get(): string;
39
44
  set(setter: string | ((prevState: string) => string)): void;
40
45
  }>>;
41
- /** Its hint while the side nav is a rail; jlib's own when empty. */
46
+ /** What it says while the side nav is a rail; jlib's own when empty. */
42
47
  readonly expandLabel: Readonly<Readonly<{
43
48
  get(): string;
44
49
  set(setter: string | ((prevState: string) => string)): void;
45
50
  }>>;
51
+ /**
52
+ * The keys that fold and unfold it from anywhere in the page, whatever `collapsible` is: `mod+b` for ⌘B on a Mac
53
+ * and Ctrl+B elsewhere. None until the app names some.
54
+ */
55
+ readonly hotkey: Readonly<Readonly<{
56
+ get(): string;
57
+ set(setter: string | ((prevState: string) => string)): void;
58
+ }>>;
46
59
  /**
47
60
  * Set by `jl-app-shell` while the side nav is its drawer, on a narrow screen: the drawer shows it whole, and its
48
- * fold button hides, `collapsed` waiting for a wide screen again.
61
+ * handle hides, `collapsed` waiting for a wide screen again.
49
62
  */
50
63
  readonly inDrawer: Readonly<Readonly<{
51
64
  get(): boolean;
@@ -61,15 +74,30 @@ export declare class JlSideNav<Id extends string = string> extends JlElement {
61
74
  private readonly _state;
62
75
  /** The sections and the form (rail or whole) the items were drawn for, and whether a drawing waits. */
63
76
  private readonly _drawn;
77
+ /** Where the drag of the handle counts from: where it began, then where it last folded or turned back. */
78
+ private readonly _drag;
79
+ private readonly _sizes;
64
80
  private readonly _refs;
65
81
  templateHtml(): Node;
66
82
  templateCss(): string;
67
83
  onConnect(): void;
84
+ onDisconnect(): void;
68
85
  /** Opens or closes a parent item. */
69
86
  toggleItem(id: string, force?: boolean): void;
70
87
  private onClick;
71
88
  /** Whether it shows as the rail now: folded, and not in a drawer. */
72
89
  private isRail;
90
+ /** The handle is dragged, not pressed: only the keyboard's Enter or Space, a click with no pointer, folds it. */
91
+ private foldOnKeyboardClick;
92
+ /** The handle keeps the pointer for the drag, wherever it goes. */
93
+ private startDrag;
94
+ /**
95
+ * Dragged far enough towards the fold (or away from it, as a rail), the side nav follows; the drag goes on from
96
+ * there, so coming back the same distance undoes it. A move the other way only takes the starting point along.
97
+ */
98
+ private foldOnDrag;
99
+ /** The keys fold it wherever the focus is, unless the page used them or a drawer shows it whole. */
100
+ private foldOnHotkey;
73
101
  private fold;
74
102
  /** Draws on the next microtask: the inputs set while connecting give one drawing, not one each. */
75
103
  private schedule;
@@ -79,8 +107,14 @@ export declare class JlSideNav<Id extends string = string> extends JlElement {
79
107
  private renderItems;
80
108
  protected drawTexts(): void;
81
109
  private renderLabel;
82
- /** The fold button's icon and text; the CSS hides it unless `collapsible`, and in a drawer. */
110
+ /** What the handle or the button says and does next; the CSS shows the one `collapsible` names, none in a drawer. */
83
111
  private renderFold;
112
+ /** The knob on the edge line, made the first time `collapsible` asks for it. */
113
+ private knob;
114
+ /** Puts the knob's centre in the gap between the header and the first section, wherever the header ends. */
115
+ private placeKnob;
116
+ /** The button at the bottom, made the first time `collapsible` asks for it. */
117
+ private foldButton;
84
118
  private choose;
85
119
  /** Up and Down move between the rows people can see, Right opens a parent, Left closes it or goes up to it. */
86
120
  private onKey;
@@ -1,27 +1,44 @@
1
1
  import { jlText } from "../lib/texts.js";
2
2
  import { BASE_STYLES } from "../styles/shared.js";
3
3
  import { JlElement } from "../base/jl-element.js";
4
- import { jsonOf, textOf } from "../lib/attributes.js";
4
+ import { jsonOf, oneOf, textOf } 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, uniqueId } from "../lib/dom.js";
8
8
  import { JlButton } from "../atoms/jl-button.js";
9
+ import { hotkeyLabels, isApplePlatform, matchesHotkey, parseHotkey } from "../lib/hotkey.js";
10
+ import { watchSizes } from "../lib/resize.js";
9
11
  import { findItem, firstLeaf, pathInSections } from "../lib/nav-tree.js";
10
12
  import jl_side_nav_default from "./jl-side-nav.css.js";
11
13
  import { css } from "@jadis/core";
12
14
  import { ChevronRight, PanelLeftClose, PanelLeftOpen } from "lucide";
13
- import { jsx, jsxs } from "@jadis/core/jsx-runtime";
15
+ import { Fragment, jsx, jsxs } from "@jadis/core/jsx-runtime";
14
16
  // src/organisms/jl-side-nav.tsx
15
17
  registerIcons({
16
18
  "chevron-right": ChevronRight,
17
19
  "panel-left-close": PanelLeftClose,
18
20
  "panel-left-open": PanelLeftOpen
19
21
  });
22
+ var SIDE_NAV_COLLAPSIBLES = [
23
+ "none",
24
+ "button",
25
+ "handle",
26
+ "knob"
27
+ ];
20
28
  var ICON_SIZE = 16;
21
29
  var CHEVRON_SIZE = 14;
22
30
  var COLLAPSE_ICON = "panel-left-close";
23
31
  var EXPAND_ICON = "panel-left-open";
32
+ var FOLD_BUTTON = "fold-button";
33
+ var KNOB = "knob";
34
+ var KNOB_ICON_SIZE = 12;
35
+ var KNOB_SIZE = 24;
36
+ var KNOB_MIN_TOP = 4;
37
+ var SECTIONS_GAP = 8;
38
+ var NO_HOTKEY = "none";
39
+ var FOLD_DRAG_PX = 24;
24
40
  var ROW_SELECTOR = ".item";
41
+ var GLIDING = "gliding";
25
42
  var NEW_TAB = "_blank";
26
43
  var SAFE_REL = "noopener noreferrer";
27
44
  var NO_ITEM = "";
@@ -30,13 +47,23 @@ var parseSections = (value) => {
30
47
  const parsed = jsonOf([])(value);
31
48
  return Array.isArray(parsed) ? parsed : [];
32
49
  };
50
+ /** Whether keys fold the side nav: an empty `hotkey` and `none` name no keys. */
51
+ var hasKeys = (hotkey) => hotkey !== "" && hotkey !== NO_HOTKEY;
52
+ var onApple = () => isApplePlatform(navigator.platform);
53
+ /** A fold label with its keys: "Collapse the menu (Ctrl+B)", "(⌘B)" on a Mac. */
54
+ var withKeys = (label, hotkey) => {
55
+ const apple = onApple();
56
+ return `${label} (${hotkeyLabels(hotkey, apple).join(apple ? "" : "+")})`;
57
+ };
58
+ /** The attribute written bare (`<jl-side-nav collapsible>`, as before it took a value) gives the handle. */
59
+ var parseCollapsible = (value) => value === "" ? "handle" : oneOf(SIDE_NAV_COLLAPSIBLES, "none")(value);
33
60
  var hasChildren = (item) => (item.children?.length ?? 0) > 0;
34
61
  /** A row is reachable when no closed list hides it. */
35
62
  var isReachable = (row) => row.closest("[hidden]") === null && row.offsetParent !== null;
36
63
  /**
37
64
  * The navigation of an app, down its side: sections of items with icons, badges and nested items that open with
38
65
  * a chevron. `value` is the active item (its parents open to show it); `collapsed` makes it a rail of icons, with
39
- * the labels as tooltips, and `collapsible` lets people fold and unfold it with a button at its bottom. Items with
66
+ * the labels as tooltips, and `collapsible` lets people fold and unfold it, with a button at its bottom, a handle along its edge or a knob on its edge line; the keys of `hotkey` do it too. Items with
40
67
  * an `href` are links; the others fire `select`. Typed by its ids, `JlSideNav<'jobs' | 'people'>` takes items of
41
68
  * those ids and gives `select` one of them.
42
69
  */
@@ -58,15 +85,30 @@ var JlSideNav = class extends JlElement {
58
85
  this.reflect("collapsed", value);
59
86
  this.schedule();
60
87
  }, { attribute: "collapsed" });
61
- /** Adds a button at the bottom that folds the side nav into its rail and unfolds it. */
62
- collapsible = this.useChange(false, (value) => this.reflect("collapsible", value), { attribute: "collapsible" });
63
- /** The fold button's text while the side nav is open; jlib's own when empty. */
88
+ /**
89
+ * What people fold the side nav into its rail with, and unfold it: `none` (the app's own control, setting
90
+ * `collapsed`), an icon `button` at its bottom, a `handle` along its edge, or a round `knob` on its edge line, under
91
+ * the header. The handle is dragged towards the fold, and back; from the keyboard, Enter folds it.
92
+ */
93
+ collapsible = this.useChange("none", (value) => {
94
+ this.reflect("collapsible", value);
95
+ this.schedule();
96
+ }, {
97
+ attribute: "collapsible",
98
+ parse: parseCollapsible
99
+ });
100
+ /** What the handle says while the side nav is open; jlib's own when empty. */
64
101
  collapseLabel = this.useChange("", () => this.schedule(), { attribute: "collapse-label" });
65
- /** Its hint while the side nav is a rail; jlib's own when empty. */
102
+ /** What it says while the side nav is a rail; jlib's own when empty. */
66
103
  expandLabel = this.useChange("", () => this.schedule(), { attribute: "expand-label" });
67
104
  /**
105
+ * The keys that fold and unfold it from anywhere in the page, whatever `collapsible` is: `mod+b` for ⌘B on a Mac
106
+ * and Ctrl+B elsewhere. None until the app names some.
107
+ */
108
+ hotkey = this.useChange("", () => this.schedule(), { attribute: "hotkey" });
109
+ /**
68
110
  * Set by `jl-app-shell` while the side nav is its drawer, on a narrow screen: the drawer shows it whole, and its
69
- * fold button hides, `collapsed` waiting for a wide screen again.
111
+ * handle hides, `collapsed` waiting for a wide screen again.
70
112
  */
71
113
  inDrawer = this.useChange(false, (value) => {
72
114
  this.reflect("in-drawer", value);
@@ -83,41 +125,59 @@ var JlSideNav = class extends JlElement {
83
125
  rail: false,
84
126
  sections: void 0
85
127
  };
128
+ /** Where the drag of the handle counts from: where it began, then where it last folded or turned back. */
129
+ _drag = { from: 0 };
130
+ _sizes = watchSizes(() => this.placeKnob());
86
131
  _refs = this.useRefs((ref) => ({
87
- fold: ref(JlButton),
132
+ bottom: ref(".bottom"),
133
+ fold: ref(".fold"),
88
134
  nav: ref("nav"),
135
+ over: ref(".over"),
89
136
  sections: ref(".sections")
90
137
  }));
91
138
  templateHtml() {
92
- return /* @__PURE__ */ jsxs("nav", {
139
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("nav", {
93
140
  attrs: { part: "base" },
94
141
  children: [
95
142
  /* @__PURE__ */ jsx("slot", { name: "header" }),
96
143
  /* @__PURE__ */ jsx("div", { class: "sections" }),
97
- /* @__PURE__ */ jsxs("div", {
144
+ /* @__PURE__ */ jsx("div", {
98
145
  class: "bottom",
99
- children: [/* @__PURE__ */ jsx("slot", { name: "footer" }), /* @__PURE__ */ jsx(JlButton, {
100
- class: "fold",
101
- variant: "ghost",
102
- block: true
103
- })]
146
+ children: /* @__PURE__ */ jsx("slot", { name: "footer" })
104
147
  })
105
148
  ]
106
- });
149
+ }), /* @__PURE__ */ jsx("div", {
150
+ class: "over",
151
+ children: /* @__PURE__ */ jsx("button", {
152
+ type: "button",
153
+ class: "fold",
154
+ children: /* @__PURE__ */ jsx("span", { class: "grip" })
155
+ })
156
+ })] });
107
157
  }
108
158
  templateCss() {
109
159
  return css`${BASE_STYLES}${jl_side_nav_default}`;
110
160
  }
111
161
  onConnect() {
112
- this._refs.fold.events.register("press", () => this.fold());
162
+ this._sizes.observe(this._refs.sections);
163
+ this.on(this._refs.fold, "click", (event) => this.foldOnKeyboardClick(event));
164
+ this.on(this._refs.fold, "pointerdown", (event) => this.startDrag(event));
165
+ this.on(this._refs.fold, "pointermove", (event) => this.foldOnDrag(event));
166
+ document.addEventListener("keydown", (event) => this.foldOnHotkey(event), { signal: this.killSignal });
113
167
  this.on(this._refs.sections, "click", (event) => this.onClick(event));
114
168
  this.on(this._refs.sections, "keydown", (event) => this.onKey(event));
115
169
  }
170
+ onDisconnect() {
171
+ this._sizes.disconnect();
172
+ }
116
173
  /** Opens or closes a parent item. */
117
174
  toggleItem(id, force) {
118
175
  if (force ?? !this._state.open.has(id)) this._state.open.add(id);
119
176
  else this._state.open.delete(id);
120
- this.whenRendered(() => this.renderOpen());
177
+ this.whenRendered(() => {
178
+ this._refs.sections.classList.add(GLIDING);
179
+ this.renderOpen();
180
+ });
121
181
  }
122
182
  onClick(event) {
123
183
  const target = event.target;
@@ -139,6 +199,34 @@ var JlSideNav = class extends JlElement {
139
199
  isRail() {
140
200
  return this.collapsed.get() && !this.inDrawer.get();
141
201
  }
202
+ /** The handle is dragged, not pressed: only the keyboard's Enter or Space, a click with no pointer, folds it. */
203
+ foldOnKeyboardClick(event) {
204
+ if (event.detail === 0) this.fold();
205
+ }
206
+ /** The handle keeps the pointer for the drag, wherever it goes. */
207
+ startDrag(event) {
208
+ this._drag.from = event.clientX;
209
+ this._refs.fold.setPointerCapture(event.pointerId);
210
+ }
211
+ /**
212
+ * Dragged far enough towards the fold (or away from it, as a rail), the side nav follows; the drag goes on from
213
+ * there, so coming back the same distance undoes it. A move the other way only takes the starting point along.
214
+ */
215
+ foldOnDrag(event) {
216
+ if (!this._refs.fold.hasPointerCapture(event.pointerId)) return;
217
+ const moved = event.clientX - this._drag.from;
218
+ const towardsNext = this.isRail() ? moved : -moved;
219
+ if (towardsNext > 0 && towardsNext < FOLD_DRAG_PX) return;
220
+ this._drag.from = event.clientX;
221
+ if (towardsNext >= FOLD_DRAG_PX) this.fold();
222
+ }
223
+ /** The keys fold it wherever the focus is, unless the page used them or a drawer shows it whole. */
224
+ foldOnHotkey(event) {
225
+ const hotkey = this.hotkey.get();
226
+ if (!(!this.inDrawer.get() && hasKeys(hotkey)) || event.defaultPrevented || !matchesHotkey(event, parseHotkey(hotkey), onApple())) return;
227
+ event.preventDefault();
228
+ this.fold();
229
+ }
142
230
  fold() {
143
231
  const collapsed = !this.collapsed.get();
144
232
  this.collapsed.set(collapsed);
@@ -179,13 +267,64 @@ var JlSideNav = class extends JlElement {
179
267
  renderLabel() {
180
268
  this._refs.nav.setAttribute("aria-label", this.label.get() || jlText("mainNavigation"));
181
269
  }
182
- /** The fold button's icon and text; the CSS hides it unless `collapsible`, and in a drawer. */
270
+ /** What the handle or the button says and does next; the CSS shows the one `collapsible` names, none in a drawer. */
183
271
  renderFold() {
184
272
  const fold = this._refs.fold;
185
273
  const rail = this.isRail();
186
- fold.icon.set(rail ? EXPAND_ICON : COLLAPSE_ICON);
187
- fold.label.set(rail ? "" : this.collapseLabel.get() || jlText("collapseMenu"));
188
- fold.hint.set(rail ? this.expandLabel.get() || jlText("expandMenu") : "");
274
+ const hotkey = this.hotkey.get();
275
+ const label = rail ? this.expandLabel.get() || jlText("expandMenu") : this.collapseLabel.get() || jlText("collapseMenu");
276
+ const hint = hasKeys(hotkey) ? withKeys(label, hotkey) : label;
277
+ const mode = this.collapsible.get();
278
+ const natives = mode === "knob" ? [fold, this.knob()] : [fold];
279
+ for (const control of natives) {
280
+ control.setAttribute("aria-label", label);
281
+ control.setAttribute("aria-expanded", String(!rail));
282
+ control.title = hint;
283
+ }
284
+ if (mode === "button") {
285
+ const button = this.foldButton();
286
+ button.icon.set(rail ? EXPAND_ICON : COLLAPSE_ICON);
287
+ button.hint.set(hint);
288
+ }
289
+ }
290
+ /** The knob on the edge line, made the first time `collapsible` asks for it. */
291
+ knob() {
292
+ const over = this._refs.over;
293
+ const made = over.querySelector(`.${KNOB}`);
294
+ if (made !== null) return made;
295
+ const knob = /* @__PURE__ */ jsx("button", {
296
+ type: "button",
297
+ class: KNOB,
298
+ onClick: () => this.fold(),
299
+ children: /* @__PURE__ */ jsx(JlIcon, {
300
+ class: "knob-icon",
301
+ name: "chevron-right",
302
+ size: KNOB_ICON_SIZE
303
+ })
304
+ });
305
+ over.append(knob);
306
+ this.placeKnob();
307
+ return knob;
308
+ }
309
+ /** Puts the knob's centre in the gap between the header and the first section, wherever the header ends. */
310
+ placeKnob() {
311
+ const knob = this._refs.over.querySelector(`.${KNOB}`);
312
+ if (knob === null) return;
313
+ const gapCentre = this._refs.sections.offsetTop - SECTIONS_GAP / 2;
314
+ knob.style.top = `${Math.max(KNOB_MIN_TOP, gapCentre - KNOB_SIZE / 2)}px`;
315
+ }
316
+ /** The button at the bottom, made the first time `collapsible` asks for it. */
317
+ foldButton() {
318
+ const bottom = this._refs.bottom;
319
+ const made = bottom.querySelector(`.${FOLD_BUTTON}`);
320
+ if (made !== null) return made;
321
+ const button = /* @__PURE__ */ jsx(JlButton, {
322
+ class: FOLD_BUTTON,
323
+ variant: "ghost"
324
+ });
325
+ button.addEventListener("press", () => this.fold());
326
+ bottom.append(button);
327
+ return button;
189
328
  }
190
329
  choose(id) {
191
330
  this.value.set(id);
@@ -228,6 +367,7 @@ var JlSideNav = class extends JlElement {
228
367
  }
229
368
  render() {
230
369
  for (const id of pathInSections(this.sections.get(), this.value.get()).slice(0, -1)) this._state.open.add(id);
370
+ this._refs.sections.classList.remove(GLIDING);
231
371
  this._refs.sections.replaceChildren(...this.sections.get().map((section, index) => this.sectionNode(section, index)));
232
372
  this.renderOpen();
233
373
  this.renderActive(this.value.get());
@@ -362,4 +502,4 @@ var JlSideNav = class extends JlElement {
362
502
  }
363
503
  };
364
504
  JlSideNav.register();
365
- export { JlSideNav };
505
+ export { JlSideNav, SIDE_NAV_COLLAPSIBLES };
@@ -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[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}tbody tr[data-index]{cursor:var(--row-cursor,auto)}: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;--foot-y:8px;--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;--foot-y:6px}.frame{border:1px solid var(--jl-line);border-radius:var(--jl-radius);background:var(--jl-surface);overflow:hidden}.scroll{max-height:var(--max-height);overscroll-behavior-x:contain;position:relative;overflow:auto}.foot{padding:var(--foot-y) var(--cell-x);border-top:1px solid var(--jl-line);color:var(--jl-muted);font-size:var(--jl-font-sm);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 16px;display:flex}.foot.alone{justify-content:flex-end}: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}tbody tr[data-index]{cursor:var(--row-cursor,auto)}: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 };
@@ -120,6 +120,8 @@ export declare class JlTable<Row extends object = TableRow, Extra extends string
120
120
  templateHtml(): Node;
121
121
  templateCss(): string;
122
122
  onConnect(): void;
123
+ /** The bar under the rows shows when the page put something in it; what stands there alone goes to its end. */
124
+ private drawFoot;
123
125
  /** Draws on the next microtask: the inputs set while connecting give one drawing, not one each. */
124
126
  protected drawTexts(): void;
125
127
  private schedule;
@@ -6,6 +6,7 @@ import { registerIcons } from "../lib/icons.js";
6
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
+ import { hasSlotted } from "../lib/slots.js";
9
10
  import { JlBadge } from "../atoms/jl-badge.js";
10
11
  import { startedOnControl } from "../lib/surface.js";
11
12
  import { PRESS_EVENTS, pressButtonOf, tellPress } from "../lib/press.js";
@@ -200,6 +201,8 @@ var JlTable = class extends JlElement {
200
201
  };
201
202
  _refs = this.useRefs((ref) => ({
202
203
  body: ref("tbody"),
204
+ foot: ref(".foot"),
205
+ footSlot: ref("slot[name=\"footer\"]"),
203
206
  head: ref("thead"),
204
207
  table: ref("table")
205
208
  }));
@@ -221,16 +224,26 @@ var JlTable = class extends JlElement {
221
224
  for (const change of rowToggles(before, openRows(expanded, expansion))) this.events.emit("toggle", change);
222
225
  }
223
226
  templateHtml() {
224
- return /* @__PURE__ */ jsx("div", {
225
- class: "scroll",
227
+ return /* @__PURE__ */ jsxs("div", {
228
+ class: "frame",
226
229
  attrs: { part: "base" },
227
- children: /* @__PURE__ */ jsxs("table", { children: [/* @__PURE__ */ jsx("thead", {}), /* @__PURE__ */ jsx("tbody", {})] })
230
+ children: [/* @__PURE__ */ jsx("div", {
231
+ class: "scroll",
232
+ children: /* @__PURE__ */ jsxs("table", { children: [/* @__PURE__ */ jsx("thead", {}), /* @__PURE__ */ jsx("tbody", {})] })
233
+ }), /* @__PURE__ */ jsx("div", {
234
+ class: "foot",
235
+ attrs: { part: "footer" },
236
+ hidden: true,
237
+ children: /* @__PURE__ */ jsx("slot", { name: "footer" })
238
+ })]
228
239
  });
229
240
  }
230
241
  templateCss() {
231
242
  return css`${BASE_STYLES}${jl_table_default}`;
232
243
  }
233
244
  onConnect() {
245
+ this.drawFoot();
246
+ this.on(this._refs.footSlot, "slotchange", () => this.drawFoot());
234
247
  this.on(this._refs.head, "click", (event) => {
235
248
  const key = event.target.closest("button.sort")?.dataset.key;
236
249
  if (key !== void 0) this.sortBy(key);
@@ -240,6 +253,12 @@ var JlTable = class extends JlElement {
240
253
  });
241
254
  for (const type of PRESS_EVENTS) this.on(this._refs.body, type, (event) => this.pressRow(event));
242
255
  }
256
+ /** The bar under the rows shows when the page put something in it; what stands there alone goes to its end. */
257
+ drawFoot() {
258
+ const foot = this._refs.foot;
259
+ foot.hidden = !hasSlotted(this._refs.footSlot);
260
+ foot.classList.toggle("alone", this._refs.footSlot.assignedElements({ flatten: true }).length === 1);
261
+ }
243
262
  /** Draws on the next microtask: the inputs set while connecting give one drawing, not one each. */
244
263
  drawTexts() {
245
264
  this.schedule("head", "body");
@@ -1,3 +1,3 @@
1
1
  // src/styles/base.css?inline
2
- var base_default = ":host{box-sizing:border-box;font-family:var(--jl-font-sans);-webkit-tap-highlight-color:transparent}:host([hidden]){display:none!important}*,:before,:after{box-sizing:inherit}[hidden]{display:none!important}button,input,select,textarea{font:inherit;color:inherit}:focus-visible{box-shadow:var(--jl-focus-ring);outline:none}h1,h2,h3,h4,p,ul,ol,figure{margin:0}code,kbd,pre{font-family:var(--jl-font-mono)}.sr-only{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}@media (forced-colors:active){:focus-visible{outline-offset:2px!important;outline:2px solid highlight!important}}@media (prefers-reduced-motion:reduce){*,:before,:after{transition-duration:1ms!important;animation-duration:1ms!important;animation-iteration-count:1!important}}";
2
+ var base_default = ":host{box-sizing:border-box;font-family:var(--jl-font-sans);-webkit-tap-highlight-color:transparent}:host([hidden]){display:none!important}*,:before,:after{box-sizing:inherit}*{scrollbar-width:thin}[hidden]{display:none!important}button,input,select,textarea{font:inherit;color:inherit}:focus-visible{box-shadow:var(--jl-focus-ring);outline:none}h1,h2,h3,h4,p,ul,ol,figure{margin:0}code,kbd,pre{font-family:var(--jl-font-mono)}.sr-only{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}@media (forced-colors:active){:focus-visible{outline-offset:2px!important;outline:2px solid highlight!important}}@media (prefers-reduced-motion:reduce){*,:before,:after{transition-duration:1ms!important;animation-duration:1ms!important;animation-iteration-count:1!important}}";
3
3
  export { base_default as default };
@@ -1,3 +1,3 @@
1
1
  // src/styles/tokens.css?inline
2
- var tokens_default = "@layer jlib{:root,[data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--jl-font-sans:\"Manrope Variable\", \"Manrope\", system-ui, -apple-system, \"Segoe UI\", sans-serif;--jl-font-mono:\"JetBrains Mono Variable\", \"JetBrains Mono\", ui-monospace, \"SF Mono\", Menlo, monospace;--jl-font-xs:12px;--jl-font-sm:13px;--jl-font-md:14px;--jl-font-lg:16px;--jl-font-xl:20px;--jl-font-2xl:28px;--jl-text:#0b0b0c;--jl-text-2:#3a3f47;--jl-muted:#5b616b;--jl-faint:#8a9099;--jl-bg:#fff;--jl-surface:#fff;--jl-surface-2:#f7f8f9;--jl-surface-3:#eef0f2;--jl-code-bg:#f0f2f4;--jl-line:#e6e8eb;--jl-line-soft:#eef0f2;--jl-line-strong:#d5d9de;--jl-brand:#0e88d3;--jl-accent:#0c72b0;--jl-accent-strong:#095a8b;--jl-accent-soft:#e9f4fb;--jl-accent-line:#b7dbf2;--jl-on-accent:#fff;--jl-on-brand:#fff;--jl-ok:#17784a;--jl-ok-soft:#ecf6f0;--jl-warn:#9a5b00;--jl-warn-soft:#fcf4e6;--jl-danger:#b42318;--jl-danger-soft:#fdf0ef;--jl-on-danger:#fff;--jl-info:#0c72b0;--jl-info-soft:#e9f4fb;--jl-code-keyword:#0c72b0;--jl-code-tag:#095a8b;--jl-code-attribute:#5b48c8;--jl-code-string:#17784a;--jl-code-number:#9a5b00;--jl-code-function:#3d5a80;--jl-code-property:#127a72;--jl-code-comment:var(--jl-muted);--jl-radius-xs:6px;--jl-radius-sm:8px;--jl-radius:10px;--jl-radius-lg:12px;--jl-radius-xl:20px;--jl-radius-pill:999px;--jl-space-1:4px;--jl-space-2:8px;--jl-space-3:12px;--jl-space-4:16px;--jl-space-5:20px;--jl-space-6:24px;--jl-space-8:32px;--jl-space-10:40px;--jl-space-12:48px;--jl-space-16:64px;--jl-control-sm:30px;--jl-control-md:36px;--jl-control-lg:44px;--jl-control-font:var(--jl-font-md);--jl-page-form:720px;--jl-page-standard:1120px;--jl-page-wide:1400px;--jl-shadow-sm:0 1px 2px #0b0b0c0d;--jl-shadow:0 6px 16px -6px #0b0b0c1f;--jl-shadow-lg:0 18px 44px -14px #0b0b0c38;--jl-focus-ring:0 0 0 3px color-mix(in srgb, var(--jl-brand) 35%, transparent);--jl-scrim:#0b0b0c61;--jl-ease:cubic-bezier(.2, .7, .2, 1);--jl-fast:.12s;--jl-slow:.24s}@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--jl-text:#eceef1;--jl-text-2:#c3c8cf;--jl-muted:#959ca6;--jl-faint:#6b727c;--jl-bg:#0f1113;--jl-surface:#0f1113;--jl-surface-2:#16191c;--jl-surface-3:#1d2125;--jl-code-bg:#1d2125;--jl-line:#262a2f;--jl-line-soft:#1f2327;--jl-line-strong:#343a41;--jl-brand:#1a9be0;--jl-accent:#3ea6e8;--jl-accent-strong:#6cc0f2;--jl-accent-soft:#0f2a3b;--jl-accent-line:#1e4a66;--jl-on-accent:#04131c;--jl-ok:#4cc38a;--jl-ok-soft:#10261c;--jl-warn:#e5a54b;--jl-warn-soft:#2a2012;--jl-danger:#f0786c;--jl-danger-soft:#3a1a17;--jl-on-danger:#1c0604;--jl-info:#3ea6e8;--jl-info-soft:#0f2a3b;--jl-code-keyword:#3ea6e8;--jl-code-tag:#6cc0f2;--jl-code-attribute:#a99bf0;--jl-code-string:#4cc38a;--jl-code-number:#e5a54b;--jl-code-function:#8fb0d6;--jl-code-property:#4fc1b5;--jl-code-comment:var(--jl-muted);--jl-shadow-sm:0 1px 2px #0006;--jl-shadow:0 6px 18px -6px #0009;--jl-shadow-lg:0 18px 44px -12px #000000b3;--jl-scrim:#0000008c}}[data-theme=dark]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--jl-text:#eceef1;--jl-text-2:#c3c8cf;--jl-muted:#959ca6;--jl-faint:#6b727c;--jl-bg:#0f1113;--jl-surface:#0f1113;--jl-surface-2:#16191c;--jl-surface-3:#1d2125;--jl-code-bg:#1d2125;--jl-line:#262a2f;--jl-line-soft:#1f2327;--jl-line-strong:#343a41;--jl-brand:#1a9be0;--jl-accent:#3ea6e8;--jl-accent-strong:#6cc0f2;--jl-accent-soft:#0f2a3b;--jl-accent-line:#1e4a66;--jl-on-accent:#04131c;--jl-ok:#4cc38a;--jl-ok-soft:#10261c;--jl-warn:#e5a54b;--jl-warn-soft:#2a2012;--jl-danger:#f0786c;--jl-danger-soft:#3a1a17;--jl-on-danger:#1c0604;--jl-info:#3ea6e8;--jl-info-soft:#0f2a3b;--jl-code-keyword:#3ea6e8;--jl-code-tag:#6cc0f2;--jl-code-attribute:#a99bf0;--jl-code-string:#4cc38a;--jl-code-number:#e5a54b;--jl-code-function:#8fb0d6;--jl-code-property:#4fc1b5;--jl-code-comment:var(--jl-muted);--jl-shadow-sm:0 1px 2px #0006;--jl-shadow:0 6px 18px -6px #0009;--jl-shadow-lg:0 18px 44px -12px #000000b3;--jl-scrim:#0000008c}@media (pointer:coarse){:root,[data-theme=light],[data-theme=dark]{--jl-control-sm:36px;--jl-control-md:44px;--jl-control-lg:48px;--jl-control-font:16px}}}";
2
+ var tokens_default = "@layer jlib{:root,[data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--jl-font-sans:\"Manrope Variable\", \"Manrope\", system-ui, -apple-system, \"Segoe UI\", sans-serif;--jl-font-mono:\"JetBrains Mono Variable\", \"JetBrains Mono\", ui-monospace, \"SF Mono\", Menlo, monospace;--jl-font-xs:12px;--jl-font-sm:13px;--jl-font-md:14px;--jl-font-lg:16px;--jl-font-xl:20px;--jl-font-2xl:28px;--jl-text:#0b0b0c;--jl-text-2:#3a3f47;--jl-muted:#5b616b;--jl-faint:#8a9099;--jl-bg:#fff;--jl-surface:#fff;--jl-surface-2:#f7f8f9;--jl-surface-3:#eef0f2;--jl-code-bg:#f0f2f4;--jl-line:#e6e8eb;--jl-line-soft:#eef0f2;--jl-line-strong:#d5d9de;--jl-brand:#0e88d3;--jl-accent:#0c72b0;--jl-accent-strong:#095a8b;--jl-accent-soft:#e9f4fb;--jl-accent-line:#b7dbf2;--jl-on-accent:#fff;--jl-on-brand:#fff;--jl-ok:#17784a;--jl-ok-soft:#ecf6f0;--jl-warn:#9a5b00;--jl-warn-soft:#fcf4e6;--jl-danger:#b42318;--jl-danger-soft:#fdf0ef;--jl-on-danger:#fff;--jl-info:#0c72b0;--jl-info-soft:#e9f4fb;--jl-code-keyword:#0c72b0;--jl-code-tag:#095a8b;--jl-code-attribute:#5b48c8;--jl-code-string:#17784a;--jl-code-number:#9a5b00;--jl-code-function:#3d5a80;--jl-code-property:#127a72;--jl-code-comment:var(--jl-muted);--jl-radius-xs:6px;--jl-radius-sm:8px;--jl-radius:10px;--jl-radius-lg:12px;--jl-radius-xl:20px;--jl-radius-pill:999px;--jl-space-1:4px;--jl-space-2:8px;--jl-space-3:12px;--jl-space-4:16px;--jl-space-5:20px;--jl-space-6:24px;--jl-space-8:32px;--jl-space-10:40px;--jl-space-12:48px;--jl-space-16:64px;--jl-control-sm:30px;--jl-control-md:36px;--jl-control-lg:44px;--jl-control-font:var(--jl-font-md);--jl-page-form:720px;--jl-page-standard:1120px;--jl-page-wide:1400px;--jl-shadow-sm:0 1px 2px #0b0b0c0d;--jl-shadow:0 6px 16px -6px #0b0b0c1f;--jl-shadow-lg:0 18px 44px -14px #0b0b0c38;--jl-focus-ring:0 0 0 3px color-mix(in srgb, var(--jl-brand) 35%, transparent);--jl-scrim:#0b0b0c61;--jl-ease:cubic-bezier(.2, .7, .2, 1);--jl-fast:.12s;--jl-slow:.24s;--jl-scrollbar:color-mix(in srgb, var(--jl-muted) 45%, transparent);scrollbar-color:var(--jl-scrollbar) transparent}@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--jl-text:#eceef1;--jl-text-2:#c3c8cf;--jl-muted:#959ca6;--jl-faint:#6b727c;--jl-bg:#0f1113;--jl-surface:#0f1113;--jl-surface-2:#16191c;--jl-surface-3:#1d2125;--jl-code-bg:#1d2125;--jl-line:#262a2f;--jl-line-soft:#1f2327;--jl-line-strong:#343a41;--jl-brand:#1a9be0;--jl-accent:#3ea6e8;--jl-accent-strong:#6cc0f2;--jl-accent-soft:#0f2a3b;--jl-accent-line:#1e4a66;--jl-on-accent:#04131c;--jl-ok:#4cc38a;--jl-ok-soft:#10261c;--jl-warn:#e5a54b;--jl-warn-soft:#2a2012;--jl-danger:#f0786c;--jl-danger-soft:#3a1a17;--jl-on-danger:#1c0604;--jl-info:#3ea6e8;--jl-info-soft:#0f2a3b;--jl-code-keyword:#3ea6e8;--jl-code-tag:#6cc0f2;--jl-code-attribute:#a99bf0;--jl-code-string:#4cc38a;--jl-code-number:#e5a54b;--jl-code-function:#8fb0d6;--jl-code-property:#4fc1b5;--jl-code-comment:var(--jl-muted);--jl-shadow-sm:0 1px 2px #0006;--jl-shadow:0 6px 18px -6px #0009;--jl-shadow-lg:0 18px 44px -12px #000000b3;--jl-scrim:#0000008c}}[data-theme=dark]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--jl-text:#eceef1;--jl-text-2:#c3c8cf;--jl-muted:#959ca6;--jl-faint:#6b727c;--jl-bg:#0f1113;--jl-surface:#0f1113;--jl-surface-2:#16191c;--jl-surface-3:#1d2125;--jl-code-bg:#1d2125;--jl-line:#262a2f;--jl-line-soft:#1f2327;--jl-line-strong:#343a41;--jl-brand:#1a9be0;--jl-accent:#3ea6e8;--jl-accent-strong:#6cc0f2;--jl-accent-soft:#0f2a3b;--jl-accent-line:#1e4a66;--jl-on-accent:#04131c;--jl-ok:#4cc38a;--jl-ok-soft:#10261c;--jl-warn:#e5a54b;--jl-warn-soft:#2a2012;--jl-danger:#f0786c;--jl-danger-soft:#3a1a17;--jl-on-danger:#1c0604;--jl-info:#3ea6e8;--jl-info-soft:#0f2a3b;--jl-code-keyword:#3ea6e8;--jl-code-tag:#6cc0f2;--jl-code-attribute:#a99bf0;--jl-code-string:#4cc38a;--jl-code-number:#e5a54b;--jl-code-function:#8fb0d6;--jl-code-property:#4fc1b5;--jl-code-comment:var(--jl-muted);--jl-shadow-sm:0 1px 2px #0006;--jl-shadow:0 6px 18px -6px #0009;--jl-shadow-lg:0 18px 44px -12px #000000b3;--jl-scrim:#0000008c}@media (pointer:coarse){:root,[data-theme=light],[data-theme=dark]{--jl-control-sm:36px;--jl-control-md:44px;--jl-control-lg:48px;--jl-control-font:16px}}}";
3
3
  export { tokens_default as default };
@@ -1,3 +1,3 @@
1
1
  // src/templates/jl-app-shell.css?inline
2
- var jl_app_shell_default = ":host{--header-height:56px;--drawer-width:min(300px, 86%);height:100%;min-height:0;display:block;container:jl-app-shell/inline-size}.shell{background:var(--jl-bg);height:100%;color:var(--jl-text);grid-template:\"top top top\"\"nav main aside\"minmax(0,1fr)/auto minmax(0,1fr) auto;display:grid;position:relative;overflow:hidden}.top{min-height:var(--header-height);border-bottom:1px solid var(--jl-line);background:var(--jl-surface);grid-area:top;align-items:center;gap:8px;padding:0 16px;display:flex}:host(:not([has-header])) .top,:host([narrow-header]) .top{display:none}::slotted([slot=header]){flex:1;min-width:0}.menu{width:var(--jl-control-md);height:var(--jl-control-md);border-radius:var(--jl-radius-sm);color:var(--jl-text-2);cursor:pointer;background:0 0;border:none;flex:none;justify-content:center;align-items:center;margin-left:-8px;padding:0;display:none}.menu:hover{background:var(--jl-surface-3);color:var(--jl-text)}.nav{border-right:1px solid var(--jl-line);background:var(--jl-surface);grid-area:nav;min-height:0;overflow-y:auto}.nav:focus-visible{box-shadow:none}:host(:not([has-nav])) .nav{display:none}.main{isolation:isolate;grid-area:main;min-width:0;min-height:0;overflow:auto}.aside{border-left:1px solid var(--jl-line);background:var(--jl-surface);grid-area:aside;min-height:0;overflow-y:auto}:host(:not([has-aside])) .aside,.tabs,.scrim{display:none}@container jl-app-shell (width<960px){.shell{grid-template:\"top\"\"main\"minmax(0,1fr)\"tabs\"/minmax(0,1fr)}:host([has-tabs]) .tabs{grid-area:tabs;display:block}:host([has-nav]) .top,:host([narrow-header][has-header]) .top{display:flex}:host([has-nav]) .menu{display:inline-flex}.nav{z-index:2;max-width:var(--drawer-width);box-shadow:var(--jl-shadow-lg);visibility:hidden;transition:transform var(--jl-slow) var(--jl-ease), visibility 0s linear var(--jl-slow);position:absolute;top:0;bottom:0;left:0;transform:translate(-100%)}:host([nav-open]) .nav{visibility:visible;transition:transform var(--jl-slow) var(--jl-ease);transform:none}.scrim{z-index:1;background:var(--jl-scrim);opacity:0;pointer-events:none;transition:opacity var(--jl-slow) var(--jl-ease);display:block;position:absolute;inset:0}:host([nav-open]) .scrim{opacity:1;pointer-events:auto}.aside{display:none}}";
2
+ var jl_app_shell_default = ":host{--header-height:56px;--drawer-width:min(300px, 86%);height:100%;min-height:0;display:block;container:jl-app-shell/inline-size}.shell{background:var(--jl-bg);height:100%;color:var(--jl-text);grid-template:\"top top top\"\"nav main aside\"minmax(0,1fr)/auto minmax(0,1fr) auto;display:grid;position:relative;overflow:hidden}.top{min-height:var(--header-height);border-bottom:1px solid var(--jl-line);background:var(--jl-surface);grid-area:top;align-items:center;gap:8px;padding:0 16px;display:flex}:host(:not([has-header])) .top,:host([narrow-header]) .top{display:none}::slotted([slot=header]){flex:1;min-width:0}.menu{width:var(--jl-control-md);height:var(--jl-control-md);border-radius:var(--jl-radius-sm);color:var(--jl-text-2);cursor:pointer;background:0 0;border:none;flex:none;justify-content:center;align-items:center;margin-left:-8px;padding:0;display:none}.menu:hover{background:var(--jl-surface-3);color:var(--jl-text)}.nav{border-right:1px solid var(--jl-line);background:var(--jl-surface);grid-area:nav;min-height:0;overflow-y:auto}.nav:focus-visible{box-shadow:none}:host(:not([has-nav])) .nav{display:none}.main{isolation:isolate;grid-area:main;min-width:0;min-height:0;overflow:auto}.aside{border-left:1px solid var(--jl-line);background:var(--jl-surface);grid-area:aside;min-height:0;overflow-y:auto}:host(:not([has-aside])) .aside,.tabs,.scrim{display:none}@container jl-app-shell (width>=960px){:host([has-side-nav]) .nav{z-index:1;overflow:visible}}@container jl-app-shell (width<960px){.shell{grid-template:\"top\"\"main\"minmax(0,1fr)\"tabs\"/minmax(0,1fr)}:host([has-tabs]) .tabs{grid-area:tabs;display:block}:host([has-nav]) .top,:host([narrow-header][has-header]) .top{display:flex}:host([has-nav]) .menu{display:inline-flex}.nav{z-index:2;max-width:var(--drawer-width);box-shadow:var(--jl-shadow-lg);visibility:hidden;transition:transform var(--jl-slow) var(--jl-ease), visibility 0s linear var(--jl-slow);position:absolute;top:0;bottom:0;left:0;transform:translate(-100%)}:host([nav-open]) .nav{visibility:visible;transition:transform var(--jl-slow) var(--jl-ease);transform:none}.scrim{z-index:1;background:var(--jl-scrim);opacity:0;pointer-events:none;transition:opacity var(--jl-slow) var(--jl-ease);display:block;position:absolute;inset:0}:host([nav-open]) .scrim{opacity:1;pointer-events:auto}.aside{display:none}}";
3
3
  export { jl_app_shell_default as default };
@@ -12,6 +12,7 @@ import { jsx, jsxs } from "@jadis/core/jsx-runtime";
12
12
  registerIcons({ menu: Menu });
13
13
  var MENU_ICON_SIZE = 18;
14
14
  var HIDDEN = "none";
15
+ var SIDE_NAV_TAG = "jl-side-nav";
15
16
  var SHELL_BOTTOM = "--jl-shell-bottom";
16
17
  /** Whether a click inside the drawer followed a link: the page changes, so the drawer gets out of the way. */
17
18
  var followsLink = (event) => event.composedPath().some((node) => node instanceof HTMLAnchorElement && node.href !== "");
@@ -201,6 +202,7 @@ var JlAppShell = class extends JlElement {
201
202
  for (const element of tabElements) element.addEventListener("more", () => this.onMore(), { signal: this._state.tabsListeners.signal });
202
203
  const navElements = this._refs.navSlot.assignedElements();
203
204
  this.reflect("has-nav", navElements.length > 0);
205
+ this.reflect("has-side-nav", navElements.some((element) => element.localName === SIDE_NAV_TAG));
204
206
  this._state.navListeners.abort();
205
207
  this._state.navListeners = new AbortController();
206
208
  const signal = this._state.navListeners.signal;
package/dist/tokens.css CHANGED
@@ -105,6 +105,10 @@
105
105
  --jl-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
106
106
  --jl-fast: 120ms;
107
107
  --jl-slow: 240ms;
108
+
109
+ /* Scrollbars: a quiet thumb on no track, in both themes. The colour is inherited, into every shadow root. */
110
+ --jl-scrollbar: color-mix(in srgb, var(--jl-muted) 45%, transparent);
111
+ scrollbar-color: var(--jl-scrollbar) transparent;
108
112
  }
109
113
 
110
114
  @media (prefers-color-scheme: dark) {
@@ -15,6 +15,11 @@ export type SideNavItem<Id extends string = string> = {
15
15
  badge?: string | number;
16
16
  children?: SideNavItem<Id>[];
17
17
  };
18
+ /**
19
+ * What people fold a side nav with: `none` (it folds only as the app sets `collapsed`), a quiet icon `button` at its
20
+ * bottom, a `handle` along its edge, or a round `knob` on its edge line, under its header.
21
+ */
22
+ export type SideNavCollapsible = 'none' | 'button' | 'handle' | 'knob';
18
23
  /** A group of items under an optional heading. */
19
24
  export type SideNavSection<Id extends string = string> = {
20
25
  label?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syware/jlib",
3
- "version": "0.15.0",
3
+ "version": "0.16.1",
4
4
  "description": "A tree-shakeable component library on Jadis and native Web Components, organised in atomic design",
5
5
  "keywords": [
6
6
  "web-components",