This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const jsx = (type, props = {}, key = null) => ({ | |
key, | |
type, | |
props | |
}); | |
export const Fragment = (props = {}) => props.children; | |
const NoFlags = 0b0000000; | |
const Placement = 0b0000001; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const HTML_TAGS = | |
`html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot`.split( | |
"," | |
); | |
const specialBooleanAttrs = | |
`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`.split( | |
"," | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shallowEqual(objA, objB) { | |
if (Object.is(objA, objB)) { | |
return true; | |
} | |
if (typeof objA !== 'object' || typeof objB !== 'object' | |
|| typeof objA === 'null' || typeof objB === 'null' | |
) { | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const config = { attributes: true, childList: true, subtree: true }; | |
const traverseFiber = (fiber, call, param1) => { | |
if (fiber) { | |
call(fiber, param1); | |
let child = fiber.child; | |
while (child) { | |
traverseFiber(child, call, param1); | |
child = child.sibling; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import * as ReactDOM from 'react-dom'; | |
const REACT_ELEMENT_TYPE = Symbol.for('react.element'); | |
const REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); | |
function isForward(object) { | |
if (typeof object === 'object' && object !== null) { | |
const $$typeof = object.$$typeof; | |
const type = object.type; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useReducer, useRef } from 'react'; | |
export const useConstant = (compute) => { | |
const ref = useRef(null); | |
if (ref.current === null) { | |
ref.current = compute(); | |
} | |
return ref.current; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let config = {}; | |
const containerMap = {}; | |
const remoteMap = {}; | |
let isDefaultScopeInitialized = false; | |
async function lookupExposedModule(key, exposedModule) { | |
const container = containerMap[key]; | |
const factory = await container.get(exposedModule); | |
const Module = factory(); | |
return Module; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isPromise(obj) { | |
return ( | |
Boolean(obj) && | |
(typeof obj === 'object' || typeof obj === 'function') && | |
typeof obj.then === 'function' && | |
typeof obj.catch === 'function' | |
); | |
} | |
function run(fn, args = [], { raceStampKey = 'raceStamp', timestamp } = {}) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const throwFatalError = () => { | |
throw new Error('Something went wrong.'); | |
}; | |
export function dataLoader(batchLoader) { | |
let pendingItems = null; | |
let dispatchTimer = null; | |
const destroyTimerAndPendingItems = () => { | |
clearTimeout(dispatchTimer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import useForceUpdate from './use-force-update'; | |
import useLayoutEffect from './useIsomorphicLayoutEffect'; | |
export const createSlots = (slotNames) => { | |
const SlotsContext = React.createContext({ | |
registerSlot: () => null, | |
unregisterSlot: () => null, | |
context: {}, | |
}); |
NewerOlder