@deepfuture/dui-cdn 1.2.0 → 1.3.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/dui.js +799 -12
- package/dui.min.js +802 -539
- package/package.json +1 -1
package/dui.js
CHANGED
|
@@ -18924,12 +18924,799 @@ var DuiTooltipTrigger = class extends DuiTooltipTriggerPrimitive {
|
|
|
18924
18924
|
};
|
|
18925
18925
|
customElements.define(DuiTooltipTrigger.tagName, DuiTooltipTrigger);
|
|
18926
18926
|
|
|
18927
|
-
// ../dui-primitives/packages/primitives/src/
|
|
18927
|
+
// ../dui-primitives/packages/primitives/src/tree/tree-context.ts
|
|
18928
|
+
var treeContext = n8(Symbol("dui-tree"));
|
|
18929
|
+
|
|
18930
|
+
// ../dui-primitives/packages/primitives/src/tree/tree-item.ts
|
|
18931
|
+
var loadChildrenEvent = customEvent(
|
|
18932
|
+
"dui-load-children",
|
|
18933
|
+
{ bubbles: true, composed: true }
|
|
18934
|
+
);
|
|
18928
18935
|
var styles144 = i5`
|
|
18929
18936
|
:host {
|
|
18930
18937
|
display: block;
|
|
18931
18938
|
}
|
|
18932
18939
|
|
|
18940
|
+
[part="root"] {
|
|
18941
|
+
outline: none;
|
|
18942
|
+
}
|
|
18943
|
+
|
|
18944
|
+
[part="content"] {
|
|
18945
|
+
display: flex;
|
|
18946
|
+
align-items: center;
|
|
18947
|
+
}
|
|
18948
|
+
|
|
18949
|
+
[part="indicator"] {
|
|
18950
|
+
display: inline-flex;
|
|
18951
|
+
flex-shrink: 0;
|
|
18952
|
+
align-items: center;
|
|
18953
|
+
justify-content: center;
|
|
18954
|
+
}
|
|
18955
|
+
|
|
18956
|
+
.spacer {
|
|
18957
|
+
flex: 1;
|
|
18958
|
+
min-width: 0;
|
|
18959
|
+
}
|
|
18960
|
+
|
|
18961
|
+
[part="group"][hidden] {
|
|
18962
|
+
display: none;
|
|
18963
|
+
}
|
|
18964
|
+
`;
|
|
18965
|
+
var _hasSlottedChildren_dec, __ctx_dec23, _loading_dec, _hasChildren_dec, _disabled_dec30, _value_dec24, _a61, _init61, _value24, _disabled30, _hasChildren, _loading, __ctx23, _hasSlottedChildren, _b40, hasSlottedChildren_get, hasSlottedChildren_set, _DuiTreeItemPrimitive_instances, _hasFiredLoad, level_get, isExpanded_get, isSelected_get2, isDisabled_get7, isFocused_get, siblings_get, reflect_fn, _onSlotChange, _onRowClick, _onIndicatorClick;
|
|
18966
|
+
var DuiTreeItemPrimitive = class extends (_a61 = i8, _value_dec24 = [n7()], _disabled_dec30 = [n7({ type: Boolean, reflect: true })], _hasChildren_dec = [n7({ type: Boolean, attribute: "has-children", reflect: true })], _loading_dec = [n7({ type: Boolean, reflect: true })], __ctx_dec23 = [c7({ context: treeContext, subscribe: true }), r8()], _hasSlottedChildren_dec = [r8()], _a61) {
|
|
18967
|
+
constructor() {
|
|
18968
|
+
super(...arguments);
|
|
18969
|
+
__privateAdd(this, _DuiTreeItemPrimitive_instances);
|
|
18970
|
+
__privateAdd(this, _value24, __runInitializers(_init61, 8, this, "")), __runInitializers(_init61, 11, this);
|
|
18971
|
+
__privateAdd(this, _disabled30, __runInitializers(_init61, 12, this, false)), __runInitializers(_init61, 15, this);
|
|
18972
|
+
__privateAdd(this, _hasChildren, __runInitializers(_init61, 16, this, false)), __runInitializers(_init61, 19, this);
|
|
18973
|
+
__privateAdd(this, _loading, __runInitializers(_init61, 20, this, false)), __runInitializers(_init61, 23, this);
|
|
18974
|
+
__privateAdd(this, __ctx23, __runInitializers(_init61, 24, this)), __runInitializers(_init61, 27, this);
|
|
18975
|
+
__privateAdd(this, _hasSlottedChildren, __runInitializers(_init61, 28, this, false)), __runInitializers(_init61, 31, this);
|
|
18976
|
+
// Tracks whether we've already fired dui-load-children for this expansion.
|
|
18977
|
+
// Reset when the branch collapses so re-expanding can re-fire if children
|
|
18978
|
+
// are still empty (e.g. previous load failed).
|
|
18979
|
+
__privateAdd(this, _hasFiredLoad, false);
|
|
18980
|
+
// ─── Event handlers ───────────────────────────────────────────────────────
|
|
18981
|
+
__privateAdd(this, _onSlotChange, (e11) => {
|
|
18982
|
+
const slot = e11.target;
|
|
18983
|
+
const has = slot.assignedElements().some((el) => el.tagName === "DUI-TREE-ITEM");
|
|
18984
|
+
if (has !== __privateGet(this, _DuiTreeItemPrimitive_instances, hasSlottedChildren_get)) {
|
|
18985
|
+
__privateSet(this, _DuiTreeItemPrimitive_instances, has, hasSlottedChildren_set);
|
|
18986
|
+
}
|
|
18987
|
+
});
|
|
18988
|
+
/**
|
|
18989
|
+
* Row click. Stops propagation so a click on a nested item doesn't bubble
|
|
18990
|
+
* to ancestor items' click handlers (which would also activate them).
|
|
18991
|
+
*/
|
|
18992
|
+
__privateAdd(this, _onRowClick, (e11) => {
|
|
18993
|
+
e11.stopPropagation();
|
|
18994
|
+
if (__privateGet(this, _DuiTreeItemPrimitive_instances, isDisabled_get7)) return;
|
|
18995
|
+
this._ctx?.activate(this.value, this.isBranch);
|
|
18996
|
+
});
|
|
18997
|
+
/**
|
|
18998
|
+
* Indicator click. Branches: stop propagation + toggle expand. Leaves:
|
|
18999
|
+
* let it bubble to the row handler (treat as row click).
|
|
19000
|
+
*/
|
|
19001
|
+
__privateAdd(this, _onIndicatorClick, (e11) => {
|
|
19002
|
+
if (!this.isBranch) return;
|
|
19003
|
+
e11.stopPropagation();
|
|
19004
|
+
if (__privateGet(this, _DuiTreeItemPrimitive_instances, isDisabled_get7)) return;
|
|
19005
|
+
this._ctx?.toggleExpand(this.value);
|
|
19006
|
+
});
|
|
19007
|
+
}
|
|
19008
|
+
/**
|
|
19009
|
+
* Public: whether this item is treated as a branch — either has slotted
|
|
19010
|
+
* `<dui-tree-item>` children OR has `has-children` set for lazy loading.
|
|
19011
|
+
* Used by the parent tree for keyboard nav and ARIA.
|
|
19012
|
+
*/
|
|
19013
|
+
get isBranch() {
|
|
19014
|
+
return __privateGet(this, _DuiTreeItemPrimitive_instances, hasSlottedChildren_get) || this.hasChildren;
|
|
19015
|
+
}
|
|
19016
|
+
// ─── Lifecycle ────────────────────────────────────────────────────────────
|
|
19017
|
+
willUpdate(_changed) {
|
|
19018
|
+
if (this.isBranch && __privateGet(this, _DuiTreeItemPrimitive_instances, isExpanded_get)) {
|
|
19019
|
+
const empty = !__privateGet(this, _DuiTreeItemPrimitive_instances, hasSlottedChildren_get);
|
|
19020
|
+
if (empty && !__privateGet(this, _hasFiredLoad)) {
|
|
19021
|
+
__privateSet(this, _hasFiredLoad, true);
|
|
19022
|
+
this.dispatchEvent(loadChildrenEvent({ value: this.value }));
|
|
19023
|
+
}
|
|
19024
|
+
} else if (!__privateGet(this, _DuiTreeItemPrimitive_instances, isExpanded_get)) {
|
|
19025
|
+
__privateSet(this, _hasFiredLoad, false);
|
|
19026
|
+
}
|
|
19027
|
+
}
|
|
19028
|
+
updated() {
|
|
19029
|
+
this.style.setProperty("--dui-tree-level", String(__privateGet(this, _DuiTreeItemPrimitive_instances, level_get)));
|
|
19030
|
+
__privateMethod(this, _DuiTreeItemPrimitive_instances, reflect_fn).call(this, "data-expanded", __privateGet(this, _DuiTreeItemPrimitive_instances, isExpanded_get) && this.isBranch);
|
|
19031
|
+
__privateMethod(this, _DuiTreeItemPrimitive_instances, reflect_fn).call(this, "data-selected", __privateGet(this, _DuiTreeItemPrimitive_instances, isSelected_get2));
|
|
19032
|
+
__privateMethod(this, _DuiTreeItemPrimitive_instances, reflect_fn).call(this, "data-disabled", __privateGet(this, _DuiTreeItemPrimitive_instances, isDisabled_get7));
|
|
19033
|
+
__privateMethod(this, _DuiTreeItemPrimitive_instances, reflect_fn).call(this, "data-branch", this.isBranch);
|
|
19034
|
+
__privateMethod(this, _DuiTreeItemPrimitive_instances, reflect_fn).call(this, "data-leaf", !this.isBranch);
|
|
19035
|
+
__privateMethod(this, _DuiTreeItemPrimitive_instances, reflect_fn).call(this, "data-focus", __privateGet(this, _DuiTreeItemPrimitive_instances, isFocused_get));
|
|
19036
|
+
__privateMethod(this, _DuiTreeItemPrimitive_instances, reflect_fn).call(this, "data-loading", this.loading);
|
|
19037
|
+
this.setAttribute("data-level", String(__privateGet(this, _DuiTreeItemPrimitive_instances, level_get)));
|
|
19038
|
+
if (this.loading) {
|
|
19039
|
+
this.setAttribute("aria-busy", "true");
|
|
19040
|
+
} else {
|
|
19041
|
+
this.removeAttribute("aria-busy");
|
|
19042
|
+
}
|
|
19043
|
+
}
|
|
19044
|
+
// ─── Render ───────────────────────────────────────────────────────────────
|
|
19045
|
+
render() {
|
|
19046
|
+
const isBranch = this.isBranch;
|
|
19047
|
+
const isExpanded = __privateGet(this, _DuiTreeItemPrimitive_instances, isExpanded_get) && isBranch;
|
|
19048
|
+
const isDisabled = __privateGet(this, _DuiTreeItemPrimitive_instances, isDisabled_get7);
|
|
19049
|
+
const isSelected = __privateGet(this, _DuiTreeItemPrimitive_instances, isSelected_get2);
|
|
19050
|
+
const isFocused = __privateGet(this, _DuiTreeItemPrimitive_instances, isFocused_get);
|
|
19051
|
+
const isLoading = this.loading;
|
|
19052
|
+
const level = __privateGet(this, _DuiTreeItemPrimitive_instances, level_get);
|
|
19053
|
+
const siblings = __privateGet(this, _DuiTreeItemPrimitive_instances, siblings_get);
|
|
19054
|
+
const selectionMode = this._ctx?.selectionMode ?? "none";
|
|
19055
|
+
return b4`
|
|
19056
|
+
<div
|
|
19057
|
+
part="root"
|
|
19058
|
+
role="treeitem"
|
|
19059
|
+
tabindex=${isFocused ? 0 : -1}
|
|
19060
|
+
aria-level=${level}
|
|
19061
|
+
aria-setsize=${siblings.length}
|
|
19062
|
+
aria-posinset=${siblings.indexOf(this) + 1}
|
|
19063
|
+
aria-expanded=${isBranch ? String(isExpanded) : A2}
|
|
19064
|
+
aria-selected=${selectionMode !== "none" ? String(isSelected) : A2}
|
|
19065
|
+
aria-disabled=${isDisabled ? "true" : A2}
|
|
19066
|
+
aria-busy=${isLoading ? "true" : A2}
|
|
19067
|
+
data-level=${level}
|
|
19068
|
+
?data-expanded=${isExpanded}
|
|
19069
|
+
?data-selected=${isSelected}
|
|
19070
|
+
?data-disabled=${isDisabled}
|
|
19071
|
+
?data-branch=${isBranch}
|
|
19072
|
+
?data-leaf=${!isBranch}
|
|
19073
|
+
?data-focus=${isFocused}
|
|
19074
|
+
?data-loading=${isLoading}
|
|
19075
|
+
@click=${__privateGet(this, _onRowClick)}
|
|
19076
|
+
>
|
|
19077
|
+
<div part="content">
|
|
19078
|
+
<span
|
|
19079
|
+
part="indicator"
|
|
19080
|
+
?data-branch=${isBranch}
|
|
19081
|
+
?data-leaf=${!isBranch}
|
|
19082
|
+
?data-loading=${isLoading}
|
|
19083
|
+
@click=${__privateGet(this, _onIndicatorClick)}
|
|
19084
|
+
></span>
|
|
19085
|
+
<slot name="label"></slot>
|
|
19086
|
+
<span class="spacer"></span>
|
|
19087
|
+
<slot name="end"></slot>
|
|
19088
|
+
</div>
|
|
19089
|
+
<div
|
|
19090
|
+
part="group"
|
|
19091
|
+
role=${isBranch ? "group" : A2}
|
|
19092
|
+
?hidden=${!isBranch || !isExpanded}
|
|
19093
|
+
>
|
|
19094
|
+
<slot @slotchange=${__privateGet(this, _onSlotChange)}></slot>
|
|
19095
|
+
</div>
|
|
19096
|
+
</div>
|
|
19097
|
+
`;
|
|
19098
|
+
}
|
|
19099
|
+
};
|
|
19100
|
+
_init61 = __decoratorStart(_a61);
|
|
19101
|
+
_value24 = new WeakMap();
|
|
19102
|
+
_disabled30 = new WeakMap();
|
|
19103
|
+
_hasChildren = new WeakMap();
|
|
19104
|
+
_loading = new WeakMap();
|
|
19105
|
+
__ctx23 = new WeakMap();
|
|
19106
|
+
_hasSlottedChildren = new WeakMap();
|
|
19107
|
+
_DuiTreeItemPrimitive_instances = new WeakSet();
|
|
19108
|
+
_hasFiredLoad = new WeakMap();
|
|
19109
|
+
level_get = function() {
|
|
19110
|
+
let level = 1;
|
|
19111
|
+
let el = this.parentElement;
|
|
19112
|
+
while (el) {
|
|
19113
|
+
if (el.tagName === "DUI-TREE-ITEM") level++;
|
|
19114
|
+
if (el.tagName === "DUI-TREE") break;
|
|
19115
|
+
el = el.parentElement;
|
|
19116
|
+
}
|
|
19117
|
+
return level;
|
|
19118
|
+
};
|
|
19119
|
+
isExpanded_get = function() {
|
|
19120
|
+
return this._ctx?.expandedValues.includes(this.value) ?? false;
|
|
19121
|
+
};
|
|
19122
|
+
isSelected_get2 = function() {
|
|
19123
|
+
return this._ctx?.selectedValues.includes(this.value) ?? false;
|
|
19124
|
+
};
|
|
19125
|
+
isDisabled_get7 = function() {
|
|
19126
|
+
if (this.disabled) return true;
|
|
19127
|
+
if (this._ctx?.disabled) return true;
|
|
19128
|
+
let el = this.parentElement;
|
|
19129
|
+
while (el) {
|
|
19130
|
+
if (el.tagName === "DUI-TREE") break;
|
|
19131
|
+
if (el.tagName === "DUI-TREE-ITEM" && el.hasAttribute("disabled")) {
|
|
19132
|
+
return true;
|
|
19133
|
+
}
|
|
19134
|
+
el = el.parentElement;
|
|
19135
|
+
}
|
|
19136
|
+
return false;
|
|
19137
|
+
};
|
|
19138
|
+
isFocused_get = function() {
|
|
19139
|
+
return this._ctx?.focusedValue === this.value;
|
|
19140
|
+
};
|
|
19141
|
+
siblings_get = function() {
|
|
19142
|
+
return Array.from(this.parentElement?.children ?? []).filter(
|
|
19143
|
+
(el) => el.tagName === "DUI-TREE-ITEM"
|
|
19144
|
+
);
|
|
19145
|
+
};
|
|
19146
|
+
reflect_fn = function(name, on) {
|
|
19147
|
+
if (on) {
|
|
19148
|
+
if (!this.hasAttribute(name)) this.setAttribute(name, "");
|
|
19149
|
+
} else if (this.hasAttribute(name)) {
|
|
19150
|
+
this.removeAttribute(name);
|
|
19151
|
+
}
|
|
19152
|
+
};
|
|
19153
|
+
_onSlotChange = new WeakMap();
|
|
19154
|
+
_onRowClick = new WeakMap();
|
|
19155
|
+
_onIndicatorClick = new WeakMap();
|
|
19156
|
+
__decorateElement(_init61, 4, "value", _value_dec24, DuiTreeItemPrimitive, _value24);
|
|
19157
|
+
__decorateElement(_init61, 4, "disabled", _disabled_dec30, DuiTreeItemPrimitive, _disabled30);
|
|
19158
|
+
__decorateElement(_init61, 4, "hasChildren", _hasChildren_dec, DuiTreeItemPrimitive, _hasChildren);
|
|
19159
|
+
__decorateElement(_init61, 4, "loading", _loading_dec, DuiTreeItemPrimitive, _loading);
|
|
19160
|
+
__decorateElement(_init61, 4, "_ctx", __ctx_dec23, DuiTreeItemPrimitive, __ctx23);
|
|
19161
|
+
_b40 = __decorateElement(_init61, 20, "#hasSlottedChildren", _hasSlottedChildren_dec, _DuiTreeItemPrimitive_instances, _hasSlottedChildren), hasSlottedChildren_get = _b40.get, hasSlottedChildren_set = _b40.set;
|
|
19162
|
+
__decoratorMetadata(_init61, DuiTreeItemPrimitive);
|
|
19163
|
+
__publicField(DuiTreeItemPrimitive, "tagName", "dui-tree-item");
|
|
19164
|
+
__publicField(DuiTreeItemPrimitive, "styles", [base, styles144]);
|
|
19165
|
+
|
|
19166
|
+
// ../dui-primitives/packages/primitives/src/tree/tree.ts
|
|
19167
|
+
var expandedChangeEvent = customEvent(
|
|
19168
|
+
"dui-expanded-change",
|
|
19169
|
+
{ bubbles: true, composed: true }
|
|
19170
|
+
);
|
|
19171
|
+
var selectionChangeEvent = customEvent(
|
|
19172
|
+
"dui-selection-change",
|
|
19173
|
+
{ bubbles: true, composed: true }
|
|
19174
|
+
);
|
|
19175
|
+
var actionEvent2 = customEvent(
|
|
19176
|
+
"dui-action",
|
|
19177
|
+
{ bubbles: true, composed: true }
|
|
19178
|
+
);
|
|
19179
|
+
var styles145 = i5`
|
|
19180
|
+
:host {
|
|
19181
|
+
display: block;
|
|
19182
|
+
}
|
|
19183
|
+
|
|
19184
|
+
[part="root"] {
|
|
19185
|
+
outline: none;
|
|
19186
|
+
}
|
|
19187
|
+
`;
|
|
19188
|
+
var __ctx_dec24, _focusedValue_dec, _internalSelected_dec, _internalExpanded_dec, _disabled_dec31, _defaultSelectedValues_dec, _selectedValues_dec, _selectionMode_dec, _defaultExpandedValues_dec, _expandedValues_dec, _a62, _init62, _expandedValues, _defaultExpandedValues, _selectionMode, _selectedValues, _defaultSelectedValues, _disabled31, _internalExpanded, _b41, internalExpanded_get, internalExpanded_set, _DuiTreePrimitive_instances, _internalSelected, _c20, internalSelected_get, internalSelected_set, _focusedValue, _d12, focusedValue_get, focusedValue_set, _typeAheadBuffer, _typeAheadTimeout, _observer, _getExpanded, _getSelected, _toggleExpand, _toggleSelect, _activate, _setFocused, __ctx24, buildContext_fn11, getAllItems_fn, getItem_fn, getVisibleItems_fn2, isVisible_fn, getParentItem_fn, focusItem_fn, findItemFromEvent_fn, _onFocusIn2, _onKeyDown10, expandSiblings_fn, typeAhead_fn;
|
|
19189
|
+
var DuiTreePrimitive = class extends (_a62 = i8, _expandedValues_dec = [n7({ type: Array })], _defaultExpandedValues_dec = [n7({ type: Array, attribute: "default-expanded-values" })], _selectionMode_dec = [n7({ attribute: "selection-mode", reflect: true })], _selectedValues_dec = [n7({ type: Array })], _defaultSelectedValues_dec = [n7({ type: Array, attribute: "default-selected-values" })], _disabled_dec31 = [n7({ type: Boolean, reflect: true })], _internalExpanded_dec = [r8()], _internalSelected_dec = [r8()], _focusedValue_dec = [r8()], __ctx_dec24 = [e9({ context: treeContext }), r8()], _a62) {
|
|
19190
|
+
constructor() {
|
|
19191
|
+
super(...arguments);
|
|
19192
|
+
__privateAdd(this, _DuiTreePrimitive_instances);
|
|
19193
|
+
__privateAdd(this, _expandedValues, __runInitializers(_init62, 8, this)), __runInitializers(_init62, 11, this);
|
|
19194
|
+
__privateAdd(this, _defaultExpandedValues, __runInitializers(_init62, 12, this, [])), __runInitializers(_init62, 15, this);
|
|
19195
|
+
__privateAdd(this, _selectionMode, __runInitializers(_init62, 16, this, "none")), __runInitializers(_init62, 19, this);
|
|
19196
|
+
__privateAdd(this, _selectedValues, __runInitializers(_init62, 20, this)), __runInitializers(_init62, 23, this);
|
|
19197
|
+
__privateAdd(this, _defaultSelectedValues, __runInitializers(_init62, 24, this, [])), __runInitializers(_init62, 27, this);
|
|
19198
|
+
__privateAdd(this, _disabled31, __runInitializers(_init62, 28, this, false)), __runInitializers(_init62, 31, this);
|
|
19199
|
+
__privateAdd(this, _internalExpanded, __runInitializers(_init62, 32, this, [])), __runInitializers(_init62, 35, this);
|
|
19200
|
+
__privateAdd(this, _internalSelected, __runInitializers(_init62, 36, this, [])), __runInitializers(_init62, 39, this);
|
|
19201
|
+
__privateAdd(this, _focusedValue, __runInitializers(_init62, 40, this, null)), __runInitializers(_init62, 43, this);
|
|
19202
|
+
// Type-ahead buffer
|
|
19203
|
+
__privateAdd(this, _typeAheadBuffer, "");
|
|
19204
|
+
__privateAdd(this, _typeAheadTimeout, null);
|
|
19205
|
+
// Watches descendant tree-items for `disabled` attr changes (so descendants
|
|
19206
|
+
// re-evaluate their inherited disabled state) and for childList changes (so
|
|
19207
|
+
// initial-focus init catches late-added items, e.g. async-loaded children).
|
|
19208
|
+
__privateAdd(this, _observer, null);
|
|
19209
|
+
// ─── State accessors (controlled vs uncontrolled) ─────────────────────────
|
|
19210
|
+
__privateAdd(this, _getExpanded, () => this.expandedValues ?? __privateGet(this, _DuiTreePrimitive_instances, internalExpanded_get));
|
|
19211
|
+
__privateAdd(this, _getSelected, () => this.selectedValues ?? __privateGet(this, _DuiTreePrimitive_instances, internalSelected_get));
|
|
19212
|
+
// ─── Mutations exposed via context ────────────────────────────────────────
|
|
19213
|
+
__privateAdd(this, _toggleExpand, (value) => {
|
|
19214
|
+
const current = [...__privateGet(this, _getExpanded).call(this)];
|
|
19215
|
+
const idx = current.indexOf(value);
|
|
19216
|
+
const next = idx >= 0 ? current.filter((v4) => v4 !== value) : [...current, value];
|
|
19217
|
+
if (this.expandedValues === void 0) {
|
|
19218
|
+
__privateSet(this, _DuiTreePrimitive_instances, next, internalExpanded_set);
|
|
19219
|
+
}
|
|
19220
|
+
this.dispatchEvent(expandedChangeEvent({ values: next }));
|
|
19221
|
+
});
|
|
19222
|
+
__privateAdd(this, _toggleSelect, (value) => {
|
|
19223
|
+
const current = [...__privateGet(this, _getSelected).call(this)];
|
|
19224
|
+
const idx = current.indexOf(value);
|
|
19225
|
+
let next;
|
|
19226
|
+
if (this.selectionMode === "single") {
|
|
19227
|
+
next = idx >= 0 ? [] : [value];
|
|
19228
|
+
} else {
|
|
19229
|
+
next = idx >= 0 ? current.filter((v4) => v4 !== value) : [...current, value];
|
|
19230
|
+
}
|
|
19231
|
+
if (this.selectedValues === void 0) {
|
|
19232
|
+
__privateSet(this, _DuiTreePrimitive_instances, next, internalSelected_set);
|
|
19233
|
+
}
|
|
19234
|
+
this.dispatchEvent(selectionChangeEvent({ values: next }));
|
|
19235
|
+
});
|
|
19236
|
+
/**
|
|
19237
|
+
* Activate an item:
|
|
19238
|
+
* - selectionMode != "none" → toggle selection (works for branches AND leaves).
|
|
19239
|
+
* Branches are still expandable via the indicator or Arrow keys.
|
|
19240
|
+
* - selectionMode == "none" + branch → toggle expand.
|
|
19241
|
+
* - selectionMode == "none" + leaf → fire `dui-action`.
|
|
19242
|
+
*/
|
|
19243
|
+
__privateAdd(this, _activate, (value, isBranch) => {
|
|
19244
|
+
if (this.disabled) return;
|
|
19245
|
+
if (this.selectionMode !== "none") {
|
|
19246
|
+
__privateGet(this, _toggleSelect).call(this, value);
|
|
19247
|
+
} else if (isBranch) {
|
|
19248
|
+
__privateGet(this, _toggleExpand).call(this, value);
|
|
19249
|
+
} else {
|
|
19250
|
+
this.dispatchEvent(actionEvent2({ value }));
|
|
19251
|
+
}
|
|
19252
|
+
});
|
|
19253
|
+
__privateAdd(this, _setFocused, (value) => {
|
|
19254
|
+
if (__privateGet(this, _DuiTreePrimitive_instances, focusedValue_get) !== value) __privateSet(this, _DuiTreePrimitive_instances, value, focusedValue_set);
|
|
19255
|
+
});
|
|
19256
|
+
__privateAdd(this, __ctx24, __runInitializers(_init62, 44, this, __privateMethod(this, _DuiTreePrimitive_instances, buildContext_fn11).call(this))), __runInitializers(_init62, 47, this);
|
|
19257
|
+
__privateAdd(this, _onFocusIn2, (e11) => {
|
|
19258
|
+
const item = __privateMethod(this, _DuiTreePrimitive_instances, findItemFromEvent_fn).call(this, e11);
|
|
19259
|
+
if (item) __privateGet(this, _setFocused).call(this, item.value);
|
|
19260
|
+
});
|
|
19261
|
+
__privateAdd(this, _onKeyDown10, (e11) => {
|
|
19262
|
+
if (this.disabled) return;
|
|
19263
|
+
const item = __privateMethod(this, _DuiTreePrimitive_instances, findItemFromEvent_fn).call(this, e11);
|
|
19264
|
+
if (!item) return;
|
|
19265
|
+
const visible = __privateMethod(this, _DuiTreePrimitive_instances, getVisibleItems_fn2).call(this);
|
|
19266
|
+
const idx = visible.indexOf(item);
|
|
19267
|
+
switch (e11.key) {
|
|
19268
|
+
case "ArrowDown": {
|
|
19269
|
+
e11.preventDefault();
|
|
19270
|
+
if (idx < visible.length - 1) __privateMethod(this, _DuiTreePrimitive_instances, focusItem_fn).call(this, visible[idx + 1]);
|
|
19271
|
+
break;
|
|
19272
|
+
}
|
|
19273
|
+
case "ArrowUp": {
|
|
19274
|
+
e11.preventDefault();
|
|
19275
|
+
if (idx > 0) __privateMethod(this, _DuiTreePrimitive_instances, focusItem_fn).call(this, visible[idx - 1]);
|
|
19276
|
+
break;
|
|
19277
|
+
}
|
|
19278
|
+
case "ArrowRight": {
|
|
19279
|
+
e11.preventDefault();
|
|
19280
|
+
if (!item.isBranch) break;
|
|
19281
|
+
if (!__privateGet(this, _getExpanded).call(this).includes(item.value)) {
|
|
19282
|
+
__privateGet(this, _toggleExpand).call(this, item.value);
|
|
19283
|
+
} else if (idx < visible.length - 1) {
|
|
19284
|
+
__privateMethod(this, _DuiTreePrimitive_instances, focusItem_fn).call(this, visible[idx + 1]);
|
|
19285
|
+
}
|
|
19286
|
+
break;
|
|
19287
|
+
}
|
|
19288
|
+
case "ArrowLeft": {
|
|
19289
|
+
e11.preventDefault();
|
|
19290
|
+
if (item.isBranch && __privateGet(this, _getExpanded).call(this).includes(item.value)) {
|
|
19291
|
+
__privateGet(this, _toggleExpand).call(this, item.value);
|
|
19292
|
+
} else {
|
|
19293
|
+
const parent = __privateMethod(this, _DuiTreePrimitive_instances, getParentItem_fn).call(this, item);
|
|
19294
|
+
if (parent) __privateMethod(this, _DuiTreePrimitive_instances, focusItem_fn).call(this, parent);
|
|
19295
|
+
}
|
|
19296
|
+
break;
|
|
19297
|
+
}
|
|
19298
|
+
case "Enter":
|
|
19299
|
+
case " ": {
|
|
19300
|
+
e11.preventDefault();
|
|
19301
|
+
if (!item.disabled) __privateGet(this, _activate).call(this, item.value, item.isBranch);
|
|
19302
|
+
break;
|
|
19303
|
+
}
|
|
19304
|
+
case "Home": {
|
|
19305
|
+
e11.preventDefault();
|
|
19306
|
+
if (visible[0]) __privateMethod(this, _DuiTreePrimitive_instances, focusItem_fn).call(this, visible[0]);
|
|
19307
|
+
break;
|
|
19308
|
+
}
|
|
19309
|
+
case "End": {
|
|
19310
|
+
e11.preventDefault();
|
|
19311
|
+
const last = visible[visible.length - 1];
|
|
19312
|
+
if (last) __privateMethod(this, _DuiTreePrimitive_instances, focusItem_fn).call(this, last);
|
|
19313
|
+
break;
|
|
19314
|
+
}
|
|
19315
|
+
case "*": {
|
|
19316
|
+
e11.preventDefault();
|
|
19317
|
+
__privateMethod(this, _DuiTreePrimitive_instances, expandSiblings_fn).call(this, item);
|
|
19318
|
+
break;
|
|
19319
|
+
}
|
|
19320
|
+
default: {
|
|
19321
|
+
if (e11.key.length === 1 && !e11.ctrlKey && !e11.metaKey && !e11.altKey) {
|
|
19322
|
+
__privateMethod(this, _DuiTreePrimitive_instances, typeAhead_fn).call(this, item, e11.key);
|
|
19323
|
+
}
|
|
19324
|
+
}
|
|
19325
|
+
}
|
|
19326
|
+
});
|
|
19327
|
+
}
|
|
19328
|
+
// ─── Lifecycle ────────────────────────────────────────────────────────────
|
|
19329
|
+
connectedCallback() {
|
|
19330
|
+
super.connectedCallback();
|
|
19331
|
+
if (!this.hasAttribute("role")) {
|
|
19332
|
+
this.setAttribute("role", "tree");
|
|
19333
|
+
}
|
|
19334
|
+
if (this.expandedValues === void 0 && this.defaultExpandedValues.length > 0) {
|
|
19335
|
+
__privateSet(this, _DuiTreePrimitive_instances, [...this.defaultExpandedValues], internalExpanded_set);
|
|
19336
|
+
}
|
|
19337
|
+
if (this.selectedValues === void 0 && this.defaultSelectedValues.length > 0) {
|
|
19338
|
+
__privateSet(this, _DuiTreePrimitive_instances, [...this.defaultSelectedValues], internalSelected_set);
|
|
19339
|
+
}
|
|
19340
|
+
this._ctx = __privateMethod(this, _DuiTreePrimitive_instances, buildContext_fn11).call(this);
|
|
19341
|
+
__privateSet(this, _observer, new MutationObserver(() => this.requestUpdate()));
|
|
19342
|
+
__privateGet(this, _observer).observe(this, {
|
|
19343
|
+
childList: true,
|
|
19344
|
+
subtree: true,
|
|
19345
|
+
attributes: true,
|
|
19346
|
+
attributeFilter: ["disabled"]
|
|
19347
|
+
});
|
|
19348
|
+
}
|
|
19349
|
+
disconnectedCallback() {
|
|
19350
|
+
super.disconnectedCallback();
|
|
19351
|
+
__privateGet(this, _observer)?.disconnect();
|
|
19352
|
+
__privateSet(this, _observer, null);
|
|
19353
|
+
if (__privateGet(this, _typeAheadTimeout)) clearTimeout(__privateGet(this, _typeAheadTimeout));
|
|
19354
|
+
__privateSet(this, _typeAheadTimeout, null);
|
|
19355
|
+
__privateSet(this, _typeAheadBuffer, "");
|
|
19356
|
+
}
|
|
19357
|
+
willUpdate(changed) {
|
|
19358
|
+
if (this.selectionMode === "multiple") {
|
|
19359
|
+
this.setAttribute("aria-multiselectable", "true");
|
|
19360
|
+
} else {
|
|
19361
|
+
this.removeAttribute("aria-multiselectable");
|
|
19362
|
+
}
|
|
19363
|
+
if (changed.has("selectionMode") && this.selectedValues === void 0) {
|
|
19364
|
+
const current = __privateGet(this, _DuiTreePrimitive_instances, internalSelected_get);
|
|
19365
|
+
if (this.selectionMode === "none" && current.length > 0) {
|
|
19366
|
+
__privateSet(this, _DuiTreePrimitive_instances, [], internalSelected_set);
|
|
19367
|
+
} else if (this.selectionMode === "single" && current.length > 1) {
|
|
19368
|
+
__privateSet(this, _DuiTreePrimitive_instances, [current[0]], internalSelected_set);
|
|
19369
|
+
}
|
|
19370
|
+
}
|
|
19371
|
+
this._ctx = __privateMethod(this, _DuiTreePrimitive_instances, buildContext_fn11).call(this);
|
|
19372
|
+
}
|
|
19373
|
+
updated() {
|
|
19374
|
+
if (__privateGet(this, _DuiTreePrimitive_instances, focusedValue_get) === null) {
|
|
19375
|
+
const first = __privateMethod(this, _DuiTreePrimitive_instances, getVisibleItems_fn2).call(this).find((i13) => !i13.disabled);
|
|
19376
|
+
if (first) __privateSet(this, _DuiTreePrimitive_instances, first.value, focusedValue_set);
|
|
19377
|
+
}
|
|
19378
|
+
}
|
|
19379
|
+
render() {
|
|
19380
|
+
return b4`
|
|
19381
|
+
<div
|
|
19382
|
+
part="root"
|
|
19383
|
+
?data-disabled=${this.disabled}
|
|
19384
|
+
@keydown=${__privateGet(this, _onKeyDown10)}
|
|
19385
|
+
@focusin=${__privateGet(this, _onFocusIn2)}
|
|
19386
|
+
>
|
|
19387
|
+
<slot></slot>
|
|
19388
|
+
</div>
|
|
19389
|
+
`;
|
|
19390
|
+
}
|
|
19391
|
+
};
|
|
19392
|
+
_init62 = __decoratorStart(_a62);
|
|
19393
|
+
_expandedValues = new WeakMap();
|
|
19394
|
+
_defaultExpandedValues = new WeakMap();
|
|
19395
|
+
_selectionMode = new WeakMap();
|
|
19396
|
+
_selectedValues = new WeakMap();
|
|
19397
|
+
_defaultSelectedValues = new WeakMap();
|
|
19398
|
+
_disabled31 = new WeakMap();
|
|
19399
|
+
_internalExpanded = new WeakMap();
|
|
19400
|
+
_DuiTreePrimitive_instances = new WeakSet();
|
|
19401
|
+
_internalSelected = new WeakMap();
|
|
19402
|
+
_focusedValue = new WeakMap();
|
|
19403
|
+
_typeAheadBuffer = new WeakMap();
|
|
19404
|
+
_typeAheadTimeout = new WeakMap();
|
|
19405
|
+
_observer = new WeakMap();
|
|
19406
|
+
_getExpanded = new WeakMap();
|
|
19407
|
+
_getSelected = new WeakMap();
|
|
19408
|
+
_toggleExpand = new WeakMap();
|
|
19409
|
+
_toggleSelect = new WeakMap();
|
|
19410
|
+
_activate = new WeakMap();
|
|
19411
|
+
_setFocused = new WeakMap();
|
|
19412
|
+
__ctx24 = new WeakMap();
|
|
19413
|
+
buildContext_fn11 = function() {
|
|
19414
|
+
return {
|
|
19415
|
+
expandedValues: __privateGet(this, _getExpanded).call(this),
|
|
19416
|
+
selectedValues: __privateGet(this, _getSelected).call(this),
|
|
19417
|
+
selectionMode: this.selectionMode,
|
|
19418
|
+
disabled: this.disabled,
|
|
19419
|
+
focusedValue: __privateGet(this, _DuiTreePrimitive_instances, focusedValue_get),
|
|
19420
|
+
toggleExpand: __privateGet(this, _toggleExpand),
|
|
19421
|
+
activate: __privateGet(this, _activate),
|
|
19422
|
+
setFocused: __privateGet(this, _setFocused)
|
|
19423
|
+
};
|
|
19424
|
+
};
|
|
19425
|
+
// ─── Item discovery (light DOM, document order) ───────────────────────────
|
|
19426
|
+
getAllItems_fn = function() {
|
|
19427
|
+
return [
|
|
19428
|
+
...this.querySelectorAll("dui-tree-item")
|
|
19429
|
+
];
|
|
19430
|
+
};
|
|
19431
|
+
getItem_fn = function(value) {
|
|
19432
|
+
return __privateMethod(this, _DuiTreePrimitive_instances, getAllItems_fn).call(this).find((i13) => i13.value === value);
|
|
19433
|
+
};
|
|
19434
|
+
getVisibleItems_fn2 = function() {
|
|
19435
|
+
return __privateMethod(this, _DuiTreePrimitive_instances, getAllItems_fn).call(this).filter((i13) => __privateMethod(this, _DuiTreePrimitive_instances, isVisible_fn).call(this, i13));
|
|
19436
|
+
};
|
|
19437
|
+
isVisible_fn = function(item) {
|
|
19438
|
+
let el = item.parentElement;
|
|
19439
|
+
while (el) {
|
|
19440
|
+
if (el === this) return true;
|
|
19441
|
+
if (el instanceof DuiTreeItemPrimitive && !__privateGet(this, _getExpanded).call(this).includes(el.value)) {
|
|
19442
|
+
return false;
|
|
19443
|
+
}
|
|
19444
|
+
el = el.parentElement;
|
|
19445
|
+
}
|
|
19446
|
+
return false;
|
|
19447
|
+
};
|
|
19448
|
+
getParentItem_fn = function(item) {
|
|
19449
|
+
let el = item.parentElement;
|
|
19450
|
+
while (el) {
|
|
19451
|
+
if (el === this) return null;
|
|
19452
|
+
if (el instanceof DuiTreeItemPrimitive) return el;
|
|
19453
|
+
el = el.parentElement;
|
|
19454
|
+
}
|
|
19455
|
+
return null;
|
|
19456
|
+
};
|
|
19457
|
+
// ─── Focus management ─────────────────────────────────────────────────────
|
|
19458
|
+
focusItem_fn = function(item) {
|
|
19459
|
+
__privateSet(this, _DuiTreePrimitive_instances, item.value, focusedValue_set);
|
|
19460
|
+
const inner = item.shadowRoot?.querySelector(
|
|
19461
|
+
"[part='root']"
|
|
19462
|
+
);
|
|
19463
|
+
inner?.focus();
|
|
19464
|
+
};
|
|
19465
|
+
// ─── Event handlers ───────────────────────────────────────────────────────
|
|
19466
|
+
findItemFromEvent_fn = function(e11) {
|
|
19467
|
+
return e11.composedPath().find(
|
|
19468
|
+
(el) => el instanceof DuiTreeItemPrimitive
|
|
19469
|
+
) ?? null;
|
|
19470
|
+
};
|
|
19471
|
+
_onFocusIn2 = new WeakMap();
|
|
19472
|
+
_onKeyDown10 = new WeakMap();
|
|
19473
|
+
expandSiblings_fn = function(item) {
|
|
19474
|
+
const siblings = Array.from(item.parentElement?.children ?? []).filter(
|
|
19475
|
+
(el) => el instanceof DuiTreeItemPrimitive && el.isBranch && !el.disabled
|
|
19476
|
+
);
|
|
19477
|
+
const current = __privateGet(this, _getExpanded).call(this);
|
|
19478
|
+
const toAdd = siblings.map((s11) => s11.value).filter((v4) => !current.includes(v4));
|
|
19479
|
+
if (toAdd.length === 0) return;
|
|
19480
|
+
const next = [...current, ...toAdd];
|
|
19481
|
+
if (this.expandedValues === void 0) {
|
|
19482
|
+
__privateSet(this, _DuiTreePrimitive_instances, next, internalExpanded_set);
|
|
19483
|
+
}
|
|
19484
|
+
this.dispatchEvent(expandedChangeEvent({ values: next }));
|
|
19485
|
+
};
|
|
19486
|
+
typeAhead_fn = function(from, char) {
|
|
19487
|
+
__privateSet(this, _typeAheadBuffer, __privateGet(this, _typeAheadBuffer) + char.toLowerCase());
|
|
19488
|
+
if (__privateGet(this, _typeAheadTimeout)) clearTimeout(__privateGet(this, _typeAheadTimeout));
|
|
19489
|
+
__privateSet(this, _typeAheadTimeout, setTimeout(() => {
|
|
19490
|
+
__privateSet(this, _typeAheadBuffer, "");
|
|
19491
|
+
__privateSet(this, _typeAheadTimeout, null);
|
|
19492
|
+
}, 500));
|
|
19493
|
+
const visible = __privateMethod(this, _DuiTreePrimitive_instances, getVisibleItems_fn2).call(this);
|
|
19494
|
+
const fromIdx = visible.indexOf(from);
|
|
19495
|
+
const ordered = [
|
|
19496
|
+
...visible.slice(fromIdx + 1),
|
|
19497
|
+
...visible.slice(0, fromIdx + 1)
|
|
19498
|
+
];
|
|
19499
|
+
const match = ordered.find((it) => {
|
|
19500
|
+
const label = it.querySelector("[slot='label']")?.textContent?.trim().toLowerCase() ?? "";
|
|
19501
|
+
return label.startsWith(__privateGet(this, _typeAheadBuffer));
|
|
19502
|
+
});
|
|
19503
|
+
if (match) __privateMethod(this, _DuiTreePrimitive_instances, focusItem_fn).call(this, match);
|
|
19504
|
+
};
|
|
19505
|
+
__decorateElement(_init62, 4, "expandedValues", _expandedValues_dec, DuiTreePrimitive, _expandedValues);
|
|
19506
|
+
__decorateElement(_init62, 4, "defaultExpandedValues", _defaultExpandedValues_dec, DuiTreePrimitive, _defaultExpandedValues);
|
|
19507
|
+
__decorateElement(_init62, 4, "selectionMode", _selectionMode_dec, DuiTreePrimitive, _selectionMode);
|
|
19508
|
+
__decorateElement(_init62, 4, "selectedValues", _selectedValues_dec, DuiTreePrimitive, _selectedValues);
|
|
19509
|
+
__decorateElement(_init62, 4, "defaultSelectedValues", _defaultSelectedValues_dec, DuiTreePrimitive, _defaultSelectedValues);
|
|
19510
|
+
__decorateElement(_init62, 4, "disabled", _disabled_dec31, DuiTreePrimitive, _disabled31);
|
|
19511
|
+
_b41 = __decorateElement(_init62, 20, "#internalExpanded", _internalExpanded_dec, _DuiTreePrimitive_instances, _internalExpanded), internalExpanded_get = _b41.get, internalExpanded_set = _b41.set;
|
|
19512
|
+
_c20 = __decorateElement(_init62, 20, "#internalSelected", _internalSelected_dec, _DuiTreePrimitive_instances, _internalSelected), internalSelected_get = _c20.get, internalSelected_set = _c20.set;
|
|
19513
|
+
_d12 = __decorateElement(_init62, 20, "#focusedValue", _focusedValue_dec, _DuiTreePrimitive_instances, _focusedValue), focusedValue_get = _d12.get, focusedValue_set = _d12.set;
|
|
19514
|
+
__decorateElement(_init62, 4, "_ctx", __ctx_dec24, DuiTreePrimitive, __ctx24);
|
|
19515
|
+
__decoratorMetadata(_init62, DuiTreePrimitive);
|
|
19516
|
+
__publicField(DuiTreePrimitive, "tagName", "dui-tree");
|
|
19517
|
+
__publicField(DuiTreePrimitive, "styles", [base, styles145]);
|
|
19518
|
+
|
|
19519
|
+
// packages/components/src/tree/tree.ts
|
|
19520
|
+
var styles146 = i`
|
|
19521
|
+
/* ── Sizes — write to public tokens on :host so consumer overrides win ── */
|
|
19522
|
+
|
|
19523
|
+
:host {
|
|
19524
|
+
/* Default = sm */
|
|
19525
|
+
--dui-tree-row-height: var(--component-height-sm);
|
|
19526
|
+
--dui-tree-indent: var(--space-4);
|
|
19527
|
+
--dui-tree-row-spacing: 0;
|
|
19528
|
+
--dui-tree-row-radius: var(--radius-sm);
|
|
19529
|
+
--dui-tree-hover-bg: oklch(from var(--foreground) l c h / 0.05);
|
|
19530
|
+
--dui-tree-selected-bg: oklch(from var(--foreground) l c h / 0.10);
|
|
19531
|
+
|
|
19532
|
+
/* Internal-only (not part of public token surface) */
|
|
19533
|
+
--_tree-label-font-size: var(--text-xs);
|
|
19534
|
+
--_tree-label-line-height: var(--text-xs--line-height);
|
|
19535
|
+
--_tree-end-font-size: var(--text-2xs);
|
|
19536
|
+
--_tree-end-line-height: var(--text-2xs--line-height);
|
|
19537
|
+
--_tree-indicator-size: 14px;
|
|
19538
|
+
--_tree-row-px: var(--space-2);
|
|
19539
|
+
--_tree-inline-gap: var(--space-2);
|
|
19540
|
+
}
|
|
19541
|
+
|
|
19542
|
+
:host([size="md"]) {
|
|
19543
|
+
--dui-tree-row-height: var(--component-height-md);
|
|
19544
|
+
--dui-tree-indent: var(--space-5);
|
|
19545
|
+
--_tree-label-font-size: var(--text-sm);
|
|
19546
|
+
--_tree-label-line-height: var(--text-sm--line-height);
|
|
19547
|
+
--_tree-end-font-size: var(--text-xs);
|
|
19548
|
+
--_tree-end-line-height: var(--text-xs--line-height);
|
|
19549
|
+
--_tree-indicator-size: var(--space-4);
|
|
19550
|
+
--_tree-inline-gap: var(--space-2);
|
|
19551
|
+
}
|
|
19552
|
+
|
|
19553
|
+
:host([size="lg"]) {
|
|
19554
|
+
--dui-tree-row-height: var(--component-height-lg);
|
|
19555
|
+
--dui-tree-indent: var(--space-6);
|
|
19556
|
+
--_tree-label-font-size: var(--text-sm);
|
|
19557
|
+
--_tree-label-line-height: var(--text-sm--line-height);
|
|
19558
|
+
--_tree-end-font-size: var(--text-xs);
|
|
19559
|
+
--_tree-end-line-height: var(--text-xs--line-height);
|
|
19560
|
+
--_tree-indicator-size: var(--space-4);
|
|
19561
|
+
--_tree-inline-gap: var(--space-2_5);
|
|
19562
|
+
}
|
|
19563
|
+
`;
|
|
19564
|
+
var DuiTree = class extends DuiTreePrimitive {
|
|
19565
|
+
static styles = [...DuiTreePrimitive.styles, styles146];
|
|
19566
|
+
};
|
|
19567
|
+
customElements.define(DuiTree.tagName, DuiTree);
|
|
19568
|
+
|
|
19569
|
+
// packages/components/src/tree/tree-item.ts
|
|
19570
|
+
var chevronMask3 = r(
|
|
19571
|
+
`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E")`
|
|
19572
|
+
);
|
|
19573
|
+
var spinnerMask = r(
|
|
19574
|
+
`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 1 1-6.219-8.56'/%3E%3C/svg%3E")`
|
|
19575
|
+
);
|
|
19576
|
+
var styles147 = i`
|
|
19577
|
+
/* ── Row container ─────────────────────────────────────────────────── */
|
|
19578
|
+
|
|
19579
|
+
/*
|
|
19580
|
+
* IMPORTANT: All visual styling lives on [part="content"], NOT [part="root"].
|
|
19581
|
+
* [part="root"] wraps both the row and the children group, so :hover on it
|
|
19582
|
+
* would bleed onto descendant rows. See the hover-bleed regression demo.
|
|
19583
|
+
*/
|
|
19584
|
+
[part="content"] {
|
|
19585
|
+
height: var(--dui-tree-row-height);
|
|
19586
|
+
padding-inline-start: calc(
|
|
19587
|
+
var(--_tree-row-px) +
|
|
19588
|
+
(var(--dui-tree-level, 1) - 1) * var(--dui-tree-indent)
|
|
19589
|
+
);
|
|
19590
|
+
padding-inline-end: var(--_tree-row-px);
|
|
19591
|
+
margin-block: calc(var(--dui-tree-row-spacing) / 2);
|
|
19592
|
+
margin-inline: var(--space-1);
|
|
19593
|
+
border-radius: var(--dui-tree-row-radius);
|
|
19594
|
+
gap: var(--_tree-inline-gap);
|
|
19595
|
+
color: var(--text-1);
|
|
19596
|
+
font-family: var(--font-sans);
|
|
19597
|
+
font-size: var(--_tree-label-font-size);
|
|
19598
|
+
line-height: var(--_tree-label-line-height);
|
|
19599
|
+
cursor: pointer;
|
|
19600
|
+
transition-property: background, box-shadow, color;
|
|
19601
|
+
transition-duration: var(--duration-faster);
|
|
19602
|
+
transition-timing-function: var(--ease-out-3);
|
|
19603
|
+
/* Allow children to truncate */
|
|
19604
|
+
min-width: 0;
|
|
19605
|
+
}
|
|
19606
|
+
|
|
19607
|
+
@media (hover: hover) {
|
|
19608
|
+
[part="content"]:hover {
|
|
19609
|
+
background: var(--dui-tree-hover-bg);
|
|
19610
|
+
}
|
|
19611
|
+
}
|
|
19612
|
+
|
|
19613
|
+
:host([data-selected]) [part="content"] {
|
|
19614
|
+
background: var(--dui-tree-selected-bg);
|
|
19615
|
+
}
|
|
19616
|
+
|
|
19617
|
+
:host([data-disabled]) [part="content"] {
|
|
19618
|
+
opacity: 0.4;
|
|
19619
|
+
cursor: not-allowed;
|
|
19620
|
+
}
|
|
19621
|
+
|
|
19622
|
+
/* ── Focus ring ─────────────────────────────────────────────────────── */
|
|
19623
|
+
|
|
19624
|
+
[part="root"]:focus-visible {
|
|
19625
|
+
outline: none;
|
|
19626
|
+
}
|
|
19627
|
+
|
|
19628
|
+
[part="root"]:focus-visible [part="content"] {
|
|
19629
|
+
box-shadow:
|
|
19630
|
+
0 0 0 var(--focus-ring-offset) var(--background),
|
|
19631
|
+
0 0 0 calc(var(--focus-ring-offset) + var(--focus-ring-width))
|
|
19632
|
+
var(--focus-ring-color);
|
|
19633
|
+
/* Keep the highlighted row above siblings so the ring isn't clipped. */
|
|
19634
|
+
position: relative;
|
|
19635
|
+
z-index: 1;
|
|
19636
|
+
}
|
|
19637
|
+
|
|
19638
|
+
/* ── Indicator (chevron / spinner / leaf placeholder) ─────────────── */
|
|
19639
|
+
|
|
19640
|
+
[part="indicator"] {
|
|
19641
|
+
width: var(--_tree-indicator-size);
|
|
19642
|
+
height: var(--_tree-indicator-size);
|
|
19643
|
+
color: var(--text-2);
|
|
19644
|
+
}
|
|
19645
|
+
|
|
19646
|
+
/* Branch chevron */
|
|
19647
|
+
:host([data-branch]) [part="indicator"]::before {
|
|
19648
|
+
content: "";
|
|
19649
|
+
display: block;
|
|
19650
|
+
width: 100%;
|
|
19651
|
+
height: 100%;
|
|
19652
|
+
background: currentColor;
|
|
19653
|
+
-webkit-mask: ${chevronMask3} center / contain no-repeat;
|
|
19654
|
+
mask: ${chevronMask3} center / contain no-repeat;
|
|
19655
|
+
transition-property: transform;
|
|
19656
|
+
transition-duration: var(--duration-fast);
|
|
19657
|
+
transition-timing-function: var(--ease-out-3);
|
|
19658
|
+
}
|
|
19659
|
+
|
|
19660
|
+
:host([data-expanded]) [part="indicator"]::before {
|
|
19661
|
+
transform: rotate(90deg);
|
|
19662
|
+
}
|
|
19663
|
+
|
|
19664
|
+
/* Loading spinner replaces the chevron in-place */
|
|
19665
|
+
:host([data-loading]) [part="indicator"]::before {
|
|
19666
|
+
-webkit-mask: ${spinnerMask} center / contain no-repeat;
|
|
19667
|
+
mask: ${spinnerMask} center / contain no-repeat;
|
|
19668
|
+
transform: none;
|
|
19669
|
+
animation: dui-tree-spin 0.9s linear infinite;
|
|
19670
|
+
}
|
|
19671
|
+
|
|
19672
|
+
@keyframes dui-tree-spin {
|
|
19673
|
+
from {
|
|
19674
|
+
transform: rotate(0deg);
|
|
19675
|
+
}
|
|
19676
|
+
to {
|
|
19677
|
+
transform: rotate(360deg);
|
|
19678
|
+
}
|
|
19679
|
+
}
|
|
19680
|
+
|
|
19681
|
+
/* ── Slotted content ────────────────────────────────────────────────── */
|
|
19682
|
+
|
|
19683
|
+
::slotted([slot="label"]) {
|
|
19684
|
+
min-width: 0;
|
|
19685
|
+
overflow: hidden;
|
|
19686
|
+
text-overflow: ellipsis;
|
|
19687
|
+
white-space: nowrap;
|
|
19688
|
+
}
|
|
19689
|
+
|
|
19690
|
+
::slotted([slot="end"]) {
|
|
19691
|
+
flex-shrink: 0;
|
|
19692
|
+
color: var(--text-2);
|
|
19693
|
+
font-size: var(--_tree-end-font-size);
|
|
19694
|
+
line-height: var(--_tree-end-line-height);
|
|
19695
|
+
}
|
|
19696
|
+
|
|
19697
|
+
/* ── Reduced motion ────────────────────────────────────────────────── */
|
|
19698
|
+
|
|
19699
|
+
@media (prefers-reduced-motion: reduce) {
|
|
19700
|
+
[part="content"],
|
|
19701
|
+
:host([data-branch]) [part="indicator"]::before {
|
|
19702
|
+
transition-duration: 0s;
|
|
19703
|
+
}
|
|
19704
|
+
:host([data-loading]) [part="indicator"]::before {
|
|
19705
|
+
animation: none;
|
|
19706
|
+
}
|
|
19707
|
+
}
|
|
19708
|
+
`;
|
|
19709
|
+
var DuiTreeItem = class extends DuiTreeItemPrimitive {
|
|
19710
|
+
static styles = [...DuiTreeItemPrimitive.styles, styles147];
|
|
19711
|
+
};
|
|
19712
|
+
customElements.define(DuiTreeItem.tagName, DuiTreeItem);
|
|
19713
|
+
|
|
19714
|
+
// ../dui-primitives/packages/primitives/src/trunc/trunc.ts
|
|
19715
|
+
var styles148 = i5`
|
|
19716
|
+
:host {
|
|
19717
|
+
display: block;
|
|
19718
|
+
}
|
|
19719
|
+
|
|
18933
19720
|
[part="root"] {
|
|
18934
19721
|
overflow: hidden;
|
|
18935
19722
|
}
|
|
@@ -18945,12 +19732,12 @@ var styles144 = i5`
|
|
|
18945
19732
|
-webkit-box-orient: vertical;
|
|
18946
19733
|
}
|
|
18947
19734
|
`;
|
|
18948
|
-
var _maxLines_dec, _maxWidth_dec,
|
|
18949
|
-
var DuiTruncPrimitive = class extends (
|
|
19735
|
+
var _maxLines_dec, _maxWidth_dec, _a63, _init63, _maxWidth, _maxLines;
|
|
19736
|
+
var DuiTruncPrimitive = class extends (_a63 = i8, _maxWidth_dec = [n7({ attribute: "max-width" })], _maxLines_dec = [n7({ attribute: "max-lines", type: Number, reflect: true })], _a63) {
|
|
18950
19737
|
constructor() {
|
|
18951
19738
|
super(...arguments);
|
|
18952
|
-
__privateAdd(this, _maxWidth, __runInitializers(
|
|
18953
|
-
__privateAdd(this, _maxLines, __runInitializers(
|
|
19739
|
+
__privateAdd(this, _maxWidth, __runInitializers(_init63, 8, this, "20rem")), __runInitializers(_init63, 11, this);
|
|
19740
|
+
__privateAdd(this, _maxLines, __runInitializers(_init63, 12, this)), __runInitializers(_init63, 15, this);
|
|
18954
19741
|
}
|
|
18955
19742
|
render() {
|
|
18956
19743
|
const clamp2 = this.maxLines !== void 0 ? Math.max(1, this.maxLines).toString() : void 0;
|
|
@@ -18962,17 +19749,17 @@ var DuiTruncPrimitive = class extends (_a61 = i8, _maxWidth_dec = [n7({ attribut
|
|
|
18962
19749
|
return b4`<div part="root" style=${dynamicStyles}><slot></slot></div>`;
|
|
18963
19750
|
}
|
|
18964
19751
|
};
|
|
18965
|
-
|
|
19752
|
+
_init63 = __decoratorStart(_a63);
|
|
18966
19753
|
_maxWidth = new WeakMap();
|
|
18967
19754
|
_maxLines = new WeakMap();
|
|
18968
|
-
__decorateElement(
|
|
18969
|
-
__decorateElement(
|
|
18970
|
-
__decoratorMetadata(
|
|
19755
|
+
__decorateElement(_init63, 4, "maxWidth", _maxWidth_dec, DuiTruncPrimitive, _maxWidth);
|
|
19756
|
+
__decorateElement(_init63, 4, "maxLines", _maxLines_dec, DuiTruncPrimitive, _maxLines);
|
|
19757
|
+
__decoratorMetadata(_init63, DuiTruncPrimitive);
|
|
18971
19758
|
__publicField(DuiTruncPrimitive, "tagName", "dui-trunc");
|
|
18972
|
-
__publicField(DuiTruncPrimitive, "styles", [base,
|
|
19759
|
+
__publicField(DuiTruncPrimitive, "styles", [base, styles148]);
|
|
18973
19760
|
|
|
18974
19761
|
// packages/components/src/trunc/trunc.ts
|
|
18975
|
-
var
|
|
19762
|
+
var styles149 = i`
|
|
18976
19763
|
[part="root"] {
|
|
18977
19764
|
font-family: var(--font-sans);
|
|
18978
19765
|
font-size: var(--text-sm); line-height: var(--text-sm--line-height);
|
|
@@ -18980,6 +19767,6 @@ var styles145 = i`
|
|
|
18980
19767
|
}
|
|
18981
19768
|
`;
|
|
18982
19769
|
var DuiTrunc = class extends DuiTruncPrimitive {
|
|
18983
|
-
static styles = [...DuiTruncPrimitive.styles,
|
|
19770
|
+
static styles = [...DuiTruncPrimitive.styles, styles149];
|
|
18984
19771
|
};
|
|
18985
19772
|
customElements.define(DuiTrunc.tagName, DuiTrunc);
|