@fluentui/react-utilities 9.14.2 → 9.15.1

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 (40) hide show
  1. package/CHANGELOG.json +31 -1
  2. package/CHANGELOG.md +20 -2
  3. package/dist/index.d.ts +35 -0
  4. package/lib/compose/getIntrinsicElementProps.js +1 -0
  5. package/lib/compose/getIntrinsicElementProps.js.map +1 -1
  6. package/lib/index.js +3 -1
  7. package/lib/index.js.map +1 -1
  8. package/lib/utils/getNativeElementProps.js +3 -0
  9. package/lib/utils/getNativeElementProps.js.map +1 -1
  10. package/lib/virtualParent/elementContains.js +29 -0
  11. package/lib/virtualParent/elementContains.js.map +1 -0
  12. package/lib/virtualParent/getParent.js +23 -0
  13. package/lib/virtualParent/getParent.js.map +1 -0
  14. package/lib/virtualParent/index.js +3 -0
  15. package/lib/virtualParent/index.js.map +1 -0
  16. package/lib/virtualParent/isVirtualElement.js +6 -0
  17. package/lib/virtualParent/isVirtualElement.js.map +1 -0
  18. package/lib/virtualParent/setVirtualParent.js +16 -0
  19. package/lib/virtualParent/setVirtualParent.js.map +1 -0
  20. package/lib/virtualParent/types.js +1 -0
  21. package/lib/virtualParent/types.js.map +1 -0
  22. package/lib-commonjs/compose/getIntrinsicElementProps.js +1 -0
  23. package/lib-commonjs/compose/getIntrinsicElementProps.js.map +1 -1
  24. package/lib-commonjs/index.js +10 -0
  25. package/lib-commonjs/index.js.map +1 -1
  26. package/lib-commonjs/utils/getNativeElementProps.js +1 -0
  27. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  28. package/lib-commonjs/virtualParent/elementContains.js +33 -0
  29. package/lib-commonjs/virtualParent/elementContains.js.map +1 -0
  30. package/lib-commonjs/virtualParent/getParent.js +29 -0
  31. package/lib-commonjs/virtualParent/getParent.js.map +1 -0
  32. package/lib-commonjs/virtualParent/index.js +8 -0
  33. package/lib-commonjs/virtualParent/index.js.map +1 -0
  34. package/lib-commonjs/virtualParent/isVirtualElement.js +16 -0
  35. package/lib-commonjs/virtualParent/isVirtualElement.js.map +1 -0
  36. package/lib-commonjs/virtualParent/setVirtualParent.js +26 -0
  37. package/lib-commonjs/virtualParent/setVirtualParent.js.map +1 -0
  38. package/lib-commonjs/virtualParent/types.js +4 -0
  39. package/lib-commonjs/virtualParent/types.js.map +1 -0
  40. package/package.json +1 -1
package/CHANGELOG.json CHANGED
@@ -2,7 +2,37 @@
2
2
  "name": "@fluentui/react-utilities",
3
3
  "entries": [
4
4
  {
5
- "date": "Mon, 09 Oct 2023 20:41:57 GMT",
5
+ "date": "Wed, 18 Oct 2023 17:47:37 GMT",
6
+ "tag": "@fluentui/react-utilities_v9.15.1",
7
+ "version": "9.15.1",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "bernardo.sunderhus@gmail.com",
12
+ "package": "@fluentui/react-utilities",
13
+ "commit": "4dc9e5be60b6ce6f3f6c72c6da39bf19a504f524",
14
+ "comment": "chore: deprecate getNativeElementProps in favor of getIntrinsicElementProps"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Wed, 11 Oct 2023 13:54:26 GMT",
21
+ "tag": "@fluentui/react-utilities_v9.15.0",
22
+ "version": "9.15.0",
23
+ "comments": {
24
+ "minor": [
25
+ {
26
+ "author": "lingfan.gao@microsoft.com",
27
+ "package": "@fluentui/react-utilities",
28
+ "commit": "97c3bc01d08b40f2fd0291fa193d95a621c9bdb8",
29
+ "comment": "feat: Add virtual parent utilties"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "date": "Mon, 09 Oct 2023 20:45:44 GMT",
6
36
  "tag": "@fluentui/react-utilities_v9.14.2",
7
37
  "version": "9.14.2",
8
38
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,30 @@
1
1
  # Change Log - @fluentui/react-utilities
2
2
 
3
- This log was last generated on Mon, 09 Oct 2023 20:41:57 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 18 Oct 2023 17:47:37 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.15.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.15.1)
8
+
9
+ Wed, 18 Oct 2023 17:47:37 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.15.0..@fluentui/react-utilities_v9.15.1)
11
+
12
+ ### Patches
13
+
14
+ - chore: deprecate getNativeElementProps in favor of getIntrinsicElementProps ([PR #29535](https://github.com/microsoft/fluentui/pull/29535) by bernardo.sunderhus@gmail.com)
15
+
16
+ ## [9.15.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.15.0)
17
+
18
+ Wed, 11 Oct 2023 13:54:26 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.14.2..@fluentui/react-utilities_v9.15.0)
20
+
21
+ ### Minor changes
22
+
23
+ - feat: Add virtual parent utilties ([PR #29286](https://github.com/microsoft/fluentui/pull/29286) by lingfan.gao@microsoft.com)
24
+
7
25
  ## [9.14.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.14.2)
8
26
 
9
- Mon, 09 Oct 2023 20:41:57 GMT
27
+ Mon, 09 Oct 2023 20:45:44 GMT
10
28
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.14.1..@fluentui/react-utilities_v9.14.2)
11
29
 
12
30
  ### Patches
package/dist/index.d.ts CHANGED
@@ -89,6 +89,15 @@ export declare type ComponentState<Slots extends SlotPropsRecord> = {
89
89
  */
90
90
  export declare function createPriorityQueue<T>(compare: PriorityQueueCompareFn<T>): PriorityQueue<T>;
91
91
 
92
+ /**
93
+ * Similar functionality to `element.contains` DOM API for use without of order DOM elements that
94
+ * checks the virtual parent hierarchy. If a virtual parents exists, it is chosen over the actual parent
95
+ *
96
+ * @internal
97
+ * @returns true if the child can find the parent in its virtual hierarchy
98
+ */
99
+ export declare function elementContains(parent: Node | null, child: Node | null): boolean;
100
+
92
101
  /**
93
102
  * HTML element types that are not allowed to have children.
94
103
  *
@@ -147,9 +156,26 @@ export declare const getIntrinsicElementProps: <Props extends UnknownSlotProps,
147
156
  * @param tagName - Tag name (e.g. "div")
148
157
  * @param props - Props object
149
158
  * @param excludedPropNames - List of props to disallow
159
+ *
160
+ * @deprecated use getIntrinsicElementProps instead, it is a type-safe version of this method
150
161
  */
151
162
  export declare function getNativeElementProps<TAttributes extends React_2.HTMLAttributes<any>>(tagName: string, props: {}, excludedPropNames?: string[]): TAttributes;
152
163
 
164
+ /**
165
+ * Gets the element which is the parent of a given element.
166
+ * This method prefers the virtual parent over real DOM parent when present.
167
+ * @internal
168
+ */
169
+ export declare function getParent(child: Node | null, options?: GetParentOptions): Node | null;
170
+
171
+ declare type GetParentOptions = {
172
+ /**
173
+ * Indicates if getParent() should ignore a virtual parent.
174
+ * @internal
175
+ */
176
+ skipVirtual?: boolean;
177
+ };
178
+
153
179
  /**
154
180
  * Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
155
181
  *
@@ -562,6 +588,15 @@ export declare interface SelectionMethods {
562
588
  declare type SelectionMode_2 = 'single' | 'multiselect';
563
589
  export { SelectionMode_2 as SelectionMode }
564
590
 
591
+ /**
592
+ * Sets the virtual parent of an element.
593
+ *
594
+ * @internal
595
+ * @param child - Theme element to set the virtual parent
596
+ * @param parent - The virtual parent, use `undefined` to remove a virtual parent relationship
597
+ */
598
+ export declare function setVirtualParent(child: Node, parent?: Node): void;
599
+
565
600
  /**
566
601
  * The props type and shorthand value for a slot. Type is either a single intrinsic element like `'div'`,
567
602
  * or a component like `typeof Button`.
@@ -7,5 +7,6 @@ import { getNativeElementProps } from '../utils/getNativeElementProps';
7
7
  * Equivalent to {@link getNativeElementProps}, but more type-safe.
8
8
  */ export const getIntrinsicElementProps = (/** The slot's default element type (e.g. 'div') */ tagName, /** The component's props object */ props, /** List of native props to exclude from the returned value */ excludedPropNames)=>{
9
9
  var _props_as;
10
+ // eslint-disable-next-line deprecation/deprecation
10
11
  return getNativeElementProps((_props_as = props.as) !== null && _props_as !== void 0 ? _props_as : tagName, props, excludedPropNames);
11
12
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["getIntrinsicElementProps.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '../utils/getNativeElementProps';\nimport type { InferredElementRefType, UnknownSlotProps } from './types';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype HTMLAttributes = React.HTMLAttributes<any>;\n\n/**\n * Given an element tagname and user props, filters the props to only allowed props for the given\n * element type.\n *\n * Equivalent to {@link getNativeElementProps}, but more type-safe.\n */\nexport const getIntrinsicElementProps = <\n Props extends UnknownSlotProps,\n ExcludedPropKeys extends Extract<keyof Props, string> = never,\n>(\n /** The slot's default element type (e.g. 'div') */\n tagName: NonNullable<Props['as']>,\n /** The component's props object */\n props: Props & React.RefAttributes<InferredElementRefType<Props>>,\n /** List of native props to exclude from the returned value */\n excludedPropNames?: ExcludedPropKeys[],\n) => {\n return getNativeElementProps<\n OmitWithoutExpanding<Props, Exclude<keyof Props, keyof HTMLAttributes | keyof UnknownSlotProps> | ExcludedPropKeys>\n >(props.as ?? tagName, props, excludedPropNames);\n};\n\n/**\n * helper type that avoids the expansion of unions while inferring it,\n * should work exactly the same as Omit\n */\ntype OmitWithoutExpanding<P, K extends string | number | symbol> = P extends unknown ? Omit<P, K> : P;\n"],"names":["React","getNativeElementProps","getIntrinsicElementProps","tagName","props","excludedPropNames","as"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ,iCAAiC;AAMvE;;;;;CAKC,GACD,OAAO,MAAMC,2BAA2B,CAItC,iDAAiD,GACjDC,SACA,iCAAiC,GACjCC,OACA,4DAA4D,GAC5DC;QAIED;IAFF,OAAOH,sBAELG,CAAAA,YAAAA,MAAME,EAAE,cAARF,uBAAAA,YAAYD,SAASC,OAAOC;AAChC,EAAE"}
1
+ {"version":3,"sources":["getIntrinsicElementProps.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '../utils/getNativeElementProps';\nimport type { InferredElementRefType, UnknownSlotProps } from './types';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype HTMLAttributes = React.HTMLAttributes<any>;\n\n/**\n * Given an element tagname and user props, filters the props to only allowed props for the given\n * element type.\n *\n * Equivalent to {@link getNativeElementProps}, but more type-safe.\n */\nexport const getIntrinsicElementProps = <\n Props extends UnknownSlotProps,\n ExcludedPropKeys extends Extract<keyof Props, string> = never,\n>(\n /** The slot's default element type (e.g. 'div') */\n tagName: NonNullable<Props['as']>,\n /** The component's props object */\n props: Props & React.RefAttributes<InferredElementRefType<Props>>,\n /** List of native props to exclude from the returned value */\n excludedPropNames?: ExcludedPropKeys[],\n) => {\n // eslint-disable-next-line deprecation/deprecation\n return getNativeElementProps<\n OmitWithoutExpanding<Props, Exclude<keyof Props, keyof HTMLAttributes | keyof UnknownSlotProps> | ExcludedPropKeys>\n >(props.as ?? tagName, props, excludedPropNames);\n};\n\n/**\n * helper type that avoids the expansion of unions while inferring it,\n * should work exactly the same as Omit\n */\ntype OmitWithoutExpanding<P, K extends string | number | symbol> = P extends unknown ? Omit<P, K> : P;\n"],"names":["React","getNativeElementProps","getIntrinsicElementProps","tagName","props","excludedPropNames","as"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ,iCAAiC;AAMvE;;;;;CAKC,GACD,OAAO,MAAMC,2BAA2B,CAItC,iDAAiD,GACjDC,SACA,iCAAiC,GACjCC,OACA,4DAA4D,GAC5DC;QAKED;IAHF,mDAAmD;IACnD,OAAOH,sBAELG,CAAAA,YAAAA,MAAME,EAAE,cAARF,uBAAAA,YAAYD,SAASC,OAAOC;AAChC,EAAE"}
package/lib/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  export { slot, isSlot, getSlots, getSlotsNext, assertSlots, resolveShorthand, isResolvedShorthand, getIntrinsicElementProps, SLOT_ELEMENT_TYPE_SYMBOL, SLOT_RENDER_FUNCTION_SYMBOL } from './compose/index';
2
2
  export { IdPrefixProvider, resetIdsForTests, useAnimationFrame, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from './hooks/index';
3
3
  export { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';
4
- export { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit, createPriorityQueue } from './utils/index';
4
+ export { clamp, // eslint-disable-next-line deprecation/deprecation
5
+ getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit, createPriorityQueue } from './utils/index';
5
6
  export { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';
6
7
  export { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';
7
8
  export { useSelection } from './selection/index';
9
+ export { elementContains, setVirtualParent, getParent } from './virtualParent/index';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export {\n slot,\n isSlot,\n getSlots,\n getSlotsNext,\n assertSlots,\n resolveShorthand,\n isResolvedShorthand,\n getIntrinsicElementProps,\n SLOT_ELEMENT_TYPE_SYMBOL,\n SLOT_RENDER_FUNCTION_SYMBOL,\n} from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n ResolveShorthandFunction,\n ResolveShorthandOptions,\n Slot,\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n UnknownSlotProps,\n SlotComponentType,\n SlotOptions,\n InferredElementRefType,\n} from './compose/index';\n\nexport {\n IdPrefixProvider,\n resetIdsForTests,\n useAnimationFrame,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useScrollbarWidth,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n getNativeElementProps,\n getPartitionedNativeProps,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n omit,\n createPriorityQueue,\n} from './utils/index';\n\nexport type { PriorityQueue } from './utils/priorityQueue';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n\n/**\n * Event utils\n */\nexport type { NativeTouchOrMouseEvent, ReactTouchOrMouseEvent, TouchOrMouseEvent } from './events/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n\nexport type {\n SelectionMode,\n OnSelectionChangeCallback,\n OnSelectionChangeData,\n SelectionItemId,\n SelectionHookParams,\n SelectionMethods,\n} from './selection/index';\nexport { useSelection } from './selection/index';\n"],"names":["slot","isSlot","getSlots","getSlotsNext","assertSlots","resolveShorthand","isResolvedShorthand","getIntrinsicElementProps","SLOT_ELEMENT_TYPE_SYMBOL","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useAnimationFrame","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","createPriorityQueue","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords","useSelection"],"mappings":"AAAA,SACEA,IAAI,EACJC,MAAM,EACNC,QAAQ,EACRC,YAAY,EACZC,WAAW,EACXC,gBAAgB,EAChBC,mBAAmB,EACnBC,wBAAwB,EACxBC,wBAAwB,EACxBC,2BAA2B,QACtB,kBAAkB;AAoBzB,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,oBAAoB,EACpBC,gBAAgB,EAChBC,aAAa,EACbC,cAAc,EACdC,KAAK,EACLC,yBAAyB,EACzBC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,EAClBC,WAAW,EACXC,iBAAiB,EACjBC,UAAU,QACL,gBAAgB;AAGvB,SAASC,SAAS,EAAEC,QAAQ,EAAEC,WAAW,QAAQ,cAAc;AAE/D,SACEC,KAAK,EACLC,qBAAqB,EACrBC,yBAAyB,EACzBC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,wBAAwB,EACxBC,IAAI,EACJC,mBAAmB,QACd,gBAAgB;AAIvB,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,eAAe,QAAQ,kBAAkB;AAQhG,SAASC,YAAY,EAAEC,YAAY,EAAEC,oBAAoB,QAAQ,iBAAiB;AAUlF,SAASC,YAAY,QAAQ,oBAAoB"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export {\n slot,\n isSlot,\n getSlots,\n getSlotsNext,\n assertSlots,\n resolveShorthand,\n isResolvedShorthand,\n getIntrinsicElementProps,\n SLOT_ELEMENT_TYPE_SYMBOL,\n SLOT_RENDER_FUNCTION_SYMBOL,\n} from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n ResolveShorthandFunction,\n ResolveShorthandOptions,\n Slot,\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n UnknownSlotProps,\n SlotComponentType,\n SlotOptions,\n InferredElementRefType,\n} from './compose/index';\n\nexport {\n IdPrefixProvider,\n resetIdsForTests,\n useAnimationFrame,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useScrollbarWidth,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n // eslint-disable-next-line deprecation/deprecation\n getNativeElementProps,\n getPartitionedNativeProps,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n omit,\n createPriorityQueue,\n} from './utils/index';\n\nexport type { PriorityQueue } from './utils/priorityQueue';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n\n/**\n * Event utils\n */\nexport type { NativeTouchOrMouseEvent, ReactTouchOrMouseEvent, TouchOrMouseEvent } from './events/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n\nexport type {\n SelectionMode,\n OnSelectionChangeCallback,\n OnSelectionChangeData,\n SelectionItemId,\n SelectionHookParams,\n SelectionMethods,\n} from './selection/index';\nexport { useSelection } from './selection/index';\n\nexport { elementContains, setVirtualParent, getParent } from './virtualParent/index';\n"],"names":["slot","isSlot","getSlots","getSlotsNext","assertSlots","resolveShorthand","isResolvedShorthand","getIntrinsicElementProps","SLOT_ELEMENT_TYPE_SYMBOL","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useAnimationFrame","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","createPriorityQueue","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords","useSelection","elementContains","setVirtualParent","getParent"],"mappings":"AAAA,SACEA,IAAI,EACJC,MAAM,EACNC,QAAQ,EACRC,YAAY,EACZC,WAAW,EACXC,gBAAgB,EAChBC,mBAAmB,EACnBC,wBAAwB,EACxBC,wBAAwB,EACxBC,2BAA2B,QACtB,kBAAkB;AAoBzB,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,oBAAoB,EACpBC,gBAAgB,EAChBC,aAAa,EACbC,cAAc,EACdC,KAAK,EACLC,yBAAyB,EACzBC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,EAClBC,WAAW,EACXC,iBAAiB,EACjBC,UAAU,QACL,gBAAgB;AAGvB,SAASC,SAAS,EAAEC,QAAQ,EAAEC,WAAW,QAAQ,cAAc;AAE/D,SACEC,KAAK,EACL,mDAAmD;AACnDC,qBAAqB,EACrBC,yBAAyB,EACzBC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,wBAAwB,EACxBC,IAAI,EACJC,mBAAmB,QACd,gBAAgB;AAIvB,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,eAAe,QAAQ,kBAAkB;AAQhG,SAASC,YAAY,EAAEC,YAAY,EAAEC,oBAAoB,QAAQ,iBAAiB;AAUlF,SAASC,YAAY,QAAQ,oBAAoB;AAEjD,SAASC,eAAe,EAAEC,gBAAgB,EAAEC,SAAS,QAAQ,wBAAwB"}
@@ -31,6 +31,8 @@ const nativeElementMap = {
31
31
  * @param tagName - Tag name (e.g. "div")
32
32
  * @param props - Props object
33
33
  * @param excludedPropNames - List of props to disallow
34
+ *
35
+ * @deprecated use getIntrinsicElementProps instead, it is a type-safe version of this method
34
36
  */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
37
  export function getNativeElementProps(tagName, props, excludedPropNames) {
36
38
  const allowedPropNames = tagName && nativeElementMap[tagName] || htmlElementProperties;
@@ -50,6 +52,7 @@ export function getNativeElementProps(tagName, props, excludedPropNames) {
50
52
  style: props.style,
51
53
  className: props.className
52
54
  },
55
+ // eslint-disable-next-line deprecation/deprecation
53
56
  primary: getNativeElementProps(primarySlotTagName, props, [
54
57
  ...excludedPropNames || [],
55
58
  'style',
@@ -1 +1 @@
1
- {"version":3,"sources":["getNativeElementProps.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n labelProperties,\n audioProperties,\n videoProperties,\n olProperties,\n liProperties,\n anchorProperties,\n buttonProperties,\n inputProperties,\n textAreaProperties,\n selectProperties,\n optionProperties,\n tableProperties,\n trProperties,\n thProperties,\n tdProperties,\n colGroupProperties,\n colProperties,\n fieldsetProperties,\n formProperties,\n iframeProperties,\n imgProperties,\n htmlElementProperties,\n getNativeProps,\n timeProperties,\n dialogProperties,\n} from './properties';\n\nconst nativeElementMap: Record<string, Record<string, number>> = {\n label: labelProperties,\n audio: audioProperties,\n video: videoProperties,\n ol: olProperties,\n li: liProperties,\n a: anchorProperties,\n button: buttonProperties,\n input: inputProperties,\n textarea: textAreaProperties,\n select: selectProperties,\n option: optionProperties,\n table: tableProperties,\n tr: trProperties,\n th: thProperties,\n td: tdProperties,\n colGroup: colGroupProperties,\n col: colProperties,\n fieldset: fieldsetProperties,\n form: formProperties,\n iframe: iframeProperties,\n img: imgProperties,\n time: timeProperties,\n dialog: dialogProperties,\n};\n\n/**\n * Given an element tagname and user props, filters the props to only allowed props for the given\n * element type.\n * @param tagName - Tag name (e.g. \"div\")\n * @param props - Props object\n * @param excludedPropNames - List of props to disallow\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getNativeElementProps<TAttributes extends React.HTMLAttributes<any>>(\n tagName: string,\n props: {},\n excludedPropNames?: string[],\n): TAttributes {\n const allowedPropNames = (tagName && nativeElementMap[tagName]) || htmlElementProperties;\n allowedPropNames.as = 1;\n\n return getNativeProps(props, allowedPropNames, excludedPropNames);\n}\n\n/**\n * Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.\n *\n * This function is only for use with components that have a primary slot other than `root`.\n * Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.\n *\n * @returns An object containing the native props for the `root` and primary slots.\n */\nexport const getPartitionedNativeProps = <\n Props extends Pick<React.HTMLAttributes<HTMLElement>, 'style' | 'className'>,\n ExcludedPropKeys extends Extract<keyof Props, string> = never,\n>({\n primarySlotTagName,\n props,\n excludedPropNames,\n}: {\n /** The primary slot's element type (e.g. 'div') */\n primarySlotTagName: keyof JSX.IntrinsicElements;\n\n /** The component's props object */\n props: Props;\n\n /** List of native props to exclude from the returned value */\n excludedPropNames?: ExcludedPropKeys[];\n}) => {\n return {\n root: { style: props.style, className: props.className },\n primary: getNativeElementProps<Omit<Props, ExcludedPropKeys>>(primarySlotTagName, props, [\n ...(excludedPropNames || []),\n 'style',\n 'className',\n ]),\n };\n};\n"],"names":["React","labelProperties","audioProperties","videoProperties","olProperties","liProperties","anchorProperties","buttonProperties","inputProperties","textAreaProperties","selectProperties","optionProperties","tableProperties","trProperties","thProperties","tdProperties","colGroupProperties","colProperties","fieldsetProperties","formProperties","iframeProperties","imgProperties","htmlElementProperties","getNativeProps","timeProperties","dialogProperties","nativeElementMap","label","audio","video","ol","li","a","button","input","textarea","select","option","table","tr","th","td","colGroup","col","fieldset","form","iframe","img","time","dialog","getNativeElementProps","tagName","props","excludedPropNames","allowedPropNames","as","getPartitionedNativeProps","primarySlotTagName","root","style","className","primary"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,eAAe,EACfC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,YAAY,EACZC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,EACfC,kBAAkB,EAClBC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,EACfC,YAAY,EACZC,YAAY,EACZC,YAAY,EACZC,kBAAkB,EAClBC,aAAa,EACbC,kBAAkB,EAClBC,cAAc,EACdC,gBAAgB,EAChBC,aAAa,EACbC,qBAAqB,EACrBC,cAAc,EACdC,cAAc,EACdC,gBAAgB,QACX,eAAe;AAEtB,MAAMC,mBAA2D;IAC/DC,OAAO1B;IACP2B,OAAO1B;IACP2B,OAAO1B;IACP2B,IAAI1B;IACJ2B,IAAI1B;IACJ2B,GAAG1B;IACH2B,QAAQ1B;IACR2B,OAAO1B;IACP2B,UAAU1B;IACV2B,QAAQ1B;IACR2B,QAAQ1B;IACR2B,OAAO1B;IACP2B,IAAI1B;IACJ2B,IAAI1B;IACJ2B,IAAI1B;IACJ2B,UAAU1B;IACV2B,KAAK1B;IACL2B,UAAU1B;IACV2B,MAAM1B;IACN2B,QAAQ1B;IACR2B,KAAK1B;IACL2B,MAAMxB;IACNyB,QAAQxB;AACV;AAEA;;;;;;CAMC,GACD,8DAA8D;AAC9D,OAAO,SAASyB,sBACdC,OAAe,EACfC,KAAS,EACTC,iBAA4B;IAE5B,MAAMC,mBAAmB,AAACH,WAAWzB,gBAAgB,CAACyB,QAAQ,IAAK7B;IACnEgC,iBAAiBC,EAAE,GAAG;IAEtB,OAAOhC,eAAe6B,OAAOE,kBAAkBD;AACjD;AAEA;;;;;;;CAOC,GACD,OAAO,MAAMG,4BAA4B,CAGvC,EACAC,kBAAkB,EAClBL,KAAK,EACLC,iBAAiB,EAUlB;IACC,OAAO;QACLK,MAAM;YAAEC,OAAOP,MAAMO,KAAK;YAAEC,WAAWR,MAAMQ,SAAS;QAAC;QACvDC,SAASX,sBAAqDO,oBAAoBL,OAAO;eACnFC,qBAAqB,EAAE;YAC3B;YACA;SACD;IACH;AACF,EAAE"}
1
+ {"version":3,"sources":["getNativeElementProps.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n labelProperties,\n audioProperties,\n videoProperties,\n olProperties,\n liProperties,\n anchorProperties,\n buttonProperties,\n inputProperties,\n textAreaProperties,\n selectProperties,\n optionProperties,\n tableProperties,\n trProperties,\n thProperties,\n tdProperties,\n colGroupProperties,\n colProperties,\n fieldsetProperties,\n formProperties,\n iframeProperties,\n imgProperties,\n htmlElementProperties,\n getNativeProps,\n timeProperties,\n dialogProperties,\n} from './properties';\n\nconst nativeElementMap: Record<string, Record<string, number>> = {\n label: labelProperties,\n audio: audioProperties,\n video: videoProperties,\n ol: olProperties,\n li: liProperties,\n a: anchorProperties,\n button: buttonProperties,\n input: inputProperties,\n textarea: textAreaProperties,\n select: selectProperties,\n option: optionProperties,\n table: tableProperties,\n tr: trProperties,\n th: thProperties,\n td: tdProperties,\n colGroup: colGroupProperties,\n col: colProperties,\n fieldset: fieldsetProperties,\n form: formProperties,\n iframe: iframeProperties,\n img: imgProperties,\n time: timeProperties,\n dialog: dialogProperties,\n};\n\n/**\n * Given an element tagname and user props, filters the props to only allowed props for the given\n * element type.\n * @param tagName - Tag name (e.g. \"div\")\n * @param props - Props object\n * @param excludedPropNames - List of props to disallow\n *\n * @deprecated use getIntrinsicElementProps instead, it is a type-safe version of this method\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getNativeElementProps<TAttributes extends React.HTMLAttributes<any>>(\n tagName: string,\n props: {},\n excludedPropNames?: string[],\n): TAttributes {\n const allowedPropNames = (tagName && nativeElementMap[tagName]) || htmlElementProperties;\n allowedPropNames.as = 1;\n\n return getNativeProps(props, allowedPropNames, excludedPropNames);\n}\n\n/**\n * Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.\n *\n * This function is only for use with components that have a primary slot other than `root`.\n * Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.\n *\n * @returns An object containing the native props for the `root` and primary slots.\n */\nexport const getPartitionedNativeProps = <\n Props extends Pick<React.HTMLAttributes<HTMLElement>, 'style' | 'className'>,\n ExcludedPropKeys extends Extract<keyof Props, string> = never,\n>({\n primarySlotTagName,\n props,\n excludedPropNames,\n}: {\n /** The primary slot's element type (e.g. 'div') */\n primarySlotTagName: keyof JSX.IntrinsicElements;\n\n /** The component's props object */\n props: Props;\n\n /** List of native props to exclude from the returned value */\n excludedPropNames?: ExcludedPropKeys[];\n}) => {\n return {\n root: { style: props.style, className: props.className },\n // eslint-disable-next-line deprecation/deprecation\n primary: getNativeElementProps<Omit<Props, ExcludedPropKeys>>(primarySlotTagName, props, [\n ...(excludedPropNames || []),\n 'style',\n 'className',\n ]),\n };\n};\n"],"names":["React","labelProperties","audioProperties","videoProperties","olProperties","liProperties","anchorProperties","buttonProperties","inputProperties","textAreaProperties","selectProperties","optionProperties","tableProperties","trProperties","thProperties","tdProperties","colGroupProperties","colProperties","fieldsetProperties","formProperties","iframeProperties","imgProperties","htmlElementProperties","getNativeProps","timeProperties","dialogProperties","nativeElementMap","label","audio","video","ol","li","a","button","input","textarea","select","option","table","tr","th","td","colGroup","col","fieldset","form","iframe","img","time","dialog","getNativeElementProps","tagName","props","excludedPropNames","allowedPropNames","as","getPartitionedNativeProps","primarySlotTagName","root","style","className","primary"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,eAAe,EACfC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,YAAY,EACZC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,EACfC,kBAAkB,EAClBC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,EACfC,YAAY,EACZC,YAAY,EACZC,YAAY,EACZC,kBAAkB,EAClBC,aAAa,EACbC,kBAAkB,EAClBC,cAAc,EACdC,gBAAgB,EAChBC,aAAa,EACbC,qBAAqB,EACrBC,cAAc,EACdC,cAAc,EACdC,gBAAgB,QACX,eAAe;AAEtB,MAAMC,mBAA2D;IAC/DC,OAAO1B;IACP2B,OAAO1B;IACP2B,OAAO1B;IACP2B,IAAI1B;IACJ2B,IAAI1B;IACJ2B,GAAG1B;IACH2B,QAAQ1B;IACR2B,OAAO1B;IACP2B,UAAU1B;IACV2B,QAAQ1B;IACR2B,QAAQ1B;IACR2B,OAAO1B;IACP2B,IAAI1B;IACJ2B,IAAI1B;IACJ2B,IAAI1B;IACJ2B,UAAU1B;IACV2B,KAAK1B;IACL2B,UAAU1B;IACV2B,MAAM1B;IACN2B,QAAQ1B;IACR2B,KAAK1B;IACL2B,MAAMxB;IACNyB,QAAQxB;AACV;AAEA;;;;;;;;CAQC,GACD,8DAA8D;AAC9D,OAAO,SAASyB,sBACdC,OAAe,EACfC,KAAS,EACTC,iBAA4B;IAE5B,MAAMC,mBAAmB,AAACH,WAAWzB,gBAAgB,CAACyB,QAAQ,IAAK7B;IACnEgC,iBAAiBC,EAAE,GAAG;IAEtB,OAAOhC,eAAe6B,OAAOE,kBAAkBD;AACjD;AAEA;;;;;;;CAOC,GACD,OAAO,MAAMG,4BAA4B,CAGvC,EACAC,kBAAkB,EAClBL,KAAK,EACLC,iBAAiB,EAUlB;IACC,OAAO;QACLK,MAAM;YAAEC,OAAOP,MAAMO,KAAK;YAAEC,WAAWR,MAAMQ,SAAS;QAAC;QACvD,mDAAmD;QACnDC,SAASX,sBAAqDO,oBAAoBL,OAAO;eACnFC,qBAAqB,EAAE;YAC3B;YACA;SACD;IACH;AACF,EAAE"}
@@ -0,0 +1,29 @@
1
+ import { getParent } from './getParent';
2
+ /**
3
+ * Similar functionality to `element.contains` DOM API for use without of order DOM elements that
4
+ * checks the virtual parent hierarchy. If a virtual parents exists, it is chosen over the actual parent
5
+ *
6
+ * @internal
7
+ * @returns true if the child can find the parent in its virtual hierarchy
8
+ */ export function elementContains(parent, child) {
9
+ if (!parent || !child) {
10
+ return false;
11
+ }
12
+ if (parent === child) {
13
+ return true;
14
+ } else {
15
+ // Tracks references of nodes that have been visited to prevent infinite loops
16
+ const set = new WeakSet();
17
+ while(child){
18
+ const nextParent = getParent(child, {
19
+ skipVirtual: set.has(child)
20
+ });
21
+ set.add(child);
22
+ if (nextParent === parent) {
23
+ return true;
24
+ }
25
+ child = nextParent;
26
+ }
27
+ }
28
+ return false;
29
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["elementContains.ts"],"sourcesContent":["import { getParent } from './getParent';\n\n/**\n * Similar functionality to `element.contains` DOM API for use without of order DOM elements that\n * checks the virtual parent hierarchy. If a virtual parents exists, it is chosen over the actual parent\n *\n * @internal\n * @returns true if the child can find the parent in its virtual hierarchy\n */\nexport function elementContains(parent: Node | null, child: Node | null): boolean {\n if (!parent || !child) {\n return false;\n }\n\n if (parent === child) {\n return true;\n } else {\n // Tracks references of nodes that have been visited to prevent infinite loops\n const set = new WeakSet<Node>();\n\n while (child) {\n const nextParent: Node | null = getParent(child, {\n skipVirtual: set.has(child),\n });\n set.add(child);\n\n if (nextParent === parent) {\n return true;\n }\n\n child = nextParent;\n }\n }\n\n return false;\n}\n"],"names":["getParent","elementContains","parent","child","set","WeakSet","nextParent","skipVirtual","has","add"],"mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;AAExC;;;;;;CAMC,GACD,OAAO,SAASC,gBAAgBC,MAAmB,EAAEC,KAAkB;IACrE,IAAI,CAACD,UAAU,CAACC,OAAO;QACrB,OAAO;IACT;IAEA,IAAID,WAAWC,OAAO;QACpB,OAAO;IACT,OAAO;QACL,8EAA8E;QAC9E,MAAMC,MAAM,IAAIC;QAEhB,MAAOF,MAAO;YACZ,MAAMG,aAA0BN,UAAUG,OAAO;gBAC/CI,aAAaH,IAAII,GAAG,CAACL;YACvB;YACAC,IAAIK,GAAG,CAACN;YAER,IAAIG,eAAeJ,QAAQ;gBACzB,OAAO;YACT;YAEAC,QAAQG;QACV;IACF;IAEA,OAAO;AACT"}
@@ -0,0 +1,23 @@
1
+ import { isVirtualElement } from './isVirtualElement';
2
+ /**
3
+ * Gets the virtual parent given the child element, if it exists.
4
+ * @internal
5
+ */ function getVirtualParent(child) {
6
+ return isVirtualElement(child) ? child._virtual.parent || null : null;
7
+ }
8
+ /**
9
+ * Gets the element which is the parent of a given element.
10
+ * This method prefers the virtual parent over real DOM parent when present.
11
+ * @internal
12
+ */ export function getParent(child, options = {}) {
13
+ if (!child) {
14
+ return null;
15
+ }
16
+ if (!options.skipVirtual) {
17
+ const virtualParent = getVirtualParent(child);
18
+ if (virtualParent) {
19
+ return virtualParent;
20
+ }
21
+ }
22
+ return (child === null || child === void 0 ? void 0 : child.parentNode) || null;
23
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["getParent.ts"],"sourcesContent":["import { isVirtualElement } from './isVirtualElement';\n\ntype GetParentOptions = {\n /**\n * Indicates if getParent() should ignore a virtual parent.\n * @internal\n */\n skipVirtual?: boolean;\n};\n\n/**\n * Gets the virtual parent given the child element, if it exists.\n * @internal\n */\nfunction getVirtualParent(child: Node): Node | null {\n return isVirtualElement(child) ? child._virtual.parent || null : null;\n}\n\n/**\n * Gets the element which is the parent of a given element.\n * This method prefers the virtual parent over real DOM parent when present.\n * @internal\n */\nexport function getParent(child: Node | null, options: GetParentOptions = {}): Node | null {\n if (!child) {\n return null;\n }\n\n if (!options.skipVirtual) {\n const virtualParent = getVirtualParent(child);\n\n if (virtualParent) {\n return virtualParent;\n }\n }\n\n return child?.parentNode || null;\n}\n"],"names":["isVirtualElement","getVirtualParent","child","_virtual","parent","getParent","options","skipVirtual","virtualParent","parentNode"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,qBAAqB;AAUtD;;;CAGC,GACD,SAASC,iBAAiBC,KAAW;IACnC,OAAOF,iBAAiBE,SAASA,MAAMC,QAAQ,CAACC,MAAM,IAAI,OAAO;AACnE;AAEA;;;;CAIC,GACD,OAAO,SAASC,UAAUH,KAAkB,EAAEI,UAA4B,CAAC,CAAC;IAC1E,IAAI,CAACJ,OAAO;QACV,OAAO;IACT;IAEA,IAAI,CAACI,QAAQC,WAAW,EAAE;QACxB,MAAMC,gBAAgBP,iBAAiBC;QAEvC,IAAIM,eAAe;YACjB,OAAOA;QACT;IACF;IAEA,OAAON,CAAAA,kBAAAA,4BAAAA,MAAOO,UAAU,KAAI;AAC9B"}
@@ -0,0 +1,3 @@
1
+ export * from './elementContains';
2
+ export * from './setVirtualParent';
3
+ export * from './getParent';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './elementContains';\nexport * from './setVirtualParent';\nexport * from './getParent';\n"],"names":[],"mappings":"AAAA,cAAc,oBAAoB;AAClC,cAAc,qBAAqB;AACnC,cAAc,cAAc"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Determines whether or not an element has the virtual hierarchy extension.
3
+ * @internal
4
+ */ export function isVirtualElement(element) {
5
+ return element && !!element._virtual;
6
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["isVirtualElement.ts"],"sourcesContent":["import type { VirtualElement } from './types';\n\n/**\n * Determines whether or not an element has the virtual hierarchy extension.\n * @internal\n */\nexport function isVirtualElement(element: Node | VirtualElement): element is VirtualElement {\n return element && !!(<VirtualElement>element)._virtual;\n}\n"],"names":["isVirtualElement","element","_virtual"],"mappings":"AAEA;;;CAGC,GACD,OAAO,SAASA,iBAAiBC,OAA8B;IAC7D,OAAOA,WAAW,CAAC,CAAC,AAAiBA,QAASC,QAAQ;AACxD"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Sets the virtual parent of an element.
3
+ *
4
+ * @internal
5
+ * @param child - Theme element to set the virtual parent
6
+ * @param parent - The virtual parent, use `undefined` to remove a virtual parent relationship
7
+ */ export function setVirtualParent(child, parent) {
8
+ if (!child) {
9
+ return;
10
+ }
11
+ const virtualChild = child;
12
+ if (!virtualChild._virtual) {
13
+ virtualChild._virtual = {};
14
+ }
15
+ virtualChild._virtual.parent = parent;
16
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["setVirtualParent.ts"],"sourcesContent":["import type { VirtualElement } from './types';\n\n/**\n * Sets the virtual parent of an element.\n *\n * @internal\n * @param child - Theme element to set the virtual parent\n * @param parent - The virtual parent, use `undefined` to remove a virtual parent relationship\n */\nexport function setVirtualParent(child: Node, parent?: Node): void {\n if (!child) {\n return;\n }\n\n const virtualChild = child as VirtualElement;\n\n if (!virtualChild._virtual) {\n virtualChild._virtual = {};\n }\n\n virtualChild._virtual.parent = parent;\n}\n"],"names":["setVirtualParent","child","parent","virtualChild","_virtual"],"mappings":"AAEA;;;;;;CAMC,GACD,OAAO,SAASA,iBAAiBC,KAAW,EAAEC,MAAa;IACzD,IAAI,CAACD,OAAO;QACV;IACF;IAEA,MAAME,eAAeF;IAErB,IAAI,CAACE,aAAaC,QAAQ,EAAE;QAC1BD,aAAaC,QAAQ,GAAG,CAAC;IAC3B;IAEAD,aAAaC,QAAQ,CAACF,MAAM,GAAGA;AACjC"}
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["types.ts"],"sourcesContent":["export interface VirtualElement extends Node {\n _virtual: {\n parent?: Node;\n };\n}\n"],"names":[],"mappings":"AAAA,WAIC"}
@@ -13,5 +13,6 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
13
  const _getNativeElementProps = require("../utils/getNativeElementProps");
14
14
  const getIntrinsicElementProps = (/** The slot's default element type (e.g. 'div') */ tagName, /** The component's props object */ props, /** List of native props to exclude from the returned value */ excludedPropNames)=>{
15
15
  var _props_as;
16
+ // eslint-disable-next-line deprecation/deprecation
16
17
  return (0, _getNativeElementProps.getNativeElementProps)((_props_as = props.as) !== null && _props_as !== void 0 ? _props_as : tagName, props, excludedPropNames);
17
18
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["getIntrinsicElementProps.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '../utils/getNativeElementProps';\n/**\n * Given an element tagname and user props, filters the props to only allowed props for the given\n * element type.\n *\n * Equivalent to {@link getNativeElementProps}, but more type-safe.\n */ export const getIntrinsicElementProps = (/** The slot's default element type (e.g. 'div') */ tagName, /** The component's props object */ props, /** List of native props to exclude from the returned value */ excludedPropNames)=>{\n var _props_as;\n return getNativeElementProps((_props_as = props.as) !== null && _props_as !== void 0 ? _props_as : tagName, props, excludedPropNames);\n};\n"],"names":["getIntrinsicElementProps","tagName","props","excludedPropNames","_props_as","getNativeElementProps","as"],"mappings":";;;;+BAOiBA;;;eAAAA;;;;iEAPM;uCACe;AAM3B,MAAMA,2BAA2B,CAAC,iDAAiD,GAAGC,SAAS,iCAAiC,GAAGC,OAAO,4DAA4D,GAAGC;IAChN,IAAIC;IACJ,OAAOC,IAAAA,4CAAqB,EAAC,AAACD,CAAAA,YAAYF,MAAMI,EAAE,AAAD,MAAO,QAAQF,cAAc,KAAK,IAAIA,YAAYH,SAASC,OAAOC;AACvH"}
1
+ {"version":3,"sources":["getIntrinsicElementProps.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '../utils/getNativeElementProps';\n/**\n * Given an element tagname and user props, filters the props to only allowed props for the given\n * element type.\n *\n * Equivalent to {@link getNativeElementProps}, but more type-safe.\n */ export const getIntrinsicElementProps = (/** The slot's default element type (e.g. 'div') */ tagName, /** The component's props object */ props, /** List of native props to exclude from the returned value */ excludedPropNames)=>{\n var _props_as;\n // eslint-disable-next-line deprecation/deprecation\n return getNativeElementProps((_props_as = props.as) !== null && _props_as !== void 0 ? _props_as : tagName, props, excludedPropNames);\n};\n"],"names":["getIntrinsicElementProps","tagName","props","excludedPropNames","_props_as","getNativeElementProps","as"],"mappings":";;;;+BAOiBA;;;eAAAA;;;;iEAPM;uCACe;AAM3B,MAAMA,2BAA2B,CAAC,iDAAiD,GAAGC,SAAS,iCAAiC,GAAGC,OAAO,4DAA4D,GAAGC;IAChN,IAAIC;IACJ,mDAAmD;IACnD,OAAOC,IAAAA,4CAAqB,EAAC,AAACD,CAAAA,YAAYF,MAAMI,EAAE,AAAD,MAAO,QAAQF,cAAc,KAAK,IAAIA,YAAYH,SAASC,OAAOC;AACvH"}
@@ -140,6 +140,15 @@ _export(exports, {
140
140
  },
141
141
  useSelection: function() {
142
142
  return _index6.useSelection;
143
+ },
144
+ elementContains: function() {
145
+ return _index7.elementContains;
146
+ },
147
+ setVirtualParent: function() {
148
+ return _index7.setVirtualParent;
149
+ },
150
+ getParent: function() {
151
+ return _index7.getParent;
143
152
  }
144
153
  });
145
154
  const _index = require("./compose/index");
@@ -149,3 +158,4 @@ const _index3 = require("./utils/index");
149
158
  const _index4 = require("./trigger/index");
150
159
  const _index5 = require("./events/index");
151
160
  const _index6 = require("./selection/index");
161
+ const _index7 = require("./virtualParent/index");
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export { slot, isSlot, getSlots, getSlotsNext, assertSlots, resolveShorthand, isResolvedShorthand, getIntrinsicElementProps, SLOT_ELEMENT_TYPE_SYMBOL, SLOT_RENDER_FUNCTION_SYMBOL } from './compose/index';\nexport { IdPrefixProvider, resetIdsForTests, useAnimationFrame, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from './hooks/index';\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\nexport { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit, createPriorityQueue } from './utils/index';\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\nexport { useSelection } from './selection/index';\n"],"names":["slot","isSlot","getSlots","getSlotsNext","assertSlots","resolveShorthand","isResolvedShorthand","getIntrinsicElementProps","SLOT_ELEMENT_TYPE_SYMBOL","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useAnimationFrame","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","createPriorityQueue","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords","useSelection"],"mappings":";;;;;;;;;;;IAASA,IAAI;eAAJA,WAAI;;IAAEC,MAAM;eAANA,aAAM;;IAAEC,QAAQ;eAARA,eAAQ;;IAAEC,YAAY;eAAZA,mBAAY;;IAAEC,WAAW;eAAXA,kBAAW;;IAAEC,gBAAgB;eAAhBA,uBAAgB;;IAAEC,mBAAmB;eAAnBA,0BAAmB;;IAAEC,wBAAwB;eAAxBA,+BAAwB;;IAAEC,wBAAwB;eAAxBA,+BAAwB;;IAAEC,2BAA2B;eAA3BA,kCAA2B;;IACzKC,gBAAgB;eAAhBA,wBAAgB;;IAAEC,gBAAgB;eAAhBA,wBAAgB;;IAAEC,iBAAiB;eAAjBA,yBAAiB;;IAAEC,oBAAoB;eAApBA,4BAAoB;;IAAEC,gBAAgB;eAAhBA,wBAAgB;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,cAAc;eAAdA,sBAAc;;IAAEC,KAAK;eAALA,aAAK;;IAAEC,yBAAyB;eAAzBA,iCAAyB;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,iBAAiB;eAAjBA,yBAAiB;;IAAEC,kBAAkB;eAAlBA,0BAAkB;;IAAEC,WAAW;eAAXA,mBAAW;;IAAEC,iBAAiB;eAAjBA,yBAAiB;;IAAEC,UAAU;eAAVA,kBAAU;;IAChQC,SAAS;eAATA,iBAAS;;IAAEC,QAAQ;eAARA,gBAAQ;;IAAEC,WAAW;eAAXA,mBAAW;;IAChCC,KAAK;eAALA,aAAK;;IAAEC,qBAAqB;eAArBA,6BAAqB;;IAAEC,yBAAyB;eAAzBA,iCAAyB;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,cAAc;eAAdA,sBAAc;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,wBAAwB;eAAxBA,gCAAwB;;IAAEC,IAAI;eAAJA,YAAI;;IAAEC,mBAAmB;eAAnBA,2BAAmB;;IAC1JC,2BAA2B;eAA3BA,mCAA2B;;IAAEC,eAAe;eAAfA,uBAAe;;IAAEC,eAAe;eAAfA,uBAAe;;IAC7DC,YAAY;eAAZA,oBAAY;;IAAEC,YAAY;eAAZA,oBAAY;;IAAEC,oBAAoB;eAApBA,4BAAoB;;IAChDC,YAAY;eAAZA,oBAAY;;;uBANqK;wBACuF;wBAChO;wBAC0H;wBAC7F;wBACb;wBACpC"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export { slot, isSlot, getSlots, getSlotsNext, assertSlots, resolveShorthand, isResolvedShorthand, getIntrinsicElementProps, SLOT_ELEMENT_TYPE_SYMBOL, SLOT_RENDER_FUNCTION_SYMBOL } from './compose/index';\nexport { IdPrefixProvider, resetIdsForTests, useAnimationFrame, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from './hooks/index';\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\nexport { clamp, // eslint-disable-next-line deprecation/deprecation\ngetNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit, createPriorityQueue } from './utils/index';\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\nexport { useSelection } from './selection/index';\nexport { elementContains, setVirtualParent, getParent } from './virtualParent/index';\n"],"names":["slot","isSlot","getSlots","getSlotsNext","assertSlots","resolveShorthand","isResolvedShorthand","getIntrinsicElementProps","SLOT_ELEMENT_TYPE_SYMBOL","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useAnimationFrame","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","createPriorityQueue","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords","useSelection","elementContains","setVirtualParent","getParent"],"mappings":";;;;;;;;;;;IAASA,IAAI;eAAJA,WAAI;;IAAEC,MAAM;eAANA,aAAM;;IAAEC,QAAQ;eAARA,eAAQ;;IAAEC,YAAY;eAAZA,mBAAY;;IAAEC,WAAW;eAAXA,kBAAW;;IAAEC,gBAAgB;eAAhBA,uBAAgB;;IAAEC,mBAAmB;eAAnBA,0BAAmB;;IAAEC,wBAAwB;eAAxBA,+BAAwB;;IAAEC,wBAAwB;eAAxBA,+BAAwB;;IAAEC,2BAA2B;eAA3BA,kCAA2B;;IACzKC,gBAAgB;eAAhBA,wBAAgB;;IAAEC,gBAAgB;eAAhBA,wBAAgB;;IAAEC,iBAAiB;eAAjBA,yBAAiB;;IAAEC,oBAAoB;eAApBA,4BAAoB;;IAAEC,gBAAgB;eAAhBA,wBAAgB;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,cAAc;eAAdA,sBAAc;;IAAEC,KAAK;eAALA,aAAK;;IAAEC,yBAAyB;eAAzBA,iCAAyB;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,iBAAiB;eAAjBA,yBAAiB;;IAAEC,kBAAkB;eAAlBA,0BAAkB;;IAAEC,WAAW;eAAXA,mBAAW;;IAAEC,iBAAiB;eAAjBA,yBAAiB;;IAAEC,UAAU;eAAVA,kBAAU;;IAChQC,SAAS;eAATA,iBAAS;;IAAEC,QAAQ;eAARA,gBAAQ;;IAAEC,WAAW;eAAXA,mBAAW;;IAChCC,KAAK;eAALA,aAAK;;IACdC,qBAAqB;eAArBA,6BAAqB;;IAAEC,yBAAyB;eAAzBA,iCAAyB;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,cAAc;eAAdA,sBAAc;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,wBAAwB;eAAxBA,gCAAwB;;IAAEC,IAAI;eAAJA,YAAI;;IAAEC,mBAAmB;eAAnBA,2BAAmB;;IAC1IC,2BAA2B;eAA3BA,mCAA2B;;IAAEC,eAAe;eAAfA,uBAAe;;IAAEC,eAAe;eAAfA,uBAAe;;IAC7DC,YAAY;eAAZA,oBAAY;;IAAEC,YAAY;eAAZA,oBAAY;;IAAEC,oBAAoB;eAApBA,4BAAoB;;IAChDC,YAAY;eAAZA,oBAAY;;IACZC,eAAe;eAAfA,uBAAe;;IAAEC,gBAAgB;eAAhBA,wBAAgB;;IAAEC,SAAS;eAATA,iBAAS;;;uBARqI;wBACuF;wBAChO;wBAE0G;wBAC7E;wBACb;wBACpC;wBACgC"}
@@ -55,6 +55,7 @@ const getPartitionedNativeProps = ({ primarySlotTagName, props, excludedPropName
55
55
  style: props.style,
56
56
  className: props.className
57
57
  },
58
+ // eslint-disable-next-line deprecation/deprecation
58
59
  primary: getNativeElementProps(primarySlotTagName, props, [
59
60
  ...excludedPropNames || [],
60
61
  'style',
@@ -1 +1 @@
1
- {"version":3,"sources":["getNativeElementProps.js"],"sourcesContent":["import * as React from 'react';\nimport { labelProperties, audioProperties, videoProperties, olProperties, liProperties, anchorProperties, buttonProperties, inputProperties, textAreaProperties, selectProperties, optionProperties, tableProperties, trProperties, thProperties, tdProperties, colGroupProperties, colProperties, fieldsetProperties, formProperties, iframeProperties, imgProperties, htmlElementProperties, getNativeProps, timeProperties, dialogProperties } from './properties';\nconst nativeElementMap = {\n label: labelProperties,\n audio: audioProperties,\n video: videoProperties,\n ol: olProperties,\n li: liProperties,\n a: anchorProperties,\n button: buttonProperties,\n input: inputProperties,\n textarea: textAreaProperties,\n select: selectProperties,\n option: optionProperties,\n table: tableProperties,\n tr: trProperties,\n th: thProperties,\n td: tdProperties,\n colGroup: colGroupProperties,\n col: colProperties,\n fieldset: fieldsetProperties,\n form: formProperties,\n iframe: iframeProperties,\n img: imgProperties,\n time: timeProperties,\n dialog: dialogProperties\n};\n/**\n * Given an element tagname and user props, filters the props to only allowed props for the given\n * element type.\n * @param tagName - Tag name (e.g. \"div\")\n * @param props - Props object\n * @param excludedPropNames - List of props to disallow\n */ // eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getNativeElementProps(tagName, props, excludedPropNames) {\n const allowedPropNames = tagName && nativeElementMap[tagName] || htmlElementProperties;\n allowedPropNames.as = 1;\n return getNativeProps(props, allowedPropNames, excludedPropNames);\n}\n/**\n * Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.\n *\n * This function is only for use with components that have a primary slot other than `root`.\n * Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.\n *\n * @returns An object containing the native props for the `root` and primary slots.\n */ export const getPartitionedNativeProps = ({ primarySlotTagName, props, excludedPropNames })=>{\n return {\n root: {\n style: props.style,\n className: props.className\n },\n primary: getNativeElementProps(primarySlotTagName, props, [\n ...excludedPropNames || [],\n 'style',\n 'className'\n ])\n };\n};\n"],"names":["getNativeElementProps","getPartitionedNativeProps","nativeElementMap","label","labelProperties","audio","audioProperties","video","videoProperties","ol","olProperties","li","liProperties","a","anchorProperties","button","buttonProperties","input","inputProperties","textarea","textAreaProperties","select","selectProperties","option","optionProperties","table","tableProperties","tr","trProperties","th","thProperties","td","tdProperties","colGroup","colGroupProperties","col","colProperties","fieldset","fieldsetProperties","form","formProperties","iframe","iframeProperties","img","imgProperties","time","timeProperties","dialog","dialogProperties","tagName","props","excludedPropNames","allowedPropNames","htmlElementProperties","as","getNativeProps","primarySlotTagName","root","style","className","primary"],"mappings":";;;;;;;;;;;IAkCgBA,qBAAqB;eAArBA;;IAYCC,yBAAyB;eAAzBA;;;;iEA9CM;4BACga;AACvb,MAAMC,mBAAmB;IACrBC,OAAOC,2BAAe;IACtBC,OAAOC,2BAAe;IACtBC,OAAOC,2BAAe;IACtBC,IAAIC,wBAAY;IAChBC,IAAIC,wBAAY;IAChBC,GAAGC,4BAAgB;IACnBC,QAAQC,4BAAgB;IACxBC,OAAOC,2BAAe;IACtBC,UAAUC,8BAAkB;IAC5BC,QAAQC,4BAAgB;IACxBC,QAAQC,4BAAgB;IACxBC,OAAOC,2BAAe;IACtBC,IAAIC,wBAAY;IAChBC,IAAIC,wBAAY;IAChBC,IAAIC,wBAAY;IAChBC,UAAUC,8BAAkB;IAC5BC,KAAKC,yBAAa;IAClBC,UAAUC,8BAAkB;IAC5BC,MAAMC,0BAAc;IACpBC,QAAQC,4BAAgB;IACxBC,KAAKC,yBAAa;IAClBC,MAAMC,0BAAc;IACpBC,QAAQC,4BAAgB;AAC5B;AAQO,SAAShD,sBAAsBiD,OAAO,EAAEC,KAAK,EAAEC,iBAAiB;IACnE,MAAMC,mBAAmBH,WAAW/C,gBAAgB,CAAC+C,QAAQ,IAAII,iCAAqB;IACtFD,iBAAiBE,EAAE,GAAG;IACtB,OAAOC,IAAAA,0BAAc,EAACL,OAAOE,kBAAkBD;AACnD;AAQW,MAAMlD,4BAA4B,CAAC,EAAEuD,kBAAkB,EAAEN,KAAK,EAAEC,iBAAiB,EAAE;IAC1F,OAAO;QACHM,MAAM;YACFC,OAAOR,MAAMQ,KAAK;YAClBC,WAAWT,MAAMS,SAAS;QAC9B;QACAC,SAAS5D,sBAAsBwD,oBAAoBN,OAAO;eACnDC,qBAAqB,EAAE;YAC1B;YACA;SACH;IACL;AACJ"}
1
+ {"version":3,"sources":["getNativeElementProps.js"],"sourcesContent":["import * as React from 'react';\nimport { labelProperties, audioProperties, videoProperties, olProperties, liProperties, anchorProperties, buttonProperties, inputProperties, textAreaProperties, selectProperties, optionProperties, tableProperties, trProperties, thProperties, tdProperties, colGroupProperties, colProperties, fieldsetProperties, formProperties, iframeProperties, imgProperties, htmlElementProperties, getNativeProps, timeProperties, dialogProperties } from './properties';\nconst nativeElementMap = {\n label: labelProperties,\n audio: audioProperties,\n video: videoProperties,\n ol: olProperties,\n li: liProperties,\n a: anchorProperties,\n button: buttonProperties,\n input: inputProperties,\n textarea: textAreaProperties,\n select: selectProperties,\n option: optionProperties,\n table: tableProperties,\n tr: trProperties,\n th: thProperties,\n td: tdProperties,\n colGroup: colGroupProperties,\n col: colProperties,\n fieldset: fieldsetProperties,\n form: formProperties,\n iframe: iframeProperties,\n img: imgProperties,\n time: timeProperties,\n dialog: dialogProperties\n};\n/**\n * Given an element tagname and user props, filters the props to only allowed props for the given\n * element type.\n * @param tagName - Tag name (e.g. \"div\")\n * @param props - Props object\n * @param excludedPropNames - List of props to disallow\n *\n * @deprecated use getIntrinsicElementProps instead, it is a type-safe version of this method\n */ // eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getNativeElementProps(tagName, props, excludedPropNames) {\n const allowedPropNames = tagName && nativeElementMap[tagName] || htmlElementProperties;\n allowedPropNames.as = 1;\n return getNativeProps(props, allowedPropNames, excludedPropNames);\n}\n/**\n * Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.\n *\n * This function is only for use with components that have a primary slot other than `root`.\n * Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.\n *\n * @returns An object containing the native props for the `root` and primary slots.\n */ export const getPartitionedNativeProps = ({ primarySlotTagName, props, excludedPropNames })=>{\n return {\n root: {\n style: props.style,\n className: props.className\n },\n // eslint-disable-next-line deprecation/deprecation\n primary: getNativeElementProps(primarySlotTagName, props, [\n ...excludedPropNames || [],\n 'style',\n 'className'\n ])\n };\n};\n"],"names":["getNativeElementProps","getPartitionedNativeProps","nativeElementMap","label","labelProperties","audio","audioProperties","video","videoProperties","ol","olProperties","li","liProperties","a","anchorProperties","button","buttonProperties","input","inputProperties","textarea","textAreaProperties","select","selectProperties","option","optionProperties","table","tableProperties","tr","trProperties","th","thProperties","td","tdProperties","colGroup","colGroupProperties","col","colProperties","fieldset","fieldsetProperties","form","formProperties","iframe","iframeProperties","img","imgProperties","time","timeProperties","dialog","dialogProperties","tagName","props","excludedPropNames","allowedPropNames","htmlElementProperties","as","getNativeProps","primarySlotTagName","root","style","className","primary"],"mappings":";;;;;;;;;;;IAoCgBA,qBAAqB;eAArBA;;IAYCC,yBAAyB;eAAzBA;;;;iEAhDM;4BACga;AACvb,MAAMC,mBAAmB;IACrBC,OAAOC,2BAAe;IACtBC,OAAOC,2BAAe;IACtBC,OAAOC,2BAAe;IACtBC,IAAIC,wBAAY;IAChBC,IAAIC,wBAAY;IAChBC,GAAGC,4BAAgB;IACnBC,QAAQC,4BAAgB;IACxBC,OAAOC,2BAAe;IACtBC,UAAUC,8BAAkB;IAC5BC,QAAQC,4BAAgB;IACxBC,QAAQC,4BAAgB;IACxBC,OAAOC,2BAAe;IACtBC,IAAIC,wBAAY;IAChBC,IAAIC,wBAAY;IAChBC,IAAIC,wBAAY;IAChBC,UAAUC,8BAAkB;IAC5BC,KAAKC,yBAAa;IAClBC,UAAUC,8BAAkB;IAC5BC,MAAMC,0BAAc;IACpBC,QAAQC,4BAAgB;IACxBC,KAAKC,yBAAa;IAClBC,MAAMC,0BAAc;IACpBC,QAAQC,4BAAgB;AAC5B;AAUO,SAAShD,sBAAsBiD,OAAO,EAAEC,KAAK,EAAEC,iBAAiB;IACnE,MAAMC,mBAAmBH,WAAW/C,gBAAgB,CAAC+C,QAAQ,IAAII,iCAAqB;IACtFD,iBAAiBE,EAAE,GAAG;IACtB,OAAOC,IAAAA,0BAAc,EAACL,OAAOE,kBAAkBD;AACnD;AAQW,MAAMlD,4BAA4B,CAAC,EAAEuD,kBAAkB,EAAEN,KAAK,EAAEC,iBAAiB,EAAE;IAC1F,OAAO;QACHM,MAAM;YACFC,OAAOR,MAAMQ,KAAK;YAClBC,WAAWT,MAAMS,SAAS;QAC9B;QACA,mDAAmD;QACnDC,SAAS5D,sBAAsBwD,oBAAoBN,OAAO;eACnDC,qBAAqB,EAAE;YAC1B;YACA;SACH;IACL;AACJ"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "elementContains", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return elementContains;
9
+ }
10
+ });
11
+ const _getParent = require("./getParent");
12
+ function elementContains(parent, child) {
13
+ if (!parent || !child) {
14
+ return false;
15
+ }
16
+ if (parent === child) {
17
+ return true;
18
+ } else {
19
+ // Tracks references of nodes that have been visited to prevent infinite loops
20
+ const set = new WeakSet();
21
+ while(child){
22
+ const nextParent = (0, _getParent.getParent)(child, {
23
+ skipVirtual: set.has(child)
24
+ });
25
+ set.add(child);
26
+ if (nextParent === parent) {
27
+ return true;
28
+ }
29
+ child = nextParent;
30
+ }
31
+ }
32
+ return false;
33
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["elementContains.js"],"sourcesContent":["import { getParent } from './getParent';\n/**\n * Similar functionality to `element.contains` DOM API for use without of order DOM elements that\n * checks the virtual parent hierarchy. If a virtual parents exists, it is chosen over the actual parent\n *\n * @internal\n * @returns true if the child can find the parent in its virtual hierarchy\n */ export function elementContains(parent, child) {\n if (!parent || !child) {\n return false;\n }\n if (parent === child) {\n return true;\n } else {\n // Tracks references of nodes that have been visited to prevent infinite loops\n const set = new WeakSet();\n while(child){\n const nextParent = getParent(child, {\n skipVirtual: set.has(child)\n });\n set.add(child);\n if (nextParent === parent) {\n return true;\n }\n child = nextParent;\n }\n }\n return false;\n}\n"],"names":["elementContains","parent","child","set","WeakSet","nextParent","getParent","skipVirtual","has","add"],"mappings":";;;;+BAOoBA;;;eAAAA;;;2BAPM;AAOf,SAASA,gBAAgBC,MAAM,EAAEC,KAAK;IAC7C,IAAI,CAACD,UAAU,CAACC,OAAO;QACnB,OAAO;IACX;IACA,IAAID,WAAWC,OAAO;QAClB,OAAO;IACX,OAAO;QACH,8EAA8E;QAC9E,MAAMC,MAAM,IAAIC;QAChB,MAAMF,MAAM;YACR,MAAMG,aAAaC,IAAAA,oBAAS,EAACJ,OAAO;gBAChCK,aAAaJ,IAAIK,GAAG,CAACN;YACzB;YACAC,IAAIM,GAAG,CAACP;YACR,IAAIG,eAAeJ,QAAQ;gBACvB,OAAO;YACX;YACAC,QAAQG;QACZ;IACJ;IACA,OAAO;AACX"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "getParent", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return getParent;
9
+ }
10
+ });
11
+ const _isVirtualElement = require("./isVirtualElement");
12
+ /**
13
+ * Gets the virtual parent given the child element, if it exists.
14
+ * @internal
15
+ */ function getVirtualParent(child) {
16
+ return (0, _isVirtualElement.isVirtualElement)(child) ? child._virtual.parent || null : null;
17
+ }
18
+ function getParent(child, options = {}) {
19
+ if (!child) {
20
+ return null;
21
+ }
22
+ if (!options.skipVirtual) {
23
+ const virtualParent = getVirtualParent(child);
24
+ if (virtualParent) {
25
+ return virtualParent;
26
+ }
27
+ }
28
+ return (child === null || child === void 0 ? void 0 : child.parentNode) || null;
29
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["getParent.js"],"sourcesContent":["import { isVirtualElement } from './isVirtualElement';\n/**\n * Gets the virtual parent given the child element, if it exists.\n * @internal\n */ function getVirtualParent(child) {\n return isVirtualElement(child) ? child._virtual.parent || null : null;\n}\n/**\n * Gets the element which is the parent of a given element.\n * This method prefers the virtual parent over real DOM parent when present.\n * @internal\n */ export function getParent(child, options = {}) {\n if (!child) {\n return null;\n }\n if (!options.skipVirtual) {\n const virtualParent = getVirtualParent(child);\n if (virtualParent) {\n return virtualParent;\n }\n }\n return (child === null || child === void 0 ? void 0 : child.parentNode) || null;\n}\n"],"names":["getParent","getVirtualParent","child","isVirtualElement","_virtual","parent","options","skipVirtual","virtualParent","parentNode"],"mappings":";;;;+BAWoBA;;;eAAAA;;;kCAXa;AACjC;;;CAGC,GAAG,SAASC,iBAAiBC,KAAK;IAC/B,OAAOC,IAAAA,kCAAgB,EAACD,SAASA,MAAME,QAAQ,CAACC,MAAM,IAAI,OAAO;AACrE;AAKW,SAASL,UAAUE,KAAK,EAAEI,UAAU,CAAC,CAAC;IAC7C,IAAI,CAACJ,OAAO;QACR,OAAO;IACX;IACA,IAAI,CAACI,QAAQC,WAAW,EAAE;QACtB,MAAMC,gBAAgBP,iBAAiBC;QACvC,IAAIM,eAAe;YACf,OAAOA;QACX;IACJ;IACA,OAAO,AAACN,CAAAA,UAAU,QAAQA,UAAU,KAAK,IAAI,KAAK,IAAIA,MAAMO,UAAU,AAAD,KAAM;AAC/E"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./elementContains"), exports);
7
+ _export_star._(require("./setVirtualParent"), exports);
8
+ _export_star._(require("./getParent"), exports);
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export * from './elementContains';\nexport * from './setVirtualParent';\nexport * from './getParent';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Determines whether or not an element has the virtual hierarchy extension.
3
+ * @internal
4
+ */ "use strict";
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ Object.defineProperty(exports, "isVirtualElement", {
9
+ enumerable: true,
10
+ get: function() {
11
+ return isVirtualElement;
12
+ }
13
+ });
14
+ function isVirtualElement(element) {
15
+ return element && !!element._virtual;
16
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["isVirtualElement.js"],"sourcesContent":["/**\n * Determines whether or not an element has the virtual hierarchy extension.\n * @internal\n */ export function isVirtualElement(element) {\n return element && !!element._virtual;\n}\n"],"names":["isVirtualElement","element","_virtual"],"mappings":"AAAA;;;CAGC;;;;+BAAmBA;;;eAAAA;;;AAAT,SAASA,iBAAiBC,OAAO;IACxC,OAAOA,WAAW,CAAC,CAACA,QAAQC,QAAQ;AACxC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Sets the virtual parent of an element.
3
+ *
4
+ * @internal
5
+ * @param child - Theme element to set the virtual parent
6
+ * @param parent - The virtual parent, use `undefined` to remove a virtual parent relationship
7
+ */ "use strict";
8
+ Object.defineProperty(exports, "__esModule", {
9
+ value: true
10
+ });
11
+ Object.defineProperty(exports, "setVirtualParent", {
12
+ enumerable: true,
13
+ get: function() {
14
+ return setVirtualParent;
15
+ }
16
+ });
17
+ function setVirtualParent(child, parent) {
18
+ if (!child) {
19
+ return;
20
+ }
21
+ const virtualChild = child;
22
+ if (!virtualChild._virtual) {
23
+ virtualChild._virtual = {};
24
+ }
25
+ virtualChild._virtual.parent = parent;
26
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["setVirtualParent.js"],"sourcesContent":["/**\n * Sets the virtual parent of an element.\n *\n * @internal\n * @param child - Theme element to set the virtual parent\n * @param parent - The virtual parent, use `undefined` to remove a virtual parent relationship\n */ export function setVirtualParent(child, parent) {\n if (!child) {\n return;\n }\n const virtualChild = child;\n if (!virtualChild._virtual) {\n virtualChild._virtual = {};\n }\n virtualChild._virtual.parent = parent;\n}\n"],"names":["setVirtualParent","child","parent","virtualChild","_virtual"],"mappings":"AAAA;;;;;;CAMC;;;;+BAAmBA;;;eAAAA;;;AAAT,SAASA,iBAAiBC,KAAK,EAAEC,MAAM;IAC9C,IAAI,CAACD,OAAO;QACR;IACJ;IACA,MAAME,eAAeF;IACrB,IAAI,CAACE,aAAaC,QAAQ,EAAE;QACxBD,aAAaC,QAAQ,GAAG,CAAC;IAC7B;IACAD,aAAaC,QAAQ,CAACF,MAAM,GAAGA;AACnC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-utilities",
3
- "version": "9.14.2",
3
+ "version": "9.15.1",
4
4
  "description": "A set of general React-specific utilities.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",