@fluentui/react-utilities 9.6.2 → 9.7.0
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.json +16 -1
- package/CHANGELOG.md +11 -2
- package/dist/index.d.ts +5 -1
- package/lib/utils/isHTMLElement.js +3 -3
- package/lib/utils/isHTMLElement.js.map +1 -1
- package/lib-amd/utils/isHTMLElement.js +4 -5
- package/lib-amd/utils/isHTMLElement.js.map +1 -1
- package/lib-commonjs/utils/isHTMLElement.js +3 -3
- package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,22 @@
|
|
2
2
|
"name": "@fluentui/react-utilities",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Mon, 13 Mar 2023 08:55:02 GMT",
|
6
|
+
"tag": "@fluentui/react-utilities_v9.7.0",
|
7
|
+
"version": "9.7.0",
|
8
|
+
"comments": {
|
9
|
+
"minor": [
|
10
|
+
{
|
11
|
+
"author": "bernardo.sunderhus@gmail.com",
|
12
|
+
"package": "@fluentui/react-utilities",
|
13
|
+
"commit": "edf96a6b5d6f13843ada1400480e347b84384b8e",
|
14
|
+
"comment": "feat: isHTMLElement to support all HTMLElement classes"
|
15
|
+
}
|
16
|
+
]
|
17
|
+
}
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"date": "Fri, 10 Mar 2023 07:14:01 GMT",
|
6
21
|
"tag": "@fluentui/react-utilities_v9.6.2",
|
7
22
|
"version": "9.6.2",
|
8
23
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,21 @@
|
|
1
1
|
# Change Log - @fluentui/react-utilities
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Mon, 13 Mar 2023 08:55:02 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.7.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.7.0)
|
8
|
+
|
9
|
+
Mon, 13 Mar 2023 08:55:02 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.6.2..@fluentui/react-utilities_v9.7.0)
|
11
|
+
|
12
|
+
### Minor changes
|
13
|
+
|
14
|
+
- feat: isHTMLElement to support all HTMLElement classes ([PR #27161](https://github.com/microsoft/fluentui/pull/27161) by bernardo.sunderhus@gmail.com)
|
15
|
+
|
7
16
|
## [9.6.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.6.2)
|
8
17
|
|
9
|
-
Fri, 10 Mar 2023 07:
|
18
|
+
Fri, 10 Mar 2023 07:14:01 GMT
|
10
19
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.6.1..@fluentui/react-utilities_v9.6.2)
|
11
20
|
|
12
21
|
### Patches
|
package/dist/index.d.ts
CHANGED
@@ -181,6 +181,8 @@ export declare function getTriggerChild<TriggerChildProps>(children: TriggerProp
|
|
181
181
|
ref?: React_2.Ref<any>;
|
182
182
|
}) | null;
|
183
183
|
|
184
|
+
declare type HTMLElementConstructorName = 'HTMLElement' | 'HTMLAnchorElement' | 'HTMLAreaElement' | 'HTMLAudioElement' | 'HTMLBaseElement' | 'HTMLBodyElement' | 'HTMLBRElement' | 'HTMLButtonElement' | 'HTMLCanvasElement' | 'HTMLDataElement' | 'HTMLDataListElement' | 'HTMLDetailsElement' | 'HTMLDialogElement' | 'HTMLDivElement' | 'HTMLDListElement' | 'HTMLEmbedElement' | 'HTMLFieldSetElement' | 'HTMLFormElement' | 'HTMLHeadingElement' | 'HTMLHeadElement' | 'HTMLHRElement' | 'HTMLHtmlElement' | 'HTMLIFrameElement' | 'HTMLImageElement' | 'HTMLInputElement' | 'HTMLModElement' | 'HTMLLabelElement' | 'HTMLLegendElement' | 'HTMLLIElement' | 'HTMLLinkElement' | 'HTMLMapElement' | 'HTMLMetaElement' | 'HTMLMeterElement' | 'HTMLObjectElement' | 'HTMLOListElement' | 'HTMLOptGroupElement' | 'HTMLOptionElement' | 'HTMLOutputElement' | 'HTMLParagraphElement' | 'HTMLParamElement' | 'HTMLPreElement' | 'HTMLProgressElement' | 'HTMLQuoteElement' | 'HTMLSlotElement' | 'HTMLScriptElement' | 'HTMLSelectElement' | 'HTMLSourceElement' | 'HTMLSpanElement' | 'HTMLStyleElement' | 'HTMLTableElement' | 'HTMLTableColElement' | 'HTMLTableRowElement' | 'HTMLTableSectionElement' | 'HTMLTemplateElement' | 'HTMLTextAreaElement' | 'HTMLTimeElement' | 'HTMLTitleElement' | 'HTMLTrackElement' | 'HTMLUListElement' | 'HTMLVideoElement';
|
185
|
+
|
184
186
|
/**
|
185
187
|
* Allows to define a prefix that will be used for all IDs generated by useId() hook. It's useful to avoid collisions
|
186
188
|
* between different bundles.
|
@@ -210,7 +212,9 @@ export declare function isFluentTrigger(element: React_2.ReactElement): element
|
|
210
212
|
* might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)
|
211
213
|
*
|
212
214
|
*/
|
213
|
-
export declare function isHTMLElement(element?: unknown
|
215
|
+
export declare function isHTMLElement<ConstructorName extends HTMLElementConstructorName = 'HTMLElement'>(element?: unknown, options?: {
|
216
|
+
constructorName?: ConstructorName;
|
217
|
+
}): element is InstanceType<(typeof globalThis)[ConstructorName]>;
|
214
218
|
|
215
219
|
/**
|
216
220
|
* @internal
|
@@ -7,9 +7,9 @@
|
|
7
7
|
* might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)
|
8
8
|
*
|
9
9
|
*/
|
10
|
-
export function isHTMLElement(element) {
|
11
|
-
var _a;
|
10
|
+
export function isHTMLElement(element, options) {
|
11
|
+
var _a, _b;
|
12
12
|
const typedElement = element;
|
13
|
-
return Boolean(
|
13
|
+
return Boolean(((_a = typedElement === null || typedElement === void 0 ? void 0 : typedElement.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) && typedElement instanceof typedElement.ownerDocument.defaultView[(_b = options === null || options === void 0 ? void 0 : options.constructorName) !== null && _b !== void 0 ? _b : 'HTMLElement']);
|
14
14
|
}
|
15
15
|
//# sourceMappingURL=isHTMLElement.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isHTMLElement","element","typedElement","Boolean","_a","ownerDocument","defaultView","
|
1
|
+
{"version":3,"names":["isHTMLElement","element","options","typedElement","Boolean","_a","ownerDocument","defaultView","_b","constructorName"],"sources":["../src/packages/react-components/react-utilities/src/utils/isHTMLElement.ts"],"sourcesContent":["/**\n * @internal\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 required as simply using `instanceof`\n * 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 */\nexport function isHTMLElement<ConstructorName extends HTMLElementConstructorName = 'HTMLElement'>(\n element?: unknown,\n options?: { constructorName?: ConstructorName },\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 | '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"],"mappings":"AAAA;;;;;;;;;AASA,OAAM,SAAUA,aAAaA,CAC3BC,OAAiB,EACjBC,OAA+C;;EAE/C,MAAMC,YAAY,GAAGF,OAAkC;EACvD,OAAOG,OAAO,CACZ,EAAAC,EAAA,GAAAF,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEG,aAAa,cAAAD,EAAA,uBAAAA,EAAA,CAAEE,WAAW,KACtCJ,YAAY,YAAYA,YAAY,CAACG,aAAa,CAACC,WAAW,CAAC,CAAAC,EAAA,GAAAN,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEO,eAAe,cAAAD,EAAA,cAAAA,EAAA,GAAI,aAAa,CAAC,CAC5G;AACH"}
|
@@ -11,12 +11,11 @@ define(["require", "exports"], function (require, exports) {
|
|
11
11
|
* might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)
|
12
12
|
*
|
13
13
|
*/
|
14
|
-
function isHTMLElement(element) {
|
15
|
-
var _a;
|
14
|
+
function isHTMLElement(element, options) {
|
15
|
+
var _a, _b;
|
16
16
|
var typedElement = element;
|
17
|
-
return Boolean(typedElement
|
18
|
-
(
|
19
|
-
typedElement instanceof typedElement.ownerDocument.defaultView.HTMLElement);
|
17
|
+
return Boolean(((_a = typedElement === null || typedElement === void 0 ? void 0 : typedElement.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) &&
|
18
|
+
typedElement instanceof typedElement.ownerDocument.defaultView[(_b = options === null || options === void 0 ? void 0 : options.constructorName) !== null && _b !== void 0 ? _b : 'HTMLElement']);
|
20
19
|
}
|
21
20
|
exports.isHTMLElement = isHTMLElement;
|
22
21
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"isHTMLElement.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/isHTMLElement.ts"],"names":[],"mappings":";;;;IAAA;;;;;;;;OAQG;IACH,SAAgB,aAAa,
|
1
|
+
{"version":3,"file":"isHTMLElement.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/isHTMLElement.ts"],"names":[],"mappings":";;;;IAAA;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAC3B,OAAiB,EACjB,OAA+C;;QAE/C,IAAM,YAAY,GAAG,OAAkC,CAAC;QACxD,OAAO,OAAO,CACZ,CAAA,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,aAAa,0CAAE,WAAW;YACtC,YAAY,YAAY,YAAY,CAAC,aAAa,CAAC,WAAW,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,mCAAI,aAAa,CAAC,CAC5G,CAAC;IACJ,CAAC;IATD,sCASC","sourcesContent":["/**\n * @internal\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 required as simply using `instanceof`\n * 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 */\nexport function isHTMLElement<ConstructorName extends HTMLElementConstructorName = 'HTMLElement'>(\n element?: unknown,\n options?: { constructorName?: ConstructorName },\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 | '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"]}
|
@@ -13,10 +13,10 @@ exports.isHTMLElement = void 0;
|
|
13
13
|
* might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)
|
14
14
|
*
|
15
15
|
*/
|
16
|
-
function isHTMLElement(element) {
|
17
|
-
var _a;
|
16
|
+
function isHTMLElement(element, options) {
|
17
|
+
var _a, _b;
|
18
18
|
const typedElement = element;
|
19
|
-
return Boolean(
|
19
|
+
return Boolean(((_a = typedElement === null || typedElement === void 0 ? void 0 : typedElement.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) && typedElement instanceof typedElement.ownerDocument.defaultView[(_b = options === null || options === void 0 ? void 0 : options.constructorName) !== null && _b !== void 0 ? _b : 'HTMLElement']);
|
20
20
|
}
|
21
21
|
exports.isHTMLElement = isHTMLElement;
|
22
22
|
//# sourceMappingURL=isHTMLElement.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isHTMLElement","element","typedElement","Boolean","_a","ownerDocument","defaultView","
|
1
|
+
{"version":3,"names":["isHTMLElement","element","options","typedElement","Boolean","_a","ownerDocument","defaultView","_b","constructorName","exports"],"sources":["../src/packages/react-components/react-utilities/src/utils/isHTMLElement.ts"],"sourcesContent":["/**\n * @internal\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 required as simply using `instanceof`\n * 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 */\nexport function isHTMLElement<ConstructorName extends HTMLElementConstructorName = 'HTMLElement'>(\n element?: unknown,\n options?: { constructorName?: ConstructorName },\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 | '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"],"mappings":";;;;;;AAAA;;;;;;;;;AASA,SAAgBA,aAAaA,CAC3BC,OAAiB,EACjBC,OAA+C;;EAE/C,MAAMC,YAAY,GAAGF,OAAkC;EACvD,OAAOG,OAAO,CACZ,EAAAC,EAAA,GAAAF,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEG,aAAa,cAAAD,EAAA,uBAAAA,EAAA,CAAEE,WAAW,KACtCJ,YAAY,YAAYA,YAAY,CAACG,aAAa,CAACC,WAAW,CAAC,CAAAC,EAAA,GAAAN,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEO,eAAe,cAAAD,EAAA,cAAAA,EAAA,GAAI,aAAa,CAAC,CAC5G;AACH;AATAE,OAAA,CAAAV,aAAA,GAAAA,aAAA"}
|