@ixfx/components 0.8.7 → 0.8.9
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/bundle/index.d.ts +743 -383
- package/bundle/index.d.ts.map +1 -1
- package/bundle/index.js +2093 -222
- package/bundle/index.js.map +1 -1
- package/dist/crumbs.d.ts +1 -1
- package/dist/crumbs.js +2 -2
- package/dist/{data-grid-CYVPSUwh.d.ts → data-grid-C588pTgt.d.ts} +15 -2
- package/dist/data-grid-C588pTgt.d.ts.map +1 -0
- package/dist/data-grid.d.ts +3 -2
- package/dist/data-grid.js +95 -5
- package/dist/data-grid.js.map +1 -1
- package/dist/{detail-list-vH56z7WE.d.ts → detail-list-IKl76Wnp.d.ts} +22 -5
- package/dist/detail-list-IKl76Wnp.d.ts.map +1 -0
- package/dist/detail-list.d.ts +4 -3
- package/dist/detail-list.js +103 -3
- package/dist/detail-list.js.map +1 -1
- package/dist/{grid-list-Cq8ga2WZ.d.ts → grid-list-BUlUnisU.d.ts} +214 -112
- package/dist/grid-list-BUlUnisU.d.ts.map +1 -0
- package/dist/{grid-list-j5C7qtlG.js → grid-list-D18FNJRH.js} +77 -164
- package/dist/grid-list-D18FNJRH.js.map +1 -0
- package/dist/grid-list.d.ts +3 -2
- package/dist/grid-list.js +1 -1
- package/dist/incr-search.d.ts +1 -1
- package/dist/{index-DDREWqMm.d.ts → index--qnhBWZJ.d.ts} +2 -2
- package/dist/{index-DDREWqMm.d.ts.map → index--qnhBWZJ.d.ts.map} +1 -1
- package/dist/index.d.ts +212 -253
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -12
- package/dist/index.js.map +1 -1
- package/dist/{interaction-B9AAlsFO.js → interaction-BskmlA9t.js} +1 -1
- package/dist/{labelled-slider-input-BCH9968c.js → labelled-slider-input-aEYDvW2S.js} +2 -2
- package/dist/{labelled-slider-input-BCH9968c.js.map → labelled-slider-input-aEYDvW2S.js.map} +1 -1
- package/dist/labelled-slider-input.js +1 -1
- package/dist/{list-item-animation-DuiwgN3l.js → list-item-animation-BUoEKi5s.js} +29 -10
- package/dist/list-item-animation-BUoEKi5s.js.map +1 -0
- package/dist/list-native-drag-controller-CFyrkKUj.d.ts +61 -0
- package/dist/list-native-drag-controller-CFyrkKUj.d.ts.map +1 -0
- package/dist/list-native-drag-controller-DxD6Yjci.js +567 -0
- package/dist/list-native-drag-controller-DxD6Yjci.js.map +1 -0
- package/dist/{menu-HMoxCPY2.js → menu-CMXhIaNZ.js} +3 -3
- package/dist/{menu-HMoxCPY2.js.map → menu-CMXhIaNZ.js.map} +1 -1
- package/dist/{menu-item-BQDYxk5A.js → menu-item-BYGQzyCe.js} +2 -2
- package/dist/{menu-item-BQDYxk5A.js.map → menu-item-BYGQzyCe.js.map} +1 -1
- package/dist/menu.js +2 -2
- package/dist/miller.d.ts +2 -2
- package/dist/miller.js +1 -1
- package/dist/narrowed-text.js +1 -1
- package/dist/plots.js +1 -1
- package/dist/select-horiz.js +1 -1
- package/dist/slider-input-BxURAAmD.d.ts.map +1 -1
- package/dist/{slider-input-WR8_RwHg.js → slider-input-Cb5uSV42.js} +78 -11
- package/dist/slider-input-Cb5uSV42.js.map +1 -0
- package/dist/slider-input.js +1 -1
- package/dist/{tree-CozQj01a.js → tree-a14n9y7i.js} +1055 -32
- package/dist/tree-a14n9y7i.js.map +1 -0
- package/dist/{tree-component-BMpxpdTi.d.ts → tree-component-BW2iCFq9.d.ts} +108 -4
- package/dist/tree-component-BW2iCFq9.d.ts.map +1 -0
- package/dist/tree.d.ts +102 -4
- package/dist/tree.d.ts.map +1 -1
- package/dist/tree.js +2 -2
- package/dist/{vertical-list-BGn9nyKh.d.ts → vertical-list-CHrXmmQ3.d.ts} +21 -4
- package/dist/vertical-list-CHrXmmQ3.d.ts.map +1 -0
- package/dist/vertical-list.d.ts +3 -2
- package/dist/vertical-list.js +103 -3
- package/dist/vertical-list.js.map +1 -1
- package/dist/{xy-axis-CrrVdDFe.js → xy-axis-COKw338Q.js} +2 -2
- package/dist/xy-axis-COKw338Q.js.map +1 -0
- package/dist/xy-axis-DQqd2yXJ.d.ts.map +1 -1
- package/docs-user/data-grid.md +30 -0
- package/docs-user/detail-list.md +29 -0
- package/docs-user/grid-list.md +34 -4
- package/docs-user/index.json +2 -2
- package/docs-user/tree.md +76 -1
- package/docs-user/vertical-list.md +30 -1
- package/package.json +1 -1
- package/dist/data-grid-CYVPSUwh.d.ts.map +0 -1
- package/dist/detail-list-vH56z7WE.d.ts.map +0 -1
- package/dist/grid-list-Cq8ga2WZ.d.ts.map +0 -1
- package/dist/grid-list-j5C7qtlG.js.map +0 -1
- package/dist/list-item-animation-DuiwgN3l.js.map +0 -1
- package/dist/slider-input-WR8_RwHg.js.map +0 -1
- package/dist/tree-CozQj01a.js.map +0 -1
- package/dist/tree-component-BMpxpdTi.d.ts.map +0 -1
- package/dist/vertical-list-BGn9nyKh.d.ts.map +0 -1
- package/dist/xy-axis-CrrVdDFe.js.map +0 -1
package/dist/tree.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { A as TreeDataModelOptions, C as TreeItemDblClickEvent, D as TreeTickleDetail, E as TreeSelectEvent, I as ListNativeDragStartDetail, O as TreeTickleEvent, P as ListDragPreviewRenderer, T as TreeSelectDetail, _ as TreeDropTarget, a as TreeComponent, b as TreeItemClickDetail, c as TreeDragContext, d as TreeDragStartEvent, g as TreeDropPosition, h as TreeDropEvent, i as TreeCollapseEvent, k as TreeDataModel, l as TreeDragEndEvent, m as TreeDropDetail, n as TreeActivateEvent, o as TreeComponentEventMap, p as TreeDropContext, r as TreeCollapseDetail, s as TreeDndMode, t as TreeActivateDetail, u as TreeDragOverEvent, v as TreeExpandDetail, w as TreeSearchHost, x as TreeItemClickEvent, y as TreeExpandEvent } from "./tree-component-BW2iCFq9.js";
|
|
1
2
|
import { a as TreeItem, i as TreeInteractionMode, n as TreeExclusivity, o as TreeNode, r as TreeFilterPredicate, s as TreeSelectionFilter, t as LoadChildrenCallback } from "./types-Bc23SI94.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import { S as ListSearchController } from "./index--qnhBWZJ.js";
|
|
4
|
+
import { t as ListNativeDragController } from "./list-native-drag-controller-CFyrkKUj.js";
|
|
4
5
|
import { n as TickledController } from "./tickled-controller-C1ZsHpyg.js";
|
|
5
|
-
import { LitElement, PropertyValues, TemplateResult, nothing } from "lit";
|
|
6
|
+
import { LitElement, PropertyValues, ReactiveController, ReactiveControllerHost, TemplateResult, nothing } from "lit";
|
|
6
7
|
import { CommandRegistry } from "@clinth/ui-commands";
|
|
7
8
|
import { TraversableTree } from "@ixfx/collections";
|
|
8
9
|
//#region src/tree/types.d.ts
|
|
@@ -34,6 +35,21 @@ declare class TreeBaseElement extends LitElement implements TreeComponent, TreeS
|
|
|
34
35
|
* disabled. See `docs/infra-incremental.md`.
|
|
35
36
|
*/
|
|
36
37
|
searchModes: string | undefined;
|
|
38
|
+
itemDnd: TreeDndMode;
|
|
39
|
+
acceptDropTypes: string | undefined;
|
|
40
|
+
dndExpandHoverMs: number;
|
|
41
|
+
/**
|
|
42
|
+
* Whether a drag that only reorders siblings (no dragged node changes parent)
|
|
43
|
+
* is honoured. Default `true`. Set `reorderable="false"` for models with no
|
|
44
|
+
* meaningful child order (e.g. a filesystem) — pure-reorder drags then get no
|
|
45
|
+
* drop indicator and emit no `tree-drop`. Reparenting is unaffected.
|
|
46
|
+
*/
|
|
47
|
+
reorderable: boolean;
|
|
48
|
+
dragPreviewRenderer: ListDragPreviewRenderer<TreeNode> | undefined;
|
|
49
|
+
canDrag: ((ctx: TreeDragContext) => boolean) | undefined;
|
|
50
|
+
canDrop: ((ctx: TreeDropContext) => boolean) | undefined;
|
|
51
|
+
parseExternalDrop: ((dt: DataTransfer) => TreeNode[] | undefined) | undefined;
|
|
52
|
+
applyInternalDrop: boolean;
|
|
37
53
|
protected _expandedKeys: Set<string>;
|
|
38
54
|
protected tickled: TickledController<string>;
|
|
39
55
|
protected _focusedDepth: number;
|
|
@@ -42,6 +58,10 @@ declare class TreeBaseElement extends LitElement implements TreeComponent, TreeS
|
|
|
42
58
|
node: TreeNode;
|
|
43
59
|
depth: number;
|
|
44
60
|
}>;
|
|
61
|
+
protected get nativeDrag(): ListNativeDragController<TreeNode>;
|
|
62
|
+
protected get dropState(): TreeDropTarget | undefined;
|
|
63
|
+
/** Keys of the nodes currently being dragged out of this tree. */
|
|
64
|
+
protected get nativeDragKeys(): ReadonlySet<string>;
|
|
45
65
|
willUpdate(changedProps: PropertyValues): void;
|
|
46
66
|
/** True while `node` is a fading ghost row (removed / collapsed, still animating out). */
|
|
47
67
|
protected _isLeaving(node: TreeNode): boolean;
|
|
@@ -79,6 +99,14 @@ declare class TreeBaseElement extends LitElement implements TreeComponent, TreeS
|
|
|
79
99
|
protected get _pendingNode(): TreeNode | undefined;
|
|
80
100
|
protected renderLoadingIndicator(): TemplateResult | typeof nothing;
|
|
81
101
|
protected render(): TemplateResult<1>;
|
|
102
|
+
/** Shared drag-and-drop render state for a row, used by every `_renderNode` variant. */
|
|
103
|
+
protected _dndRowState(node: TreeNode): {
|
|
104
|
+
draggable: boolean;
|
|
105
|
+
dragging: boolean;
|
|
106
|
+
dropTarget: boolean;
|
|
107
|
+
dropPosition?: TreeDropTarget[`position`];
|
|
108
|
+
dropDepth?: number;
|
|
109
|
+
};
|
|
82
110
|
protected _renderNode(node: TreeNode, depth: number): TemplateResult;
|
|
83
111
|
static styles: import("lit").CSSResult[];
|
|
84
112
|
}
|
|
@@ -95,6 +123,11 @@ interface TreeBaseElementEventMap extends TreeComponentEventMap {
|
|
|
95
123
|
'select': TreeSelectEvent;
|
|
96
124
|
'tickle': TreeTickleEvent;
|
|
97
125
|
'activate': TreeActivateEvent;
|
|
126
|
+
'list-native-drag-start': CustomEvent<ListNativeDragStartDetail<TreeNode>>;
|
|
127
|
+
'tree-drag-start': TreeDragStartEvent;
|
|
128
|
+
'tree-drag-over': TreeDragOverEvent;
|
|
129
|
+
'tree-drop': TreeDropEvent;
|
|
130
|
+
'tree-drag-end': TreeDragEndEvent;
|
|
98
131
|
}
|
|
99
132
|
interface TreeBaseElement {
|
|
100
133
|
addEventListener: (<K extends keyof TreeBaseElementEventMap>(type: K, listener: (this: TreeBaseElement, event: TreeBaseElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void);
|
|
@@ -152,5 +185,70 @@ declare class TreeController<T> {
|
|
|
152
185
|
navigateToValue(predicate: (value: T) => boolean): boolean;
|
|
153
186
|
}
|
|
154
187
|
//#endregion
|
|
155
|
-
|
|
188
|
+
//#region src/tree/tree-drop-controller.d.ts
|
|
189
|
+
interface TreeDropVisibleRow {
|
|
190
|
+
readonly key: string;
|
|
191
|
+
readonly node: TreeNode;
|
|
192
|
+
readonly depth: number;
|
|
193
|
+
readonly rect: DOMRect;
|
|
194
|
+
}
|
|
195
|
+
/** What a `dragover` / `drop` DataTransfer resolved to for this tree. */
|
|
196
|
+
interface TreeDropResolvedDrag {
|
|
197
|
+
readonly source: `internal` | `external`;
|
|
198
|
+
/** Keys of the dragged nodes (empty for external). */
|
|
199
|
+
readonly keys: readonly string[];
|
|
200
|
+
/** The dragged nodes — live nodes for internal, parsed payload for external. */
|
|
201
|
+
readonly nodes: readonly TreeNode[];
|
|
202
|
+
}
|
|
203
|
+
type TreeDropControllerConfig = {
|
|
204
|
+
getDndMode: () => `none` | `internal` | `external` | `both`;
|
|
205
|
+
getExpandHoverMs: () => number;
|
|
206
|
+
/** Visible rows in display order, each with a fresh viewport rect. Host may cache. */
|
|
207
|
+
getVisibleRows: () => TreeDropVisibleRow[];
|
|
208
|
+
getIndentPx: () => number;
|
|
209
|
+
getScrollContainer: () => HTMLElement | undefined;
|
|
210
|
+
/** True when `key` is `ancestorKey` or a descendant of it. */
|
|
211
|
+
isSelfOrDescendant: (ancestorKey: string, key: string) => boolean;
|
|
212
|
+
/** True when the node is currently expanded in the UI. */
|
|
213
|
+
isExpanded: (key: string) => boolean;
|
|
214
|
+
/**
|
|
215
|
+
* When `false`, an internal drop that would not change any dragged node's
|
|
216
|
+
* parent (pure sibling reorder, or dropping back into the current parent) is
|
|
217
|
+
* rejected outright — no indicator, no `tree-drop`.
|
|
218
|
+
*/
|
|
219
|
+
isReorderAllowed: () => boolean;
|
|
220
|
+
/** Current parent key of `key`, or `undefined` for a root-level node. */
|
|
221
|
+
getParentKey: (key: string) => string | undefined;
|
|
222
|
+
/**
|
|
223
|
+
* Decide whether this DataTransfer is acceptable and resolve the dragged set.
|
|
224
|
+
* `phase` is `hover` during dragenter/dragover (DataTransfer is read-protected —
|
|
225
|
+
* resolve internal drags from the drag registry) and `drop` during drop
|
|
226
|
+
* (getData is readable; external payloads may be parsed here). Return
|
|
227
|
+
* `undefined` to reject (the tree will not become a drop target).
|
|
228
|
+
*/
|
|
229
|
+
resolveDrag: (dataTransfer: DataTransfer, phase: `hover` | `drop`) => TreeDropResolvedDrag | undefined;
|
|
230
|
+
vet: (ctx: TreeDropContext) => boolean;
|
|
231
|
+
expandKey: (key: string) => void;
|
|
232
|
+
/** Fired whenever the resolved drop target changes (undefined = none / rejected). */
|
|
233
|
+
onDropStateChange: (state: TreeDropTarget | undefined) => void;
|
|
234
|
+
/** Fired when a drag enters / leaves this tree. */
|
|
235
|
+
onActiveChange: (active: boolean) => void;
|
|
236
|
+
commitDrop: (detail: TreeDropDetail) => boolean;
|
|
237
|
+
onDragEnd: (dropped: boolean) => void;
|
|
238
|
+
};
|
|
239
|
+
declare class TreeDropController implements ReactiveController {
|
|
240
|
+
#private;
|
|
241
|
+
constructor(host: ReactiveControllerHost & HTMLElement, config: TreeDropControllerConfig);
|
|
242
|
+
/** A drag is currently over this tree. */
|
|
243
|
+
get isDragging(): boolean;
|
|
244
|
+
/** A drag is over this tree but the current position is not a valid drop. */
|
|
245
|
+
get isRejected(): boolean;
|
|
246
|
+
get dropState(): TreeDropTarget | undefined;
|
|
247
|
+
hostConnected(): void;
|
|
248
|
+
/** Bind once the shadow `#container` exists (it does not yet at `hostConnected`). */
|
|
249
|
+
hostUpdated(): void;
|
|
250
|
+
hostDisconnected(): void;
|
|
251
|
+
}
|
|
252
|
+
//#endregion
|
|
253
|
+
export { type LoadChildrenCallback, type TreeActivateDetail, type TreeActivateEvent, TreeBaseElement, TreeBaseElementEventMap, TreeCheckboxState, type TreeCollapseDetail, type TreeCollapseEvent, type TreeComponentEventMap, TreeConfig, TreeController, TreeControllerOptions, TreeDataModel, type TreeDataModelOptions, type TreeDndMode, type TreeDragContext, type TreeDragEndEvent, type TreeDragOverEvent, type TreeDragStartEvent, type TreeDropContext, TreeDropController, TreeDropControllerConfig, type TreeDropDetail, type TreeDropEvent, type TreeDropPosition, TreeDropResolvedDrag, type TreeDropTarget, TreeDropVisibleRow, type TreeExclusivity, type TreeExpandDetail, type TreeExpandEvent, type TreeFilterPredicate, type TreeItem, type TreeItemClickDetail, type TreeItemClickEvent, TreeListElement, type TreeNode, type TreeSelectDetail, type TreeSelectEvent, type TreeSelectionFilter, type TreeTickleDetail, type TreeTickleEvent };
|
|
156
254
|
//# sourceMappingURL=tree.d.ts.map
|
package/dist/tree.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.d.ts","names":[],"sources":["../src/tree/types.ts","../src/tree/tree-base.ts","../src/tree/tree-list.ts","../src/tree/tree-controller.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tree.d.ts","names":[],"sources":["../src/tree/types.ts","../src/tree/tree-base.ts","../src/tree/tree-list.ts","../src/tree/tree-controller.ts","../src/tree/tree-drop-controller.ts"],"mappings":";;;;;;;;;;KAqCY;EACV;;;;cCuCW,wBAAwB,sBAAsB,eAAe;;EAExE,MAAM;EAGN,OAAO;;EAIP,cAAc;EAGd,aAAa;EAGb,iBAAiB;;EAIjB,iBAAiB;EAGjB,cAAc;YAGJ,gBAAc,IAAA;MAEpB,iBAAiB,YAA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-
import {
|
|
2
|
-
export { TreeBaseElement, TreeController, TreeDataModel, TreeListElement };
|
|
1
|
+
import { a as TreeDataModel, i as TreeDropController, n as TreeListElement, r as TreeBaseElement, t as TreeController } from "./tree-a14n9y7i.js";
|
|
2
|
+
export { TreeBaseElement, TreeController, TreeDataModel, TreeDropController, TreeListElement };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as ListNativeDragStartEvent, P as ListDragPreviewRenderer } from "./tree-component-BW2iCFq9.js";
|
|
2
|
+
import { S as ListSearchController } from "./index--qnhBWZJ.js";
|
|
2
3
|
import { i as ListInteractionMode, l as ListSelectionMode, r as ListElementEventMap } from "./list-selection-types-B5ioL-dG.js";
|
|
3
4
|
import { LitElement, PropertyValues } from "lit";
|
|
4
5
|
import { CommandId, CommandRegistry } from "@clinth/ui-commands";
|
|
@@ -52,8 +53,20 @@ declare class VerticalListElement extends LitElement {
|
|
|
52
53
|
* disabled. See `docs/infra-incremental.md`.
|
|
53
54
|
*/
|
|
54
55
|
searchModes: string | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Enable native browser drag-and-drop for selectable items. When true,
|
|
58
|
+
* selectable rows become draggable and the list emits
|
|
59
|
+
* `list-native-drag-start` when a drag begins.
|
|
60
|
+
*/
|
|
61
|
+
itemsDraggable: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Custom drag preview renderer (synchronous). Defaults to the shared
|
|
64
|
+
* built-in HTML+canvas preview.
|
|
65
|
+
*/
|
|
66
|
+
dragPreviewRenderer: ListDragPreviewRenderer<Element> | undefined;
|
|
55
67
|
private readonly selection;
|
|
56
68
|
private tickled;
|
|
69
|
+
private _syncNativeDraggable;
|
|
57
70
|
/** Incremental search (navigate / select / filter). See `docs/infra-incremental.md`. */
|
|
58
71
|
readonly search: ListSearchController<Element>;
|
|
59
72
|
/** Command registry carrying this list's `list.search.*` commands. */
|
|
@@ -123,6 +136,7 @@ declare class VerticalListElement extends LitElement {
|
|
|
123
136
|
private _createCustomCheckbox;
|
|
124
137
|
private _findListItem;
|
|
125
138
|
private _dispatch;
|
|
139
|
+
private _dispatchCancelable;
|
|
126
140
|
private _onPointerOver;
|
|
127
141
|
private _onPointerLeave;
|
|
128
142
|
private _onKeyDown;
|
|
@@ -136,8 +150,11 @@ declare global {
|
|
|
136
150
|
interface HTMLElementTagNameMap {
|
|
137
151
|
'ixfx-vertical-list': VerticalListElement;
|
|
138
152
|
}
|
|
139
|
-
interface HTMLElementEventMap extends
|
|
153
|
+
interface HTMLElementEventMap extends VerticalListElementEventMap {}
|
|
154
|
+
}
|
|
155
|
+
interface VerticalListElementEventMap extends ListElementEventMap {
|
|
156
|
+
'list-native-drag-start': ListNativeDragStartEvent<Element>;
|
|
140
157
|
}
|
|
141
158
|
//#endregion
|
|
142
|
-
export { CustomCheckboxOptions as n, VerticalListElement as r, AddItemOptions as t };
|
|
143
|
-
//# sourceMappingURL=vertical-list-
|
|
159
|
+
export { VerticalListElementEventMap as i, CustomCheckboxOptions as n, VerticalListElement as r, AddItemOptions as t };
|
|
160
|
+
//# sourceMappingURL=vertical-list-CHrXmmQ3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertical-list-CHrXmmQ3.d.ts","names":[],"sources":["../src/vertical-list/vertical-list.ts"],"mappings":";;;;;;UAwDiB;EACf,WAAW;EACX;EACA;;UAGe;;;;;;EAMf;;cAMW,4BAA4B;;EAEvC,eAAe;EAGf,iBAAiB;EAGjB,mBAAmB,IAAI;;;;;;EAQvB;;;;;;;;;;;;;;;;;;;EAqBA,oBAAoB,gCAAgC;;;;;;EAQpD;;;;;;EAQA;;;;;EAOA,qBAAqB,wBAAwB;mBAU5B;UAeT;UA4EA;;WA4EC,QAAM,qBAAA;;MAYX,YAAY;EAoBP;EAmBA;EAgDA,QAAQ,SAAS;;MAuCtB,gBAAgB;;MAKhB,iBAAiB,YAAY;EAIjC,QAAQ,MAAM,kBAAkB,UAAU;;;;;;EAqB1C,WAAW,MAAM,UAAU;;EAW3B,YAAY,OAAO,SAAS,WAAW;EAIvC;;;;;;EAYA,SAAS,gBAAgB;;;;;;EAczB,SAAS,WAAW,WAAW,OAAO;EAItC,OAAO,MAAM;EAIb,WAAW,OAAO,SAAS;EAI3B,SAAS,MAAM;EAIf;EAIA;;MAQI,gBAAgB;;MAKhB;;EAMJ,WAAW,MAAM;;EAKjB,gBAAgB,MAAM;;EAKtB,mBAAmB,MAAM;;EAKzB,SAAS;EAkBP,eAAe,0CAA0C,UAAU;UAqB7D;UAgBA;UAOA;UAiBA;;;;;;;UA6FA;;;;;UAuBA;UAcA;UAYA;UAQA;UAWA;UAMA;UAIA;UAwDA;UAUA;UAMA;SAUQ,sBAAM;EAmJb,wBAAM;;QAeT;YACI;IACR,sBAAsB;;YAGd,4BAA4B;;UAGvB,oCAAoC;EACnD,0BAA0B,yBAAyB"}
|
package/dist/vertical-list.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { F as ListDragSource, I as ListNativeDragStartDetail, L as ListNativeDragStartEvent, M as ListDragPreview, N as ListDragPreviewContext, P as ListDragPreviewRenderer, j as ListDragEntry } from "./tree-component-BW2iCFq9.js";
|
|
1
2
|
import { a as ListItemClickDetail, c as ListSelectEvent, d as ListTickleEvent, i as ListInteractionMode, l as ListSelectionMode, n as ListActivateEvent, o as ListItemClickEvent, r as ListElementEventMap, s as ListSelectDetail, t as ListActivateDetail, u as ListTickleDetail } from "./list-selection-types-B5ioL-dG.js";
|
|
2
|
-
import { n as CustomCheckboxOptions, r as VerticalListElement, t as AddItemOptions } from "./vertical-list-
|
|
3
|
-
export { AddItemOptions, CustomCheckboxOptions, type ListActivateDetail, type ListActivateEvent, type ListElementEventMap, type ListInteractionMode, type ListItemClickDetail, type ListItemClickEvent, type ListSelectDetail, type ListSelectEvent, type ListSelectionMode, type ListTickleDetail, type ListTickleEvent, VerticalListElement };
|
|
3
|
+
import { i as VerticalListElementEventMap, n as CustomCheckboxOptions, r as VerticalListElement, t as AddItemOptions } from "./vertical-list-CHrXmmQ3.js";
|
|
4
|
+
export { AddItemOptions, CustomCheckboxOptions, type ListActivateDetail, type ListActivateEvent, type ListDragEntry, type ListDragPreview, type ListDragPreviewContext, type ListDragPreviewRenderer, type ListDragSource, type ListElementEventMap, type ListInteractionMode, type ListItemClickDetail, type ListItemClickEvent, type ListNativeDragStartDetail, type ListNativeDragStartEvent, type ListSelectDetail, type ListSelectEvent, type ListSelectionMode, type ListTickleDetail, type ListTickleEvent, VerticalListElement, VerticalListElementEventMap };
|
package/dist/vertical-list.js
CHANGED
|
@@ -2,8 +2,9 @@ import { t as TickledController } from "./tickled-controller-Dh1Uh_vG.js";
|
|
|
2
2
|
import { t as themeFallbacks } from "./fallbacks-BcKGq-2F.js";
|
|
3
3
|
import { n as safeCustomElement, t as __decorate } from "./decorate-VRK8rslU.js";
|
|
4
4
|
import { c as createElementListSearchAdapter, i as ListSearchController, n as listSearchStyles, o as registerListSearchCommands, r as LIST_SEARCH_MODES, u as keyForElement } from "./incr-search-C05WjbZh.js";
|
|
5
|
+
import { t as ListNativeDragController } from "./list-native-drag-controller-DxD6Yjci.js";
|
|
5
6
|
import { r as ListDragSelectController, t as ListSelectionController } from "./list-selection-controller-SA4piSBi.js";
|
|
6
|
-
import { n as animateListItemIn, r as animateListItemOut } from "./list-item-animation-
|
|
7
|
+
import { n as animateListItemIn, r as animateListItemOut } from "./list-item-animation-BUoEKi5s.js";
|
|
7
8
|
import { LitElement, css, html, render } from "lit";
|
|
8
9
|
import { property } from "lit/decorators.js";
|
|
9
10
|
import { createCommandRegistry } from "@clinth/ui-commands";
|
|
@@ -15,6 +16,7 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
15
16
|
this.selectionMode = `single`;
|
|
16
17
|
this.interactionMode = `standard`;
|
|
17
18
|
this.itemWrap = `stop`;
|
|
19
|
+
this.itemsDraggable = false;
|
|
18
20
|
this.#customWrappers = /* @__PURE__ */ new Map();
|
|
19
21
|
this.#wrappedElements = /* @__PURE__ */ new Set();
|
|
20
22
|
this.#animatedItems = /* @__PURE__ */ new WeakSet();
|
|
@@ -45,7 +47,41 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
45
47
|
},
|
|
46
48
|
onStateChange: () => this._syncItemStates(),
|
|
47
49
|
itemWrap: this.itemWrap,
|
|
48
|
-
hoverDisabled: () => this.#dragSelect.isDragging
|
|
50
|
+
hoverDisabled: () => this.#dragSelect.isDragging || this.#nativeDrag.isDragging
|
|
51
|
+
});
|
|
52
|
+
this.#nativeDragging = false;
|
|
53
|
+
this.#postDragSuppressTimer = 0;
|
|
54
|
+
this.#nativeDrag = new ListNativeDragController(this, {
|
|
55
|
+
source: `vertical-list`,
|
|
56
|
+
isEnabled: () => this.itemsDraggable && this.selectionMode !== `none` && this._getVisibleItems().length > 0,
|
|
57
|
+
resolveEventToKey: (target) => {
|
|
58
|
+
if (!(target instanceof Element)) return void 0;
|
|
59
|
+
const item = target.closest?.(ITEM_SELECTOR);
|
|
60
|
+
if (!item || !this.contains(item) || this.#wrappedElements.has(item)) return void 0;
|
|
61
|
+
return keyForElement(item);
|
|
62
|
+
},
|
|
63
|
+
prepareSelection: (originKey) => this.#prepareNativeDrag(originKey),
|
|
64
|
+
getMetrics: () => ({}),
|
|
65
|
+
getRenderer: () => this.dragPreviewRenderer,
|
|
66
|
+
dispatch: (detail) => this._dispatchCancelable(`list-native-drag-start`, detail),
|
|
67
|
+
onActiveChange: (active, originKey) => {
|
|
68
|
+
this.#nativeDragging = active;
|
|
69
|
+
this.toggleAttribute(`data-native-dragging`, active);
|
|
70
|
+
for (const el of this._getVisibleItems()) el.toggleAttribute(`data-drag-origin`, active && originKey !== void 0 && keyForElement(el) === originKey);
|
|
71
|
+
if (active) {
|
|
72
|
+
const count = this.selection.selected.size;
|
|
73
|
+
this.setAttribute(`aria-label`, count <= 1 ? `Dragging 1 item` : `Dragging ${count} items`);
|
|
74
|
+
} else this.removeAttribute(`aria-label`);
|
|
75
|
+
this.requestUpdate();
|
|
76
|
+
},
|
|
77
|
+
onEnd: () => {
|
|
78
|
+
this.#nativeDragging = false;
|
|
79
|
+
this.toggleAttribute(`data-native-dragging`, false);
|
|
80
|
+
this.removeAttribute(`aria-label`);
|
|
81
|
+
for (const el of this._getVisibleItems()) el.removeAttribute(`data-drag-origin`);
|
|
82
|
+
this.#startPostDragSuppressTimer();
|
|
83
|
+
},
|
|
84
|
+
syncLightDomDraggable: () => this._syncNativeDraggable()
|
|
49
85
|
});
|
|
50
86
|
this.#dragSelect = new ListDragSelectController(this, {
|
|
51
87
|
getSurface: () => this.renderRoot.querySelector(`.container`),
|
|
@@ -127,7 +163,7 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
127
163
|
}
|
|
128
164
|
};
|
|
129
165
|
this._onClick = (e) => {
|
|
130
|
-
if (this.#dragSelect.isDragging) return;
|
|
166
|
+
if (this.#dragSelect.isDragging || this.#nativeDrag.isDragging || this.#postDragSuppressTimer !== 0) return;
|
|
131
167
|
const item = this._findListItem(e.composedPath());
|
|
132
168
|
if (!item) return;
|
|
133
169
|
this._dispatch(`list-item-click`, { item });
|
|
@@ -144,6 +180,44 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
144
180
|
#itemObserver;
|
|
145
181
|
/** Items that have already played (or been skipped for) their enter animation. */
|
|
146
182
|
#animatedItems;
|
|
183
|
+
#nativeDragging;
|
|
184
|
+
#postDragSuppressTimer;
|
|
185
|
+
#nativeDrag;
|
|
186
|
+
#prepareNativeDrag(originKey) {
|
|
187
|
+
const visible = this._getVisibleItems();
|
|
188
|
+
const originEl = visible.find((el) => keyForElement(el) === originKey);
|
|
189
|
+
if (!originEl || !this._isCheckable(originEl)) return void 0;
|
|
190
|
+
if (!this.selection.selected.has(originEl)) this.selection.replace(originEl);
|
|
191
|
+
const selected = [];
|
|
192
|
+
visible.forEach((el, index) => {
|
|
193
|
+
if (!this.selection.selected.has(el)) return;
|
|
194
|
+
selected.push({
|
|
195
|
+
key: keyForElement(el) ?? originKey,
|
|
196
|
+
index,
|
|
197
|
+
item: el,
|
|
198
|
+
element: el
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
const origin = selected.find((entry) => entry.key === originKey);
|
|
202
|
+
if (!origin) return void 0;
|
|
203
|
+
return {
|
|
204
|
+
origin,
|
|
205
|
+
selected
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
_syncNativeDraggable() {
|
|
209
|
+
if (!this.isConnected) return;
|
|
210
|
+
for (const el of this.querySelectorAll(ITEM_SELECTOR)) {
|
|
211
|
+
if (this.#wrappedElements.has(el)) continue;
|
|
212
|
+
if (el instanceof HTMLElement) el.draggable = this.itemsDraggable && this._isCheckable(el);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
#startPostDragSuppressTimer() {
|
|
216
|
+
if (this.#postDragSuppressTimer) clearTimeout(this.#postDragSuppressTimer);
|
|
217
|
+
this.#postDragSuppressTimer = window.setTimeout(() => {
|
|
218
|
+
this.#postDragSuppressTimer = 0;
|
|
219
|
+
}, 0);
|
|
220
|
+
}
|
|
147
221
|
/** Live drag-select preview rect (surface-relative); the covered items carry `data-marquee`. */
|
|
148
222
|
#marqueeRect;
|
|
149
223
|
#dragSelect;
|
|
@@ -211,6 +285,10 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
211
285
|
this.#unregisterSearchCommands?.();
|
|
212
286
|
this.#unregisterSearchCommands = void 0;
|
|
213
287
|
this.#searchRegistry = void 0;
|
|
288
|
+
if (this.#postDragSuppressTimer) {
|
|
289
|
+
clearTimeout(this.#postDragSuppressTimer);
|
|
290
|
+
this.#postDragSuppressTimer = 0;
|
|
291
|
+
}
|
|
214
292
|
}
|
|
215
293
|
/**
|
|
216
294
|
* Animate in items appended to the light DOM (however they got there —
|
|
@@ -250,6 +328,10 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
250
328
|
}
|
|
251
329
|
this._syncItemStates();
|
|
252
330
|
} else if (changed.has(`checkboxRenderer`) && this.interactionMode === `checked`) this._syncCheckboxes();
|
|
331
|
+
if (changed.has(`itemsDraggable`) || changed.has(`interactionMode`)) {
|
|
332
|
+
this._syncNativeDraggable();
|
|
333
|
+
this.#nativeDrag.refreshDraggable();
|
|
334
|
+
}
|
|
253
335
|
}
|
|
254
336
|
/** The most recently selected item, or `undefined` if nothing is selected. */
|
|
255
337
|
get selectedItem() {
|
|
@@ -519,6 +601,14 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
519
601
|
composed: true
|
|
520
602
|
}));
|
|
521
603
|
}
|
|
604
|
+
_dispatchCancelable(name, detail) {
|
|
605
|
+
return this.dispatchEvent(new CustomEvent(name, {
|
|
606
|
+
detail,
|
|
607
|
+
bubbles: true,
|
|
608
|
+
composed: true,
|
|
609
|
+
cancelable: true
|
|
610
|
+
}));
|
|
611
|
+
}
|
|
522
612
|
_activateItem(item) {
|
|
523
613
|
if (this.interactionMode !== `manual`) this.selection.replace(item);
|
|
524
614
|
this._dispatch(`list-activate`, { item });
|
|
@@ -654,6 +744,10 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
654
744
|
color: var(--item-text-selected);
|
|
655
745
|
}
|
|
656
746
|
|
|
747
|
+
::slotted([data-drag-origin]) {
|
|
748
|
+
opacity: 0.6;
|
|
749
|
+
}
|
|
750
|
+
|
|
657
751
|
/* checked mode: checkbox (injected into li) communicates selection — suppress bg highlight */
|
|
658
752
|
:host([interaction-mode="checked"]) ::slotted([data-selected]) {
|
|
659
753
|
background: transparent;
|
|
@@ -700,6 +794,12 @@ __decorate([property({
|
|
|
700
794
|
attribute: `search-modes`,
|
|
701
795
|
reflect: true
|
|
702
796
|
})], VerticalListElement.prototype, "searchModes", void 0);
|
|
797
|
+
__decorate([property({
|
|
798
|
+
type: Boolean,
|
|
799
|
+
attribute: `items-draggable`,
|
|
800
|
+
reflect: true
|
|
801
|
+
})], VerticalListElement.prototype, "itemsDraggable", void 0);
|
|
802
|
+
__decorate([property({ attribute: false })], VerticalListElement.prototype, "dragPreviewRenderer", void 0);
|
|
703
803
|
VerticalListElement = __decorate([safeCustomElement(`ixfx-vertical-list`)], VerticalListElement);
|
|
704
804
|
//#endregion
|
|
705
805
|
export { VerticalListElement };
|