first commit

This commit is contained in:
Stefan Hacker
2026-04-03 09:38:48 +02:00
commit 37ad745546
47450 changed files with 3120798 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
export type { IVirtualElement } from '@fluentui/dom-utilities';
+2
View File
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=IVirtualElement.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"IVirtualElement.js","sourceRoot":"../src/","sources":["dom/IVirtualElement.ts"],"names":[],"mappings":"","sourcesContent":["export type { IVirtualElement } from '@fluentui/dom-utilities';\n"]}
+4
View File
@@ -0,0 +1,4 @@
/**
* Verifies if an application can use DOM.
*/
export declare function canUseDOM(): boolean;
+12
View File
@@ -0,0 +1,12 @@
/**
* Verifies if an application can use DOM.
*/
export function canUseDOM() {
return (
// eslint-disable-next-line no-restricted-globals
typeof window !== 'undefined' &&
!!(
// eslint-disable-next-line no-restricted-globals, @typescript-eslint/no-deprecated
(window.document && window.document.createElement)));
}
//# sourceMappingURL=canUseDOM.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"canUseDOM.js","sourceRoot":"../src/","sources":["dom/canUseDOM.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,SAAS;IACvB,OAAO;IACL,iDAAiD;IACjD,OAAO,MAAM,KAAK,WAAW;QAC7B,CAAC,CAAC;QACA,mFAAmF;QACnF,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,CACnD,CACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Verifies if an application can use DOM.\n */\nexport function canUseDOM(): boolean {\n return (\n // eslint-disable-next-line no-restricted-globals\n typeof window !== 'undefined' &&\n !!(\n // eslint-disable-next-line no-restricted-globals, @typescript-eslint/no-deprecated\n (window.document && window.document.createElement)\n )\n );\n}\n"]}
+1
View File
@@ -0,0 +1 @@
export {};
+96
View File
@@ -0,0 +1,96 @@
import { portalContainsElement } from './portalContainsElement';
import { DATA_PORTAL_ATTRIBUTE, setPortalAttribute } from './setPortalAttribute';
import { elementContains } from './elementContains';
import { getParent } from './getParent';
var unattachedSvg = document.createElement('svg');
var unattachedDiv = document.createElement('div');
var parentDiv = document.createElement('div');
var childDiv = document.createElement('div');
parentDiv.appendChild(childDiv);
describe('elementContains', function () {
it('can find a child', function () {
expect(elementContains(parentDiv, childDiv)).toEqual(true);
});
it('can return false on an unattached child', function () {
expect(elementContains(parentDiv, unattachedDiv)).toEqual(false);
});
it('can return false on a null child', function () {
expect(elementContains(parentDiv, null)).toEqual(false);
});
it('can return false on a null parent', function () {
expect(elementContains(null, null)).toEqual(false);
});
it('can return false when parent is an svg', function () {
expect(elementContains(unattachedSvg, unattachedDiv)).toEqual(false);
});
});
describe('getParent', function () {
it('returns correct parent for inner SVG elements', function () {
var childSvg = document.createElement('svg');
var svgRectangle = document.createElement('rect');
childSvg.appendChild(svgRectangle);
parentDiv.appendChild(childSvg);
expect(getParent(svgRectangle)).toEqual(childSvg);
expect(getParent(childSvg)).toEqual(parentDiv);
});
});
describe('setPortalAttribute', function () {
it('sets attribute', function () {
var testDiv = document.createElement('div');
expect(testDiv.getAttribute(DATA_PORTAL_ATTRIBUTE)).toBeFalsy();
setPortalAttribute(testDiv);
expect(testDiv.getAttribute(DATA_PORTAL_ATTRIBUTE)).toBeTruthy();
});
});
describe('portalContainsElement', function () {
var root;
var leaf;
var parent;
var portal;
var unlinked;
beforeEach(function () {
root = document.createElement('div');
leaf = document.createElement('div');
parent = document.createElement('div');
portal = document.createElement('div');
unlinked = document.createElement('div');
setPortalAttribute(portal);
});
it('works with and without parent specified', function () {
root.appendChild(parent);
parent.appendChild(portal);
portal.appendChild(leaf);
expect(portalContainsElement(root)).toBeFalsy();
expect(portalContainsElement(parent)).toBeFalsy();
expect(portalContainsElement(portal)).toBeTruthy();
expect(portalContainsElement(leaf)).toBeTruthy();
expect(portalContainsElement(leaf, parent)).toBeTruthy();
});
it('works correctly when parent and child are in same portal', function () {
root.appendChild(portal);
portal.appendChild(parent);
parent.appendChild(leaf);
expect(portalContainsElement(parent)).toBeTruthy();
expect(portalContainsElement(leaf, parent)).toBeFalsy();
});
it('works with hierarchically invalid parents', function () {
root.appendChild(parent);
parent.appendChild(portal);
portal.appendChild(leaf);
// When parent is invalid, searches should go to root
expect(portalContainsElement(root, leaf)).toBeFalsy();
expect(portalContainsElement(parent, leaf)).toBeFalsy();
expect(portalContainsElement(portal, leaf)).toBeTruthy();
expect(portalContainsElement(leaf, unlinked)).toBeTruthy();
});
it('works when element is parent', function () {
root.appendChild(parent);
parent.appendChild(portal);
portal.appendChild(leaf);
expect(portalContainsElement(root, root)).toBeFalsy();
expect(portalContainsElement(parent, parent)).toBeFalsy();
expect(portalContainsElement(portal, portal)).toBeTruthy();
expect(portalContainsElement(leaf, leaf)).toBeFalsy();
});
});
//# sourceMappingURL=dom.test.js.map
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
export { elementContains } from '@fluentui/dom-utilities';
+2
View File
@@ -0,0 +1,2 @@
export { elementContains } from '@fluentui/dom-utilities';
//# sourceMappingURL=elementContains.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"elementContains.js","sourceRoot":"../src/","sources":["dom/elementContains.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { elementContains } from '@fluentui/dom-utilities';\n"]}
@@ -0,0 +1 @@
export { elementContainsAttribute } from '@fluentui/dom-utilities';
+2
View File
@@ -0,0 +1,2 @@
export { elementContainsAttribute } from '@fluentui/dom-utilities';
//# sourceMappingURL=elementContainsAttribute.js.map
@@ -0,0 +1 @@
{"version":3,"file":"elementContainsAttribute.js","sourceRoot":"../src/","sources":["dom/elementContainsAttribute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { elementContainsAttribute } from '@fluentui/dom-utilities';\n"]}
+1
View File
@@ -0,0 +1 @@
export { findElementRecursive } from '@fluentui/dom-utilities';
+2
View File
@@ -0,0 +1,2 @@
export { findElementRecursive } from '@fluentui/dom-utilities';
//# sourceMappingURL=findElementRecursive.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"findElementRecursive.js","sourceRoot":"../src/","sources":["dom/findElementRecursive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { findElementRecursive } from '@fluentui/dom-utilities';\n"]}
+1
View File
@@ -0,0 +1 @@
export { getActiveElement } from '@fluentui/dom-utilities';
+2
View File
@@ -0,0 +1,2 @@
export { getActiveElement } from '@fluentui/dom-utilities';
//# sourceMappingURL=getActiveElement.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"getActiveElement.js","sourceRoot":"../src/","sources":["dom/getActiveElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { getActiveElement } from '@fluentui/dom-utilities';\n"]}
+1
View File
@@ -0,0 +1 @@
export { getChildren } from '@fluentui/dom-utilities';
+2
View File
@@ -0,0 +1,2 @@
export { getChildren } from '@fluentui/dom-utilities';
//# sourceMappingURL=getChildren.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"getChildren.js","sourceRoot":"../src/","sources":["dom/getChildren.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { getChildren } from '@fluentui/dom-utilities';\n"]}
+8
View File
@@ -0,0 +1,8 @@
/**
* Helper to get the document object. Note that in popup window cases, document
* might be the wrong document, which is why we look at ownerDocument for the
* truth.
*
* @public
*/
export declare function getDocument(rootElement?: HTMLElement | null): Document | undefined;
+20
View File
@@ -0,0 +1,20 @@
import { canUseDOM } from './canUseDOM';
/**
* Helper to get the document object. Note that in popup window cases, document
* might be the wrong document, which is why we look at ownerDocument for the
* truth.
*
* @public
*/
export function getDocument(rootElement) {
// eslint-disable-next-line no-restricted-globals
if (!canUseDOM() || typeof document === 'undefined') {
return undefined;
}
else {
var el = rootElement;
// eslint-disable-next-line no-restricted-globals
return el && el.ownerDocument ? el.ownerDocument : document;
}
}
//# sourceMappingURL=getDocument.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"getDocument.js","sourceRoot":"../src/","sources":["dom/getDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,WAAgC;IAC1D,iDAAiD;IACjD,IAAI,CAAC,SAAS,EAAE,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpD,OAAO,SAAS,CAAC;IACnB,CAAC;SAAM,CAAC;QACN,IAAM,EAAE,GAAG,WAAsB,CAAC;QAElC,iDAAiD;QACjD,OAAO,EAAE,IAAI,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC9D,CAAC;AACH,CAAC","sourcesContent":["import { canUseDOM } from './canUseDOM';\n\n/**\n * Helper to get the document object. Note that in popup window cases, document\n * might be the wrong document, which is why we look at ownerDocument for the\n * truth.\n *\n * @public\n */\nexport function getDocument(rootElement?: HTMLElement | null): Document | undefined {\n // eslint-disable-next-line no-restricted-globals\n if (!canUseDOM() || typeof document === 'undefined') {\n return undefined;\n } else {\n const el = rootElement as Element;\n\n // eslint-disable-next-line no-restricted-globals\n return el && el.ownerDocument ? el.ownerDocument : document;\n }\n}\n"]}
+1
View File
@@ -0,0 +1 @@
export { getEventTarget } from '@fluentui/dom-utilities';
+2
View File
@@ -0,0 +1,2 @@
export { getEventTarget } from '@fluentui/dom-utilities';
//# sourceMappingURL=getEventTarget.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"getEventTarget.js","sourceRoot":"../src/","sources":["dom/getEventTarget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { getEventTarget } from '@fluentui/dom-utilities';\n"]}
@@ -0,0 +1,8 @@
/**
* Gets the first visible element that matches the given selector
* @param selector - The selector to use to find potential visible elements
* @returns The first visible element that matches the selector, otherwise undefined
*
* @public
*/
export declare function getFirstVisibleElementFromSelector(selector: string): Element | undefined;
@@ -0,0 +1,16 @@
import { isElementVisibleAndNotHidden } from '../focus';
import { getDocument } from './getDocument';
/**
* Gets the first visible element that matches the given selector
* @param selector - The selector to use to find potential visible elements
* @returns The first visible element that matches the selector, otherwise undefined
*
* @public
*/
export function getFirstVisibleElementFromSelector(selector) {
var doc = getDocument();
var elements = doc.querySelectorAll(selector);
// Iterate across the elements that match the selector and return the first visible/non-hidden element
return Array.from(elements).find(function (element) { var _a; return isElementVisibleAndNotHidden(element, (_a = doc.defaultView) !== null && _a !== void 0 ? _a : undefined); });
}
//# sourceMappingURL=getFirstVisibleElementFromSelector.js.map
@@ -0,0 +1 @@
{"version":3,"file":"getFirstVisibleElementFromSelector.js","sourceRoot":"../src/","sources":["dom/getFirstVisibleElementFromSelector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,UAAU,kCAAkC,CAAC,QAAgB;IACjE,IAAM,GAAG,GAAG,WAAW,EAAG,CAAC;IAC3B,IAAM,QAAQ,GAAG,GAAG,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAEhD,sGAAsG;IACtG,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,UAAC,OAAoB,YACpD,OAAA,4BAA4B,CAAC,OAAO,EAAE,MAAA,GAAG,CAAC,WAAW,mCAAI,SAAS,CAAC,CAAA,EAAA,CACpE,CAAC;AACJ,CAAC","sourcesContent":["import { isElementVisibleAndNotHidden } from '../focus';\nimport { getDocument } from './getDocument';\n\n/**\n * Gets the first visible element that matches the given selector\n * @param selector - The selector to use to find potential visible elements\n * @returns The first visible element that matches the selector, otherwise undefined\n *\n * @public\n */\nexport function getFirstVisibleElementFromSelector(selector: string): Element | undefined {\n const doc = getDocument()!;\n const elements = doc.querySelectorAll(selector);\n\n // Iterate across the elements that match the selector and return the first visible/non-hidden element\n return Array.from(elements).find((element: HTMLElement) =>\n isElementVisibleAndNotHidden(element, doc.defaultView ?? undefined),\n );\n}\n"]}
+1
View File
@@ -0,0 +1 @@
export { getParent } from '@fluentui/dom-utilities';
+2
View File
@@ -0,0 +1,2 @@
export { getParent } from '@fluentui/dom-utilities';
//# sourceMappingURL=getParent.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"getParent.js","sourceRoot":"../src/","sources":["dom/getParent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { getParent } from '@fluentui/dom-utilities';\n"]}
+7
View File
@@ -0,0 +1,7 @@
import type { IRectangle } from '../IRectangle';
/**
* Helper to get bounding client rect. Passing in window will get the window size.
*
* @public
*/
export declare function getRect(element: HTMLElement | Window | null, win?: Window): IRectangle | undefined;
+29
View File
@@ -0,0 +1,29 @@
import { getWindow } from './getWindow';
/**
* Helper to get bounding client rect. Passing in window will get the window size.
*
* @public
*/
export function getRect(element, win) {
var theWin = (win !== null && win !== void 0 ? win : (!element || (element && element.hasOwnProperty('devicePixelRatio'))))
? getWindow()
: getWindow(element);
var rect;
if (element) {
if (element === theWin) {
rect = {
left: 0,
top: 0,
width: theWin.innerWidth,
height: theWin.innerHeight,
right: theWin.innerWidth,
bottom: theWin.innerHeight,
};
}
else if (element.getBoundingClientRect) {
rect = element.getBoundingClientRect();
}
}
return rect;
}
//# sourceMappingURL=getRect.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"getRect.js","sourceRoot":"../src/","sources":["dom/getRect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,OAAoC,EAAE,GAAY;IACxE,IAAM,MAAM,GACV,CAAA,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,CAAC,CAAC,OAAO,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC,CAAC;QAC1E,CAAC,CAAC,SAAS,EAAE;QACb,CAAC,CAAC,SAAS,CAAC,OAAsB,CAAE,CAAC;IACzC,IAAI,IAA4B,CAAC;IACjC,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;YACvB,IAAI,GAAG;gBACL,IAAI,EAAE,CAAC;gBACP,GAAG,EAAE,CAAC;gBACN,KAAK,EAAE,MAAM,CAAC,UAAU;gBACxB,MAAM,EAAE,MAAM,CAAC,WAAW;gBAC1B,KAAK,EAAE,MAAM,CAAC,UAAU;gBACxB,MAAM,EAAE,MAAM,CAAC,WAAW;aAC3B,CAAC;QACJ,CAAC;aAAM,IAAK,OAA+C,CAAC,qBAAqB,EAAE,CAAC;YAClF,IAAI,GAAI,OAAuB,CAAC,qBAAqB,EAAE,CAAC;QAC1D,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { IRectangle } from '../IRectangle';\nimport { getWindow } from './getWindow';\n\n/**\n * Helper to get bounding client rect. Passing in window will get the window size.\n *\n * @public\n */\nexport function getRect(element: HTMLElement | Window | null, win?: Window): IRectangle | undefined {\n const theWin =\n win ?? (!element || (element && element.hasOwnProperty('devicePixelRatio')))\n ? getWindow()\n : getWindow(element as HTMLElement)!;\n let rect: IRectangle | undefined;\n if (element) {\n if (element === theWin) {\n rect = {\n left: 0,\n top: 0,\n width: theWin.innerWidth,\n height: theWin.innerHeight,\n right: theWin.innerWidth,\n bottom: theWin.innerHeight,\n };\n } else if ((element as { getBoundingClientRect?: unknown }).getBoundingClientRect) {\n rect = (element as HTMLElement).getBoundingClientRect();\n }\n }\n return rect;\n}\n"]}
+1
View File
@@ -0,0 +1 @@
export { getVirtualParent } from '@fluentui/dom-utilities';
+2
View File
@@ -0,0 +1,2 @@
export { getVirtualParent } from '@fluentui/dom-utilities';
//# sourceMappingURL=getVirtualParent.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"getVirtualParent.js","sourceRoot":"../src/","sources":["dom/getVirtualParent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { getVirtualParent } from '@fluentui/dom-utilities';\n"]}
+9
View File
@@ -0,0 +1,9 @@
/**
* Helper to get the window object. The helper will make sure to use a cached variable
* of "window", to avoid overhead and memory leaks in IE11. Note that in popup scenarios the
* window object won't match the "global" window object, and for these scenarios, you should
* pass in an element hosted within the popup.
*
* @public
*/
export declare function getWindow(rootElement?: Element | null): Window | undefined;
+30
View File
@@ -0,0 +1,30 @@
import { canUseDOM } from './canUseDOM';
var _window = undefined;
// Note: Accessing "window" in IE11 is somewhat expensive, and calling "typeof window"
// hits a memory leak, whereas aliasing it and calling "typeof _window" does not.
// Caching the window value at the file scope lets us minimize the impact.
try {
// eslint-disable-next-line no-restricted-globals
_window = window;
}
catch (e) {
/* no-op */
}
/**
* Helper to get the window object. The helper will make sure to use a cached variable
* of "window", to avoid overhead and memory leaks in IE11. Note that in popup scenarios the
* window object won't match the "global" window object, and for these scenarios, you should
* pass in an element hosted within the popup.
*
* @public
*/
export function getWindow(rootElement) {
if (!canUseDOM() || typeof _window === 'undefined') {
return undefined;
}
else {
var el = rootElement;
return el && el.ownerDocument && el.ownerDocument.defaultView ? el.ownerDocument.defaultView : _window;
}
}
//# sourceMappingURL=getWindow.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"getWindow.js","sourceRoot":"../src/","sources":["dom/getWindow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,IAAI,OAAO,GAAuB,SAAS,CAAC;AAE5C,sFAAsF;AACtF,iFAAiF;AACjF,0EAA0E;AAC1E,IAAI,CAAC;IACH,iDAAiD;IACjD,OAAO,GAAG,MAAM,CAAC;AACnB,CAAC;AAAC,OAAO,CAAC,EAAE,CAAC;IACX,WAAW;AACb,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,WAA4B;IACpD,IAAI,CAAC,SAAS,EAAE,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;QACnD,OAAO,SAAS,CAAC;IACnB,CAAC;SAAM,CAAC;QACN,IAAM,EAAE,GAAG,WAAsB,CAAC;QAElC,OAAO,EAAE,IAAI,EAAE,CAAC,aAAa,IAAI,EAAE,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC;IACzG,CAAC;AACH,CAAC","sourcesContent":["import { canUseDOM } from './canUseDOM';\n\nlet _window: Window | undefined = undefined;\n\n// Note: Accessing \"window\" in IE11 is somewhat expensive, and calling \"typeof window\"\n// hits a memory leak, whereas aliasing it and calling \"typeof _window\" does not.\n// Caching the window value at the file scope lets us minimize the impact.\ntry {\n // eslint-disable-next-line no-restricted-globals\n _window = window;\n} catch (e) {\n /* no-op */\n}\n\n/**\n * Helper to get the window object. The helper will make sure to use a cached variable\n * of \"window\", to avoid overhead and memory leaks in IE11. Note that in popup scenarios the\n * window object won't match the \"global\" window object, and for these scenarios, you should\n * pass in an element hosted within the popup.\n *\n * @public\n */\nexport function getWindow(rootElement?: Element | null): Window | undefined {\n if (!canUseDOM() || typeof _window === 'undefined') {\n return undefined;\n } else {\n const el = rootElement as Element;\n\n return el && el.ownerDocument && el.ownerDocument.defaultView ? el.ownerDocument.defaultView : _window;\n }\n}\n"]}
+1
View File
@@ -0,0 +1 @@
export { isVirtualElement } from '@fluentui/dom-utilities';
+2
View File
@@ -0,0 +1,2 @@
export { isVirtualElement } from '@fluentui/dom-utilities';
//# sourceMappingURL=isVirtualElement.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"isVirtualElement.js","sourceRoot":"../src/","sources":["dom/isVirtualElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { isVirtualElement } from '@fluentui/dom-utilities';\n"]}
+1
View File
@@ -0,0 +1 @@
export declare function on(element: Element | Window | Document, eventName: string, callback: (ev: Event) => void, options?: boolean): () => void;
+5
View File
@@ -0,0 +1,5 @@
export function on(element, eventName, callback, options) {
element.addEventListener(eventName, callback, options);
return function () { return element.removeEventListener(eventName, callback, options); };
}
//# sourceMappingURL=on.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"on.js","sourceRoot":"../src/","sources":["dom/on.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,EAAE,CAChB,OAAoC,EACpC,SAAiB,EACjB,QAA6B,EAC7B,OAAiB;IAEjB,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAEvD,OAAO,cAAM,OAAA,OAAO,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAzD,CAAyD,CAAC;AACzE,CAAC","sourcesContent":["export function on(\n element: Element | Window | Document,\n eventName: string,\n callback: (ev: Event) => void,\n options?: boolean,\n): () => void {\n element.addEventListener(eventName, callback, options);\n\n return () => element.removeEventListener(eventName, callback, options);\n}\n"]}
+1
View File
@@ -0,0 +1 @@
export { portalContainsElement } from '@fluentui/dom-utilities';
+2
View File
@@ -0,0 +1,2 @@
export { portalContainsElement } from '@fluentui/dom-utilities';
//# sourceMappingURL=portalContainsElement.js.map
@@ -0,0 +1 @@
{"version":3,"file":"portalContainsElement.js","sourceRoot":"../src/","sources":["dom/portalContainsElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { portalContainsElement } from '@fluentui/dom-utilities';\n"]}
+4
View File
@@ -0,0 +1,4 @@
/** Raises a click event.
* @deprecated Moved to `FocusZone` component since it was the only place internally using this function.
*/
export declare function raiseClick(target: Element, doc?: Document): void;
+26
View File
@@ -0,0 +1,26 @@
import { getDocument } from './getDocument';
/** Raises a click event.
* @deprecated Moved to `FocusZone` component since it was the only place internally using this function.
*/
export function raiseClick(target, doc) {
var theDoc = doc !== null && doc !== void 0 ? doc : getDocument();
var event = createNewEvent('MouseEvents', theDoc);
// eslint-disable-next-line @typescript-eslint/no-deprecated
event.initEvent('click', true, true);
target.dispatchEvent(event);
}
function createNewEvent(eventName, doc) {
var event;
if (typeof Event === 'function') {
// Chrome, Opera, Firefox
event = new Event(eventName);
}
else {
// IE
event = doc.createEvent('Event');
// eslint-disable-next-line @typescript-eslint/no-deprecated
event.initEvent(eventName, true, true);
}
return event;
}
//# sourceMappingURL=raiseClick.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"raiseClick.js","sourceRoot":"../src/","sources":["dom/raiseClick.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,MAAe,EAAE,GAAc;IACxD,IAAM,MAAM,GAAG,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,WAAW,EAAG,CAAC;IACrC,IAAM,KAAK,GAAG,cAAc,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACpD,4DAA4D;IAC5D,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACrC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,cAAc,CAAC,SAAiB,EAAE,GAAa;IACtD,IAAI,KAAK,CAAC;IACV,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;QAChC,yBAAyB;QACzB,KAAK,GAAG,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC;QACN,KAAK;QACL,KAAK,GAAG,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACjC,4DAA4D;QAC5D,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { getDocument } from './getDocument';\n\n/** Raises a click event.\n * @deprecated Moved to `FocusZone` component since it was the only place internally using this function.\n */\nexport function raiseClick(target: Element, doc?: Document): void {\n const theDoc = doc ?? getDocument()!;\n const event = createNewEvent('MouseEvents', theDoc);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n event.initEvent('click', true, true);\n target.dispatchEvent(event);\n}\n\nfunction createNewEvent(eventName: string, doc: Document): Event {\n let event;\n if (typeof Event === 'function') {\n // Chrome, Opera, Firefox\n event = new Event(eventName);\n } else {\n // IE\n event = doc.createEvent('Event');\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n event.initEvent(eventName, true, true);\n }\n return event;\n}\n"]}
+1
View File
@@ -0,0 +1 @@
export { DATA_PORTAL_ATTRIBUTE, setPortalAttribute } from '@fluentui/dom-utilities';
+2
View File
@@ -0,0 +1,2 @@
export { DATA_PORTAL_ATTRIBUTE, setPortalAttribute } from '@fluentui/dom-utilities';
//# sourceMappingURL=setPortalAttribute.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"setPortalAttribute.js","sourceRoot":"../src/","sources":["dom/setPortalAttribute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { DATA_PORTAL_ATTRIBUTE, setPortalAttribute } from '@fluentui/dom-utilities';\n"]}
+10
View File
@@ -0,0 +1,10 @@
/**
* @deprecated Use `canUseDOM` from `@fluentui/utilities` instead.
*/
export declare let _isSSR: boolean;
/**
* Helper to set ssr mode to simulate no window object returned from getWindow helper.
*
* @deprecated Use `canUseDOM` from `@fluentui/utilities` instead.
*/
export declare function setSSR(isEnabled: boolean): void;
+14
View File
@@ -0,0 +1,14 @@
/**
* @deprecated Use `canUseDOM` from `@fluentui/utilities` instead.
*/
export var _isSSR = false;
/**
* Helper to set ssr mode to simulate no window object returned from getWindow helper.
*
* @deprecated Use `canUseDOM` from `@fluentui/utilities` instead.
*/
export function setSSR(isEnabled) {
throw new Error('setSSR has been deprecated and is not used in any utilities anymore.' +
' Use canUseDOM from @fluentui/utilities instead.');
}
//# sourceMappingURL=setSSR.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"setSSR.js","sourceRoot":"../src/","sources":["dom/setSSR.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,IAAI,MAAM,GAAG,KAAK,CAAC;AAE1B;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,SAAkB;IACvC,MAAM,IAAI,KAAK,CACb,sEAAsE;QACpE,kDAAkD,CACrD,CAAC;AACJ,CAAC","sourcesContent":["/**\n * @deprecated Use `canUseDOM` from `@fluentui/utilities` instead.\n */\nexport let _isSSR = false;\n\n/**\n * Helper to set ssr mode to simulate no window object returned from getWindow helper.\n *\n * @deprecated Use `canUseDOM` from `@fluentui/utilities` instead.\n */\nexport function setSSR(isEnabled: boolean): void {\n throw new Error(\n 'setSSR has been deprecated and is not used in any utilities anymore.' +\n ' Use canUseDOM from @fluentui/utilities instead.',\n );\n}\n"]}
+1
View File
@@ -0,0 +1 @@
export { setVirtualParent } from '@fluentui/dom-utilities';
+2
View File
@@ -0,0 +1,2 @@
export { setVirtualParent } from '@fluentui/dom-utilities';
//# sourceMappingURL=setVirtualParent.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"setVirtualParent.js","sourceRoot":"../src/","sources":["dom/setVirtualParent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { setVirtualParent } from '@fluentui/dom-utilities';\n"]}