Private
Public Access
1
0

feat: Fluent UI Outlook Lite + connections mockup

This commit is contained in:
2026-04-14 18:52:25 +00:00
parent 1199eff6c3
commit dfa4010406
34820 changed files with 1003813 additions and 205 deletions

View File

@@ -0,0 +1,18 @@
/**
* @internal
* Clamps `value` to a number between the min and max.
*
* @param value - the value to be clamped
* @param min - the lowest valid value
* @param max - the highest valid value
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "clamp", {
enumerable: true,
get: function() {
return clamp;
}
});
const clamp = (value, min, max)=>Math.max(min, Math.min(max, value || 0));

View File

@@ -0,0 +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"],"mappings":"AAAA;;;;;;;CAOC;;;;+BACYA;;;eAAAA;;;AAAN,MAAMA,QAAQ,CAACC,OAAeC,KAAaC,MAAwBC,KAAKD,GAAG,CAACD,KAAKE,KAAKF,GAAG,CAACC,KAAKF,SAAS"}

View File

@@ -0,0 +1,15 @@
/**
* Creates a set from a given iterable, in case the iterable is a set itself, returns the given set instead.
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "createSetFromIterable", {
enumerable: true,
get: function() {
return createSetFromIterable;
}
});
function createSetFromIterable(iterable) {
return iterable instanceof Set ? iterable : new Set(iterable);
}

View File

@@ -0,0 +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"],"mappings":"AAAA;;CAEC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,sBAAyBC,QAAqB;IAC5D,OAAOA,oBAAoBC,MAAMD,WAAW,IAAIC,IAAID;AACtD"}

View File

@@ -0,0 +1,65 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
getNativeElementProps: function() {
return getNativeElementProps;
},
getPartitionedNativeProps: function() {
return getPartitionedNativeProps;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _properties = require("./properties");
const nativeElementMap = {
label: _properties.labelProperties,
audio: _properties.audioProperties,
video: _properties.videoProperties,
ol: _properties.olProperties,
li: _properties.liProperties,
a: _properties.anchorProperties,
button: _properties.buttonProperties,
input: _properties.inputProperties,
textarea: _properties.textAreaProperties,
select: _properties.selectProperties,
option: _properties.optionProperties,
table: _properties.tableProperties,
tr: _properties.trProperties,
th: _properties.thProperties,
td: _properties.tdProperties,
colGroup: _properties.colGroupProperties,
col: _properties.colProperties,
fieldset: _properties.fieldsetProperties,
form: _properties.formProperties,
iframe: _properties.iframeProperties,
img: _properties.imgProperties,
time: _properties.timeProperties,
dialog: _properties.dialogProperties
};
function getNativeElementProps(tagName, props, excludedPropNames) {
const allowedPropNames = tagName && nativeElementMap[tagName] || _properties.htmlElementProperties;
allowedPropNames.as = 1;
return (0, _properties.getNativeProps)(props, allowedPropNames, excludedPropNames);
}
const getPartitionedNativeProps = ({ primarySlotTagName, props, excludedPropNames })=>{
return {
root: {
style: props.style,
className: props.className
},
// eslint-disable-next-line @typescript-eslint/no-deprecated
primary: getNativeElementProps(primarySlotTagName, props, [
...excludedPropNames || [],
'style',
'className'
])
};
};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,28 @@
/**
* @internal
* Finds and swaps a provided key for it's right to left format.
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getRTLSafeKey", {
enumerable: true,
get: function() {
return getRTLSafeKey;
}
});
const getRTLSafeKey = (key, dir)=>{
if (dir === 'rtl') {
switch(key){
case 'ArrowLeft':
{
return 'ArrowRight';
}
case 'ArrowRight':
{
return 'ArrowLeft';
}
}
}
return key;
};

View File

@@ -0,0 +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'): string => {\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"],"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"}

View File

@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getReactCallbackName", {
enumerable: true,
get: function() {
return getReactCallbackName;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
function getReactCallbackName(event) {
if (event._reactName) {
return event._reactName;
}
if (event.dispatchConfig) {
if (event.dispatchConfig.registrationName) {
return event.dispatchConfig.registrationName;
}
return event.dispatchConfig.phasedRegistrationNames.bubbled;
}
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line no-console
console.error(`@fluentui/react-utilities [${getReactCallbackName.name}]:
Passed React.SyntheticEvent does not contain ".dispatchConfig" or "._reactName". This should not happen, please report it to https://github.com/microsoft/fluentui.`);
}
}

View File

@@ -0,0 +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"],"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"}

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getReactElementRef", {
enumerable: true,
get: function() {
return getReactElementRef;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const IS_REACT_19_OR_HIGHER = parseInt(_react.version, 10) >= 19;
function getReactElementRef(element) {
if (!element) {
return undefined;
}
if (IS_REACT_19_OR_HIGHER) {
return element.props.ref;
}
return element.ref;
}

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/utils/getReactElementRef.ts"],"sourcesContent":["import * as React from 'react';\n\nconst IS_REACT_19_OR_HIGHER = parseInt(React.version, 10) >= 19;\n\n/**\n * Returns a ref for the React element in a backwards-compatible way.\n *\n * @param element - The element to get the ref for.\n * @returns The ref for the element.\n */\nexport function getReactElementRef<T>(element: React.ReactElement | null | undefined): React.Ref<T> | undefined {\n if (!element) {\n return undefined;\n }\n\n if (IS_REACT_19_OR_HIGHER) {\n return (element as React.ReactElement<{ ref?: React.Ref<T> }>).props.ref;\n }\n\n return (element as React.ReactElement & { ref: React.Ref<T> | undefined }).ref;\n}\n"],"names":["getReactElementRef","IS_REACT_19_OR_HIGHER","parseInt","React","version","element","undefined","props","ref"],"mappings":";;;;+BAUgBA;;;eAAAA;;;;iEAVO;AAEvB,MAAMC,wBAAwBC,SAASC,OAAMC,OAAO,EAAE,OAAO;AAQtD,SAASJ,mBAAsBK,OAA8C;IAClF,IAAI,CAACA,SAAS;QACZ,OAAOC;IACT;IAEA,IAAIL,uBAAuB;QACzB,OAAO,AAACI,QAAuDE,KAAK,CAACC,GAAG;IAC1E;IAEA,OAAO,AAACH,QAAmEG,GAAG;AAChF"}

View File

@@ -0,0 +1,144 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
anchorProperties: function() {
return _properties.anchorProperties;
},
audioProperties: function() {
return _properties.audioProperties;
},
baseElementEvents: function() {
return _properties.baseElementEvents;
},
baseElementProperties: function() {
return _properties.baseElementProperties;
},
buttonProperties: function() {
return _properties.buttonProperties;
},
clamp: function() {
return _clamp.clamp;
},
colGroupProperties: function() {
return _properties.colGroupProperties;
},
colProperties: function() {
return _properties.colProperties;
},
createPriorityQueue: function() {
return _priorityQueue.createPriorityQueue;
},
dialogProperties: function() {
return _properties.dialogProperties;
},
divProperties: function() {
return _properties.divProperties;
},
fieldsetProperties: function() {
return _properties.fieldsetProperties;
},
formProperties: function() {
return _properties.formProperties;
},
// eslint-disable-next-line @typescript-eslint/no-deprecated
getNativeElementProps: function() {
return _getNativeElementProps.getNativeElementProps;
},
getNativeProps: function() {
return _properties.getNativeProps;
},
getPartitionedNativeProps: function() {
return _getNativeElementProps.getPartitionedNativeProps;
},
getRTLSafeKey: function() {
return _getRTLSafeKey.getRTLSafeKey;
},
getReactElementRef: function() {
return _getReactElementRef.getReactElementRef;
},
htmlElementProperties: function() {
return _properties.htmlElementProperties;
},
iframeProperties: function() {
return _properties.iframeProperties;
},
imgProperties: function() {
return _properties.imgProperties;
},
inputProperties: function() {
return _properties.inputProperties;
},
isHTMLElement: function() {
return _isHTMLElement.isHTMLElement;
},
isInteractiveHTMLElement: function() {
return _isInteractiveHTMLElement.isInteractiveHTMLElement;
},
labelProperties: function() {
return _properties.labelProperties;
},
liProperties: function() {
return _properties.liProperties;
},
measureScrollbarWidth: function() {
return _measureScrollBarWidth.measureScrollbarWidth;
},
mergeCallbacks: function() {
return _mergeCallbacks.mergeCallbacks;
},
microdataProperties: function() {
return _properties.microdataProperties;
},
olProperties: function() {
return _properties.olProperties;
},
omit: function() {
return _omit.omit;
},
optionProperties: function() {
return _properties.optionProperties;
},
selectProperties: function() {
return _properties.selectProperties;
},
tableProperties: function() {
return _properties.tableProperties;
},
tdProperties: function() {
return _properties.tdProperties;
},
textAreaProperties: function() {
return _properties.textAreaProperties;
},
thProperties: function() {
return _properties.thProperties;
},
timeProperties: function() {
return _properties.timeProperties;
},
trProperties: function() {
return _properties.trProperties;
},
videoProperties: function() {
return _properties.videoProperties;
}
});
const _clamp = require("./clamp");
const _getNativeElementProps = require("./getNativeElementProps");
const _getReactElementRef = require("./getReactElementRef");
const _getRTLSafeKey = require("./getRTLSafeKey");
const _mergeCallbacks = require("./mergeCallbacks");
const _omit = require("./omit");
const _properties = require("./properties");
const _isHTMLElement = require("./isHTMLElement");
const _isInteractiveHTMLElement = require("./isInteractiveHTMLElement");
const _priorityQueue = require("./priorityQueue");
const _measureScrollBarWidth = require("./measureScrollBarWidth");

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export { clamp } from './clamp';\nexport {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n getNativeElementProps,\n getPartitionedNativeProps,\n} from './getNativeElementProps';\nexport { getReactElementRef } from './getReactElementRef';\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';\nexport { measureScrollbarWidth } from './measureScrollBarWidth';\n"],"names":["anchorProperties","audioProperties","baseElementEvents","baseElementProperties","buttonProperties","clamp","colGroupProperties","colProperties","createPriorityQueue","dialogProperties","divProperties","fieldsetProperties","formProperties","getNativeElementProps","getNativeProps","getPartitionedNativeProps","getRTLSafeKey","getReactElementRef","htmlElementProperties","iframeProperties","imgProperties","inputProperties","isHTMLElement","isInteractiveHTMLElement","labelProperties","liProperties","measureScrollbarWidth","mergeCallbacks","microdataProperties","olProperties","omit","optionProperties","selectProperties","tableProperties","tdProperties","textAreaProperties","thProperties","timeProperties","trProperties","videoProperties"],"mappings":";;;;;;;;;;;IAWEA,gBAAgB;eAAhBA,4BAAgB;;IAChBC,eAAe;eAAfA,2BAAe;;IACfC,iBAAiB;eAAjBA,6BAAiB;;IACjBC,qBAAqB;eAArBA,iCAAqB;;IACrBC,gBAAgB;eAAhBA,4BAAgB;;IAfTC,KAAK;eAALA,YAAK;;IAgBZC,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;;IAnBd,4DAA4D;IAC5DC,qBAAqB;eAArBA,4CAAqB;;IAmBrBC,cAAc;eAAdA,0BAAc;;IAlBdC,yBAAyB;eAAzBA,gDAAyB;;IAGlBC,aAAa;eAAbA,4BAAa;;IADbC,kBAAkB;eAAlBA,sCAAkB;;IAiBzBC,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;;IAiBLC,qBAAqB;eAArBA,4CAAqB;;IArCrBC,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;;;uBAvCK;uCAKf;oCAC4B;+BACL;gCACC;sBACV;4BA+Bd;+BACuB;0CACW;+BAEL;uCACE"}

View File

@@ -0,0 +1,29 @@
/**
* Verifies if a given node is an HTMLElement,
* this method works seamlessly with frames and elements from different documents
*
* This is preferred over simply using `instanceof`.
* 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)
*
* @example
* ```ts
* isHTMLElement(event.target) && event.target.focus()
* isHTMLElement(event.target, {constructorName: 'HTMLInputElement'}) && event.target.value // some value
* ```
*
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "isHTMLElement", {
enumerable: true,
get: function() {
return isHTMLElement;
}
});
function isHTMLElement(element, options) {
var _typedElement_ownerDocument;
const typedElement = element;
var _options_constructorName;
return Boolean((typedElement === null || typedElement === void 0 ? void 0 : (_typedElement_ownerDocument = typedElement.ownerDocument) === null || _typedElement_ownerDocument === void 0 ? void 0 : _typedElement_ownerDocument.defaultView) && typedElement instanceof typedElement.ownerDocument.defaultView[(_options_constructorName = options === null || options === void 0 ? void 0 : options.constructorName) !== null && _options_constructorName !== void 0 ? _options_constructorName : 'HTMLElement']);
}

View File

@@ -0,0 +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"],"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"}

View File

@@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "isInteractiveHTMLElement", {
enumerable: true,
get: function() {
return isInteractiveHTMLElement;
}
});
const _isHTMLElement = require("./isHTMLElement");
function isInteractiveHTMLElement(element) {
if (!(0, _isHTMLElement.isHTMLElement)(element)) {
return false;
}
const { tagName } = element;
switch(tagName){
case 'BUTTON':
case 'A':
case 'INPUT':
case 'TEXTAREA':
return true;
}
return element.isContentEditable;
}

View File

@@ -0,0 +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): boolean {\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"],"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"}

View File

@@ -0,0 +1,26 @@
/**
* Measures the width of the scrollbar for the given document.
*
* @param targetDocument - Document to measure the scrollbar width
* @returns The width of the scrollbar in pixels
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "measureScrollbarWidth", {
enumerable: true,
get: function() {
return measureScrollbarWidth;
}
});
function measureScrollbarWidth(targetDocument) {
const outer = targetDocument.createElement('div');
outer.style.visibility = 'hidden';
outer.style.overflow = 'scroll';
const inner = targetDocument.createElement('div');
outer.appendChild(inner);
targetDocument.body.appendChild(outer);
const scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
outer.remove();
return scrollbarWidth;
}

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/utils/measureScrollBarWidth.ts"],"sourcesContent":["/**\n * Measures the width of the scrollbar for the given document.\n *\n * @param targetDocument - Document to measure the scrollbar width\n * @returns The width of the scrollbar in pixels\n */\nexport function measureScrollbarWidth(targetDocument: Document): number {\n const outer = targetDocument.createElement('div');\n outer.style.visibility = 'hidden';\n outer.style.overflow = 'scroll';\n\n const inner = targetDocument.createElement('div');\n outer.appendChild(inner);\n\n targetDocument.body.appendChild(outer);\n const scrollbarWidth = outer.offsetWidth - inner.offsetWidth;\n outer.remove();\n\n return scrollbarWidth;\n}\n"],"names":["measureScrollbarWidth","targetDocument","outer","createElement","style","visibility","overflow","inner","appendChild","body","scrollbarWidth","offsetWidth","remove"],"mappings":"AAAA;;;;;CAKC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,sBAAsBC,cAAwB;IAC5D,MAAMC,QAAQD,eAAeE,aAAa,CAAC;IAC3CD,MAAME,KAAK,CAACC,UAAU,GAAG;IACzBH,MAAME,KAAK,CAACE,QAAQ,GAAG;IAEvB,MAAMC,QAAQN,eAAeE,aAAa,CAAC;IAC3CD,MAAMM,WAAW,CAACD;IAElBN,eAAeQ,IAAI,CAACD,WAAW,CAACN;IAChC,MAAMQ,iBAAiBR,MAAMS,WAAW,GAAGJ,MAAMI,WAAW;IAC5DT,MAAMU,MAAM;IAEZ,OAAOF;AACT"}

View File

@@ -0,0 +1,38 @@
/**
* @internal
* Combine two event callbacks into a single callback function that calls each one in order.
*
* Usage example:
* ```ts
* state.slot.onChange = mergeCallbacks(state.slot.onChange, ev => {
* // Handle onChange
* });
* ```
*
* The primary use is to avoid the need to capture an existing callback (`state.slot.onChange` in the example) to a
* local variable before replacing with a new listener that calls the existing one. This helps avoid bugs like:
* * Infinite recursion by calling the re-assigned state.slot.onChange if it's not captured to a local variable.
* * Missing a call to the original onChange due to an early return or other conditional.
*
* If you need a callback that is stable between renders, wrap the result in {@link useEventCallback}.
*
* @param callback1 - The first callback to be called, or undefined
* @param callback2 - The second callback to be called, or undefined
*
* @returns A function that that calls the provided functions in order
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "mergeCallbacks", {
enumerable: true,
get: function() {
return mergeCallbacks;
}
});
function mergeCallbacks(callback1, callback2) {
return (...args)=>{
callback1 === null || callback1 === void 0 ? void 0 : callback1(...args);
callback2 === null || callback2 === void 0 ? void 0 : callback2(...args);
};
}

View File

@@ -0,0 +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): (...args: Args) => void {\n return (...args: Args) => {\n callback1?.(...args);\n callback2?.(...args);\n };\n}\n"],"names":["mergeCallbacks","callback1","callback2","args"],"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"}

View File

@@ -0,0 +1,33 @@
/**
* Tiny helper to do the minimal amount of work in duplicating an object but omitting some
* props. This ends up faster than using object ...rest or reduce to filter.
*
* This behaves very much like filteredAssign, but does not merge many objects together,
* uses an exclusion object map, and avoids spreads all for optimal performance.
*
* See perf test for background:
* https://jsperf.com/omit-vs-rest-vs-reduce/1
*
* @param obj - The object to clone
* @param exclusions - The array of keys to exclude
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "omit", {
enumerable: true,
get: function() {
return omit;
}
});
function omit(obj, exclusions) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const result = {};
for(const key in obj){
if (exclusions.indexOf(key) === -1 && obj.hasOwnProperty(key)) {
result[key] = obj[key];
}
}
return result;
}

View File

@@ -0,0 +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"],"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"}

View File

@@ -0,0 +1,98 @@
/**
* @internal
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "createPriorityQueue", {
enumerable: true,
get: function() {
return createPriorityQueue;
}
});
function createPriorityQueue(compare) {
const arr = [];
let size = 0;
const swap = (a, b)=>{
const tmp = arr[a];
arr[a] = arr[b];
arr[b] = tmp;
};
const heapify = (i)=>{
let smallest = i;
const l = left(i);
const r = right(i);
if (l < size && compare(arr[l], arr[smallest]) < 0) {
smallest = l;
}
if (r < size && compare(arr[r], arr[smallest]) < 0) {
smallest = r;
}
if (smallest !== i) {
swap(smallest, i);
heapify(smallest);
}
};
const dequeue = ()=>{
if (size === 0) {
throw new Error('Priority queue empty');
}
const res = arr[0];
arr[0] = arr[--size];
heapify(0);
return res;
};
const peek = ()=>{
if (size === 0) {
return null;
}
return arr[0];
};
const enqueue = (item)=>{
arr[size++] = item;
let i = size - 1;
let p = parent(i);
while(i > 0 && compare(arr[p], arr[i]) > 0){
swap(p, i);
i = p;
p = parent(i);
}
};
const contains = (item)=>{
const index = arr.indexOf(item);
return index >= 0 && index < size;
};
const remove = (item)=>{
const i = arr.indexOf(item);
if (i === -1 || i >= size) {
return;
}
arr[i] = arr[--size];
heapify(i);
};
const clear = ()=>{
size = 0;
};
const all = ()=>{
return arr.slice(0, size);
};
return {
all,
clear,
contains,
dequeue,
enqueue,
peek,
remove,
size: ()=>size
};
}
const left = (i)=>{
return 2 * i + 1;
};
const right = (i)=>{
return 2 * i + 2;
};
const parent = (i)=>{
return Math.floor((i - 1) / 2);
};

View File

@@ -0,0 +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"],"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"}

View File

@@ -0,0 +1,403 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
anchorProperties: function() {
return anchorProperties;
},
audioProperties: function() {
return audioProperties;
},
baseElementEvents: function() {
return baseElementEvents;
},
baseElementProperties: function() {
return baseElementProperties;
},
buttonProperties: function() {
return buttonProperties;
},
colGroupProperties: function() {
return colGroupProperties;
},
colProperties: function() {
return colProperties;
},
dialogProperties: function() {
return dialogProperties;
},
divProperties: function() {
return divProperties;
},
fieldsetProperties: function() {
return fieldsetProperties;
},
formProperties: function() {
return formProperties;
},
getNativeProps: function() {
return getNativeProps;
},
htmlElementProperties: function() {
return htmlElementProperties;
},
iframeProperties: function() {
return iframeProperties;
},
imgProperties: function() {
return imgProperties;
},
inputProperties: function() {
return inputProperties;
},
labelProperties: function() {
return labelProperties;
},
liProperties: function() {
return liProperties;
},
microdataProperties: function() {
return microdataProperties;
},
olProperties: function() {
return olProperties;
},
optionProperties: function() {
return optionProperties;
},
selectProperties: function() {
return selectProperties;
},
tableProperties: function() {
return tableProperties;
},
tdProperties: function() {
return tdProperties;
},
textAreaProperties: function() {
return textAreaProperties;
},
thProperties: function() {
return thProperties;
},
timeProperties: function() {
return timeProperties;
},
trProperties: function() {
return trProperties;
},
videoProperties: function() {
return videoProperties;
}
});
const toObjectMap = (...items)=>{
const result = {};
for (const item of items){
const keys = Array.isArray(item) ? item : Object.keys(item);
for (const key of keys){
result[key] = 1;
}
}
return result;
};
const baseElementEvents = toObjectMap([
'onAuxClick',
'onAnimationEnd',
'onAnimationStart',
'onCopy',
'onCut',
'onPaste',
'onCompositionEnd',
'onCompositionStart',
'onCompositionUpdate',
'onFocus',
'onFocusCapture',
'onBlur',
'onBlurCapture',
'onChange',
'onInput',
'onSubmit',
'onLoad',
'onError',
'onKeyDown',
'onKeyDownCapture',
'onKeyPress',
'onKeyUp',
'onAbort',
'onCanPlay',
'onCanPlayThrough',
'onDurationChange',
'onEmptied',
'onEncrypted',
'onEnded',
'onLoadedData',
'onLoadedMetadata',
'onLoadStart',
'onPause',
'onPlay',
'onPlaying',
'onProgress',
'onRateChange',
'onSeeked',
'onSeeking',
'onStalled',
'onSuspend',
'onTimeUpdate',
'onVolumeChange',
'onWaiting',
'onClick',
'onClickCapture',
'onContextMenu',
'onDoubleClick',
'onDrag',
'onDragEnd',
'onDragEnter',
'onDragExit',
'onDragLeave',
'onDragOver',
'onDragStart',
'onDrop',
'onMouseDown',
'onMouseDownCapture',
'onMouseEnter',
'onMouseLeave',
'onMouseMove',
'onMouseOut',
'onMouseOver',
'onMouseUp',
'onMouseUpCapture',
'onSelect',
'onTouchCancel',
'onTouchEnd',
'onTouchMove',
'onTouchStart',
'onScroll',
'onWheel',
'onPointerCancel',
'onPointerDown',
'onPointerEnter',
'onPointerLeave',
'onPointerMove',
'onPointerOut',
'onPointerOver',
'onPointerUp',
'onGotPointerCapture',
'onLostPointerCapture'
]);
const baseElementProperties = toObjectMap([
'accessKey',
'children',
'className',
'contentEditable',
'dir',
'draggable',
'hidden',
'htmlFor',
'id',
'lang',
'popover',
'focusgroup',
'ref',
'role',
'style',
'tabIndex',
'title',
'translate',
'spellCheck',
'name'
]);
const microdataProperties = toObjectMap([
'itemID',
'itemProp',
'itemRef',
'itemScope',
'itemType'
]);
const htmlElementProperties = toObjectMap(baseElementProperties, baseElementEvents, microdataProperties);
const labelProperties = toObjectMap(htmlElementProperties, [
'form'
]);
const audioProperties = toObjectMap(htmlElementProperties, [
'height',
'loop',
'muted',
'preload',
'src',
'width'
]);
const videoProperties = toObjectMap(audioProperties, [
'poster'
]);
const olProperties = toObjectMap(htmlElementProperties, [
'start'
]);
const liProperties = toObjectMap(htmlElementProperties, [
'value'
]);
const anchorProperties = toObjectMap(htmlElementProperties, [
'download',
'href',
'hrefLang',
'media',
'referrerPolicy',
'rel',
'target',
'type'
]);
const timeProperties = toObjectMap(htmlElementProperties, [
'dateTime'
]);
const buttonProperties = toObjectMap(htmlElementProperties, [
'autoFocus',
'disabled',
'form',
'formAction',
'formEncType',
'formMethod',
'formNoValidate',
'formTarget',
'popoverTarget',
'popoverTargetAction',
'type',
'value'
]);
const inputProperties = toObjectMap(buttonProperties, [
'accept',
'alt',
'autoCorrect',
'autoCapitalize',
'autoComplete',
'checked',
'dirname',
'form',
'height',
'inputMode',
'list',
'max',
'maxLength',
'min',
'minLength',
'multiple',
'pattern',
'placeholder',
'readOnly',
'required',
'src',
'step',
'size',
'type',
'value',
'width'
]);
const textAreaProperties = toObjectMap(buttonProperties, [
'autoCapitalize',
'cols',
'dirname',
'form',
'maxLength',
'placeholder',
'readOnly',
'required',
'rows',
'wrap'
]);
const selectProperties = toObjectMap(buttonProperties, [
'form',
'multiple',
'required'
]);
const optionProperties = toObjectMap(htmlElementProperties, [
'selected',
'value'
]);
const tableProperties = toObjectMap(htmlElementProperties, [
'cellPadding',
'cellSpacing'
]);
const trProperties = htmlElementProperties;
const thProperties = toObjectMap(htmlElementProperties, [
'colSpan',
'rowSpan',
'scope'
]);
const tdProperties = toObjectMap(htmlElementProperties, [
'colSpan',
'headers',
'rowSpan',
'scope'
]);
const colGroupProperties = toObjectMap(htmlElementProperties, [
'span'
]);
const colProperties = toObjectMap(htmlElementProperties, [
'span'
]);
const fieldsetProperties = toObjectMap(htmlElementProperties, [
'disabled',
'form'
]);
const formProperties = toObjectMap(htmlElementProperties, [
'acceptCharset',
'action',
'encType',
'encType',
'method',
'noValidate',
'target'
]);
const iframeProperties = toObjectMap(htmlElementProperties, [
'allow',
'allowFullScreen',
'allowPaymentRequest',
'allowTransparency',
'csp',
'height',
'importance',
'referrerPolicy',
'sandbox',
'src',
'srcDoc',
'width'
]);
const imgProperties = toObjectMap(htmlElementProperties, [
'alt',
'crossOrigin',
'height',
'src',
'srcSet',
'useMap',
'width'
]);
const dialogProperties = toObjectMap(htmlElementProperties, [
'open',
'onCancel',
'onClose'
]);
const divProperties = htmlElementProperties;
function getNativeProps(// eslint-disable-next-line @typescript-eslint/no-explicit-any
props, allowedPropNames, excludedPropNames) {
// It'd be great to properly type this while allowing 'aria-` and 'data-' attributes like TypeScript does for
// JSX attributes, but that ability is hardcoded into the TS compiler with no analog in TypeScript typings.
// Then we'd be able to enforce props extends native props (including aria- and data- attributes), and then
// return native props.
// We should be able to do this once this PR is merged: https://github.com/microsoft/TypeScript/pull/26797
const isArray = Array.isArray(allowedPropNames);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const result = {};
const keys = Object.keys(props);
for (const key of keys){
const isNativeProp = !isArray && allowedPropNames[key] || isArray && allowedPropNames.indexOf(key) >= 0 || key.indexOf('data-') === 0 || key.indexOf('aria-') === 0;
if (isNativeProp && (!excludedPropNames || (excludedPropNames === null || excludedPropNames === void 0 ? void 0 : excludedPropNames.indexOf(key)) === -1)) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
result[key] = props[key];
}
}
return result;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));

File diff suppressed because one or more lines are too long