@syware/jlib 0.8.0 → 0.10.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/README.md +19 -3
- package/dist/all.js +6 -3
- package/dist/atoms/jl-app-icon.css.js +3 -0
- package/dist/atoms/jl-app-icon.js +1 -1
- package/dist/atoms/jl-avatar.css.js +3 -0
- package/dist/atoms/jl-avatar.js +1 -1
- package/dist/atoms/jl-badge.css.js +3 -0
- package/dist/atoms/jl-badge.js +1 -1
- package/dist/atoms/jl-button.css.js +3 -0
- package/dist/atoms/jl-button.js +1 -1
- package/dist/atoms/jl-checkbox.css.js +3 -0
- package/dist/atoms/jl-checkbox.js +1 -1
- package/dist/atoms/jl-chip.css.js +3 -0
- package/dist/atoms/jl-chip.d.ts +1 -0
- package/dist/atoms/jl-chip.js +5 -3
- package/dist/atoms/jl-divider.css.js +3 -0
- package/dist/atoms/jl-divider.js +1 -1
- package/dist/atoms/jl-icon.css.js +3 -0
- package/dist/atoms/jl-icon.js +1 -1
- package/dist/atoms/jl-input.css.js +3 -0
- package/dist/atoms/jl-input.d.ts +2 -0
- package/dist/atoms/jl-input.js +10 -4
- package/dist/atoms/jl-kbd.css.js +3 -0
- package/dist/atoms/jl-kbd.js +1 -1
- package/dist/atoms/jl-link.css.js +3 -0
- package/dist/atoms/jl-link.js +1 -1
- package/dist/atoms/jl-loading-bar.css.js +3 -0
- package/dist/atoms/jl-loading-bar.d.ts +38 -0
- package/dist/atoms/jl-loading-bar.js +121 -0
- package/dist/atoms/jl-progress-ring.css.js +3 -0
- package/dist/atoms/jl-progress-ring.js +1 -1
- package/dist/atoms/jl-progress.css.js +3 -0
- package/dist/atoms/jl-progress.js +1 -1
- package/dist/atoms/jl-rating.css.js +3 -0
- package/dist/atoms/jl-rating.d.ts +2 -0
- package/dist/atoms/jl-rating.js +14 -6
- package/dist/atoms/jl-select.css.js +3 -0
- package/dist/atoms/jl-select.js +1 -1
- package/dist/atoms/jl-skeleton.css.js +3 -0
- package/dist/atoms/jl-skeleton.js +1 -1
- package/dist/atoms/jl-slider.css.js +3 -0
- package/dist/atoms/jl-slider.js +1 -1
- package/dist/atoms/jl-spinner.css.js +3 -0
- package/dist/atoms/jl-spinner.d.ts +2 -0
- package/dist/atoms/jl-spinner.js +7 -3
- package/dist/atoms/jl-switch.css.js +3 -0
- package/dist/atoms/jl-switch.js +1 -1
- package/dist/atoms/jl-textarea.css.js +3 -0
- package/dist/atoms/jl-textarea.js +1 -1
- package/dist/base/jl-element.d.ts +8 -0
- package/dist/base/jl-element.js +5 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5 -2
- package/dist/lib/flow.js +23 -6
- package/dist/lib/texts-de.d.ts +111 -0
- package/dist/lib/texts-de.js +114 -0
- package/dist/lib/texts-fr.d.ts +111 -0
- package/dist/lib/texts-fr.js +114 -0
- package/dist/lib/texts.d.ts +180 -91
- package/dist/lib/texts.js +177 -9
- package/dist/molecules/jl-accordion-item.css.js +3 -0
- package/dist/molecules/jl-accordion-item.js +1 -1
- package/dist/molecules/jl-accordion.css.js +3 -0
- package/dist/molecules/jl-accordion.js +1 -1
- package/dist/molecules/jl-account-button.css.js +3 -0
- package/dist/molecules/jl-account-button.js +1 -1
- package/dist/molecules/jl-alert.css.js +3 -0
- package/dist/molecules/jl-alert.d.ts +1 -0
- package/dist/molecules/jl-alert.js +5 -3
- package/dist/molecules/jl-avatar-group.css.js +3 -0
- package/dist/molecules/jl-avatar-group.js +1 -1
- package/dist/molecules/jl-breadcrumb.css.js +3 -0
- package/dist/molecules/jl-breadcrumb.d.ts +2 -0
- package/dist/molecules/jl-breadcrumb.js +13 -7
- package/dist/molecules/jl-calendar.css.js +3 -0
- package/dist/molecules/jl-calendar.d.ts +1 -0
- package/dist/molecules/jl-calendar.js +8 -5
- package/dist/molecules/jl-card.css.js +3 -0
- package/dist/molecules/jl-card.js +1 -1
- package/dist/molecules/jl-chip-group.css.js +3 -0
- package/dist/molecules/jl-chip-group.d.ts +1 -0
- package/dist/molecules/jl-chip-group.js +5 -2
- package/dist/molecules/jl-code-block.css.js +3 -0
- package/dist/molecules/jl-code-block.js +2 -2
- package/dist/molecules/jl-combobox.css.js +3 -0
- package/dist/molecules/jl-combobox.d.ts +3 -1
- package/dist/molecules/jl-combobox.js +13 -8
- package/dist/molecules/jl-copy-button.css.js +3 -0
- package/dist/molecules/jl-copy-button.d.ts +1 -0
- package/dist/molecules/jl-copy-button.js +8 -6
- package/dist/molecules/jl-date-picker.css.js +3 -0
- package/dist/molecules/jl-date-picker.d.ts +1 -0
- package/dist/molecules/jl-date-picker.js +11 -8
- package/dist/molecules/jl-empty.css.js +3 -0
- package/dist/molecules/jl-empty.js +1 -1
- package/dist/molecules/jl-facts.css.js +3 -0
- package/dist/molecules/jl-facts.js +1 -1
- package/dist/molecules/jl-field.css.js +3 -0
- package/dist/molecules/jl-field.js +1 -1
- package/dist/molecules/jl-file-drop.css.js +3 -0
- package/dist/molecules/jl-file-drop.d.ts +1 -0
- package/dist/molecules/jl-file-drop.js +16 -7
- package/dist/molecules/jl-input-list.css.js +3 -0
- package/dist/molecules/jl-input-list.d.ts +3 -2
- package/dist/molecules/jl-input-list.js +11 -8
- package/dist/molecules/jl-list-item.css.js +3 -0
- package/dist/molecules/jl-list-item.js +1 -1
- package/dist/molecules/jl-load-more.css.js +3 -0
- package/dist/molecules/jl-load-more.d.ts +4 -2
- package/dist/molecules/jl-load-more.js +16 -9
- package/dist/molecules/jl-load-state.css.js +3 -0
- package/dist/molecules/jl-load-state.d.ts +13 -0
- package/dist/molecules/jl-load-state.js +63 -12
- package/dist/molecules/jl-menu.css.js +3 -0
- package/dist/molecules/jl-menu.js +1 -1
- package/dist/molecules/jl-number-input.css.js +3 -0
- package/dist/molecules/jl-number-input.d.ts +1 -0
- package/dist/molecules/jl-number-input.js +7 -4
- package/dist/molecules/jl-pagination.css.js +3 -0
- package/dist/molecules/jl-pagination.d.ts +2 -0
- package/dist/molecules/jl-pagination.js +18 -10
- package/dist/molecules/jl-popover.css.js +3 -0
- package/dist/molecules/jl-popover.js +1 -1
- package/dist/molecules/jl-radio-group.css.js +3 -0
- package/dist/molecules/jl-radio-group.d.ts +1 -0
- package/dist/molecules/jl-radio-group.js +5 -2
- package/dist/molecules/jl-search-button.css.js +3 -0
- package/dist/molecules/jl-search-button.d.ts +2 -1
- package/dist/molecules/jl-search-button.js +7 -5
- package/dist/molecules/jl-search.css.js +3 -0
- package/dist/molecules/jl-search.d.ts +2 -0
- package/dist/molecules/jl-search.js +10 -4
- package/dist/molecules/jl-segmented.css.js +3 -0
- package/dist/molecules/jl-segmented.js +1 -1
- package/dist/molecules/jl-stat.css.js +3 -0
- package/dist/molecules/jl-stat.js +1 -1
- package/dist/molecules/jl-steps.css.js +3 -0
- package/dist/molecules/jl-steps.d.ts +2 -0
- package/dist/molecules/jl-steps.js +10 -5
- package/dist/molecules/jl-tab-panel.css.js +3 -0
- package/dist/molecules/jl-tab-panel.js +1 -1
- package/dist/molecules/jl-tabs.css.js +3 -0
- package/dist/molecules/jl-tabs.js +1 -1
- package/dist/molecules/jl-tag-input.css.js +3 -0
- package/dist/molecules/jl-tag-input.d.ts +1 -0
- package/dist/molecules/jl-tag-input.js +9 -5
- package/dist/molecules/jl-timeline.css.js +3 -0
- package/dist/molecules/jl-timeline.js +1 -1
- package/dist/molecules/jl-toast.css.js +3 -0
- package/dist/molecules/jl-toast.d.ts +1 -0
- package/dist/molecules/jl-toast.js +5 -3
- package/dist/molecules/jl-tooltip.css.js +3 -0
- package/dist/molecules/jl-tooltip.js +1 -1
- package/dist/organisms/jl-command-palette.css.js +3 -0
- package/dist/organisms/jl-command-palette.d.ts +3 -1
- package/dist/organisms/jl-command-palette.js +23 -15
- package/dist/organisms/jl-confirm.css.js +3 -0
- package/dist/organisms/jl-confirm.d.ts +3 -0
- package/dist/organisms/jl-confirm.js +13 -12
- package/dist/organisms/jl-dialog.css.js +3 -0
- package/dist/organisms/jl-dialog.d.ts +1 -0
- package/dist/organisms/jl-dialog.js +5 -3
- package/dist/organisms/jl-drawer.css.js +3 -0
- package/dist/organisms/jl-drawer.d.ts +1 -0
- package/dist/organisms/jl-drawer.js +5 -3
- package/dist/organisms/jl-flow.css.js +3 -0
- package/dist/organisms/jl-flow.d.ts +2 -0
- package/dist/organisms/jl-flow.js +26 -17
- package/dist/organisms/jl-navbar.css.js +3 -0
- package/dist/organisms/jl-navbar.d.ts +3 -0
- package/dist/organisms/jl-navbar.js +17 -8
- package/dist/organisms/jl-page-header.css.js +3 -0
- package/dist/organisms/jl-page-header.js +1 -1
- package/dist/organisms/jl-page-outlet.css.js +3 -0
- package/dist/organisms/jl-page-outlet.d.ts +34 -0
- package/dist/organisms/jl-page-outlet.js +107 -0
- package/dist/organisms/jl-side-nav.css.js +3 -0
- package/dist/organisms/jl-side-nav.d.ts +4 -2
- package/dist/organisms/jl-side-nav.js +18 -12
- package/dist/organisms/jl-tab-bar.css.js +3 -0
- package/dist/organisms/jl-tab-bar.d.ts +1 -0
- package/dist/organisms/jl-tab-bar.js +6 -3
- package/dist/organisms/jl-table.css.js +3 -0
- package/dist/organisms/jl-table.d.ts +2 -1
- package/dist/organisms/jl-table.js +10 -7
- package/dist/organisms/jl-toaster.css.js +3 -0
- package/dist/organisms/jl-toaster.d.ts +2 -1
- package/dist/organisms/jl-toaster.js +13 -10
- package/dist/organisms/jl-tree.css.js +3 -0
- package/dist/organisms/jl-tree.d.ts +6 -4
- package/dist/organisms/jl-tree.js +22 -16
- package/dist/styles/base.css.js +3 -0
- package/dist/styles/control.css.js +3 -0
- package/dist/styles/floating.css.js +3 -0
- package/dist/styles/shared.js +4 -4
- package/dist/styles/tokens.css.js +3 -0
- package/dist/templates/jl-app-shell.css.js +3 -0
- package/dist/templates/jl-app-shell.d.ts +1 -0
- package/dist/templates/jl-app-shell.js +5 -3
- package/dist/templates/jl-auth-layout.css.js +3 -0
- package/dist/templates/jl-auth-layout.d.ts +4 -3
- package/dist/templates/jl-auth-layout.js +14 -12
- package/dist/templates/jl-page.css.js +3 -0
- package/dist/templates/jl-page.d.ts +1 -0
- package/dist/templates/jl-page.js +5 -2
- package/dist/templates/jl-split-view.css.js +3 -0
- package/dist/templates/jl-split-view.d.ts +1 -0
- package/dist/templates/jl-split-view.js +6 -5
- package/dist/templates/jl-stack.css.js +3 -0
- package/dist/templates/jl-stack.d.ts +17 -0
- package/dist/templates/jl-stack.js +36 -0
- package/dist/types/jl-stack.types.d.ts +2 -0
- package/dist/types/texts.types.d.ts +29 -4
- package/package.json +5 -4
- package/dist/atoms/jl-app-icon.css_raw.js +0 -3
- package/dist/atoms/jl-avatar.css_raw.js +0 -3
- package/dist/atoms/jl-badge.css_raw.js +0 -3
- package/dist/atoms/jl-button.css_raw.js +0 -3
- package/dist/atoms/jl-checkbox.css_raw.js +0 -3
- package/dist/atoms/jl-chip.css_raw.js +0 -3
- package/dist/atoms/jl-divider.css_raw.js +0 -3
- package/dist/atoms/jl-icon.css_raw.js +0 -3
- package/dist/atoms/jl-input.css_raw.js +0 -3
- package/dist/atoms/jl-kbd.css_raw.js +0 -3
- package/dist/atoms/jl-link.css_raw.js +0 -3
- package/dist/atoms/jl-progress-ring.css_raw.js +0 -3
- package/dist/atoms/jl-progress.css_raw.js +0 -3
- package/dist/atoms/jl-rating.css_raw.js +0 -3
- package/dist/atoms/jl-select.css_raw.js +0 -3
- package/dist/atoms/jl-skeleton.css_raw.js +0 -3
- package/dist/atoms/jl-slider.css_raw.js +0 -3
- package/dist/atoms/jl-spinner.css_raw.js +0 -3
- package/dist/atoms/jl-switch.css_raw.js +0 -3
- package/dist/atoms/jl-textarea.css_raw.js +0 -3
- package/dist/molecules/jl-accordion-item.css_raw.js +0 -3
- package/dist/molecules/jl-accordion.css_raw.js +0 -3
- package/dist/molecules/jl-account-button.css_raw.js +0 -3
- package/dist/molecules/jl-alert.css_raw.js +0 -3
- package/dist/molecules/jl-avatar-group.css_raw.js +0 -3
- package/dist/molecules/jl-breadcrumb.css_raw.js +0 -3
- package/dist/molecules/jl-calendar.css_raw.js +0 -3
- package/dist/molecules/jl-card.css_raw.js +0 -3
- package/dist/molecules/jl-chip-group.css_raw.js +0 -3
- package/dist/molecules/jl-code-block.css_raw.js +0 -3
- package/dist/molecules/jl-combobox.css_raw.js +0 -3
- package/dist/molecules/jl-copy-button.css_raw.js +0 -3
- package/dist/molecules/jl-date-picker.css_raw.js +0 -3
- package/dist/molecules/jl-empty.css_raw.js +0 -3
- package/dist/molecules/jl-facts.css_raw.js +0 -3
- package/dist/molecules/jl-field.css_raw.js +0 -3
- package/dist/molecules/jl-file-drop.css_raw.js +0 -3
- package/dist/molecules/jl-input-list.css_raw.js +0 -3
- package/dist/molecules/jl-list-item.css_raw.js +0 -3
- package/dist/molecules/jl-load-more.css_raw.js +0 -3
- package/dist/molecules/jl-load-state.css_raw.js +0 -3
- package/dist/molecules/jl-menu.css_raw.js +0 -3
- package/dist/molecules/jl-number-input.css_raw.js +0 -3
- package/dist/molecules/jl-pagination.css_raw.js +0 -3
- package/dist/molecules/jl-popover.css_raw.js +0 -3
- package/dist/molecules/jl-radio-group.css_raw.js +0 -3
- package/dist/molecules/jl-search-button.css_raw.js +0 -3
- package/dist/molecules/jl-search.css_raw.js +0 -3
- package/dist/molecules/jl-segmented.css_raw.js +0 -3
- package/dist/molecules/jl-stat.css_raw.js +0 -3
- package/dist/molecules/jl-steps.css_raw.js +0 -3
- package/dist/molecules/jl-tab-panel.css_raw.js +0 -3
- package/dist/molecules/jl-tabs.css_raw.js +0 -3
- package/dist/molecules/jl-tag-input.css_raw.js +0 -3
- package/dist/molecules/jl-timeline.css_raw.js +0 -3
- package/dist/molecules/jl-toast.css_raw.js +0 -3
- package/dist/molecules/jl-tooltip.css_raw.js +0 -3
- package/dist/organisms/jl-command-palette.css_raw.js +0 -3
- package/dist/organisms/jl-confirm.css_raw.js +0 -3
- package/dist/organisms/jl-dialog.css_raw.js +0 -3
- package/dist/organisms/jl-drawer.css_raw.js +0 -3
- package/dist/organisms/jl-flow.css_raw.js +0 -3
- package/dist/organisms/jl-navbar.css_raw.js +0 -3
- package/dist/organisms/jl-page-header.css_raw.js +0 -3
- package/dist/organisms/jl-side-nav.css_raw.js +0 -3
- package/dist/organisms/jl-tab-bar.css_raw.js +0 -3
- package/dist/organisms/jl-table.css_raw.js +0 -3
- package/dist/organisms/jl-toaster.css_raw.js +0 -3
- package/dist/organisms/jl-tree.css_raw.js +0 -3
- package/dist/styles/base.css_raw.js +0 -3
- package/dist/styles/control.css_raw.js +0 -3
- package/dist/styles/floating.css_raw.js +0 -3
- package/dist/styles/tokens.css_raw.js +0 -3
- package/dist/templates/jl-app-shell.css_raw.js +0 -3
- package/dist/templates/jl-auth-layout.css_raw.js +0 -3
- package/dist/templates/jl-page.css_raw.js +0 -3
- package/dist/templates/jl-split-view.css_raw.js +0 -3
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// src/molecules/jl-file-drop.css?inline
|
|
2
|
+
var jl_file_drop_default = ":host{--pad:24px;--badge:44px;min-width:0;display:block}:host([size=sm]){--pad:14px;--badge:34px}:host([size=lg]){--pad:36px;--badge:52px}.zone{padding:var(--pad);border:1.5px dashed var(--jl-line-strong);border-radius:var(--jl-radius);background:var(--jl-surface);color:var(--jl-text);text-align:center;cursor:pointer;transition:border-color var(--jl-fast) var(--jl-ease), background var(--jl-fast) var(--jl-ease);flex-direction:column;align-items:center;gap:4px;display:flex}.zone:hover{border-color:color-mix(in srgb, var(--jl-line-strong) 60%, var(--jl-text) 18%);background:var(--jl-surface-2)}:host([dragging]) .zone{border-color:var(--jl-accent);background:var(--jl-accent-soft)}:host([invalid]) .zone{border-color:var(--jl-danger)}:host([disabled]) .zone{border-color:var(--jl-line-strong);background:var(--jl-surface-2);color:var(--jl-muted);cursor:not-allowed}.zone-icon{width:var(--badge);height:var(--badge);border-radius:var(--jl-radius-pill);background:var(--jl-surface-3);color:var(--jl-muted);transition:background var(--jl-fast) var(--jl-ease), color var(--jl-fast) var(--jl-ease);justify-content:center;align-items:center;margin-bottom:6px}:host([dragging]) .zone-icon{background:var(--jl-surface);color:var(--jl-accent)}.text{font-size:var(--jl-font-md);font-weight:600;line-height:1.4}:host([size=sm]) .text{font-size:var(--jl-font-sm)}.hint{color:var(--jl-muted);font-size:var(--jl-font-xs);line-height:1.4}.browse{height:var(--jl-control-sm);border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-sm);background:var(--jl-surface);font-size:var(--jl-font-xs);cursor:pointer;transition:background var(--jl-fast) var(--jl-ease);align-items:center;margin-top:8px;padding:0 12px;font-weight:600;display:inline-flex}.browse:hover{background:var(--jl-surface-3)}.browse:disabled{cursor:not-allowed;opacity:.5}.refused,.files{margin:8px 0 0;padding:0;list-style:none}.refused{color:var(--jl-danger);font-size:var(--jl-font-sm);gap:4px;line-height:1.45;display:grid}.refusal{align-items:flex-start;gap:6px;display:flex}.refusal jl-icon{margin-top:3px}.refused-name{overflow-wrap:anywhere;font-weight:600}.files{border:1px solid var(--jl-line);border-radius:var(--jl-radius)}.file{align-items:center;gap:10px;min-height:40px;padding:6px 8px 6px 12px;display:flex}.file+.file{border-top:1px solid var(--jl-line)}.file-icon{color:var(--jl-faint)}.file-name{min-width:0;font-size:var(--jl-font-sm);text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}.file-size{color:var(--jl-muted);font-family:var(--jl-font-mono);font-size:var(--jl-font-xs);white-space:nowrap}.file-remove{border-radius:var(--jl-radius-xs);width:26px;height:26px;color:var(--jl-faint);cursor:pointer;background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.file-remove:hover{background:var(--jl-surface-3);color:var(--jl-text)}.hint:first-letter{text-transform:uppercase}";
|
|
3
|
+
export { jl_file_drop_default as default };
|
|
@@ -88,6 +88,7 @@ export declare class JlFileDrop extends JlFormControl {
|
|
|
88
88
|
private setFiles;
|
|
89
89
|
private renderFiles;
|
|
90
90
|
private renderRefused;
|
|
91
|
+
protected drawTexts(): void;
|
|
91
92
|
private renderText;
|
|
92
93
|
/** What it takes, under the text: `PNG, JPG · up to 5 MB`. */
|
|
93
94
|
private renderHint;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { pageLocale } from "../lib/locale.js";
|
|
2
|
+
import { jlText } from "../lib/texts.js";
|
|
1
3
|
import { BASE_STYLES } from "../styles/shared.js";
|
|
2
4
|
import { JlFormControl } from "../base/jl-form-control.js";
|
|
3
5
|
import { clampedNumber, oneOf } from "../lib/attributes.js";
|
|
4
6
|
import { registerIcons } from "../lib/icons.js";
|
|
5
7
|
import { CONTROL_SIZES } from "../lib/options.js";
|
|
6
|
-
import { jlText } from "../lib/texts.js";
|
|
7
8
|
import { JlIcon } from "../atoms/jl-icon.js";
|
|
8
9
|
import { setOrRemove, uniqueId } from "../lib/dom.js";
|
|
9
|
-
import { pageLocale } from "../lib/locale.js";
|
|
10
10
|
import { checkFiles, describeAccept, formatFileSize, isSameFile } from "../lib/files.js";
|
|
11
|
-
import jl_file_drop_default from "./jl-file-drop.
|
|
11
|
+
import jl_file_drop_default from "./jl-file-drop.css.js";
|
|
12
12
|
import { css } from "@jadis/core";
|
|
13
13
|
import { CircleAlert, File, Image, Upload, X } from "lucide";
|
|
14
14
|
import { Fragment, jsx, jsxs } from "@jadis/core/jsx-runtime";
|
|
@@ -84,7 +84,8 @@ var JlFileDrop = class extends JlFormControl {
|
|
|
84
84
|
};
|
|
85
85
|
_state = {
|
|
86
86
|
depth: 0,
|
|
87
|
-
files: []
|
|
87
|
+
files: [],
|
|
88
|
+
refused: []
|
|
88
89
|
};
|
|
89
90
|
_nameWatch = new MutationObserver(() => this.renderFormValue());
|
|
90
91
|
_refs = this.useRefs((ref) => ({
|
|
@@ -150,8 +151,7 @@ var JlFileDrop = class extends JlFormControl {
|
|
|
150
151
|
/* @__PURE__ */ jsx("button", {
|
|
151
152
|
class: "browse",
|
|
152
153
|
type: "button",
|
|
153
|
-
"aria-describedby": this._ids.hint
|
|
154
|
-
children: jlText("browse")
|
|
154
|
+
"aria-describedby": this._ids.hint
|
|
155
155
|
})
|
|
156
156
|
]
|
|
157
157
|
}),
|
|
@@ -168,7 +168,6 @@ var JlFileDrop = class extends JlFormControl {
|
|
|
168
168
|
}),
|
|
169
169
|
/* @__PURE__ */ jsx("ul", {
|
|
170
170
|
class: "files",
|
|
171
|
-
"aria-label": jlText("chosenFiles"),
|
|
172
171
|
hidden: true
|
|
173
172
|
})
|
|
174
173
|
] });
|
|
@@ -311,6 +310,7 @@ var JlFileDrop = class extends JlFormControl {
|
|
|
311
310
|
})));
|
|
312
311
|
}
|
|
313
312
|
renderRefused(refused) {
|
|
313
|
+
this._state.refused = refused;
|
|
314
314
|
const rules = this.rules();
|
|
315
315
|
this._refs.refused.hidden = refused.length === 0;
|
|
316
316
|
this._refs.refused.replaceChildren(...refused.map(({ file, reason }) => /* @__PURE__ */ jsxs("li", {
|
|
@@ -328,6 +328,15 @@ var JlFileDrop = class extends JlFormControl {
|
|
|
328
328
|
] })]
|
|
329
329
|
})));
|
|
330
330
|
}
|
|
331
|
+
drawTexts() {
|
|
332
|
+
this._refs.browse.textContent = jlText("browse");
|
|
333
|
+
this._refs.files.setAttribute("aria-label", jlText("chosenFiles"));
|
|
334
|
+
this.renderText();
|
|
335
|
+
this.renderHint();
|
|
336
|
+
this.renderFiles();
|
|
337
|
+
this.renderRefused(this._state.refused);
|
|
338
|
+
this.renderValidity();
|
|
339
|
+
}
|
|
331
340
|
renderText() {
|
|
332
341
|
const text = this.text.get();
|
|
333
342
|
const fallback = jlText(this.multiple.get() ? "dropFiles" : "dropFile");
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// src/molecules/jl-input-list.css?inline
|
|
2
|
+
var jl_input_list_default = ":host{display:block}.list,.rows{gap:var(--jl-space-2);display:grid}.row{align-items:start;gap:var(--jl-space-1);display:flex}.row>:first-child{flex:1;min-width:0}[hidden]{display:none}";
|
|
3
|
+
export { jl_input_list_default as default };
|
|
@@ -49,12 +49,12 @@ export declare class JlInputList extends JlElement {
|
|
|
49
49
|
get(): boolean;
|
|
50
50
|
set(setter: boolean | ((prevState: boolean) => boolean)): void;
|
|
51
51
|
}>>;
|
|
52
|
-
/** The add button's text. */
|
|
52
|
+
/** The add button's text; jlib's own when empty. */
|
|
53
53
|
readonly addLabel: Readonly<Readonly<{
|
|
54
54
|
get(): string;
|
|
55
55
|
set(setter: string | ((prevState: string) => string)): void;
|
|
56
56
|
}>>;
|
|
57
|
-
/** The text a screen reader says for each row's remove button. */
|
|
57
|
+
/** The text a screen reader says for each row's remove button; jlib's own when empty. */
|
|
58
58
|
readonly removeLabel: Readonly<Readonly<{
|
|
59
59
|
get(): string;
|
|
60
60
|
set(setter: string | ((prevState: string) => string)): void;
|
|
@@ -66,6 +66,7 @@ export declare class JlInputList extends JlElement {
|
|
|
66
66
|
onConnect(): void;
|
|
67
67
|
/** Values set from outside start the rows again; those the rows themselves gave change nothing. */
|
|
68
68
|
private follow;
|
|
69
|
+
protected drawTexts(): void;
|
|
69
70
|
private renderRows;
|
|
70
71
|
private renderAdd;
|
|
71
72
|
private renderDisabled;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { jlText } from "../lib/texts.js";
|
|
1
2
|
import { BASE_STYLES } from "../styles/shared.js";
|
|
2
3
|
import { JlElement } from "../base/jl-element.js";
|
|
3
4
|
import { clampedNumber, jsonOf, oneOf } from "../lib/attributes.js";
|
|
4
5
|
import { registerIcons } from "../lib/icons.js";
|
|
5
|
-
import { jlText } from "../lib/texts.js";
|
|
6
6
|
import { JlButton } from "../atoms/jl-button.js";
|
|
7
7
|
import { INPUT_TYPES, JlInput } from "../atoms/jl-input.js";
|
|
8
8
|
import { JlSelect } from "../atoms/jl-select.js";
|
|
9
9
|
import { JlTextarea } from "../atoms/jl-textarea.js";
|
|
10
10
|
import { canAddRow, filledValues, rowsOf, sameValues, withRowAt, withoutRowAt } from "../lib/input-list.js";
|
|
11
|
-
import jl_input_list_default from "./jl-input-list.
|
|
11
|
+
import jl_input_list_default from "./jl-input-list.css.js";
|
|
12
12
|
import { css } from "@jadis/core";
|
|
13
13
|
import { Plus, X } from "lucide";
|
|
14
14
|
import { jsx, jsxs } from "@jadis/core/jsx-runtime";
|
|
@@ -53,10 +53,10 @@ var JlInputList = class extends JlElement {
|
|
|
53
53
|
/** The name of each row for screen readers: the field's label. */
|
|
54
54
|
label = this.useChange("", () => this.renderRows(), { attribute: "label" });
|
|
55
55
|
disabled = this.useChange(false, (value) => this.renderDisabled(value), { attribute: "disabled" });
|
|
56
|
-
/** The add button's text. */
|
|
57
|
-
addLabel = this.useChange(
|
|
58
|
-
/** The text a screen reader says for each row's remove button. */
|
|
59
|
-
removeLabel = this.useChange(
|
|
56
|
+
/** The add button's text; jlib's own when empty. */
|
|
57
|
+
addLabel = this.useChange("", () => this.renderAdd(), { attribute: "add-label" });
|
|
58
|
+
/** The text a screen reader says for each row's remove button; jlib's own when empty. */
|
|
59
|
+
removeLabel = this.useChange("", () => this.renderRows(), { attribute: "remove-label" });
|
|
60
60
|
_state = { rows: [""] };
|
|
61
61
|
_refs = this.useRefs((ref) => ({
|
|
62
62
|
add: ref(".add"),
|
|
@@ -86,13 +86,16 @@ var JlInputList = class extends JlElement {
|
|
|
86
86
|
this._state.rows = rowsOf(values);
|
|
87
87
|
this.renderRows();
|
|
88
88
|
}
|
|
89
|
+
drawTexts() {
|
|
90
|
+
this.renderRows();
|
|
91
|
+
}
|
|
89
92
|
renderRows() {
|
|
90
93
|
this._refs.rows.replaceChildren(...this._state.rows.map((value, index) => this.row(value, index)));
|
|
91
94
|
this.renderAdd();
|
|
92
95
|
}
|
|
93
96
|
renderAdd() {
|
|
94
97
|
const add = this._refs.add;
|
|
95
|
-
add.label.set(this.addLabel.get());
|
|
98
|
+
add.label.set(this.addLabel.get() || jlText("addValue"));
|
|
96
99
|
add.hidden = this.disabled.get() || !canAddRow(this._state.rows.length, this.max.get());
|
|
97
100
|
}
|
|
98
101
|
renderDisabled(disabled) {
|
|
@@ -106,7 +109,7 @@ var JlInputList = class extends JlElement {
|
|
|
106
109
|
variant: "ghost",
|
|
107
110
|
size: "sm",
|
|
108
111
|
icon: "x",
|
|
109
|
-
hint: this.removeLabel.get()
|
|
112
|
+
hint: this.removeLabel.get() || jlText("removeValue")
|
|
110
113
|
});
|
|
111
114
|
remove.events.register("press", () => this.removeRow(index));
|
|
112
115
|
remove.hidden = this.disabled.get() || this._state.rows.length === 1;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// src/molecules/jl-list-item.css?inline
|
|
2
|
+
var jl_list_item_default = ":host{--pad-x:16px;--pad-y:12px;display:block}.item{min-height:52px;padding:var(--pad-y) var(--pad-x);background:var(--jl-surface);color:var(--jl-text);transition:background var(--jl-fast) var(--jl-ease);align-items:center;gap:12px;display:flex;position:relative}:host(:not(:last-child)) .item{border-bottom:1px solid var(--jl-line)}:host([clickable]) .item{cursor:pointer}:host([clickable]) .item:hover{background:var(--jl-surface-2)}:host([selected]) .item,:host([selected][clickable]) .item:hover{background:var(--jl-accent-soft)}.link{z-index:1;position:absolute;inset:0}.link:focus-visible,.item:focus-visible{box-shadow:inset 0 0 0 2px color-mix(in srgb, var(--jl-brand) 55%, transparent)}.end{z-index:2;flex:none;align-items:center;gap:8px;display:flex;position:relative}.start{flex:none;align-items:center;display:inline-flex}.icon-box{border-radius:var(--jl-radius-sm);background:var(--jl-surface-3);width:32px;height:32px;color:var(--jl-text-2);justify-content:center;align-items:center;display:inline-flex}:host([selected]) .icon-box{background:color-mix(in srgb, var(--jl-accent) 14%, transparent);color:var(--jl-accent)}.text{flex:1;gap:1px;min-width:0;display:grid}.heading{font-size:var(--jl-font-md);text-overflow:ellipsis;white-space:nowrap;font-weight:600;line-height:1.4;overflow:hidden}:host([selected]) .heading{color:var(--jl-accent)}.description{color:var(--jl-muted);font-size:var(--jl-font-sm);line-height:1.45}.meta{color:var(--jl-muted);font-size:var(--jl-font-xs);font-variant-numeric:tabular-nums;white-space:nowrap;flex:none}.chevron{color:var(--jl-faint);margin-right:-4px}";
|
|
3
|
+
export { jl_list_item_default as default };
|
|
@@ -5,7 +5,7 @@ import { JlIcon } from "../atoms/jl-icon.js";
|
|
|
5
5
|
import { setOrRemove } from "../lib/dom.js";
|
|
6
6
|
import { hasSlotted } from "../lib/slots.js";
|
|
7
7
|
import { isActivationKey, startedOnControl } from "../lib/surface.js";
|
|
8
|
-
import jl_list_item_default from "./jl-list-item.
|
|
8
|
+
import jl_list_item_default from "./jl-list-item.css.js";
|
|
9
9
|
import { css } from "@jadis/core";
|
|
10
10
|
import { ChevronRight } from "lucide";
|
|
11
11
|
import { jsx, jsxs } from "@jadis/core/jsx-runtime";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// src/molecules/jl-load-more.css?inline
|
|
2
|
+
var jl_load_more_default = ":host{display:block}:host([complete]){display:none}.more{color:var(--jl-muted);font-size:var(--jl-font-sm);flex-wrap:wrap;justify-content:center;align-items:center;gap:12px;padding:12px 0;display:flex}";
|
|
3
|
+
export { jl_load_more_default as default };
|
|
@@ -23,12 +23,12 @@ export declare class JlLoadMore extends JlElement {
|
|
|
23
23
|
get(): boolean;
|
|
24
24
|
set(setter: boolean | ((prevState: boolean) => boolean)): void;
|
|
25
25
|
}>>;
|
|
26
|
-
/** The button's text. */
|
|
26
|
+
/** The button's text; jlib's own when empty. */
|
|
27
27
|
readonly label: Readonly<Readonly<{
|
|
28
28
|
get(): string;
|
|
29
29
|
set(setter: string | ((prevState: string) => string)): void;
|
|
30
30
|
}>>;
|
|
31
|
-
/** What shows beside it
|
|
31
|
+
/** What shows beside it, `{shown}` and `{total}` filled; jlib's own when empty. */
|
|
32
32
|
readonly countText: Readonly<Readonly<{
|
|
33
33
|
get(): string;
|
|
34
34
|
set(setter: string | ((prevState: string) => string)): void;
|
|
@@ -37,5 +37,7 @@ export declare class JlLoadMore extends JlElement {
|
|
|
37
37
|
templateHtml(): Node;
|
|
38
38
|
templateCss(): string;
|
|
39
39
|
onConnect(): void;
|
|
40
|
+
protected drawTexts(): void;
|
|
41
|
+
private renderLabel;
|
|
40
42
|
private render;
|
|
41
43
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { pageLocale } from "../lib/locale.js";
|
|
2
|
+
import { fillText } from "../lib/text.js";
|
|
3
|
+
import { jlTemplate, jlText } from "../lib/texts.js";
|
|
1
4
|
import { BASE_STYLES } from "../styles/shared.js";
|
|
2
5
|
import { JlElement } from "../base/jl-element.js";
|
|
3
|
-
import { fillText } from "../lib/text.js";
|
|
4
|
-
import { jlText } from "../lib/texts.js";
|
|
5
6
|
import { JlButton } from "../atoms/jl-button.js";
|
|
6
|
-
import
|
|
7
|
-
import jl_load_more_default from "./jl-load-more.css_raw.js";
|
|
7
|
+
import jl_load_more_default from "./jl-load-more.css.js";
|
|
8
8
|
import { css } from "@jadis/core";
|
|
9
9
|
import { jsx, jsxs } from "@jadis/core/jsx-runtime";
|
|
10
10
|
// src/molecules/jl-load-more.tsx
|
|
@@ -21,10 +21,10 @@ var JlLoadMore = class extends JlElement {
|
|
|
21
21
|
total = this.useChange(0, () => this.render(), { attribute: "total" });
|
|
22
22
|
/** The next page is on its way: the button shows a spinner and ignores presses. */
|
|
23
23
|
loading = this.useChange(false, (value) => this._refs.button.loading.set(value), { attribute: "loading" });
|
|
24
|
-
/** The button's text. */
|
|
25
|
-
label = this.useChange(
|
|
26
|
-
/** What shows beside it
|
|
27
|
-
countText = this.useChange(
|
|
24
|
+
/** The button's text; jlib's own when empty. */
|
|
25
|
+
label = this.useChange("", () => this.renderLabel(), { attribute: "label" });
|
|
26
|
+
/** What shows beside it, `{shown}` and `{total}` filled; jlib's own when empty. */
|
|
27
|
+
countText = this.useChange("", () => this.render(), { attribute: "count-text" });
|
|
28
28
|
_refs = this.useRefs((ref) => ({
|
|
29
29
|
button: ref(JlButton),
|
|
30
30
|
count: ref(".count")
|
|
@@ -47,11 +47,18 @@ var JlLoadMore = class extends JlElement {
|
|
|
47
47
|
if (!this.loading.get()) this.events.emit("more");
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
+
drawTexts() {
|
|
51
|
+
this.renderLabel();
|
|
52
|
+
this.render();
|
|
53
|
+
}
|
|
54
|
+
renderLabel() {
|
|
55
|
+
this._refs.button.label.set(this.label.get() || jlText("showMore"));
|
|
56
|
+
}
|
|
50
57
|
render() {
|
|
51
58
|
const locale = pageLocale();
|
|
52
59
|
const shown = this.shown.get();
|
|
53
60
|
const total = this.total.get();
|
|
54
|
-
this._refs.count.textContent = fillText(this.countText.get(), {
|
|
61
|
+
this._refs.count.textContent = fillText(this.countText.get() || jlTemplate("shownOfTotal"), {
|
|
55
62
|
shown: shown.toLocaleString(locale),
|
|
56
63
|
total: total.toLocaleString(locale)
|
|
57
64
|
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// src/molecules/jl-load-state.css?inline
|
|
2
|
+
var jl_load_state_default = ":host{display:block}.bones{gap:16px;padding:16px;display:grid}.bones.lines{gap:10px}.bones.cards{grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px;padding:0}.bone-row{align-items:center;gap:12px;display:flex}.bone-lines{flex:1;gap:6px;display:grid}.bone-card{border:1px solid var(--jl-line);border-radius:var(--jl-radius-lg);gap:8px;padding:12px;display:grid}";
|
|
3
|
+
export { jl_load_state_default as default };
|
|
@@ -10,8 +10,15 @@ export declare const LOAD_SKELETONS: readonly LoadSkeleton[];
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class JlLoadState extends JlElement {
|
|
12
12
|
static readonly selector = "jl-load-state";
|
|
13
|
+
/**
|
|
14
|
+
* Resolves once every load state under `root` that can be seen, in shadow roots too, has left `loading`: those drawn
|
|
15
|
+
* meanwhile included, as a page's data draws more of the page. Or once `signal` aborts. A page that shows only once
|
|
16
|
+
* it has its data waits for it (see `jl-page-outlet`).
|
|
17
|
+
*/
|
|
18
|
+
static whenSettled(root: ParentNode, signal?: AbortSignal): Promise<void>;
|
|
13
19
|
readonly events: Readonly<import("@jadis/core").UseEventsHandler<{
|
|
14
20
|
retry: undefined;
|
|
21
|
+
state: LoadState;
|
|
15
22
|
}>>;
|
|
16
23
|
readonly state: Readonly<Readonly<{
|
|
17
24
|
get(): LoadState;
|
|
@@ -32,14 +39,17 @@ export declare class JlLoadState extends JlElement {
|
|
|
32
39
|
get(): number;
|
|
33
40
|
set(setter: number | ((prevState: number) => number)): void;
|
|
34
41
|
}>>;
|
|
42
|
+
/** The heading of a failed load; jlib's own when empty. */
|
|
35
43
|
readonly errorHeading: Readonly<Readonly<{
|
|
36
44
|
get(): string;
|
|
37
45
|
set(setter: string | ((prevState: string) => string)): void;
|
|
38
46
|
}>>;
|
|
47
|
+
/** What a failed load says under its heading; jlib's own when empty. */
|
|
39
48
|
readonly errorText: Readonly<Readonly<{
|
|
40
49
|
get(): string;
|
|
41
50
|
set(setter: string | ((prevState: string) => string)): void;
|
|
42
51
|
}>>;
|
|
52
|
+
/** The button that runs the load again; jlib's own text when empty. */
|
|
43
53
|
readonly retryLabel: Readonly<Readonly<{
|
|
44
54
|
get(): string;
|
|
45
55
|
set(setter: string | ((prevState: string) => string)): void;
|
|
@@ -53,10 +63,13 @@ export declare class JlLoadState extends JlElement {
|
|
|
53
63
|
* (a search typed on, a poll during a reload) draws nothing and resolves true: the later one decides.
|
|
54
64
|
*/
|
|
55
65
|
load<Value>(task: LoadTask<Value>): Promise<boolean>;
|
|
66
|
+
/** Tells the page the state changed: `state`, with the new one. */
|
|
67
|
+
private announceState;
|
|
56
68
|
/** Whether data is shown (the content or the empty state), which a refresh keeps. */
|
|
57
69
|
private isShowing;
|
|
58
70
|
templateHtml(): Node;
|
|
59
71
|
templateCss(): string;
|
|
72
|
+
protected drawTexts(): void;
|
|
60
73
|
onConnect(): void;
|
|
61
74
|
onDisconnect(): void;
|
|
62
75
|
private renderState;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { jlText } from "../lib/texts.js";
|
|
1
2
|
import { BASE_STYLES } from "../styles/shared.js";
|
|
2
3
|
import { JlElement } from "../base/jl-element.js";
|
|
3
4
|
import { clampedNumber, oneOf } from "../lib/attributes.js";
|
|
4
5
|
import { define } from "../lib/define.js";
|
|
5
6
|
import { registerIcons } from "../lib/icons.js";
|
|
6
|
-
import { jlText } from "../lib/texts.js";
|
|
7
7
|
import { JlButton } from "../atoms/jl-button.js";
|
|
8
8
|
import { JlSkeleton } from "../atoms/jl-skeleton.js";
|
|
9
9
|
import { JlEmpty } from "./jl-empty.js";
|
|
10
|
-
import jl_load_state_default from "./jl-load-state.
|
|
10
|
+
import jl_load_state_default from "./jl-load-state.css.js";
|
|
11
11
|
import { css } from "@jadis/core";
|
|
12
12
|
import { CircleAlert, RefreshCw } from "lucide";
|
|
13
13
|
import { jsx, jsxs } from "@jadis/core/jsx-runtime";
|
|
@@ -28,7 +28,6 @@ var LOAD_SKELETONS = [
|
|
|
28
28
|
"cards",
|
|
29
29
|
"lines"
|
|
30
30
|
];
|
|
31
|
-
var DEFAULT_ERROR_HEADING = "This could not be loaded";
|
|
32
31
|
var DEFAULT_DELAY_MS = 300;
|
|
33
32
|
var MAX_DELAY_MS = 5e3;
|
|
34
33
|
var DEFAULT_COUNT = 3;
|
|
@@ -39,6 +38,7 @@ var LINE_WIDTHS = [
|
|
|
39
38
|
"96%",
|
|
40
39
|
"70%"
|
|
41
40
|
];
|
|
41
|
+
var STATE_EVENT = "state";
|
|
42
42
|
/** The skeleton of each shape, `count` times. */
|
|
43
43
|
var SKELETONS = {
|
|
44
44
|
cards: (count) => Array.from({ length: count }, () => /* @__PURE__ */ jsxs("div", {
|
|
@@ -65,16 +65,57 @@ var SKELETONS = {
|
|
|
65
65
|
})]
|
|
66
66
|
}))
|
|
67
67
|
};
|
|
68
|
+
/** The load states under a node and in the shadow roots there, its own included: a page draws them in its own. */
|
|
69
|
+
function loadStatesIn(root) {
|
|
70
|
+
const nodes = [root, ...root.querySelectorAll("*")];
|
|
71
|
+
const own = nodes.filter((node) => node instanceof JlLoadState);
|
|
72
|
+
const shadows = nodes.flatMap((node) => node instanceof Element && node.shadowRoot ? [node.shadowRoot] : []);
|
|
73
|
+
return [...own, ...shadows.flatMap(loadStatesIn)];
|
|
74
|
+
}
|
|
75
|
+
/** Whether a load state still waits for its data where it can be seen: one in a hidden tab may never load. */
|
|
76
|
+
var isWaiting = (state) => state.state.get() === "loading" && state.checkVisibility();
|
|
77
|
+
/** Resolves once a load state leaves `loading`, or once the signal aborts. */
|
|
78
|
+
function leftLoading(state, signal) {
|
|
79
|
+
return new Promise((resolve) => {
|
|
80
|
+
const listening = new AbortController();
|
|
81
|
+
const stop = () => {
|
|
82
|
+
listening.abort();
|
|
83
|
+
resolve();
|
|
84
|
+
};
|
|
85
|
+
signal.addEventListener("abort", stop, { signal: listening.signal });
|
|
86
|
+
state.addEventListener(STATE_EVENT, () => {
|
|
87
|
+
if (isWaiting(state)) return;
|
|
88
|
+
stop();
|
|
89
|
+
}, { signal: listening.signal });
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/** Waits for the components connected meanwhile to run their `onConnect`, a task after connecting. */
|
|
93
|
+
var nextTask = () => new Promise((resolve) => setTimeout(resolve));
|
|
68
94
|
/**
|
|
69
95
|
* What a list or a page shows while its data comes: nothing for a moment, then a skeleton shaped like it; then the
|
|
70
96
|
* data (the default slot), what to say when there is none (slot `empty`, a `jl-empty`), or, when it failed, what
|
|
71
97
|
* failed and Try again. `load()` fetches, draws and moves between the states; a later `load()` keeps what is shown
|
|
72
98
|
* until the new data is there, so live updates do not flash. Or set `state` yourself.
|
|
73
99
|
*/
|
|
74
|
-
var JlLoadState = class extends JlElement {
|
|
100
|
+
var JlLoadState = class JlLoadState extends JlElement {
|
|
75
101
|
static selector = "jl-load-state";
|
|
102
|
+
/**
|
|
103
|
+
* Resolves once every load state under `root` that can be seen, in shadow roots too, has left `loading`: those drawn
|
|
104
|
+
* meanwhile included, as a page's data draws more of the page. Or once `signal` aborts. A page that shows only once
|
|
105
|
+
* it has its data waits for it (see `jl-page-outlet`).
|
|
106
|
+
*/
|
|
107
|
+
static async whenSettled(root, signal = new AbortController().signal) {
|
|
108
|
+
await nextTask();
|
|
109
|
+
const waiting = loadStatesIn(root).filter(isWaiting);
|
|
110
|
+
if (waiting.length === 0 || signal.aborted) return;
|
|
111
|
+
await Promise.all(waiting.map((state) => leftLoading(state, signal)));
|
|
112
|
+
return JlLoadState.whenSettled(root, signal);
|
|
113
|
+
}
|
|
76
114
|
events = this.useEvents();
|
|
77
|
-
state = this.useChange("loading", (value) =>
|
|
115
|
+
state = this.useChange("loading", (value, previous) => {
|
|
116
|
+
this.renderState(value);
|
|
117
|
+
this.announceState(value, previous);
|
|
118
|
+
}, {
|
|
78
119
|
attribute: "state",
|
|
79
120
|
parse: oneOf(LOAD_STATES, "loading")
|
|
80
121
|
});
|
|
@@ -93,9 +134,12 @@ var JlLoadState = class extends JlElement {
|
|
|
93
134
|
attribute: "delay",
|
|
94
135
|
parse: clampedNumber(DEFAULT_DELAY_MS, 0, MAX_DELAY_MS)
|
|
95
136
|
});
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
137
|
+
/** The heading of a failed load; jlib's own when empty. */
|
|
138
|
+
errorHeading = this.useChange("", () => this.drawTexts(), { attribute: "error-heading" });
|
|
139
|
+
/** What a failed load says under its heading; jlib's own when empty. */
|
|
140
|
+
errorText = this.useChange("", () => this.drawTexts(), { attribute: "error-text" });
|
|
141
|
+
/** The button that runs the load again; jlib's own text when empty. */
|
|
142
|
+
retryLabel = this.useChange("", () => this.drawTexts(), { attribute: "retry-label" });
|
|
99
143
|
_work = { latest: 0 };
|
|
100
144
|
_refs = this.useRefs((ref) => ({
|
|
101
145
|
bones: ref(".bones"),
|
|
@@ -128,6 +172,11 @@ var JlLoadState = class extends JlElement {
|
|
|
128
172
|
return false;
|
|
129
173
|
}
|
|
130
174
|
}
|
|
175
|
+
/** Tells the page the state changed: `state`, with the new one. */
|
|
176
|
+
announceState(value, previous) {
|
|
177
|
+
if (value === previous) return;
|
|
178
|
+
this.events.emit(STATE_EVENT, value);
|
|
179
|
+
}
|
|
131
180
|
/** Whether data is shown (the content or the empty state), which a refresh keeps. */
|
|
132
181
|
isShowing() {
|
|
133
182
|
const state = this.state.get();
|
|
@@ -150,13 +199,10 @@ var JlLoadState = class extends JlElement {
|
|
|
150
199
|
/* @__PURE__ */ jsx("jl-empty", {
|
|
151
200
|
class: "error",
|
|
152
201
|
icon: "circle-alert",
|
|
153
|
-
heading: DEFAULT_ERROR_HEADING,
|
|
154
|
-
description: jlText("loadStateError"),
|
|
155
202
|
hidden: true,
|
|
156
203
|
children: /* @__PURE__ */ jsx(JlButton, {
|
|
157
204
|
class: "retry",
|
|
158
|
-
icon: "refresh"
|
|
159
|
-
label: jlText("retry")
|
|
205
|
+
icon: "refresh"
|
|
160
206
|
})
|
|
161
207
|
}),
|
|
162
208
|
/* @__PURE__ */ jsx("div", {
|
|
@@ -175,6 +221,11 @@ var JlLoadState = class extends JlElement {
|
|
|
175
221
|
templateCss() {
|
|
176
222
|
return css`${BASE_STYLES}${jl_load_state_default}`;
|
|
177
223
|
}
|
|
224
|
+
drawTexts() {
|
|
225
|
+
this._refs.error.heading.set(this.errorHeading.get() || jlText("loadStateHeading"));
|
|
226
|
+
this._refs.error.description.set(this.errorText.get() || jlText("loadStateError"));
|
|
227
|
+
this._refs.retry.label.set(this.retryLabel.get() || jlText("retry"));
|
|
228
|
+
}
|
|
178
229
|
onConnect() {
|
|
179
230
|
this.renderSkeleton();
|
|
180
231
|
this.renderState(this.state.get());
|
|
@@ -0,0 +1,3 @@
|
|
|
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}";
|
|
3
|
+
export { jl_menu_default as default };
|
|
@@ -6,7 +6,7 @@ import { JlIcon } from "../atoms/jl-icon.js";
|
|
|
6
6
|
import { uniqueId } from "../lib/dom.js";
|
|
7
7
|
import { firstIndex, lastIndex, letterIndex, stepIndex } from "../lib/roving.js";
|
|
8
8
|
import { setTriggerAria } from "../lib/trigger.js";
|
|
9
|
-
import jl_menu_default from "./jl-menu.
|
|
9
|
+
import jl_menu_default from "./jl-menu.css.js";
|
|
10
10
|
import { css } from "@jadis/core";
|
|
11
11
|
import { Fragment, jsx, jsxs } from "@jadis/core/jsx-runtime";
|
|
12
12
|
// src/molecules/jl-menu.tsx
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// src/molecules/jl-number-input.css?inline
|
|
2
|
+
var jl_number_input_default = ":host{display:block}.control{padding:0 8px}.native{text-align:center;font-variant-numeric:tabular-nums}.action{margin-right:0}.action:disabled{color:var(--jl-faint);cursor:not-allowed;opacity:.5;background:0 0}:host([size=sm]) .action{width:22px;height:22px}:host([size=lg]) .action{width:30px;height:30px}";
|
|
3
|
+
export { jl_number_input_default as default };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { jlText } from "../lib/texts.js";
|
|
1
2
|
import { BASE_STYLES, CONTROL_STYLES } from "../styles/shared.js";
|
|
2
3
|
import { JlFormControl } from "../base/jl-form-control.js";
|
|
3
4
|
import { oneOf } from "../lib/attributes.js";
|
|
4
5
|
import { registerIcons } from "../lib/icons.js";
|
|
5
6
|
import { CONTROL_SIZES } from "../lib/options.js";
|
|
6
|
-
import { jlText } from "../lib/texts.js";
|
|
7
7
|
import { JlIcon } from "../atoms/jl-icon.js";
|
|
8
8
|
import { setOrRemove } from "../lib/dom.js";
|
|
9
9
|
import { clamp, parseNumber, stepValue } from "../lib/numeric.js";
|
|
10
|
-
import jl_number_input_default from "./jl-number-input.
|
|
10
|
+
import jl_number_input_default from "./jl-number-input.css.js";
|
|
11
11
|
import { css } from "@jadis/core";
|
|
12
12
|
import { Minus, Plus } from "lucide";
|
|
13
13
|
import { jsx, jsxs } from "@jadis/core/jsx-runtime";
|
|
@@ -89,7 +89,6 @@ var JlNumberInput = class extends JlFormControl {
|
|
|
89
89
|
class: "action step down",
|
|
90
90
|
type: "button",
|
|
91
91
|
tabIndex: -1,
|
|
92
|
-
"aria-label": jlText("decrease"),
|
|
93
92
|
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
94
93
|
name: "minus",
|
|
95
94
|
size: ICON_SIZE
|
|
@@ -106,7 +105,6 @@ var JlNumberInput = class extends JlFormControl {
|
|
|
106
105
|
class: "action step up",
|
|
107
106
|
type: "button",
|
|
108
107
|
tabIndex: -1,
|
|
109
|
-
"aria-label": jlText("increase"),
|
|
110
108
|
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
111
109
|
name: "plus",
|
|
112
110
|
size: ICON_SIZE
|
|
@@ -208,6 +206,11 @@ var JlNumberInput = class extends JlFormControl {
|
|
|
208
206
|
this._refs.down.disabled = off || value !== null && min !== null && value <= min;
|
|
209
207
|
this._refs.up.disabled = off || value !== null && max !== null && value >= max;
|
|
210
208
|
}
|
|
209
|
+
drawTexts() {
|
|
210
|
+
this._refs.down.setAttribute("aria-label", jlText("decrease"));
|
|
211
|
+
this._refs.up.setAttribute("aria-label", jlText("increase"));
|
|
212
|
+
this.renderValidity();
|
|
213
|
+
}
|
|
211
214
|
renderValidity() {
|
|
212
215
|
if (!(this.required.get() && this.value.get() === null)) {
|
|
213
216
|
this.internals.setValidity({});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// src/molecules/jl-pagination.css?inline
|
|
2
|
+
var jl_pagination_default = ":host{--height:var(--jl-control-md);--font-size:var(--jl-font-sm);--entry:var(--height);--gap:4px;--min-button:26px;display:block}:host([size=sm]){--height:var(--jl-control-sm);--font-size:var(--jl-font-xs);--min-button:24px}:host([size=lg]){--height:var(--jl-control-lg);--font-size:var(--jl-font-md);--min-button:32px}@media (width<480px){:host{--entry:var(--min-button);--gap:2px}}nav{align-items:center;gap:var(--gap);display:flex}.pages{align-items:center;gap:var(--gap);padding:0;list-style:none;display:flex}.pages li{width:var(--entry);display:flex}.button{width:100%;height:var(--height);border-radius:var(--jl-radius-sm);color:var(--jl-text-2);font-size:var(--font-size);font-variant-numeric:tabular-nums;cursor:pointer;transition:background var(--jl-fast) var(--jl-ease), color var(--jl-fast) var(--jl-ease);background:0 0;border:1px solid #0000;justify-content:center;align-items:center;padding:0 2px;font-weight:600;display:inline-flex}.button:hover:not(:disabled,[aria-current]){background:var(--jl-surface-2);color:var(--jl-text)}.button:active:not(:disabled,[aria-current]){background:var(--jl-surface-3)}.previous,.next{width:calc(var(--entry) + 2px);border-color:var(--jl-line-strong);color:var(--jl-text);flex:none}.button:disabled{cursor:not-allowed;opacity:.4}.page[aria-current]{background:var(--jl-accent);color:var(--jl-on-accent);cursor:default}.pages .gap{width:calc(var(--entry) - 10px);color:var(--jl-faint);font-size:var(--font-size);-webkit-user-select:none;user-select:none;justify-content:center;align-items:flex-end;display:inline-flex}.status{min-width:72px;color:var(--jl-text-2);font-size:var(--font-size);font-variant-numeric:tabular-nums;text-align:center;white-space:nowrap;flex:none;padding:0 8px;font-weight:600}";
|
|
3
|
+
export { jl_pagination_default as default };
|
|
@@ -46,6 +46,8 @@ export declare class JlPagination extends JlElement {
|
|
|
46
46
|
private readonly _refs;
|
|
47
47
|
templateHtml(): Node;
|
|
48
48
|
templateCss(): string;
|
|
49
|
+
protected drawTexts(): void;
|
|
50
|
+
private renderLabel;
|
|
49
51
|
onConnect(): void;
|
|
50
52
|
/** The current page, kept within the pages there are. */
|
|
51
53
|
private currentPage;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { jlText } from "../lib/texts.js";
|
|
1
2
|
import { BASE_STYLES } from "../styles/shared.js";
|
|
2
3
|
import { JlElement } from "../base/jl-element.js";
|
|
3
4
|
import { clampedNumber, oneOf } from "../lib/attributes.js";
|
|
4
5
|
import { registerIcons } from "../lib/icons.js";
|
|
5
6
|
import { CONTROL_SIZES } from "../lib/options.js";
|
|
6
|
-
import { jlText } from "../lib/texts.js";
|
|
7
7
|
import { JlIcon } from "../atoms/jl-icon.js";
|
|
8
8
|
import { clampPage, pageItems } from "../lib/pagination.js";
|
|
9
|
-
import jl_pagination_default from "./jl-pagination.
|
|
9
|
+
import jl_pagination_default from "./jl-pagination.css.js";
|
|
10
10
|
import { css } from "@jadis/core";
|
|
11
11
|
import { ChevronLeft, ChevronRight } from "lucide";
|
|
12
12
|
import { jsx, jsxs } from "@jadis/core/jsx-runtime";
|
|
@@ -61,9 +61,7 @@ var JlPagination = class extends JlElement {
|
|
|
61
61
|
parse: oneOf(CONTROL_SIZES, "md")
|
|
62
62
|
});
|
|
63
63
|
/** The navigation's name for screen readers, when a page has more than one. */
|
|
64
|
-
label = this.useChange(
|
|
65
|
-
this._refs.nav.setAttribute("aria-label", value || jlText("pagination"));
|
|
66
|
-
}, { attribute: "label" });
|
|
64
|
+
label = this.useChange("", () => this.renderLabel(), { attribute: "label" });
|
|
67
65
|
_refs = this.useRefs((ref) => ({
|
|
68
66
|
list: ref(".pages"),
|
|
69
67
|
nav: ref("nav"),
|
|
@@ -80,7 +78,6 @@ var JlPagination = class extends JlElement {
|
|
|
80
78
|
/* @__PURE__ */ jsx("button", {
|
|
81
79
|
type: "button",
|
|
82
80
|
class: "button previous",
|
|
83
|
-
"aria-label": jlText("previousPage"),
|
|
84
81
|
children: /* @__PURE__ */ jsx(JlIcon, { name: "chevron-left" })
|
|
85
82
|
}),
|
|
86
83
|
/* @__PURE__ */ jsx("ol", { class: "pages" }),
|
|
@@ -91,7 +88,6 @@ var JlPagination = class extends JlElement {
|
|
|
91
88
|
/* @__PURE__ */ jsx("button", {
|
|
92
89
|
type: "button",
|
|
93
90
|
class: "button next",
|
|
94
|
-
"aria-label": jlText("nextPage"),
|
|
95
91
|
children: /* @__PURE__ */ jsx(JlIcon, { name: "chevron-right" })
|
|
96
92
|
})
|
|
97
93
|
]
|
|
@@ -100,6 +96,15 @@ var JlPagination = class extends JlElement {
|
|
|
100
96
|
templateCss() {
|
|
101
97
|
return css`${BASE_STYLES}${jl_pagination_default}`;
|
|
102
98
|
}
|
|
99
|
+
drawTexts() {
|
|
100
|
+
this._refs.previous.setAttribute("aria-label", jlText("previousPage"));
|
|
101
|
+
this._refs.next.setAttribute("aria-label", jlText("nextPage"));
|
|
102
|
+
this.renderLabel();
|
|
103
|
+
this.render();
|
|
104
|
+
}
|
|
105
|
+
renderLabel() {
|
|
106
|
+
this._refs.nav.setAttribute("aria-label", this.label.get() || jlText("pagination"));
|
|
107
|
+
}
|
|
103
108
|
onConnect() {
|
|
104
109
|
this.on(this._refs.previous, "click", () => this.step(STEP_BACK));
|
|
105
110
|
this.on(this._refs.next, "click", () => this.step(STEP_FORWARD));
|
|
@@ -125,8 +130,11 @@ var JlPagination = class extends JlElement {
|
|
|
125
130
|
this._refs.status.hidden = !compact;
|
|
126
131
|
this._refs.status.replaceChildren(/* @__PURE__ */ jsx("span", {
|
|
127
132
|
class: "sr-only",
|
|
128
|
-
children: "
|
|
129
|
-
}),
|
|
133
|
+
children: `${jlText("page")} `
|
|
134
|
+
}), jlText("pageOfTotal", {
|
|
135
|
+
page,
|
|
136
|
+
total: Math.max(pages, 1)
|
|
137
|
+
}));
|
|
130
138
|
if (!compact) {
|
|
131
139
|
const items = pageItems(page, pages, this.siblings.get(), this.boundaries.get());
|
|
132
140
|
this._refs.list.replaceChildren(...items.map((item) => this.entry(item, page)));
|
|
@@ -143,7 +151,7 @@ var JlPagination = class extends JlElement {
|
|
|
143
151
|
type: "button",
|
|
144
152
|
class: "button page",
|
|
145
153
|
"data-page": item.page,
|
|
146
|
-
"aria-label":
|
|
154
|
+
"aria-label": jlText("pageNumber", { page: item.page }),
|
|
147
155
|
"aria-current": isCurrent ? "page" : void 0,
|
|
148
156
|
children: String(item.page)
|
|
149
157
|
}) });
|