@fluentui/react-utilities 9.18.16 → 9.18.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -2
- package/dist/index.d.ts +1 -2
- package/lib/compose/assertSlots.js.map +1 -1
- package/lib/compose/constants.js.map +1 -1
- package/lib/compose/deprecated/getSlots.js.map +1 -1
- package/lib/compose/deprecated/getSlotsNext.js.map +1 -1
- package/lib/compose/deprecated/resolveShorthand.js.map +1 -1
- package/lib/compose/getIntrinsicElementProps.js.map +1 -1
- package/lib/compose/index.js +11 -9
- package/lib/compose/index.js.map +1 -1
- package/lib/compose/isResolvedShorthand.js +2 -2
- package/lib/compose/isResolvedShorthand.js.map +1 -1
- package/lib/compose/isSlot.js.map +1 -1
- package/lib/compose/slot.js.map +1 -1
- package/lib/compose/types.js.map +1 -1
- package/lib/events/index.js +1 -1
- package/lib/events/index.js.map +1 -1
- package/lib/events/mouseTouchHelpers.js.map +1 -1
- package/lib/hooks/index.js +13 -13
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useAnimationFrame.js.map +1 -1
- package/lib/hooks/useBrowserTimer.js.map +1 -1
- package/lib/hooks/useControllableState.js.map +1 -1
- package/lib/hooks/useEventCallback.js.map +1 -1
- package/lib/hooks/useFirstMount.js.map +1 -1
- package/lib/hooks/useForceUpdate.js +2 -2
- package/lib/hooks/useForceUpdate.js.map +1 -1
- package/lib/hooks/useId.js.map +1 -1
- package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib/hooks/useMergedRefs.js.map +1 -1
- package/lib/hooks/useOnClickOutside.js.map +1 -1
- package/lib/hooks/useOnScrollOutside.js.map +1 -1
- package/lib/hooks/usePrevious.js.map +1 -1
- package/lib/hooks/useScrollbarWidth.js.map +1 -1
- package/lib/hooks/useTimeout.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/selection/index.js +1 -2
- package/lib/selection/index.js.map +1 -1
- package/lib/selection/types.js.map +1 -1
- package/lib/selection/useSelection.js.map +1 -1
- package/lib/ssr/SSRContext.js.map +1 -1
- package/lib/ssr/canUseDOM.js.map +1 -1
- package/lib/ssr/index.js +2 -2
- package/lib/ssr/index.js.map +1 -1
- package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
- package/lib/trigger/getTriggerChild.js.map +1 -1
- package/lib/trigger/index.js +3 -4
- package/lib/trigger/index.js.map +1 -1
- package/lib/trigger/isFluentTrigger.js.map +1 -1
- package/lib/trigger/types.js.map +1 -1
- package/lib/utils/clamp.js.map +1 -1
- package/lib/utils/createSetFromIterable.js.map +1 -1
- package/lib/utils/getNativeElementProps.js.map +1 -1
- package/lib/utils/getRTLSafeKey.js.map +1 -1
- package/lib/utils/getReactCallbackName.js.map +1 -1
- package/lib/utils/index.js +10 -9
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/isHTMLElement.js.map +1 -1
- package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
- package/lib/utils/mergeCallbacks.js.map +1 -1
- package/lib/utils/omit.js.map +1 -1
- package/lib/utils/priorityQueue.js.map +1 -1
- package/lib/utils/properties.js.map +1 -1
- package/lib/utils/types.js.map +1 -1
- package/lib/virtualParent/elementContains.js.map +1 -1
- package/lib/virtualParent/getParent.js.map +1 -1
- package/lib/virtualParent/index.js +3 -3
- package/lib/virtualParent/index.js.map +1 -1
- package/lib/virtualParent/isVirtualElement.js.map +1 -1
- package/lib/virtualParent/setVirtualParent.js.map +1 -1
- package/lib/virtualParent/types.js.map +1 -1
- package/lib-commonjs/compose/assertSlots.js.map +1 -1
- package/lib-commonjs/compose/constants.js.map +1 -1
- package/lib-commonjs/compose/deprecated/getSlots.js.map +1 -1
- package/lib-commonjs/compose/deprecated/getSlotsNext.js.map +1 -1
- package/lib-commonjs/compose/deprecated/resolveShorthand.js.map +1 -1
- package/lib-commonjs/compose/getIntrinsicElementProps.js.map +1 -1
- package/lib-commonjs/compose/index.js +43 -13
- package/lib-commonjs/compose/index.js.map +1 -1
- package/lib-commonjs/compose/isResolvedShorthand.js +3 -2
- package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
- package/lib-commonjs/compose/isSlot.js.map +1 -1
- package/lib-commonjs/compose/slot.js +1 -1
- package/lib-commonjs/compose/slot.js.map +1 -1
- package/lib-commonjs/compose/types.js.map +1 -1
- package/lib-commonjs/events/index.js +18 -2
- package/lib-commonjs/events/index.js.map +1 -1
- package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
- package/lib-commonjs/hooks/index.js +66 -14
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useAnimationFrame.js.map +1 -1
- package/lib-commonjs/hooks/useBrowserTimer.js.map +1 -1
- package/lib-commonjs/hooks/useControllableState.js.map +1 -1
- package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
- package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
- package/lib-commonjs/hooks/useForceUpdate.js +3 -2
- package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
- package/lib-commonjs/hooks/useId.js +1 -1
- package/lib-commonjs/hooks/useId.js.map +1 -1
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib-commonjs/hooks/useMergedRefs.js +2 -1
- package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
- package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
- package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
- package/lib-commonjs/hooks/usePrevious.js.map +1 -1
- package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
- package/lib-commonjs/hooks/useTimeout.js.map +1 -1
- package/lib-commonjs/index.js +4 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/selection/index.js +7 -3
- package/lib-commonjs/selection/index.js.map +1 -1
- package/lib-commonjs/selection/types.js.map +1 -1
- package/lib-commonjs/selection/useSelection.js.map +1 -1
- package/lib-commonjs/ssr/SSRContext.js.map +1 -1
- package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
- package/lib-commonjs/ssr/index.js +28 -3
- package/lib-commonjs/ssr/index.js.map +1 -1
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +3 -3
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
- package/lib-commonjs/trigger/getTriggerChild.js +3 -2
- package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
- package/lib-commonjs/trigger/index.js +20 -5
- package/lib-commonjs/trigger/index.js.map +1 -1
- package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
- package/lib-commonjs/trigger/types.js.map +1 -1
- package/lib-commonjs/utils/clamp.js.map +1 -1
- package/lib-commonjs/utils/createSetFromIterable.js.map +1 -1
- package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
- package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
- package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
- package/lib-commonjs/utils/index.js +132 -10
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
- package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
- package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
- package/lib-commonjs/utils/omit.js.map +1 -1
- package/lib-commonjs/utils/priorityQueue.js +0 -4
- package/lib-commonjs/utils/priorityQueue.js.map +1 -1
- package/lib-commonjs/utils/properties.js +2 -1
- package/lib-commonjs/utils/properties.js.map +1 -1
- package/lib-commonjs/utils/types.js +1 -4
- package/lib-commonjs/utils/types.js.map +1 -1
- package/lib-commonjs/virtualParent/elementContains.js.map +1 -1
- package/lib-commonjs/virtualParent/getParent.js.map +1 -1
- package/lib-commonjs/virtualParent/index.js +20 -4
- package/lib-commonjs/virtualParent/index.js.map +1 -1
- package/lib-commonjs/virtualParent/isVirtualElement.js +1 -4
- package/lib-commonjs/virtualParent/isVirtualElement.js.map +1 -1
- package/lib-commonjs/virtualParent/setVirtualParent.js +1 -7
- package/lib-commonjs/virtualParent/setVirtualParent.js.map +1 -1
- package/lib-commonjs/virtualParent/types.js.map +1 -1
- package/package.json +3 -18
@@ -26,13 +26,13 @@ function applyTriggerPropsToChildren(children, triggerChildProps) {
|
|
26
26
|
* Clones a React element tree, and applies the given props to the first grandchild that is not
|
27
27
|
* a FluentTriggerComponent or React Fragment (the same element returned by {@link getTriggerChild}).
|
28
28
|
*/ function cloneTriggerTree(child, triggerProps) {
|
29
|
-
if (
|
29
|
+
if (!_react.isValidElement(child) || child.type === _react.Fragment) {
|
30
30
|
throw new Error('A trigger element must be a single element for this component. ' + "Please ensure that you're not using React Fragments.");
|
31
31
|
}
|
32
32
|
if ((0, _isFluentTrigger.isFluentTrigger)(child)) {
|
33
33
|
const grandchild = cloneTriggerTree(child.props.children, triggerProps);
|
34
|
-
return
|
34
|
+
return _react.cloneElement(child, undefined, grandchild);
|
35
35
|
} else {
|
36
|
-
return
|
36
|
+
return _react.cloneElement(child, triggerProps);
|
37
37
|
}
|
38
38
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["applyTriggerPropsToChildren.ts"],"sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\nimport type { TriggerProps } from './types';\n\n/**\n * @internal\n * resolve the trigger props to the children, either by calling the render function, or cloning with the new props.\n */\nexport function applyTriggerPropsToChildren<TriggerChildProps>(\n children: TriggerProps<TriggerChildProps>['children'],\n triggerChildProps: TriggerChildProps,\n): React.ReactElement | null {\n if (typeof children === 'function') {\n return children(triggerChildProps);\n } else if (children) {\n return cloneTriggerTree(children, triggerChildProps);\n }\n\n // Components in React should return either JSX elements or \"null\", otherwise React will throw:\n // Nothing was returned from render.\n // This usually means a return statement is missing. Or, to render nothing, return null.\n return children || null;\n}\n\n/**\n * Clones a React element tree, and applies the given props to the first grandchild that is not\n * a FluentTriggerComponent or React Fragment (the same element returned by {@link getTriggerChild}).\n */\nfunction cloneTriggerTree<TriggerChildProps>(\n child: React.ReactNode,\n triggerProps: TriggerChildProps,\n): React.ReactElement {\n if (!React.isValidElement(child) || child.type === React.Fragment) {\n throw new Error(\n 'A trigger element must be a single element for this component. ' +\n \"Please ensure that you're not using React Fragments.\",\n );\n }\n\n if (isFluentTrigger(child)) {\n const grandchild = cloneTriggerTree(child.props.children, triggerProps);\n return React.cloneElement(child, undefined, grandchild);\n } else {\n return React.cloneElement(child, triggerProps as TriggerChildProps & React.Attributes);\n }\n}\n"],"names":["applyTriggerPropsToChildren","children","triggerChildProps","cloneTriggerTree","child","triggerProps","React","isValidElement","type","Fragment","Error","isFluentTrigger","grandchild","props","cloneElement","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQgBA;;;eAAAA;;;;iEARO;iCACS;AAOzB,SAASA,4BACdC,QAAqD,EACrDC,iBAAoC;IAEpC,IAAI,OAAOD,aAAa,YAAY;QAClC,OAAOA,SAASC;IAClB,OAAO,IAAID,UAAU;QACnB,OAAOE,iBAAiBF,UAAUC;IACpC;IAEA,+FAA+F;IAC/F,sCAAsC;IACtC,0FAA0F;IAC1F,OAAOD,YAAY;AACrB;AAEA;;;CAGC,GACD,SAASE,iBACPC,KAAsB,EACtBC,YAA+B;IAE/B,IAAI,
|
1
|
+
{"version":3,"sources":["../src/trigger/applyTriggerPropsToChildren.ts"],"sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\nimport type { TriggerProps } from './types';\n\n/**\n * @internal\n * resolve the trigger props to the children, either by calling the render function, or cloning with the new props.\n */\nexport function applyTriggerPropsToChildren<TriggerChildProps>(\n children: TriggerProps<TriggerChildProps>['children'],\n triggerChildProps: TriggerChildProps,\n): React.ReactElement | null {\n if (typeof children === 'function') {\n return children(triggerChildProps);\n } else if (children) {\n return cloneTriggerTree(children, triggerChildProps);\n }\n\n // Components in React should return either JSX elements or \"null\", otherwise React will throw:\n // Nothing was returned from render.\n // This usually means a return statement is missing. Or, to render nothing, return null.\n return children || null;\n}\n\n/**\n * Clones a React element tree, and applies the given props to the first grandchild that is not\n * a FluentTriggerComponent or React Fragment (the same element returned by {@link getTriggerChild}).\n */\nfunction cloneTriggerTree<TriggerChildProps>(\n child: React.ReactNode,\n triggerProps: TriggerChildProps,\n): React.ReactElement {\n if (!React.isValidElement(child) || child.type === React.Fragment) {\n throw new Error(\n 'A trigger element must be a single element for this component. ' +\n \"Please ensure that you're not using React Fragments.\",\n );\n }\n\n if (isFluentTrigger(child)) {\n const grandchild = cloneTriggerTree(child.props.children, triggerProps);\n return React.cloneElement(child, undefined, grandchild);\n } else {\n return React.cloneElement(child, triggerProps as TriggerChildProps & React.Attributes);\n }\n}\n"],"names":["applyTriggerPropsToChildren","children","triggerChildProps","cloneTriggerTree","child","triggerProps","React","isValidElement","type","Fragment","Error","isFluentTrigger","grandchild","props","cloneElement","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQgBA;;;eAAAA;;;;iEARO;iCACS;AAOzB,SAASA,4BACdC,QAAqD,EACrDC,iBAAoC;IAEpC,IAAI,OAAOD,aAAa,YAAY;QAClC,OAAOA,SAASC;IAClB,OAAO,IAAID,UAAU;QACnB,OAAOE,iBAAiBF,UAAUC;IACpC;IAEA,+FAA+F;IAC/F,sCAAsC;IACtC,0FAA0F;IAC1F,OAAOD,YAAY;AACrB;AAEA;;;CAGC,GACD,SAASE,iBACPC,KAAsB,EACtBC,YAA+B;IAE/B,IAAI,CAACC,OAAMC,cAAc,CAACH,UAAUA,MAAMI,IAAI,KAAKF,OAAMG,QAAQ,EAAE;QACjE,MAAM,IAAIC,MACR,oEACE;IAEN;IAEA,IAAIC,IAAAA,gCAAe,EAACP,QAAQ;QAC1B,MAAMQ,aAAaT,iBAAiBC,MAAMS,KAAK,CAACZ,QAAQ,EAAEI;QAC1D,OAAOC,OAAMQ,YAAY,CAACV,OAAOW,WAAWH;IAC9C,OAAO;QACL,OAAON,OAAMQ,YAAY,CAACV,OAAOC;IACnC;AACF"}
|
@@ -12,9 +12,10 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
|
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
13
13
|
const _isFluentTrigger = require("./isFluentTrigger");
|
14
14
|
function getTriggerChild(children) {
|
15
|
-
if (
|
15
|
+
if (!_react.isValidElement(children)) {
|
16
16
|
return null;
|
17
17
|
}
|
18
|
-
return (0, _isFluentTrigger.isFluentTrigger)(children) ? getTriggerChild(//
|
18
|
+
return (0, _isFluentTrigger.isFluentTrigger)(children) ? getTriggerChild(// FIXME: This casting should be unnecessary as isFluentTrigger is a guard type method,
|
19
|
+
// but for some reason it's failing on build
|
19
20
|
children.props.children) : children;
|
20
21
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["getTriggerChild.ts"],"sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\nimport type { TriggerProps } from './types';\n\n/**\n * @internal\n * Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).\n *\n * In the case where the immediate child is itself a FluentTriggerComponent and/or React Fragment,\n * it returns the first descendant that is _not_ a FluentTriggerComponent or Fragment.\n * This allows multiple triggers to be stacked, and still apply their props to the actual trigger element.\n *\n * For example, the following returns `<div id=\"child\" />`:\n * ```jsx\n * getTriggerChild(\n * <Tooltip>\n * <MenuTrigger>\n * <div id=\"child\" />\n * </MenuTrigger>\n * </Tooltip>\n * );\n * ```\n *\n * In the case where the immediate child is not a valid element,\n * null is returned\n */\nexport function getTriggerChild<TriggerChildProps>(\n children: TriggerProps<TriggerChildProps>['children'],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): (React.ReactElement<Partial<TriggerChildProps>> & { ref?: React.Ref<any> }) | null {\n if (!React.isValidElement<TriggerChildProps>(children)) {\n return null;\n }\n return isFluentTrigger(children)\n ? getTriggerChild(\n // FIXME: This casting should be unnecessary as isFluentTrigger is a guard type method,\n // but for some reason it's failing on build\n (children.props as TriggerProps).children,\n )\n : children;\n}\n"],"names":["getTriggerChild","children","React","isValidElement","isFluentTrigger","props"],"rangeMappings":"
|
1
|
+
{"version":3,"sources":["../src/trigger/getTriggerChild.ts"],"sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\nimport type { TriggerProps } from './types';\n\n/**\n * @internal\n * Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).\n *\n * In the case where the immediate child is itself a FluentTriggerComponent and/or React Fragment,\n * it returns the first descendant that is _not_ a FluentTriggerComponent or Fragment.\n * This allows multiple triggers to be stacked, and still apply their props to the actual trigger element.\n *\n * For example, the following returns `<div id=\"child\" />`:\n * ```jsx\n * getTriggerChild(\n * <Tooltip>\n * <MenuTrigger>\n * <div id=\"child\" />\n * </MenuTrigger>\n * </Tooltip>\n * );\n * ```\n *\n * In the case where the immediate child is not a valid element,\n * null is returned\n */\nexport function getTriggerChild<TriggerChildProps>(\n children: TriggerProps<TriggerChildProps>['children'],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): (React.ReactElement<Partial<TriggerChildProps>> & { ref?: React.Ref<any> }) | null {\n if (!React.isValidElement<TriggerChildProps>(children)) {\n return null;\n }\n return isFluentTrigger(children)\n ? getTriggerChild(\n // FIXME: This casting should be unnecessary as isFluentTrigger is a guard type method,\n // but for some reason it's failing on build\n (children.props as TriggerProps).children,\n )\n : children;\n}\n"],"names":["getTriggerChild","children","React","isValidElement","isFluentTrigger","props"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA0BgBA;;;eAAAA;;;;iEA1BO;iCACS;AAyBzB,SAASA,gBACdC,QAAqD;IAGrD,IAAI,CAACC,OAAMC,cAAc,CAAoBF,WAAW;QACtD,OAAO;IACT;IACA,OAAOG,IAAAA,gCAAe,EAACH,YACnBD,gBAGE,AAFA,uFAAuF;IACvF,4CAA4C;IAC3CC,SAASI,KAAK,CAAkBJ,QAAQ,IAE3CA;AACN"}
|
@@ -2,8 +2,23 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
function _export(target, all) {
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
7
|
+
enumerable: true,
|
8
|
+
get: all[name]
|
9
|
+
});
|
10
|
+
}
|
11
|
+
_export(exports, {
|
12
|
+
applyTriggerPropsToChildren: function() {
|
13
|
+
return _applyTriggerPropsToChildren.applyTriggerPropsToChildren;
|
14
|
+
},
|
15
|
+
getTriggerChild: function() {
|
16
|
+
return _getTriggerChild.getTriggerChild;
|
17
|
+
},
|
18
|
+
isFluentTrigger: function() {
|
19
|
+
return _isFluentTrigger.isFluentTrigger;
|
20
|
+
}
|
21
|
+
});
|
22
|
+
const _applyTriggerPropsToChildren = require("./applyTriggerPropsToChildren");
|
23
|
+
const _getTriggerChild = require("./getTriggerChild");
|
24
|
+
const _isFluentTrigger = require("./isFluentTrigger");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export
|
1
|
+
{"version":3,"sources":["../src/trigger/index.ts"],"sourcesContent":["export { applyTriggerPropsToChildren } from './applyTriggerPropsToChildren';\nexport { getTriggerChild } from './getTriggerChild';\nexport { isFluentTrigger } from './isFluentTrigger';\nexport type { FluentTriggerComponent, TriggerProps } from './types';\n"],"names":["applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,2BAA2B;eAA3BA,wDAA2B;;IAC3BC,eAAe;eAAfA,gCAAe;;IACfC,eAAe;eAAfA,gCAAe;;;6CAFoB;iCACZ;iCACA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["isFluentTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport type { FluentTriggerComponent, TriggerProps } from './types';\n\n/**\n * @internal\n * Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).\n * See the {@link FluentTriggerComponent} type for more info.\n */\nexport function isFluentTrigger(element: React.ReactElement): element is React.ReactElement<TriggerProps> {\n return Boolean((element.type as FluentTriggerComponent).isFluentTriggerComponent);\n}\n"],"names":["isFluentTrigger","element","Boolean","type","isFluentTriggerComponent"],"rangeMappings":";;;;;;;;;;;;;;","mappings":";;;;+BAQgBA;;;eAAAA;;;;iEARO;AAQhB,SAASA,gBAAgBC,OAA2B;IACzD,OAAOC,
|
1
|
+
{"version":3,"sources":["../src/trigger/isFluentTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport type { FluentTriggerComponent, TriggerProps } from './types';\n\n/**\n * @internal\n * Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).\n * See the {@link FluentTriggerComponent} type for more info.\n */\nexport function isFluentTrigger(element: React.ReactElement): element is React.ReactElement<TriggerProps> {\n return Boolean((element.type as FluentTriggerComponent).isFluentTriggerComponent);\n}\n"],"names":["isFluentTrigger","element","Boolean","type","isFluentTriggerComponent"],"rangeMappings":";;;;;;;;;;;;;;","mappings":";;;;+BAQgBA;;;eAAAA;;;;iEARO;AAQhB,SAASA,gBAAgBC,OAA2B;IACzD,OAAOC,QAAQ,AAACD,QAAQE,IAAI,CAA4BC,wBAAwB;AAClF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["types.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n * Allows a component to be tagged as a FluentUI trigger component.\n *\n * Triggers are special-case components: they attach event listeners and other props on their child,\n * and use them to trigger another component to show. Examples include `MenuTrigger` and `Tooltip`.\n *\n * A component can be tagged as a trigger as follows:\n * ```ts\n * const MyComponent: React.FC<MyComponentProps> & FluentTriggerComponent = ...;\n *\n * MyComponent.isFluentTriggerComponent = true; // MUST also set this to true\n * ```\n */\nexport type FluentTriggerComponent = {\n isFluentTriggerComponent?: boolean;\n};\n\n/**\n * A trigger may have a children that could be either:\n * 1. A single element\n * 2. A render function that will receive properties and must return a valid element or null\n * 3. null or undefined\n */\nexport type TriggerProps<TriggerChildProps = unknown> = {\n children?: React.ReactElement | ((props: TriggerChildProps) => React.ReactElement | null) | null;\n};\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}
|
1
|
+
{"version":3,"sources":["../src/trigger/types.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n * Allows a component to be tagged as a FluentUI trigger component.\n *\n * Triggers are special-case components: they attach event listeners and other props on their child,\n * and use them to trigger another component to show. Examples include `MenuTrigger` and `Tooltip`.\n *\n * A component can be tagged as a trigger as follows:\n * ```ts\n * const MyComponent: React.FC<MyComponentProps> & FluentTriggerComponent = ...;\n *\n * MyComponent.isFluentTriggerComponent = true; // MUST also set this to true\n * ```\n */\nexport type FluentTriggerComponent = {\n isFluentTriggerComponent?: boolean;\n};\n\n/**\n * A trigger may have a children that could be either:\n * 1. A single element\n * 2. A render function that will receive properties and must return a valid element or null\n * 3. null or undefined\n */\nexport type TriggerProps<TriggerChildProps = unknown> = {\n children?: React.ReactElement | ((props: TriggerChildProps) => React.ReactElement | null) | null;\n};\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["clamp.ts"],"sourcesContent":["/**\n * @internal\n * Clamps `value` to a number between the min and max.\n *\n * @param value - the value to be clamped\n * @param min - the lowest valid value\n * @param max - the highest valid value\n */\nexport const clamp = (value: number, min: number, max: number): number => Math.max(min, Math.min(max, value || 0));\n"],"names":["clamp","value","min","max","Math"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;;CAOC;;;;+BACYA;;;eAAAA;;;AAAN,MAAMA,QAAQ,CAACC,OAAeC,KAAaC,MAAwBC,KAAKD,GAAG,CAACD,KAAKE,KAAKF,GAAG,CAACC,KAAKF,SAAS"}
|
1
|
+
{"version":3,"sources":["../src/utils/clamp.ts"],"sourcesContent":["/**\n * @internal\n * Clamps `value` to a number between the min and max.\n *\n * @param value - the value to be clamped\n * @param min - the lowest valid value\n * @param max - the highest valid value\n */\nexport const clamp = (value: number, min: number, max: number): number => Math.max(min, Math.min(max, value || 0));\n"],"names":["clamp","value","min","max","Math"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;;CAOC;;;;+BACYA;;;eAAAA;;;AAAN,MAAMA,QAAQ,CAACC,OAAeC,KAAaC,MAAwBC,KAAKD,GAAG,CAACD,KAAKE,KAAKF,GAAG,CAACC,KAAKF,SAAS"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["createSetFromIterable.ts"],"sourcesContent":["/**\n * Creates a set from a given iterable, in case the iterable is a set itself, returns the given set instead.\n */\nexport function createSetFromIterable<V>(iterable: Iterable<V>): Set<V> {\n return iterable instanceof Set ? iterable : new Set(iterable);\n}\n"],"names":["createSetFromIterable","iterable","Set"],"rangeMappings":";;;;;;;;;;;;;;","mappings":"AAAA;;CAEC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,sBAAyBC,QAAqB;IAC5D,OAAOA,oBAAoBC,MAAMD,WAAW,IAAIC,IAAID;AACtD"}
|
1
|
+
{"version":3,"sources":["../src/utils/createSetFromIterable.ts"],"sourcesContent":["/**\n * Creates a set from a given iterable, in case the iterable is a set itself, returns the given set instead.\n */\nexport function createSetFromIterable<V>(iterable: Iterable<V>): Set<V> {\n return iterable instanceof Set ? iterable : new Set(iterable);\n}\n"],"names":["createSetFromIterable","iterable","Set"],"rangeMappings":";;;;;;;;;;;;;;","mappings":"AAAA;;CAEC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,sBAAyBC,QAAqB;IAC5D,OAAOA,oBAAoBC,MAAMD,WAAW,IAAIC,IAAID;AACtD"}
|
@@ -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 * @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":["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"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAiEgBA,
|
1
|
+
{"version":3,"sources":["../src/utils/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":["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"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAiEgBA,qBAAqB;eAArBA;;IAmBHC,yBAAyB;eAAzBA;;;;iEApFU;4BA2BhB;AAEP,MAAMC,mBAA2D;IAC/DC,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;AAC1B;AAYO,SAAShD,sBACdiD,OAAe,EACfC,KAAS,EACTC,iBAA4B;IAE5B,MAAMC,mBAAmB,AAACH,WAAW/C,gBAAgB,CAAC+C,QAAQ,IAAKI,iCAAqB;IACxFD,iBAAiBE,EAAE,GAAG;IAEtB,OAAOC,IAAAA,0BAAc,EAACL,OAAOE,kBAAkBD;AACjD;AAUO,MAAMlD,4BAA4B,CAGvC,EACAuD,kBAAkB,EAClBN,KAAK,EACLC,iBAAiB,EAUlB;IACC,OAAO;QACLM,MAAM;YAAEC,OAAOR,MAAMQ,KAAK;YAAEC,WAAWT,MAAMS,SAAS;QAAC;QACvD,mDAAmD;QACnDC,SAAS5D,sBAAqDwD,oBAAoBN,OAAO;eACnFC,qBAAqB,EAAE;YAC3B;YACA;SACD;IACH;AACF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["getRTLSafeKey.ts"],"sourcesContent":["/**\n * @internal\n * Finds and swaps a provided key for it's right to left format.\n */\nexport const getRTLSafeKey = (key: string, dir: 'ltr' | 'rtl') => {\n if (dir === 'rtl') {\n switch (key) {\n case 'ArrowLeft': {\n return 'ArrowRight';\n }\n\n case 'ArrowRight': {\n return 'ArrowLeft';\n }\n }\n }\n\n return key;\n};\n"],"names":["getRTLSafeKey","key","dir"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;CAGC;;;;+BACYA;;;eAAAA;;;AAAN,MAAMA,gBAAgB,CAACC,KAAaC;IACzC,IAAIA,QAAQ,OAAO;QACjB,OAAQD;YACN,KAAK;gBAAa;oBAChB,OAAO;gBACT;YAEA,KAAK;gBAAc;oBACjB,OAAO;gBACT;QACF;IACF;IAEA,OAAOA;AACT"}
|
1
|
+
{"version":3,"sources":["../src/utils/getRTLSafeKey.ts"],"sourcesContent":["/**\n * @internal\n * Finds and swaps a provided key for it's right to left format.\n */\nexport const getRTLSafeKey = (key: string, dir: 'ltr' | 'rtl') => {\n if (dir === 'rtl') {\n switch (key) {\n case 'ArrowLeft': {\n return 'ArrowRight';\n }\n\n case 'ArrowRight': {\n return 'ArrowLeft';\n }\n }\n }\n\n return key;\n};\n"],"names":["getRTLSafeKey","key","dir"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;CAGC;;;;+BACYA;;;eAAAA;;;AAAN,MAAMA,gBAAgB,CAACC,KAAaC;IACzC,IAAIA,QAAQ,OAAO;QACjB,OAAQD;YACN,KAAK;gBAAa;oBAChB,OAAO;gBACT;YAEA,KAAK;gBAAc;oBACjB,OAAO;gBACT;QACF;IACF;IAEA,OAAOA;AACT"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["getReactCallbackName.ts"],"sourcesContent":["import * as React from 'react';\n\ninterface ReactSyntheticEvent extends React.SyntheticEvent<unknown> {\n // React 17/18\n // See https://github.com/facebook/react/pull/19236\n _reactName?: string;\n\n // React 16\n dispatchConfig?: {\n registrationName: string;\n phasedRegistrationNames: {\n bubbled: string;\n captured: string;\n };\n };\n}\n\ntype NonUndefined<A> = A extends undefined ? never : A;\ntype FunctionKeys<T extends object> = {\n [K in keyof T]-?: NonUndefined<T[K]> extends Function ? K : never;\n}[keyof T];\n\nexport type ReactCallbackName = FunctionKeys<React.DOMAttributes<unknown>>;\n\n/**\n * React.SyntheticEvent contains name of a callback that should be fired, this function returns it.\n *\n * Ideally, it should also distinguish regular and \"capture\" callbacks, but it's possible only with React 17 as\n * \".eventPhase\" there has proper value, see https://github.com/facebook/react/pull/19244. In React 16 all events\n * are handled in bubble phase.\n */\nexport function getReactCallbackName(event: ReactSyntheticEvent): ReactCallbackName | undefined {\n if (event._reactName) {\n return event._reactName as ReactCallbackName;\n }\n\n if (event.dispatchConfig) {\n if (event.dispatchConfig.registrationName) {\n return event.dispatchConfig.registrationName as ReactCallbackName;\n }\n\n return event.dispatchConfig.phasedRegistrationNames.bubbled as ReactCallbackName;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error(/** #__DE-INDENT__ */ `\n @fluentui/react-utilities [${getReactCallbackName.name}]:\n Passed React.SyntheticEvent does not contain \".dispatchConfig\" or \"._reactName\". This should not happen, please report it to https://github.com/microsoft/fluentui.\n `);\n }\n}\n"],"names":["getReactCallbackName","event","_reactName","dispatchConfig","registrationName","phasedRegistrationNames","bubbled","process","env","NODE_ENV","console","error","name"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA+BgBA;;;eAAAA;;;;iEA/BO;AA+BhB,SAASA,qBAAqBC,KAA0B;IAC7D,IAAIA,MAAMC,UAAU,EAAE;QACpB,OAAOD,MAAMC,UAAU;IACzB;IAEA,IAAID,MAAME,cAAc,EAAE;QACxB,IAAIF,MAAME,cAAc,CAACC,gBAAgB,EAAE;YACzC,OAAOH,MAAME,cAAc,CAACC,gBAAgB;QAC9C;QAEA,OAAOH,MAAME,cAAc,CAACE,uBAAuB,CAACC,OAAO;IAC7D;IAEA,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,sCAAsC;QACtCC,QAAQC,KAAK,CAAuB,CAAC,2BACR,EAAEX,qBAAqBY,IAAI,CAAC;mKAEzD,CAAC;IACH;AACF"}
|
1
|
+
{"version":3,"sources":["../src/utils/getReactCallbackName.ts"],"sourcesContent":["import * as React from 'react';\n\ninterface ReactSyntheticEvent extends React.SyntheticEvent<unknown> {\n // React 17/18\n // See https://github.com/facebook/react/pull/19236\n _reactName?: string;\n\n // React 16\n dispatchConfig?: {\n registrationName: string;\n phasedRegistrationNames: {\n bubbled: string;\n captured: string;\n };\n };\n}\n\ntype NonUndefined<A> = A extends undefined ? never : A;\ntype FunctionKeys<T extends object> = {\n [K in keyof T]-?: NonUndefined<T[K]> extends Function ? K : never;\n}[keyof T];\n\nexport type ReactCallbackName = FunctionKeys<React.DOMAttributes<unknown>>;\n\n/**\n * React.SyntheticEvent contains name of a callback that should be fired, this function returns it.\n *\n * Ideally, it should also distinguish regular and \"capture\" callbacks, but it's possible only with React 17 as\n * \".eventPhase\" there has proper value, see https://github.com/facebook/react/pull/19244. In React 16 all events\n * are handled in bubble phase.\n */\nexport function getReactCallbackName(event: ReactSyntheticEvent): ReactCallbackName | undefined {\n if (event._reactName) {\n return event._reactName as ReactCallbackName;\n }\n\n if (event.dispatchConfig) {\n if (event.dispatchConfig.registrationName) {\n return event.dispatchConfig.registrationName as ReactCallbackName;\n }\n\n return event.dispatchConfig.phasedRegistrationNames.bubbled as ReactCallbackName;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error(/** #__DE-INDENT__ */ `\n @fluentui/react-utilities [${getReactCallbackName.name}]:\n Passed React.SyntheticEvent does not contain \".dispatchConfig\" or \"._reactName\". This should not happen, please report it to https://github.com/microsoft/fluentui.\n `);\n }\n}\n"],"names":["getReactCallbackName","event","_reactName","dispatchConfig","registrationName","phasedRegistrationNames","bubbled","process","env","NODE_ENV","console","error","name"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA+BgBA;;;eAAAA;;;;iEA/BO;AA+BhB,SAASA,qBAAqBC,KAA0B;IAC7D,IAAIA,MAAMC,UAAU,EAAE;QACpB,OAAOD,MAAMC,UAAU;IACzB;IAEA,IAAID,MAAME,cAAc,EAAE;QACxB,IAAIF,MAAME,cAAc,CAACC,gBAAgB,EAAE;YACzC,OAAOH,MAAME,cAAc,CAACC,gBAAgB;QAC9C;QAEA,OAAOH,MAAME,cAAc,CAACE,uBAAuB,CAACC,OAAO;IAC7D;IAEA,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,sCAAsC;QACtCC,QAAQC,KAAK,CAAuB,CAAC,2BACR,EAAEX,qBAAqBY,IAAI,CAAC;mKAEzD,CAAC;IACH;AACF"}
|
@@ -2,13 +2,135 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
5
|
+
function _export(target, all) {
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
7
|
+
enumerable: true,
|
8
|
+
get: all[name]
|
9
|
+
});
|
10
|
+
}
|
11
|
+
_export(exports, {
|
12
|
+
anchorProperties: function() {
|
13
|
+
return _properties.anchorProperties;
|
14
|
+
},
|
15
|
+
audioProperties: function() {
|
16
|
+
return _properties.audioProperties;
|
17
|
+
},
|
18
|
+
baseElementEvents: function() {
|
19
|
+
return _properties.baseElementEvents;
|
20
|
+
},
|
21
|
+
baseElementProperties: function() {
|
22
|
+
return _properties.baseElementProperties;
|
23
|
+
},
|
24
|
+
buttonProperties: function() {
|
25
|
+
return _properties.buttonProperties;
|
26
|
+
},
|
27
|
+
clamp: function() {
|
28
|
+
return _clamp.clamp;
|
29
|
+
},
|
30
|
+
colGroupProperties: function() {
|
31
|
+
return _properties.colGroupProperties;
|
32
|
+
},
|
33
|
+
colProperties: function() {
|
34
|
+
return _properties.colProperties;
|
35
|
+
},
|
36
|
+
createPriorityQueue: function() {
|
37
|
+
return _priorityQueue.createPriorityQueue;
|
38
|
+
},
|
39
|
+
dialogProperties: function() {
|
40
|
+
return _properties.dialogProperties;
|
41
|
+
},
|
42
|
+
divProperties: function() {
|
43
|
+
return _properties.divProperties;
|
44
|
+
},
|
45
|
+
fieldsetProperties: function() {
|
46
|
+
return _properties.fieldsetProperties;
|
47
|
+
},
|
48
|
+
formProperties: function() {
|
49
|
+
return _properties.formProperties;
|
50
|
+
},
|
51
|
+
// eslint-disable-next-line deprecation/deprecation
|
52
|
+
getNativeElementProps: function() {
|
53
|
+
return _getNativeElementProps.getNativeElementProps;
|
54
|
+
},
|
55
|
+
getNativeProps: function() {
|
56
|
+
return _properties.getNativeProps;
|
57
|
+
},
|
58
|
+
getPartitionedNativeProps: function() {
|
59
|
+
return _getNativeElementProps.getPartitionedNativeProps;
|
60
|
+
},
|
61
|
+
getRTLSafeKey: function() {
|
62
|
+
return _getRTLSafeKey.getRTLSafeKey;
|
63
|
+
},
|
64
|
+
htmlElementProperties: function() {
|
65
|
+
return _properties.htmlElementProperties;
|
66
|
+
},
|
67
|
+
iframeProperties: function() {
|
68
|
+
return _properties.iframeProperties;
|
69
|
+
},
|
70
|
+
imgProperties: function() {
|
71
|
+
return _properties.imgProperties;
|
72
|
+
},
|
73
|
+
inputProperties: function() {
|
74
|
+
return _properties.inputProperties;
|
75
|
+
},
|
76
|
+
isHTMLElement: function() {
|
77
|
+
return _isHTMLElement.isHTMLElement;
|
78
|
+
},
|
79
|
+
isInteractiveHTMLElement: function() {
|
80
|
+
return _isInteractiveHTMLElement.isInteractiveHTMLElement;
|
81
|
+
},
|
82
|
+
labelProperties: function() {
|
83
|
+
return _properties.labelProperties;
|
84
|
+
},
|
85
|
+
liProperties: function() {
|
86
|
+
return _properties.liProperties;
|
87
|
+
},
|
88
|
+
mergeCallbacks: function() {
|
89
|
+
return _mergeCallbacks.mergeCallbacks;
|
90
|
+
},
|
91
|
+
microdataProperties: function() {
|
92
|
+
return _properties.microdataProperties;
|
93
|
+
},
|
94
|
+
olProperties: function() {
|
95
|
+
return _properties.olProperties;
|
96
|
+
},
|
97
|
+
omit: function() {
|
98
|
+
return _omit.omit;
|
99
|
+
},
|
100
|
+
optionProperties: function() {
|
101
|
+
return _properties.optionProperties;
|
102
|
+
},
|
103
|
+
selectProperties: function() {
|
104
|
+
return _properties.selectProperties;
|
105
|
+
},
|
106
|
+
tableProperties: function() {
|
107
|
+
return _properties.tableProperties;
|
108
|
+
},
|
109
|
+
tdProperties: function() {
|
110
|
+
return _properties.tdProperties;
|
111
|
+
},
|
112
|
+
textAreaProperties: function() {
|
113
|
+
return _properties.textAreaProperties;
|
114
|
+
},
|
115
|
+
thProperties: function() {
|
116
|
+
return _properties.thProperties;
|
117
|
+
},
|
118
|
+
timeProperties: function() {
|
119
|
+
return _properties.timeProperties;
|
120
|
+
},
|
121
|
+
trProperties: function() {
|
122
|
+
return _properties.trProperties;
|
123
|
+
},
|
124
|
+
videoProperties: function() {
|
125
|
+
return _properties.videoProperties;
|
126
|
+
}
|
127
|
+
});
|
128
|
+
const _clamp = require("./clamp");
|
129
|
+
const _getNativeElementProps = require("./getNativeElementProps");
|
130
|
+
const _getRTLSafeKey = require("./getRTLSafeKey");
|
131
|
+
const _mergeCallbacks = require("./mergeCallbacks");
|
132
|
+
const _omit = require("./omit");
|
133
|
+
const _properties = require("./properties");
|
134
|
+
const _isHTMLElement = require("./isHTMLElement");
|
135
|
+
const _isInteractiveHTMLElement = require("./isInteractiveHTMLElement");
|
136
|
+
const _priorityQueue = require("./priorityQueue");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export
|
1
|
+
{"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export { clamp } from './clamp';\nexport {\n // eslint-disable-next-line deprecation/deprecation\n getNativeElementProps,\n getPartitionedNativeProps,\n} from './getNativeElementProps';\nexport { getRTLSafeKey } from './getRTLSafeKey';\nexport { mergeCallbacks } from './mergeCallbacks';\nexport { omit } from './omit';\nexport {\n anchorProperties,\n audioProperties,\n baseElementEvents,\n baseElementProperties,\n buttonProperties,\n colGroupProperties,\n colProperties,\n dialogProperties,\n divProperties,\n fieldsetProperties,\n formProperties,\n getNativeProps,\n htmlElementProperties,\n iframeProperties,\n imgProperties,\n inputProperties,\n labelProperties,\n liProperties,\n microdataProperties,\n olProperties,\n optionProperties,\n selectProperties,\n tableProperties,\n tdProperties,\n textAreaProperties,\n thProperties,\n timeProperties,\n trProperties,\n videoProperties,\n} from './properties';\nexport { isHTMLElement } from './isHTMLElement';\nexport { isInteractiveHTMLElement } from './isInteractiveHTMLElement';\nexport type { PriorityQueue, PriorityQueueCompareFn } from './priorityQueue';\nexport { createPriorityQueue } from './priorityQueue';\n"],"names":["anchorProperties","audioProperties","baseElementEvents","baseElementProperties","buttonProperties","clamp","colGroupProperties","colProperties","createPriorityQueue","dialogProperties","divProperties","fieldsetProperties","formProperties","getNativeElementProps","getNativeProps","getPartitionedNativeProps","getRTLSafeKey","htmlElementProperties","iframeProperties","imgProperties","inputProperties","isHTMLElement","isInteractiveHTMLElement","labelProperties","liProperties","mergeCallbacks","microdataProperties","olProperties","omit","optionProperties","selectProperties","tableProperties","tdProperties","textAreaProperties","thProperties","timeProperties","trProperties","videoProperties"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAUEA,gBAAgB;eAAhBA,4BAAgB;;IAChBC,eAAe;eAAfA,2BAAe;;IACfC,iBAAiB;eAAjBA,6BAAiB;;IACjBC,qBAAqB;eAArBA,iCAAqB;;IACrBC,gBAAgB;eAAhBA,4BAAgB;;IAdTC,KAAK;eAALA,YAAK;;IAeZC,kBAAkB;eAAlBA,8BAAkB;;IAClBC,aAAa;eAAbA,yBAAa;;IA2BNC,mBAAmB;eAAnBA,kCAAmB;;IA1B1BC,gBAAgB;eAAhBA,4BAAgB;;IAChBC,aAAa;eAAbA,yBAAa;;IACbC,kBAAkB;eAAlBA,8BAAkB;;IAClBC,cAAc;eAAdA,0BAAc;;IAlBd,mDAAmD;IACnDC,qBAAqB;eAArBA,4CAAqB;;IAkBrBC,cAAc;eAAdA,0BAAc;;IAjBdC,yBAAyB;eAAzBA,gDAAyB;;IAElBC,aAAa;eAAbA,4BAAa;;IAgBpBC,qBAAqB;eAArBA,iCAAqB;;IACrBC,gBAAgB;eAAhBA,4BAAgB;;IAChBC,aAAa;eAAbA,yBAAa;;IACbC,eAAe;eAAfA,2BAAe;;IAeRC,aAAa;eAAbA,4BAAa;;IACbC,wBAAwB;eAAxBA,kDAAwB;;IAf/BC,eAAe;eAAfA,2BAAe;;IACfC,YAAY;eAAZA,wBAAY;;IApBLC,cAAc;eAAdA,8BAAc;;IAqBrBC,mBAAmB;eAAnBA,+BAAmB;;IACnBC,YAAY;eAAZA,wBAAY;;IArBLC,IAAI;eAAJA,UAAI;;IAsBXC,gBAAgB;eAAhBA,4BAAgB;;IAChBC,gBAAgB;eAAhBA,4BAAgB;;IAChBC,eAAe;eAAfA,2BAAe;;IACfC,YAAY;eAAZA,wBAAY;;IACZC,kBAAkB;eAAlBA,8BAAkB;;IAClBC,YAAY;eAAZA,wBAAY;;IACZC,cAAc;eAAdA,0BAAc;;IACdC,YAAY;eAAZA,wBAAY;;IACZC,eAAe;eAAfA,2BAAe;;;uBAtCK;uCAKf;+BACuB;gCACC;sBACV;4BA+Bd;+BACuB;0CACW;+BAEL"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["isHTMLElement.ts"],"sourcesContent":["/**\n * Verifies if a given node is an HTMLElement,\n * this method works seamlessly with frames and elements from different documents\n *\n * This is preferred over simply using `instanceof`.\n * Since `instanceof` might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)\n *\n * @example\n * ```ts\n * isHTMLElement(event.target) && event.target.focus()\n * isHTMLElement(event.target, {constructorName: 'HTMLInputElement'}) && event.target.value // some value\n * ```\n *\n */\nexport function isHTMLElement<ConstructorName extends HTMLElementConstructorName = 'HTMLElement'>(\n element?: unknown,\n options?: {\n /**\n * Can be used to provide a custom constructor instead of `HTMLElement`,\n * Like `HTMLInputElement` for example.\n */\n constructorName?: ConstructorName;\n },\n): element is InstanceType<(typeof globalThis)[ConstructorName]> {\n const typedElement = element as Node | null | undefined;\n return Boolean(\n typedElement?.ownerDocument?.defaultView &&\n typedElement instanceof typedElement.ownerDocument.defaultView[options?.constructorName ?? 'HTMLElement'],\n );\n}\n\ntype HTMLElementConstructorName =\n | 'HTMLElement'\n | 'HTMLAnchorElement'\n | 'HTMLAreaElement'\n | 'HTMLAudioElement'\n | 'HTMLBaseElement'\n | 'HTMLBodyElement'\n | 'HTMLBRElement'\n | 'HTMLButtonElement'\n | 'HTMLCanvasElement'\n | 'HTMLDataElement'\n | 'HTMLDataListElement'\n | 'HTMLDetailsElement'\n // NOTE: dialog is not supported in safari 14, also it was removed from lib-dom starting typescript 4.4\n // | 'HTMLDialogElement'\n | 'HTMLDivElement'\n | 'HTMLDListElement'\n | 'HTMLEmbedElement'\n | 'HTMLFieldSetElement'\n | 'HTMLFormElement'\n | 'HTMLHeadingElement'\n | 'HTMLHeadElement'\n | 'HTMLHRElement'\n | 'HTMLHtmlElement'\n | 'HTMLIFrameElement'\n | 'HTMLImageElement'\n | 'HTMLInputElement'\n | 'HTMLModElement'\n | 'HTMLLabelElement'\n | 'HTMLLegendElement'\n | 'HTMLLIElement'\n | 'HTMLLinkElement'\n | 'HTMLMapElement'\n | 'HTMLMetaElement'\n | 'HTMLMeterElement'\n | 'HTMLObjectElement'\n | 'HTMLOListElement'\n | 'HTMLOptGroupElement'\n | 'HTMLOptionElement'\n | 'HTMLOutputElement'\n | 'HTMLParagraphElement'\n | 'HTMLParamElement'\n | 'HTMLPreElement'\n | 'HTMLProgressElement'\n | 'HTMLQuoteElement'\n | 'HTMLSlotElement'\n | 'HTMLScriptElement'\n | 'HTMLSelectElement'\n | 'HTMLSourceElement'\n | 'HTMLSpanElement'\n | 'HTMLStyleElement'\n | 'HTMLTableElement'\n | 'HTMLTableColElement'\n | 'HTMLTableRowElement'\n | 'HTMLTableSectionElement'\n | 'HTMLTemplateElement'\n | 'HTMLTextAreaElement'\n | 'HTMLTimeElement'\n | 'HTMLTitleElement'\n | 'HTMLTrackElement'\n | 'HTMLUListElement'\n | 'HTMLVideoElement';\n"],"names":["isHTMLElement","element","options","typedElement","Boolean","ownerDocument","defaultView","constructorName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;;;;;;;;CAaC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,cACdC,OAAiB,EACjBC,OAMC;QAICC;IAFF,MAAMA,eAAeF;QAG8CC;IAFnE,OAAOE,QACLD,CAAAA,
|
1
|
+
{"version":3,"sources":["../src/utils/isHTMLElement.ts"],"sourcesContent":["/**\n * Verifies if a given node is an HTMLElement,\n * this method works seamlessly with frames and elements from different documents\n *\n * This is preferred over simply using `instanceof`.\n * Since `instanceof` might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)\n *\n * @example\n * ```ts\n * isHTMLElement(event.target) && event.target.focus()\n * isHTMLElement(event.target, {constructorName: 'HTMLInputElement'}) && event.target.value // some value\n * ```\n *\n */\nexport function isHTMLElement<ConstructorName extends HTMLElementConstructorName = 'HTMLElement'>(\n element?: unknown,\n options?: {\n /**\n * Can be used to provide a custom constructor instead of `HTMLElement`,\n * Like `HTMLInputElement` for example.\n */\n constructorName?: ConstructorName;\n },\n): element is InstanceType<(typeof globalThis)[ConstructorName]> {\n const typedElement = element as Node | null | undefined;\n return Boolean(\n typedElement?.ownerDocument?.defaultView &&\n typedElement instanceof typedElement.ownerDocument.defaultView[options?.constructorName ?? 'HTMLElement'],\n );\n}\n\ntype HTMLElementConstructorName =\n | 'HTMLElement'\n | 'HTMLAnchorElement'\n | 'HTMLAreaElement'\n | 'HTMLAudioElement'\n | 'HTMLBaseElement'\n | 'HTMLBodyElement'\n | 'HTMLBRElement'\n | 'HTMLButtonElement'\n | 'HTMLCanvasElement'\n | 'HTMLDataElement'\n | 'HTMLDataListElement'\n | 'HTMLDetailsElement'\n // NOTE: dialog is not supported in safari 14, also it was removed from lib-dom starting typescript 4.4\n // | 'HTMLDialogElement'\n | 'HTMLDivElement'\n | 'HTMLDListElement'\n | 'HTMLEmbedElement'\n | 'HTMLFieldSetElement'\n | 'HTMLFormElement'\n | 'HTMLHeadingElement'\n | 'HTMLHeadElement'\n | 'HTMLHRElement'\n | 'HTMLHtmlElement'\n | 'HTMLIFrameElement'\n | 'HTMLImageElement'\n | 'HTMLInputElement'\n | 'HTMLModElement'\n | 'HTMLLabelElement'\n | 'HTMLLegendElement'\n | 'HTMLLIElement'\n | 'HTMLLinkElement'\n | 'HTMLMapElement'\n | 'HTMLMetaElement'\n | 'HTMLMeterElement'\n | 'HTMLObjectElement'\n | 'HTMLOListElement'\n | 'HTMLOptGroupElement'\n | 'HTMLOptionElement'\n | 'HTMLOutputElement'\n | 'HTMLParagraphElement'\n | 'HTMLParamElement'\n | 'HTMLPreElement'\n | 'HTMLProgressElement'\n | 'HTMLQuoteElement'\n | 'HTMLSlotElement'\n | 'HTMLScriptElement'\n | 'HTMLSelectElement'\n | 'HTMLSourceElement'\n | 'HTMLSpanElement'\n | 'HTMLStyleElement'\n | 'HTMLTableElement'\n | 'HTMLTableColElement'\n | 'HTMLTableRowElement'\n | 'HTMLTableSectionElement'\n | 'HTMLTemplateElement'\n | 'HTMLTextAreaElement'\n | 'HTMLTimeElement'\n | 'HTMLTitleElement'\n | 'HTMLTrackElement'\n | 'HTMLUListElement'\n | 'HTMLVideoElement';\n"],"names":["isHTMLElement","element","options","typedElement","Boolean","ownerDocument","defaultView","constructorName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;;;;;;;;CAaC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,cACdC,OAAiB,EACjBC,OAMC;QAICC;IAFF,MAAMA,eAAeF;QAG8CC;IAFnE,OAAOE,QACLD,CAAAA,yBAAAA,oCAAAA,8BAAAA,aAAcE,aAAa,cAA3BF,kDAAAA,4BAA6BG,WAAW,KACtCH,wBAAwBA,aAAaE,aAAa,CAACC,WAAW,CAACJ,CAAAA,2BAAAA,oBAAAA,8BAAAA,QAASK,eAAe,cAAxBL,sCAAAA,2BAA4B,cAAc;AAE/G"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["isInteractiveHTMLElement.ts"],"sourcesContent":["import { isHTMLElement } from './isHTMLElement';\n\n/**\n * @internal\n * Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys\n */\nexport function isInteractiveHTMLElement(element: unknown) {\n if (!isHTMLElement(element)) {\n return false;\n }\n\n const { tagName } = element;\n switch (tagName) {\n case 'BUTTON':\n case 'A':\n case 'INPUT':\n case 'TEXTAREA':\n return true;\n }\n\n return element.isContentEditable;\n}\n"],"names":["isInteractiveHTMLElement","element","isHTMLElement","tagName","isContentEditable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAMgBA;;;eAAAA;;;+BANc;AAMvB,SAASA,yBAAyBC,OAAgB;IACvD,IAAI,CAACC,IAAAA,
|
1
|
+
{"version":3,"sources":["../src/utils/isInteractiveHTMLElement.ts"],"sourcesContent":["import { isHTMLElement } from './isHTMLElement';\n\n/**\n * @internal\n * Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys\n */\nexport function isInteractiveHTMLElement(element: unknown) {\n if (!isHTMLElement(element)) {\n return false;\n }\n\n const { tagName } = element;\n switch (tagName) {\n case 'BUTTON':\n case 'A':\n case 'INPUT':\n case 'TEXTAREA':\n return true;\n }\n\n return element.isContentEditable;\n}\n"],"names":["isInteractiveHTMLElement","element","isHTMLElement","tagName","isContentEditable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAMgBA;;;eAAAA;;;+BANc;AAMvB,SAASA,yBAAyBC,OAAgB;IACvD,IAAI,CAACC,IAAAA,4BAAa,EAACD,UAAU;QAC3B,OAAO;IACT;IAEA,MAAM,EAAEE,OAAO,EAAE,GAAGF;IACpB,OAAQE;QACN,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;YACH,OAAO;IACX;IAEA,OAAOF,QAAQG,iBAAiB;AAClC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["mergeCallbacks.ts"],"sourcesContent":["/**\n * @internal\n * Combine two event callbacks into a single callback function that calls each one in order.\n *\n * Usage example:\n * ```ts\n * state.slot.onChange = mergeCallbacks(state.slot.onChange, ev => {\n * // Handle onChange\n * });\n * ```\n *\n * The primary use is to avoid the need to capture an existing callback (`state.slot.onChange` in the example) to a\n * local variable before replacing with a new listener that calls the existing one. This helps avoid bugs like:\n * * Infinite recursion by calling the re-assigned state.slot.onChange if it's not captured to a local variable.\n * * Missing a call to the original onChange due to an early return or other conditional.\n *\n * If you need a callback that is stable between renders, wrap the result in {@link useEventCallback}.\n *\n * @param callback1 - The first callback to be called, or undefined\n * @param callback2 - The second callback to be called, or undefined\n *\n * @returns A function that that calls the provided functions in order\n */\nexport function mergeCallbacks<Args extends unknown[]>(\n callback1: ((...args: Args) => void) | undefined,\n callback2: ((...args: Args) => void) | undefined,\n) {\n return (...args: Args) => {\n callback1?.(...args);\n callback2?.(...args);\n };\n}\n"],"names":["mergeCallbacks","callback1","callback2","args"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;CAsBC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,eACdC,SAAgD,EAChDC,SAAgD;IAEhD,OAAO,CAAC,GAAGC;QACTF,
|
1
|
+
{"version":3,"sources":["../src/utils/mergeCallbacks.ts"],"sourcesContent":["/**\n * @internal\n * Combine two event callbacks into a single callback function that calls each one in order.\n *\n * Usage example:\n * ```ts\n * state.slot.onChange = mergeCallbacks(state.slot.onChange, ev => {\n * // Handle onChange\n * });\n * ```\n *\n * The primary use is to avoid the need to capture an existing callback (`state.slot.onChange` in the example) to a\n * local variable before replacing with a new listener that calls the existing one. This helps avoid bugs like:\n * * Infinite recursion by calling the re-assigned state.slot.onChange if it's not captured to a local variable.\n * * Missing a call to the original onChange due to an early return or other conditional.\n *\n * If you need a callback that is stable between renders, wrap the result in {@link useEventCallback}.\n *\n * @param callback1 - The first callback to be called, or undefined\n * @param callback2 - The second callback to be called, or undefined\n *\n * @returns A function that that calls the provided functions in order\n */\nexport function mergeCallbacks<Args extends unknown[]>(\n callback1: ((...args: Args) => void) | undefined,\n callback2: ((...args: Args) => void) | undefined,\n) {\n return (...args: Args) => {\n callback1?.(...args);\n callback2?.(...args);\n };\n}\n"],"names":["mergeCallbacks","callback1","callback2","args"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;CAsBC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,eACdC,SAAgD,EAChDC,SAAgD;IAEhD,OAAO,CAAC,GAAGC;QACTF,sBAAAA,gCAAAA,aAAeE;QACfD,sBAAAA,gCAAAA,aAAeC;IACjB;AACF"}
|
@@ -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"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;;;;;;;CAYC,GACD,8DAA8D;;;;;+BAC9CA;;;eAAAA;;;AAAT,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
|
+
{"version":3,"sources":["../src/utils/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"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;;;;;;;CAYC,GACD,8DAA8D;;;;;+BAC9CA;;;eAAAA;;;AAAT,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"],"rangeMappings":"
|
1
|
+
{"version":3,"sources":["../src/utils/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"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;CAEC;;;;+BAsBeA;;;eAAAA;;;AAAT,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"}
|
@@ -374,7 +374,8 @@ const dialogProperties = toObjectMap(htmlElementProperties, [
|
|
374
374
|
'onClose'
|
375
375
|
]);
|
376
376
|
const divProperties = htmlElementProperties;
|
377
|
-
function getNativeProps(
|
377
|
+
function getNativeProps(// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
378
|
+
props, allowedPropNames, excludedPropNames) {
|
378
379
|
// It'd be great to properly type this while allowing 'aria-` and 'data-' attributes like TypeScript does for
|
379
380
|
// JSX attributes, but that ability is hardcoded into the TS compiler with no analog in TypeScript typings.
|
380
381
|
// Then we'd be able to enforce props extends native props (including aria- and data- attributes), and then
|
@@ -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":["anchorProperties","audioProperties","baseElementEvents","baseElementProperties","buttonProperties","colGroupProperties","colProperties","dialogProperties","divProperties","fieldsetProperties","formProperties","getNativeProps","htmlElementProperties","iframeProperties","imgProperties","inputProperties","labelProperties","liProperties","microdataProperties","olProperties","optionProperties","selectProperties","tableProperties","tdProperties","textAreaProperties","thProperties","timeProperties","trProperties","videoProperties","toObjectMap","items","result","item","keys","Array","isArray","Object","key","props","allowedPropNames","excludedPropNames","isNativeProp","indexOf"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA6MaA,gBAAAA;eAAAA;;IAzCAC,eAAAA;eAAAA;;IAjJAC,iBAAAA;eAAAA;;IA0FAC,qBAAAA;eAAAA;;IAwHAC,gBAAAA;eAAAA;;IAuHAC,kBAAAA;eAAAA;;IAIAC,aAAAA;eAAAA;;IAqEAC,gBAAAA;eAAAA;;IAOAC,aAAAA;eAAAA;;IAnEAC,kBAAAA;eAAAA;;IAUAC,cAAAA;eAAAA;;IA2EGC,cAAAA;eAAAA;;IA1SHC,qBAAAA;eAAAA;;IA8OAC,gBAAAA;eAAAA;;IAoBAC,aAAAA;eAAAA;;IA/JAC,eAAAA;eAAAA;;IA5FAC,eAAAA;eAAAA;;IAyCAC,YAAAA;eAAAA;;IA7DAC,mBAAAA;eAAAA;;IAoDAC,YAAAA;eAAAA;;IAoHAC,gBAAAA;eAAAA;;IANAC,gBAAAA;eAAAA;;IAgBAC,eAAAA;eAAAA;;IA4BAC,YAAAA;eAAAA;;IA9DAC,kBAAAA;eAAAA;;IAmDAC,YAAAA;eAAAA;;IA9GAC,cAAAA;eAAAA;;IAuGAC,YAAAA;eAAAA;;IAjJAC,eAAAA;eAAAA;;;AAlLb,MAAMC,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;AAOO,MAAM7B,oBAAoB2B,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;AAOM,MAAM1B,wBAAwB0B,YAAY;IAC/C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAOM,MAAMX,sBAAsBW,YAAY;IAC7C;IACA;IACA;IACA;IACA;CACD;AAOM,MAAMjB,wBAAwBiB,YAAY1B,uBAAuBD,mBAAmBgB;AAOpF,MAAMF,kBAAkBa,YAAYjB,uBAAuB;IAChE;CACD;AAOM,MAAMX,kBAAkB4B,YAAYjB,uBAAuB;IAChE;IACA;IACA;IACA;IACA;IACA;CACD;AAOM,MAAMgB,kBAAkBC,YAAY5B,iBAAiB;IAC1D;CACD;AAOM,MAAMkB,eAAeU,YAAYjB,uBAAuB;IAC7D;CACD;AAOM,MAAMK,eAAeY,YAAYjB,uBAAuB;IAC7D;CACD;AAOM,MAAMZ,mBAAmB6B,YAAYjB,uBAAuB;IACjE;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAOM,MAAMc,iBAAiBG,YAAYjB,uBAAuB;IAC/D;CACD;AAOM,MAAMR,mBAAmByB,YAAYjB,uBAAuB;IACjE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAOM,MAAMG,kBAAkBc,YAAYzB,kBAAkB;IAC3D;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAOM,MAAMoB,qBAAqBK,YAAYzB,kBAAkB;IAC9D;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAOM,MAAMiB,mBAAmBQ,YAAYzB,kBAAkB;IAC5D;IACA;IACA;CACD;AAEM,MAAMgB,mBAAmBS,YAAYjB,uBAAuB;IACjE;IACA;CACD;AAOM,MAAMU,kBAAkBO,YAAYjB,uBAAuB;IAChE;IACA;CACD;AAOM,MAAMe,eAAef;AAOrB,MAAMa,eAAeI,YAAYjB,uBAAuB;IAC7D;IACA;IACA;CACD;AAOM,MAAMW,eAAeM,YAAYjB,uBAAuB;IAC7D;IACA;IACA;IACA;CACD;AAEM,MAAMP,qBAAqBwB,YAAYjB,uBAAuB;IACnE;CACD;AAEM,MAAMN,gBAAgBuB,YAAYjB,uBAAuB;IAC9D;CACD;AAOM,MAAMH,qBAAqBoB,YAAYjB,uBAAuB;IACnE;IACA;CACD;AAOM,MAAMF,iBAAiBmB,YAAYjB,uBAAuB;IAC/D;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAOM,MAAMC,mBAAmBgB,YAAYjB,uBAAuB;IACjE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAOM,MAAME,gBAAgBe,YAAYjB,uBAAuB;IAC9D;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAOM,MAAML,mBAAmBsB,YAAYjB,uBAAuB;IAAC;IAAQ;IAAY;CAAU;AAO3F,MAAMJ,gBAAgBI;AAkBtB,SAASD,eAEd2B,KAA0B,EAC1BC,gBAAmD,EACnDC,iBAA4B;IAE5B,6GAA6G;IAC7G,2GAA2G;IAC3G,2GAA2G;IAC3G,uBAAuB;IACvB,0GAA0G;IAE1G,MAAML,UAAUD,MAAMC,OAAO,CAACI;IAC9B,8DAA8D;IAC9D,MAAMR,SAA8B,CAAC;IACrC,MAAME,OAAOG,OAAOH,IAAI,CAACK;IAEzB,KAAK,MAAMD,OAAOJ,KAAM;QACtB,MAAMQ,eACJ,CAAEN,WAAWI,gBAA4C,CAACF,IAAI,IAC7DF,WAAWI,iBAA+BG,OAAO,CAACL,QAAQ,KAC3DA,IAAIK,OAAO,CAAC,aAAa,KACzBL,IAAIK,OAAO,CAAC,aAAa;QAE3B,IAAID,gBAAiB,CAAA,CAACD,qBAAqBA,CAAAA,sBAAAA,QAAAA,sBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,kBAAmBE,OAAO,CAACL,IAAAA,MAAS,CAAC,CAAA,GAAI;YAClF,8DAA8D;YAC9DN,MAAM,CAACM,IAAI,GAAGC,KAAM,CAACD,IAAI;QAC3B;IACF;IAEA,OAAON;AACT"}
|
1
|
+
{"version":3,"sources":["../src/utils/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":["anchorProperties","audioProperties","baseElementEvents","baseElementProperties","buttonProperties","colGroupProperties","colProperties","dialogProperties","divProperties","fieldsetProperties","formProperties","getNativeProps","htmlElementProperties","iframeProperties","imgProperties","inputProperties","labelProperties","liProperties","microdataProperties","olProperties","optionProperties","selectProperties","tableProperties","tdProperties","textAreaProperties","thProperties","timeProperties","trProperties","videoProperties","toObjectMap","items","result","item","keys","Array","isArray","Object","key","props","allowedPropNames","excludedPropNames","isNativeProp","indexOf"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA6MaA,gBAAgB;eAAhBA;;IAzCAC,eAAe;eAAfA;;IAjJAC,iBAAiB;eAAjBA;;IA0FAC,qBAAqB;eAArBA;;IAwHAC,gBAAgB;eAAhBA;;IAuHAC,kBAAkB;eAAlBA;;IAIAC,aAAa;eAAbA;;IAqEAC,gBAAgB;eAAhBA;;IAOAC,aAAa;eAAbA;;IAnEAC,kBAAkB;eAAlBA;;IAUAC,cAAc;eAAdA;;IA2EGC,cAAc;eAAdA;;IA1SHC,qBAAqB;eAArBA;;IA8OAC,gBAAgB;eAAhBA;;IAoBAC,aAAa;eAAbA;;IA/JAC,eAAe;eAAfA;;IA5FAC,eAAe;eAAfA;;IAyCAC,YAAY;eAAZA;;IA7DAC,mBAAmB;eAAnBA;;IAoDAC,YAAY;eAAZA;;IAoHAC,gBAAgB;eAAhBA;;IANAC,gBAAgB;eAAhBA;;IAgBAC,eAAe;eAAfA;;IA4BAC,YAAY;eAAZA;;IA9DAC,kBAAkB;eAAlBA;;IAmDAC,YAAY;eAAZA;;IA9GAC,cAAc;eAAdA;;IAuGAC,YAAY;eAAZA;;IAjJAC,eAAe;eAAfA;;;AAlLb,MAAMC,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;AAOO,MAAM7B,oBAAoB2B,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;AAOM,MAAM1B,wBAAwB0B,YAAY;IAC/C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAOM,MAAMX,sBAAsBW,YAAY;IAC7C;IACA;IACA;IACA;IACA;CACD;AAOM,MAAMjB,wBAAwBiB,YAAY1B,uBAAuBD,mBAAmBgB;AAOpF,MAAMF,kBAAkBa,YAAYjB,uBAAuB;IAChE;CACD;AAOM,MAAMX,kBAAkB4B,YAAYjB,uBAAuB;IAChE;IACA;IACA;IACA;IACA;IACA;CACD;AAOM,MAAMgB,kBAAkBC,YAAY5B,iBAAiB;IAC1D;CACD;AAOM,MAAMkB,eAAeU,YAAYjB,uBAAuB;IAC7D;CACD;AAOM,MAAMK,eAAeY,YAAYjB,uBAAuB;IAC7D;CACD;AAOM,MAAMZ,mBAAmB6B,YAAYjB,uBAAuB;IACjE;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAOM,MAAMc,iBAAiBG,YAAYjB,uBAAuB;IAC/D;CACD;AAOM,MAAMR,mBAAmByB,YAAYjB,uBAAuB;IACjE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAOM,MAAMG,kBAAkBc,YAAYzB,kBAAkB;IAC3D;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAOM,MAAMoB,qBAAqBK,YAAYzB,kBAAkB;IAC9D;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAOM,MAAMiB,mBAAmBQ,YAAYzB,kBAAkB;IAC5D;IACA;IACA;CACD;AAEM,MAAMgB,mBAAmBS,YAAYjB,uBAAuB;IACjE;IACA;CACD;AAOM,MAAMU,kBAAkBO,YAAYjB,uBAAuB;IAChE;IACA;CACD;AAOM,MAAMe,eAAef;AAOrB,MAAMa,eAAeI,YAAYjB,uBAAuB;IAC7D;IACA;IACA;CACD;AAOM,MAAMW,eAAeM,YAAYjB,uBAAuB;IAC7D;IACA;IACA;IACA;CACD;AAEM,MAAMP,qBAAqBwB,YAAYjB,uBAAuB;IACnE;CACD;AAEM,MAAMN,gBAAgBuB,YAAYjB,uBAAuB;IAC9D;CACD;AAOM,MAAMH,qBAAqBoB,YAAYjB,uBAAuB;IACnE;IACA;CACD;AAOM,MAAMF,iBAAiBmB,YAAYjB,uBAAuB;IAC/D;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAOM,MAAMC,mBAAmBgB,YAAYjB,uBAAuB;IACjE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAOM,MAAME,gBAAgBe,YAAYjB,uBAAuB;IAC9D;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAOM,MAAML,mBAAmBsB,YAAYjB,uBAAuB;IAAC;IAAQ;IAAY;CAAU;AAO3F,MAAMJ,gBAAgBI;AAkBtB,SAASD,eACd,8DAA8D;AAC9D2B,KAA0B,EAC1BC,gBAAmD,EACnDC,iBAA4B;IAE5B,6GAA6G;IAC7G,2GAA2G;IAC3G,2GAA2G;IAC3G,uBAAuB;IACvB,0GAA0G;IAE1G,MAAML,UAAUD,MAAMC,OAAO,CAACI;IAC9B,8DAA8D;IAC9D,MAAMR,SAA8B,CAAC;IACrC,MAAME,OAAOG,OAAOH,IAAI,CAACK;IAEzB,KAAK,MAAMD,OAAOJ,KAAM;QACtB,MAAMQ,eACJ,AAAC,CAACN,WAAW,AAACI,gBAA2C,CAACF,IAAI,IAC7DF,WAAW,AAACI,iBAA8BG,OAAO,CAACL,QAAQ,KAC3DA,IAAIK,OAAO,CAAC,aAAa,KACzBL,IAAIK,OAAO,CAAC,aAAa;QAE3B,IAAID,gBAAiB,CAAA,CAACD,qBAAqBA,CAAAA,8BAAAA,wCAAAA,kBAAmBE,OAAO,CAACL,UAAS,CAAC,CAAA,GAAI;YAClF,8DAA8D;YAC9DN,MAAM,CAACM,IAAI,GAAGC,KAAM,CAACD,IAAI;QAC3B;IACF;IAEA,OAAON;AACT"}
|
@@ -18,10 +18,7 @@
|
|
18
18
|
// Since every single Omit clause in this case is being applied to a single union member there's no conflicts on keyof evaluation and in the second clause Omit<{ b: string }, 'a'> becomes { b: string },
|
19
19
|
// so the result is {} | { b: string }, as expected.
|
20
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
21
|
-
|
22
|
-
* @internal
|
23
|
-
* If type T includes `null`, remove it and add `undefined` instead.
|
24
|
-
*/ "use strict";
|
21
|
+
"use strict";
|
25
22
|
Object.defineProperty(exports, "__esModule", {
|
26
23
|
value: true
|
27
24
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["types.ts"],"sourcesContent":["/**\n * Helper type that works similar to Omit,\n * but when modifying an union type it will distribute the omission to all the union members.\n *\n * See [distributive conditional types](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types) for more information\n */\n// Traditional Omit is basically equivalent to => Pick<T, Exclude<keyof T, K>>\n//\n// let's say we have Omit<{ a: string } | { b: string }, 'a'>\n// equivalent to: Pick<{ a: string } | { b: string }, Exclude<keyof ({ a: string } | { b: string }), 'a'>>\n// The expected result would be {} | { b: string }, the omission of 'a' from all the union members,\n// but keyof ({ a: string } | { b: string }) is never as they don't share common keys\n// so Exclude<never, 'a'> is never,\n// and Pick<{ a: string } | { b: string }, never> is {}.\n//\n// With DistributiveOmit on the other hand it becomes like this:\n// DistributiveOmit<{ a: string } | { b: string }, 'a'>\n// equivalent to: Omit<{ a: string }, 'a'> | Omit<{ b: string }, 'a'>\n// Since every single Omit clause in this case is being applied to a single union member there's no conflicts on keyof evaluation and in the second clause Omit<{ b: string }, 'a'> becomes { b: string },\n// so the result is {} | { b: string }, as expected.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : T;\n\n/**\n * Converts a union type (`A | B | C`) to an intersection type (`A & B & C`)\n */\nexport type UnionToIntersection<U> = (U extends unknown ? (x: U) => U : never) extends (x: infer I) => U ? I : never;\n\n/**\n * @internal\n * If type T includes `null`, remove it and add `undefined` instead.\n */\nexport type ReplaceNullWithUndefined<T> = T extends null ? Exclude<T, null> | undefined : T;\n"],"names":[],"rangeMappings":"
|
1
|
+
{"version":3,"sources":["../src/utils/types.ts"],"sourcesContent":["/**\n * Helper type that works similar to Omit,\n * but when modifying an union type it will distribute the omission to all the union members.\n *\n * See [distributive conditional types](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types) for more information\n */\n// Traditional Omit is basically equivalent to => Pick<T, Exclude<keyof T, K>>\n//\n// let's say we have Omit<{ a: string } | { b: string }, 'a'>\n// equivalent to: Pick<{ a: string } | { b: string }, Exclude<keyof ({ a: string } | { b: string }), 'a'>>\n// The expected result would be {} | { b: string }, the omission of 'a' from all the union members,\n// but keyof ({ a: string } | { b: string }) is never as they don't share common keys\n// so Exclude<never, 'a'> is never,\n// and Pick<{ a: string } | { b: string }, never> is {}.\n//\n// With DistributiveOmit on the other hand it becomes like this:\n// DistributiveOmit<{ a: string } | { b: string }, 'a'>\n// equivalent to: Omit<{ a: string }, 'a'> | Omit<{ b: string }, 'a'>\n// Since every single Omit clause in this case is being applied to a single union member there's no conflicts on keyof evaluation and in the second clause Omit<{ b: string }, 'a'> becomes { b: string },\n// so the result is {} | { b: string }, as expected.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : T;\n\n/**\n * Converts a union type (`A | B | C`) to an intersection type (`A & B & C`)\n */\nexport type UnionToIntersection<U> = (U extends unknown ? (x: U) => U : never) extends (x: infer I) => U ? I : never;\n\n/**\n * @internal\n * If type T includes `null`, remove it and add `undefined` instead.\n */\nexport type ReplaceNullWithUndefined<T> = T extends null ? Exclude<T, null> | undefined : T;\n"],"names":[],"rangeMappings":";;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;CAKC,GACD,8EAA8E;AAC9E,EAAE;AACF,6DAA6D;AAC7D,0GAA0G;AAC1G,mGAAmG;AACnG,qFAAqF;AACrF,oCAAoC;AACpC,wDAAwD;AACxD,EAAE;AACF,gEAAgE;AAChE,uDAAuD;AACvD,qEAAqE;AACrE,0MAA0M;AAC1M,oDAAoD;AACpD,8DAA8D"}
|
@@ -1 +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":["elementContains","parent","child","set","WeakSet","nextParent","getParent","skipVirtual","has","add"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASgBA;;;eAAAA;;;2BATU;AASnB,SAASA,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,aAA0BC,IAAAA,
|
1
|
+
{"version":3,"sources":["../src/virtualParent/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":["elementContains","parent","child","set","WeakSet","nextParent","getParent","skipVirtual","has","add"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASgBA;;;eAAAA;;;2BATU;AASnB,SAASA,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,aAA0BC,IAAAA,oBAAS,EAACJ,OAAO;gBAC/CK,aAAaJ,IAAIK,GAAG,CAACN;YACvB;YACAC,IAAIM,GAAG,CAACP;YAER,IAAIG,eAAeJ,QAAQ;gBACzB,OAAO;YACT;YAEAC,QAAQG;QACV;IACF;IAEA,OAAO;AACT"}
|