@design-factory/angular 21.1.0-next.0 → 21.1.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/fesm2022/design-factory-angular-drawer.mjs +22 -29
- package/fesm2022/design-factory-angular-drawer.mjs.map +1 -1
- package/fesm2022/design-factory-angular-internals.mjs +5 -5
- package/fesm2022/design-factory-angular-internals.mjs.map +1 -1
- package/fesm2022/design-factory-angular-sidenav.mjs +139 -62
- package/fesm2022/design-factory-angular-sidenav.mjs.map +1 -1
- package/fesm2022/design-factory-angular-theme.mjs +1 -1
- package/fesm2022/design-factory-angular-theme.mjs.map +1 -1
- package/fesm2022/design-factory-angular-topnav.mjs +152 -75
- package/fesm2022/design-factory-angular-topnav.mjs.map +1 -1
- package/package.json +3 -6
- package/types/design-factory-angular-drawer.d.ts +13 -14
- package/types/design-factory-angular-internals.d.ts +3 -3
- package/types/design-factory-angular-sidenav.d.ts +19 -6
- package/types/design-factory-angular-topnav.d.ts +13 -6
- package/node_modules/@agnos-ui/core/README.md +0 -5
- package/node_modules/@agnos-ui/core/accordion-BC_9xn23.cjs +0 -314
- package/node_modules/@agnos-ui/core/accordion-Ca_0T8Bc.js +0 -315
- package/node_modules/@agnos-ui/core/alert-AhaliJ17.cjs +0 -9
- package/node_modules/@agnos-ui/core/alert-Cb9FhbFQ.js +0 -10
- package/node_modules/@agnos-ui/core/collapse-COriZO7o.cjs +0 -94
- package/node_modules/@agnos-ui/core/collapse-CP79atna.js +0 -95
- package/node_modules/@agnos-ui/core/common-B5jS-Ih_.cjs +0 -73
- package/node_modules/@agnos-ui/core/common-DFyZvkII.js +0 -74
- package/node_modules/@agnos-ui/core/components/accordion/accordion.d.ts +0 -333
- package/node_modules/@agnos-ui/core/components/accordion/index.cjs +0 -7
- package/node_modules/@agnos-ui/core/components/accordion/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/accordion/index.js +0 -7
- package/node_modules/@agnos-ui/core/components/alert/alert.d.ts +0 -37
- package/node_modules/@agnos-ui/core/components/alert/common.d.ts +0 -138
- package/node_modules/@agnos-ui/core/components/alert/index.cjs +0 -5
- package/node_modules/@agnos-ui/core/components/alert/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/alert/index.js +0 -5
- package/node_modules/@agnos-ui/core/components/carousel/carousel.d.ts +0 -247
- package/node_modules/@agnos-ui/core/components/carousel/index.cjs +0 -292
- package/node_modules/@agnos-ui/core/components/carousel/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/carousel/index.js +0 -292
- package/node_modules/@agnos-ui/core/components/collapse/collapse.d.ts +0 -135
- package/node_modules/@agnos-ui/core/components/collapse/index.cjs +0 -5
- package/node_modules/@agnos-ui/core/components/collapse/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/collapse/index.js +0 -5
- package/node_modules/@agnos-ui/core/components/commonProps.d.ts +0 -11
- package/node_modules/@agnos-ui/core/components/drawer/drawer.d.ts +0 -279
- package/node_modules/@agnos-ui/core/components/drawer/index.cjs +0 -5
- package/node_modules/@agnos-ui/core/components/drawer/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/drawer/index.js +0 -5
- package/node_modules/@agnos-ui/core/components/modal/index.cjs +0 -8
- package/node_modules/@agnos-ui/core/components/modal/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/modal/index.js +0 -8
- package/node_modules/@agnos-ui/core/components/modal/modal.d.ts +0 -245
- package/node_modules/@agnos-ui/core/components/pagination/index.cjs +0 -5
- package/node_modules/@agnos-ui/core/components/pagination/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/pagination/index.js +0 -5
- package/node_modules/@agnos-ui/core/components/pagination/pagination.d.ts +0 -313
- package/node_modules/@agnos-ui/core/components/progressbar/index.cjs +0 -5
- package/node_modules/@agnos-ui/core/components/progressbar/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/progressbar/index.js +0 -5
- package/node_modules/@agnos-ui/core/components/progressbar/progressbar.d.ts +0 -91
- package/node_modules/@agnos-ui/core/components/rating/index.cjs +0 -5
- package/node_modules/@agnos-ui/core/components/rating/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/rating/index.js +0 -5
- package/node_modules/@agnos-ui/core/components/rating/rating.d.ts +0 -191
- package/node_modules/@agnos-ui/core/components/slider/index.cjs +0 -5
- package/node_modules/@agnos-ui/core/components/slider/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/slider/index.js +0 -5
- package/node_modules/@agnos-ui/core/components/slider/slider-utils.d.ts +0 -25
- package/node_modules/@agnos-ui/core/components/slider/slider.d.ts +0 -383
- package/node_modules/@agnos-ui/core/components/toast/index.cjs +0 -7
- package/node_modules/@agnos-ui/core/components/toast/index.d.ts +0 -2
- package/node_modules/@agnos-ui/core/components/toast/index.js +0 -7
- package/node_modules/@agnos-ui/core/components/toast/toast.d.ts +0 -66
- package/node_modules/@agnos-ui/core/components/toast/toaster.d.ts +0 -128
- package/node_modules/@agnos-ui/core/components/tree/index.cjs +0 -5
- package/node_modules/@agnos-ui/core/components/tree/index.d.ts +0 -1
- package/node_modules/@agnos-ui/core/components/tree/index.js +0 -5
- package/node_modules/@agnos-ui/core/components/tree/tree.d.ts +0 -143
- package/node_modules/@agnos-ui/core/config.cjs +0 -36
- package/node_modules/@agnos-ui/core/config.d.ts +0 -117
- package/node_modules/@agnos-ui/core/config.js +0 -36
- package/node_modules/@agnos-ui/core/directive-Bsreu2z1.js +0 -523
- package/node_modules/@agnos-ui/core/directive-DCaXmRe_.cjs +0 -522
- package/node_modules/@agnos-ui/core/drawer-BbFAHV07.cjs +0 -328
- package/node_modules/@agnos-ui/core/drawer-C6Qa0xEu.js +0 -329
- package/node_modules/@agnos-ui/core/index.cjs +0 -134
- package/node_modules/@agnos-ui/core/index.d.ts +0 -29
- package/node_modules/@agnos-ui/core/index.js +0 -134
- package/node_modules/@agnos-ui/core/isFocusable-Ckwus82R.js +0 -32
- package/node_modules/@agnos-ui/core/isFocusable-DfzDLeAN.cjs +0 -31
- package/node_modules/@agnos-ui/core/modal-BsNuHhT7.cjs +0 -252
- package/node_modules/@agnos-ui/core/modal-CgzY8ezz.js +0 -253
- package/node_modules/@agnos-ui/core/package.json +0 -57
- package/node_modules/@agnos-ui/core/pagination-ZxGaNWZz.js +0 -255
- package/node_modules/@agnos-ui/core/pagination-xbcOHnhd.cjs +0 -254
- package/node_modules/@agnos-ui/core/progressbar-CRbMKp4b.cjs +0 -86
- package/node_modules/@agnos-ui/core/progressbar-CSEIFnlD.js +0 -87
- package/node_modules/@agnos-ui/core/promise-CxCD3NYv.cjs +0 -118
- package/node_modules/@agnos-ui/core/promise-D-RZVPuv.js +0 -119
- package/node_modules/@agnos-ui/core/rating-BIdiiPUo.js +0 -184
- package/node_modules/@agnos-ui/core/rating-qx1xaBmz.cjs +0 -183
- package/node_modules/@agnos-ui/core/scrollbars-CT87iv_6.cjs +0 -30
- package/node_modules/@agnos-ui/core/scrollbars-CcxSrnCx.js +0 -31
- package/node_modules/@agnos-ui/core/services/extendWidget.cjs +0 -41
- package/node_modules/@agnos-ui/core/services/extendWidget.d.ts +0 -31
- package/node_modules/@agnos-ui/core/services/extendWidget.js +0 -41
- package/node_modules/@agnos-ui/core/services/floatingUI.cjs +0 -111
- package/node_modules/@agnos-ui/core/services/floatingUI.d.ts +0 -76
- package/node_modules/@agnos-ui/core/services/floatingUI.js +0 -111
- package/node_modules/@agnos-ui/core/services/focusElement.cjs +0 -46
- package/node_modules/@agnos-ui/core/services/focusElement.d.ts +0 -9
- package/node_modules/@agnos-ui/core/services/focusElement.js +0 -46
- package/node_modules/@agnos-ui/core/services/focustrack.cjs +0 -47
- package/node_modules/@agnos-ui/core/services/focustrack.d.ts +0 -40
- package/node_modules/@agnos-ui/core/services/focustrack.js +0 -47
- package/node_modules/@agnos-ui/core/services/hash.cjs +0 -15
- package/node_modules/@agnos-ui/core/services/hash.d.ts +0 -3
- package/node_modules/@agnos-ui/core/services/hash.js +0 -15
- package/node_modules/@agnos-ui/core/services/intersection.cjs +0 -53
- package/node_modules/@agnos-ui/core/services/intersection.d.ts +0 -30
- package/node_modules/@agnos-ui/core/services/intersection.js +0 -53
- package/node_modules/@agnos-ui/core/services/matchMedia.cjs +0 -14
- package/node_modules/@agnos-ui/core/services/matchMedia.d.ts +0 -8
- package/node_modules/@agnos-ui/core/services/matchMedia.js +0 -14
- package/node_modules/@agnos-ui/core/services/navManager.cjs +0 -166
- package/node_modules/@agnos-ui/core/services/navManager.d.ts +0 -144
- package/node_modules/@agnos-ui/core/services/navManager.js +0 -166
- package/node_modules/@agnos-ui/core/services/pointerdownPosition.cjs +0 -60
- package/node_modules/@agnos-ui/core/services/pointerdownPosition.d.ts +0 -42
- package/node_modules/@agnos-ui/core/services/pointerdownPosition.js +0 -60
- package/node_modules/@agnos-ui/core/services/portal.cjs +0 -42
- package/node_modules/@agnos-ui/core/services/portal.d.ts +0 -16
- package/node_modules/@agnos-ui/core/services/portal.js +0 -42
- package/node_modules/@agnos-ui/core/services/resizeObserver.cjs +0 -54
- package/node_modules/@agnos-ui/core/services/resizeObserver.d.ts +0 -18
- package/node_modules/@agnos-ui/core/services/resizeObserver.js +0 -54
- package/node_modules/@agnos-ui/core/services/siblingsInert.cjs +0 -44
- package/node_modules/@agnos-ui/core/services/siblingsInert.d.ts +0 -16
- package/node_modules/@agnos-ui/core/services/siblingsInert.js +0 -44
- package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.cjs +0 -186
- package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.d.ts +0 -166
- package/node_modules/@agnos-ui/core/services/transitions/baseTransitions.js +0 -186
- package/node_modules/@agnos-ui/core/services/transitions/collapse.cjs +0 -40
- package/node_modules/@agnos-ui/core/services/transitions/collapse.d.ts +0 -49
- package/node_modules/@agnos-ui/core/services/transitions/collapse.js +0 -40
- package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.cjs +0 -32
- package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.d.ts +0 -25
- package/node_modules/@agnos-ui/core/services/transitions/cssTransitions.js +0 -32
- package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.cjs +0 -37
- package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.d.ts +0 -47
- package/node_modules/@agnos-ui/core/services/transitions/simpleClassTransition.js +0 -37
- package/node_modules/@agnos-ui/core/slider-B93hE0ag.cjs +0 -807
- package/node_modules/@agnos-ui/core/slider-Cjiq9FgI.js +0 -808
- package/node_modules/@agnos-ui/core/textDirection-cNgt24LJ.js +0 -4
- package/node_modules/@agnos-ui/core/textDirection-zqcZ5-eK.cjs +0 -3
- package/node_modules/@agnos-ui/core/toaster-BQWqxYv-.cjs +0 -190
- package/node_modules/@agnos-ui/core/toaster-BzEkshT2.js +0 -191
- package/node_modules/@agnos-ui/core/tree-DY04XPPg.cjs +0 -228
- package/node_modules/@agnos-ui/core/tree-HwcvZ0_p.js +0 -229
- package/node_modules/@agnos-ui/core/types.cjs +0 -6
- package/node_modules/@agnos-ui/core/types.d.ts +0 -246
- package/node_modules/@agnos-ui/core/types.js +0 -6
- package/node_modules/@agnos-ui/core/utils/directive.cjs +0 -28
- package/node_modules/@agnos-ui/core/utils/directive.d.ts +0 -352
- package/node_modules/@agnos-ui/core/utils/directive.js +0 -28
- package/node_modules/@agnos-ui/core/utils/func.cjs +0 -7
- package/node_modules/@agnos-ui/core/utils/func.d.ts +0 -11
- package/node_modules/@agnos-ui/core/utils/func.js +0 -7
- package/node_modules/@agnos-ui/core/utils/id.cjs +0 -5
- package/node_modules/@agnos-ui/core/utils/id.d.ts +0 -6
- package/node_modules/@agnos-ui/core/utils/id.js +0 -5
- package/node_modules/@agnos-ui/core/utils/internal/assign.d.ts +0 -10
- package/node_modules/@agnos-ui/core/utils/internal/checks.d.ts +0 -57
- package/node_modules/@agnos-ui/core/utils/internal/dom.d.ts +0 -75
- package/node_modules/@agnos-ui/core/utils/internal/isFocusable.d.ts +0 -9
- package/node_modules/@agnos-ui/core/utils/internal/math.d.ts +0 -5
- package/node_modules/@agnos-ui/core/utils/internal/promise.d.ts +0 -98
- package/node_modules/@agnos-ui/core/utils/internal/scrollbars.d.ts +0 -8
- package/node_modules/@agnos-ui/core/utils/internal/sort.d.ts +0 -16
- package/node_modules/@agnos-ui/core/utils/internal/ssrHTMLElement.d.ts +0 -17
- package/node_modules/@agnos-ui/core/utils/internal/textDirection.d.ts +0 -7
- package/node_modules/@agnos-ui/core/utils/internal/traversal.d.ts +0 -54
- package/node_modules/@agnos-ui/core/utils/stores.cjs +0 -172
- package/node_modules/@agnos-ui/core/utils/stores.d.ts +0 -224
- package/node_modules/@agnos-ui/core/utils/stores.js +0 -172
- package/node_modules/@agnos-ui/core/utils/widget.cjs +0 -8
- package/node_modules/@agnos-ui/core/utils/widget.d.ts +0 -11
- package/node_modules/@agnos-ui/core/utils/widget.js +0 -8
- package/node_modules/@agnos-ui/core/utils/writables.cjs +0 -16
- package/node_modules/@agnos-ui/core/utils/writables.d.ts +0 -95
- package/node_modules/@agnos-ui/core/utils/writables.js +0 -16
- package/node_modules/@agnos-ui/core/writables-DYGjj5T3.js +0 -103
- package/node_modules/@agnos-ui/core/writables-Dt68gADJ.cjs +0 -102
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { writable, computed, readable } from "@amadeus-it-group/tansu";
|
|
2
|
-
import { createNavManager } from "./services/navManager.js";
|
|
3
|
-
import { s as mergeDirectives, d as browserDirective, g as createAttributesDirective, b as bindDirective } from "./directive-Bsreu2z1.js";
|
|
4
|
-
import { noop } from "./utils/func.js";
|
|
5
|
-
import { writablesForProps, stateStores, true$ } from "./utils/stores.js";
|
|
6
|
-
import { e as typeFunction, a as typeArray, j as typeString } from "./writables-DYGjj5T3.js";
|
|
7
|
-
import { createWidgetFactory } from "./utils/widget.js";
|
|
8
|
-
function getTreeDefaultConfig() {
|
|
9
|
-
return {
|
|
10
|
-
...defaultTreeConfig
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
const defaultTreeConfig = {
|
|
14
|
-
className: "",
|
|
15
|
-
nodes: [],
|
|
16
|
-
onExpandToggle: noop,
|
|
17
|
-
navSelector: (node) => node.querySelectorAll("button"),
|
|
18
|
-
ariaLabelToggleFn: (label) => `Toggle ${label}`
|
|
19
|
-
};
|
|
20
|
-
const configValidator = {
|
|
21
|
-
className: typeString,
|
|
22
|
-
nodes: typeArray,
|
|
23
|
-
onExpandToggle: typeFunction,
|
|
24
|
-
navSelector: typeFunction,
|
|
25
|
-
ariaLabelToggleFn: typeFunction
|
|
26
|
-
};
|
|
27
|
-
const createTree = createWidgetFactory("tree", (config) => {
|
|
28
|
-
const [{ nodes$, onExpandToggle$, navSelector$, ariaLabelToggleFn$, ...stateProps }, patch] = writablesForProps(
|
|
29
|
-
defaultTreeConfig,
|
|
30
|
-
config,
|
|
31
|
-
configValidator
|
|
32
|
-
);
|
|
33
|
-
const treeMap = /* @__PURE__ */ new Map();
|
|
34
|
-
const _expandedMap = {
|
|
35
|
-
get(item) {
|
|
36
|
-
return item.isExpanded;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const _toggleChange$ = writable({});
|
|
40
|
-
const expandedMap$ = computed(() => {
|
|
41
|
-
normalizedNodes$();
|
|
42
|
-
_toggleChange$();
|
|
43
|
-
return _expandedMap;
|
|
44
|
-
});
|
|
45
|
-
const {
|
|
46
|
-
elementsInDomOrder$,
|
|
47
|
-
directive: navDirective,
|
|
48
|
-
refreshElements,
|
|
49
|
-
focusIndex,
|
|
50
|
-
focusPrevious,
|
|
51
|
-
focusNext,
|
|
52
|
-
focusFirst,
|
|
53
|
-
focusLast
|
|
54
|
-
} = createNavManager();
|
|
55
|
-
const navManagerConfig$ = computed(() => ({
|
|
56
|
-
keys: {
|
|
57
|
-
ArrowUp: focusPrevious,
|
|
58
|
-
ArrowDown: focusNext,
|
|
59
|
-
Home: focusFirst,
|
|
60
|
-
End: focusLast
|
|
61
|
-
},
|
|
62
|
-
selector: navSelector$()
|
|
63
|
-
}));
|
|
64
|
-
const traverseTree = (node, level, parent) => {
|
|
65
|
-
const copyNode = {
|
|
66
|
-
...node,
|
|
67
|
-
ariaLabel: node.ariaLabel ?? node.label,
|
|
68
|
-
level,
|
|
69
|
-
children: [],
|
|
70
|
-
isExpanded: node.children?.length ? node.isExpanded ?? false : void 0
|
|
71
|
-
};
|
|
72
|
-
treeMap.set(copyNode, {
|
|
73
|
-
parent
|
|
74
|
-
});
|
|
75
|
-
if (node.children) {
|
|
76
|
-
copyNode.children = node.children.map((child) => traverseTree(child, level + 1, copyNode));
|
|
77
|
-
}
|
|
78
|
-
return copyNode;
|
|
79
|
-
};
|
|
80
|
-
const normalizedNodes$ = computed(() => {
|
|
81
|
-
treeMap.clear();
|
|
82
|
-
return nodes$().map((node) => traverseTree(node, 0, void 0));
|
|
83
|
-
});
|
|
84
|
-
const _lastFocusedTreeItem$ = writable(
|
|
85
|
-
normalizedNodes$().find((node) => node.isExpanded !== void 0)
|
|
86
|
-
);
|
|
87
|
-
const getTreeItemInfo = (item) => {
|
|
88
|
-
const treeItem = treeMap.get(item);
|
|
89
|
-
if (!treeItem) {
|
|
90
|
-
console.error(`Node ${item.label} doesn't exist in the map`);
|
|
91
|
-
}
|
|
92
|
-
return treeItem;
|
|
93
|
-
};
|
|
94
|
-
const treeItemElementDirective = browserDirective(
|
|
95
|
-
(toggleItem, args) => {
|
|
96
|
-
let treeItemInfo;
|
|
97
|
-
const destroy = () => {
|
|
98
|
-
if (treeItemInfo && treeItemInfo.htmlElement === toggleItem) {
|
|
99
|
-
treeItemInfo.htmlElement = void 0;
|
|
100
|
-
}
|
|
101
|
-
treeItemInfo = void 0;
|
|
102
|
-
};
|
|
103
|
-
const update = (args2) => {
|
|
104
|
-
destroy();
|
|
105
|
-
treeItemInfo = getTreeItemInfo(args2.item);
|
|
106
|
-
if (treeItemInfo) {
|
|
107
|
-
if (treeItemInfo.htmlElement) {
|
|
108
|
-
console.warn(`The tree item directive should be used once per element`);
|
|
109
|
-
}
|
|
110
|
-
treeItemInfo.htmlElement = toggleItem;
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
update(args);
|
|
114
|
-
return {
|
|
115
|
-
update,
|
|
116
|
-
destroy
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
);
|
|
120
|
-
const focusElementIfExists = (itemToFocus) => {
|
|
121
|
-
if (itemToFocus) {
|
|
122
|
-
const mapItemHtml = getTreeItemInfo(itemToFocus)?.htmlElement;
|
|
123
|
-
if (mapItemHtml) {
|
|
124
|
-
const index = elementsInDomOrder$().indexOf(mapItemHtml);
|
|
125
|
-
focusIndex(index, 0);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
const itemToggleAttributesDirective = createAttributesDirective(
|
|
130
|
-
(treeItemContext$) => ({
|
|
131
|
-
events: {
|
|
132
|
-
focus: () => {
|
|
133
|
-
const { item } = treeItemContext$();
|
|
134
|
-
_lastFocusedTreeItem$.set(item);
|
|
135
|
-
},
|
|
136
|
-
click: () => {
|
|
137
|
-
const { item } = treeItemContext$();
|
|
138
|
-
toggleExpanded(item);
|
|
139
|
-
},
|
|
140
|
-
keydown: (event) => {
|
|
141
|
-
const { key } = event;
|
|
142
|
-
const { item } = treeItemContext$();
|
|
143
|
-
const isExpanded = item.isExpanded;
|
|
144
|
-
refreshElements();
|
|
145
|
-
switch (key) {
|
|
146
|
-
case "Enter":
|
|
147
|
-
case " ":
|
|
148
|
-
toggleExpanded(item);
|
|
149
|
-
break;
|
|
150
|
-
case "ArrowLeft":
|
|
151
|
-
if (isExpanded) {
|
|
152
|
-
toggleExpanded(item);
|
|
153
|
-
} else {
|
|
154
|
-
focusElementIfExists(getTreeItemInfo(item)?.parent);
|
|
155
|
-
}
|
|
156
|
-
break;
|
|
157
|
-
case "ArrowRight":
|
|
158
|
-
if (!isExpanded) {
|
|
159
|
-
toggleExpanded(item);
|
|
160
|
-
} else {
|
|
161
|
-
focusElementIfExists(item.children?.[0]);
|
|
162
|
-
}
|
|
163
|
-
break;
|
|
164
|
-
default:
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
event.preventDefault();
|
|
168
|
-
event.stopPropagation();
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
attributes: {
|
|
172
|
-
"aria-label": computed(() => {
|
|
173
|
-
const { item } = treeItemContext$();
|
|
174
|
-
return ariaLabelToggleFn$()(item.ariaLabel);
|
|
175
|
-
}),
|
|
176
|
-
tabindex: computed(() => {
|
|
177
|
-
const { item } = treeItemContext$();
|
|
178
|
-
return item === _lastFocusedTreeItem$() ? "0" : "-1";
|
|
179
|
-
}),
|
|
180
|
-
type: readable("button")
|
|
181
|
-
},
|
|
182
|
-
classNames: {
|
|
183
|
-
"au-tree-expand-icon": true$,
|
|
184
|
-
"au-tree-expand-icon-expanded": computed(() => {
|
|
185
|
-
_toggleChange$();
|
|
186
|
-
const { item } = treeItemContext$();
|
|
187
|
-
return item.isExpanded ?? false;
|
|
188
|
-
})
|
|
189
|
-
}
|
|
190
|
-
})
|
|
191
|
-
);
|
|
192
|
-
const toggleExpanded = (node) => {
|
|
193
|
-
const treeItemInfo = getTreeItemInfo(node);
|
|
194
|
-
if (treeItemInfo === void 0 || node.isExpanded === void 0) {
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
node.isExpanded = !node.isExpanded;
|
|
198
|
-
_toggleChange$.set({});
|
|
199
|
-
onExpandToggle$()(node);
|
|
200
|
-
};
|
|
201
|
-
const widget = {
|
|
202
|
-
...stateStores({ normalizedNodes$, expandedMap$, ...stateProps }),
|
|
203
|
-
patch,
|
|
204
|
-
api: {},
|
|
205
|
-
directives: {
|
|
206
|
-
navigationDirective: bindDirective(navDirective, navManagerConfig$),
|
|
207
|
-
itemToggleDirective: mergeDirectives(treeItemElementDirective, itemToggleAttributesDirective),
|
|
208
|
-
itemAttributesDirective: createAttributesDirective(
|
|
209
|
-
(treeItemContext$) => ({
|
|
210
|
-
attributes: {
|
|
211
|
-
role: readable("treeitem"),
|
|
212
|
-
"aria-selected": readable("false"),
|
|
213
|
-
// TODO: adapt aria-selected to the actual selected state
|
|
214
|
-
"aria-expanded": computed(() => {
|
|
215
|
-
const { item } = treeItemContext$();
|
|
216
|
-
_toggleChange$();
|
|
217
|
-
return item.isExpanded?.toString();
|
|
218
|
-
})
|
|
219
|
-
}
|
|
220
|
-
})
|
|
221
|
-
)
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
return widget;
|
|
225
|
-
});
|
|
226
|
-
export {
|
|
227
|
-
createTree as c,
|
|
228
|
-
getTreeDefaultConfig as g
|
|
229
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const FACTORY_WIDGET_NAME = /* @__PURE__ */ Symbol();
|
|
4
|
-
const INVALID_VALUE = /* @__PURE__ */ Symbol();
|
|
5
|
-
exports.FACTORY_WIDGET_NAME = FACTORY_WIDGET_NAME;
|
|
6
|
-
exports.INVALID_VALUE = INVALID_VALUE;
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import type { ReadableSignal, StoreOptions, SubscribableStore, WritableSignal } from '@amadeus-it-group/tansu';
|
|
2
|
-
/**
|
|
3
|
-
* A type that maps each property of an object type `T` to either a `ReadableSignal` of that property type or the property type itself.
|
|
4
|
-
*
|
|
5
|
-
* @template T - The object type whose properties are being mapped.
|
|
6
|
-
*/
|
|
7
|
-
export type ValuesOrReadableSignals<T extends object> = {
|
|
8
|
-
[K in keyof T]?: ReadableSignal<T[K] | undefined> | T[K];
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* A type that maps the properties of an object type `T` to either a `WritableSignal` of the property type or the property type itself.
|
|
12
|
-
*
|
|
13
|
-
* @template T - The object type whose properties are being mapped.
|
|
14
|
-
*/
|
|
15
|
-
export type ValuesOrWritableSignals<T extends object> = {
|
|
16
|
-
[K in keyof T]?: WritableSignal<T[K] | undefined> | T[K];
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Interface representing the configuration for properties.
|
|
20
|
-
*
|
|
21
|
-
* @template U - An object type representing the properties.
|
|
22
|
-
*/
|
|
23
|
-
export interface PropsConfig<U extends object> {
|
|
24
|
-
/**
|
|
25
|
-
* Object containing, for each property, either its initial value, or a store that will contain the value at any time.
|
|
26
|
-
* When the value of a property is undefined or invalid, the value from the config is used.
|
|
27
|
-
*/
|
|
28
|
-
props?: ValuesOrWritableSignals<U>;
|
|
29
|
-
/**
|
|
30
|
-
* Either a store of objects containing, for each property, the default value,
|
|
31
|
-
* or an object containing, for each property, either a store containing the default value or the default value itself.
|
|
32
|
-
*/
|
|
33
|
-
config?: ReadableSignal<Partial<U>> | ValuesOrReadableSignals<Partial<U>>;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Represents a generic widget with reactive state, stores, and various functionalities.
|
|
37
|
-
*
|
|
38
|
-
* @template Props - The type of the properties that can be passed to the widget.
|
|
39
|
-
* @template State - The type of the state managed by the widget.
|
|
40
|
-
* @template Api - The type of the API functions available for interacting with the widget.
|
|
41
|
-
* @template Actions - The type of the action handlers for user interactions.
|
|
42
|
-
* @template Directives - The type of the directives used in the widget's template.
|
|
43
|
-
*/
|
|
44
|
-
export interface Widget<Props extends object = object, State extends object = object, Api extends object = object, Directives extends object = object> {
|
|
45
|
-
/**
|
|
46
|
-
* the reactive state of the widget, combining all the values served by the stores
|
|
47
|
-
*/
|
|
48
|
-
state$: ReadableSignal<State>;
|
|
49
|
-
/**
|
|
50
|
-
* the different stores of the widget, all reactive
|
|
51
|
-
*/
|
|
52
|
-
stores: {
|
|
53
|
-
[K in keyof State as `${K & string}$`]: ReadableSignal<State[K]>;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Modify the parameter values, and recalculate the stores accordingly
|
|
57
|
-
*/
|
|
58
|
-
patch(parameters: Partial<Props>): void;
|
|
59
|
-
/**
|
|
60
|
-
* directives to be used on html elements in the template of the widget
|
|
61
|
-
*/
|
|
62
|
-
directives: Directives;
|
|
63
|
-
/**
|
|
64
|
-
* all the api functions to interact with the widget
|
|
65
|
-
*/
|
|
66
|
-
api: Api;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Extracts the state type from a widget type that contains a `state$` property.
|
|
70
|
-
*
|
|
71
|
-
* @template T - A type that extends an object with a `state$` property of type `SubscribableStore<any>`.
|
|
72
|
-
* @returns The type of the state contained within the `state$` property if it extends an object, otherwise `never`.
|
|
73
|
-
*/
|
|
74
|
-
export type WidgetState<T extends {
|
|
75
|
-
state$: SubscribableStore<any>;
|
|
76
|
-
}> = T extends {
|
|
77
|
-
state$: SubscribableStore<infer U extends object>;
|
|
78
|
-
} ? U : never;
|
|
79
|
-
/**
|
|
80
|
-
* Extracts the type of the argument expected by the `patch` method of a given type `T`.
|
|
81
|
-
*
|
|
82
|
-
* This utility type takes a generic type `T` which must have a `patch` method. The `patch` method
|
|
83
|
-
* should accept an argument that is a partial of some object type `U`. If `T` meets this condition,
|
|
84
|
-
* `WidgetProps` will resolve to the type `U`. Otherwise, it will resolve to `never`.
|
|
85
|
-
*
|
|
86
|
-
* @template T - A type that includes a `patch` method accepting a partial object.
|
|
87
|
-
*/
|
|
88
|
-
export type WidgetProps<T extends {
|
|
89
|
-
patch: (arg: any) => void;
|
|
90
|
-
}> = T extends {
|
|
91
|
-
patch: (arg: Partial<infer U extends object>) => void;
|
|
92
|
-
} ? U : never;
|
|
93
|
-
/**
|
|
94
|
-
* A unique symbol representing a widget factory widget name.
|
|
95
|
-
*/
|
|
96
|
-
export declare const FACTORY_WIDGET_NAME: unique symbol;
|
|
97
|
-
/**
|
|
98
|
-
* A factory function type for creating instances of a widget.
|
|
99
|
-
*
|
|
100
|
-
* @template W - The type of the widget that extends the base Widget type.
|
|
101
|
-
* @template T - The type of the factory function that creates the widget. Useful when the factory function has a generic
|
|
102
|
-
* @param props - Optional configuration properties for the widget.
|
|
103
|
-
* @returns An instance of the widget.
|
|
104
|
-
*/
|
|
105
|
-
export type WidgetFactory<W extends Widget, T extends (props?: PropsConfig<WidgetProps<W>>) => W = (props?: PropsConfig<WidgetProps<W>>) => W> = T & {
|
|
106
|
-
[FACTORY_WIDGET_NAME]?: string;
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* Represents a server-side rendered HTML element with limited functionality.
|
|
110
|
-
*
|
|
111
|
-
* This interface extends a subset of the {@link HTMLElement} interface, providing
|
|
112
|
-
* methods to set and remove attributes, manipulate the element's classes, and
|
|
113
|
-
* partially manipulate the element's style.
|
|
114
|
-
*
|
|
115
|
-
* It inherits the {@link https://developer.mozilla.org/docs/Web/API/Element/setAttribute | setAttribute} and {@link https://developer.mozilla.org/docs/Web/API/Element/getAttribute | getAttribute} methods from the {@link HTMLElement} interface.
|
|
116
|
-
*
|
|
117
|
-
*/
|
|
118
|
-
export interface SSRHTMLElement extends Pick<HTMLElement, 'setAttribute' | 'removeAttribute'> {
|
|
119
|
-
/**
|
|
120
|
-
* Object allowing to manipulate the classes of the element.
|
|
121
|
-
*/
|
|
122
|
-
classList: Pick<HTMLElement['classList'], 'add' | 'remove' | 'toggle'>;
|
|
123
|
-
/**
|
|
124
|
-
* Object allowing to manipulate the style of the element.
|
|
125
|
-
*/
|
|
126
|
-
style: Partial<Record<StyleKeyCamelCase | StyleKeyKebabCase, StyleValue>> & Pick<HTMLElement['style'], 'setProperty' | 'removeProperty'>;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Represents a directive function that can be applied to an SSRHTMLElement.
|
|
130
|
-
*
|
|
131
|
-
* @template T - The type of the arguments passed to the directive.
|
|
132
|
-
* @template U - The type of the SSRHTMLElement, defaults to SSRHTMLElement.
|
|
133
|
-
*
|
|
134
|
-
* @param node - The SSRHTMLElement to which the directive is applied.
|
|
135
|
-
* @param args - The arguments passed to the directive.
|
|
136
|
-
*
|
|
137
|
-
* @returns An optional object that may contain:
|
|
138
|
-
* - `update`: A function to update the directive with new arguments.
|
|
139
|
-
* - `destroy`: A function to clean up when the directive is no longer needed.
|
|
140
|
-
*/
|
|
141
|
-
export type Directive<T = void, U extends SSRHTMLElement = SSRHTMLElement> = (node: U, args: T) => void | {
|
|
142
|
-
update?: (args: T) => void;
|
|
143
|
-
destroy?: () => void;
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* Represents a tuple containing a directive and its associated parameter.
|
|
147
|
-
*
|
|
148
|
-
* @template T - The type of the parameter associated with the directive.
|
|
149
|
-
* @template U - The type of the SSRHTMLElement, defaults to SSRHTMLElement.
|
|
150
|
-
*/
|
|
151
|
-
export type DirectiveAndParam<T, U extends SSRHTMLElement = SSRHTMLElement> = [Directive<T, U>, T];
|
|
152
|
-
/**
|
|
153
|
-
* Represents a mapping of directives and their optional parameters.
|
|
154
|
-
*
|
|
155
|
-
* @template T - An array type representing the parameters for the directives.
|
|
156
|
-
* @template U - The type of the SSR HTML element, defaults to `SSRHTMLElement`.
|
|
157
|
-
*/
|
|
158
|
-
export type DirectivesAndOptParam<T extends any[], U extends SSRHTMLElement = SSRHTMLElement> = {
|
|
159
|
-
[K in keyof T]: Directive<void, U> | DirectiveAndParam<T[K], U>;
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* A unique symbol representing an invalid value.
|
|
163
|
-
* This can be used as a sentinel value to indicate that a variable or property
|
|
164
|
-
* does not hold a valid value.
|
|
165
|
-
*/
|
|
166
|
-
export declare const INVALID_VALUE: unique symbol;
|
|
167
|
-
/**
|
|
168
|
-
* A type alias for a function that normalizes a value of type `T`.
|
|
169
|
-
* The function takes a value of type `T` and returns either a normalized value of type `T`
|
|
170
|
-
* or a special constant `INVALID_VALUE` indicating that the value is invalid.
|
|
171
|
-
*
|
|
172
|
-
* @template T - The type of the value to be normalized.
|
|
173
|
-
* @param value - The value to be normalized.
|
|
174
|
-
* @returns The normalized value of type `T` or `INVALID_VALUE` if the value is invalid.
|
|
175
|
-
*/
|
|
176
|
-
export type NormalizeValue<T> = (value: T) => T | typeof INVALID_VALUE;
|
|
177
|
-
/**
|
|
178
|
-
* Interface representing options for a writable store with default values.
|
|
179
|
-
*
|
|
180
|
-
* @template T - The type of the value stored.
|
|
181
|
-
*/
|
|
182
|
-
export interface WritableWithDefaultOptions<T> {
|
|
183
|
-
/**
|
|
184
|
-
* the normalize value function. should return the {@link INVALID_VALUE} symbol when the provided value is invalid
|
|
185
|
-
*/
|
|
186
|
-
normalizeValue?: NormalizeValue<T>;
|
|
187
|
-
/**
|
|
188
|
-
* the equal function, allowing to compare two values. used to check if a previous and current values are equals.
|
|
189
|
-
*/
|
|
190
|
-
equal?: StoreOptions<T>['equal'];
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Represents a type that validates a configuration object.
|
|
194
|
-
*
|
|
195
|
-
* @template T - The type of the configuration object to be validated.
|
|
196
|
-
*
|
|
197
|
-
* This type maps each key of the configuration object `T` to an optional
|
|
198
|
-
* `WritableWithDefaultOptions` type, allowing for partial validation.
|
|
199
|
-
*/
|
|
200
|
-
export type ConfigValidator<T extends object> = {
|
|
201
|
-
[K in keyof T]: WritableWithDefaultOptions<T[K]> | undefined;
|
|
202
|
-
};
|
|
203
|
-
/**
|
|
204
|
-
* Represents a value that can be assigned to an attribute.
|
|
205
|
-
*/
|
|
206
|
-
export type AttributeValue = string | number | boolean | undefined;
|
|
207
|
-
type CamelToKebab<S extends string> = S extends `${infer Head}${infer Tail}` ? `${Head extends Lowercase<Head> ? Head : `-${Lowercase<Head>}`}${CamelToKebab<Tail>}` : S;
|
|
208
|
-
/**
|
|
209
|
-
* Represents a key of the CSSStyleDeclaration interface (in camelCase), excluding certain properties and methods.
|
|
210
|
-
*
|
|
211
|
-
* This is useful for scenarios where you need to work with CSS properties directly without
|
|
212
|
-
* dealing with the methods and other non-style properties of CSSStyleDeclaration.
|
|
213
|
-
*/
|
|
214
|
-
export type StyleKeyCamelCase = Exclude<keyof CSSStyleDeclaration, 'length' | 'item' | 'parentRule' | 'getPropertyValue' | 'getPropertyPriority' | 'setProperty' | 'removeProperty' | typeof Symbol.iterator | number | 'cssText'>;
|
|
215
|
-
/**
|
|
216
|
-
* Represents a key of the CSSStyleDeclaration interface, converted to kebab-case, excluding certain properties and methods.
|
|
217
|
-
*
|
|
218
|
-
* This is useful for scenarios where you need to work with CSS properties directly without
|
|
219
|
-
* dealing with the methods and other non-style properties of CSSStyleDeclaration.
|
|
220
|
-
*/
|
|
221
|
-
export type StyleKeyKebabCase = CamelToKebab<StyleKeyCamelCase>;
|
|
222
|
-
/**
|
|
223
|
-
* Represents a CSS custom property key.
|
|
224
|
-
* CSS custom properties are defined using the `--` prefix.
|
|
225
|
-
*/
|
|
226
|
-
export type StyleKeyCustomProperty = `--${string}`;
|
|
227
|
-
/**
|
|
228
|
-
* Represents a key that can be used for styling purposes.
|
|
229
|
-
* This includes camelCase style keys, kebab-case style keys, and CSS custom property keys.
|
|
230
|
-
*/
|
|
231
|
-
export type StyleKey = StyleKeyCamelCase | StyleKeyKebabCase | StyleKeyCustomProperty;
|
|
232
|
-
/**
|
|
233
|
-
* Represents a value that can be used for styling purposes.
|
|
234
|
-
* @remarks
|
|
235
|
-
* This type can be a string representing a style value, or it can be undefined or null.
|
|
236
|
-
* It is useful for scenarios where a style value might be optional or not set.
|
|
237
|
-
*/
|
|
238
|
-
export type StyleValue = string | undefined | null;
|
|
239
|
-
/**
|
|
240
|
-
* A conditional type that checks if type `T` extends type `U`.
|
|
241
|
-
* @template T - The type to check.
|
|
242
|
-
* @template U - The type to check against.
|
|
243
|
-
* @returns `1` if `T` extends `U`, otherwise `0`.
|
|
244
|
-
*/
|
|
245
|
-
export type Extends<T, U> = T extends U ? 1 : 0;
|
|
246
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
require("@amadeus-it-group/tansu");
|
|
4
|
-
require("esm-env");
|
|
5
|
-
const utils_directive = require("../directive-DCaXmRe_.cjs");
|
|
6
|
-
require("./func.cjs");
|
|
7
|
-
exports.attributesData = utils_directive.attributesData;
|
|
8
|
-
exports.bindDirective = utils_directive.bindDirective;
|
|
9
|
-
exports.bindDirectiveNoArg = utils_directive.bindDirectiveNoArg;
|
|
10
|
-
exports.browserDirective = utils_directive.browserDirective;
|
|
11
|
-
exports.classDirective = utils_directive.classDirective;
|
|
12
|
-
exports.conditionalDirective = utils_directive.conditionalDirective;
|
|
13
|
-
exports.createAttributesDirective = utils_directive.createAttributesDirective;
|
|
14
|
-
exports.createBrowserStoreArrayDirective = utils_directive.createBrowserStoreArrayDirective;
|
|
15
|
-
exports.createBrowserStoreDirective = utils_directive.createBrowserStoreDirective;
|
|
16
|
-
exports.createConditionalBrowserStoreArrayDirective = utils_directive.createConditionalBrowserStoreArrayDirective;
|
|
17
|
-
exports.createConditionalStoreArrayDirective = utils_directive.createConditionalStoreArrayDirective;
|
|
18
|
-
exports.createStoreArrayDirective = utils_directive.createStoreArrayDirective;
|
|
19
|
-
exports.createStoreDirective = utils_directive.createStoreDirective;
|
|
20
|
-
exports.directiveAttributes = utils_directive.directiveAttributes;
|
|
21
|
-
exports.directiveSubscribe = utils_directive.directiveSubscribe;
|
|
22
|
-
exports.directiveUpdate = utils_directive.directiveUpdate;
|
|
23
|
-
exports.isBrowserHTMLElement = utils_directive.isBrowserHTMLElement;
|
|
24
|
-
exports.mapDirectiveArg = utils_directive.mapDirectiveArg;
|
|
25
|
-
exports.mergeDirectives = utils_directive.mergeDirectives;
|
|
26
|
-
exports.multiDirective = utils_directive.multiDirective;
|
|
27
|
-
exports.registrationArray = utils_directive.registrationArray;
|
|
28
|
-
exports.ssrAttributes = utils_directive.ssrAttributes;
|