@fluentui/priority-overflow 9.1.10 → 9.1.12

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,12 +1,30 @@
1
1
  # Change Log - @fluentui/priority-overflow
2
2
 
3
- This log was last generated on Mon, 20 Nov 2023 09:51:19 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 16 May 2024 09:21:18 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.1.12](https://github.com/microsoft/fluentui/tree/@fluentui/priority-overflow_v9.1.12)
8
+
9
+ Thu, 16 May 2024 09:21:18 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/priority-overflow_v9.1.11..@fluentui/priority-overflow_v9.1.12)
11
+
12
+ ### Patches
13
+
14
+ - force update the overflow when item is removed ([PR #31340](https://github.com/microsoft/fluentui/pull/31340) by miroslav.stastny@microsoft.com)
15
+
16
+ ## [9.1.11](https://github.com/microsoft/fluentui/tree/@fluentui/priority-overflow_v9.1.11)
17
+
18
+ Thu, 14 Dec 2023 09:58:42 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/priority-overflow_v9.1.10..@fluentui/priority-overflow_v9.1.11)
20
+
21
+ ### Patches
22
+
23
+ - fix: updates should be synchronous in unit tests ([PR #30014](https://github.com/microsoft/fluentui/pull/30014) by lingfangao@hotmail.com)
24
+
7
25
  ## [9.1.10](https://github.com/microsoft/fluentui/tree/@fluentui/priority-overflow_v9.1.10)
8
26
 
9
- Mon, 20 Nov 2023 09:51:19 GMT
27
+ Mon, 20 Nov 2023 09:55:08 GMT
10
28
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/priority-overflow_v9.1.9..@fluentui/priority-overflow_v9.1.10)
11
29
 
12
30
  ### Patches
package/lib/debounce.js CHANGED
@@ -5,6 +5,11 @@
5
5
  * @returns debounced function
6
6
  */ export function debounce(fn) {
7
7
  let pending;
8
+ // React testing platforms will often output errors when state updates happen outside `act`
9
+ // Since there is nothing obvious to wait for we just avoid debouncing in unit test environments
10
+ if (process.env.NODE_ENV === 'test') {
11
+ return fn;
12
+ }
8
13
  return ()=>{
9
14
  if (!pending) {
10
15
  pending = true;
@@ -1 +1 @@
1
- {"version":3,"sources":["debounce.ts"],"sourcesContent":["/**\n * Microtask debouncer\n * https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide\n * @param fn - Function to debounce\n * @returns debounced function\n */\nexport function debounce(fn: Function) {\n let pending: boolean;\n return () => {\n if (!pending) {\n pending = true;\n queueMicrotask(() => {\n // Need to set pending to `false` before the debounced function is run.\n // React can actually interrupt the function while it's running!\n pending = false;\n fn();\n });\n }\n };\n}\n"],"names":["debounce","fn","pending","queueMicrotask"],"mappings":"AAAA;;;;;CAKC,GACD,OAAO,SAASA,SAASC,EAAY;IACnC,IAAIC;IACJ,OAAO;QACL,IAAI,CAACA,SAAS;YACZA,UAAU;YACVC,eAAe;gBACb,uEAAuE;gBACvE,gEAAgE;gBAChED,UAAU;gBACVD;YACF;QACF;IACF;AACF"}
1
+ {"version":3,"sources":["debounce.ts"],"sourcesContent":["/**\n * Microtask debouncer\n * https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide\n * @param fn - Function to debounce\n * @returns debounced function\n */\nexport function debounce(fn: Function) {\n let pending: boolean;\n\n // React testing platforms will often output errors when state updates happen outside `act`\n // Since there is nothing obvious to wait for we just avoid debouncing in unit test environments\n if (process.env.NODE_ENV === 'test') {\n return fn as () => void;\n }\n\n return () => {\n if (!pending) {\n pending = true;\n queueMicrotask(() => {\n // Need to set pending to `false` before the debounced function is run.\n // React can actually interrupt the function while it's running!\n pending = false;\n fn();\n });\n }\n };\n}\n"],"names":["debounce","fn","pending","process","env","NODE_ENV","queueMicrotask"],"mappings":"AAAA;;;;;CAKC,GACD,OAAO,SAASA,SAASC,EAAY;IACnC,IAAIC;IAEJ,2FAA2F;IAC3F,gGAAgG;IAChG,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,QAAQ;QACnC,OAAOJ;IACT;IAEA,OAAO;QACL,IAAI,CAACC,SAAS;YACZA,UAAU;YACVI,eAAe;gBACb,uEAAuE;gBACvE,gEAAgE;gBAChEJ,UAAU;gBACVD;YACF;QACF;IACF;AACF"}
@@ -194,6 +194,11 @@ import { createPriorityQueue } from './priorityQueue';
194
194
  if (!overflowItems[itemId]) {
195
195
  return;
196
196
  }
197
+ if (observing) {
198
+ // We might be removing an item in an overflow which would not affect the tops,
199
+ // but we need to update anyway to update the overflow menu state
200
+ forceDispatch = true;
201
+ }
197
202
  const item = overflowItems[itemId];
198
203
  visibleItemQueue.remove(itemId);
199
204
  invisibleItemQueue.remove(itemId);
@@ -1 +1 @@
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 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 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 const disconnect: OverflowManager['disconnect'] = () => {\n disposeResizeObserver();\n\n // reset flags\n container = undefined;\n observing = false;\n forceDispatch = true;\n\n // clear all entries\n Object.keys(overflowItems).forEach(itemId => removeItem(itemId));\n Object.keys(overflowDividers).forEach(dividerId => removeDivider(dividerId));\n removeOverflowMenu();\n sizeCache.clear();\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\nconst 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"],"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","groupManager","createGroupManager","compareItems","lt","rt","lte","rte","priority","positionStatusBit","Node","DOCUMENT_POSITION_FOLLOWING","DOCUMENT_POSITION_PRECEDING","element","compareDocumentPosition","getElementAxisSize","horizontal","vertical","el","has","set","get","getOffsetSize","bind","getClientSize","invisibleItemQueue","a","b","visibleItemQueue","occupiedSize","totalItemSize","all","map","id","reduce","prev","current","totalDividerSize","Object","entries","groupVisibility","acc","state","overflowMenuSize","size","showItem","item","visible","groupId","isSingleItemVisible","removeAttribute","hideItem","setAttribute","dispatchOverflowUpdate","visibleItemIds","invisibleItemIds","visibleItems","itemId","invisibleItems","processOverflowItems","clear","availableSize","visibleTop","peek","invisibleTop","i","forceUpdate","update","observe","observedContainer","userOptions","assign","values","forEach","addItem","addOverflowMenu","addDivider","divider","removeOverflowMenu","removeDivider","removeItem","remove","delete","disconnect","keys","dividerId","groups","updateGroupVisibility","group","isGroupVisible","Set","add"],"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,GAC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,QAAQ,CAACM,cAAc,CAACqC,GAAG,CAAClC;YACnC8B,sBAAsBvC;QACxB;QACAgC,YAAWvB,MAAc,EAAET,OAAe;YACxCsC,MAAM,CAACtC,QAAQ,CAACO,gBAAgB,CAAC2B,MAAM,CAACzB;YACxC6B,MAAM,CAACtC,QAAQ,CAACM,cAAc,CAAC4B,MAAM,CAACzB;YACtC8B,sBAAsBvC;QACxB;QACAH,UAASY,MAAc,EAAET,OAAe;YACtCsC,MAAM,CAACtC,QAAQ,CAACO,gBAAgB,CAAC2B,MAAM,CAACzB;YACxC6B,MAAM,CAACtC,QAAQ,CAACM,cAAc,CAACqC,GAAG,CAAClC;YACnC8B,sBAAsBvC;QACxB;QACAG,UAASM,MAAc,EAAET,OAAe;YACtCsC,MAAM,CAACtC,QAAQ,CAACO,gBAAgB,CAACoC,GAAG,CAAClC;YACrC6B,MAAM,CAACtC,QAAQ,CAACM,cAAc,CAAC4B,MAAM,CAACzB;YACtC8B,sBAAsBvC;QACxB;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 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 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 if (observing) {\n // We might be removing an item in an overflow which would not affect the tops,\n // but we need to update anyway to update the overflow menu state\n forceDispatch = true;\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 const disconnect: OverflowManager['disconnect'] = () => {\n disposeResizeObserver();\n\n // reset flags\n container = undefined;\n observing = false;\n forceDispatch = true;\n\n // clear all entries\n Object.keys(overflowItems).forEach(itemId => removeItem(itemId));\n Object.keys(overflowDividers).forEach(dividerId => removeDivider(dividerId));\n removeOverflowMenu();\n sizeCache.clear();\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\nconst 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"],"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","groupManager","createGroupManager","compareItems","lt","rt","lte","rte","priority","positionStatusBit","Node","DOCUMENT_POSITION_FOLLOWING","DOCUMENT_POSITION_PRECEDING","element","compareDocumentPosition","getElementAxisSize","horizontal","vertical","el","has","set","get","getOffsetSize","bind","getClientSize","invisibleItemQueue","a","b","visibleItemQueue","occupiedSize","totalItemSize","all","map","id","reduce","prev","current","totalDividerSize","Object","entries","groupVisibility","acc","state","overflowMenuSize","size","showItem","item","visible","groupId","isSingleItemVisible","removeAttribute","hideItem","setAttribute","dispatchOverflowUpdate","visibleItemIds","invisibleItemIds","visibleItems","itemId","invisibleItems","processOverflowItems","clear","availableSize","visibleTop","peek","invisibleTop","i","forceUpdate","update","observe","observedContainer","userOptions","assign","values","forEach","addItem","addOverflowMenu","addDivider","divider","removeOverflowMenu","removeDivider","removeItem","remove","delete","disconnect","keys","dividerId","groups","updateGroupVisibility","group","isGroupVisible","Set","add"],"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,IAAMD;IAC1B;IAEA,MAAME,gBAAmD,CAAC;IAC1D,MAAMC,mBAAyD,CAAC;IAChE,IAAIC,wBAAoC,IAAM;IAE9C,MAAMC,cAAc,CAACC,gBAAuCC;QAC1D,MAAMC,WAAWF,eAAeG,OAAO;QACvCF,eAAeG,OAAO,CAACF;QACvB,OAAON,aAAa,CAACM,SAAS;IAChC;IAEA,MAAMG,eAAeC;IAErB,SAASC,aAAaC,EAAiB,EAAEC,EAAiB;QACxD,IAAI,CAACD,MAAM,CAACC,IAAI;YACd,OAAO;QACT;QAEA,MAAMC,MAAMd,aAAa,CAACY,GAAG;QAC7B,MAAMG,MAAMf,aAAa,CAACa,GAAG;QAE7B,IAAIC,IAAIE,QAAQ,KAAKD,IAAIC,QAAQ,EAAE;YACjC,OAAOF,IAAIE,QAAQ,GAAGD,IAAIC,QAAQ,GAAG,IAAI,CAAC;QAC5C;QAEA,MAAMC,oBACJzB,QAAQG,iBAAiB,KAAK,QAAQuB,KAAKC,2BAA2B,GAAGD,KAAKE,2BAA2B;QAE3G,sCAAsC;QACtC,OAAON,IAAIO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CAACtC,QAAQ,CAACM,cAAc,CAACnC,GAAG,CAACsC,WACnC6B,MAAM,CAACtC,QAAQ,CAACM,cAAc,CAACV,IAAI,KAAK;QAE5C;QACA8B,SAAQjB,MAAc,EAAET,OAAe;gBACrCsC,SAAOtC;;YAAPsC,MAAAA,UAAAA,OAAM,CAACtC,WAAAA,QAAQ,iCAAfsC,OAAM,CAACtC,SAAQ,GAAK;gBAClBM,gBAAgB,IAAIoC;gBACpBnC,kBAAkB,IAAImC;YACxB;YAEAJ,MAAM,CAACtC,QAAQ,CAACM,cAAc,CAACqC,GAAG,CAAClC;YACnC8B,sBAAsBvC;QACxB;QACAgC,YAAWvB,MAAc,EAAET,OAAe;YACxCsC,MAAM,CAACtC,QAAQ,CAACO,gBAAgB,CAAC2B,MAAM,CAACzB;YACxC6B,MAAM,CAACtC,QAAQ,CAACM,cAAc,CAAC4B,MAAM,CAACzB;YACtC8B,sBAAsBvC;QACxB;QACAH,UAASY,MAAc,EAAET,OAAe;YACtCsC,MAAM,CAACtC,QAAQ,CAACO,gBAAgB,CAAC2B,MAAM,CAACzB;YACxC6B,MAAM,CAACtC,QAAQ,CAACM,cAAc,CAACqC,GAAG,CAAClC;YACnC8B,sBAAsBvC;QACxB;QACAG,UAASM,MAAc,EAAET,OAAe;YACtCsC,MAAM,CAACtC,QAAQ,CAACO,gBAAgB,CAACoC,GAAG,CAAClC;YACrC6B,MAAM,CAACtC,QAAQ,CAACM,cAAc,CAAC4B,MAAM,CAACzB;YACtC8B,sBAAsBvC;QACxB;IACF;AACF"}
@@ -15,6 +15,11 @@ Object.defineProperty(exports, "debounce", {
15
15
  });
16
16
  function debounce(fn) {
17
17
  let pending;
18
+ // React testing platforms will often output errors when state updates happen outside `act`
19
+ // Since there is nothing obvious to wait for we just avoid debouncing in unit test environments
20
+ if (process.env.NODE_ENV === 'test') {
21
+ return fn;
22
+ }
18
23
  return ()=>{
19
24
  if (!pending) {
20
25
  pending = true;
@@ -1 +1 @@
1
- {"version":3,"sources":["debounce.js"],"sourcesContent":["/**\n * Microtask debouncer\n * https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide\n * @param fn - Function to debounce\n * @returns debounced function\n */ export function debounce(fn) {\n let pending;\n return ()=>{\n if (!pending) {\n pending = true;\n queueMicrotask(()=>{\n // Need to set pending to `false` before the debounced function is run.\n // React can actually interrupt the function while it's running!\n pending = false;\n fn();\n });\n }\n };\n}\n"],"names":["debounce","fn","pending","queueMicrotask"],"mappings":"AAAA;;;;;CAKC;;;;+BAAmBA;;;eAAAA;;;AAAT,SAASA,SAASC,EAAE;IAC3B,IAAIC;IACJ,OAAO;QACH,IAAI,CAACA,SAAS;YACVA,UAAU;YACVC,eAAe;gBACX,uEAAuE;gBACvE,gEAAgE;gBAChED,UAAU;gBACVD;YACJ;QACJ;IACJ;AACJ"}
1
+ {"version":3,"sources":["debounce.js"],"sourcesContent":["/**\n * Microtask debouncer\n * https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide\n * @param fn - Function to debounce\n * @returns debounced function\n */ export function debounce(fn) {\n let pending;\n // React testing platforms will often output errors when state updates happen outside `act`\n // Since there is nothing obvious to wait for we just avoid debouncing in unit test environments\n if (process.env.NODE_ENV === 'test') {\n return fn;\n }\n return ()=>{\n if (!pending) {\n pending = true;\n queueMicrotask(()=>{\n // Need to set pending to `false` before the debounced function is run.\n // React can actually interrupt the function while it's running!\n pending = false;\n fn();\n });\n }\n };\n}\n"],"names":["debounce","fn","pending","process","env","NODE_ENV","queueMicrotask"],"mappings":"AAAA;;;;;CAKC;;;;+BAAmBA;;;eAAAA;;;AAAT,SAASA,SAASC,EAAE;IAC3B,IAAIC;IACJ,2FAA2F;IAC3F,gGAAgG;IAChG,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,QAAQ;QACjC,OAAOJ;IACX;IACA,OAAO;QACH,IAAI,CAACC,SAAS;YACVA,UAAU;YACVI,eAAe;gBACX,uEAAuE;gBACvE,gEAAgE;gBAChEJ,UAAU;gBACVD;YACJ;QACJ;IACJ;AACJ"}
@@ -201,6 +201,11 @@ function createOverflowManager() {
201
201
  if (!overflowItems[itemId]) {
202
202
  return;
203
203
  }
204
+ if (observing) {
205
+ // We might be removing an item in an overflow which would not affect the tops,
206
+ // but we need to update anyway to update the overflow menu state
207
+ forceDispatch = true;
208
+ }
204
209
  const item = overflowItems[itemId];
205
210
  visibleItemQueue.remove(itemId);
206
211
  invisibleItemQueue.remove(itemId);
@@ -1 +1 @@
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 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 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 const disconnect = ()=>{\n disposeResizeObserver();\n // reset flags\n container = undefined;\n observing = false;\n forceDispatch = true;\n // clear all entries\n Object.keys(overflowItems).forEach((itemId)=>removeItem(itemId));\n Object.keys(overflowDividers).forEach((dividerId)=>removeDivider(dividerId));\n removeOverflowMenu();\n sizeCache.clear();\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}\nconst 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"],"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","groupManager","createGroupManager","compareItems","lt","rt","lte","rte","priority","positionStatusBit","Node","DOCUMENT_POSITION_FOLLOWING","DOCUMENT_POSITION_PRECEDING","element","compareDocumentPosition","getElementAxisSize","horizontal","vertical","el","has","set","get","getOffsetSize","bind","getClientSize","invisibleItemQueue","createPriorityQueue","a","b","visibleItemQueue","occupiedSize","totalItemSize","all","map","id","reduce","prev","current","totalDividerSize","Object","entries","groupVisibility","acc","state","overflowMenuSize","size","showItem","item","visible","groupId","isSingleItemVisible","_overflowDividers_item_groupId","removeAttribute","DATA_OVERFLOWING","hideItem","setAttribute","dispatchOverflowUpdate","visibleItemIds","invisibleItemIds","visibleItems","itemId","invisibleItems","processOverflowItems","clear","availableSize","visibleTop","peek","invisibleTop","i","forceUpdate","update","debounce","observe","observedContainer","userOptions","assign","values","forEach","observeResize","addItem","DATA_OVERFLOW_GROUP","addOverflowMenu","addDivider","divider","removeOverflowMenu","removeDivider","removeItem","remove","delete","disconnect","keys","dividerId","groups","updateGroupVisibility","group","isGroupVisible","_groups","_groupId","_","Set","add"],"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,eAAeC;IACrB,SAASC,aAAaC,EAAE,EAAEC,EAAE;QACxB,IAAI,CAACD,MAAM,CAACC,IAAI;YACZ,OAAO;QACX;QACA,MAAMC,MAAMd,aAAa,CAACY,GAAG;QAC7B,MAAMG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2C,MAAM,CAAC3C,QAAQ,CAACS,gBAAgB,CAAC0C,GAAG,CAACxC;YACrCgC,MAAM,CAAC3C,QAAQ,CAACQ,cAAc,CAAC+B,MAAM,CAAC5B;YACtCiC,sBAAsB5C;QAC1B;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 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 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 if (observing) {\n // We might be removing an item in an overflow which would not affect the tops,\n // but we need to update anyway to update the overflow menu state\n forceDispatch = true;\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 const disconnect = ()=>{\n disposeResizeObserver();\n // reset flags\n container = undefined;\n observing = false;\n forceDispatch = true;\n // clear all entries\n Object.keys(overflowItems).forEach((itemId)=>removeItem(itemId));\n Object.keys(overflowDividers).forEach((dividerId)=>removeDivider(dividerId));\n removeOverflowMenu();\n sizeCache.clear();\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}\nconst 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"],"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","groupManager","createGroupManager","compareItems","lt","rt","lte","rte","priority","positionStatusBit","Node","DOCUMENT_POSITION_FOLLOWING","DOCUMENT_POSITION_PRECEDING","element","compareDocumentPosition","getElementAxisSize","horizontal","vertical","el","has","set","get","getOffsetSize","bind","getClientSize","invisibleItemQueue","createPriorityQueue","a","b","visibleItemQueue","occupiedSize","totalItemSize","all","map","id","reduce","prev","current","totalDividerSize","Object","entries","groupVisibility","acc","state","overflowMenuSize","size","showItem","item","visible","groupId","isSingleItemVisible","_overflowDividers_item_groupId","removeAttribute","DATA_OVERFLOWING","hideItem","setAttribute","dispatchOverflowUpdate","visibleItemIds","invisibleItemIds","visibleItems","itemId","invisibleItems","processOverflowItems","clear","availableSize","visibleTop","peek","invisibleTop","i","forceUpdate","update","debounce","observe","observedContainer","userOptions","assign","values","forEach","observeResize","addItem","DATA_OVERFLOW_GROUP","addOverflowMenu","addDivider","divider","removeOverflowMenu","removeDivider","removeItem","remove","delete","disconnect","keys","dividerId","groups","updateGroupVisibility","group","isGroupVisible","_groups","_groupId","_","Set","add"],"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,eAAeC;IACrB,SAASC,aAAaC,EAAE,EAAEC,EAAE;QACxB,IAAI,CAACD,MAAM,CAACC,IAAI;YACZ,OAAO;QACX;QACA,MAAMC,MAAMd,aAAa,CAACY,GAAG;QAC7B,MAAMG,MAAMf,aAAa,CAACa,GAAG;QAC7B,IAAIC,IAAIE,QAAQ,KAAKD,IAAI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ACrB2C,MAAM,CAAC3C,QAAQ,CAACS,gBAAgB,CAAC0C,GAAG,CAACxC;YACrCgC,MAAM,CAAC3C,QAAQ,CAACQ,cAAc,CAAC+B,MAAM,CAAC5B;YACtCiC,sBAAsB5C;QAC1B;IACJ;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/priority-overflow",
3
- "version": "9.1.10",
3
+ "version": "9.1.12",
4
4
  "description": "Vanilla JS utilities to implement overflow menus",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",