@syware/jlib 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all.js +2 -2
- package/dist/index.js +2 -2
- package/dist/organisms/jl-side-nav.css.js +1 -1
- package/dist/organisms/jl-side-nav.d.ts +43 -9
- package/dist/organisms/jl-side-nav.js +164 -24
- package/dist/organisms/jl-table.css.js +1 -1
- package/dist/organisms/jl-table.d.ts +2 -0
- package/dist/organisms/jl-table.js +22 -3
- package/dist/styles/base.css.js +1 -1
- package/dist/styles/tokens.css.js +1 -1
- package/dist/templates/jl-app-shell.css.js +1 -1
- package/dist/templates/jl-app-shell.js +2 -0
- package/dist/tokens.css +4 -0
- package/dist/types/jl-side-nav.types.d.ts +5 -0
- package/package.json +1 -1
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 };
|
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 };
|
|
@@ -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
|
|
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
|
-
/**
|
|
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():
|
|
34
|
-
set(setter:
|
|
38
|
+
get(): SideNavCollapsible;
|
|
39
|
+
set(setter: ((prevState: SideNavCollapsible) => SideNavCollapsible) | SideNavCollapsible): void;
|
|
35
40
|
}>>;
|
|
36
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
*
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
/**
|
|
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
|
-
*
|
|
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
|
-
|
|
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__ */
|
|
144
|
+
/* @__PURE__ */ jsx("div", {
|
|
98
145
|
class: "bottom",
|
|
99
|
-
children:
|
|
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.
|
|
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(() =>
|
|
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
|
-
/**
|
|
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
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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}.
|
|
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__ */
|
|
225
|
-
class: "
|
|
227
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
228
|
+
class: "frame",
|
|
226
229
|
attrs: { part: "base" },
|
|
227
|
-
children:
|
|
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");
|
package/dist/styles/base.css.js
CHANGED
|
@@ -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;
|