@fluentui/react-utilities 9.13.0 → 9.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/CHANGELOG.json +55 -1
  2. package/CHANGELOG.md +24 -2
  3. package/lib/compose/assertSlots.js +8 -3
  4. package/lib/compose/assertSlots.js.map +1 -1
  5. package/lib/compose/getSlots.js +1 -1
  6. package/lib/compose/getSlots.js.map +1 -1
  7. package/lib/compose/getSlotsNext.js +1 -1
  8. package/lib/compose/getSlotsNext.js.map +1 -1
  9. package/lib/compose/isResolvedShorthand.js.map +1 -1
  10. package/lib/compose/isSlot.js +2 -1
  11. package/lib/compose/isSlot.js.map +1 -1
  12. package/lib/compose/resolveShorthand.js +2 -1
  13. package/lib/compose/resolveShorthand.js.map +1 -1
  14. package/lib/compose/slot.js +7 -7
  15. package/lib/compose/slot.js.map +1 -1
  16. package/lib/events/mouseTouchHelpers.js.map +1 -1
  17. package/lib/hooks/useAnimationFrame.js +10 -1
  18. package/lib/hooks/useAnimationFrame.js.map +1 -1
  19. package/lib/hooks/useBrowserTimer.js.map +1 -1
  20. package/lib/hooks/useControllableState.js +5 -8
  21. package/lib/hooks/useControllableState.js.map +1 -1
  22. package/lib/hooks/useEventCallback.js.map +1 -1
  23. package/lib/hooks/useFirstMount.js.map +1 -1
  24. package/lib/hooks/useForceUpdate.js.map +1 -1
  25. package/lib/hooks/useId.js.map +1 -1
  26. package/lib/hooks/useMergedRefs.js.map +1 -1
  27. package/lib/hooks/useOnClickOutside.js +25 -19
  28. package/lib/hooks/useOnClickOutside.js.map +1 -1
  29. package/lib/hooks/useOnScrollOutside.js +12 -6
  30. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  31. package/lib/hooks/usePrevious.js.map +1 -1
  32. package/lib/hooks/useScrollbarWidth.js +1 -1
  33. package/lib/hooks/useScrollbarWidth.js.map +1 -1
  34. package/lib/hooks/useTimeout.js.map +1 -1
  35. package/lib/selection/useSelection.js +2 -2
  36. package/lib/selection/useSelection.js.map +1 -1
  37. package/lib/ssr/SSRContext.js +5 -7
  38. package/lib/ssr/SSRContext.js.map +1 -1
  39. package/lib/ssr/canUseDOM.js.map +1 -1
  40. package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
  41. package/lib/trigger/getTriggerChild.js.map +1 -1
  42. package/lib/trigger/isFluentTrigger.js.map +1 -1
  43. package/lib/utils/createSetFromIterable.js.map +1 -1
  44. package/lib/utils/getNativeElementProps.js +1 -1
  45. package/lib/utils/getNativeElementProps.js.map +1 -1
  46. package/lib/utils/getRTLSafeKey.js.map +1 -1
  47. package/lib/utils/getReactCallbackName.js +2 -4
  48. package/lib/utils/getReactCallbackName.js.map +1 -1
  49. package/lib/utils/isHTMLElement.js +2 -2
  50. package/lib/utils/isHTMLElement.js.map +1 -1
  51. package/lib/utils/isInteractiveHTMLElement.js +1 -1
  52. package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
  53. package/lib/utils/mergeCallbacks.js +3 -2
  54. package/lib/utils/mergeCallbacks.js.map +1 -1
  55. package/lib/utils/omit.js.map +1 -1
  56. package/lib/utils/priorityQueue.js.map +1 -1
  57. package/lib/utils/properties.js +2 -1
  58. package/lib/utils/properties.js.map +1 -1
  59. package/lib-commonjs/compose/assertSlots.js +13 -6
  60. package/lib-commonjs/compose/assertSlots.js.map +1 -1
  61. package/lib-commonjs/compose/constants.js +6 -2
  62. package/lib-commonjs/compose/constants.js.map +1 -1
  63. package/lib-commonjs/compose/getSlots.js +6 -4
  64. package/lib-commonjs/compose/getSlots.js.map +1 -1
  65. package/lib-commonjs/compose/getSlotsNext.js +6 -4
  66. package/lib-commonjs/compose/getSlotsNext.js.map +1 -1
  67. package/lib-commonjs/compose/index.js +14 -12
  68. package/lib-commonjs/compose/index.js.map +1 -1
  69. package/lib-commonjs/compose/isResolvedShorthand.js +3 -1
  70. package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
  71. package/lib-commonjs/compose/isSlot.js +5 -2
  72. package/lib-commonjs/compose/isSlot.js.map +1 -1
  73. package/lib-commonjs/compose/resolveShorthand.js +7 -4
  74. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  75. package/lib-commonjs/compose/slot.js +18 -12
  76. package/lib-commonjs/compose/slot.js.map +1 -1
  77. package/lib-commonjs/compose/types.js +2 -2
  78. package/lib-commonjs/compose/types.js.map +1 -1
  79. package/lib-commonjs/events/index.js +2 -2
  80. package/lib-commonjs/events/index.js.map +1 -1
  81. package/lib-commonjs/events/mouseTouchHelpers.js +11 -5
  82. package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
  83. package/lib-commonjs/hooks/index.js +14 -14
  84. package/lib-commonjs/hooks/index.js.map +1 -1
  85. package/lib-commonjs/hooks/useAnimationFrame.js +13 -2
  86. package/lib-commonjs/hooks/useAnimationFrame.js.map +1 -1
  87. package/lib-commonjs/hooks/useBrowserTimer.js +5 -3
  88. package/lib-commonjs/hooks/useBrowserTimer.js.map +1 -1
  89. package/lib-commonjs/hooks/useControllableState.js +10 -11
  90. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  91. package/lib-commonjs/hooks/useEventCallback.js +5 -3
  92. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  93. package/lib-commonjs/hooks/useFirstMount.js +5 -3
  94. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  95. package/lib-commonjs/hooks/useForceUpdate.js +3 -1
  96. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  97. package/lib-commonjs/hooks/useId.js +11 -5
  98. package/lib-commonjs/hooks/useId.js.map +1 -1
  99. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +5 -3
  100. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  101. package/lib-commonjs/hooks/useMergedRefs.js +5 -3
  102. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  103. package/lib-commonjs/hooks/useOnClickOutside.js +29 -22
  104. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  105. package/lib-commonjs/hooks/useOnScrollOutside.js +16 -9
  106. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  107. package/lib-commonjs/hooks/usePrevious.js +5 -3
  108. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  109. package/lib-commonjs/hooks/useScrollbarWidth.js +6 -4
  110. package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
  111. package/lib-commonjs/hooks/useTimeout.js +3 -1
  112. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  113. package/lib-commonjs/index.js +129 -43
  114. package/lib-commonjs/index.js.map +1 -1
  115. package/lib-commonjs/selection/index.js +3 -3
  116. package/lib-commonjs/selection/index.js.map +1 -1
  117. package/lib-commonjs/selection/types.js +2 -2
  118. package/lib-commonjs/selection/types.js.map +1 -1
  119. package/lib-commonjs/selection/useSelection.js +7 -5
  120. package/lib-commonjs/selection/useSelection.js.map +1 -1
  121. package/lib-commonjs/ssr/SSRContext.js +22 -14
  122. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  123. package/lib-commonjs/ssr/canUseDOM.js +3 -1
  124. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  125. package/lib-commonjs/ssr/index.js +3 -3
  126. package/lib-commonjs/ssr/index.js.map +1 -1
  127. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +5 -3
  128. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
  129. package/lib-commonjs/trigger/getTriggerChild.js +5 -3
  130. package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
  131. package/lib-commonjs/trigger/index.js +5 -5
  132. package/lib-commonjs/trigger/index.js.map +1 -1
  133. package/lib-commonjs/trigger/isFluentTrigger.js +5 -3
  134. package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
  135. package/lib-commonjs/trigger/types.js +2 -2
  136. package/lib-commonjs/trigger/types.js.map +1 -1
  137. package/lib-commonjs/utils/clamp.js +3 -1
  138. package/lib-commonjs/utils/clamp.js.map +1 -1
  139. package/lib-commonjs/utils/createSetFromIterable.js +3 -1
  140. package/lib-commonjs/utils/createSetFromIterable.js.map +1 -1
  141. package/lib-commonjs/utils/getNativeElementProps.js +9 -5
  142. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  143. package/lib-commonjs/utils/getRTLSafeKey.js +3 -1
  144. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  145. package/lib-commonjs/utils/getReactCallbackName.js +7 -7
  146. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
  147. package/lib-commonjs/utils/index.js +10 -10
  148. package/lib-commonjs/utils/index.js.map +1 -1
  149. package/lib-commonjs/utils/isHTMLElement.js +5 -3
  150. package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
  151. package/lib-commonjs/utils/isInteractiveHTMLElement.js +4 -2
  152. package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
  153. package/lib-commonjs/utils/mergeCallbacks.js +6 -3
  154. package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
  155. package/lib-commonjs/utils/omit.js +3 -1
  156. package/lib-commonjs/utils/omit.js.map +1 -1
  157. package/lib-commonjs/utils/priorityQueue.js +3 -1
  158. package/lib-commonjs/utils/priorityQueue.js.map +1 -1
  159. package/lib-commonjs/utils/properties.js +89 -30
  160. package/lib-commonjs/utils/properties.js.map +1 -1
  161. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"sources":["omit.ts"],"sourcesContent":["/**\n * Tiny helper to do the minimal amount of work in duplicating an object but omitting some\n * props. This ends up faster than using object ...rest or reduce to filter.\n *\n * This behaves very much like filteredAssign, but does not merge many objects together,\n * uses an exclusion object map, and avoids spreads all for optimal performance.\n *\n * See perf test for background:\n * https://jsperf.com/omit-vs-rest-vs-reduce/1\n *\n * @param obj - The object to clone\n * @param exclusions - The array of keys to exclude\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(\n obj: TObj,\n exclusions: Exclusions,\n): Omit<TObj, Exclusions[number]> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: Record<string, any> = {};\n\n for (const key in obj) {\n if (exclusions.indexOf(key) === -1 && obj.hasOwnProperty(key)) {\n result[key] = obj[key];\n }\n }\n\n return result as TObj;\n}\n"],"names":["omit","obj","exclusions","result","key","indexOf","hasOwnProperty"],"mappings":"AAAA;;;;;;;;;;;;CAYC,GACD,8DAA8D;AAC9D,OAAO,SAASA,KACdC,GAAS,EACTC,UAAsB,EACU;IAChC,8DAA8D;IAC9D,MAAMC,SAA8B,CAAC;IAErC,IAAK,MAAMC,OAAOH,IAAK;QACrB,IAAIC,WAAWG,OAAO,CAACD,SAAS,CAAC,KAAKH,IAAIK,cAAc,CAACF,MAAM;YAC7DD,MAAM,CAACC,IAAI,GAAGH,GAAG,CAACG,IAAI;QACxB,CAAC;IACH;IAEA,OAAOD;AACT,CAAC"}
1
+ {"version":3,"sources":["omit.ts"],"sourcesContent":["/**\n * Tiny helper to do the minimal amount of work in duplicating an object but omitting some\n * props. This ends up faster than using object ...rest or reduce to filter.\n *\n * This behaves very much like filteredAssign, but does not merge many objects together,\n * uses an exclusion object map, and avoids spreads all for optimal performance.\n *\n * See perf test for background:\n * https://jsperf.com/omit-vs-rest-vs-reduce/1\n *\n * @param obj - The object to clone\n * @param exclusions - The array of keys to exclude\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(\n obj: TObj,\n exclusions: Exclusions,\n): Omit<TObj, Exclusions[number]> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: Record<string, any> = {};\n\n for (const key in obj) {\n if (exclusions.indexOf(key) === -1 && obj.hasOwnProperty(key)) {\n result[key] = obj[key];\n }\n }\n\n return result as TObj;\n}\n"],"names":["omit","obj","exclusions","result","key","indexOf","hasOwnProperty"],"mappings":"AAAA;;;;;;;;;;;;CAYC,GACD,8DAA8D;AAC9D,OAAO,SAASA,KACdC,GAAS,EACTC,UAAsB;IAEtB,8DAA8D;IAC9D,MAAMC,SAA8B,CAAC;IAErC,IAAK,MAAMC,OAAOH,IAAK;QACrB,IAAIC,WAAWG,OAAO,CAACD,SAAS,CAAC,KAAKH,IAAIK,cAAc,CAACF,MAAM;YAC7DD,MAAM,CAACC,IAAI,GAAGH,GAAG,CAACG,IAAI;QACxB;IACF;IAEA,OAAOD;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["priorityQueue.ts"],"sourcesContent":["/**\n * @internal\n */\nexport type PriorityQueueCompareFn<T> = (a: T, b: T) => number;\n\n/**\n * @internal\n */\nexport interface PriorityQueue<T> {\n all: () => T[];\n clear: () => void;\n contains: (item: T) => boolean;\n dequeue: () => T;\n enqueue: (item: T) => void;\n peek: () => T | null;\n remove: (item: T) => void;\n size: () => number;\n}\n\n/**\n * @internal\n * @param compare - comparison function for items\n * @returns Priority queue implemented with a min heap\n */\nexport function createPriorityQueue<T>(compare: PriorityQueueCompareFn<T>): PriorityQueue<T> {\n const arr: T[] = [];\n let size = 0;\n\n const swap = (a: number, b: number) => {\n const tmp = arr[a];\n arr[a] = arr[b];\n arr[b] = tmp;\n };\n\n const heapify = (i: number) => {\n let smallest = i;\n const l = left(i);\n const r = right(i);\n\n if (l < size && compare(arr[l], arr[smallest]) < 0) {\n smallest = l;\n }\n\n if (r < size && compare(arr[r], arr[smallest]) < 0) {\n smallest = r;\n }\n\n if (smallest !== i) {\n swap(smallest, i);\n heapify(smallest);\n }\n };\n\n const dequeue = () => {\n if (size === 0) {\n throw new Error('Priority queue empty');\n }\n\n const res = arr[0];\n arr[0] = arr[--size];\n heapify(0);\n\n return res;\n };\n\n const peek = () => {\n if (size === 0) {\n return null;\n }\n\n return arr[0];\n };\n\n const enqueue = (item: T) => {\n arr[size++] = item;\n let i = size - 1;\n let p = parent(i);\n while (i > 0 && compare(arr[p], arr[i]) > 0) {\n swap(p, i);\n i = p;\n p = parent(i);\n }\n };\n\n const contains = (item: T) => {\n const index = arr.indexOf(item);\n return index >= 0 && index < size;\n };\n\n const remove = (item: T) => {\n const i = arr.indexOf(item);\n\n if (i === -1 || i >= size) {\n return;\n }\n\n arr[i] = arr[--size];\n heapify(i);\n };\n\n const clear = () => {\n size = 0;\n };\n\n const all = () => {\n return arr.slice(0, size);\n };\n\n return {\n all,\n clear,\n contains,\n dequeue,\n enqueue,\n peek,\n remove,\n size: () => size,\n };\n}\n\nconst left = (i: number) => {\n return 2 * i + 1;\n};\n\nconst right = (i: number) => {\n return 2 * i + 2;\n};\n\nconst parent = (i: number) => {\n return Math.floor((i - 1) / 2);\n};\n"],"names":["createPriorityQueue","compare","arr","size","swap","a","b","tmp","heapify","i","smallest","l","left","r","right","dequeue","Error","res","peek","enqueue","item","p","parent","contains","index","indexOf","remove","clear","all","slice","Math","floor"],"mappings":"AAAA;;CAEC,GAiBD;;;;CAIC,GACD,OAAO,SAASA,oBAAuBC,OAAkC,EAAoB;IAC3F,MAAMC,MAAW,EAAE;IACnB,IAAIC,OAAO;IAEX,MAAMC,OAAO,CAACC,GAAWC,IAAc;QACrC,MAAMC,MAAML,GAAG,CAACG,EAAE;QAClBH,GAAG,CAACG,EAAE,GAAGH,GAAG,CAACI,EAAE;QACfJ,GAAG,CAACI,EAAE,GAAGC;IACX;IAEA,MAAMC,UAAU,CAACC,IAAc;QAC7B,IAAIC,WAAWD;QACf,MAAME,IAAIC,KAAKH;QACf,MAAMI,IAAIC,MAAML;QAEhB,IAAIE,IAAIR,QAAQF,QAAQC,GAAG,CAACS,EAAE,EAAET,GAAG,CAACQ,SAAS,IAAI,GAAG;YAClDA,WAAWC;QACb,CAAC;QAED,IAAIE,IAAIV,QAAQF,QAAQC,GAAG,CAACW,EAAE,EAAEX,GAAG,CAACQ,SAAS,IAAI,GAAG;YAClDA,WAAWG;QACb,CAAC;QAED,IAAIH,aAAaD,GAAG;YAClBL,KAAKM,UAAUD;YACfD,QAAQE;QACV,CAAC;IACH;IAEA,MAAMK,UAAU,IAAM;QACpB,IAAIZ,SAAS,GAAG;YACd,MAAM,IAAIa,MAAM,wBAAwB;QAC1C,CAAC;QAED,MAAMC,MAAMf,GAAG,CAAC,EAAE;QAClBA,GAAG,CAAC,EAAE,GAAGA,GAAG,CAAC,EAAEC,KAAK;QACpBK,QAAQ;QAER,OAAOS;IACT;IAEA,MAAMC,OAAO,IAAM;QACjB,IAAIf,SAAS,GAAG;YACd,OAAO,IAAI;QACb,CAAC;QAED,OAAOD,GAAG,CAAC,EAAE;IACf;IAEA,MAAMiB,UAAU,CAACC,OAAY;QAC3BlB,GAAG,CAACC,OAAO,GAAGiB;QACd,IAAIX,IAAIN,OAAO;QACf,IAAIkB,IAAIC,OAAOb;QACf,MAAOA,IAAI,KAAKR,QAAQC,GAAG,CAACmB,EAAE,EAAEnB,GAAG,CAACO,EAAE,IAAI,EAAG;YAC3CL,KAAKiB,GAAGZ;YACRA,IAAIY;YACJA,IAAIC,OAAOb;QACb;IACF;IAEA,MAAMc,WAAW,CAACH,OAAY;QAC5B,MAAMI,QAAQtB,IAAIuB,OAAO,CAACL;QAC1B,OAAOI,SAAS,KAAKA,QAAQrB;IAC/B;IAEA,MAAMuB,SAAS,CAACN,OAAY;QAC1B,MAAMX,IAAIP,IAAIuB,OAAO,CAACL;QAEtB,IAAIX,MAAM,CAAC,KAAKA,KAAKN,MAAM;YACzB;QACF,CAAC;QAEDD,GAAG,CAACO,EAAE,GAAGP,GAAG,CAAC,EAAEC,KAAK;QACpBK,QAAQC;IACV;IAEA,MAAMkB,QAAQ,IAAM;QAClBxB,OAAO;IACT;IAEA,MAAMyB,MAAM,IAAM;QAChB,OAAO1B,IAAI2B,KAAK,CAAC,GAAG1B;IACtB;IAEA,OAAO;QACLyB;QACAD;QACAJ;QACAR;QACAI;QACAD;QACAQ;QACAvB,MAAM,IAAMA;IACd;AACF,CAAC;AAED,MAAMS,OAAO,CAACH,IAAc;IAC1B,OAAO,IAAIA,IAAI;AACjB;AAEA,MAAMK,QAAQ,CAACL,IAAc;IAC3B,OAAO,IAAIA,IAAI;AACjB;AAEA,MAAMa,SAAS,CAACb,IAAc;IAC5B,OAAOqB,KAAKC,KAAK,CAAC,AAACtB,CAAAA,IAAI,CAAA,IAAK;AAC9B"}
1
+ {"version":3,"sources":["priorityQueue.ts"],"sourcesContent":["/**\n * @internal\n */\nexport type PriorityQueueCompareFn<T> = (a: T, b: T) => number;\n\n/**\n * @internal\n */\nexport interface PriorityQueue<T> {\n all: () => T[];\n clear: () => void;\n contains: (item: T) => boolean;\n dequeue: () => T;\n enqueue: (item: T) => void;\n peek: () => T | null;\n remove: (item: T) => void;\n size: () => number;\n}\n\n/**\n * @internal\n * @param compare - comparison function for items\n * @returns Priority queue implemented with a min heap\n */\nexport function createPriorityQueue<T>(compare: PriorityQueueCompareFn<T>): PriorityQueue<T> {\n const arr: T[] = [];\n let size = 0;\n\n const swap = (a: number, b: number) => {\n const tmp = arr[a];\n arr[a] = arr[b];\n arr[b] = tmp;\n };\n\n const heapify = (i: number) => {\n let smallest = i;\n const l = left(i);\n const r = right(i);\n\n if (l < size && compare(arr[l], arr[smallest]) < 0) {\n smallest = l;\n }\n\n if (r < size && compare(arr[r], arr[smallest]) < 0) {\n smallest = r;\n }\n\n if (smallest !== i) {\n swap(smallest, i);\n heapify(smallest);\n }\n };\n\n const dequeue = () => {\n if (size === 0) {\n throw new Error('Priority queue empty');\n }\n\n const res = arr[0];\n arr[0] = arr[--size];\n heapify(0);\n\n return res;\n };\n\n const peek = () => {\n if (size === 0) {\n return null;\n }\n\n return arr[0];\n };\n\n const enqueue = (item: T) => {\n arr[size++] = item;\n let i = size - 1;\n let p = parent(i);\n while (i > 0 && compare(arr[p], arr[i]) > 0) {\n swap(p, i);\n i = p;\n p = parent(i);\n }\n };\n\n const contains = (item: T) => {\n const index = arr.indexOf(item);\n return index >= 0 && index < size;\n };\n\n const remove = (item: T) => {\n const i = arr.indexOf(item);\n\n if (i === -1 || i >= size) {\n return;\n }\n\n arr[i] = arr[--size];\n heapify(i);\n };\n\n const clear = () => {\n size = 0;\n };\n\n const all = () => {\n return arr.slice(0, size);\n };\n\n return {\n all,\n clear,\n contains,\n dequeue,\n enqueue,\n peek,\n remove,\n size: () => size,\n };\n}\n\nconst left = (i: number) => {\n return 2 * i + 1;\n};\n\nconst right = (i: number) => {\n return 2 * i + 2;\n};\n\nconst parent = (i: number) => {\n return Math.floor((i - 1) / 2);\n};\n"],"names":["createPriorityQueue","compare","arr","size","swap","a","b","tmp","heapify","i","smallest","l","left","r","right","dequeue","Error","res","peek","enqueue","item","p","parent","contains","index","indexOf","remove","clear","all","slice","Math","floor"],"mappings":"AAAA;;CAEC,GAiBD;;;;CAIC,GACD,OAAO,SAASA,oBAAuBC,OAAkC;IACvE,MAAMC,MAAW,EAAE;IACnB,IAAIC,OAAO;IAEX,MAAMC,OAAO,CAACC,GAAWC;QACvB,MAAMC,MAAML,GAAG,CAACG,EAAE;QAClBH,GAAG,CAACG,EAAE,GAAGH,GAAG,CAACI,EAAE;QACfJ,GAAG,CAACI,EAAE,GAAGC;IACX;IAEA,MAAMC,UAAU,CAACC;QACf,IAAIC,WAAWD;QACf,MAAME,IAAIC,KAAKH;QACf,MAAMI,IAAIC,MAAML;QAEhB,IAAIE,IAAIR,QAAQF,QAAQC,GAAG,CAACS,EAAE,EAAET,GAAG,CAACQ,SAAS,IAAI,GAAG;YAClDA,WAAWC;QACb;QAEA,IAAIE,IAAIV,QAAQF,QAAQC,GAAG,CAACW,EAAE,EAAEX,GAAG,CAACQ,SAAS,IAAI,GAAG;YAClDA,WAAWG;QACb;QAEA,IAAIH,aAAaD,GAAG;YAClBL,KAAKM,UAAUD;YACfD,QAAQE;QACV;IACF;IAEA,MAAMK,UAAU;QACd,IAAIZ,SAAS,GAAG;YACd,MAAM,IAAIa,MAAM;QAClB;QAEA,MAAMC,MAAMf,GAAG,CAAC,EAAE;QAClBA,GAAG,CAAC,EAAE,GAAGA,GAAG,CAAC,EAAEC,KAAK;QACpBK,QAAQ;QAER,OAAOS;IACT;IAEA,MAAMC,OAAO;QACX,IAAIf,SAAS,GAAG;YACd,OAAO;QACT;QAEA,OAAOD,GAAG,CAAC,EAAE;IACf;IAEA,MAAMiB,UAAU,CAACC;QACflB,GAAG,CAACC,OAAO,GAAGiB;QACd,IAAIX,IAAIN,OAAO;QACf,IAAIkB,IAAIC,OAAOb;QACf,MAAOA,IAAI,KAAKR,QAAQC,GAAG,CAACmB,EAAE,EAAEnB,GAAG,CAACO,EAAE,IAAI,EAAG;YAC3CL,KAAKiB,GAAGZ;YACRA,IAAIY;YACJA,IAAIC,OAAOb;QACb;IACF;IAEA,MAAMc,WAAW,CAACH;QAChB,MAAMI,QAAQtB,IAAIuB,OAAO,CAACL;QAC1B,OAAOI,SAAS,KAAKA,QAAQrB;IAC/B;IAEA,MAAMuB,SAAS,CAACN;QACd,MAAMX,IAAIP,IAAIuB,OAAO,CAACL;QAEtB,IAAIX,MAAM,CAAC,KAAKA,KAAKN,MAAM;YACzB;QACF;QAEAD,GAAG,CAACO,EAAE,GAAGP,GAAG,CAAC,EAAEC,KAAK;QACpBK,QAAQC;IACV;IAEA,MAAMkB,QAAQ;QACZxB,OAAO;IACT;IAEA,MAAMyB,MAAM;QACV,OAAO1B,IAAI2B,KAAK,CAAC,GAAG1B;IACtB;IAEA,OAAO;QACLyB;QACAD;QACAJ;QACAR;QACAI;QACAD;QACAQ;QACAvB,MAAM,IAAMA;IACd;AACF;AAEA,MAAMS,OAAO,CAACH;IACZ,OAAO,IAAIA,IAAI;AACjB;AAEA,MAAMK,QAAQ,CAACL;IACb,OAAO,IAAIA,IAAI;AACjB;AAEA,MAAMa,SAAS,CAACb;IACd,OAAOqB,KAAKC,KAAK,CAAC,AAACtB,CAAAA,IAAI,CAAA,IAAK;AAC9B"}
@@ -402,8 +402,9 @@ props, allowedPropNames, excludedPropNames) {
402
402
  const result = {};
403
403
  const keys = Object.keys(props);
404
404
  for (const key of keys){
405
+ var _excludedPropNames;
405
406
  const isNativeProp = !isArray && allowedPropNames[key] || isArray && allowedPropNames.indexOf(key) >= 0 || key.indexOf('data-') === 0 || key.indexOf('aria-') === 0;
406
- if (isNativeProp && (!excludedPropNames || (excludedPropNames === null || excludedPropNames === void 0 ? void 0 : excludedPropNames.indexOf(key)) === -1)) {
407
+ if (isNativeProp && (!excludedPropNames || ((_excludedPropNames = excludedPropNames) === null || _excludedPropNames === void 0 ? void 0 : _excludedPropNames.indexOf(key)) === -1)) {
407
408
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
408
409
  result[key] = props[key];
409
410
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["properties.ts"],"sourcesContent":["const toObjectMap = (...items: (string[] | Record<string, number>)[]) => {\n const result: Record<string, number> = {};\n\n for (const item of items) {\n const keys = Array.isArray(item) ? item : Object.keys(item);\n\n for (const key of keys) {\n result[key] = 1;\n }\n }\n\n return result;\n};\n\n/**\n * An array of events that are allowed on every html element type.\n *\n * @public\n */\nexport const baseElementEvents = toObjectMap([\n 'onAuxClick',\n 'onAnimationEnd',\n 'onAnimationStart',\n 'onCopy',\n 'onCut',\n 'onPaste',\n 'onCompositionEnd',\n 'onCompositionStart',\n 'onCompositionUpdate',\n 'onFocus',\n 'onFocusCapture',\n 'onBlur',\n 'onBlurCapture',\n 'onChange',\n 'onInput',\n 'onSubmit',\n 'onLoad',\n 'onError',\n 'onKeyDown',\n 'onKeyDownCapture',\n 'onKeyPress',\n 'onKeyUp',\n 'onAbort',\n 'onCanPlay',\n 'onCanPlayThrough',\n 'onDurationChange',\n 'onEmptied',\n 'onEncrypted',\n 'onEnded',\n 'onLoadedData',\n 'onLoadedMetadata',\n 'onLoadStart',\n 'onPause',\n 'onPlay',\n 'onPlaying',\n 'onProgress',\n 'onRateChange',\n 'onSeeked',\n 'onSeeking',\n 'onStalled',\n 'onSuspend',\n 'onTimeUpdate',\n 'onVolumeChange',\n 'onWaiting',\n 'onClick',\n 'onClickCapture',\n 'onContextMenu',\n 'onDoubleClick',\n 'onDrag',\n 'onDragEnd',\n 'onDragEnter',\n 'onDragExit',\n 'onDragLeave',\n 'onDragOver',\n 'onDragStart',\n 'onDrop',\n 'onMouseDown',\n 'onMouseDownCapture',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseMove',\n 'onMouseOut',\n 'onMouseOver',\n 'onMouseUp',\n 'onMouseUpCapture',\n 'onSelect',\n 'onTouchCancel',\n 'onTouchEnd',\n 'onTouchMove',\n 'onTouchStart',\n 'onScroll',\n 'onWheel',\n 'onPointerCancel',\n 'onPointerDown',\n 'onPointerEnter',\n 'onPointerLeave',\n 'onPointerMove',\n 'onPointerOut',\n 'onPointerOver',\n 'onPointerUp',\n 'onGotPointerCapture',\n 'onLostPointerCapture',\n]);\n\n/**\n * An array of element attributes which are allowed on every html element type.\n *\n * @public\n */\nexport const baseElementProperties = toObjectMap([\n 'accessKey', // global\n 'children', // global\n 'className', // global\n 'contentEditable', // global\n 'dir', // global\n 'draggable', // global\n 'hidden', // global\n 'htmlFor', // global\n 'id', // global\n 'lang', // global\n 'ref', // global\n 'role', // global\n 'style', // global\n 'tabIndex', // global\n 'title', // global\n 'translate', // global\n 'spellCheck', // global\n 'name', // global\n]);\n\n/**\n * An array of microdata attributes that are allowed on every html element type.\n *\n * @public\n */\nexport const microdataProperties = toObjectMap([\n 'itemID', // global\n 'itemProp', // global\n 'itemRef', // global\n 'itemScope', // global\n 'itemType', // global\n]);\n\n/**\n * An array of HTML element properties and events.\n *\n * @public\n */\nexport const htmlElementProperties = toObjectMap(baseElementProperties, baseElementEvents, microdataProperties);\n\n/**\n * An array of LABEL tag properties and events.\n *\n * @public\n */\nexport const labelProperties = toObjectMap(htmlElementProperties, [\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n]);\n\n/**\n * An array of AUDIO tag properties and events.\n\n * @public\n */\nexport const audioProperties = toObjectMap(htmlElementProperties, [\n 'height', // canvas, embed, iframe, img, input, object, video\n 'loop', // audio, video\n 'muted', // audio, video\n 'preload', // audio, video\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'width', // canvas, embed, iframe, img, input, object, video\n]);\n\n/**\n * An array of VIDEO tag properties and events.\n *\n * @public\n */\nexport const videoProperties = toObjectMap(audioProperties, [\n 'poster', // video\n]);\n\n/**\n * An array of OL tag properties and events.\n *\n * @public\n */\nexport const olProperties = toObjectMap(htmlElementProperties, [\n 'start', // ol\n]);\n\n/**\n * An array of LI tag properties and events.\n *\n * @public\n */\nexport const liProperties = toObjectMap(htmlElementProperties, [\n 'value', // button, input, li, option, meter, progress, param\n]);\n\n/**\n * An array of A tag properties and events.\n *\n * @public\n */\nexport const anchorProperties = toObjectMap(htmlElementProperties, [\n 'download', // a, area\n 'href', // a, area, base, link\n 'hrefLang', // a, area, link\n 'media', // a, area, link, source, style\n 'rel', // a, area, link\n 'target', // a, area, base, form\n 'type', // a, button, input, link, menu, object, script, source, style\n]);\n\n/**\n * An array of TIME tag properties and events.\n *\n * @public\n */\nexport const timeProperties = toObjectMap(htmlElementProperties, [\n 'dateTime', // time\n]);\n\n/**\n * An array of BUTTON tag properties and events.\n *\n * @public\n */\nexport const buttonProperties = toObjectMap(htmlElementProperties, [\n 'autoFocus', // button, input, select, textarea\n 'disabled', // button, fieldset, input, optgroup, option, select, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'formAction', // input, button\n 'formEncType', // input, button\n 'formMethod', // input, button\n 'formNoValidate', // input, button\n 'formTarget', // input, button\n 'type', // a, button, input, link, menu, object, script, source, style\n 'value', // button, input, li, option, meter, progress, param,\n]);\n\n/**\n * An array of INPUT tag properties and events.\n *\n * @public\n */\nexport const inputProperties = toObjectMap(buttonProperties, [\n 'accept', // input\n 'alt', // area, img, input\n 'autoCapitalize', // input, textarea\n 'autoComplete', // form, input\n 'checked', // input\n 'dirname', // input, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'height', // canvas, embed, iframe, img, input, object, video\n 'inputMode', // input\n 'list', // input\n 'max', // input, meter\n 'maxLength', // input, textarea\n 'min', // input, meter\n 'multiple', // input, select\n 'pattern', // input\n 'placeholder', // input, textarea\n 'readOnly', // input, textarea\n 'required', // input, select, textarea\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'step', // input\n 'size', // input\n 'type', // a, button, input, link, menu, object, script, source, style\n 'value', // button, input, li, option, meter, progress, param\n 'width', // canvas, embed, iframe, img, input, object, video\n]);\n\n/**\n * An array of TEXTAREA tag properties and events.\n *\n * @public\n */\nexport const textAreaProperties = toObjectMap(buttonProperties, [\n 'autoCapitalize', // input, textarea\n 'cols', // textarea\n 'dirname', // input, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'maxLength', // input, textarea\n 'placeholder', // input, textarea\n 'readOnly', // input, textarea\n 'required', // input, select, textarea\n 'rows', // textarea\n 'wrap', // textarea\n]);\n\n/**\n * An array of SELECT tag properties and events.\n *\n * @public\n */\nexport const selectProperties = toObjectMap(buttonProperties, [\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'multiple', // input, select\n 'required', // input, select, textarea\n]);\n\nexport const optionProperties = toObjectMap(htmlElementProperties, [\n 'selected', // option\n 'value', // button, input, li, option, meter, progress, param\n]);\n\n/**\n * An array of TABLE tag properties and events.\n *\n * @public\n */\nexport const tableProperties = toObjectMap(htmlElementProperties, [\n 'cellPadding', // table\n 'cellSpacing', // table\n]);\n\n/**\n * An array of TR tag properties and events.\n *\n * @public\n */\nexport const trProperties = htmlElementProperties;\n\n/**\n * An array of TH tag properties and events.\n *\n * @public\n */\nexport const thProperties = toObjectMap(htmlElementProperties, [\n 'colSpan', // td, th\n 'rowSpan', // td, th\n 'scope', // th\n]);\n\n/**\n * An array of TD tag properties and events.\n *\n * @public\n */\nexport const tdProperties = toObjectMap(htmlElementProperties, [\n 'colSpan', // td\n 'headers', // td\n 'rowSpan', // td, th\n 'scope', // th\n]);\n\nexport const colGroupProperties = toObjectMap(htmlElementProperties, [\n 'span', // col, colgroup\n]);\n\nexport const colProperties = toObjectMap(htmlElementProperties, [\n 'span', // col, colgroup\n]);\n\n/**\n * An array of FIELDSET tag properties and events.\n *\n * @public\n */\nexport const fieldsetProperties = toObjectMap(htmlElementProperties, [\n 'disabled', // button, fieldset, input, optgroup, option, select, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n]);\n\n/**\n * An array of FORM tag properties and events.\n *\n * @public\n */\nexport const formProperties = toObjectMap(htmlElementProperties, [\n 'acceptCharset', // form\n 'action', // form\n 'encType', // form\n 'encType', // form\n 'method', // form\n 'noValidate', // form\n 'target', // form\n]);\n\n/**\n * An array of IFRAME tag properties and events.\n *\n * @public\n */\nexport const iframeProperties = toObjectMap(htmlElementProperties, [\n 'allow', // iframe\n 'allowFullScreen', // iframe\n 'allowPaymentRequest', // iframe\n 'allowTransparency', // iframe\n 'csp', // iframe\n 'height', // canvas, embed, iframe, img, input, object, video\n 'importance', // iframe\n 'referrerPolicy', // iframe\n 'sandbox', // iframe\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'srcDoc', // iframe\n 'width', // canvas, embed, iframe, img, input, object, video,\n]);\n\n/**\n * An array of IMAGE tag properties and events.\n *\n * @public\n */\nexport const imgProperties = toObjectMap(htmlElementProperties, [\n 'alt', // area, img, input\n 'crossOrigin', // img\n 'height', // canvas, embed, iframe, img, input, object, video\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'srcSet', // img, source\n 'useMap', // img, object,\n 'width', // canvas, embed, iframe, img, input, object, video\n]);\n\n/**\n * An array of DIALOG tag properties and events.\n *\n * @public\n */\nexport const dialogProperties = toObjectMap(htmlElementProperties, ['open', 'onCancel', 'onClose']);\n\n/**\n * An array of DIV tag properties and events.\n *\n * @public\n */\nexport const divProperties = htmlElementProperties;\n\n/**\n * Gets native supported props for an html element provided the allowance set. Use one of the property\n * sets defined (divProperties, buttonPropertes, etc) to filter out supported properties from a given\n * props set. Note that all data- and aria- prefixed attributes will be allowed.\n * NOTE: getNativeProps should always be applied first when adding props to a react component. The\n * non-native props should be applied second. This will prevent getNativeProps from overriding your custom props.\n * For example, if props passed to getNativeProps has an onClick function and getNativeProps is added to\n * the component after an onClick function is added, then the getNativeProps onClick will override it.\n *\n * @public\n * @param props - The unfiltered input props\n * @param allowedPropNames - The array or record of allowed prop names.\n * @param excludedPropNames\n * @returns The filtered props\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getNativeProps<T extends Record<string, any>>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: Record<string, any>,\n allowedPropNames: string[] | Record<string, number>,\n excludedPropNames?: string[],\n): T {\n // It'd be great to properly type this while allowing 'aria-` and 'data-' attributes like TypeScript does for\n // JSX attributes, but that ability is hardcoded into the TS compiler with no analog in TypeScript typings.\n // Then we'd be able to enforce props extends native props (including aria- and data- attributes), and then\n // return native props.\n // We should be able to do this once this PR is merged: https://github.com/microsoft/TypeScript/pull/26797\n\n const isArray = Array.isArray(allowedPropNames);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: Record<string, any> = {};\n const keys = Object.keys(props);\n\n for (const key of keys) {\n const isNativeProp =\n (!isArray && (allowedPropNames as Record<string, number>)[key]) ||\n (isArray && (allowedPropNames as string[]).indexOf(key) >= 0) ||\n key.indexOf('data-') === 0 ||\n key.indexOf('aria-') === 0;\n\n if (isNativeProp && (!excludedPropNames || excludedPropNames?.indexOf(key) === -1)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result[key] = props![key] as any;\n }\n }\n\n return result as T;\n}\n"],"names":["toObjectMap","items","result","item","keys","Array","isArray","Object","key","baseElementEvents","baseElementProperties","microdataProperties","htmlElementProperties","labelProperties","audioProperties","videoProperties","olProperties","liProperties","anchorProperties","timeProperties","buttonProperties","inputProperties","textAreaProperties","selectProperties","optionProperties","tableProperties","trProperties","thProperties","tdProperties","colGroupProperties","colProperties","fieldsetProperties","formProperties","iframeProperties","imgProperties","dialogProperties","divProperties","getNativeProps","props","allowedPropNames","excludedPropNames","isNativeProp","indexOf"],"mappings":"AAAA,MAAMA,cAAc,CAAC,GAAGC,QAAiD;IACvE,MAAMC,SAAiC,CAAC;IAExC,KAAK,MAAMC,QAAQF,MAAO;QACxB,MAAMG,OAAOC,MAAMC,OAAO,CAACH,QAAQA,OAAOI,OAAOH,IAAI,CAACD,KAAK;QAE3D,KAAK,MAAMK,OAAOJ,KAAM;YACtBF,MAAM,CAACM,IAAI,GAAG;QAChB;IACF;IAEA,OAAON;AACT;AAEA;;;;CAIC,GACD,OAAO,MAAMO,oBAAoBT,YAAY;IAC3C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAMU,wBAAwBV,YAAY;IAC/C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAMW,sBAAsBX,YAAY;IAC7C;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAMY,wBAAwBZ,YAAYU,uBAAuBD,mBAAmBE,qBAAqB;AAEhH;;;;CAIC,GACD,OAAO,MAAME,kBAAkBb,YAAYY,uBAAuB;IAChE;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAME,kBAAkBd,YAAYY,uBAAuB;IAChE;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAMG,kBAAkBf,YAAYc,iBAAiB;IAC1D;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"}
1
+ {"version":3,"sources":["properties.ts"],"sourcesContent":["const toObjectMap = (...items: (string[] | Record<string, number>)[]) => {\n const result: Record<string, number> = {};\n\n for (const item of items) {\n const keys = Array.isArray(item) ? item : Object.keys(item);\n\n for (const key of keys) {\n result[key] = 1;\n }\n }\n\n return result;\n};\n\n/**\n * An array of events that are allowed on every html element type.\n *\n * @public\n */\nexport const baseElementEvents = toObjectMap([\n 'onAuxClick',\n 'onAnimationEnd',\n 'onAnimationStart',\n 'onCopy',\n 'onCut',\n 'onPaste',\n 'onCompositionEnd',\n 'onCompositionStart',\n 'onCompositionUpdate',\n 'onFocus',\n 'onFocusCapture',\n 'onBlur',\n 'onBlurCapture',\n 'onChange',\n 'onInput',\n 'onSubmit',\n 'onLoad',\n 'onError',\n 'onKeyDown',\n 'onKeyDownCapture',\n 'onKeyPress',\n 'onKeyUp',\n 'onAbort',\n 'onCanPlay',\n 'onCanPlayThrough',\n 'onDurationChange',\n 'onEmptied',\n 'onEncrypted',\n 'onEnded',\n 'onLoadedData',\n 'onLoadedMetadata',\n 'onLoadStart',\n 'onPause',\n 'onPlay',\n 'onPlaying',\n 'onProgress',\n 'onRateChange',\n 'onSeeked',\n 'onSeeking',\n 'onStalled',\n 'onSuspend',\n 'onTimeUpdate',\n 'onVolumeChange',\n 'onWaiting',\n 'onClick',\n 'onClickCapture',\n 'onContextMenu',\n 'onDoubleClick',\n 'onDrag',\n 'onDragEnd',\n 'onDragEnter',\n 'onDragExit',\n 'onDragLeave',\n 'onDragOver',\n 'onDragStart',\n 'onDrop',\n 'onMouseDown',\n 'onMouseDownCapture',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseMove',\n 'onMouseOut',\n 'onMouseOver',\n 'onMouseUp',\n 'onMouseUpCapture',\n 'onSelect',\n 'onTouchCancel',\n 'onTouchEnd',\n 'onTouchMove',\n 'onTouchStart',\n 'onScroll',\n 'onWheel',\n 'onPointerCancel',\n 'onPointerDown',\n 'onPointerEnter',\n 'onPointerLeave',\n 'onPointerMove',\n 'onPointerOut',\n 'onPointerOver',\n 'onPointerUp',\n 'onGotPointerCapture',\n 'onLostPointerCapture',\n]);\n\n/**\n * An array of element attributes which are allowed on every html element type.\n *\n * @public\n */\nexport const baseElementProperties = toObjectMap([\n 'accessKey', // global\n 'children', // global\n 'className', // global\n 'contentEditable', // global\n 'dir', // global\n 'draggable', // global\n 'hidden', // global\n 'htmlFor', // global\n 'id', // global\n 'lang', // global\n 'ref', // global\n 'role', // global\n 'style', // global\n 'tabIndex', // global\n 'title', // global\n 'translate', // global\n 'spellCheck', // global\n 'name', // global\n]);\n\n/**\n * An array of microdata attributes that are allowed on every html element type.\n *\n * @public\n */\nexport const microdataProperties = toObjectMap([\n 'itemID', // global\n 'itemProp', // global\n 'itemRef', // global\n 'itemScope', // global\n 'itemType', // global\n]);\n\n/**\n * An array of HTML element properties and events.\n *\n * @public\n */\nexport const htmlElementProperties = toObjectMap(baseElementProperties, baseElementEvents, microdataProperties);\n\n/**\n * An array of LABEL tag properties and events.\n *\n * @public\n */\nexport const labelProperties = toObjectMap(htmlElementProperties, [\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n]);\n\n/**\n * An array of AUDIO tag properties and events.\n\n * @public\n */\nexport const audioProperties = toObjectMap(htmlElementProperties, [\n 'height', // canvas, embed, iframe, img, input, object, video\n 'loop', // audio, video\n 'muted', // audio, video\n 'preload', // audio, video\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'width', // canvas, embed, iframe, img, input, object, video\n]);\n\n/**\n * An array of VIDEO tag properties and events.\n *\n * @public\n */\nexport const videoProperties = toObjectMap(audioProperties, [\n 'poster', // video\n]);\n\n/**\n * An array of OL tag properties and events.\n *\n * @public\n */\nexport const olProperties = toObjectMap(htmlElementProperties, [\n 'start', // ol\n]);\n\n/**\n * An array of LI tag properties and events.\n *\n * @public\n */\nexport const liProperties = toObjectMap(htmlElementProperties, [\n 'value', // button, input, li, option, meter, progress, param\n]);\n\n/**\n * An array of A tag properties and events.\n *\n * @public\n */\nexport const anchorProperties = toObjectMap(htmlElementProperties, [\n 'download', // a, area\n 'href', // a, area, base, link\n 'hrefLang', // a, area, link\n 'media', // a, area, link, source, style\n 'rel', // a, area, link\n 'target', // a, area, base, form\n 'type', // a, button, input, link, menu, object, script, source, style\n]);\n\n/**\n * An array of TIME tag properties and events.\n *\n * @public\n */\nexport const timeProperties = toObjectMap(htmlElementProperties, [\n 'dateTime', // time\n]);\n\n/**\n * An array of BUTTON tag properties and events.\n *\n * @public\n */\nexport const buttonProperties = toObjectMap(htmlElementProperties, [\n 'autoFocus', // button, input, select, textarea\n 'disabled', // button, fieldset, input, optgroup, option, select, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'formAction', // input, button\n 'formEncType', // input, button\n 'formMethod', // input, button\n 'formNoValidate', // input, button\n 'formTarget', // input, button\n 'type', // a, button, input, link, menu, object, script, source, style\n 'value', // button, input, li, option, meter, progress, param,\n]);\n\n/**\n * An array of INPUT tag properties and events.\n *\n * @public\n */\nexport const inputProperties = toObjectMap(buttonProperties, [\n 'accept', // input\n 'alt', // area, img, input\n 'autoCapitalize', // input, textarea\n 'autoComplete', // form, input\n 'checked', // input\n 'dirname', // input, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'height', // canvas, embed, iframe, img, input, object, video\n 'inputMode', // input\n 'list', // input\n 'max', // input, meter\n 'maxLength', // input, textarea\n 'min', // input, meter\n 'multiple', // input, select\n 'pattern', // input\n 'placeholder', // input, textarea\n 'readOnly', // input, textarea\n 'required', // input, select, textarea\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'step', // input\n 'size', // input\n 'type', // a, button, input, link, menu, object, script, source, style\n 'value', // button, input, li, option, meter, progress, param\n 'width', // canvas, embed, iframe, img, input, object, video\n]);\n\n/**\n * An array of TEXTAREA tag properties and events.\n *\n * @public\n */\nexport const textAreaProperties = toObjectMap(buttonProperties, [\n 'autoCapitalize', // input, textarea\n 'cols', // textarea\n 'dirname', // input, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'maxLength', // input, textarea\n 'placeholder', // input, textarea\n 'readOnly', // input, textarea\n 'required', // input, select, textarea\n 'rows', // textarea\n 'wrap', // textarea\n]);\n\n/**\n * An array of SELECT tag properties and events.\n *\n * @public\n */\nexport const selectProperties = toObjectMap(buttonProperties, [\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n 'multiple', // input, select\n 'required', // input, select, textarea\n]);\n\nexport const optionProperties = toObjectMap(htmlElementProperties, [\n 'selected', // option\n 'value', // button, input, li, option, meter, progress, param\n]);\n\n/**\n * An array of TABLE tag properties and events.\n *\n * @public\n */\nexport const tableProperties = toObjectMap(htmlElementProperties, [\n 'cellPadding', // table\n 'cellSpacing', // table\n]);\n\n/**\n * An array of TR tag properties and events.\n *\n * @public\n */\nexport const trProperties = htmlElementProperties;\n\n/**\n * An array of TH tag properties and events.\n *\n * @public\n */\nexport const thProperties = toObjectMap(htmlElementProperties, [\n 'colSpan', // td, th\n 'rowSpan', // td, th\n 'scope', // th\n]);\n\n/**\n * An array of TD tag properties and events.\n *\n * @public\n */\nexport const tdProperties = toObjectMap(htmlElementProperties, [\n 'colSpan', // td\n 'headers', // td\n 'rowSpan', // td, th\n 'scope', // th\n]);\n\nexport const colGroupProperties = toObjectMap(htmlElementProperties, [\n 'span', // col, colgroup\n]);\n\nexport const colProperties = toObjectMap(htmlElementProperties, [\n 'span', // col, colgroup\n]);\n\n/**\n * An array of FIELDSET tag properties and events.\n *\n * @public\n */\nexport const fieldsetProperties = toObjectMap(htmlElementProperties, [\n 'disabled', // button, fieldset, input, optgroup, option, select, textarea\n 'form', // button, fieldset, input, label, meter, object, output, select, textarea\n]);\n\n/**\n * An array of FORM tag properties and events.\n *\n * @public\n */\nexport const formProperties = toObjectMap(htmlElementProperties, [\n 'acceptCharset', // form\n 'action', // form\n 'encType', // form\n 'encType', // form\n 'method', // form\n 'noValidate', // form\n 'target', // form\n]);\n\n/**\n * An array of IFRAME tag properties and events.\n *\n * @public\n */\nexport const iframeProperties = toObjectMap(htmlElementProperties, [\n 'allow', // iframe\n 'allowFullScreen', // iframe\n 'allowPaymentRequest', // iframe\n 'allowTransparency', // iframe\n 'csp', // iframe\n 'height', // canvas, embed, iframe, img, input, object, video\n 'importance', // iframe\n 'referrerPolicy', // iframe\n 'sandbox', // iframe\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'srcDoc', // iframe\n 'width', // canvas, embed, iframe, img, input, object, video,\n]);\n\n/**\n * An array of IMAGE tag properties and events.\n *\n * @public\n */\nexport const imgProperties = toObjectMap(htmlElementProperties, [\n 'alt', // area, img, input\n 'crossOrigin', // img\n 'height', // canvas, embed, iframe, img, input, object, video\n 'src', // audio, embed, iframe, img, input, script, source, track, video\n 'srcSet', // img, source\n 'useMap', // img, object,\n 'width', // canvas, embed, iframe, img, input, object, video\n]);\n\n/**\n * An array of DIALOG tag properties and events.\n *\n * @public\n */\nexport const dialogProperties = toObjectMap(htmlElementProperties, ['open', 'onCancel', 'onClose']);\n\n/**\n * An array of DIV tag properties and events.\n *\n * @public\n */\nexport const divProperties = htmlElementProperties;\n\n/**\n * Gets native supported props for an html element provided the allowance set. Use one of the property\n * sets defined (divProperties, buttonPropertes, etc) to filter out supported properties from a given\n * props set. Note that all data- and aria- prefixed attributes will be allowed.\n * NOTE: getNativeProps should always be applied first when adding props to a react component. The\n * non-native props should be applied second. This will prevent getNativeProps from overriding your custom props.\n * For example, if props passed to getNativeProps has an onClick function and getNativeProps is added to\n * the component after an onClick function is added, then the getNativeProps onClick will override it.\n *\n * @public\n * @param props - The unfiltered input props\n * @param allowedPropNames - The array or record of allowed prop names.\n * @param excludedPropNames\n * @returns The filtered props\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getNativeProps<T extends Record<string, any>>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: Record<string, any>,\n allowedPropNames: string[] | Record<string, number>,\n excludedPropNames?: string[],\n): T {\n // It'd be great to properly type this while allowing 'aria-` and 'data-' attributes like TypeScript does for\n // JSX attributes, but that ability is hardcoded into the TS compiler with no analog in TypeScript typings.\n // Then we'd be able to enforce props extends native props (including aria- and data- attributes), and then\n // return native props.\n // We should be able to do this once this PR is merged: https://github.com/microsoft/TypeScript/pull/26797\n\n const isArray = Array.isArray(allowedPropNames);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: Record<string, any> = {};\n const keys = Object.keys(props);\n\n for (const key of keys) {\n const isNativeProp =\n (!isArray && (allowedPropNames as Record<string, number>)[key]) ||\n (isArray && (allowedPropNames as string[]).indexOf(key) >= 0) ||\n key.indexOf('data-') === 0 ||\n key.indexOf('aria-') === 0;\n\n if (isNativeProp && (!excludedPropNames || excludedPropNames?.indexOf(key) === -1)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result[key] = props![key] as any;\n }\n }\n\n return result as T;\n}\n"],"names":["toObjectMap","items","result","item","keys","Array","isArray","Object","key","baseElementEvents","baseElementProperties","microdataProperties","htmlElementProperties","labelProperties","audioProperties","videoProperties","olProperties","liProperties","anchorProperties","timeProperties","buttonProperties","inputProperties","textAreaProperties","selectProperties","optionProperties","tableProperties","trProperties","thProperties","tdProperties","colGroupProperties","colProperties","fieldsetProperties","formProperties","iframeProperties","imgProperties","dialogProperties","divProperties","getNativeProps","props","allowedPropNames","excludedPropNames","isNativeProp","indexOf"],"mappings":"AAAA,MAAMA,cAAc,CAAC,GAAGC;IACtB,MAAMC,SAAiC,CAAC;IAExC,KAAK,MAAMC,QAAQF,MAAO;QACxB,MAAMG,OAAOC,MAAMC,OAAO,CAACH,QAAQA,OAAOI,OAAOH,IAAI,CAACD;QAEtD,KAAK,MAAMK,OAAOJ,KAAM;YACtBF,MAAM,CAACM,IAAI,GAAG;QAChB;IACF;IAEA,OAAON;AACT;AAEA;;;;CAIC,GACD,OAAO,MAAMO,oBAAoBT,YAAY;IAC3C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAMU,wBAAwBV,YAAY;IAC/C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAMW,sBAAsBX,YAAY;IAC7C;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAMY,wBAAwBZ,YAAYU,uBAAuBD,mBAAmBE,qBAAqB;AAEhH;;;;CAIC,GACD,OAAO,MAAME,kBAAkBb,YAAYY,uBAAuB;IAChE;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAME,kBAAkBd,YAAYY,uBAAuB;IAChE;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH;;;;CAIC,GACD,OAAO,MAAMG,kBAAkBf,YAAYc,iBAAiB;IAC1D;CACD,EAAE;A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"}
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "assertSlots", {
6
6
  enumerable: true,
7
- get: ()=>assertSlots
7
+ get: function() {
8
+ return assertSlots;
9
+ }
8
10
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
11
13
  const _constants = require("./constants");
12
14
  const _isSlot = require("./isSlot");
13
15
  const _index = require("./index");
@@ -30,15 +32,20 @@ function assertSlots(state) {
30
32
  elementType: typedState.components[slotName]
31
33
  });
32
34
  // eslint-disable-next-line no-console
33
- console.warn(`${assertSlots.name} warning: state.${slotName} is not a slot.\n` + `Be sure to create slots properly by using 'slot.always' or 'slot.optional'.`);
35
+ console.warn(`@fluentui/react-utilities [${assertSlots.name}]:
36
+ "state.${slotName}" is not a slot!
37
+ Be sure to create slots properly by using "slot.always" or "slot.optional".`);
34
38
  } else {
35
39
  // This means a slot is being declared by using resolveShorthand on the state hook,
36
40
  // but the render method is using the new `assertSlots` method. That scenario can be solved by simply updating the slot element with the proper element type
37
- const { [_constants.SLOT_ELEMENT_TYPE_SYMBOL]: elementType } = slotElement;
41
+ const { [_constants.SLOT_ELEMENT_TYPE_SYMBOL]: elementType } = slotElement;
38
42
  if (elementType !== typedState.components[slotName]) {
39
43
  slotElement[_constants.SLOT_ELEMENT_TYPE_SYMBOL] = typedState.components[slotName];
40
44
  // eslint-disable-next-line no-console
41
- console.warn(`${assertSlots.name} warning: state.${slotName} element type differs from state.components.${slotName}, ${elementType} !== ${typedState.components[slotName]}. \n` + `Be sure to create slots properly by using 'slot.always' or 'slot.optional' with the correct elementType`);
45
+ console.warn(`@fluentui/react-utilities [${assertSlots.name}]:
46
+ "state.${slotName}" element type differs from "state.components.${slotName}",
47
+ ${elementType} !== ${typedState.components[slotName]}.
48
+ Be sure to create slots properly by using "slot.always" or "slot.optional" with the correct elementType.`);
42
49
  }
43
50
  }
44
51
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["assertSlots.js"],"sourcesContent":["import * as React from 'react';\nimport { SLOT_ELEMENT_TYPE_SYMBOL } from './constants';\nimport { isSlot } from './isSlot';\nimport { slot } from './index';\n/**\n * @internal\n * Assertion method to ensure state slots properties are properly declared.\n * A properly declared slot must be declared by using the `slot` method.\n *\n * @example\n * ```tsx\n * export const renderInput_unstable = (state: InputState) => {\n assertSlots<InputSlots>(state);\n return (\n <state.root>\n {state.contentBefore && <state.contentBefore />}\n <state.input />\n {state.contentAfter && <state.contentAfter />}\n </state.root>\n );\n };\n * ```\n */ export function assertSlots(state) {\n /**\n * This verification is not necessary in production\n * as we're verifying static properties that will not change between environments\n */ if (process.env.NODE_ENV !== 'production') {\n const typedState = state;\n for (const slotName of Object.keys(typedState.components)){\n const slotElement = typedState[slotName];\n if (slotElement === undefined) {\n continue;\n }\n // this means a slot is being declared without using, slot.always or slot.optional or even resolveShorthand on the state hook,\n // but the render method is using the new `assertSlots` method. That scenario can be solved by simply updating the slot element with the proper element type\n // FIXME: this slot will still fail to support child render function scenario\n if (!isSlot(slotElement)) {\n typedState[slotName] = slot.always(slotElement, {\n elementType: typedState.components[slotName]\n });\n // eslint-disable-next-line no-console\n console.warn(`${assertSlots.name} warning: state.${slotName} is not a slot.\\n` + `Be sure to create slots properly by using 'slot.always' or 'slot.optional'.`);\n } else {\n // This means a slot is being declared by using resolveShorthand on the state hook,\n // but the render method is using the new `assertSlots` method. That scenario can be solved by simply updating the slot element with the proper element type\n const { [SLOT_ELEMENT_TYPE_SYMBOL]: elementType } = slotElement;\n if (elementType !== typedState.components[slotName]) {\n slotElement[SLOT_ELEMENT_TYPE_SYMBOL] = typedState.components[slotName];\n // eslint-disable-next-line no-console\n console.warn(`${assertSlots.name} warning: state.${slotName} element type differs from state.components.${slotName}, ${elementType} !== ${typedState.components[slotName]}. \\n` + `Be sure to create slots properly by using 'slot.always' or 'slot.optional' with the correct elementType`);\n }\n }\n }\n }\n}\n"],"names":["assertSlots","state","process","env","NODE_ENV","typedState","slotName","Object","keys","components","slotElement","undefined","isSlot","slot","always","elementType","console","warn","name","SLOT_ELEMENT_TYPE_SYMBOL"],"mappings":";;;;+BAsBoBA;;aAAAA;;;6DAtBG;2BACkB;wBAClB;uBACF;AAmBV,SAASA,YAAYC,KAAK,EAAE;IACnC;;;GAGD,GAAG,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,MAAMC,aAAaJ;QACnB,KAAK,MAAMK,YAAYC,OAAOC,IAAI,CAACH,WAAWI,UAAU,EAAE;YACtD,MAAMC,cAAcL,UAAU,CAACC,SAAS;YACxC,IAAII,gBAAgBC,WAAW;gBAC3B,QAAS;YACb,CAAC;YACD,8HAA8H;YAC9H,4JAA4J;YAC5J,6EAA6E;YAC7E,IAAI,CAACC,IAAAA,cAAM,EAACF,cAAc;gBACtBL,UAAU,CAACC,SAAS,GAAGO,WAAI,CAACC,MAAM,CAACJ,aAAa;oBAC5CK,aAAaV,WAAWI,UAAU,CAACH,SAAS;gBAChD;gBACA,sCAAsC;gBACtCU,QAAQC,IAAI,CAAC,CAAC,EAAEjB,YAAYkB,IAAI,CAAC,gBAAgB,EAAEZ,SAAS,iBAAiB,CAAC,GAAG,CAAC,2EAA2E,CAAC;YAClK,OAAO;gBACH,mFAAmF;gBACnF,4JAA4J;gBAC5J,MAAM,EAAE,CAACa,mCAAwB,CAAC,EAAEJ,YAAW,EAAG,GAAGL;gBACrD,IAAIK,gBAAgBV,WAAWI,UAAU,CAACH,SAAS,EAAE;oBACjDI,WAAW,CAACS,mCAAwB,CAAC,GAAGd,WAAWI,UAAU,CAACH,SAAS;oBACvE,sCAAsC;oBACtCU,QAAQC,IAAI,CAAC,CAAC,EAAEjB,YAAYkB,IAAI,CAAC,gBAAgB,EAAEZ,SAAS,4CAA4C,EAAEA,SAAS,EAAE,EAAES,YAAY,KAAK,EAAEV,WAAWI,UAAU,CAACH,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,uGAAuG,CAAC;gBAC/R,CAAC;YACL,CAAC;QACL;IACJ,CAAC;AACL"}
1
+ {"version":3,"sources":["assertSlots.js"],"sourcesContent":["import * as React from 'react';\nimport { SLOT_ELEMENT_TYPE_SYMBOL } from './constants';\nimport { isSlot } from './isSlot';\nimport { slot } from './index';\n/**\n * @internal\n * Assertion method to ensure state slots properties are properly declared.\n * A properly declared slot must be declared by using the `slot` method.\n *\n * @example\n * ```tsx\n * export const renderInput_unstable = (state: InputState) => {\n assertSlots<InputSlots>(state);\n return (\n <state.root>\n {state.contentBefore && <state.contentBefore />}\n <state.input />\n {state.contentAfter && <state.contentAfter />}\n </state.root>\n );\n };\n * ```\n */ export function assertSlots(state) {\n /**\n * This verification is not necessary in production\n * as we're verifying static properties that will not change between environments\n */ if (process.env.NODE_ENV !== 'production') {\n const typedState = state;\n for (const slotName of Object.keys(typedState.components)){\n const slotElement = typedState[slotName];\n if (slotElement === undefined) {\n continue;\n }\n // this means a slot is being declared without using, slot.always or slot.optional or even resolveShorthand on the state hook,\n // but the render method is using the new `assertSlots` method. That scenario can be solved by simply updating the slot element with the proper element type\n // FIXME: this slot will still fail to support child render function scenario\n if (!isSlot(slotElement)) {\n typedState[slotName] = slot.always(slotElement, {\n elementType: typedState.components[slotName]\n });\n // eslint-disable-next-line no-console\n console.warn(`@fluentui/react-utilities [${assertSlots.name}]:\n\"state.${slotName}\" is not a slot!\nBe sure to create slots properly by using \"slot.always\" or \"slot.optional\".`);\n } else {\n // This means a slot is being declared by using resolveShorthand on the state hook,\n // but the render method is using the new `assertSlots` method. That scenario can be solved by simply updating the slot element with the proper element type\n const { [SLOT_ELEMENT_TYPE_SYMBOL]: elementType } = slotElement;\n if (elementType !== typedState.components[slotName]) {\n slotElement[SLOT_ELEMENT_TYPE_SYMBOL] = typedState.components[slotName];\n // eslint-disable-next-line no-console\n console.warn(`@fluentui/react-utilities [${assertSlots.name}]:\n\"state.${slotName}\" element type differs from \"state.components.${slotName}\",\n${elementType} !== ${typedState.components[slotName]}.\nBe sure to create slots properly by using \"slot.always\" or \"slot.optional\" with the correct elementType.`);\n }\n }\n }\n }\n}\n"],"names":["assertSlots","state","process","env","NODE_ENV","typedState","slotName","Object","keys","components","slotElement","undefined","isSlot","slot","always","elementType","console","warn","name","SLOT_ELEMENT_TYPE_SYMBOL"],"mappings":";;;;+BAsBoBA;;;eAAAA;;;;iEAtBG;2BACkB;wBAClB;uBACF;AAmBV,SAASA,YAAYC,KAAK;IACjC;;;GAGD,GAAG,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,MAAMC,aAAaJ;QACnB,KAAK,MAAMK,YAAYC,OAAOC,IAAI,CAACH,WAAWI,UAAU,EAAE;YACtD,MAAMC,cAAcL,UAAU,CAACC,SAAS;YACxC,IAAII,gBAAgBC,WAAW;gBAC3B;YACJ;YACA,8HAA8H;YAC9H,4JAA4J;YAC5J,6EAA6E;YAC7E,IAAI,CAACC,IAAAA,cAAM,EAACF,cAAc;gBACtBL,UAAU,CAACC,SAAS,GAAGO,WAAI,CAACC,MAAM,CAACJ,aAAa;oBAC5CK,aAAaV,WAAWI,UAAU,CAACH,SAAS;gBAChD;gBACA,sCAAsC;gBACtCU,QAAQC,IAAI,CAAC,CAAC,2BAA2B,EAAEjB,YAAYkB,IAAI,CAAC;OACrE,EAAEZ,SAAS;2EACyD,CAAC;YAChE,OAAO;gBACH,mFAAmF;gBACnF,4JAA4J;gBAC5J,MAAM,EAAE,CAACa,mCAAwB,CAAC,EAAEJ,WAAW,EAAE,GAAGL;gBACpD,IAAIK,gBAAgBV,WAAWI,UAAU,CAACH,SAAS,EAAE;oBACjDI,WAAW,CAACS,mCAAwB,CAAC,GAAGd,WAAWI,UAAU,CAACH,SAAS;oBACvE,sCAAsC;oBACtCU,QAAQC,IAAI,CAAC,CAAC,2BAA2B,EAAEjB,YAAYkB,IAAI,CAAC;OACzE,EAAEZ,SAAS,8CAA8C,EAAEA,SAAS;AAC3E,EAAES,YAAY,KAAK,EAAEV,WAAWI,UAAU,CAACH,SAAS,CAAC;wGACmD,CAAC;gBACzF;YACJ;QACJ;IACJ;AACJ"}
@@ -12,8 +12,12 @@ function _export(target, all) {
12
12
  });
13
13
  }
14
14
  _export(exports, {
15
- SLOT_RENDER_FUNCTION_SYMBOL: ()=>SLOT_RENDER_FUNCTION_SYMBOL,
16
- SLOT_ELEMENT_TYPE_SYMBOL: ()=>SLOT_ELEMENT_TYPE_SYMBOL
15
+ SLOT_RENDER_FUNCTION_SYMBOL: function() {
16
+ return SLOT_RENDER_FUNCTION_SYMBOL;
17
+ },
18
+ SLOT_ELEMENT_TYPE_SYMBOL: function() {
19
+ return SLOT_ELEMENT_TYPE_SYMBOL;
20
+ }
17
21
  });
18
22
  const SLOT_RENDER_FUNCTION_SYMBOL = Symbol('fui.slotRenderFunction');
19
23
  const SLOT_ELEMENT_TYPE_SYMBOL = Symbol('fui.slotElementType');
@@ -1 +1 @@
1
- {"version":3,"sources":["constants.js"],"sourcesContent":["/**\n * @internal\n * Internal reference for the render function\n */ export const SLOT_RENDER_FUNCTION_SYMBOL = Symbol('fui.slotRenderFunction');\n/**\n * @internal\n * Internal reference for the render function\n */ export const SLOT_ELEMENT_TYPE_SYMBOL = Symbol('fui.slotElementType');\n"],"names":["SLOT_RENDER_FUNCTION_SYMBOL","SLOT_ELEMENT_TYPE_SYMBOL","Symbol"],"mappings":"AAAA;;;CAGC;;;;;;;;;;;IAAgBA,2BAA2B,MAA3BA;IAIAC,wBAAwB,MAAxBA;;AAJN,MAAMD,8BAA8BE,OAAO;AAI3C,MAAMD,2BAA2BC,OAAO"}
1
+ {"version":3,"sources":["constants.js"],"sourcesContent":["/**\n * @internal\n * Internal reference for the render function\n */ export const SLOT_RENDER_FUNCTION_SYMBOL = Symbol('fui.slotRenderFunction');\n/**\n * @internal\n * Internal reference for the render function\n */ export const SLOT_ELEMENT_TYPE_SYMBOL = Symbol('fui.slotElementType');\n"],"names":["SLOT_RENDER_FUNCTION_SYMBOL","SLOT_ELEMENT_TYPE_SYMBOL","Symbol"],"mappings":"AAAA;;;CAGC;;;;;;;;;;;IAAgBA,2BAA2B;eAA3BA;;IAIAC,wBAAwB;eAAxBA;;;AAJN,MAAMD,8BAA8BE,OAAO;AAI3C,MAAMD,2BAA2BC,OAAO"}
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "getSlots", {
6
6
  enumerable: true,
7
- get: ()=>getSlots
7
+ get: function() {
8
+ return getSlots;
9
+ }
8
10
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
11
13
  const _omit = require("../utils/omit");
12
14
  const _isSlot = require("./isSlot");
13
15
  const _constants = require("./constants");
@@ -35,7 +37,7 @@ function getSlot(state, slotName) {
35
37
  ];
36
38
  }
37
39
  // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)
38
- const { as: asProp , children , ...rest } = props;
40
+ const { as: asProp, children, ...rest } = props;
39
41
  const renderFunction = (0, _isSlot.isSlot)(props) ? props[_constants.SLOT_RENDER_FUNCTION_SYMBOL] : undefined;
40
42
  const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];
41
43
  if (renderFunction || typeof children === 'function') {
@@ -1 +1 @@
1
- {"version":3,"sources":["getSlots.js"],"sourcesContent":["import * as React from 'react';\nimport { omit } from '../utils/omit';\nimport { isSlot } from './isSlot';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';\n/**\n * Given the state and an array of slot names, will break out `slots` and `slotProps`\n * collections.\n *\n * The root is derived from a mix of `components` props and `as` prop.\n *\n * Slots will render as null if they are rendered as primitives with undefined children.\n *\n * The slotProps will always omit the `as` prop within them, and for slots that are string\n * primitives, the props will be filtered according to the slot type by the type system.\n * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable\n * anchor props. Note that this is only enforced at build time by Typescript -- there is no\n * runtime code filtering props in this function.\n *\n * @param state - State including slot definitions\n * @returns An object containing the `slots` map and `slotProps` map.\n */ export function getSlots(state) {\n const slots = {};\n const slotProps = {};\n const slotNames = Object.keys(state.components);\n for (const slotName of slotNames){\n const [slot, props] = getSlot(state, slotName);\n slots[slotName] = slot;\n slotProps[slotName] = props;\n }\n return {\n slots,\n slotProps: slotProps\n };\n}\nfunction getSlot(state, slotName) {\n var _state_components, _state_components1;\n const props = state[slotName];\n if (props === undefined) {\n return [\n null,\n undefined\n ];\n }\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp , children , ...rest } = props;\n const renderFunction = isSlot(props) ? props[SLOT_RENDER_FUNCTION_SYMBOL] : undefined;\n const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];\n if (renderFunction || typeof children === 'function') {\n const render = renderFunction || children;\n return [\n React.Fragment,\n {\n children: render(slot, rest)\n }\n ];\n }\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = shouldOmitAsProp ? omit(props, [\n 'as'\n ]) : props;\n return [\n slot,\n slotProps\n ];\n}\n"],"names":["getSlots","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlot","_state_components","_state_components1","undefined","as","asProp","children","rest","renderFunction","isSlot","SLOT_RENDER_FUNCTION_SYMBOL","render","React","Fragment","shouldOmitAsProp","omit"],"mappings":";;;;+BAoBoBA;;aAAAA;;;6DApBG;sBACF;wBACE;2BACqB;AAiBjC,SAASA,SAASC,KAAK,EAAE;IAChC,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IACnB,MAAMC,YAAYC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC9C,KAAK,MAAMC,YAAYJ,UAAU;QAC7B,MAAM,CAACK,MAAMC,MAAM,GAAGC,QAAQV,OAAOO;QACrCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IAC1B;IACA,OAAO;QACHR;QACAC,WAAWA;IACf;AACJ;AACA,SAASQ,QAAQV,KAAK,EAAEO,QAAQ,EAAE;IAC9B,IAAII,mBAAmBC;IACvB,MAAMH,QAAQT,KAAK,CAACO,SAAS;IAC7B,IAAIE,UAAUI,WAAW;QACrB,OAAO;YACH,IAAI;YACJA;SACH;IACL,CAAC;IACD,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,OAAM,EAAGC,SAAQ,EAAG,GAAGC,MAAM,GAAGR;IAC5C,MAAMS,iBAAiBC,IAAAA,cAAM,EAACV,SAASA,KAAK,CAACW,sCAA2B,CAAC,GAAGP,SAAS;IACrF,MAAML,OAAO,AAAC,CAAA,AAACG,CAAAA,oBAAoBX,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIK,sBAAsB,KAAK,IAAI,KAAK,IAAIA,iBAAiB,CAACJ,SAAS,AAAD,MAAOM,aAAa,OAAOb,MAAMM,UAAU,CAACC,SAAS,KAAK,WAAWQ,UAAW,CAAA,AAACH,CAAAA,qBAAqBZ,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIM,uBAAuB,KAAK,IAAI,KAAK,IAAIA,kBAAkB,CAACL,SAAS,AAAD,KAAM,QAAQP,MAAMM,UAAU,CAACC,SAAS;IACnX,IAAIW,kBAAkB,OAAOF,aAAa,YAAY;QAClD,MAAMK,SAASH,kBAAkBF;QACjC,OAAO;YACHM,OAAMC,QAAQ;YACd;gBACIP,UAAUK,OAAOb,MAAMS;YAC3B;SACH;IACL,CAAC;IACD,MAAMO,mBAAmB,OAAOhB,SAAS,YAAYO;IACrD,MAAMb,YAAYsB,mBAAmBC,IAAAA,UAAI,EAAChB,OAAO;QAC7C;KACH,IAAIA,KAAK;IACV,OAAO;QACHD;QACAN;KACH;AACL"}
1
+ {"version":3,"sources":["getSlots.js"],"sourcesContent":["import * as React from 'react';\nimport { omit } from '../utils/omit';\nimport { isSlot } from './isSlot';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';\n/**\n * Given the state and an array of slot names, will break out `slots` and `slotProps`\n * collections.\n *\n * The root is derived from a mix of `components` props and `as` prop.\n *\n * Slots will render as null if they are rendered as primitives with undefined children.\n *\n * The slotProps will always omit the `as` prop within them, and for slots that are string\n * primitives, the props will be filtered according to the slot type by the type system.\n * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable\n * anchor props. Note that this is only enforced at build time by Typescript -- there is no\n * runtime code filtering props in this function.\n *\n * @param state - State including slot definitions\n * @returns An object containing the `slots` map and `slotProps` map.\n */ export function getSlots(state) {\n const slots = {};\n const slotProps = {};\n const slotNames = Object.keys(state.components);\n for (const slotName of slotNames){\n const [slot, props] = getSlot(state, slotName);\n slots[slotName] = slot;\n slotProps[slotName] = props;\n }\n return {\n slots,\n slotProps: slotProps\n };\n}\nfunction getSlot(state, slotName) {\n var _state_components, _state_components1;\n const props = state[slotName];\n if (props === undefined) {\n return [\n null,\n undefined\n ];\n }\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, children, ...rest } = props;\n const renderFunction = isSlot(props) ? props[SLOT_RENDER_FUNCTION_SYMBOL] : undefined;\n const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];\n if (renderFunction || typeof children === 'function') {\n const render = renderFunction || children;\n return [\n React.Fragment,\n {\n children: render(slot, rest)\n }\n ];\n }\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = shouldOmitAsProp ? omit(props, [\n 'as'\n ]) : props;\n return [\n slot,\n slotProps\n ];\n}\n"],"names":["getSlots","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlot","_state_components","_state_components1","undefined","as","asProp","children","rest","renderFunction","isSlot","SLOT_RENDER_FUNCTION_SYMBOL","render","React","Fragment","shouldOmitAsProp","omit"],"mappings":";;;;+BAoBoBA;;;eAAAA;;;;iEApBG;sBACF;wBACE;2BACqB;AAiBjC,SAASA,SAASC,KAAK;IAC9B,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IACnB,MAAMC,YAAYC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC9C,KAAK,MAAMC,YAAYJ,UAAU;QAC7B,MAAM,CAACK,MAAMC,MAAM,GAAGC,QAAQV,OAAOO;QACrCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IAC1B;IACA,OAAO;QACHR;QACAC,WAAWA;IACf;AACJ;AACA,SAASQ,QAAQV,KAAK,EAAEO,QAAQ;IAC5B,IAAII,mBAAmBC;IACvB,MAAMH,QAAQT,KAAK,CAACO,SAAS;IAC7B,IAAIE,UAAUI,WAAW;QACrB,OAAO;YACH;YACAA;SACH;IACL;IACA,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,MAAM,EAAEC,QAAQ,EAAE,GAAGC,MAAM,GAAGR;IAC1C,MAAMS,iBAAiBC,IAAAA,cAAM,EAACV,SAASA,KAAK,CAACW,sCAA2B,CAAC,GAAGP;IAC5E,MAAML,OAAO,AAAC,CAAA,AAACG,CAAAA,oBAAoBX,MAAMM,UAAU,AAAD,MAAO,QAAQK,sBAAsB,KAAK,IAAI,KAAK,IAAIA,iBAAiB,CAACJ,SAAS,AAAD,MAAOM,aAAa,OAAOb,MAAMM,UAAU,CAACC,SAAS,KAAK,WAAWQ,UAAW,CAAA,AAACH,CAAAA,qBAAqBZ,MAAMM,UAAU,AAAD,MAAO,QAAQM,uBAAuB,KAAK,IAAI,KAAK,IAAIA,kBAAkB,CAACL,SAAS,AAAD,KAAM,QAAQP,MAAMM,UAAU,CAACC,SAAS;IACnX,IAAIW,kBAAkB,OAAOF,aAAa,YAAY;QAClD,MAAMK,SAASH,kBAAkBF;QACjC,OAAO;YACHM,OAAMC,QAAQ;YACd;gBACIP,UAAUK,OAAOb,MAAMS;YAC3B;SACH;IACL;IACA,MAAMO,mBAAmB,OAAOhB,SAAS,YAAYO;IACrD,MAAMb,YAAYsB,mBAAmBC,IAAAA,UAAI,EAAChB,OAAO;QAC7C;KACH,IAAIA;IACL,OAAO;QACHD;QACAN;KACH;AACL"}
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "getSlotsNext", {
6
6
  enumerable: true,
7
- get: ()=>getSlotsNext
7
+ get: function() {
8
+ return getSlotsNext;
9
+ }
8
10
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
11
13
  function getSlotsNext(state) {
12
14
  const slots = {};
13
15
  const slotProps = {};
@@ -32,7 +34,7 @@ function getSlotNext(state, slotName) {
32
34
  ];
33
35
  }
34
36
  // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)
35
- const { as: asProp , ...propsWithoutAs } = props;
37
+ const { as: asProp, ...propsWithoutAs } = props;
36
38
  const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];
37
39
  const shouldOmitAsProp = typeof slot === 'string' && asProp;
38
40
  const slotProps = shouldOmitAsProp ? propsWithoutAs : props;
@@ -1 +1 @@
1
- {"version":3,"sources":["getSlotsNext.js"],"sourcesContent":["import * as React from 'react';\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n *\n * @internal\n * This is an internal temporary method, this method will cease to exist eventually!\n *\n * * ❗️❗️ **DO NOT USE IT EXTERNALLY** ❗️❗️\n */ export function getSlotsNext(state) {\n const slots = {};\n const slotProps = {};\n const slotNames = Object.keys(state.components);\n for (const slotName of slotNames){\n const [slot, props] = getSlotNext(state, slotName);\n slots[slotName] = slot;\n slotProps[slotName] = props;\n }\n return {\n slots,\n slotProps: slotProps\n };\n}\nfunction getSlotNext(state, slotName) {\n var _state_components, _state_components1;\n const props = state[slotName];\n if (props === undefined) {\n return [\n null,\n undefined\n ];\n }\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp , ...propsWithoutAs } = props;\n const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = shouldOmitAsProp ? propsWithoutAs : props;\n return [\n slot,\n slotProps\n ];\n}\n"],"names":["getSlotsNext","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlotNext","_state_components","_state_components1","undefined","as","asProp","propsWithoutAs","shouldOmitAsProp"],"mappings":";;;;+BAQoBA;;aAAAA;;;6DARG;AAQZ,SAASA,aAAaC,KAAK,EAAE;IACpC,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IACnB,MAAMC,YAAYC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC9C,KAAK,MAAMC,YAAYJ,UAAU;QAC7B,MAAM,CAACK,MAAMC,MAAM,GAAGC,YAAYV,OAAOO;QACzCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IAC1B;IACA,OAAO;QACHR;QACAC,WAAWA;IACf;AACJ;AACA,SAASQ,YAAYV,KAAK,EAAEO,QAAQ,EAAE;IAClC,IAAII,mBAAmBC;IACvB,MAAMH,QAAQT,KAAK,CAACO,SAAS;IAC7B,IAAIE,UAAUI,WAAW;QACrB,OAAO;YACH,IAAI;YACJA;SACH;IACL,CAAC;IACD,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,OAAM,EAAG,GAAGC,gBAAgB,GAAGP;IAC3C,MAAMD,OAAO,AAAC,CAAA,AAACG,CAAAA,oBAAoBX,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIK,sBAAsB,KAAK,IAAI,KAAK,IAAIA,iBAAiB,CAACJ,SAAS,AAAD,MAAOM,aAAa,OAAOb,MAAMM,UAAU,CAACC,SAAS,KAAK,WAAWQ,UAAW,CAAA,AAACH,CAAAA,qBAAqBZ,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIM,uBAAuB,KAAK,IAAI,KAAK,IAAIA,kBAAkB,CAACL,SAAS,AAAD,KAAM,QAAQP,MAAMM,UAAU,CAACC,SAAS;IACnX,MAAMU,mBAAmB,OAAOT,SAAS,YAAYO;IACrD,MAAMb,YAAYe,mBAAmBD,iBAAiBP,KAAK;IAC3D,OAAO;QACHD;QACAN;KACH;AACL"}
1
+ {"version":3,"sources":["getSlotsNext.js"],"sourcesContent":["import * as React from 'react';\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n *\n * @internal\n * This is an internal temporary method, this method will cease to exist eventually!\n *\n * * ❗️❗️ **DO NOT USE IT EXTERNALLY** ❗️❗️\n */ export function getSlotsNext(state) {\n const slots = {};\n const slotProps = {};\n const slotNames = Object.keys(state.components);\n for (const slotName of slotNames){\n const [slot, props] = getSlotNext(state, slotName);\n slots[slotName] = slot;\n slotProps[slotName] = props;\n }\n return {\n slots,\n slotProps: slotProps\n };\n}\nfunction getSlotNext(state, slotName) {\n var _state_components, _state_components1;\n const props = state[slotName];\n if (props === undefined) {\n return [\n null,\n undefined\n ];\n }\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, ...propsWithoutAs } = props;\n const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = shouldOmitAsProp ? propsWithoutAs : props;\n return [\n slot,\n slotProps\n ];\n}\n"],"names":["getSlotsNext","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlotNext","_state_components","_state_components1","undefined","as","asProp","propsWithoutAs","shouldOmitAsProp"],"mappings":";;;;+BAQoBA;;;eAAAA;;;;iEARG;AAQZ,SAASA,aAAaC,KAAK;IAClC,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IACnB,MAAMC,YAAYC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC9C,KAAK,MAAMC,YAAYJ,UAAU;QAC7B,MAAM,CAACK,MAAMC,MAAM,GAAGC,YAAYV,OAAOO;QACzCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IAC1B;IACA,OAAO;QACHR;QACAC,WAAWA;IACf;AACJ;AACA,SAASQ,YAAYV,KAAK,EAAEO,QAAQ;IAChC,IAAII,mBAAmBC;IACvB,MAAMH,QAAQT,KAAK,CAACO,SAAS;IAC7B,IAAIE,UAAUI,WAAW;QACrB,OAAO;YACH;YACAA;SACH;IACL;IACA,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,MAAM,EAAE,GAAGC,gBAAgB,GAAGP;IAC1C,MAAMD,OAAO,AAAC,CAAA,AAACG,CAAAA,oBAAoBX,MAAMM,UAAU,AAAD,MAAO,QAAQK,sBAAsB,KAAK,IAAI,KAAK,IAAIA,iBAAiB,CAACJ,SAAS,AAAD,MAAOM,aAAa,OAAOb,MAAMM,UAAU,CAACC,SAAS,KAAK,WAAWQ,UAAW,CAAA,AAACH,CAAAA,qBAAqBZ,MAAMM,UAAU,AAAD,MAAO,QAAQM,uBAAuB,KAAK,IAAI,KAAK,IAAIA,kBAAkB,CAACL,SAAS,AAAD,KAAM,QAAQP,MAAMM,UAAU,CAACC,SAAS;IACnX,MAAMU,mBAAmB,OAAOT,SAAS,YAAYO;IACrD,MAAMb,YAAYe,mBAAmBD,iBAAiBP;IACtD,OAAO;QACHD;QACAN;KACH;AACL"}
@@ -4,16 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "slot", {
6
6
  enumerable: true,
7
- get: ()=>_slot
7
+ get: function() {
8
+ return _slot;
9
+ }
8
10
  });
9
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
10
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
11
- const _slot = /*#__PURE__*/ _interopRequireWildcard(require("./slot"));
12
- _exportStar(require("./getSlots"), exports);
13
- _exportStar(require("./resolveShorthand"), exports);
14
- _exportStar(require("./types"), exports);
15
- _exportStar(require("./isResolvedShorthand"), exports);
16
- _exportStar(require("./constants"), exports);
17
- _exportStar(require("./getSlotsNext"), exports);
18
- _exportStar(require("./isSlot"), exports);
19
- _exportStar(require("./assertSlots"), exports);
11
+ const _export_star = require("@swc/helpers/_/_export_star");
12
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
13
+ const _slot = /*#__PURE__*/ _interop_require_wildcard._(require("./slot"));
14
+ _export_star._(require("./getSlots"), exports);
15
+ _export_star._(require("./resolveShorthand"), exports);
16
+ _export_star._(require("./types"), exports);
17
+ _export_star._(require("./isResolvedShorthand"), exports);
18
+ _export_star._(require("./constants"), exports);
19
+ _export_star._(require("./getSlotsNext"), exports);
20
+ _export_star._(require("./isSlot"), exports);
21
+ _export_star._(require("./assertSlots"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["import * as slot from './slot';\nexport * from './getSlots';\nexport * from './resolveShorthand';\nexport * from './types';\nexport * from './isResolvedShorthand';\nexport * from './constants';\nexport * from './getSlotsNext';\nexport * from './isSlot';\nexport * from './assertSlots';\nexport { slot };\n"],"names":["slot"],"mappings":";;;;+BASSA;;aAAAA;;;;4DATa;oBACR;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["import * as slot from './slot';\nexport * from './getSlots';\nexport * from './resolveShorthand';\nexport * from './types';\nexport * from './isResolvedShorthand';\nexport * from './constants';\nexport * from './getSlotsNext';\nexport * from './isSlot';\nexport * from './assertSlots';\nexport { slot };\n"],"names":["slot"],"mappings":";;;;+BASSA;;;eAAAA;;;;;gEATa;uBACR;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA"}
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "isResolvedShorthand", {
6
6
  enumerable: true,
7
- get: ()=>isResolvedShorthand
7
+ get: function() {
8
+ return isResolvedShorthand;
9
+ }
8
10
  });
9
11
  const _react = require("react");
10
12
  function isResolvedShorthand(shorthand) {
@@ -1 +1 @@
1
- {"version":3,"sources":["isResolvedShorthand.js"],"sourcesContent":["import { isValidElement } from 'react';\n/**\n * Guard method that validates if a shorthand is a slot\n * can be used to extends properties provided by a slot\n *\n * @example\n * ```\n * const backdropSlot = resolveShorthand(backdrop, {\n * defaultProps: {\n * onClick: useEventCallback(event => {\n * if (isResolvedShorthand(backdrop)) {\n * backdrop.onClick?.(event)\n * }\n * // do something after passing click down the line\n * }),\n * },\n * })\n * ```\n * @example\n * ```\n * const handleBackDropClick = (event) => {\n * // do your thing\n * }\n * const backdropSlot = resolveShorthand(backdrop, {\n * defaultProps: {\n * onClick: useEventCallback(\n * mergeCallbacks(isResolvedShorthand(backdrop) ? backdrop.onClick : undefined, handleBackdropClick)\n * )\n * })\n * ```\n */ export function isResolvedShorthand(shorthand) {\n return shorthand !== null && typeof shorthand === 'object' && !Array.isArray(shorthand) && !isValidElement(shorthand);\n}\n"],"names":["isResolvedShorthand","shorthand","Array","isArray","isValidElement"],"mappings":";;;;+BA8BoBA;;aAAAA;;uBA9BW;AA8BpB,SAASA,oBAAoBC,SAAS,EAAE;IAC/C,OAAOA,cAAc,IAAI,IAAI,OAAOA,cAAc,YAAY,CAACC,MAAMC,OAAO,CAACF,cAAc,eAACG,IAAAA,qBAAc,EAACH;AAC/G"}
1
+ {"version":3,"sources":["isResolvedShorthand.js"],"sourcesContent":["import { isValidElement } from 'react';\n/**\n * Guard method that validates if a shorthand is a slot\n * can be used to extends properties provided by a slot\n *\n * @example\n * ```\n * const backdropSlot = resolveShorthand(backdrop, {\n * defaultProps: {\n * onClick: useEventCallback(event => {\n * if (isResolvedShorthand(backdrop)) {\n * backdrop.onClick?.(event)\n * }\n * // do something after passing click down the line\n * }),\n * },\n * })\n * ```\n * @example\n * ```\n * const handleBackDropClick = (event) => {\n * // do your thing\n * }\n * const backdropSlot = resolveShorthand(backdrop, {\n * defaultProps: {\n * onClick: useEventCallback(\n * mergeCallbacks(isResolvedShorthand(backdrop) ? backdrop.onClick : undefined, handleBackdropClick)\n * )\n * })\n * ```\n */ export function isResolvedShorthand(shorthand) {\n return shorthand !== null && typeof shorthand === 'object' && !Array.isArray(shorthand) && !isValidElement(shorthand);\n}\n"],"names":["isResolvedShorthand","shorthand","Array","isArray","isValidElement"],"mappings":";;;;+BA8BoBA;;;eAAAA;;;uBA9BW;AA8BpB,SAASA,oBAAoBC,SAAS;IAC7C,OAAOA,cAAc,QAAQ,OAAOA,cAAc,YAAY,CAACC,MAAMC,OAAO,CAACF,cAAc,eAACG,IAAAA,qBAAc,EAACH;AAC/G"}
@@ -4,9 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "isSlot", {
6
6
  enumerable: true,
7
- get: ()=>isSlot
7
+ get: function() {
8
+ return isSlot;
9
+ }
8
10
  });
9
11
  const _constants = require("./constants");
10
12
  function isSlot(element) {
11
- return Boolean(element === null || element === void 0 ? void 0 : element.hasOwnProperty(_constants.SLOT_ELEMENT_TYPE_SYMBOL));
13
+ var _element;
14
+ return Boolean((_element = element) === null || _element === void 0 ? void 0 : _element.hasOwnProperty(_constants.SLOT_ELEMENT_TYPE_SYMBOL));
12
15
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["isSlot.js"],"sourcesContent":["import { SLOT_ELEMENT_TYPE_SYMBOL } from './constants';\n/**\n * Guard method to ensure a given element is a slot.\n * This is mainly used internally to ensure a slot is being used as a component.\n */ export function isSlot(element) {\n return Boolean(element === null || element === void 0 ? void 0 : element.hasOwnProperty(SLOT_ELEMENT_TYPE_SYMBOL));\n}\n"],"names":["isSlot","element","Boolean","hasOwnProperty","SLOT_ELEMENT_TYPE_SYMBOL"],"mappings":";;;;+BAIoBA;;aAAAA;;2BAJqB;AAI9B,SAASA,OAAOC,OAAO,EAAE;IAChC,OAAOC,QAAQD,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQE,cAAc,CAACC,mCAAwB,CAAC;AACrH"}
1
+ {"version":3,"sources":["isSlot.js"],"sourcesContent":["import { SLOT_ELEMENT_TYPE_SYMBOL } from './constants';\n/**\n * Guard method to ensure a given element is a slot.\n * This is mainly used internally to ensure a slot is being used as a component.\n */ export function isSlot(element) {\n var _element;\n return Boolean((_element = element) === null || _element === void 0 ? void 0 : _element.hasOwnProperty(SLOT_ELEMENT_TYPE_SYMBOL));\n}\n"],"names":["isSlot","element","_element","Boolean","hasOwnProperty","SLOT_ELEMENT_TYPE_SYMBOL"],"mappings":";;;;+BAIoBA;;;eAAAA;;;2BAJqB;AAI9B,SAASA,OAAOC,OAAO;IAC9B,IAAIC;IACJ,OAAOC,QAAQ,AAACD,CAAAA,WAAWD,OAAM,MAAO,QAAQC,aAAa,KAAK,IAAI,KAAK,IAAIA,SAASE,cAAc,CAACC,mCAAwB;AACnI"}
@@ -4,14 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "resolveShorthand", {
6
6
  enumerable: true,
7
- get: ()=>resolveShorthand
7
+ get: function() {
8
+ return resolveShorthand;
9
+ }
8
10
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _slot = /*#__PURE__*/ _interopRequireWildcard(require("./slot"));
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _slot = /*#__PURE__*/ _interop_require_wildcard._(require("./slot"));
11
13
  const resolveShorthand = (value, options)=>{
14
+ var _options;
12
15
  return _slot.optional(value, {
13
16
  ...options,
14
- renderByDefault: options === null || options === void 0 ? void 0 : options.required,
17
+ renderByDefault: (_options = options) === null || _options === void 0 ? void 0 : _options.required,
15
18
  // elementType as undefined is the way to identify between a slot and a resolveShorthand call
16
19
  // in the case elementType is undefined assertSlots will fail, ensuring it'll only work with slot method.
17
20
  elementType: undefined
@@ -1 +1 @@
1
- {"version":3,"sources":["resolveShorthand.js"],"sourcesContent":["import * as slot from './slot';\n/**\n * Resolves shorthands into slot props, to ensure normalization of the signature\n * being passed down to getSlots method\n * @param value - the base shorthand props\n * @param options - options to resolve shorthand props\n */ export const resolveShorthand = (value, options)=>{\n return slot.optional(value, {\n ...options,\n renderByDefault: options === null || options === void 0 ? void 0 : options.required,\n // elementType as undefined is the way to identify between a slot and a resolveShorthand call\n // in the case elementType is undefined assertSlots will fail, ensuring it'll only work with slot method.\n elementType: undefined\n });\n};\n"],"names":["resolveShorthand","value","options","slot","optional","renderByDefault","required","elementType","undefined"],"mappings":";;;;+BAMiBA;;aAAAA;;;4DANK;AAMX,MAAMA,mBAAmB,CAACC,OAAOC,UAAU;IAClD,OAAOC,MAAKC,QAAQ,CAACH,OAAO;QACxB,GAAGC,OAAO;QACVG,iBAAiBH,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQI,QAAQ;QACnF,6FAA6F;QAC7F,yGAAyG;QACzGC,aAAaC;IACjB;AACJ"}
1
+ {"version":3,"sources":["resolveShorthand.js"],"sourcesContent":["import * as slot from './slot';\n/**\n * Resolves shorthands into slot props, to ensure normalization of the signature\n * being passed down to getSlots method\n * @param value - the base shorthand props\n * @param options - options to resolve shorthand props\n */ export const resolveShorthand = (value, options)=>{\n var _options;\n return slot.optional(value, {\n ...options,\n renderByDefault: (_options = options) === null || _options === void 0 ? void 0 : _options.required,\n // elementType as undefined is the way to identify between a slot and a resolveShorthand call\n // in the case elementType is undefined assertSlots will fail, ensuring it'll only work with slot method.\n elementType: undefined\n });\n};\n"],"names":["resolveShorthand","value","options","_options","slot","optional","renderByDefault","required","elementType","undefined"],"mappings":";;;;+BAMiBA;;;eAAAA;;;;gEANK;AAMX,MAAMA,mBAAmB,CAACC,OAAOC;IACxC,IAAIC;IACJ,OAAOC,MAAKC,QAAQ,CAACJ,OAAO;QACxB,GAAGC,OAAO;QACVI,iBAAiB,AAACH,CAAAA,WAAWD,OAAM,MAAO,QAAQC,aAAa,KAAK,IAAI,KAAK,IAAIA,SAASI,QAAQ;QAClG,6FAA6F;QAC7F,yGAAyG;QACzGC,aAAaC;IACjB;AACJ"}
@@ -9,15 +9,21 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- always: ()=>always,
13
- optional: ()=>optional,
14
- resolveShorthand: ()=>resolveShorthand
12
+ always: function() {
13
+ return always;
14
+ },
15
+ optional: function() {
16
+ return optional;
17
+ },
18
+ resolveShorthand: function() {
19
+ return resolveShorthand;
20
+ }
15
21
  });
16
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
17
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
22
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
23
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
18
24
  const _constants = require("./constants");
19
25
  function always(value, options) {
20
- const { defaultProps , elementType } = options;
26
+ const { defaultProps, elementType } = options;
21
27
  const props = resolveShorthand(value);
22
28
  /**
23
29
  * Casting is required here as SlotComponentType is a function, not an object.
@@ -30,8 +36,9 @@ function always(value, options) {
30
36
  [_constants.SLOT_ELEMENT_TYPE_SYMBOL]: elementType
31
37
  };
32
38
  if (props && typeof props.children === 'function') {
39
+ var _defaultProps;
33
40
  propsWithMetadata[_constants.SLOT_RENDER_FUNCTION_SYMBOL] = props.children;
34
- propsWithMetadata.children = defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.children;
41
+ propsWithMetadata.children = (_defaultProps = defaultProps) === null || _defaultProps === void 0 ? void 0 : _defaultProps.children;
35
42
  }
36
43
  return propsWithMetadata;
37
44
  }
@@ -51,11 +58,10 @@ function resolveShorthand(value) {
51
58
  if (value && typeof value !== 'object' && process.env.NODE_ENV !== 'production') {
52
59
  // TODO: would be nice to have a link to slot documentation in this error message
53
60
  // eslint-disable-next-line no-console
54
- console.error([
55
- `[slot.resolveShorthand]: A slot got invalid value "${value}" (${typeof value}).`,
56
- 'A valid value is a slot shorthand or slot properties object.',
57
- 'Slot shorthands can be strings, numbers, arrays or JSX elements'
58
- ].join('\n'));
61
+ console.error(`@fluentui/react-utilities [slot.${resolveShorthand.name}]:
62
+ A slot got an invalid value "${value}" (${typeof value}).
63
+ A valid value for a slot is a slot shorthand or slot properties object.
64
+ Slot shorthands can be strings, numbers, arrays or JSX elements`);
59
65
  }
60
66
  return value;
61
67
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["slot.js"],"sourcesContent":["import * as React from 'react';\nimport { SLOT_ELEMENT_TYPE_SYMBOL, SLOT_RENDER_FUNCTION_SYMBOL } from './constants';\n/**\n * Creates a slot from a slot shorthand or properties (`props.SLOT_NAME` or `props` itself)\n * @param value - the value of the slot, it can be a slot shorthand, a slot component or a slot properties\n * @param options - values you can pass to alter the signature of a slot, those values are:\n *\n * * `elementType` - the base element type of a slot, defaults to `'div'`\n * * `defaultProps` - similar to a React component declaration, you can provide a slot default properties to be merged with the shorthand/properties provided.\n */ export function always(value, options) {\n const { defaultProps , elementType } = options;\n const props = resolveShorthand(value);\n /**\n * Casting is required here as SlotComponentType is a function, not an object.\n * Although SlotComponentType has a function signature, it is still just an object.\n * This is required to make a slot callable (JSX compatible), this is the exact same approach\n * that is used on `@types/react` components\n */ const propsWithMetadata = {\n ...defaultProps,\n ...props,\n [SLOT_ELEMENT_TYPE_SYMBOL]: elementType\n };\n if (props && typeof props.children === 'function') {\n propsWithMetadata[SLOT_RENDER_FUNCTION_SYMBOL] = props.children;\n propsWithMetadata.children = defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.children;\n }\n return propsWithMetadata;\n}\n/**\n * Creates a slot from a slot shorthand or properties (`props.SLOT_NAME` or `props` itself)\n * @param value - the value of the slot, it can be a slot shorthand, a slot component or a slot properties\n * @param options - values you can pass to alter the signature of a slot, those values are:\n *\n * * `elementType` - the base element type of a slot, defaults to `'div'`\n * * `defaultProps` - similar to a React component declaration, you can provide a slot default properties to be merged with the shorthand/properties provided\n * * `renderByDefault` - a boolean that indicates if a slot will be rendered even if it's base value is `undefined`.\n * By default if `props.SLOT_NAME` is `undefined` then `state.SLOT_NAME` becomes `undefined`\n * and nothing will be rendered, but if `renderByDefault = true` then `state.SLOT_NAME` becomes an object\n * with the values provided by `options.defaultProps` (or `{}`). This is useful for cases such as providing a default content\n * in case no shorthand is provided, like the case of the `expandIcon` slot for the `AccordionHeader`\n */ export function optional(value, options) {\n if (value === null || value === undefined && !options.renderByDefault) {\n return undefined;\n }\n return always(value, options);\n}\n/**\n * Helper function that converts a slot shorthand or properties to a slot properties object\n * The main difference between this function and `slot` is that this function does not return the metadata required for a slot to be considered a properly renderable slot, it only converts the value to a slot properties object\n * @param value - the value of the slot, it can be a slot shorthand or a slot properties object\n */ export function resolveShorthand(value) {\n if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || // eslint-disable-next-line @typescript-eslint/no-explicit-any\n React.isValidElement(value)) {\n return {\n children: value\n };\n }\n if (value && typeof value !== 'object' && process.env.NODE_ENV !== 'production') {\n // TODO: would be nice to have a link to slot documentation in this error message\n // eslint-disable-next-line no-console\n console.error([\n `[slot.resolveShorthand]: A slot got invalid value \"${value}\" (${typeof value}).`,\n 'A valid value is a slot shorthand or slot properties object.',\n 'Slot shorthands can be strings, numbers, arrays or JSX elements'\n ].join('\\n'));\n }\n return value;\n}\n"],"names":["always","optional","resolveShorthand","value","options","defaultProps","elementType","props","propsWithMetadata","SLOT_ELEMENT_TYPE_SYMBOL","children","SLOT_RENDER_FUNCTION_SYMBOL","undefined","renderByDefault","Array","isArray","React","isValidElement","process","env","NODE_ENV","console","error","join"],"mappings":";;;;;;;;;;;IASoBA,MAAM,MAANA;IA+BAC,QAAQ,MAARA;IAUAC,gBAAgB,MAAhBA;;;6DAlDG;2BAC+C;AAQ3D,SAASF,OAAOG,KAAK,EAAEC,OAAO,EAAE;IACvC,MAAM,EAAEC,aAAY,EAAGC,YAAW,EAAG,GAAGF;IACxC,MAAMG,QAAQL,iBAAiBC;IAC/B;;;;;GAKD,GAAG,MAAMK,oBAAoB;QACxB,GAAGH,YAAY;QACf,GAAGE,KAAK;QACR,CAACE,mCAAwB,CAAC,EAAEH;IAChC;IACA,IAAIC,SAAS,OAAOA,MAAMG,QAAQ,KAAK,YAAY;QAC/CF,iBAAiB,CAACG,sCAA2B,CAAC,GAAGJ,MAAMG,QAAQ;QAC/DF,kBAAkBE,QAAQ,GAAGL,iBAAiB,IAAI,IAAIA,iBAAiB,KAAK,IAAI,KAAK,IAAIA,aAAaK,QAAQ;IAClH,CAAC;IACD,OAAOF;AACX;AAaW,SAASP,SAASE,KAAK,EAAEC,OAAO,EAAE;IACzC,IAAID,UAAU,IAAI,IAAIA,UAAUS,aAAa,CAACR,QAAQS,eAAe,EAAE;QACnE,OAAOD;IACX,CAAC;IACD,OAAOZ,OAAOG,OAAOC;AACzB;AAKW,SAASF,iBAAiBC,KAAK,EAAE;IACxC,IAAI,OAAOA,UAAU,YAAY,OAAOA,UAAU,YAAYW,MAAMC,OAAO,CAACZ,UAAU,8DAA8D;kBACpJa,OAAMC,cAAc,CAACd,QAAQ;QACzB,OAAO;YACHO,UAAUP;QACd;IACJ,CAAC;IACD,IAAIA,SAAS,OAAOA,UAAU,YAAYe,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QAC7E,iFAAiF;QACjF,sCAAsC;QACtCC,QAAQC,KAAK,CAAC;YACV,CAAC,mDAAmD,EAAEnB,MAAM,GAAG,EAAE,OAAOA,MAAM,EAAE,CAAC;YACjF;YACA;SACH,CAACoB,IAAI,CAAC;IACX,CAAC;IACD,OAAOpB;AACX"}
1
+ {"version":3,"sources":["slot.js"],"sourcesContent":["import * as React from 'react';\nimport { SLOT_ELEMENT_TYPE_SYMBOL, SLOT_RENDER_FUNCTION_SYMBOL } from './constants';\n/**\n * Creates a slot from a slot shorthand or properties (`props.SLOT_NAME` or `props` itself)\n * @param value - the value of the slot, it can be a slot shorthand, a slot component or a slot properties\n * @param options - values you can pass to alter the signature of a slot, those values are:\n *\n * * `elementType` - the base element type of a slot, defaults to `'div'`\n * * `defaultProps` - similar to a React component declaration, you can provide a slot default properties to be merged with the shorthand/properties provided.\n */ export function always(value, options) {\n const { defaultProps, elementType } = options;\n const props = resolveShorthand(value);\n /**\n * Casting is required here as SlotComponentType is a function, not an object.\n * Although SlotComponentType has a function signature, it is still just an object.\n * This is required to make a slot callable (JSX compatible), this is the exact same approach\n * that is used on `@types/react` components\n */ const propsWithMetadata = {\n ...defaultProps,\n ...props,\n [SLOT_ELEMENT_TYPE_SYMBOL]: elementType\n };\n if (props && typeof props.children === 'function') {\n var _defaultProps;\n propsWithMetadata[SLOT_RENDER_FUNCTION_SYMBOL] = props.children;\n propsWithMetadata.children = (_defaultProps = defaultProps) === null || _defaultProps === void 0 ? void 0 : _defaultProps.children;\n }\n return propsWithMetadata;\n}\n/**\n * Creates a slot from a slot shorthand or properties (`props.SLOT_NAME` or `props` itself)\n * @param value - the value of the slot, it can be a slot shorthand, a slot component or a slot properties\n * @param options - values you can pass to alter the signature of a slot, those values are:\n *\n * * `elementType` - the base element type of a slot, defaults to `'div'`\n * * `defaultProps` - similar to a React component declaration, you can provide a slot default properties to be merged with the shorthand/properties provided\n * * `renderByDefault` - a boolean that indicates if a slot will be rendered even if it's base value is `undefined`.\n * By default if `props.SLOT_NAME` is `undefined` then `state.SLOT_NAME` becomes `undefined`\n * and nothing will be rendered, but if `renderByDefault = true` then `state.SLOT_NAME` becomes an object\n * with the values provided by `options.defaultProps` (or `{}`). This is useful for cases such as providing a default content\n * in case no shorthand is provided, like the case of the `expandIcon` slot for the `AccordionHeader`\n */ export function optional(value, options) {\n if (value === null || value === undefined && !options.renderByDefault) {\n return undefined;\n }\n return always(value, options);\n}\n/**\n * Helper function that converts a slot shorthand or properties to a slot properties object\n * The main difference between this function and `slot` is that this function does not return the metadata required for a slot to be considered a properly renderable slot, it only converts the value to a slot properties object\n * @param value - the value of the slot, it can be a slot shorthand or a slot properties object\n */ export function resolveShorthand(value) {\n if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || // eslint-disable-next-line @typescript-eslint/no-explicit-any\n React.isValidElement(value)) {\n return {\n children: value\n };\n }\n if (value && typeof value !== 'object' && process.env.NODE_ENV !== 'production') {\n // TODO: would be nice to have a link to slot documentation in this error message\n // eslint-disable-next-line no-console\n console.error(`@fluentui/react-utilities [slot.${resolveShorthand.name}]:\nA slot got an invalid value \"${value}\" (${typeof value}).\nA valid value for a slot is a slot shorthand or slot properties object.\nSlot shorthands can be strings, numbers, arrays or JSX elements`);\n }\n return value;\n}\n"],"names":["always","optional","resolveShorthand","value","options","defaultProps","elementType","props","propsWithMetadata","SLOT_ELEMENT_TYPE_SYMBOL","children","_defaultProps","SLOT_RENDER_FUNCTION_SYMBOL","undefined","renderByDefault","Array","isArray","React","isValidElement","process","env","NODE_ENV","console","error","name"],"mappings":";;;;;;;;;;;IASoBA,MAAM;eAANA;;IAgCAC,QAAQ;eAARA;;IAUAC,gBAAgB;eAAhBA;;;;iEAnDG;2BAC+C;AAQ3D,SAASF,OAAOG,KAAK,EAAEC,OAAO;IACrC,MAAM,EAAEC,YAAY,EAAEC,WAAW,EAAE,GAAGF;IACtC,MAAMG,QAAQL,iBAAiBC;IAC/B;;;;;GAKD,GAAG,MAAMK,oBAAoB;QACxB,GAAGH,YAAY;QACf,GAAGE,KAAK;QACR,CAACE,mCAAwB,CAAC,EAAEH;IAChC;IACA,IAAIC,SAAS,OAAOA,MAAMG,QAAQ,KAAK,YAAY;QAC/C,IAAIC;QACJH,iBAAiB,CAACI,sCAA2B,CAAC,GAAGL,MAAMG,QAAQ;QAC/DF,kBAAkBE,QAAQ,GAAG,AAACC,CAAAA,gBAAgBN,YAAW,MAAO,QAAQM,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcD,QAAQ;IACtI;IACA,OAAOF;AACX;AAaW,SAASP,SAASE,KAAK,EAAEC,OAAO;IACvC,IAAID,UAAU,QAAQA,UAAUU,aAAa,CAACT,QAAQU,eAAe,EAAE;QACnE,OAAOD;IACX;IACA,OAAOb,OAAOG,OAAOC;AACzB;AAKW,SAASF,iBAAiBC,KAAK;IACtC,IAAI,OAAOA,UAAU,YAAY,OAAOA,UAAU,YAAYY,MAAMC,OAAO,CAACb,UAAU,8DAA8D;kBACpJc,OAAMC,cAAc,CAACf,QAAQ;QACzB,OAAO;YACHO,UAAUP;QACd;IACJ;IACA,IAAIA,SAAS,OAAOA,UAAU,YAAYgB,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QAC7E,iFAAiF;QACjF,sCAAsC;QACtCC,QAAQC,KAAK,CAAC,CAAC,gCAAgC,EAAErB,iBAAiBsB,IAAI,CAAC;6BAClD,EAAErB,MAAM,GAAG,EAAE,OAAOA,MAAM;;+DAEQ,CAAC;IAC5D;IACA,OAAOA;AACX"}
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
6
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
5
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
6
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
@@ -1 +1 @@
1
- {"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;6DAAuB"}
1
+ {"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;iEAAuB"}
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./mouseTouchHelpers"), exports);
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./mouseTouchHelpers"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export * from './mouseTouchHelpers';\n"],"names":[],"mappings":";;;;;oBAAc"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export * from './mouseTouchHelpers';\n"],"names":[],"mappings":";;;;;uBAAc"}