@fluentui/priority-overflow 0.0.0-nightly-20231019-0416.1 → 0.0.0-nightly-20231023-0416.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +3 -3
- package/CHANGELOG.md +4 -4
- package/lib/createResizeObserver.js +22 -0
- package/lib/createResizeObserver.js.map +1 -0
- package/lib/overflowManager.js +9 -8
- package/lib/overflowManager.js.map +1 -1
- package/lib-commonjs/createResizeObserver.js +32 -0
- package/lib-commonjs/createResizeObserver.js.map +1 -0
- package/lib-commonjs/overflowManager.js +9 -8
- package/lib-commonjs/overflowManager.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
"name": "@fluentui/priority-overflow",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
6
|
-
"tag": "@fluentui/priority-overflow_v0.0.0-nightly-
|
7
|
-
"version": "0.0.0-nightly-
|
5
|
+
"date": "Mon, 23 Oct 2023 04:24:31 GMT",
|
6
|
+
"tag": "@fluentui/priority-overflow_v0.0.0-nightly-20231023-0416.1",
|
7
|
+
"version": "0.0.0-nightly-20231023-0416.1",
|
8
8
|
"comments": {
|
9
9
|
"prerelease": [
|
10
10
|
{
|
package/CHANGELOG.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# Change Log - @fluentui/priority-overflow
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Mon, 23 Oct 2023 04:24:31 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-nightly-
|
7
|
+
## [0.0.0-nightly-20231023-0416.1](https://github.com/microsoft/fluentui/tree/@fluentui/priority-overflow_v0.0.0-nightly-20231023-0416.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/priority-overflow_v9.1.7..@fluentui/priority-overflow_v0.0.0-nightly-
|
9
|
+
Mon, 23 Oct 2023 04:24:31 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/priority-overflow_v9.1.7..@fluentui/priority-overflow_v0.0.0-nightly-20231023-0416.1)
|
11
11
|
|
12
12
|
### Changes
|
13
13
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/**
|
2
|
+
* Helper function that creates a resize observer in the element's own window global
|
3
|
+
* @param elementToObserve - Uses the element's window global to create the resize observer
|
4
|
+
* @param callback
|
5
|
+
* @returns function to cleanup the resize observer
|
6
|
+
*/ export function observeResize(elementToObserve, callback) {
|
7
|
+
var _elementToObserve_ownerDocument_defaultView;
|
8
|
+
const GlobalResizeObsever = (_elementToObserve_ownerDocument_defaultView = elementToObserve.ownerDocument.defaultView) === null || _elementToObserve_ownerDocument_defaultView === void 0 ? void 0 : _elementToObserve_ownerDocument_defaultView.ResizeObserver;
|
9
|
+
if (!GlobalResizeObsever) {
|
10
|
+
if (process.env.NODE_ENV !== 'production') {
|
11
|
+
// eslint-disable-next-line no-console
|
12
|
+
console.error('@fluentui/priority-overflow', 'ResizeObserver does not exist on container window');
|
13
|
+
}
|
14
|
+
return ()=>null;
|
15
|
+
}
|
16
|
+
let resizeObserver = new GlobalResizeObsever(callback);
|
17
|
+
resizeObserver.observe(elementToObserve);
|
18
|
+
return ()=>{
|
19
|
+
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
|
20
|
+
resizeObserver = undefined;
|
21
|
+
};
|
22
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["createResizeObserver.ts"],"sourcesContent":["/**\n * Helper function that creates a resize observer in the element's own window global\n * @param elementToObserve - Uses the element's window global to create the resize observer\n * @param callback\n * @returns function to cleanup the resize observer\n */\nexport function observeResize(elementToObserve: HTMLElement, callback: ResizeObserverCallback) {\n const GlobalResizeObsever = elementToObserve.ownerDocument.defaultView?.ResizeObserver;\n\n if (!GlobalResizeObsever) {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error('@fluentui/priority-overflow', 'ResizeObserver does not exist on container window');\n }\n return () => null;\n }\n\n let resizeObserver: ResizeObserver | undefined = new GlobalResizeObsever(callback);\n resizeObserver.observe(elementToObserve);\n\n return () => {\n resizeObserver?.disconnect();\n resizeObserver = undefined;\n };\n}\n"],"names":["observeResize","elementToObserve","callback","GlobalResizeObsever","ownerDocument","defaultView","ResizeObserver","process","env","NODE_ENV","console","error","resizeObserver","observe","disconnect","undefined"],"mappings":"AAAA;;;;;CAKC,GACD,OAAO,SAASA,cAAcC,gBAA6B,EAAEC,QAAgC;QAC/DD;IAA5B,MAAME,uBAAsBF,8CAAAA,iBAAiBG,aAAa,CAACC,WAAW,cAA1CJ,kEAAAA,4CAA4CK,cAAc;IAEtF,IAAI,CAACH,qBAAqB;QACxB,IAAII,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACzC,sCAAsC;YACtCC,QAAQC,KAAK,CAAC,+BAA+B;QAC/C;QACA,OAAO,IAAM;IACf;IAEA,IAAIC,iBAA6C,IAAIT,oBAAoBD;IACzEU,eAAeC,OAAO,CAACZ;IAEvB,OAAO;QACLW,2BAAAA,qCAAAA,eAAgBE,UAAU;QAC1BF,iBAAiBG;IACnB;AACF"}
|
package/lib/overflowManager.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { DATA_OVERFLOWING, DATA_OVERFLOW_GROUP } from './consts';
|
2
|
+
import { observeResize } from './createResizeObserver';
|
2
3
|
import { debounce } from './debounce';
|
3
4
|
import { createPriorityQueue } from './priorityQueue';
|
4
5
|
/**
|
@@ -25,12 +26,7 @@ import { createPriorityQueue } from './priorityQueue';
|
|
25
26
|
};
|
26
27
|
const overflowItems = {};
|
27
28
|
const overflowDividers = {};
|
28
|
-
|
29
|
-
if (!entries[0] || !container) {
|
30
|
-
return;
|
31
|
-
}
|
32
|
-
update();
|
33
|
-
});
|
29
|
+
let disposeResizeObserver = ()=>null;
|
34
30
|
const getNextItem = (queueToDequeue, queueToEnqueue)=>{
|
35
31
|
const nextItem = queueToDequeue.dequeue();
|
36
32
|
queueToEnqueue.enqueue(nextItem);
|
@@ -193,12 +189,17 @@ import { createPriorityQueue } from './priorityQueue';
|
|
193
189
|
observing = true;
|
194
190
|
Object.values(overflowItems).forEach((item)=>visibleItemQueue.enqueue(item.id));
|
195
191
|
container = observedContainer;
|
196
|
-
|
192
|
+
disposeResizeObserver = observeResize(container, (entries)=>{
|
193
|
+
if (!entries[0] || !container) {
|
194
|
+
return;
|
195
|
+
}
|
196
|
+
update();
|
197
|
+
});
|
197
198
|
};
|
198
199
|
const disconnect = ()=>{
|
199
200
|
observing = false;
|
200
201
|
sizeCache.clear();
|
201
|
-
|
202
|
+
disposeResizeObserver();
|
202
203
|
};
|
203
204
|
const addItem = (item)=>{
|
204
205
|
if (overflowItems[item.id]) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["overflowManager.ts"],"sourcesContent":["import { DATA_OVERFLOWING, DATA_OVERFLOW_GROUP } from './consts';\nimport { debounce } from './debounce';\nimport { createPriorityQueue, PriorityQueue } from './priorityQueue';\nimport type {\n OverflowGroupState,\n OverflowItemEntry,\n OverflowManager,\n ObserveOptions,\n OverflowDividerEntry,\n} from './types';\n\n/**\n * @internal\n * @returns overflow manager instance\n */\nexport function createOverflowManager(): OverflowManager {\n // calls to `offsetWidth or offsetHeight` can happen multiple times in an update\n // Use a cache to avoid causing too many recalcs and avoid scripting time to meausure sizes\n const sizeCache = new Map<HTMLElement, number>();\n let container: HTMLElement | undefined;\n let overflowMenu: HTMLElement | undefined;\n // Set as true when resize observer is observing\n let observing = false;\n // If true, next update will dispatch to onUpdateOverflow even if queue top states don't change\n // Initially true to force dispatch on first mount\n let forceDispatch = true;\n const options: Required<ObserveOptions> = {\n padding: 10,\n overflowAxis: 'horizontal',\n overflowDirection: 'end',\n minimumVisible: 0,\n onUpdateItemVisibility: () => undefined,\n onUpdateOverflow: () => undefined,\n };\n\n const overflowItems: Record<string, OverflowItemEntry> = {};\n const overflowDividers: Record<string, OverflowDividerEntry> = {};\n const resizeObserver = new ResizeObserver(entries => {\n if (!entries[0] || !container) {\n return;\n }\n\n update();\n });\n\n const getNextItem = (queueToDequeue: PriorityQueue<string>, queueToEnqueue: PriorityQueue<string>) => {\n const nextItem = queueToDequeue.dequeue();\n queueToEnqueue.enqueue(nextItem);\n return overflowItems[nextItem];\n };\n\n const createGroupManager = () => {\n const groupVisibility: Record<string, OverflowGroupState> = {};\n const groups: Record<string, { visibleItemIds: Set<string>; invisibleItemIds: Set<string> }> = {};\n function updateGroupVisibility(groupId: string) {\n const group = groups[groupId];\n if (group.invisibleItemIds.size && group.visibleItemIds.size) {\n groupVisibility[groupId] = 'overflow';\n } else if (group.visibleItemIds.size === 0) {\n groupVisibility[groupId] = 'hidden';\n } else {\n groupVisibility[groupId] = 'visible';\n }\n }\n function isGroupVisible(groupId: string) {\n return groupVisibility[groupId] === 'visible' || groupVisibility[groupId] === 'overflow';\n }\n return {\n groupVisibility: () => groupVisibility,\n isSingleItemVisible(itemId: string, groupId: string) {\n return (\n isGroupVisible(groupId) &&\n groups[groupId].visibleItemIds.has(itemId) &&\n groups[groupId].visibleItemIds.size === 1\n );\n },\n addItem(itemId: string, groupId: string) {\n groups[groupId] ??= {\n visibleItemIds: new Set<string>(),\n invisibleItemIds: new Set<string>(),\n };\n\n groups[groupId].visibleItemIds.add(itemId);\n updateGroupVisibility(groupId);\n },\n removeItem(itemId: string, groupId: string) {\n groups[groupId].invisibleItemIds.delete(itemId);\n groups[groupId].visibleItemIds.delete(itemId);\n updateGroupVisibility(groupId);\n },\n showItem(itemId: string, groupId: string) {\n groups[groupId].invisibleItemIds.delete(itemId);\n groups[groupId].visibleItemIds.add(itemId);\n updateGroupVisibility(groupId);\n },\n hideItem(itemId: string, groupId: string) {\n groups[groupId].invisibleItemIds.add(itemId);\n groups[groupId].visibleItemIds.delete(itemId);\n updateGroupVisibility(groupId);\n },\n };\n };\n\n const groupManager = createGroupManager();\n\n function compareItems(lt: string | null, rt: string | null): number {\n if (!lt || !rt) {\n return 0;\n }\n\n const lte = overflowItems[lt];\n const rte = overflowItems[rt];\n\n if (lte.priority !== rte.priority) {\n return lte.priority > rte.priority ? 1 : -1;\n }\n\n const positionStatusBit =\n options.overflowDirection === 'end' ? Node.DOCUMENT_POSITION_FOLLOWING : Node.DOCUMENT_POSITION_PRECEDING;\n\n // eslint-disable-next-line no-bitwise\n return lte.element.compareDocumentPosition(rte.element) & positionStatusBit ? 1 : -1;\n }\n\n function getElementAxisSize(\n horizontal: 'clientWidth' | 'offsetWidth',\n vertical: 'clientHeight' | 'offsetHeight',\n el: HTMLElement,\n ): number {\n if (!sizeCache.has(el)) {\n sizeCache.set(el, options.overflowAxis === 'horizontal' ? el[horizontal] : el[vertical]);\n }\n\n return sizeCache.get(el)!;\n }\n\n const getOffsetSize = getElementAxisSize.bind(null, 'offsetWidth', 'offsetHeight');\n const getClientSize = getElementAxisSize.bind(null, 'clientWidth', 'clientHeight');\n\n const invisibleItemQueue = createPriorityQueue<string>((a, b) => -1 * compareItems(a, b));\n\n const visibleItemQueue = createPriorityQueue<string>(compareItems);\n\n function occupiedSize(): number {\n const totalItemSize = visibleItemQueue\n .all()\n .map(id => overflowItems[id].element)\n .map(getOffsetSize)\n .reduce((prev, current) => prev + current, 0);\n\n const totalDividerSize = Object.entries(groupManager.groupVisibility()).reduce(\n (acc, [id, state]) =>\n acc + (state !== 'hidden' && overflowDividers[id] ? getOffsetSize(overflowDividers[id].element) : 0),\n 0,\n );\n\n const overflowMenuSize = invisibleItemQueue.size() > 0 && overflowMenu ? getOffsetSize(overflowMenu) : 0;\n\n return totalItemSize + totalDividerSize + overflowMenuSize;\n }\n\n const showItem = () => {\n const item = getNextItem(invisibleItemQueue, visibleItemQueue);\n options.onUpdateItemVisibility({ item, visible: true });\n\n if (item.groupId) {\n groupManager.showItem(item.id, item.groupId);\n\n if (groupManager.isSingleItemVisible(item.id, item.groupId)) {\n overflowDividers[item.groupId]?.element.removeAttribute(DATA_OVERFLOWING);\n }\n }\n };\n\n const hideItem = () => {\n const item = getNextItem(visibleItemQueue, invisibleItemQueue);\n options.onUpdateItemVisibility({ item, visible: false });\n\n if (item.groupId) {\n if (groupManager.isSingleItemVisible(item.id, item.groupId)) {\n overflowDividers[item.groupId]?.element.setAttribute(DATA_OVERFLOWING, '');\n }\n\n groupManager.hideItem(item.id, item.groupId);\n }\n };\n\n const dispatchOverflowUpdate = () => {\n const visibleItemIds = visibleItemQueue.all();\n const invisibleItemIds = invisibleItemQueue.all();\n\n const visibleItems = visibleItemIds.map(itemId => overflowItems[itemId]);\n const invisibleItems = invisibleItemIds.map(itemId => overflowItems[itemId]);\n\n options.onUpdateOverflow({ visibleItems, invisibleItems, groupVisibility: groupManager.groupVisibility() });\n };\n\n const processOverflowItems = (): boolean => {\n if (!container) {\n return false;\n }\n sizeCache.clear();\n\n const availableSize = getClientSize(container) - options.padding;\n\n // Snapshot of the visible/invisible state to compare for updates\n const visibleTop = visibleItemQueue.peek();\n const invisibleTop = invisibleItemQueue.peek();\n\n while (compareItems(invisibleItemQueue.peek(), visibleItemQueue.peek()) > 0) {\n hideItem(); // hide elements whose priority become smaller than the highest priority of the hidden one\n }\n\n // Run the show/hide step twice - the first step might not be correct if\n // it was triggered by a new item being added - new items are always visible by default.\n for (let i = 0; i < 2; i++) {\n // Add items until available width is filled - can result in overflow\n while (\n (occupiedSize() < availableSize && invisibleItemQueue.size() > 0) ||\n invisibleItemQueue.size() === 1 // attempt to show the last invisible item hoping it's size does not exceed overflow menu size\n ) {\n showItem();\n }\n\n // Remove items until there's no more overflow\n while (occupiedSize() > availableSize && visibleItemQueue.size() > options.minimumVisible) {\n hideItem();\n }\n }\n\n // only update when the state of visible/invisible items has changed\n return visibleItemQueue.peek() !== visibleTop || invisibleItemQueue.peek() !== invisibleTop;\n };\n\n const forceUpdate: OverflowManager['forceUpdate'] = () => {\n if (processOverflowItems() || forceDispatch) {\n forceDispatch = false;\n dispatchOverflowUpdate();\n }\n };\n\n const update: OverflowManager['update'] = debounce(forceUpdate);\n\n const observe: OverflowManager['observe'] = (observedContainer, userOptions) => {\n Object.assign(options, userOptions);\n observing = true;\n Object.values(overflowItems).forEach(item => visibleItemQueue.enqueue(item.id));\n\n container = observedContainer;\n resizeObserver.observe(container);\n };\n\n const disconnect: OverflowManager['disconnect'] = () => {\n observing = false;\n sizeCache.clear();\n resizeObserver.disconnect();\n };\n\n const addItem: OverflowManager['addItem'] = item => {\n if (overflowItems[item.id]) {\n return;\n }\n\n overflowItems[item.id] = item;\n\n // some options can affect priority which are only set on `observe`\n if (observing) {\n // Updates to elements might not change the queue tops\n // i.e. new element is enqueued but the top of the queue stays the same\n // force a dispatch on the next batched update\n forceDispatch = true;\n visibleItemQueue.enqueue(item.id);\n }\n\n if (item.groupId) {\n groupManager.addItem(item.id, item.groupId);\n item.element.setAttribute(DATA_OVERFLOW_GROUP, item.groupId);\n }\n\n update();\n };\n\n const addOverflowMenu: OverflowManager['addOverflowMenu'] = el => {\n overflowMenu = el;\n };\n\n const addDivider: OverflowManager['addDivider'] = divider => {\n if (!divider.groupId || overflowDividers[divider.groupId]) {\n return;\n }\n\n divider.element.setAttribute(DATA_OVERFLOW_GROUP, divider.groupId);\n overflowDividers[divider.groupId] = divider;\n };\n\n const removeOverflowMenu: OverflowManager['removeOverflowMenu'] = () => {\n overflowMenu = undefined;\n };\n\n const removeDivider: OverflowManager['removeDivider'] = groupId => {\n if (!overflowDividers[groupId]) {\n return;\n }\n const divider = overflowDividers[groupId];\n if (divider.groupId) {\n delete overflowDividers[groupId];\n divider.element.removeAttribute(DATA_OVERFLOW_GROUP);\n }\n };\n\n const removeItem: OverflowManager['removeItem'] = itemId => {\n if (!overflowItems[itemId]) {\n return;\n }\n\n const item = overflowItems[itemId];\n visibleItemQueue.remove(itemId);\n invisibleItemQueue.remove(itemId);\n\n if (item.groupId) {\n groupManager.removeItem(item.id, item.groupId);\n item.element.removeAttribute(DATA_OVERFLOW_GROUP);\n }\n\n sizeCache.delete(item.element);\n delete overflowItems[itemId];\n update();\n };\n\n return {\n addItem,\n disconnect,\n forceUpdate,\n observe,\n removeItem,\n update,\n addOverflowMenu,\n removeOverflowMenu,\n addDivider,\n removeDivider,\n };\n}\n"],"names":["DATA_OVERFLOWING","DATA_OVERFLOW_GROUP","debounce","createPriorityQueue","createOverflowManager","sizeCache","Map","container","overflowMenu","observing","forceDispatch","options","padding","overflowAxis","overflowDirection","minimumVisible","onUpdateItemVisibility","undefined","onUpdateOverflow","overflowItems","overflowDividers","resizeObserver","ResizeObserver","entries","update","getNextItem","queueToDequeue","queueToEnqueue","nextItem","dequeue","enqueue","createGroupManager","groupVisibility","groups","updateGroupVisibility","groupId","group","invisibleItemIds","size","visibleItemIds","isGroupVisible","isSingleItemVisible","itemId","has","addItem","Set","add","removeItem","delete","showItem","hideItem","groupManager","compareItems","lt","rt","lte","rte","priority","positionStatusBit","Node","DOCUMENT_POSITION_FOLLOWING","DOCUMENT_POSITION_PRECEDING","element","compareDocumentPosition","getElementAxisSize","horizontal","vertical","el","set","get","getOffsetSize","bind","getClientSize","invisibleItemQueue","a","b","visibleItemQueue","occupiedSize","totalItemSize","all","map","id","reduce","prev","current","totalDividerSize","Object","acc","state","overflowMenuSize","item","visible","removeAttribute","setAttribute","dispatchOverflowUpdate","visibleItems","invisibleItems","processOverflowItems","clear","availableSize","visibleTop","peek","invisibleTop","i","forceUpdate","observe","observedContainer","userOptions","assign","values","forEach","disconnect","addOverflowMenu","addDivider","divider","removeOverflowMenu","removeDivider","remove"],"mappings":"AAAA,SAASA,gBAAgB,EAAEC,mBAAmB,QAAQ,WAAW;AACjE,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,mBAAmB,QAAuB,kBAAkB;AASrE;;;CAGC,GACD,OAAO,SAASC;IACd,gFAAgF;IAChF,2FAA2F;IAC3F,MAAMC,YAAY,IAAIC;IACtB,IAAIC;IACJ,IAAIC;IACJ,gDAAgD;IAChD,IAAIC,Y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BgB,aAAaJ,UAAU,CAAC2C,KAAKT,EAAE,EAAES,KAAKvD,OAAO;YAC7CuD,KAAK5B,OAAO,CAAC8B,eAAe,CAAC3F;QAC/B;QAEAI,UAAU2C,MAAM,CAAC0C,KAAK5B,OAAO;QAC7B,OAAO3C,aAAa,CAACuB,OAAO;QAC5BlB;IACF;IAEA,OAAO;QACLoB;QACAmE;QACAP;QACAC;QACA1D;QACAvB;QACAwF;QACAG;QACAF;QACAG;IACF;AACF"}
|
1
|
+
{"version":3,"sources":["overflowManager.ts"],"sourcesContent":["import { DATA_OVERFLOWING, DATA_OVERFLOW_GROUP } from './consts';\nimport { observeResize } from './createResizeObserver';\nimport { debounce } from './debounce';\nimport { createPriorityQueue, PriorityQueue } from './priorityQueue';\nimport type {\n OverflowGroupState,\n OverflowItemEntry,\n OverflowManager,\n ObserveOptions,\n OverflowDividerEntry,\n} from './types';\n\n/**\n * @internal\n * @returns overflow manager instance\n */\nexport function createOverflowManager(): OverflowManager {\n // calls to `offsetWidth or offsetHeight` can happen multiple times in an update\n // Use a cache to avoid causing too many recalcs and avoid scripting time to meausure sizes\n const sizeCache = new Map<HTMLElement, number>();\n let container: HTMLElement | undefined;\n let overflowMenu: HTMLElement | undefined;\n // Set as true when resize observer is observing\n let observing = false;\n // If true, next update will dispatch to onUpdateOverflow even if queue top states don't change\n // Initially true to force dispatch on first mount\n let forceDispatch = true;\n const options: Required<ObserveOptions> = {\n padding: 10,\n overflowAxis: 'horizontal',\n overflowDirection: 'end',\n minimumVisible: 0,\n onUpdateItemVisibility: () => undefined,\n onUpdateOverflow: () => undefined,\n };\n\n const overflowItems: Record<string, OverflowItemEntry> = {};\n const overflowDividers: Record<string, OverflowDividerEntry> = {};\n let disposeResizeObserver: () => void = () => null;\n\n const getNextItem = (queueToDequeue: PriorityQueue<string>, queueToEnqueue: PriorityQueue<string>) => {\n const nextItem = queueToDequeue.dequeue();\n queueToEnqueue.enqueue(nextItem);\n return overflowItems[nextItem];\n };\n\n const createGroupManager = () => {\n const groupVisibility: Record<string, OverflowGroupState> = {};\n const groups: Record<string, { visibleItemIds: Set<string>; invisibleItemIds: Set<string> }> = {};\n function updateGroupVisibility(groupId: string) {\n const group = groups[groupId];\n if (group.invisibleItemIds.size && group.visibleItemIds.size) {\n groupVisibility[groupId] = 'overflow';\n } else if (group.visibleItemIds.size === 0) {\n groupVisibility[groupId] = 'hidden';\n } else {\n groupVisibility[groupId] = 'visible';\n }\n }\n function isGroupVisible(groupId: string) {\n return groupVisibility[groupId] === 'visible' || groupVisibility[groupId] === 'overflow';\n }\n return {\n groupVisibility: () => groupVisibility,\n isSingleItemVisible(itemId: string, groupId: string) {\n return (\n isGroupVisible(groupId) &&\n groups[groupId].visibleItemIds.has(itemId) &&\n groups[groupId].visibleItemIds.size === 1\n );\n },\n addItem(itemId: string, groupId: string) {\n groups[groupId] ??= {\n visibleItemIds: new Set<string>(),\n invisibleItemIds: new Set<string>(),\n };\n\n groups[groupId].visibleItemIds.add(itemId);\n updateGroupVisibility(groupId);\n },\n removeItem(itemId: string, groupId: string) {\n groups[groupId].invisibleItemIds.delete(itemId);\n groups[groupId].visibleItemIds.delete(itemId);\n updateGroupVisibility(groupId);\n },\n showItem(itemId: string, groupId: string) {\n groups[groupId].invisibleItemIds.delete(itemId);\n groups[groupId].visibleItemIds.add(itemId);\n updateGroupVisibility(groupId);\n },\n hideItem(itemId: string, groupId: string) {\n groups[groupId].invisibleItemIds.add(itemId);\n groups[groupId].visibleItemIds.delete(itemId);\n updateGroupVisibility(groupId);\n },\n };\n };\n\n const groupManager = createGroupManager();\n\n function compareItems(lt: string | null, rt: string | null): number {\n if (!lt || !rt) {\n return 0;\n }\n\n const lte = overflowItems[lt];\n const rte = overflowItems[rt];\n\n if (lte.priority !== rte.priority) {\n return lte.priority > rte.priority ? 1 : -1;\n }\n\n const positionStatusBit =\n options.overflowDirection === 'end' ? Node.DOCUMENT_POSITION_FOLLOWING : Node.DOCUMENT_POSITION_PRECEDING;\n\n // eslint-disable-next-line no-bitwise\n return lte.element.compareDocumentPosition(rte.element) & positionStatusBit ? 1 : -1;\n }\n\n function getElementAxisSize(\n horizontal: 'clientWidth' | 'offsetWidth',\n vertical: 'clientHeight' | 'offsetHeight',\n el: HTMLElement,\n ): number {\n if (!sizeCache.has(el)) {\n sizeCache.set(el, options.overflowAxis === 'horizontal' ? el[horizontal] : el[vertical]);\n }\n\n return sizeCache.get(el)!;\n }\n\n const getOffsetSize = getElementAxisSize.bind(null, 'offsetWidth', 'offsetHeight');\n const getClientSize = getElementAxisSize.bind(null, 'clientWidth', 'clientHeight');\n\n const invisibleItemQueue = createPriorityQueue<string>((a, b) => -1 * compareItems(a, b));\n\n const visibleItemQueue = createPriorityQueue<string>(compareItems);\n\n function occupiedSize(): number {\n const totalItemSize = visibleItemQueue\n .all()\n .map(id => overflowItems[id].element)\n .map(getOffsetSize)\n .reduce((prev, current) => prev + current, 0);\n\n const totalDividerSize = Object.entries(groupManager.groupVisibility()).reduce(\n (acc, [id, state]) =>\n acc + (state !== 'hidden' && overflowDividers[id] ? getOffsetSize(overflowDividers[id].element) : 0),\n 0,\n );\n\n const overflowMenuSize = invisibleItemQueue.size() > 0 && overflowMenu ? getOffsetSize(overflowMenu) : 0;\n\n return totalItemSize + totalDividerSize + overflowMenuSize;\n }\n\n const showItem = () => {\n const item = getNextItem(invisibleItemQueue, visibleItemQueue);\n options.onUpdateItemVisibility({ item, visible: true });\n\n if (item.groupId) {\n groupManager.showItem(item.id, item.groupId);\n\n if (groupManager.isSingleItemVisible(item.id, item.groupId)) {\n overflowDividers[item.groupId]?.element.removeAttribute(DATA_OVERFLOWING);\n }\n }\n };\n\n const hideItem = () => {\n const item = getNextItem(visibleItemQueue, invisibleItemQueue);\n options.onUpdateItemVisibility({ item, visible: false });\n\n if (item.groupId) {\n if (groupManager.isSingleItemVisible(item.id, item.groupId)) {\n overflowDividers[item.groupId]?.element.setAttribute(DATA_OVERFLOWING, '');\n }\n\n groupManager.hideItem(item.id, item.groupId);\n }\n };\n\n const dispatchOverflowUpdate = () => {\n const visibleItemIds = visibleItemQueue.all();\n const invisibleItemIds = invisibleItemQueue.all();\n\n const visibleItems = visibleItemIds.map(itemId => overflowItems[itemId]);\n const invisibleItems = invisibleItemIds.map(itemId => overflowItems[itemId]);\n\n options.onUpdateOverflow({ visibleItems, invisibleItems, groupVisibility: groupManager.groupVisibility() });\n };\n\n const processOverflowItems = (): boolean => {\n if (!container) {\n return false;\n }\n sizeCache.clear();\n\n const availableSize = getClientSize(container) - options.padding;\n\n // Snapshot of the visible/invisible state to compare for updates\n const visibleTop = visibleItemQueue.peek();\n const invisibleTop = invisibleItemQueue.peek();\n\n while (compareItems(invisibleItemQueue.peek(), visibleItemQueue.peek()) > 0) {\n hideItem(); // hide elements whose priority become smaller than the highest priority of the hidden one\n }\n\n // Run the show/hide step twice - the first step might not be correct if\n // it was triggered by a new item being added - new items are always visible by default.\n for (let i = 0; i < 2; i++) {\n // Add items until available width is filled - can result in overflow\n while (\n (occupiedSize() < availableSize && invisibleItemQueue.size() > 0) ||\n invisibleItemQueue.size() === 1 // attempt to show the last invisible item hoping it's size does not exceed overflow menu size\n ) {\n showItem();\n }\n\n // Remove items until there's no more overflow\n while (occupiedSize() > availableSize && visibleItemQueue.size() > options.minimumVisible) {\n hideItem();\n }\n }\n\n // only update when the state of visible/invisible items has changed\n return visibleItemQueue.peek() !== visibleTop || invisibleItemQueue.peek() !== invisibleTop;\n };\n\n const forceUpdate: OverflowManager['forceUpdate'] = () => {\n if (processOverflowItems() || forceDispatch) {\n forceDispatch = false;\n dispatchOverflowUpdate();\n }\n };\n\n const update: OverflowManager['update'] = debounce(forceUpdate);\n\n const observe: OverflowManager['observe'] = (observedContainer, userOptions) => {\n Object.assign(options, userOptions);\n observing = true;\n Object.values(overflowItems).forEach(item => visibleItemQueue.enqueue(item.id));\n\n container = observedContainer;\n disposeResizeObserver = observeResize(container, entries => {\n if (!entries[0] || !container) {\n return;\n }\n\n update();\n });\n };\n\n const disconnect: OverflowManager['disconnect'] = () => {\n observing = false;\n sizeCache.clear();\n disposeResizeObserver();\n };\n\n const addItem: OverflowManager['addItem'] = item => {\n if (overflowItems[item.id]) {\n return;\n }\n\n overflowItems[item.id] = item;\n\n // some options can affect priority which are only set on `observe`\n if (observing) {\n // Updates to elements might not change the queue tops\n // i.e. new element is enqueued but the top of the queue stays the same\n // force a dispatch on the next batched update\n forceDispatch = true;\n visibleItemQueue.enqueue(item.id);\n }\n\n if (item.groupId) {\n groupManager.addItem(item.id, item.groupId);\n item.element.setAttribute(DATA_OVERFLOW_GROUP, item.groupId);\n }\n\n update();\n };\n\n const addOverflowMenu: OverflowManager['addOverflowMenu'] = el => {\n overflowMenu = el;\n };\n\n const addDivider: OverflowManager['addDivider'] = divider => {\n if (!divider.groupId || overflowDividers[divider.groupId]) {\n return;\n }\n\n divider.element.setAttribute(DATA_OVERFLOW_GROUP, divider.groupId);\n overflowDividers[divider.groupId] = divider;\n };\n\n const removeOverflowMenu: OverflowManager['removeOverflowMenu'] = () => {\n overflowMenu = undefined;\n };\n\n const removeDivider: OverflowManager['removeDivider'] = groupId => {\n if (!overflowDividers[groupId]) {\n return;\n }\n const divider = overflowDividers[groupId];\n if (divider.groupId) {\n delete overflowDividers[groupId];\n divider.element.removeAttribute(DATA_OVERFLOW_GROUP);\n }\n };\n\n const removeItem: OverflowManager['removeItem'] = itemId => {\n if (!overflowItems[itemId]) {\n return;\n }\n\n const item = overflowItems[itemId];\n visibleItemQueue.remove(itemId);\n invisibleItemQueue.remove(itemId);\n\n if (item.groupId) {\n groupManager.removeItem(item.id, item.groupId);\n item.element.removeAttribute(DATA_OVERFLOW_GROUP);\n }\n\n sizeCache.delete(item.element);\n delete overflowItems[itemId];\n update();\n };\n\n return {\n addItem,\n disconnect,\n forceUpdate,\n observe,\n removeItem,\n update,\n addOverflowMenu,\n removeOverflowMenu,\n addDivider,\n removeDivider,\n };\n}\n"],"names":["DATA_OVERFLOWING","DATA_OVERFLOW_GROUP","observeResize","debounce","createPriorityQueue","createOverflowManager","sizeCache","Map","container","overflowMenu","observing","forceDispatch","options","padding","overflowAxis","overflowDirection","minimumVisible","onUpdateItemVisibility","undefined","onUpdateOverflow","overflowItems","overflowDividers","disposeResizeObserver","getNextItem","queueToDequeue","queueToEnqueue","nextItem","dequeue","enqueue","createGroupManager","groupVisibility","groups","updateGroupVisibility","groupId","group","invisibleItemIds","size","visibleItemIds","isGroupVisible","isSingleItemVisible","itemId","has","addItem","Set","add","removeItem","delete","showItem","hideItem","groupManager","compareItems","lt","rt","lte","rte","priority","positionStatusBit","Node","DOCUMENT_POSITION_FOLLOWING","DOCUMENT_POSITION_PRECEDING","element","compareDocumentPosition","getElementAxisSize","horizontal","vertical","el","set","get","getOffsetSize","bind","getClientSize","invisibleItemQueue","a","b","visibleItemQueue","occupiedSize","totalItemSize","all","map","id","reduce","prev","current","totalDividerSize","Object","entries","acc","state","overflowMenuSize","item","visible","removeAttribute","setAttribute","dispatchOverflowUpdate","visibleItems","invisibleItems","processOverflowItems","clear","availableSize","visibleTop","peek","invisibleTop","i","forceUpdate","update","observe","observedContainer","userOptions","assign","values","forEach","disconnect","addOverflowMenu","addDivider","divider","removeOverflowMenu","removeDivider","remove"],"mappings":"AAAA,SAASA,gBAAgB,EAAEC,mBAAmB,QAAQ,WAAW;AACjE,SAASC,aAAa,QAAQ,yBAAyB;AACvD,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,mBAAmB,QAAuB,kBAAkB;AASrE;;;CAGC,GACD,OAAO,SAASC;IACd,gFAAgF;IAChF,2FAA2F;IAC3F,MAAMC,YAAY,IAAIC;IACtB,IAAIC;IACJ,IAAIC;IACJ,gDAAgD;IAChD,IAAIC,YAAY;IAChB,+FAA+F;IAC/F,kDAAkD;IAClD,IAAIC,gBAAgB;IACpB,MAAMC,UAAoC;QACxCC,SAAS;QACTC,cAAc;QACdC,mBAAmB;QACnBC,gBAAgB;QAChBC,wBAAwB,IAAMC;QAC9BC,kBAAkB,I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ACoB,OAAO;QAC5BgE;IACF;IAEA,OAAO;QACL9D;QACAqE;QACAR;QACAE;QACA5D;QACA2D;QACAQ;QACAG;QACAF;QACAG;IACF;AACF"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/**
|
2
|
+
* Helper function that creates a resize observer in the element's own window global
|
3
|
+
* @param elementToObserve - Uses the element's window global to create the resize observer
|
4
|
+
* @param callback
|
5
|
+
* @returns function to cleanup the resize observer
|
6
|
+
*/ "use strict";
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
8
|
+
value: true
|
9
|
+
});
|
10
|
+
Object.defineProperty(exports, "observeResize", {
|
11
|
+
enumerable: true,
|
12
|
+
get: function() {
|
13
|
+
return observeResize;
|
14
|
+
}
|
15
|
+
});
|
16
|
+
function observeResize(elementToObserve, callback) {
|
17
|
+
var _elementToObserve_ownerDocument_defaultView;
|
18
|
+
const GlobalResizeObsever = (_elementToObserve_ownerDocument_defaultView = elementToObserve.ownerDocument.defaultView) === null || _elementToObserve_ownerDocument_defaultView === void 0 ? void 0 : _elementToObserve_ownerDocument_defaultView.ResizeObserver;
|
19
|
+
if (!GlobalResizeObsever) {
|
20
|
+
if (process.env.NODE_ENV !== 'production') {
|
21
|
+
// eslint-disable-next-line no-console
|
22
|
+
console.error('@fluentui/priority-overflow', 'ResizeObserver does not exist on container window');
|
23
|
+
}
|
24
|
+
return ()=>null;
|
25
|
+
}
|
26
|
+
let resizeObserver = new GlobalResizeObsever(callback);
|
27
|
+
resizeObserver.observe(elementToObserve);
|
28
|
+
return ()=>{
|
29
|
+
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
|
30
|
+
resizeObserver = undefined;
|
31
|
+
};
|
32
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["createResizeObserver.js"],"sourcesContent":["/**\n * Helper function that creates a resize observer in the element's own window global\n * @param elementToObserve - Uses the element's window global to create the resize observer\n * @param callback\n * @returns function to cleanup the resize observer\n */ export function observeResize(elementToObserve, callback) {\n var _elementToObserve_ownerDocument_defaultView;\n const GlobalResizeObsever = (_elementToObserve_ownerDocument_defaultView = elementToObserve.ownerDocument.defaultView) === null || _elementToObserve_ownerDocument_defaultView === void 0 ? void 0 : _elementToObserve_ownerDocument_defaultView.ResizeObserver;\n if (!GlobalResizeObsever) {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error('@fluentui/priority-overflow', 'ResizeObserver does not exist on container window');\n }\n return ()=>null;\n }\n let resizeObserver = new GlobalResizeObsever(callback);\n resizeObserver.observe(elementToObserve);\n return ()=>{\n resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();\n resizeObserver = undefined;\n };\n}\n"],"names":["observeResize","elementToObserve","callback","_elementToObserve_ownerDocument_defaultView","GlobalResizeObsever","ownerDocument","defaultView","ResizeObserver","process","env","NODE_ENV","console","error","resizeObserver","observe","disconnect","undefined"],"mappings":"AAAA;;;;;CAKC;;;;+BAAmBA;;;eAAAA;;;AAAT,SAASA,cAAcC,gBAAgB,EAAEC,QAAQ;IACxD,IAAIC;IACJ,MAAMC,sBAAsB,AAACD,CAAAA,8CAA8CF,iBAAiBI,aAAa,CAACC,WAAW,AAAD,MAAO,QAAQH,gDAAgD,KAAK,IAAI,KAAK,IAAIA,4CAA4CI,cAAc;IAC/P,IAAI,CAACH,qBAAqB;QACtB,IAAII,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACvC,sCAAsC;YACtCC,QAAQC,KAAK,CAAC,+BAA+B;QACjD;QACA,OAAO,IAAI;IACf;IACA,IAAIC,iBAAiB,IAAIT,oBAAoBF;IAC7CW,eAAeC,OAAO,CAACb;IACvB,OAAO;QACHY,mBAAmB,QAAQA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeE,UAAU;QACzFF,iBAAiBG;IACrB;AACJ"}
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "createOverflowManager", {
|
|
9
9
|
}
|
10
10
|
});
|
11
11
|
const _consts = require("./consts");
|
12
|
+
const _createResizeObserver = require("./createResizeObserver");
|
12
13
|
const _debounce = require("./debounce");
|
13
14
|
const _priorityQueue = require("./priorityQueue");
|
14
15
|
function createOverflowManager() {
|
@@ -32,12 +33,7 @@ function createOverflowManager() {
|
|
32
33
|
};
|
33
34
|
const overflowItems = {};
|
34
35
|
const overflowDividers = {};
|
35
|
-
|
36
|
-
if (!entries[0] || !container) {
|
37
|
-
return;
|
38
|
-
}
|
39
|
-
update();
|
40
|
-
});
|
36
|
+
let disposeResizeObserver = ()=>null;
|
41
37
|
const getNextItem = (queueToDequeue, queueToEnqueue)=>{
|
42
38
|
const nextItem = queueToDequeue.dequeue();
|
43
39
|
queueToEnqueue.enqueue(nextItem);
|
@@ -200,12 +196,17 @@ function createOverflowManager() {
|
|
200
196
|
observing = true;
|
201
197
|
Object.values(overflowItems).forEach((item)=>visibleItemQueue.enqueue(item.id));
|
202
198
|
container = observedContainer;
|
203
|
-
|
199
|
+
disposeResizeObserver = (0, _createResizeObserver.observeResize)(container, (entries)=>{
|
200
|
+
if (!entries[0] || !container) {
|
201
|
+
return;
|
202
|
+
}
|
203
|
+
update();
|
204
|
+
});
|
204
205
|
};
|
205
206
|
const disconnect = ()=>{
|
206
207
|
observing = false;
|
207
208
|
sizeCache.clear();
|
208
|
-
|
209
|
+
disposeResizeObserver();
|
209
210
|
};
|
210
211
|
const addItem = (item)=>{
|
211
212
|
if (overflowItems[item.id]) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["overflowManager.js"],"sourcesContent":["import { DATA_OVERFLOWING, DATA_OVERFLOW_GROUP } from './consts';\nimport { debounce } from './debounce';\nimport { createPriorityQueue } from './priorityQueue';\n/**\n * @internal\n * @returns overflow manager instance\n */ export function createOverflowManager() {\n // calls to `offsetWidth or offsetHeight` can happen multiple times in an update\n // Use a cache to avoid causing too many recalcs and avoid scripting time to meausure sizes\n const sizeCache = new Map();\n let container;\n let overflowMenu;\n // Set as true when resize observer is observing\n let observing = false;\n // If true, next update will dispatch to onUpdateOverflow even if queue top states don't change\n // Initially true to force dispatch on first mount\n let forceDispatch = true;\n const options = {\n padding: 10,\n overflowAxis: 'horizontal',\n overflowDirection: 'end',\n minimumVisible: 0,\n onUpdateItemVisibility: ()=>undefined,\n onUpdateOverflow: ()=>undefined\n };\n const overflowItems = {};\n const overflowDividers = {};\n const resizeObserver = new ResizeObserver((entries)=>{\n if (!entries[0] || !container) {\n return;\n }\n update();\n });\n const getNextItem = (queueToDequeue, queueToEnqueue)=>{\n const nextItem = queueToDequeue.dequeue();\n queueToEnqueue.enqueue(nextItem);\n return overflowItems[nextItem];\n };\n const createGroupManager = ()=>{\n const groupVisibility = {};\n const groups = {};\n function updateGroupVisibility(groupId) {\n const group = groups[groupId];\n if (group.invisibleItemIds.size && group.visibleItemIds.size) {\n groupVisibility[groupId] = 'overflow';\n } else if (group.visibleItemIds.size === 0) {\n groupVisibility[groupId] = 'hidden';\n } else {\n groupVisibility[groupId] = 'visible';\n }\n }\n function isGroupVisible(groupId) {\n return groupVisibility[groupId] === 'visible' || groupVisibility[groupId] === 'overflow';\n }\n return {\n groupVisibility: ()=>groupVisibility,\n isSingleItemVisible (itemId, groupId) {\n return isGroupVisible(groupId) && groups[groupId].visibleItemIds.has(itemId) && groups[groupId].visibleItemIds.size === 1;\n },\n addItem (itemId, groupId) {\n var _groups, _groupId;\n var _;\n (_ = (_groups = groups)[_groupId = groupId]) !== null && _ !== void 0 ? _ : _groups[_groupId] = {\n visibleItemIds: new Set(),\n invisibleItemIds: new Set()\n };\n groups[groupId].visibleItemIds.add(itemId);\n updateGroupVisibility(groupId);\n },\n removeItem (itemId, groupId) {\n groups[groupId].invisibleItemIds.delete(itemId);\n groups[groupId].visibleItemIds.delete(itemId);\n updateGroupVisibility(groupId);\n },\n showItem (itemId, groupId) {\n groups[groupId].invisibleItemIds.delete(itemId);\n groups[groupId].visibleItemIds.add(itemId);\n updateGroupVisibility(groupId);\n },\n hideItem (itemId, groupId) {\n groups[groupId].invisibleItemIds.add(itemId);\n groups[groupId].visibleItemIds.delete(itemId);\n updateGroupVisibility(groupId);\n }\n };\n };\n const groupManager = createGroupManager();\n function compareItems(lt, rt) {\n if (!lt || !rt) {\n return 0;\n }\n const lte = overflowItems[lt];\n const rte = overflowItems[rt];\n if (lte.priority !== rte.priority) {\n return lte.priority > rte.priority ? 1 : -1;\n }\n const positionStatusBit = options.overflowDirection === 'end' ? Node.DOCUMENT_POSITION_FOLLOWING : Node.DOCUMENT_POSITION_PRECEDING;\n // eslint-disable-next-line no-bitwise\n return lte.element.compareDocumentPosition(rte.element) & positionStatusBit ? 1 : -1;\n }\n function getElementAxisSize(horizontal, vertical, el) {\n if (!sizeCache.has(el)) {\n sizeCache.set(el, options.overflowAxis === 'horizontal' ? el[horizontal] : el[vertical]);\n }\n return sizeCache.get(el);\n }\n const getOffsetSize = getElementAxisSize.bind(null, 'offsetWidth', 'offsetHeight');\n const getClientSize = getElementAxisSize.bind(null, 'clientWidth', 'clientHeight');\n const invisibleItemQueue = createPriorityQueue((a, b)=>-1 * compareItems(a, b));\n const visibleItemQueue = createPriorityQueue(compareItems);\n function occupiedSize() {\n const totalItemSize = visibleItemQueue.all().map((id)=>overflowItems[id].element).map(getOffsetSize).reduce((prev, current)=>prev + current, 0);\n const totalDividerSize = Object.entries(groupManager.groupVisibility()).reduce((acc, [id, state])=>acc + (state !== 'hidden' && overflowDividers[id] ? getOffsetSize(overflowDividers[id].element) : 0), 0);\n const overflowMenuSize = invisibleItemQueue.size() > 0 && overflowMenu ? getOffsetSize(overflowMenu) : 0;\n return totalItemSize + totalDividerSize + overflowMenuSize;\n }\n const showItem = ()=>{\n const item = getNextItem(invisibleItemQueue, visibleItemQueue);\n options.onUpdateItemVisibility({\n item,\n visible: true\n });\n if (item.groupId) {\n groupManager.showItem(item.id, item.groupId);\n if (groupManager.isSingleItemVisible(item.id, item.groupId)) {\n var _overflowDividers_item_groupId;\n (_overflowDividers_item_groupId = overflowDividers[item.groupId]) === null || _overflowDividers_item_groupId === void 0 ? void 0 : _overflowDividers_item_groupId.element.removeAttribute(DATA_OVERFLOWING);\n }\n }\n };\n const hideItem = ()=>{\n const item = getNextItem(visibleItemQueue, invisibleItemQueue);\n options.onUpdateItemVisibility({\n item,\n visible: false\n });\n if (item.groupId) {\n if (groupManager.isSingleItemVisible(item.id, item.groupId)) {\n var _overflowDividers_item_groupId;\n (_overflowDividers_item_groupId = overflowDividers[item.groupId]) === null || _overflowDividers_item_groupId === void 0 ? void 0 : _overflowDividers_item_groupId.element.setAttribute(DATA_OVERFLOWING, '');\n }\n groupManager.hideItem(item.id, item.groupId);\n }\n };\n const dispatchOverflowUpdate = ()=>{\n const visibleItemIds = visibleItemQueue.all();\n const invisibleItemIds = invisibleItemQueue.all();\n const visibleItems = visibleItemIds.map((itemId)=>overflowItems[itemId]);\n const invisibleItems = invisibleItemIds.map((itemId)=>overflowItems[itemId]);\n options.onUpdateOverflow({\n visibleItems,\n invisibleItems,\n groupVisibility: groupManager.groupVisibility()\n });\n };\n const processOverflowItems = ()=>{\n if (!container) {\n return false;\n }\n sizeCache.clear();\n const availableSize = getClientSize(container) - options.padding;\n // Snapshot of the visible/invisible state to compare for updates\n const visibleTop = visibleItemQueue.peek();\n const invisibleTop = invisibleItemQueue.peek();\n while(compareItems(invisibleItemQueue.peek(), visibleItemQueue.peek()) > 0){\n hideItem(); // hide elements whose priority become smaller than the highest priority of the hidden one\n }\n // Run the show/hide step twice - the first step might not be correct if\n // it was triggered by a new item being added - new items are always visible by default.\n for(let i = 0; i < 2; i++){\n // Add items until available width is filled - can result in overflow\n while(occupiedSize() < availableSize && invisibleItemQueue.size() > 0 || invisibleItemQueue.size() === 1 // attempt to show the last invisible item hoping it's size does not exceed overflow menu size\n ){\n showItem();\n }\n // Remove items until there's no more overflow\n while(occupiedSize() > availableSize && visibleItemQueue.size() > options.minimumVisible){\n hideItem();\n }\n }\n // only update when the state of visible/invisible items has changed\n return visibleItemQueue.peek() !== visibleTop || invisibleItemQueue.peek() !== invisibleTop;\n };\n const forceUpdate = ()=>{\n if (processOverflowItems() || forceDispatch) {\n forceDispatch = false;\n dispatchOverflowUpdate();\n }\n };\n const update = debounce(forceUpdate);\n const observe = (observedContainer, userOptions)=>{\n Object.assign(options, userOptions);\n observing = true;\n Object.values(overflowItems).forEach((item)=>visibleItemQueue.enqueue(item.id));\n container = observedContainer;\n resizeObserver.observe(container);\n };\n const disconnect = ()=>{\n observing = false;\n sizeCache.clear();\n resizeObserver.disconnect();\n };\n const addItem = (item)=>{\n if (overflowItems[item.id]) {\n return;\n }\n overflowItems[item.id] = item;\n // some options can affect priority which are only set on `observe`\n if (observing) {\n // Updates to elements might not change the queue tops\n // i.e. new element is enqueued but the top of the queue stays the same\n // force a dispatch on the next batched update\n forceDispatch = true;\n visibleItemQueue.enqueue(item.id);\n }\n if (item.groupId) {\n groupManager.addItem(item.id, item.groupId);\n item.element.setAttribute(DATA_OVERFLOW_GROUP, item.groupId);\n }\n update();\n };\n const addOverflowMenu = (el)=>{\n overflowMenu = el;\n };\n const addDivider = (divider)=>{\n if (!divider.groupId || overflowDividers[divider.groupId]) {\n return;\n }\n divider.element.setAttribute(DATA_OVERFLOW_GROUP, divider.groupId);\n overflowDividers[divider.groupId] = divider;\n };\n const removeOverflowMenu = ()=>{\n overflowMenu = undefined;\n };\n const removeDivider = (groupId)=>{\n if (!overflowDividers[groupId]) {\n return;\n }\n const divider = overflowDividers[groupId];\n if (divider.groupId) {\n delete overflowDividers[groupId];\n divider.element.removeAttribute(DATA_OVERFLOW_GROUP);\n }\n };\n const removeItem = (itemId)=>{\n if (!overflowItems[itemId]) {\n return;\n }\n const item = overflowItems[itemId];\n visibleItemQueue.remove(itemId);\n invisibleItemQueue.remove(itemId);\n if (item.groupId) {\n groupManager.removeItem(item.id, item.groupId);\n item.element.removeAttribute(DATA_OVERFLOW_GROUP);\n }\n sizeCache.delete(item.element);\n delete overflowItems[itemId];\n update();\n };\n return {\n addItem,\n disconnect,\n forceUpdate,\n observe,\n removeItem,\n update,\n addOverflowMenu,\n removeOverflowMenu,\n addDivider,\n removeDivider\n };\n}\n"],"names":["createOverflowManager","sizeCache","Map","container","overflowMenu","observing","forceDispatch","options","padding","overflowAxis","overflowDirection","minimumVisible","onUpdateItemVisibility","undefined","onUpdateOverflow","overflowItems","overflowDividers","resizeObserver","ResizeObserver","entries","update","getNextItem","queueToDequeue","queueToEnqueue","nextItem","dequeue","enqueue","createGroupManager","groupVisibility","groups","updateGroupVisibility","groupId","group","invisibleItemIds","size","visibleItemIds","isGroupVisible","isSingleItemVisible","itemId","has","addItem","_groups","_groupId","_","Set","add","removeItem","delete","showItem","hideItem","groupManager","compareItems","lt","rt","lte","rte","priority","positionStatusBit","Node","DOCUMENT_POSITION_FOLLOWING","DOCUMENT_POSITION_PRECEDING","element","compareDocumentPosition","getElementAxisSize","horizontal","vertical","el","set","get","getOffsetSize","bind","getClientSize","invisibleItemQueue","createPriorityQueue","a","b","visibleItemQueue","occupiedSize","totalItemSize","all","map","id","reduce","prev","current","totalDividerSize","Object","acc","state","overflowMenuSize","item","visible","_overflowDividers_item_groupId","removeAttribute","DATA_OVERFLOWING","setAttribute","dispatchOverflowUpdate","visibleItems","invisibleItems","processOverflowItems","clear","availableSize","visibleTop","peek","invisibleTop","i","forceUpdate","debounce","observe","observedContainer","userOptions","assign","values","forEach","disconnect","DATA_OVERFLOW_GROUP","addOverflowMenu","addDivider","divider","removeOverflowMenu","removeDivider","remove"],"mappings":";;;;+BAMoBA;;;eAAAA;;;wBANkC;0BAC7B;+BACW;AAIzB,SAASA;IAChB,gFAAgF;IAChF,2FAA2F;IAC3F,MAAMC,YAAY,IAAIC;IACtB,IAAIC;IACJ,IAAIC;IACJ,gDAAgD;IAChD,IAAIC,YAAY;IAChB,+FAA+F;IAC/F,kDAAkD;IAClD,IAAIC,gBAAgB;IACpB,MAAMC,UAAU;QACZC,SAAS;QACTC,cAAc;QACdC,mBAAmB;QACnBC,gBA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AK3D,OAAO,EAAE;YACdmB,aAAaJ,UAAU,CAAC4C,KAAKT,EAAE,EAAES,KAAK3D,OAAO;YAC7C2D,KAAK7B,OAAO,CAACgC,eAAe,CAACsB,2BAAmB;QACpD;QACAlH,UAAU8C,MAAM,CAAC2C,KAAK7B,OAAO;QAC7B,OAAO9C,aAAa,CAACuB,OAAO;QAC5BlB;IACJ;IACA,OAAO;QACHoB;QACA0E;QACAR;QACAE;QACA9D;QACA1B;QACAgG;QACAG;QACAF;QACAG;IACJ;AACJ"}
|
1
|
+
{"version":3,"sources":["overflowManager.js"],"sourcesContent":["import { DATA_OVERFLOWING, DATA_OVERFLOW_GROUP } from './consts';\nimport { observeResize } from './createResizeObserver';\nimport { debounce } from './debounce';\nimport { createPriorityQueue } from './priorityQueue';\n/**\n * @internal\n * @returns overflow manager instance\n */ export function createOverflowManager() {\n // calls to `offsetWidth or offsetHeight` can happen multiple times in an update\n // Use a cache to avoid causing too many recalcs and avoid scripting time to meausure sizes\n const sizeCache = new Map();\n let container;\n let overflowMenu;\n // Set as true when resize observer is observing\n let observing = false;\n // If true, next update will dispatch to onUpdateOverflow even if queue top states don't change\n // Initially true to force dispatch on first mount\n let forceDispatch = true;\n const options = {\n padding: 10,\n overflowAxis: 'horizontal',\n overflowDirection: 'end',\n minimumVisible: 0,\n onUpdateItemVisibility: ()=>undefined,\n onUpdateOverflow: ()=>undefined\n };\n const overflowItems = {};\n const overflowDividers = {};\n let disposeResizeObserver = ()=>null;\n const getNextItem = (queueToDequeue, queueToEnqueue)=>{\n const nextItem = queueToDequeue.dequeue();\n queueToEnqueue.enqueue(nextItem);\n return overflowItems[nextItem];\n };\n const createGroupManager = ()=>{\n const groupVisibility = {};\n const groups = {};\n function updateGroupVisibility(groupId) {\n const group = groups[groupId];\n if (group.invisibleItemIds.size && group.visibleItemIds.size) {\n groupVisibility[groupId] = 'overflow';\n } else if (group.visibleItemIds.size === 0) {\n groupVisibility[groupId] = 'hidden';\n } else {\n groupVisibility[groupId] = 'visible';\n }\n }\n function isGroupVisible(groupId) {\n return groupVisibility[groupId] === 'visible' || groupVisibility[groupId] === 'overflow';\n }\n return {\n groupVisibility: ()=>groupVisibility,\n isSingleItemVisible (itemId, groupId) {\n return isGroupVisible(groupId) && groups[groupId].visibleItemIds.has(itemId) && groups[groupId].visibleItemIds.size === 1;\n },\n addItem (itemId, groupId) {\n var _groups, _groupId;\n var _;\n (_ = (_groups = groups)[_groupId = groupId]) !== null && _ !== void 0 ? _ : _groups[_groupId] = {\n visibleItemIds: new Set(),\n invisibleItemIds: new Set()\n };\n groups[groupId].visibleItemIds.add(itemId);\n updateGroupVisibility(groupId);\n },\n removeItem (itemId, groupId) {\n groups[groupId].invisibleItemIds.delete(itemId);\n groups[groupId].visibleItemIds.delete(itemId);\n updateGroupVisibility(groupId);\n },\n showItem (itemId, groupId) {\n groups[groupId].invisibleItemIds.delete(itemId);\n groups[groupId].visibleItemIds.add(itemId);\n updateGroupVisibility(groupId);\n },\n hideItem (itemId, groupId) {\n groups[groupId].invisibleItemIds.add(itemId);\n groups[groupId].visibleItemIds.delete(itemId);\n updateGroupVisibility(groupId);\n }\n };\n };\n const groupManager = createGroupManager();\n function compareItems(lt, rt) {\n if (!lt || !rt) {\n return 0;\n }\n const lte = overflowItems[lt];\n const rte = overflowItems[rt];\n if (lte.priority !== rte.priority) {\n return lte.priority > rte.priority ? 1 : -1;\n }\n const positionStatusBit = options.overflowDirection === 'end' ? Node.DOCUMENT_POSITION_FOLLOWING : Node.DOCUMENT_POSITION_PRECEDING;\n // eslint-disable-next-line no-bitwise\n return lte.element.compareDocumentPosition(rte.element) & positionStatusBit ? 1 : -1;\n }\n function getElementAxisSize(horizontal, vertical, el) {\n if (!sizeCache.has(el)) {\n sizeCache.set(el, options.overflowAxis === 'horizontal' ? el[horizontal] : el[vertical]);\n }\n return sizeCache.get(el);\n }\n const getOffsetSize = getElementAxisSize.bind(null, 'offsetWidth', 'offsetHeight');\n const getClientSize = getElementAxisSize.bind(null, 'clientWidth', 'clientHeight');\n const invisibleItemQueue = createPriorityQueue((a, b)=>-1 * compareItems(a, b));\n const visibleItemQueue = createPriorityQueue(compareItems);\n function occupiedSize() {\n const totalItemSize = visibleItemQueue.all().map((id)=>overflowItems[id].element).map(getOffsetSize).reduce((prev, current)=>prev + current, 0);\n const totalDividerSize = Object.entries(groupManager.groupVisibility()).reduce((acc, [id, state])=>acc + (state !== 'hidden' && overflowDividers[id] ? getOffsetSize(overflowDividers[id].element) : 0), 0);\n const overflowMenuSize = invisibleItemQueue.size() > 0 && overflowMenu ? getOffsetSize(overflowMenu) : 0;\n return totalItemSize + totalDividerSize + overflowMenuSize;\n }\n const showItem = ()=>{\n const item = getNextItem(invisibleItemQueue, visibleItemQueue);\n options.onUpdateItemVisibility({\n item,\n visible: true\n });\n if (item.groupId) {\n groupManager.showItem(item.id, item.groupId);\n if (groupManager.isSingleItemVisible(item.id, item.groupId)) {\n var _overflowDividers_item_groupId;\n (_overflowDividers_item_groupId = overflowDividers[item.groupId]) === null || _overflowDividers_item_groupId === void 0 ? void 0 : _overflowDividers_item_groupId.element.removeAttribute(DATA_OVERFLOWING);\n }\n }\n };\n const hideItem = ()=>{\n const item = getNextItem(visibleItemQueue, invisibleItemQueue);\n options.onUpdateItemVisibility({\n item,\n visible: false\n });\n if (item.groupId) {\n if (groupManager.isSingleItemVisible(item.id, item.groupId)) {\n var _overflowDividers_item_groupId;\n (_overflowDividers_item_groupId = overflowDividers[item.groupId]) === null || _overflowDividers_item_groupId === void 0 ? void 0 : _overflowDividers_item_groupId.element.setAttribute(DATA_OVERFLOWING, '');\n }\n groupManager.hideItem(item.id, item.groupId);\n }\n };\n const dispatchOverflowUpdate = ()=>{\n const visibleItemIds = visibleItemQueue.all();\n const invisibleItemIds = invisibleItemQueue.all();\n const visibleItems = visibleItemIds.map((itemId)=>overflowItems[itemId]);\n const invisibleItems = invisibleItemIds.map((itemId)=>overflowItems[itemId]);\n options.onUpdateOverflow({\n visibleItems,\n invisibleItems,\n groupVisibility: groupManager.groupVisibility()\n });\n };\n const processOverflowItems = ()=>{\n if (!container) {\n return false;\n }\n sizeCache.clear();\n const availableSize = getClientSize(container) - options.padding;\n // Snapshot of the visible/invisible state to compare for updates\n const visibleTop = visibleItemQueue.peek();\n const invisibleTop = invisibleItemQueue.peek();\n while(compareItems(invisibleItemQueue.peek(), visibleItemQueue.peek()) > 0){\n hideItem(); // hide elements whose priority become smaller than the highest priority of the hidden one\n }\n // Run the show/hide step twice - the first step might not be correct if\n // it was triggered by a new item being added - new items are always visible by default.\n for(let i = 0; i < 2; i++){\n // Add items until available width is filled - can result in overflow\n while(occupiedSize() < availableSize && invisibleItemQueue.size() > 0 || invisibleItemQueue.size() === 1 // attempt to show the last invisible item hoping it's size does not exceed overflow menu size\n ){\n showItem();\n }\n // Remove items until there's no more overflow\n while(occupiedSize() > availableSize && visibleItemQueue.size() > options.minimumVisible){\n hideItem();\n }\n }\n // only update when the state of visible/invisible items has changed\n return visibleItemQueue.peek() !== visibleTop || invisibleItemQueue.peek() !== invisibleTop;\n };\n const forceUpdate = ()=>{\n if (processOverflowItems() || forceDispatch) {\n forceDispatch = false;\n dispatchOverflowUpdate();\n }\n };\n const update = debounce(forceUpdate);\n const observe = (observedContainer, userOptions)=>{\n Object.assign(options, userOptions);\n observing = true;\n Object.values(overflowItems).forEach((item)=>visibleItemQueue.enqueue(item.id));\n container = observedContainer;\n disposeResizeObserver = observeResize(container, (entries)=>{\n if (!entries[0] || !container) {\n return;\n }\n update();\n });\n };\n const disconnect = ()=>{\n observing = false;\n sizeCache.clear();\n disposeResizeObserver();\n };\n const addItem = (item)=>{\n if (overflowItems[item.id]) {\n return;\n }\n overflowItems[item.id] = item;\n // some options can affect priority which are only set on `observe`\n if (observing) {\n // Updates to elements might not change the queue tops\n // i.e. new element is enqueued but the top of the queue stays the same\n // force a dispatch on the next batched update\n forceDispatch = true;\n visibleItemQueue.enqueue(item.id);\n }\n if (item.groupId) {\n groupManager.addItem(item.id, item.groupId);\n item.element.setAttribute(DATA_OVERFLOW_GROUP, item.groupId);\n }\n update();\n };\n const addOverflowMenu = (el)=>{\n overflowMenu = el;\n };\n const addDivider = (divider)=>{\n if (!divider.groupId || overflowDividers[divider.groupId]) {\n return;\n }\n divider.element.setAttribute(DATA_OVERFLOW_GROUP, divider.groupId);\n overflowDividers[divider.groupId] = divider;\n };\n const removeOverflowMenu = ()=>{\n overflowMenu = undefined;\n };\n const removeDivider = (groupId)=>{\n if (!overflowDividers[groupId]) {\n return;\n }\n const divider = overflowDividers[groupId];\n if (divider.groupId) {\n delete overflowDividers[groupId];\n divider.element.removeAttribute(DATA_OVERFLOW_GROUP);\n }\n };\n const removeItem = (itemId)=>{\n if (!overflowItems[itemId]) {\n return;\n }\n const item = overflowItems[itemId];\n visibleItemQueue.remove(itemId);\n invisibleItemQueue.remove(itemId);\n if (item.groupId) {\n groupManager.removeItem(item.id, item.groupId);\n item.element.removeAttribute(DATA_OVERFLOW_GROUP);\n }\n sizeCache.delete(item.element);\n delete overflowItems[itemId];\n update();\n };\n return {\n addItem,\n disconnect,\n forceUpdate,\n observe,\n removeItem,\n update,\n addOverflowMenu,\n removeOverflowMenu,\n addDivider,\n removeDivider\n };\n}\n"],"names":["createOverflowManager","sizeCache","Map","container","overflowMenu","observing","forceDispatch","options","padding","overflowAxis","overflowDirection","minimumVisible","onUpdateItemVisibility","undefined","onUpdateOverflow","overflowItems","overflowDividers","disposeResizeObserver","getNextItem","queueToDequeue","queueToEnqueue","nextItem","dequeue","enqueue","createGroupManager","groupVisibility","groups","updateGroupVisibility","groupId","group","invisibleItemIds","size","visibleItemIds","isGroupVisible","isSingleItemVisible","itemId","has","addItem","_groups","_groupId","_","Set","add","removeItem","delete","showItem","hideItem","groupManager","compareItems","lt","rt","lte","rte","priority","positionStatusBit","Node","DOCUMENT_POSITION_FOLLOWING","DOCUMENT_POSITION_PRECEDING","element","compareDocumentPosition","getElementAxisSize","horizontal","vertical","el","set","get","getOffsetSize","bind","getClientSize","invisibleItemQueue","createPriorityQueue","a","b","visibleItemQueue","occupiedSize","totalItemSize","all","map","id","reduce","prev","current","totalDividerSize","Object","entries","acc","state","overflowMenuSize","item","visible","_overflowDividers_item_groupId","removeAttribute","DATA_OVERFLOWING","setAttribute","dispatchOverflowUpdate","visibleItems","invisibleItems","processOverflowItems","clear","availableSize","visibleTop","peek","invisibleTop","i","forceUpdate","update","debounce","observe","observedContainer","userOptions","assign","values","forEach","observeResize","disconnect","DATA_OVERFLOW_GROUP","addOverflowMenu","addDivider","divider","removeOverflowMenu","removeDivider","remove"],"mappings":";;;;+BAOoBA;;;eAAAA;;;wBAPkC;sCACxB;0BACL;+BACW;AAIzB,SAASA;IAChB,gFAAgF;IAChF,2FAA2F;IAC3F,MAAMC,YAAY,IAAIC;IACtB,IAAIC;IACJ,IAAIC;IACJ,gDAAgD;IAChD,IAAIC,YAAY;IAChB,+FAA+F;IAC/F,kDAAkD;IAClD,IAAIC,gBAAgB;IACpB,MAAMC,UAAU;QACZC,SAAS;QACTC,cAAc;QACdC,mBAAmB;QACnBC,gBAAgB;QAChBC,wBAAwB,IAAIC;QAC5BC,kBAAkB,IAAID;IAC1B;IACA,MAAME,gBAAgB,CAAC;IACvB,MAAMC,mBAAmB,CAAC;IAC1B,IAAIC,wBAAwB,IAAI;IAChC,MAAMC,cAAc,CAACC,gBAAgBC;QACjC,MAAMC,WAAWF,eAAeG,OAAO;QACvCF,eAAeG,OAAO,CAACF;QACvB,OAAON,aAAa,CAACM,SAAS;IAClC;IACA,MAAMG,qBAAqB;QACvB,MAAMC,kBAAkB,CAAC;QACzB,MAAMC,SAAS,CAAC;QAChB,SAASC,sBAAsBC,OAAO;YAClC,MAAMC,QAAQH,MAAM,CAACE,QAAQ;YAC7B,IAAIC,MAAMC,gBAAgB,CAACC,IAAI,IAAIF,MAAMG,cAAc,CAACD,IAAI,EAAE;gBAC1DN,eAAe,CAACG,QAAQ,GAAG;YAC/B,OAAO,IAAIC,MAAMG,cAAc,CAACD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