diff --git a/packages/core/package.json b/packages/core/package.json index 34b2a888..ad1aa7a1 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@dark-engine/core", - "version": "0.7.6", + "version": "0.7.7", "description": "Dark is lightweight (10 Kb gzipped) component-and-hook-based UI rendering engine for javascript apps without dependencies and written in Typescript 💫", "author": "AlexPlex", "license": "MIT", diff --git a/packages/core/umd/dark-core.development.js b/packages/core/umd/dark-core.development.js index 2220e929..f2a31d62 100644 --- a/packages/core/umd/dark-core.development.js +++ b/packages/core/umd/dark-core.development.js @@ -707,7 +707,7 @@ function mutateFiber(options) { fiber.alternate.alternate = null; } if (!fiber.nativeElement && (0,_view__WEBPACK_IMPORTED_MODULE_4__.detectIsVirtualNode)(fiber.instance)) { - fiber.nativeElement = _platform__WEBPACK_IMPORTED_MODULE_1__.platform.createNativeElement(fiber); + fiber.nativeElement = _platform__WEBPACK_IMPORTED_MODULE_1__.platform.createNativeElement(fiber.instance); } } function mutateAlternate(options) { @@ -3028,15 +3028,10 @@ function getVirtualNodeKey(vNode) { var key = vNode && vNode.attrs[_constants__WEBPACK_IMPORTED_MODULE_0__.ATTR_KEY]; return !(0,_helpers__WEBPACK_IMPORTED_MODULE_1__.detectIsEmpty)(key) ? key : null; } -function Text(source) { - var text = typeof source === 'string' ? new TextVirtualNode(source) : detectIsTextVirtualNode(source) ? source.value : ''; - return text; -} -function Comment(text) { - var factory = function () { return new CommentVirtualNode(text); }; - factory[$$virtualNode] = true; - return factory; -} +var createEmptyVirtualNode = function () { return new CommentVirtualNode(_constants__WEBPACK_IMPORTED_MODULE_0__.EMPTY_NODE); }; +var detectIsVirtualNodeFactory = function (factory) { + return (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.detectIsFunction)(factory) && factory[$$virtualNode] === true; +}; function View(def) { var factory = function () { var as = def.as, slot = def.slot, _a = def.isVoid, isVoid = _a === void 0 ? false : _a, rest = __rest(def, ["as", "slot", "isVoid"]); @@ -3051,10 +3046,19 @@ function View(def) { factory[$$virtualNode] = true; return factory; } -var createEmptyVirtualNode = function () { return new CommentVirtualNode(_constants__WEBPACK_IMPORTED_MODULE_0__.EMPTY_NODE); }; -var detectIsVirtualNodeFactory = function (factory) { - return (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.detectIsFunction)(factory) && factory[$$virtualNode] === true; -}; +function Text(source) { + var text = (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.detectIsString)(source) + ? new TextVirtualNode(source) + : detectIsTextVirtualNode(source) + ? source.value + : ''; + return text; +} +function Comment(text) { + var factory = function () { return new CommentVirtualNode(text); }; + factory[$$virtualNode] = true; + return factory; +} diff --git a/packages/core/umd/dark-core.development.js.map b/packages/core/umd/dark-core.development.js.map index 947f2157..2d5b12c1 100644 --- a/packages/core/umd/dark-core.development.js.map +++ b/packages/core/umd/dark-core.development.js.map @@ -1 +1 @@ -{"version":3,"file":"dark-core.development.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACVwC;AACU;AAKlD,IAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AACxC,IAAM,cAAc,GAA0B;IAC5C,WAAW,EAAE,EAAE;IACf,YAAY,EAAE,EAAE;IAChB,KAAK,EAAE,WAAW;CACnB,CAAC;AACF;IASE,0BAAY,OAA4B;QAHjC,aAAQ,GAA+B,EAAE,CAAC;QAI/C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC;QACnC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAA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;YACzD,aAAa,GAAG,KAAK,CAAC;YACtB,QAAQ,GAAG,IAAI,CAAC;YAChB,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC;SAC9B;aAAM;YACL,SAAS,GAAG,IAAI,CAAC;SAClB;KACF;AACH,CAAC;AAEoB;;;;;;;UCtErB;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACN4B;AACF;AACqB;AACvB;AACG;AACA;AACD;AACH;AACA;AACD;AACE;AACC;AACE;AACI;AACD;AACO;AACI;AACb;AACA;AACY;AACc;AAC3B;AACG;AACJ;AACE;AACC;AACN;AACK;AACO;AACK","sources":["webpack://DarkCore/webpack/universalModuleDefinition","webpack://DarkCore/./src/component/component.ts","webpack://DarkCore/./src/component/index.ts","webpack://DarkCore/./src/component/types.ts","webpack://DarkCore/./src/constants.ts","webpack://DarkCore/./src/context/context.ts","webpack://DarkCore/./src/context/index.ts","webpack://DarkCore/./src/context/types.ts","webpack://DarkCore/./src/element/element.ts","webpack://DarkCore/./src/element/index.ts","webpack://DarkCore/./src/fiber/fiber.ts","webpack://DarkCore/./src/fiber/index.ts","webpack://DarkCore/./src/fiber/types.ts","webpack://DarkCore/./src/fragment/fragment.ts","webpack://DarkCore/./src/fragment/index.ts","webpack://DarkCore/./src/helpers/index.ts","webpack://DarkCore/./src/lazy/index.ts","webpack://DarkCore/./src/lazy/lazy.ts","webpack://DarkCore/./src/memo/index.ts","webpack://DarkCore/./src/memo/memo.ts","webpack://DarkCore/./src/platform/index.ts","webpack://DarkCore/./src/platform/platform.ts","webpack://DarkCore/./src/platform/types.ts","webpack://DarkCore/./src/ref/index.ts","webpack://DarkCore/./src/ref/ref.ts","webpack://DarkCore/./src/scope/index.ts","webpack://DarkCore/./src/scope/scope.ts","webpack://DarkCore/./src/shared/index.ts","webpack://DarkCore/./src/shared/types.ts","webpack://DarkCore/./src/suspense/index.ts","webpack://DarkCore/./src/suspense/suspense.ts","webpack://DarkCore/./src/unmount/index.ts","webpack://DarkCore/./src/unmount/unmount.ts","webpack://DarkCore/./src/use-callback/index.ts","webpack://DarkCore/./src/use-callback/use-callback.ts","webpack://DarkCore/./src/use-context/index.ts","webpack://DarkCore/./src/use-context/use-context.ts","webpack://DarkCore/./src/use-deferred-value/index.ts","webpack://DarkCore/./src/use-deferred-value/use-deferred-value.ts","webpack://DarkCore/./src/use-effect/index.ts","webpack://DarkCore/./src/use-effect/use-effect.ts","webpack://DarkCore/./src/use-error/index.ts","webpack://DarkCore/./src/use-error/use-error.ts","webpack://DarkCore/./src/use-event/index.ts","webpack://DarkCore/./src/use-event/use-event.ts","webpack://DarkCore/./src/use-imperative-handle/index.ts","webpack://DarkCore/./src/use-imperative-handle/use-imperative-handle.ts","webpack://DarkCore/./src/use-layout-effect/index.ts","webpack://DarkCore/./src/use-layout-effect/use-layout-effect.ts","webpack://DarkCore/./src/use-memo/index.ts","webpack://DarkCore/./src/use-memo/use-memo.ts","webpack://DarkCore/./src/use-reducer/index.ts","webpack://DarkCore/./src/use-reducer/use-reducer.ts","webpack://DarkCore/./src/use-ref/index.ts","webpack://DarkCore/./src/use-ref/use-ref.ts","webpack://DarkCore/./src/use-state/index.ts","webpack://DarkCore/./src/use-state/use-state.ts","webpack://DarkCore/./src/use-update/index.ts","webpack://DarkCore/./src/use-update/use-update.ts","webpack://DarkCore/./src/view/index.ts","webpack://DarkCore/./src/view/types.ts","webpack://DarkCore/./src/view/view.ts","webpack://DarkCore/./src/walk/index.ts","webpack://DarkCore/./src/walk/walk.ts","webpack://DarkCore/webpack/bootstrap","webpack://DarkCore/webpack/runtime/define property getters","webpack://DarkCore/webpack/runtime/hasOwnProperty shorthand","webpack://DarkCore/webpack/runtime/make namespace object","webpack://DarkCore/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"DarkCore\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"DarkCore\"] = factory();\n\telse\n\t\troot[\"DarkCore\"] = factory();\n})(self, () => {\nreturn ","import { ATTR_KEY } from '../constants';\r\nimport { error, detectIsEmpty } from '../helpers';\r\nimport type { DarkElementKey, DarkElementInstance } from '../shared';\r\nimport type { MutableRef } from '../ref';\r\nimport type { CreateElement, ComponentOptions, StandardComponentProps, SlotProps } from './types';\r\n\r\nconst $$component = Symbol('component');\r\nconst defaultOptions: ComponentOptions = {\r\n displayName: '',\r\n defaultProps: {},\r\n token: $$component,\r\n};\r\nclass ComponentFactory

{\r\n public type: CreateElement

;\r\n public token: Symbol;\r\n public props: P;\r\n public ref: MutableRef;\r\n public displayName: string;\r\n public children: Array = [];\r\n public shouldUpdate?: (props: P, nextProps: P) => boolean;\r\n\r\n constructor(options: ComponentFactory

) {\r\n this.type = options.type || null;\r\n this.token = options.token || null;\r\n this.props = options.props || null;\r\n this.ref = options.ref || null;\r\n this.displayName = options.displayName || '';\r\n this.shouldUpdate = options.shouldUpdate || null;\r\n }\r\n}\r\n\r\nfunction createComponent(\r\n createElement: CreateElement

,\r\n options: ComponentOptions

= {},\r\n) {\r\n type Props = P & StandardComponentProps;\r\n const computedOptions = { ...defaultOptions, ...options };\r\n const { token, defaultProps, displayName, shouldUpdate } = computedOptions;\r\n\r\n return (props = {} as Props, ref?: MutableRef): ComponentFactory => {\r\n const computedProps = { ...defaultProps, ...props };\r\n const factory = new ComponentFactory({\r\n token,\r\n ref,\r\n displayName,\r\n shouldUpdate,\r\n props: computedProps,\r\n type: createElement,\r\n children: [],\r\n });\r\n\r\n if (computedProps.ref) {\r\n delete computedProps.ref;\r\n\r\n if (process.env.NODE_ENV === 'development') {\r\n error(`[Dark]: To use ref you need to wrap the createComponent with forwardRef!`);\r\n }\r\n }\r\n\r\n return factory;\r\n };\r\n}\r\n\r\nconst detectIsComponentFactory = (factory: unknown): factory is ComponentFactory => factory instanceof ComponentFactory;\r\n\r\nconst getComponentFactoryKey = (factory: ComponentFactory): DarkElementKey =>\r\n !detectIsEmpty(factory.props[ATTR_KEY]) ? factory.props[ATTR_KEY] : null;\r\n\r\nexport { ComponentFactory, createComponent, detectIsComponentFactory, getComponentFactoryKey };\r\n","export * from './component';\r\nexport * from './types';\r\n","import type { ComponentFactory } from './component';\r\nimport type { DarkElementKey, DarkElement } from '../shared';\r\nimport type { MutableRef } from '../ref';\r\n\r\nexport type ComponentOptions

= Readonly<{\r\n displayName?: string;\r\n defaultProps?: Partial

;\r\n token?: Symbol;\r\n shouldUpdate?: (props: P, nextProps: P) => boolean;\r\n}>;\r\n\r\nexport type StandardComponentProps = KeyProps & SlotProps & RefProps;\r\n\r\nexport type KeyProps = {\r\n key?: DarkElementKey;\r\n};\r\n\r\nexport type SlotProps = Readonly<{\r\n slot?: T;\r\n}>;\r\n\r\nexport type RefProps = {\r\n ref?: MutableRef;\r\n};\r\n\r\nexport type Component = any, R = any> = (\r\n props: T,\r\n ref?: MutableRef,\r\n) => ComponentFactory;\r\n\r\nexport type ComponentFactoryReturnType = DarkElement;\r\n\r\nexport type CreateElement

= (\r\n props: P & Pick,\r\n ref?: MutableRef,\r\n) => ComponentFactoryReturnType;\r\n","export const ROOT = 'root';\r\nexport const EMPTY_NODE = 'dark:matter';\r\nexport const ATTR_KEY = 'key';\r\nexport const ATTR_REF = 'ref';\r\nexport const PARTIAL_UPDATE = 'partial-update';\r\n\r\nexport enum TaskPriority {\r\n HIGH = 2,\r\n NORMAL = 1,\r\n LOW = 0,\r\n}\r\n","import { createComponent } from '../component';\r\nimport { useEffect } from '../use-effect';\r\nimport { componentFiberHelper } from '../scope';\r\nimport { useContext } from '../use-context';\r\nimport { detectIsFunction } from '../helpers';\r\nimport type { Context, ContexProviderProps } from './types';\r\n\r\nfunction createContext(defaultValue: T): Context {\r\n let displayName = 'Context';\r\n const context: Context = {\r\n displayName,\r\n defaultValue,\r\n Provider: null,\r\n Consumer: null,\r\n };\r\n\r\n mutateContext(context, defaultValue, displayName);\r\n\r\n Object.defineProperty(context, 'displayName', {\r\n get: () => displayName,\r\n set: (newValue: string) => {\r\n displayName = newValue;\r\n mutateContext(context, defaultValue, displayName);\r\n },\r\n });\r\n\r\n return context;\r\n}\r\n\r\nfunction mutateContext(context: Context, defaultValue: T, displayName: string) {\r\n context.Provider = createProvider(context, defaultValue, displayName);\r\n context.Consumer = createConsumer(context, displayName);\r\n}\r\n\r\nfunction createProvider(context: Context, defaultValue: T, displayName: string) {\r\n return createComponent>(\r\n ({ value = defaultValue, slot }) => {\r\n const fiber = componentFiberHelper.get();\r\n\r\n if (!fiber.provider) {\r\n fiber.provider = new Map();\r\n }\r\n\r\n if (!fiber.provider.get(context)) {\r\n fiber.provider.set(context, {\r\n subscribers: [],\r\n value,\r\n });\r\n }\r\n\r\n const provider = fiber.provider.get(context);\r\n\r\n useEffect(() => {\r\n for (const subscriber of provider.subscribers) {\r\n subscriber(value);\r\n }\r\n }, [value]);\r\n\r\n provider.value = value;\r\n\r\n return slot;\r\n },\r\n { displayName: `${displayName}.Provider` },\r\n );\r\n}\r\n\r\nfunction createConsumer(context: Context, displayName: string) {\r\n return createComponent(\r\n ({ slot }) => {\r\n const value = useContext(context);\r\n\r\n return detectIsFunction(slot) ? slot(value) : null;\r\n },\r\n { displayName: `${displayName}.Consumer` },\r\n );\r\n}\r\n\r\nexport { createContext };\r\n","export * from './context';\r\nexport * from './types';\r\n","import type { Component, SlotProps } from '../component';\r\nimport type { DarkElement } from '../shared';\r\n\r\nexport type ContexProviderProps = {\r\n value: T;\r\n} & SlotProps;\r\n\r\nexport type Context = {\r\n Provider: Component>;\r\n Consumer: Component DarkElement>>;\r\n displayName?: string;\r\n defaultValue: T;\r\n};\r\n\r\nexport type ContextProviderValue = {\r\n value: T;\r\n subscribers: Array<(value: T) => void>;\r\n};\r\n","import { detectIsNumber, detectIsString, detectIsFunction } from '../helpers';\r\nimport { View, Text, type TagVirtualNodeFactory } from '../view';\r\n\r\nfunction getChildren(children: Array) {\r\n children = children.map(x => (detectIsString(x) || detectIsNumber(x) ? Text(x.toString()) : x));\r\n\r\n return children ? (Array.isArray(children) ? [...children] : [children]) : [];\r\n}\r\n\r\nfunction createElement(\r\n tag: string | Function,\r\n props: any,\r\n ...children: Array\r\n): TagVirtualNodeFactory | Function | null {\r\n if (detectIsString(tag)) {\r\n return View({\r\n ...props,\r\n as: tag,\r\n slot: getChildren(children),\r\n });\r\n }\r\n\r\n if (detectIsFunction(tag)) {\r\n let slot = getChildren(children);\r\n\r\n slot = slot.length === 1 ? slot[0] : slot;\r\n\r\n return tag({ ...props, slot });\r\n }\r\n\r\n return null;\r\n}\r\n\r\nexport { createElement };\r\n","export * from './element';\r\n","import { flatten, detectIsEmpty, error, keyBy, takeListFromEnd, detectIsUndefined, detectIsArray } from '../helpers';\r\nimport { platform } from '../platform';\r\nimport {\r\n wipRootHelper,\r\n currentRootHelper,\r\n nextUnitOfWorkHelper,\r\n deletionsHelper,\r\n fiberMountHelper,\r\n componentFiberHelper,\r\n fromHookUpdateHelper,\r\n effectStoreHelper,\r\n effectsHelper,\r\n layoutEffectsHelper,\r\n} from '../scope';\r\nimport { type ComponentFactory, detectIsComponentFactory, getComponentFactoryKey } from '../component';\r\nimport {\r\n type TagVirtualNode,\r\n detectIsTagVirtualNode,\r\n createEmptyVirtualNode,\r\n getVirtualNodeKey,\r\n detectIsVirtualNode,\r\n detectIsVirtualNodeFactory,\r\n} from '../view';\r\nimport { detectIsMemo } from '../memo';\r\nimport type { Context, ContextProviderValue } from '../context';\r\nimport type { DarkElementKey, DarkElement, DarkElementInstance } from '../shared';\r\nimport { PARTIAL_UPDATE } from '../constants';\r\nimport { type NativeElement, type Hook, EffectTag, cloneTagMap } from './types';\r\nimport { hasEffects } from '../use-effect';\r\nimport { hasLayoutEffects } from '../use-layout-effect';\r\nimport { walkFiber } from '../walk';\r\nimport { unmountFiber } from '../unmount';\r\n\r\nclass Fiber {\r\n public nativeElement: N;\r\n public parent: Fiber;\r\n public child: Fiber;\r\n public nextSibling: Fiber;\r\n public alternate: Fiber;\r\n public effectTag: EffectTag;\r\n public instance: DarkElementInstance;\r\n public hook: Hook;\r\n public shadow: Fiber;\r\n public provider: Map;\r\n public transposition: boolean;\r\n public mountedToHost: boolean;\r\n public portalHost: boolean;\r\n public effectHost: boolean;\r\n public layoutEffectHost: boolean;\r\n public childrenCount: number;\r\n public marker: string;\r\n public isUsed: boolean;\r\n public idx: number;\r\n public catchException: (error: Error) => void;\r\n\r\n constructor(options: Partial>) {\r\n this.nativeElement = options.nativeElement || null;\r\n this.parent = options.parent || null;\r\n this.child = options.child || null;\r\n this.nextSibling = options.nextSibling || null;\r\n this.alternate = options.alternate || null;\r\n this.effectTag = options.effectTag || null;\r\n this.instance = options.instance || null;\r\n this.hook = options.hook || createHook();\r\n this.shadow = options.shadow || null;\r\n this.provider = options.provider || null;\r\n this.transposition = !detectIsUndefined(options.transposition) ? options.transposition : false;\r\n this.mountedToHost = !detectIsUndefined(options.mountedToHost) || false;\r\n this.portalHost = !detectIsUndefined(options.portalHost) ? options.portalHost : false;\r\n this.effectHost = !detectIsUndefined(options.effectHost) ? options.effectHost : false;\r\n this.layoutEffectHost = !detectIsUndefined(options.layoutEffectHost) ? options.layoutEffectHost : false;\r\n this.childrenCount = options.childrenCount || 0;\r\n this.marker = options.marker || '';\r\n this.idx = options.idx || 0;\r\n this.isUsed = options.isUsed || false;\r\n }\r\n\r\n public markPortalHost() {\r\n this.portalHost = true;\r\n this.parent && !this.parent.portalHost && this.parent.markPortalHost();\r\n }\r\n\r\n public markEffectHost() {\r\n this.effectHost = true;\r\n this.parent && !this.parent.effectHost && this.parent.markEffectHost();\r\n }\r\n\r\n public markLayoutEffectHost() {\r\n this.layoutEffectHost = true;\r\n this.parent && !this.parent.layoutEffectHost && this.parent.markLayoutEffectHost();\r\n }\r\n\r\n public markMountedToHost() {\r\n this.mountedToHost = true;\r\n this.parent && !this.parent.mountedToHost && this.parent.markMountedToHost();\r\n }\r\n\r\n public setError(error: Error) {\r\n if (typeof this.catchException === 'function') {\r\n this.catchException(error);\r\n } else if (this.parent) {\r\n this.parent.setError(error);\r\n }\r\n }\r\n}\r\n\r\nfunction workLoop() {\r\n const wipFiber = wipRootHelper.get();\r\n let nextUnitOfWork = nextUnitOfWorkHelper.get();\r\n let shouldYield = false;\r\n let hasMoreWork = Boolean(nextUnitOfWork);\r\n\r\n while (nextUnitOfWork && !shouldYield) {\r\n nextUnitOfWork = performUnitOfWork(nextUnitOfWork);\r\n nextUnitOfWorkHelper.set(nextUnitOfWork);\r\n hasMoreWork = Boolean(nextUnitOfWork);\r\n shouldYield = platform.shouldYeildToHost();\r\n }\r\n\r\n if (!nextUnitOfWork && wipFiber) {\r\n commitChanges();\r\n }\r\n\r\n return hasMoreWork;\r\n}\r\n\r\nfunction performUnitOfWork(fiber: Fiber) {\r\n let isDeepWalking = true;\r\n let nextFiber = fiber;\r\n let shadow: Fiber = fiber.shadow;\r\n let instance = fiber.instance;\r\n\r\n while (true) {\r\n isDeepWalking = fiberMountHelper.deepWalking.get();\r\n nextFiber.hook.idx = 0;\r\n\r\n if (isDeepWalking) {\r\n const hasChildren = hasChildrenProp(instance) && instance.children.length > 0;\r\n\r\n if (hasChildren) {\r\n const { performedFiber, performedNextFiber, performedShadow, performedInstance } = performChild({\r\n nextFiber,\r\n shadow,\r\n instance,\r\n });\r\n\r\n nextFiber = performedNextFiber;\r\n shadow = performedShadow;\r\n instance = performedInstance;\r\n\r\n if (performedFiber) return performedFiber;\r\n } else {\r\n const { performedFiber, performedNextFiber, performedShadow, performedInstance } = performSibling({\r\n nextFiber,\r\n shadow,\r\n instance,\r\n });\r\n\r\n nextFiber = performedNextFiber;\r\n shadow = performedShadow;\r\n instance = performedInstance;\r\n\r\n if (performedFiber) return performedFiber;\r\n }\r\n } else {\r\n const { performedFiber, performedNextFiber, performedShadow, performedInstance } = performSibling({\r\n nextFiber,\r\n shadow,\r\n instance,\r\n });\r\n\r\n nextFiber = performedNextFiber;\r\n shadow = performedShadow;\r\n instance = performedInstance;\r\n\r\n if (performedFiber) return performedFiber;\r\n }\r\n\r\n performPartialUpdateEffects(nextFiber);\r\n\r\n if (nextFiber.parent === null) return null;\r\n }\r\n}\r\n\r\nfunction performPartialUpdateEffects(nextFiber: Fiber) {\r\n if (nextFiber.marker === PARTIAL_UPDATE) {\r\n const alternate = nextFiber.child?.alternate || null;\r\n const fiber = nextFiber.child || null;\r\n\r\n if (alternate && fiber && alternate.nextSibling && !fiber.nextSibling) {\r\n let nextFiber = alternate.nextSibling;\r\n const deletions: Array = [];\r\n\r\n while (nextFiber) {\r\n nextFiber.effectTag = EffectTag.DELETION;\r\n deletions.push(nextFiber);\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n deletionsHelper.get().push(...deletions);\r\n }\r\n }\r\n}\r\n\r\ntype PerformChildOptions = {\r\n nextFiber: Fiber;\r\n shadow: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction performChild(options: PerformChildOptions) {\r\n fiberMountHelper.jumpToChild();\r\n let nextFiber = options.nextFiber;\r\n let shadow = options.shadow;\r\n let instance = options.instance;\r\n\r\n shadow = shadow ? shadow.child : null;\r\n\r\n const alternate = getChildAlternate(nextFiber);\r\n const hook = getHook({ shadow, alternate, instance });\r\n const provider = shadow ? shadow.provider : alternate ? alternate.provider : null;\r\n let fiber = new Fiber({ hook, provider });\r\n\r\n componentFiberHelper.set(fiber);\r\n fiber.parent = nextFiber;\r\n\r\n const { performedInstance, performedShadow } = pertformInstance({\r\n instance,\r\n idx: 0,\r\n fiber,\r\n alternate,\r\n });\r\n instance = performedInstance || instance;\r\n shadow = performedShadow || shadow;\r\n alternate && mutateAlternate({ alternate, instance });\r\n mutateFiber({ fiber, alternate, instance });\r\n fiber = alternate ? performMemo({ fiber, alternate, instance }) : fiber;\r\n\r\n fiber.idx = 0;\r\n\r\n nextFiber.child = fiber;\r\n fiber.parent = nextFiber;\r\n fiber.shadow = shadow;\r\n nextFiber = fiber;\r\n\r\n cloneTagMap[fiber.parent.effectTag] && (fiber.effectTag = fiber.parent.effectTag);\r\n\r\n return {\r\n performedFiber: nextFiber,\r\n performedNextFiber: nextFiber,\r\n performedShadow: shadow,\r\n performedInstance: instance,\r\n };\r\n}\r\n\r\ntype PerformSiblingOptions = {\r\n nextFiber: Fiber;\r\n shadow: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction performSibling(options: PerformSiblingOptions) {\r\n fiberMountHelper.jumpToSibling();\r\n let nextFiber = options.nextFiber;\r\n let shadow = options.shadow;\r\n let instance = options.instance;\r\n const parent = nextFiber.parent.instance;\r\n const childrenIdx = fiberMountHelper.getIndex();\r\n const hasSibling = hasChildrenProp(parent) && parent.children[childrenIdx];\r\n\r\n if (hasSibling) {\r\n fiberMountHelper.deepWalking.set(true);\r\n\r\n shadow = shadow ? shadow.nextSibling : null;\r\n const alternate = getNextSiblingAlternate(nextFiber);\r\n const hook = getHook({ shadow, alternate, instance });\r\n const provider = shadow ? shadow.provider : alternate ? alternate.provider : null;\r\n let fiber = new Fiber({ hook, provider });\r\n\r\n componentFiberHelper.set(fiber);\r\n fiber.parent = nextFiber.parent;\r\n\r\n const { performedInstance, performedShadow } = pertformInstance({\r\n instance: parent,\r\n idx: childrenIdx,\r\n fiber,\r\n alternate,\r\n });\r\n instance = performedInstance || instance;\r\n shadow = performedShadow || shadow;\r\n alternate && mutateAlternate({ alternate, instance });\r\n mutateFiber({ fiber, alternate, instance });\r\n fiber = alternate ? performMemo({ fiber, alternate, instance }) : fiber;\r\n\r\n fiber.idx = childrenIdx;\r\n\r\n fiber.parent = nextFiber.parent;\r\n nextFiber.nextSibling = fiber;\r\n fiber.shadow = shadow;\r\n nextFiber = fiber;\r\n\r\n cloneTagMap[fiber.parent.effectTag] && (fiber.effectTag = fiber.parent.effectTag);\r\n\r\n return {\r\n performedFiber: nextFiber,\r\n performedNextFiber: nextFiber,\r\n performedShadow: shadow,\r\n performedInstance: instance,\r\n };\r\n } else {\r\n fiberMountHelper.jumpToParent();\r\n fiberMountHelper.deepWalking.set(false);\r\n shadow = shadow ? shadow.parent : null;\r\n nextFiber = nextFiber.parent;\r\n instance = nextFiber.instance;\r\n\r\n if (hasChildrenProp(nextFiber.instance)) {\r\n nextFiber.instance.children = [];\r\n }\r\n }\r\n\r\n return {\r\n performedFiber: null,\r\n performedNextFiber: nextFiber,\r\n performedShadow: shadow,\r\n performedInstance: instance,\r\n };\r\n}\r\n\r\ntype MutateFiberOptions = {\r\n fiber: Fiber;\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction mutateFiber(options: MutateFiberOptions) {\r\n const { fiber, alternate, instance } = options;\r\n const key = alternate ? getElementKey(alternate.instance) : null;\r\n const nextKey = alternate ? getElementKey(instance) : null;\r\n const isDifferentKeys = key !== nextKey;\r\n const isSameType = Boolean(alternate) && getInstanceType(alternate.instance) === getInstanceType(instance);\r\n const isUpdate = isSameType && !isDifferentKeys;\r\n\r\n fiber.instance = instance;\r\n fiber.alternate = alternate || null;\r\n fiber.nativeElement = isUpdate ? alternate.nativeElement : null;\r\n fiber.effectTag = isUpdate ? EffectTag.UPDATE : EffectTag.PLACEMENT;\r\n fiber.mountedToHost = isUpdate;\r\n\r\n if (hasChildrenProp(fiber.instance)) {\r\n fiber.childrenCount = fiber.instance.children.length;\r\n }\r\n\r\n if (fiber.alternate) {\r\n fiber.alternate.shadow = null;\r\n fiber.alternate.alternate = null;\r\n }\r\n\r\n if (!fiber.nativeElement && detectIsVirtualNode(fiber.instance)) {\r\n fiber.nativeElement = platform.createNativeElement(fiber);\r\n }\r\n}\r\n\r\ntype PerformAlternateOptions = {\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction mutateAlternate(options: PerformAlternateOptions) {\r\n const { alternate, instance } = options;\r\n const alternateType = getInstanceType(alternate.instance);\r\n const elementType = getInstanceType(instance);\r\n const isSameType = elementType === alternateType;\r\n const prevKey = getElementKey(alternate.instance);\r\n const nextKey = getElementKey(instance);\r\n const isSameKeys = prevKey === nextKey;\r\n\r\n alternate.isUsed = true;\r\n\r\n if (!isSameType || !isSameKeys) {\r\n alternate.effectTag = EffectTag.DELETION;\r\n deletionsHelper.get().push(alternate);\r\n } else if (hasChildrenProp(alternate.instance) && hasChildrenProp(instance)) {\r\n const prevElementsCount = alternate.childrenCount;\r\n const nextElementsCount = instance.children.length;\r\n const isRequestedKeys = prevElementsCount !== nextElementsCount;\r\n\r\n if (isRequestedKeys) {\r\n const children = hasChildrenProp(instance) ? instance.children : [];\r\n const { prevKeys, nextKeys } = extractKeys(alternate.child, children);\r\n const hasPrevKeys = prevKeys.length > 0;\r\n const hasNextKeys = nextKeys.length > 0;\r\n const hasAnyKeys = hasPrevKeys || hasNextKeys;\r\n\r\n if (process.env.NODE_ENV === 'development') {\r\n if (!hasAnyKeys && prevElementsCount !== 0 && nextElementsCount !== 0) {\r\n error(`\r\n [Dark]: Operation of inserting, adding, replacing elements into list requires to have a unique key for every node (string or number, but not array index)!\r\n `);\r\n }\r\n }\r\n\r\n const performRemovingNodes = () => {\r\n const diffKeys = getDiffKeys(prevKeys, nextKeys);\r\n\r\n if (diffKeys.length > 0) {\r\n const fibersMap = createFibersByKeyMap(alternate.child);\r\n\r\n for (const key of diffKeys) {\r\n const fiber = fibersMap[key] || null;\r\n\r\n if (fiber) {\r\n fiber.effectTag = EffectTag.DELETION;\r\n deletionsHelper.get().push(fiber);\r\n }\r\n }\r\n } else {\r\n const diffCount = prevElementsCount - nextElementsCount;\r\n if (diffCount === 0) return;\r\n const fibers = takeListFromEnd(getSiblingFibers(alternate.child), diffCount);\r\n\r\n for (const fiber of fibers) {\r\n fiber.effectTag = EffectTag.DELETION;\r\n }\r\n\r\n deletionsHelper.get().push(...fibers);\r\n }\r\n };\r\n\r\n const performInsertingNodes = () => {\r\n const diffKeys = getDiffKeys(nextKeys, prevKeys);\r\n\r\n if (diffKeys.length === 0) return;\r\n\r\n const diffKeyMap = keyBy(diffKeys, x => x);\r\n const usedKeyMap = {};\r\n let keyIdx = 0;\r\n\r\n for (const nextKey of nextKeys) {\r\n if (process.env.NODE_ENV === 'development') {\r\n if (usedKeyMap[nextKey]) {\r\n error(`Some key of node already has been used!`);\r\n }\r\n }\r\n\r\n usedKeyMap[nextKey] = true;\r\n\r\n if (nextKey !== prevKeys[keyIdx] && diffKeyMap[nextKey]) {\r\n const insertionFiber = new Fiber({\r\n instance: createEmptyVirtualNode(),\r\n parent: alternate,\r\n effectTag: EffectTag.PLACEMENT,\r\n });\r\n\r\n if (keyIdx === 0) {\r\n insertionFiber.nextSibling = alternate.child;\r\n alternate.child = insertionFiber;\r\n } else {\r\n const [fiber, prevFiber] = getFibersByIdx(alternate.child, keyIdx);\r\n\r\n if (fiber && prevFiber) {\r\n insertionFiber.nextSibling = fiber;\r\n prevFiber.nextSibling = insertionFiber;\r\n }\r\n }\r\n }\r\n\r\n keyIdx++;\r\n }\r\n };\r\n\r\n performRemovingNodes();\r\n performInsertingNodes();\r\n }\r\n }\r\n}\r\n\r\ntype PerformMemoOptions = {\r\n fiber: Fiber;\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction performMemo(options: PerformMemoOptions) {\r\n const { fiber, alternate, instance } = options;\r\n\r\n if (detectIsMemo(fiber.instance)) {\r\n let memoFiber: Fiber = null;\r\n const factory = instance as ComponentFactory;\r\n const alternateFactory = alternate.instance as ComponentFactory;\r\n\r\n if (factory.type !== alternateFactory.type) return fiber;\r\n\r\n const props = alternateFactory.props;\r\n const nextProps = factory.props;\r\n const skip = !factory.shouldUpdate(props, nextProps);\r\n\r\n if (skip) {\r\n let nextFiber: Fiber = null;\r\n fiberMountHelper.deepWalking.set(false);\r\n\r\n memoFiber = new Fiber({\r\n ...alternate,\r\n alternate,\r\n effectTag: EffectTag.SKIP,\r\n nextSibling: alternate.nextSibling\r\n ? alternate.nextSibling.effectTag === EffectTag.DELETION\r\n ? null\r\n : alternate.nextSibling\r\n : null,\r\n });\r\n\r\n alternate.alternate = null;\r\n nextFiber = memoFiber.child;\r\n\r\n while (nextFiber) {\r\n nextFiber.parent = memoFiber;\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n if (memoFiber.effectHost) {\r\n fiber.markEffectHost();\r\n }\r\n\r\n if (memoFiber.layoutEffectHost) {\r\n fiber.markLayoutEffectHost();\r\n }\r\n\r\n if (memoFiber.mountedToHost) {\r\n fiber.markMountedToHost();\r\n }\r\n\r\n if (memoFiber.portalHost) {\r\n fiber.markPortalHost();\r\n }\r\n\r\n return memoFiber;\r\n }\r\n }\r\n\r\n return fiber;\r\n}\r\n\r\ntype PerformInstanceOptions = {\r\n instance: DarkElementInstance;\r\n idx: number;\r\n fiber: Fiber;\r\n alternate: Fiber;\r\n};\r\n\r\nfunction pertformInstance(options: PerformInstanceOptions) {\r\n const { instance, idx, fiber, alternate } = options;\r\n let performedInstance: DarkElementInstance = null;\r\n let performedShadow: Fiber = null;\r\n\r\n if (hasChildrenProp(instance)) {\r\n const elements = detectIsArray(instance.children[idx])\r\n ? flatten([instance.children[idx]])\r\n : [instance.children[idx]];\r\n\r\n instance.children.splice(idx, 1, ...elements);\r\n performedInstance = instance.children[idx];\r\n performedShadow = alternate\r\n ? getRootShadow({\r\n instance: performedInstance,\r\n fiber,\r\n alternate,\r\n })\r\n : performedShadow;\r\n performedInstance = mountInstance(fiber, performedInstance);\r\n }\r\n\r\n if (detectIsComponentFactory(performedInstance)) {\r\n if (hasEffects(fiber)) {\r\n fiber.markEffectHost();\r\n }\r\n\r\n if (hasLayoutEffects(fiber)) {\r\n fiber.markLayoutEffectHost();\r\n }\r\n\r\n if (platform.detectIsPortal(performedInstance)) {\r\n fiber.markPortalHost();\r\n }\r\n }\r\n\r\n return {\r\n performedInstance,\r\n performedShadow,\r\n };\r\n}\r\n\r\ntype GetRootShadowOptions = {\r\n instance: DarkElementInstance;\r\n fiber: Fiber;\r\n alternate: Fiber;\r\n};\r\n\r\nfunction getRootShadow(options: GetRootShadowOptions) {\r\n const { instance, fiber, alternate } = options;\r\n const key = getElementKey(alternate.instance);\r\n const nextKey = getElementKey(instance);\r\n let shadow: Fiber = null;\r\n\r\n if (key !== nextKey) {\r\n shadow = getAlternateByKey(nextKey, alternate.parent.child);\r\n\r\n if (shadow) {\r\n fiber.hook = shadow.hook;\r\n fiber.provider = shadow.provider;\r\n alternate.transposition = true;\r\n }\r\n }\r\n\r\n return shadow;\r\n}\r\n\r\nfunction mountInstance(fiber: Fiber, instance: DarkElementInstance) {\r\n const isComponentFactory = detectIsComponentFactory(instance);\r\n const factory = instance as ComponentFactory;\r\n\r\n if (isComponentFactory) {\r\n try {\r\n const result = factory.type(factory.props, factory.ref);\r\n\r\n factory.children = detectIsArray(result)\r\n ? (flatten([result]) as Array)\r\n : ([result] as Array);\r\n } catch (err) {\r\n factory.children = [];\r\n fiber.setError(err);\r\n error(err);\r\n }\r\n } else if (detectIsVirtualNodeFactory(instance)) {\r\n instance = instance();\r\n }\r\n\r\n if (hasChildrenProp(instance)) {\r\n for (let i = 0; i < instance.children.length; i++) {\r\n if (!instance.children[i]) {\r\n instance.children[i] = transformElementInstance(instance.children[i]) as DarkElementInstance;\r\n }\r\n }\r\n\r\n instance.children = isComponentFactory\r\n ? instance.children\r\n : detectIsArray(instance.children)\r\n ? flatten([instance.children])\r\n : [instance.children];\r\n\r\n if (isComponentFactory && factory.children.length === 0) {\r\n factory.children.push(createEmptyVirtualNode());\r\n }\r\n }\r\n\r\n return instance;\r\n}\r\n\r\nfunction getFibersByIdx(fiber: Fiber, idx: number): [Fiber | null, Fiber | null] {\r\n const map: Record = {};\r\n let nextFiber = fiber;\r\n let position = 0;\r\n\r\n while (nextFiber) {\r\n map[position] = nextFiber;\r\n\r\n if (position === idx) {\r\n return [map[position] || null, map[position - 1] || null];\r\n }\r\n\r\n position++;\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return [null, null];\r\n}\r\n\r\nfunction createFibersByKeyMap(fiber: Fiber) {\r\n let nextFiber = fiber;\r\n const map: Record = {};\r\n\r\n while (nextFiber) {\r\n const key = getElementKey(nextFiber.instance);\r\n\r\n if (!detectIsEmpty(key)) {\r\n map[key] = nextFiber;\r\n }\r\n\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return map;\r\n}\r\n\r\nfunction extractKeys(alternate: Fiber, children: Array) {\r\n let nextFiber = alternate;\r\n let idx = 0;\r\n const prevKeys: Array = [];\r\n const nextKeys: Array = [];\r\n\r\n while (nextFiber || idx < children.length) {\r\n const key = nextFiber && getElementKey(nextFiber.instance);\r\n const nextKey = children[idx] && getElementKey(children[idx]);\r\n\r\n if (!detectIsEmpty(key)) {\r\n prevKeys.push(key);\r\n }\r\n\r\n if (!detectIsEmpty(nextKey)) {\r\n nextKeys.push(nextKey);\r\n }\r\n\r\n nextFiber = nextFiber ? nextFiber.nextSibling : null;\r\n idx++;\r\n }\r\n\r\n return {\r\n prevKeys,\r\n nextKeys,\r\n };\r\n}\r\n\r\nfunction getAlternateByKey(key: DarkElementKey, fiber: Fiber) {\r\n if (detectIsEmpty(key)) return null;\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n if (key === getElementKey(nextFiber.instance)) {\r\n return nextFiber;\r\n }\r\n\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return null;\r\n}\r\n\r\nfunction getElementKey(instance: DarkElementInstance): DarkElementKey | null {\r\n const key = detectIsComponentFactory(instance)\r\n ? getComponentFactoryKey(instance)\r\n : detectIsTagVirtualNode(instance)\r\n ? getVirtualNodeKey(instance)\r\n : null;\r\n\r\n return key;\r\n}\r\n\r\nfunction getDiffKeys(keys: Array, nextKeys: Array): Array {\r\n const nextKeysMap = nextKeys.reduce((acc, key) => ((acc[key] = true), acc), {});\r\n const diff = [];\r\n\r\n for (const key of keys) {\r\n if (!nextKeysMap[key]) {\r\n diff.push(key);\r\n }\r\n }\r\n\r\n return diff;\r\n}\r\n\r\nfunction getChildAlternate(fiber: Fiber): Fiber | null {\r\n let alternate = fiber.alternate && fiber.alternate.effectTag !== EffectTag.DELETION ? fiber.alternate.child : null;\r\n\r\n while (alternate && alternate.effectTag === EffectTag.DELETION) {\r\n alternate = alternate.nextSibling;\r\n }\r\n\r\n return alternate;\r\n}\r\n\r\nfunction getNextSiblingAlternate(fiber: Fiber): Fiber | null {\r\n let alternate = fiber.alternate?.nextSibling || null;\r\n\r\n while (alternate && alternate.effectTag === EffectTag.DELETION) {\r\n alternate = alternate.nextSibling;\r\n }\r\n\r\n return alternate;\r\n}\r\n\r\nfunction transformElementInstance(instance: DarkElement) {\r\n return detectIsEmpty(instance) || instance === false ? createEmptyVirtualNode() : instance;\r\n}\r\n\r\nfunction getInstanceType(instance: DarkElementInstance): string | Function {\r\n return detectIsTagVirtualNode(instance)\r\n ? instance.name\r\n : detectIsVirtualNode(instance)\r\n ? instance.type\r\n : detectIsComponentFactory(instance)\r\n ? instance.type\r\n : null;\r\n}\r\n\r\nfunction getSiblingFibers(fiber: Fiber): Array {\r\n const list = [];\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n list.push(nextFiber);\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return list;\r\n}\r\n\r\nfunction hasChildrenProp(element: DarkElementInstance): element is TagVirtualNode | ComponentFactory {\r\n return detectIsTagVirtualNode(element) || detectIsComponentFactory(element);\r\n}\r\n\r\nfunction commitChanges() {\r\n const wipFiber = wipRootHelper.get();\r\n const fromHook = fromHookUpdateHelper.get();\r\n\r\n commitWork(wipFiber.child, () => {\r\n const layoutEffects = layoutEffectsHelper.get();\r\n const effects = effectsHelper.get();\r\n\r\n wipRootHelper.set(null);\r\n\r\n for (const layoutEffect of layoutEffects) {\r\n layoutEffect();\r\n }\r\n\r\n setTimeout(() => {\r\n for (const effect of effects) {\r\n effect();\r\n }\r\n });\r\n\r\n layoutEffectsHelper.reset();\r\n effectsHelper.reset();\r\n\r\n if (fromHook) {\r\n fromHookUpdateHelper.set(false);\r\n } else {\r\n currentRootHelper.set(wipFiber);\r\n }\r\n });\r\n}\r\n\r\nfunction commitWork(fiber: Fiber, onComplete: Function) {\r\n const deletions = deletionsHelper.get();\r\n\r\n // important order\r\n for (const fiber of deletions) {\r\n unmountFiber(fiber);\r\n platform.applyCommit(fiber);\r\n }\r\n\r\n walkFiber({\r\n fiber,\r\n onLoop: ({ nextFiber, isReturn, resetIsDeepWalking }) => {\r\n const skip = nextFiber.effectTag === EffectTag.SKIP;\r\n\r\n if (skip) {\r\n resetIsDeepWalking();\r\n } else if (!isReturn) {\r\n platform.applyCommit(nextFiber);\r\n }\r\n\r\n if (nextFiber && nextFiber.shadow) {\r\n nextFiber.shadow = null;\r\n }\r\n },\r\n });\r\n\r\n platform.finishCommitWork();\r\n deletionsHelper.set([]);\r\n onComplete();\r\n}\r\n\r\nfunction createHook(): Hook {\r\n return {\r\n idx: 0,\r\n values: [],\r\n };\r\n}\r\n\r\ntype GetHookOptions = {\r\n shadow: Fiber;\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction getHook(options: GetHookOptions) {\r\n const { shadow, alternate, instance } = options;\r\n\r\n if (shadow) return shadow.hook;\r\n\r\n if (alternate && getElementKey(alternate.instance) === getElementKey(instance)) {\r\n return alternate.hook;\r\n }\r\n\r\n return createHook();\r\n}\r\n\r\ntype CreateUpdateCallbackOptions = {\r\n rootId: number;\r\n fiber: Fiber;\r\n forceStart?: boolean;\r\n onStart: () => void;\r\n};\r\n\r\nfunction createUpdateCallback(options: CreateUpdateCallbackOptions) {\r\n const { rootId, fiber, forceStart = false, onStart } = options;\r\n const callback = () => {\r\n forceStart && onStart();\r\n if (fiber.isUsed) return;\r\n !forceStart && onStart();\r\n effectStoreHelper.set(rootId); // important order!\r\n fromHookUpdateHelper.set(true);\r\n fiberMountHelper.reset();\r\n\r\n fiber.alternate = new Fiber({\r\n ...fiber,\r\n alternate: null,\r\n });\r\n fiber.marker = PARTIAL_UPDATE;\r\n fiber.effectTag = EffectTag.UPDATE;\r\n fiber.child = null;\r\n\r\n wipRootHelper.set(fiber);\r\n componentFiberHelper.set(fiber);\r\n fiber.instance = mountInstance(fiber, fiber.instance);\r\n nextUnitOfWorkHelper.set(fiber);\r\n };\r\n\r\n return callback;\r\n}\r\n\r\nexport { Fiber, workLoop, createHook, hasChildrenProp, createUpdateCallback };\r\n","export * from './fiber';\r\nexport * from './types';\r\n","export enum EffectTag {\r\n PLACEMENT = 'PLACEMENT',\r\n UPDATE = 'UPDATE',\r\n DELETION = 'DELETION',\r\n SKIP = 'SKIP',\r\n}\r\n\r\nexport type NativeElement = unknown;\r\n\r\nexport type HookValue = {\r\n token?: Symbol;\r\n deps: Array;\r\n value: T;\r\n};\r\n\r\nexport type Hook = {\r\n idx: number;\r\n values: Array;\r\n};\r\n\r\nexport const cloneTagMap = {\r\n [EffectTag.PLACEMENT]: true,\r\n [EffectTag.SKIP]: true,\r\n};\r\n","import { type KeyProps, createComponent, detectIsComponentFactory } from '../component';\r\n\r\nconst $$fragment = Symbol('fragment');\r\n\r\nconst Fragment = createComponent(({ slot }) => slot || null, {\r\n token: $$fragment,\r\n});\r\n\r\nconst detectIsFragment = (factory: unknown) => detectIsComponentFactory(factory) && factory.token === $$fragment;\r\n\r\nexport { Fragment, detectIsFragment };\r\n","export * from './fragment';\r\n","import type { NestedArray } from '../shared';\r\n\r\nconst detectIsFunction = (o: any): o is Function => typeof o === 'function';\r\nconst detectIsUndefined = (o: any) => typeof o === 'undefined';\r\nconst detectIsNumber = (o: any) => typeof o === 'number';\r\nconst detectIsString = (o: any) => typeof o === 'string';\r\nconst detectIsObject = (o: any) => typeof o === 'object';\r\nconst detectIsBoolean = (o: any) => typeof o === 'boolean';\r\nconst detectIsArray = (o: any): o is Array => Array.isArray(o);\r\nconst detectIsNull = (o: any) => o === null;\r\nconst detectIsEmpty = (o: any) => detectIsNull(o) || detectIsUndefined(o);\r\n\r\nfunction error(str: string) {\r\n !detectIsUndefined(console) && console.error(str);\r\n}\r\n\r\nfunction flatten(source: Array>): Array {\r\n const list = [];\r\n const levelMap = { 0: { idx: 0, source } };\r\n let level = 0;\r\n\r\n do {\r\n const { source, idx } = levelMap[level];\r\n const item = source[idx];\r\n\r\n if (idx >= source.length) {\r\n level--;\r\n levelMap[level].idx++;\r\n continue;\r\n }\r\n\r\n if (detectIsArray(item)) {\r\n level++;\r\n levelMap[level] = {\r\n idx: 0,\r\n source: item,\r\n };\r\n } else {\r\n list.push(item);\r\n levelMap[level].idx++;\r\n }\r\n } while (level > 0 || levelMap[level].idx < levelMap[level].source.length);\r\n\r\n return list;\r\n}\r\n\r\nfunction getTime() {\r\n return Date.now();\r\n}\r\n\r\nfunction keyBy(\r\n list: Array,\r\n fn: (o: T) => string | number,\r\n value = false,\r\n): Record {\r\n return list.reduce((acc, x) => ((acc[fn(x)] = value ? x : true), acc), {});\r\n}\r\n\r\nfunction takeListFromEnd(source: Array, count: number) {\r\n return source.slice(source.length - count, source.length);\r\n}\r\n\r\nconst dummyFn = () => {};\r\n\r\nfunction detectIsDepsDifferent(deps: Array, prevDeps: Array): boolean {\r\n if (!detectIsUndefined(deps) && !detectIsUndefined(prevDeps) && deps.length > 0 && prevDeps.length > 0) {\r\n for (let i = 0; i < prevDeps.length; i++) {\r\n if (prevDeps[i] !== deps[i]) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n}\r\n\r\nexport {\r\n detectIsFunction,\r\n detectIsUndefined,\r\n detectIsNumber,\r\n detectIsString,\r\n detectIsObject,\r\n detectIsBoolean,\r\n detectIsArray,\r\n detectIsNull,\r\n detectIsEmpty,\r\n error,\r\n flatten,\r\n getTime,\r\n keyBy,\r\n takeListFromEnd,\r\n dummyFn,\r\n detectIsDepsDifferent,\r\n};\r\n","export * from './lazy';\r\n","import { type Component, createComponent, detectIsComponentFactory } from '../component';\r\nimport { useState } from '../use-state';\r\nimport { useEffect } from '../use-effect';\r\nimport { forwardRef } from '../ref';\r\nimport { SuspenseContext } from '../suspense';\r\nimport { useContext } from '../use-context';\r\n\r\nconst $$lazy = Symbol('lazy');\r\n\r\ntype LazyScope = {\r\n component: Component;\r\n};\r\n\r\nfunction lazy(dynamic: () => Promise<{ default: Component

}>) {\r\n return forwardRef(\r\n createComponent(\r\n (props, ref) => {\r\n const { fallback, trigger } = useContext(SuspenseContext);\r\n const [scope, setScope] = useState>({\r\n component: null,\r\n });\r\n\r\n useEffect(() => {\r\n fetchModule(dynamic).then(component => {\r\n setScope({ component });\r\n });\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (!scope.component) return;\r\n trigger();\r\n }, [scope.component]);\r\n\r\n return scope.component ? scope.component(props, ref) : fallback;\r\n },\r\n { token: $$lazy },\r\n ),\r\n );\r\n}\r\n\r\nconst detectIsLazy = (factory: unknown) => detectIsComponentFactory(factory) && factory.token === $$lazy;\r\n\r\nfunction fetchModule(dynamic: () => Promise<{ default: Component }>) {\r\n return new Promise(resolve => {\r\n dynamic().then(module => {\r\n if (!module.default) {\r\n throw new Error('[Dark]: lazy loaded component should be exported as default!');\r\n }\r\n\r\n resolve(module.default);\r\n });\r\n });\r\n}\r\n\r\nexport { lazy, detectIsLazy };\r\n","export * from './memo';\r\n","import {\r\n type Component,\r\n type ComponentFactory,\r\n type StandardComponentProps,\r\n type RefProps,\r\n type SlotProps,\r\n createComponent,\r\n detectIsComponentFactory,\r\n} from '../component';\r\nimport { type MutableRef, forwardRef } from '../ref';\r\n\r\ntype ShouldUpdate = (props: T, nextProps: T) => boolean;\r\n\r\nconst $$memo = Symbol('memo');\r\n\r\nconst defaultShouldUpdate = (props: {}, nextProps: {}): boolean => {\r\n const keys = Object.keys(nextProps);\r\n\r\n for (const key of keys) {\r\n if (key !== 'slot' && nextProps[key] !== props[key]) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n};\r\n\r\nconst detectIsMemo = (factory: unknown) => detectIsComponentFactory(factory) && factory.token === $$memo;\r\n\r\nfunction memo(\r\n component: (props: T, ref?: MutableRef) => ComponentFactory,\r\n shouldUpdate: ShouldUpdate = defaultShouldUpdate,\r\n): Component {\r\n return forwardRef(\r\n createComponent(\r\n (props: T & RefProps, ref) => {\r\n ref && (props.ref = ref);\r\n\r\n return component(props);\r\n },\r\n { token: $$memo, shouldUpdate },\r\n ),\r\n );\r\n}\r\n\r\nexport { $$memo, memo, detectIsMemo };\r\n","export * from './platform';\r\nexport * from './types';\r\n","import type { Platform } from './types';\r\n\r\nexport const platform: Platform = {\r\n scheduleCallback: () => {\r\n throw new Error('scheduleCallback not installed by renderer');\r\n },\r\n shouldYeildToHost: () => {\r\n throw new Error('shouldYeildToHost not installed by renderer');\r\n },\r\n createNativeElement: () => {\r\n throw new Error('createNativeElement not installed by renderer');\r\n },\r\n applyCommit: () => {\r\n throw new Error('applyCommit not installed by renderer');\r\n },\r\n finishCommitWork: () => {\r\n throw new Error('finishCommitWork not installed by renderer');\r\n },\r\n detectIsPortal: () => {\r\n throw new Error('detectIsPortal not installed by renderer');\r\n },\r\n unmountPortal: () => {\r\n throw new Error('unmountPortal not installed by renderer');\r\n },\r\n};\r\n","import { type Fiber } from '../fiber';\r\nimport { type TaskPriority } from '../constants';\r\nimport { type ComponentFactory } from '../component';\r\n\r\nexport type Platform = {\r\n scheduleCallback: (callback: () => void, options?: ScheduleCallbackOptions) => void;\r\n shouldYeildToHost: () => boolean;\r\n createNativeElement: (fiber: Fiber) => N;\r\n applyCommit: (fiber: Fiber) => void;\r\n finishCommitWork: () => void;\r\n detectIsPortal: (factory: ComponentFactory) => boolean;\r\n unmountPortal: (fiber: Fiber) => void;\r\n};\r\n\r\nexport type ScheduleCallbackOptions = {\r\n priority?: TaskPriority;\r\n timeoutMs?: number;\r\n};\r\n","export * from './ref';\r\nexport type { MutableRef } from './types';\r\n","import { detectIsObject, detectIsNull } from '../helpers';\r\nimport type { Component, RefProps, ComponentFactory } from '../component';\r\nimport type { MutableRef } from './types';\r\n\r\nfunction forwardRef(component: Component) {\r\n type Props = P & RefProps;\r\n\r\n return ({ ref, ...rest }: Props) => {\r\n return component(rest as P, ref) as ComponentFactory;\r\n };\r\n}\r\n\r\nconst detectIsRef = (ref: unknown) => {\r\n if (!detectIsObject(ref) || detectIsNull(ref)) return false;\r\n const mutableRef = ref as MutableRef;\r\n\r\n for (const key in mutableRef) {\r\n if (key === 'current' && mutableRef.hasOwnProperty(key)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n};\r\n\r\nexport { forwardRef, detectIsRef };\r\n","export * from './scope';\r\n","import type { Fiber } from '../fiber';\r\n\r\nclass Store {\r\n public wipRoot: Fiber = null;\r\n public currentRoot: Fiber = null;\r\n public nextUnitOfWork: Fiber = null;\r\n public fromHookUpdate = false;\r\n public events: Map> = new Map();\r\n public unsubscribers: Array<() => void> = [];\r\n public deletions: Array = [];\r\n public fiberMount = {\r\n level: 0,\r\n navigation: {},\r\n isDeepWalking: true,\r\n };\r\n public componentFiber: Fiber = null;\r\n public effects: Array<() => void> = [];\r\n public layoutEffects: Array<() => void> = [];\r\n}\r\n\r\nlet rootId = null;\r\nconst stores = new Map();\r\n\r\nconst effectStoreHelper = {\r\n set: (id: number) => effectStore(id),\r\n remove: (id: number) => stores.delete(id),\r\n};\r\n\r\nconst getRootId = (): number => rootId;\r\n\r\nconst effectStore = (id: number) => {\r\n rootId = id;\r\n !stores.get(rootId) && stores.set(rootId, new Store());\r\n};\r\n\r\nconst storeHelper = {\r\n get: (id: number = rootId) => stores.get(id),\r\n};\r\n\r\nconst wipRootHelper = {\r\n get: () => storeHelper.get()?.wipRoot || null,\r\n set: (fiber: Fiber) => (storeHelper.get().wipRoot = fiber),\r\n};\r\n\r\nconst currentRootHelper = {\r\n get: (id?: number) => storeHelper.get(id)?.currentRoot || null,\r\n set: (fiber: Fiber) => (storeHelper.get().currentRoot = fiber),\r\n};\r\n\r\nconst nextUnitOfWorkHelper = {\r\n get: () => storeHelper.get()?.nextUnitOfWork || null,\r\n set: (fiber: Fiber) => (storeHelper.get().nextUnitOfWork = fiber),\r\n};\r\n\r\nconst componentFiberHelper = {\r\n get: () => storeHelper.get()?.componentFiber,\r\n set: (fiber: Fiber) => (storeHelper.get().componentFiber = fiber),\r\n};\r\n\r\nconst fromHookUpdateHelper = {\r\n get: () => storeHelper.get()?.fromHookUpdate || false,\r\n set: (value: boolean) => (storeHelper.get().fromHookUpdate = value),\r\n};\r\n\r\nconst eventsHelper = {\r\n get: () => storeHelper.get().events,\r\n addUnsubscriber: (fn: () => void) => storeHelper.get().unsubscribers.push(fn),\r\n mapUnsubscribers: (id: number) => storeHelper.get(id).unsubscribers.forEach(fn => fn()),\r\n};\r\n\r\nconst deletionsHelper = {\r\n get: () => storeHelper.get().deletions,\r\n set: (deletions: Array) => (storeHelper.get().deletions = deletions),\r\n};\r\n\r\nconst fiberMountHelper = {\r\n reset: () => {\r\n storeHelper.get().fiberMount = {\r\n level: 0,\r\n navigation: {},\r\n isDeepWalking: true,\r\n };\r\n },\r\n getIndex: () => storeHelper.get().fiberMount.navigation[storeHelper.get().fiberMount.level],\r\n jumpToChild: () => {\r\n const { fiberMount } = storeHelper.get();\r\n const level = fiberMount.level;\r\n const nextLevel = level + 1;\r\n\r\n fiberMount.level = nextLevel;\r\n fiberMount.navigation[nextLevel] = 0;\r\n },\r\n jumpToParent: () => {\r\n const { fiberMount } = storeHelper.get();\r\n const level = fiberMount.level;\r\n const nextLevel = level - 1;\r\n\r\n fiberMount.navigation[level] = 0;\r\n fiberMount.level = nextLevel;\r\n },\r\n jumpToSibling: () => {\r\n const { fiberMount } = storeHelper.get();\r\n const level = fiberMount.level;\r\n const idx = fiberMount.navigation[level] + 1;\r\n\r\n fiberMount.navigation[level] = idx;\r\n },\r\n deepWalking: {\r\n get: () => storeHelper.get().fiberMount.isDeepWalking,\r\n set: (value: boolean) => (storeHelper.get().fiberMount.isDeepWalking = value),\r\n },\r\n};\r\n\r\nconst effectsHelper = {\r\n get: () => storeHelper.get().effects,\r\n reset: () => (storeHelper.get().effects = []),\r\n add: (effect: () => void) => storeHelper.get().effects.push(effect),\r\n};\r\n\r\nconst layoutEffectsHelper = {\r\n get: () => storeHelper.get().layoutEffects,\r\n reset: () => (storeHelper.get().layoutEffects = []),\r\n add: (effect: () => void) => storeHelper.get().layoutEffects.push(effect),\r\n};\r\n\r\nexport {\r\n getRootId,\r\n effectStoreHelper,\r\n wipRootHelper,\r\n currentRootHelper,\r\n nextUnitOfWorkHelper,\r\n componentFiberHelper,\r\n fromHookUpdateHelper,\r\n eventsHelper,\r\n deletionsHelper,\r\n fiberMountHelper,\r\n effectsHelper,\r\n layoutEffectsHelper,\r\n};\r\n","export * from './types';\r\n","import type { ComponentFactory } from '../component';\r\nimport type { VirtualNode, VirtualNodeFactory } from '../view';\r\n\r\nexport type DarkElement = NestedArray;\r\n\r\nexport type Nullable = null | false | undefined;\r\n\r\nexport type NestedArray = T | Array>;\r\n\r\nexport type RenderProps = (...args: Array) => DarkElement;\r\n\r\nexport type DarkElementKey = string | number;\r\n\r\nexport type DarkElementInstance = VirtualNode | VirtualNodeFactory | ComponentFactory;\r\n","export * from './suspense';\r\n","import { createComponent } from '../component';\r\nimport { useState } from '../use-state';\r\nimport { createContext } from '../context';\r\nimport { useContext } from '../use-context';\r\nimport { useMemo } from '../use-memo';\r\nimport { useCallback } from '../use-callback';\r\nimport type { DarkElement } from '../shared';\r\n\r\ntype SuspenseProps = {\r\n fallback: DarkElement;\r\n};\r\n\r\ntype SuspenseContextValue = {\r\n fallback: DarkElement;\r\n isLoaded: boolean;\r\n trigger: () => void;\r\n};\r\n\r\nconst SuspenseContext = createContext({\r\n fallback: null,\r\n isLoaded: true,\r\n trigger: () => {},\r\n});\r\n\r\nconst Suspense = createComponent(({ fallback, slot }) => {\r\n if (!fallback) {\r\n throw new Error(`[Dark]: Suspense fallback not found`);\r\n }\r\n const { isLoaded: isSuspenseLoaded } = useContext(SuspenseContext);\r\n const [isLoaded, setIsLoaded] = useState(false);\r\n const trigger = useCallback(() => setIsLoaded(true), []);\r\n const value = useMemo(() => ({ fallback, isLoaded, trigger }), [fallback, isLoaded]);\r\n\r\n return SuspenseContext.Provider({\r\n value,\r\n slot: isSuspenseLoaded ? slot : null,\r\n });\r\n});\r\n\r\nexport { SuspenseContext, Suspense };\r\n","export * from './unmount';\r\n","import { type Fiber } from '../fiber';\r\nimport { platform } from '../platform';\r\nimport { detectIsComponentFactory } from '../component';\r\nimport { dropEffects } from '../use-effect';\r\nimport { dropLayoutEffects } from '../use-layout-effect';\r\nimport { walkFiber } from '../walk';\r\nimport { detectIsUndefined } from '../helpers';\r\nimport { currentRootHelper, eventsHelper, effectStoreHelper } from '../scope';\r\n\r\nfunction unmountFiber(fiber: Fiber) {\r\n if (!fiber.effectHost && !fiber.layoutEffectHost && !fiber.portalHost) return;\r\n\r\n walkFiber({\r\n fiber,\r\n onLoop: ({ nextFiber, isReturn, stop }) => {\r\n if (nextFiber === fiber.nextSibling || fiber.transposition) return stop();\r\n\r\n if (!isReturn && detectIsComponentFactory(nextFiber.instance)) {\r\n nextFiber.layoutEffectHost && dropLayoutEffects(nextFiber.hook);\r\n nextFiber.effectHost && dropEffects(nextFiber.hook);\r\n nextFiber.portalHost && platform.unmountPortal(nextFiber);\r\n }\r\n },\r\n });\r\n}\r\n\r\nfunction unmountRoot(rootId: number, onComplete: () => void) {\r\n if (detectIsUndefined(rootId)) return;\r\n\r\n unmountFiber(currentRootHelper.get(rootId));\r\n eventsHelper.mapUnsubscribers(rootId);\r\n effectStoreHelper.remove(rootId);\r\n onComplete();\r\n}\r\n\r\nexport { unmountFiber, unmountRoot };\r\n","export * from './use-callback';\r\n","import { useMemo } from '../use-memo';\r\n\r\nfunction useCallback(callback: T, deps: Array): T {\r\n const value = useMemo(() => callback, deps);\r\n\r\n return value;\r\n}\r\n\r\nexport { useCallback };\r\n","export * from './use-context';\r\n","import { useEffect } from '../use-effect';\r\nimport { useMemo } from '../use-memo';\r\nimport { componentFiberHelper } from '../scope';\r\nimport { useUpdate } from '../use-update';\r\nimport type { Fiber } from '../fiber';\r\nimport type { Context, ContextProviderValue } from '../context';\r\n\r\nfunction useContext(context: Context): T {\r\n const { defaultValue } = context;\r\n const fiber = componentFiberHelper.get();\r\n const provider = getProvider(context, fiber);\r\n const value = provider ? provider.value : defaultValue;\r\n const update = useUpdate();\r\n const scope = useMemo(() => ({ prevValue: value }), []);\r\n const hasProvider = Boolean(provider);\r\n\r\n useEffect(() => {\r\n if (!hasProvider) return;\r\n\r\n const subscriber = (newValue: T) => {\r\n if (!Object.is(scope.prevValue, newValue)) {\r\n update();\r\n }\r\n };\r\n\r\n provider.subscribers.push(subscriber);\r\n\r\n return () => {\r\n const idx = provider.subscribers.findIndex(x => x === subscriber);\r\n\r\n if (idx !== -1) {\r\n provider.subscribers.splice(idx, 1);\r\n }\r\n };\r\n }, [hasProvider]);\r\n\r\n scope.prevValue = value;\r\n\r\n return value;\r\n}\r\n\r\nfunction getProvider(context: Context, fiber: Fiber): ContextProviderValue {\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n if (nextFiber.provider && nextFiber.provider.get(context)) {\r\n return nextFiber.provider.get(context) as ContextProviderValue;\r\n }\r\n\r\n nextFiber = nextFiber.parent;\r\n }\r\n\r\n return null;\r\n}\r\n\r\nexport { useContext };\r\n","export * from './use-deferred-value';\r\n","import { useState } from '../use-state';\r\nimport { useEffect } from '../use-effect';\r\nimport { TaskPriority } from '../constants';\r\n\r\ntype UseDeferredValueOprions = {\r\n timeoutMs: number;\r\n};\r\n\r\nfunction useDeferredValue(value: T, options?: UseDeferredValueOprions): T {\r\n const { timeoutMs } = options || {};\r\n const [deferredValue, setDeferredValue] = useState(value, {\r\n priority: TaskPriority.LOW,\r\n timeoutMs,\r\n });\r\n\r\n useEffect(() => {\r\n setDeferredValue(value);\r\n }, [value]);\r\n\r\n return deferredValue;\r\n}\r\n\r\nexport { useDeferredValue };\r\n","export * from './use-effect';\r\n","import { detectIsUndefined, detectIsFunction, detectIsDepsDifferent } from '../helpers';\r\nimport { componentFiberHelper, effectsHelper } from '../scope';\r\nimport type { Fiber, Hook, HookValue } from '../fiber';\r\nimport type { Effect, DropEffect } from './types';\r\n\r\nconst $$useEffect = Symbol('use-effect');\r\n\r\nconst { useEffect, hasEffects, dropEffects } = createEffect($$useEffect, effectsHelper);\r\n\r\nfunction createEffect(token: Symbol, store: typeof effectsHelper) {\r\n function useEffect(effect: Effect, deps?: Array) {\r\n const fiber = componentFiberHelper.get();\r\n const hook = fiber.hook as Hook>;\r\n const { idx, values } = hook;\r\n const runEffect = () => {\r\n values[idx] = {\r\n deps,\r\n token,\r\n value: undefined,\r\n };\r\n\r\n store.add(() => {\r\n values[idx].value = effect();\r\n });\r\n };\r\n\r\n if (detectIsUndefined(values[idx])) {\r\n runEffect();\r\n } else {\r\n const { deps: prevDeps, value: cleanup } = values[idx];\r\n const isDepsDifferent = deps ? detectIsDepsDifferent(deps, prevDeps) : true;\r\n\r\n if (isDepsDifferent) {\r\n detectIsFunction(cleanup) && cleanup();\r\n runEffect();\r\n }\r\n }\r\n\r\n hook.idx++;\r\n }\r\n\r\n function hasEffects(fiber: Fiber) {\r\n const { values } = fiber.hook as Hook;\r\n const hasEffect = values.some(x => x.token === token);\r\n\r\n return hasEffect;\r\n }\r\n\r\n function dropEffects(hook: Hook>) {\r\n const { values } = hook;\r\n\r\n for (const value of values) {\r\n if (value.token === token) {\r\n const cleanup = value.value;\r\n\r\n detectIsFunction(cleanup) && cleanup();\r\n }\r\n }\r\n }\r\n\r\n return {\r\n useEffect,\r\n hasEffects,\r\n dropEffects,\r\n };\r\n}\r\n\r\nexport { useEffect, hasEffects, dropEffects, createEffect };\r\n","export * from './use-error';\r\n","import { componentFiberHelper } from '../scope';\r\nimport { useEffect } from '../use-effect';\r\nimport { useUpdate } from '../use-update';\r\nimport { useMemo } from '../use-memo';\r\n\r\ntype ErrorScope = {\r\n error: Error;\r\n};\r\n\r\nfunction useError(): Error | null {\r\n const fiber = componentFiberHelper.get();\r\n const update = useUpdate();\r\n const scope: ErrorScope = useMemo(() => ({ error: null }), []);\r\n\r\n fiber.catchException = (error: Error) => {\r\n scope.error = error;\r\n update();\r\n };\r\n\r\n useEffect(() => {\r\n scope.error = null;\r\n }, [scope.error]);\r\n\r\n return scope.error;\r\n}\r\n\r\nexport { useError };\r\n","export * from './use-event';\r\n","import { useMemo } from '../use-memo';\r\nimport { useCallback } from '../use-callback';\r\n\r\nfunction useEvent any>(fn: T) {\r\n const scope = useMemo(() => ({ fn }), []);\r\n\r\n scope.fn = fn;\r\n\r\n const callback = useCallback((...args) => {\r\n return scope.fn(...args);\r\n }, []);\r\n\r\n return callback as unknown as T;\r\n}\r\n\r\nexport { useEvent };\r\n","export * from './use-imperative-handle';\r\n","import { useMemo } from '../use-memo';\r\nimport type { MutableRef } from '../ref';\r\n\r\nfunction useImperativeHandle(ref: MutableRef, createHandle: () => T, deps: Array) {\r\n const current = useMemo(() => createHandle(), deps);\r\n\r\n ref.current = current;\r\n}\r\n\r\nexport { useImperativeHandle };\r\n","export * from './use-layout-effect';\r\n","import { layoutEffectsHelper } from '../scope';\r\nimport { createEffect } from '../use-effect';\r\n\r\nconst $$useLayoutEffect = Symbol('use-layout-effect');\r\n\r\nconst {\r\n useEffect: useLayoutEffect,\r\n hasEffects: hasLayoutEffects,\r\n dropEffects: dropLayoutEffects,\r\n} = createEffect($$useLayoutEffect, layoutEffectsHelper);\r\n\r\nexport { useLayoutEffect, hasLayoutEffects, dropLayoutEffects };\r\n","export * from './use-memo';\r\n","import { type DarkElement } from '../shared';\r\nimport { detectIsUndefined, detectIsArray, detectIsDepsDifferent } from '../helpers';\r\nimport { detectIsComponentFactory, createComponent } from '../component';\r\nimport { detectIsVirtualNodeFactory } from '../view';\r\nimport { componentFiberHelper } from '../scope';\r\nimport { Fragment } from '../fragment';\r\nimport { $$memo } from '../memo';\r\n\r\nconst Memo = createComponent(({ slot }) => slot, { token: $$memo });\r\n\r\nfunction wrap(value: T, isDepsDifferent: boolean) {\r\n const check = (value: T) => detectIsVirtualNodeFactory(value) || detectIsComponentFactory(value);\r\n\r\n if (detectIsArray(value) ? check(value[0]) : check(value)) {\r\n const slot = value as unknown as DarkElement;\r\n const factory = Memo({\r\n slot: Fragment({ slot }),\r\n });\r\n\r\n factory.shouldUpdate = () => isDepsDifferent;\r\n\r\n return factory;\r\n }\r\n\r\n return value;\r\n}\r\n\r\nfunction processValue(getValue: () => T, isDepsDifferent = false) {\r\n return wrap(getValue(), isDepsDifferent);\r\n}\r\n\r\nfunction useMemo(getValue: () => T, deps: Array): T {\r\n const fiber = componentFiberHelper.get();\r\n const { hook } = fiber;\r\n const { idx, values } = hook;\r\n\r\n if (detectIsUndefined(values[idx])) {\r\n const value = processValue(getValue);\r\n\r\n values[idx] = {\r\n deps,\r\n value,\r\n };\r\n\r\n hook.idx++;\r\n\r\n return value as T;\r\n }\r\n\r\n const hookValue = values[idx];\r\n const prevDeps = hookValue.deps as Array;\r\n const isDepsDifferent = detectIsDepsDifferent(deps, prevDeps);\r\n const computedGetValue = isDepsDifferent ? getValue : () => hookValue.value;\r\n\r\n hookValue.deps = deps;\r\n hookValue.value = processValue(computedGetValue, isDepsDifferent);\r\n\r\n hook.idx++;\r\n\r\n return hookValue.value;\r\n}\r\n\r\nexport { useMemo };\r\n","export * from './use-reducer';\r\nexport type { Reducer } from './types';\r\n","import { useState } from '../use-state';\r\nimport { useCallback } from '../use-callback';\r\nimport { useMemo } from '../use-memo';\r\nimport { detectIsFunction } from '../helpers';\r\nimport type { Reducer, Dispatch, ReducerAction, ReducerState } from './types';\r\n\r\nfunction useReducer(\r\n reducer: R,\r\n initialState: ReducerState,\r\n initializer?: (state: ReducerState) => ReducerState,\r\n): [ReducerState, Dispatch>] {\r\n const initialValue = useMemo(() => {\r\n return detectIsFunction(initializer) ? initializer(initialState) : initialState;\r\n }, []);\r\n const [state, setState] = useState>(initialValue);\r\n const dispatch = useCallback((action: ReducerAction) => setState(state => reducer(state, action)), []) as Dispatch<\r\n ReducerAction\r\n >;\r\n\r\n return [state, dispatch];\r\n}\r\n\r\nexport { useReducer };\r\n","export * from './use-ref';\r\n","import { useMemo } from '../use-memo';\r\nimport type { MutableRef } from '../ref';\r\n\r\nfunction useRef(initialValue: T = null): MutableRef {\r\n const ref = useMemo(() => ({ current: initialValue }), []) as MutableRef;\r\n\r\n return ref;\r\n}\r\n\r\nexport { useRef };\r\n","export * from './use-state';\r\n","import { type ScheduleCallbackOptions } from '../platform';\r\nimport { detectIsUndefined, detectIsFunction } from '../helpers';\r\nimport { componentFiberHelper } from '../scope';\r\nimport { useUpdate } from '../use-update';\r\nimport { useMemo } from '../use-memo';\r\nimport { useCallback } from '../use-callback';\r\nimport { TaskPriority } from '../constants';\r\n\r\ntype Value = T | ((prevValue: T) => T);\r\ntype Scope = {\r\n idx: number;\r\n values: Array;\r\n};\r\n\r\nfunction useState(initialValue: T, options?: ScheduleCallbackOptions): [T, (value: Value) => void] {\r\n const fiber = componentFiberHelper.get();\r\n const update = useUpdate(options);\r\n const scope: Scope = useMemo(\r\n () => ({\r\n idx: fiber.hook.idx,\r\n values: fiber.hook.values,\r\n }),\r\n [],\r\n );\r\n const setState = useCallback((sourceValue: Value) => {\r\n const value = scope.values[scope.idx];\r\n const newValue = detectIsFunction(sourceValue) ? sourceValue(value) : sourceValue;\r\n\r\n if (!Object.is(value, newValue)) {\r\n const setValue = () => {\r\n scope.values[scope.idx] = newValue;\r\n };\r\n\r\n if (options?.priority === TaskPriority.LOW) {\r\n update(() => setValue());\r\n } else {\r\n setValue();\r\n update();\r\n }\r\n }\r\n }, []);\r\n const { hook } = fiber;\r\n const { idx, values } = hook;\r\n const value: T = !detectIsUndefined(values[idx]) ? values[idx] : initialValue;\r\n\r\n values[idx] = value;\r\n scope.idx = idx;\r\n scope.values = values;\r\n hook.idx++;\r\n\r\n return [value, setState];\r\n}\r\n\r\nexport { useState };\r\n","export * from './use-update';\r\n","import { platform, type ScheduleCallbackOptions } from '../platform';\r\nimport { getRootId, componentFiberHelper } from '../scope';\r\nimport { createUpdateCallback } from '../fiber';\r\nimport { useMemo } from '../use-memo';\r\nimport { dummyFn } from '../helpers';\r\n\r\nfunction useUpdate(options?: ScheduleCallbackOptions) {\r\n const rootId = getRootId();\r\n const fiber = componentFiberHelper.get();\r\n const scope = useMemo(() => ({ fiber }), []);\r\n\r\n scope.fiber = fiber;\r\n\r\n const update = (onStart?: () => void) => {\r\n const callback = createUpdateCallback({\r\n rootId,\r\n fiber: scope.fiber,\r\n forceStart: Boolean(options?.timeoutMs),\r\n onStart: onStart || dummyFn,\r\n });\r\n\r\n platform.scheduleCallback(callback, options);\r\n };\r\n\r\n return update;\r\n}\r\n\r\nexport { useUpdate };\r\n","export * from './view';\r\nexport * from './types';\r\n","export type ViewDef = {\r\n as: string;\r\n slot?: any;\r\n isVoid?: boolean;\r\n [prop: string]: any;\r\n};\r\n\r\nexport enum NodeType {\r\n TAG = 'TAG',\r\n TEXT = 'TEXT',\r\n COMMENT = 'COMMENT',\r\n}\r\n","import { EMPTY_NODE, ATTR_KEY } from '../constants';\r\nimport { detectIsArray, detectIsEmpty, detectIsFunction } from '../helpers';\r\nimport type { DarkElementKey } from '../shared';\r\nimport type { ComponentFactory, StandardComponentProps } from '../component';\r\nimport { NodeType, type ViewDef } from './types';\r\n\r\nexport type VirtualNodeFactory = () => VirtualNode;\r\nexport type TagVirtualNodeFactory = () => TagVirtualNode;\r\nexport type TextVirtualNodeFactory = () => TextVirtualNode;\r\nexport type CommentVirtualNodeFactory = () => CommentVirtualNode;\r\n\r\nconst $$virtualNode = Symbol('virtual-node');\r\n\r\nclass VirtualNode {\r\n public type: NodeType = null;\r\n\r\n constructor(options: Partial) {\r\n this.type = options.type;\r\n }\r\n}\r\n\r\nclass TagVirtualNode extends VirtualNode {\r\n public type = NodeType.TAG;\r\n public name: string = null;\r\n public isVoid = false;\r\n public attrs: Record = {};\r\n public children: Array = [];\r\n\r\n constructor(options: Partial) {\r\n super(options);\r\n this.name = options.name || this.name;\r\n this.isVoid = options.isVoid || this.isVoid;\r\n this.attrs = options.attrs || this.attrs;\r\n this.children = options.children || this.children;\r\n }\r\n}\r\n\r\nclass TextVirtualNode extends VirtualNode {\r\n public type = NodeType.TEXT;\r\n public value = '';\r\n\r\n constructor(text: string) {\r\n super({});\r\n this.value = text;\r\n }\r\n}\r\n\r\nclass CommentVirtualNode extends VirtualNode {\r\n public type = NodeType.COMMENT;\r\n public value = '';\r\n\r\n constructor(text: string) {\r\n super({});\r\n this.value = text;\r\n }\r\n}\r\n\r\nconst detectIsVirtualNode = (vNode: unknown): vNode is VirtualNode => vNode instanceof VirtualNode;\r\nconst detectIsTagVirtualNode = (vNode: unknown): vNode is TagVirtualNode => vNode instanceof TagVirtualNode;\r\nconst detectIsCommentVirtualNode = (vNode: unknown): vNode is CommentVirtualNode => vNode instanceof CommentVirtualNode;\r\nconst detectIsTextVirtualNode = (vNode: unknown): vNode is TextVirtualNode => vNode instanceof TextVirtualNode;\r\nconst detectIsEmptyVirtualNode = (vNode: unknown): boolean =>\r\n detectIsCommentVirtualNode(vNode) && vNode.value === EMPTY_NODE;\r\n\r\nfunction getVirtualNodeKey(vNode: TagVirtualNode): DarkElementKey | null {\r\n const key = vNode && vNode.attrs[ATTR_KEY];\r\n\r\n return !detectIsEmpty(key) ? key : null;\r\n}\r\n\r\nfunction Text(source: string | StandardComponentProps['slot']): string | TextVirtualNode {\r\n const text =\r\n typeof source === 'string' ? new TextVirtualNode(source) : detectIsTextVirtualNode(source) ? source.value : '';\r\n\r\n return text;\r\n}\r\n\r\nfunction Comment(text: string): CommentVirtualNodeFactory {\r\n const factory = () => new CommentVirtualNode(text);\r\n\r\n factory[$$virtualNode] = true;\r\n\r\n return factory;\r\n}\r\n\r\nfunction View(def: ViewDef): TagVirtualNodeFactory {\r\n const factory = () => {\r\n const { as, slot, isVoid = false, ...rest } = def;\r\n const children = isVoid ? [] : detectIsArray(slot) ? slot : slot ? [slot] : [];\r\n\r\n return new TagVirtualNode({\r\n name: as,\r\n isVoid,\r\n attrs: { ...rest },\r\n children: children as Array,\r\n });\r\n };\r\n\r\n factory[$$virtualNode] = true;\r\n\r\n return factory;\r\n}\r\n\r\nconst createEmptyVirtualNode = () => new CommentVirtualNode(EMPTY_NODE);\r\n\r\nconst detectIsVirtualNodeFactory = (factory: unknown): factory is VirtualNodeFactory =>\r\n detectIsFunction(factory) && factory[$$virtualNode] === true;\r\n\r\nexport {\r\n VirtualNode,\r\n TagVirtualNode,\r\n TextVirtualNode,\r\n CommentVirtualNode,\r\n detectIsVirtualNode,\r\n detectIsTagVirtualNode,\r\n detectIsCommentVirtualNode,\r\n detectIsTextVirtualNode,\r\n detectIsEmptyVirtualNode,\r\n getVirtualNodeKey,\r\n Text,\r\n Comment,\r\n View,\r\n createEmptyVirtualNode,\r\n detectIsVirtualNodeFactory,\r\n};\r\n","export * from './walk';\r\n","import { type Fiber } from '../fiber';\r\n\r\ntype WalkFiberOptions = {\r\n fiber: Fiber;\r\n onLoop: (options: OnLoopOptions) => void;\r\n};\r\n\r\ntype OnLoopOptions = {\r\n nextFiber: Fiber;\r\n isReturn: boolean;\r\n resetIsDeepWalking: () => void;\r\n stop: () => void;\r\n};\r\n\r\nfunction walkFiber(options: WalkFiberOptions) {\r\n const { fiber, onLoop } = options;\r\n let nextFiber = fiber;\r\n let isDeepWalking = true;\r\n let isReturn = false;\r\n let isStopped = false;\r\n const visitedMap = new Map();\r\n const detectCanVisit = (fiber: Fiber) => !visitedMap.get(fiber);\r\n\r\n while (nextFiber) {\r\n onLoop({\r\n nextFiber: nextFiber as Fiber,\r\n isReturn,\r\n resetIsDeepWalking: () => (isDeepWalking = false),\r\n stop: () => (isStopped = true),\r\n });\r\n\r\n if (isStopped) {\r\n break;\r\n }\r\n\r\n if (nextFiber.child && isDeepWalking && detectCanVisit(nextFiber.child)) {\r\n const newFiber = nextFiber.child;\r\n\r\n isReturn = false;\r\n nextFiber = newFiber;\r\n visitedMap.set(newFiber, true);\r\n } else if (nextFiber.nextSibling && detectCanVisit(nextFiber.nextSibling)) {\r\n const newFiber = nextFiber.nextSibling;\r\n\r\n isDeepWalking = true;\r\n isReturn = false;\r\n nextFiber = newFiber;\r\n visitedMap.set(newFiber, true);\r\n } else if (\r\n nextFiber.parent &&\r\n nextFiber.parent === fiber &&\r\n nextFiber.parent.nextSibling &&\r\n detectCanVisit(nextFiber.parent.nextSibling)\r\n ) {\r\n const newFiber = nextFiber.parent.nextSibling;\r\n\r\n isDeepWalking = true;\r\n isReturn = false;\r\n nextFiber = newFiber;\r\n visitedMap.set(newFiber, true);\r\n } else if (nextFiber.parent && nextFiber.parent !== fiber) {\r\n isDeepWalking = false;\r\n isReturn = true;\r\n nextFiber = nextFiber.parent;\r\n } else {\r\n nextFiber = null;\r\n }\r\n }\r\n}\r\n\r\nexport { walkFiber };\r\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export * from './component';\r\nexport * from './context';\r\nexport { createElement as h } from './element';\r\nexport * from './fiber';\r\nexport * from './fragment';\r\nexport * from './platform';\r\nexport * from './helpers';\r\nexport * from './lazy';\r\nexport * from './memo';\r\nexport * from './ref';\r\nexport * from './scope';\r\nexport * from './shared';\r\nexport * from './suspense';\r\nexport * from './use-callback';\r\nexport * from './use-context';\r\nexport * from './use-deferred-value';\r\nexport { useEffect } from './use-effect';\r\nexport * from './use-error';\r\nexport * from './use-event';\r\nexport * from './use-imperative-handle';\r\nexport { useLayoutEffect } from './use-layout-effect';\r\nexport * from './use-memo';\r\nexport * from './use-reducer';\r\nexport * from './use-ref';\r\nexport * from './use-state';\r\nexport * from './use-update';\r\nexport * from './view';\r\nexport * from './constants';\r\nexport { walkFiber } from './walk';\r\nexport { unmountRoot } from './unmount';\r\n"],"names":[],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"dark-core.development.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACVwC;AACU;AAKlD,IAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AACxC,IAAM,cAAc,GAA0B;IAC5C,WAAW,EAAE,EAAE;IACf,YAAY,EAAE,EAAE;IAChB,KAAK,EAAE,WAAW;CACnB,CAAC;AACF;IASE,0BAAY,OAA4B;QAHjC,aAAQ,GAA+B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AW;YAC5B,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,EAC5C;YACA,IAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC;YAE9C,aAAa,GAAG,IAAI,CAAC;YACrB,QAAQ,GAAG,KAAK,CAAC;YACjB,SAAS,GAAG,QAAQ,CAAC;YACrB,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;SAChC;aAAM,IAAI,SAAS,CAAC,MAAM,IAAI,SAAS,CAAC,MAAM,KAAK,KAAK,EAAE;YACzD,aAAa,GAAG,KAAK,CAAC;YACtB,QAAQ,GAAG,IAAI,CAAC;YAChB,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC;SAC9B;aAAM;YACL,SAAS,GAAG,IAAI,CAAC;SAClB;KACF;AACH,CAAC;AAEoB;;;;;;;UCtErB;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACN4B;AACF;AACqB;AACvB;AACG;AACA;AACD;AACH;AACA;AACD;AACE;AACC;AACE;AACI;AACD;AACO;AACI;AACb;AACA;AACY;AACc;AAC3B;AACG;AACJ;AACE;AACC;AACN;AACK;AACO;AACK","sources":["webpack://DarkCore/webpack/universalModuleDefinition","webpack://DarkCore/./src/component/component.ts","webpack://DarkCore/./src/component/index.ts","webpack://DarkCore/./src/component/types.ts","webpack://DarkCore/./src/constants.ts","webpack://DarkCore/./src/context/context.ts","webpack://DarkCore/./src/context/index.ts","webpack://DarkCore/./src/context/types.ts","webpack://DarkCore/./src/element/element.ts","webpack://DarkCore/./src/element/index.ts","webpack://DarkCore/./src/fiber/fiber.ts","webpack://DarkCore/./src/fiber/index.ts","webpack://DarkCore/./src/fiber/types.ts","webpack://DarkCore/./src/fragment/fragment.ts","webpack://DarkCore/./src/fragment/index.ts","webpack://DarkCore/./src/helpers/index.ts","webpack://DarkCore/./src/lazy/index.ts","webpack://DarkCore/./src/lazy/lazy.ts","webpack://DarkCore/./src/memo/index.ts","webpack://DarkCore/./src/memo/memo.ts","webpack://DarkCore/./src/platform/index.ts","webpack://DarkCore/./src/platform/platform.ts","webpack://DarkCore/./src/platform/types.ts","webpack://DarkCore/./src/ref/index.ts","webpack://DarkCore/./src/ref/ref.ts","webpack://DarkCore/./src/scope/index.ts","webpack://DarkCore/./src/scope/scope.ts","webpack://DarkCore/./src/shared/index.ts","webpack://DarkCore/./src/shared/types.ts","webpack://DarkCore/./src/suspense/index.ts","webpack://DarkCore/./src/suspense/suspense.ts","webpack://DarkCore/./src/unmount/index.ts","webpack://DarkCore/./src/unmount/unmount.ts","webpack://DarkCore/./src/use-callback/index.ts","webpack://DarkCore/./src/use-callback/use-callback.ts","webpack://DarkCore/./src/use-context/index.ts","webpack://DarkCore/./src/use-context/use-context.ts","webpack://DarkCore/./src/use-deferred-value/index.ts","webpack://DarkCore/./src/use-deferred-value/use-deferred-value.ts","webpack://DarkCore/./src/use-effect/index.ts","webpack://DarkCore/./src/use-effect/use-effect.ts","webpack://DarkCore/./src/use-error/index.ts","webpack://DarkCore/./src/use-error/use-error.ts","webpack://DarkCore/./src/use-event/index.ts","webpack://DarkCore/./src/use-event/use-event.ts","webpack://DarkCore/./src/use-imperative-handle/index.ts","webpack://DarkCore/./src/use-imperative-handle/use-imperative-handle.ts","webpack://DarkCore/./src/use-layout-effect/index.ts","webpack://DarkCore/./src/use-layout-effect/use-layout-effect.ts","webpack://DarkCore/./src/use-memo/index.ts","webpack://DarkCore/./src/use-memo/use-memo.ts","webpack://DarkCore/./src/use-reducer/index.ts","webpack://DarkCore/./src/use-reducer/use-reducer.ts","webpack://DarkCore/./src/use-ref/index.ts","webpack://DarkCore/./src/use-ref/use-ref.ts","webpack://DarkCore/./src/use-state/index.ts","webpack://DarkCore/./src/use-state/use-state.ts","webpack://DarkCore/./src/use-update/index.ts","webpack://DarkCore/./src/use-update/use-update.ts","webpack://DarkCore/./src/view/index.ts","webpack://DarkCore/./src/view/types.ts","webpack://DarkCore/./src/view/view.ts","webpack://DarkCore/./src/walk/index.ts","webpack://DarkCore/./src/walk/walk.ts","webpack://DarkCore/webpack/bootstrap","webpack://DarkCore/webpack/runtime/define property getters","webpack://DarkCore/webpack/runtime/hasOwnProperty shorthand","webpack://DarkCore/webpack/runtime/make namespace object","webpack://DarkCore/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"DarkCore\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"DarkCore\"] = factory();\n\telse\n\t\troot[\"DarkCore\"] = factory();\n})(self, () => {\nreturn ","import { ATTR_KEY } from '../constants';\r\nimport { error, detectIsEmpty } from '../helpers';\r\nimport type { DarkElementKey, DarkElementInstance } from '../shared';\r\nimport type { MutableRef } from '../ref';\r\nimport type { CreateElement, ComponentOptions, StandardComponentProps, SlotProps } from './types';\r\n\r\nconst $$component = Symbol('component');\r\nconst defaultOptions: ComponentOptions = {\r\n displayName: '',\r\n defaultProps: {},\r\n token: $$component,\r\n};\r\nclass ComponentFactory

{\r\n public type: CreateElement

;\r\n public token: Symbol;\r\n public props: P;\r\n public ref: MutableRef;\r\n public displayName: string;\r\n public children: Array = [];\r\n public shouldUpdate?: (props: P, nextProps: P) => boolean;\r\n\r\n constructor(options: ComponentFactory

) {\r\n this.type = options.type || null;\r\n this.token = options.token || null;\r\n this.props = options.props || null;\r\n this.ref = options.ref || null;\r\n this.displayName = options.displayName || '';\r\n this.shouldUpdate = options.shouldUpdate || null;\r\n }\r\n}\r\n\r\nfunction createComponent(\r\n createElement: CreateElement

,\r\n options: ComponentOptions

= {},\r\n) {\r\n type Props = P & StandardComponentProps;\r\n const computedOptions = { ...defaultOptions, ...options };\r\n const { token, defaultProps, displayName, shouldUpdate } = computedOptions;\r\n\r\n return (props = {} as Props, ref?: MutableRef): ComponentFactory => {\r\n const computedProps = { ...defaultProps, ...props };\r\n const factory = new ComponentFactory({\r\n token,\r\n ref,\r\n displayName,\r\n shouldUpdate,\r\n props: computedProps,\r\n type: createElement,\r\n children: [],\r\n });\r\n\r\n if (computedProps.ref) {\r\n delete computedProps.ref;\r\n\r\n if (process.env.NODE_ENV === 'development') {\r\n error(`[Dark]: To use ref you need to wrap the createComponent with forwardRef!`);\r\n }\r\n }\r\n\r\n return factory;\r\n };\r\n}\r\n\r\nconst detectIsComponentFactory = (factory: unknown): factory is ComponentFactory => factory instanceof ComponentFactory;\r\n\r\nconst getComponentFactoryKey = (factory: ComponentFactory): DarkElementKey =>\r\n !detectIsEmpty(factory.props[ATTR_KEY]) ? factory.props[ATTR_KEY] : null;\r\n\r\nexport { ComponentFactory, createComponent, detectIsComponentFactory, getComponentFactoryKey };\r\n","export * from './component';\r\nexport * from './types';\r\n","import type { ComponentFactory } from './component';\r\nimport type { DarkElementKey, DarkElement } from '../shared';\r\nimport type { MutableRef } from '../ref';\r\n\r\nexport type ComponentOptions

= Readonly<{\r\n displayName?: string;\r\n defaultProps?: Partial

;\r\n token?: Symbol;\r\n shouldUpdate?: (props: P, nextProps: P) => boolean;\r\n}>;\r\n\r\nexport type StandardComponentProps = KeyProps & SlotProps & RefProps;\r\n\r\nexport type KeyProps = {\r\n key?: DarkElementKey;\r\n};\r\n\r\nexport type SlotProps = Readonly<{\r\n slot?: T;\r\n}>;\r\n\r\nexport type RefProps = {\r\n ref?: MutableRef;\r\n};\r\n\r\nexport type Component = any, R = any> = (\r\n props: T,\r\n ref?: MutableRef,\r\n) => ComponentFactory;\r\n\r\nexport type ComponentFactoryReturnType = DarkElement;\r\n\r\nexport type CreateElement

= (\r\n props: P & Pick,\r\n ref?: MutableRef,\r\n) => ComponentFactoryReturnType;\r\n","export const ROOT = 'root';\r\nexport const EMPTY_NODE = 'dark:matter';\r\nexport const ATTR_KEY = 'key';\r\nexport const ATTR_REF = 'ref';\r\nexport const PARTIAL_UPDATE = 'partial-update';\r\n\r\nexport enum TaskPriority {\r\n HIGH = 2,\r\n NORMAL = 1,\r\n LOW = 0,\r\n}\r\n","import { createComponent } from '../component';\r\nimport { useEffect } from '../use-effect';\r\nimport { componentFiberHelper } from '../scope';\r\nimport { useContext } from '../use-context';\r\nimport { detectIsFunction } from '../helpers';\r\nimport type { Context, ContexProviderProps } from './types';\r\n\r\nfunction createContext(defaultValue: T): Context {\r\n let displayName = 'Context';\r\n const context: Context = {\r\n displayName,\r\n defaultValue,\r\n Provider: null,\r\n Consumer: null,\r\n };\r\n\r\n mutateContext(context, defaultValue, displayName);\r\n\r\n Object.defineProperty(context, 'displayName', {\r\n get: () => displayName,\r\n set: (newValue: string) => {\r\n displayName = newValue;\r\n mutateContext(context, defaultValue, displayName);\r\n },\r\n });\r\n\r\n return context;\r\n}\r\n\r\nfunction mutateContext(context: Context, defaultValue: T, displayName: string) {\r\n context.Provider = createProvider(context, defaultValue, displayName);\r\n context.Consumer = createConsumer(context, displayName);\r\n}\r\n\r\nfunction createProvider(context: Context, defaultValue: T, displayName: string) {\r\n return createComponent>(\r\n ({ value = defaultValue, slot }) => {\r\n const fiber = componentFiberHelper.get();\r\n\r\n if (!fiber.provider) {\r\n fiber.provider = new Map();\r\n }\r\n\r\n if (!fiber.provider.get(context)) {\r\n fiber.provider.set(context, {\r\n subscribers: [],\r\n value,\r\n });\r\n }\r\n\r\n const provider = fiber.provider.get(context);\r\n\r\n useEffect(() => {\r\n for (const subscriber of provider.subscribers) {\r\n subscriber(value);\r\n }\r\n }, [value]);\r\n\r\n provider.value = value;\r\n\r\n return slot;\r\n },\r\n { displayName: `${displayName}.Provider` },\r\n );\r\n}\r\n\r\nfunction createConsumer(context: Context, displayName: string) {\r\n return createComponent(\r\n ({ slot }) => {\r\n const value = useContext(context);\r\n\r\n return detectIsFunction(slot) ? slot(value) : null;\r\n },\r\n { displayName: `${displayName}.Consumer` },\r\n );\r\n}\r\n\r\nexport { createContext };\r\n","export * from './context';\r\nexport * from './types';\r\n","import type { Component, SlotProps } from '../component';\r\nimport type { DarkElement } from '../shared';\r\n\r\nexport type ContexProviderProps = {\r\n value: T;\r\n} & SlotProps;\r\n\r\nexport type Context = {\r\n Provider: Component>;\r\n Consumer: Component DarkElement>>;\r\n displayName?: string;\r\n defaultValue: T;\r\n};\r\n\r\nexport type ContextProviderValue = {\r\n value: T;\r\n subscribers: Array<(value: T) => void>;\r\n};\r\n","import { detectIsNumber, detectIsString, detectIsFunction } from '../helpers';\r\nimport { View, Text, type TagVirtualNodeFactory } from '../view';\r\n\r\nfunction getChildren(children: Array) {\r\n children = children.map(x => (detectIsString(x) || detectIsNumber(x) ? Text(x.toString()) : x));\r\n\r\n return children ? (Array.isArray(children) ? [...children] : [children]) : [];\r\n}\r\n\r\nfunction createElement(\r\n tag: string | Function,\r\n props: any,\r\n ...children: Array\r\n): TagVirtualNodeFactory | Function | null {\r\n if (detectIsString(tag)) {\r\n return View({\r\n ...props,\r\n as: tag,\r\n slot: getChildren(children),\r\n });\r\n }\r\n\r\n if (detectIsFunction(tag)) {\r\n let slot = getChildren(children);\r\n\r\n slot = slot.length === 1 ? slot[0] : slot;\r\n\r\n return tag({ ...props, slot });\r\n }\r\n\r\n return null;\r\n}\r\n\r\nexport { createElement };\r\n","export * from './element';\r\n","import { flatten, detectIsEmpty, error, keyBy, takeListFromEnd, detectIsUndefined, detectIsArray } from '../helpers';\r\nimport { platform } from '../platform';\r\nimport {\r\n wipRootHelper,\r\n currentRootHelper,\r\n nextUnitOfWorkHelper,\r\n deletionsHelper,\r\n fiberMountHelper,\r\n componentFiberHelper,\r\n fromHookUpdateHelper,\r\n effectStoreHelper,\r\n effectsHelper,\r\n layoutEffectsHelper,\r\n} from '../scope';\r\nimport { type ComponentFactory, detectIsComponentFactory, getComponentFactoryKey } from '../component';\r\nimport {\r\n type TagVirtualNode,\r\n detectIsTagVirtualNode,\r\n createEmptyVirtualNode,\r\n getVirtualNodeKey,\r\n detectIsVirtualNode,\r\n detectIsVirtualNodeFactory,\r\n} from '../view';\r\nimport { detectIsMemo } from '../memo';\r\nimport type { Context, ContextProviderValue } from '../context';\r\nimport type { DarkElementKey, DarkElement, DarkElementInstance } from '../shared';\r\nimport { PARTIAL_UPDATE } from '../constants';\r\nimport { type NativeElement, type Hook, EffectTag, cloneTagMap } from './types';\r\nimport { hasEffects } from '../use-effect';\r\nimport { hasLayoutEffects } from '../use-layout-effect';\r\nimport { walkFiber } from '../walk';\r\nimport { unmountFiber } from '../unmount';\r\n\r\nclass Fiber {\r\n public nativeElement: N;\r\n public parent: Fiber;\r\n public child: Fiber;\r\n public nextSibling: Fiber;\r\n public alternate: Fiber;\r\n public effectTag: EffectTag;\r\n public instance: DarkElementInstance;\r\n public hook: Hook;\r\n public shadow: Fiber;\r\n public provider: Map;\r\n public transposition: boolean;\r\n public mountedToHost: boolean;\r\n public portalHost: boolean;\r\n public effectHost: boolean;\r\n public layoutEffectHost: boolean;\r\n public childrenCount: number;\r\n public marker: string;\r\n public isUsed: boolean;\r\n public idx: number;\r\n public catchException: (error: Error) => void;\r\n\r\n constructor(options: Partial>) {\r\n this.nativeElement = options.nativeElement || null;\r\n this.parent = options.parent || null;\r\n this.child = options.child || null;\r\n this.nextSibling = options.nextSibling || null;\r\n this.alternate = options.alternate || null;\r\n this.effectTag = options.effectTag || null;\r\n this.instance = options.instance || null;\r\n this.hook = options.hook || createHook();\r\n this.shadow = options.shadow || null;\r\n this.provider = options.provider || null;\r\n this.transposition = !detectIsUndefined(options.transposition) ? options.transposition : false;\r\n this.mountedToHost = !detectIsUndefined(options.mountedToHost) || false;\r\n this.portalHost = !detectIsUndefined(options.portalHost) ? options.portalHost : false;\r\n this.effectHost = !detectIsUndefined(options.effectHost) ? options.effectHost : false;\r\n this.layoutEffectHost = !detectIsUndefined(options.layoutEffectHost) ? options.layoutEffectHost : false;\r\n this.childrenCount = options.childrenCount || 0;\r\n this.marker = options.marker || '';\r\n this.idx = options.idx || 0;\r\n this.isUsed = options.isUsed || false;\r\n }\r\n\r\n public markPortalHost() {\r\n this.portalHost = true;\r\n this.parent && !this.parent.portalHost && this.parent.markPortalHost();\r\n }\r\n\r\n public markEffectHost() {\r\n this.effectHost = true;\r\n this.parent && !this.parent.effectHost && this.parent.markEffectHost();\r\n }\r\n\r\n public markLayoutEffectHost() {\r\n this.layoutEffectHost = true;\r\n this.parent && !this.parent.layoutEffectHost && this.parent.markLayoutEffectHost();\r\n }\r\n\r\n public markMountedToHost() {\r\n this.mountedToHost = true;\r\n this.parent && !this.parent.mountedToHost && this.parent.markMountedToHost();\r\n }\r\n\r\n public setError(error: Error) {\r\n if (typeof this.catchException === 'function') {\r\n this.catchException(error);\r\n } else if (this.parent) {\r\n this.parent.setError(error);\r\n }\r\n }\r\n}\r\n\r\nfunction workLoop() {\r\n const wipFiber = wipRootHelper.get();\r\n let nextUnitOfWork = nextUnitOfWorkHelper.get();\r\n let shouldYield = false;\r\n let hasMoreWork = Boolean(nextUnitOfWork);\r\n\r\n while (nextUnitOfWork && !shouldYield) {\r\n nextUnitOfWork = performUnitOfWork(nextUnitOfWork);\r\n nextUnitOfWorkHelper.set(nextUnitOfWork);\r\n hasMoreWork = Boolean(nextUnitOfWork);\r\n shouldYield = platform.shouldYeildToHost();\r\n }\r\n\r\n if (!nextUnitOfWork && wipFiber) {\r\n commitChanges();\r\n }\r\n\r\n return hasMoreWork;\r\n}\r\n\r\nfunction performUnitOfWork(fiber: Fiber) {\r\n let isDeepWalking = true;\r\n let nextFiber = fiber;\r\n let shadow: Fiber = fiber.shadow;\r\n let instance = fiber.instance;\r\n\r\n while (true) {\r\n isDeepWalking = fiberMountHelper.deepWalking.get();\r\n nextFiber.hook.idx = 0;\r\n\r\n if (isDeepWalking) {\r\n const hasChildren = hasChildrenProp(instance) && instance.children.length > 0;\r\n\r\n if (hasChildren) {\r\n const { performedFiber, performedNextFiber, performedShadow, performedInstance } = performChild({\r\n nextFiber,\r\n shadow,\r\n instance,\r\n });\r\n\r\n nextFiber = performedNextFiber;\r\n shadow = performedShadow;\r\n instance = performedInstance;\r\n\r\n if (performedFiber) return performedFiber;\r\n } else {\r\n const { performedFiber, performedNextFiber, performedShadow, performedInstance } = performSibling({\r\n nextFiber,\r\n shadow,\r\n instance,\r\n });\r\n\r\n nextFiber = performedNextFiber;\r\n shadow = performedShadow;\r\n instance = performedInstance;\r\n\r\n if (performedFiber) return performedFiber;\r\n }\r\n } else {\r\n const { performedFiber, performedNextFiber, performedShadow, performedInstance } = performSibling({\r\n nextFiber,\r\n shadow,\r\n instance,\r\n });\r\n\r\n nextFiber = performedNextFiber;\r\n shadow = performedShadow;\r\n instance = performedInstance;\r\n\r\n if (performedFiber) return performedFiber;\r\n }\r\n\r\n performPartialUpdateEffects(nextFiber);\r\n\r\n if (nextFiber.parent === null) return null;\r\n }\r\n}\r\n\r\nfunction performPartialUpdateEffects(nextFiber: Fiber) {\r\n if (nextFiber.marker === PARTIAL_UPDATE) {\r\n const alternate = nextFiber.child?.alternate || null;\r\n const fiber = nextFiber.child || null;\r\n\r\n if (alternate && fiber && alternate.nextSibling && !fiber.nextSibling) {\r\n let nextFiber = alternate.nextSibling;\r\n const deletions: Array = [];\r\n\r\n while (nextFiber) {\r\n nextFiber.effectTag = EffectTag.DELETION;\r\n deletions.push(nextFiber);\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n deletionsHelper.get().push(...deletions);\r\n }\r\n }\r\n}\r\n\r\ntype PerformChildOptions = {\r\n nextFiber: Fiber;\r\n shadow: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction performChild(options: PerformChildOptions) {\r\n fiberMountHelper.jumpToChild();\r\n let nextFiber = options.nextFiber;\r\n let shadow = options.shadow;\r\n let instance = options.instance;\r\n\r\n shadow = shadow ? shadow.child : null;\r\n\r\n const alternate = getChildAlternate(nextFiber);\r\n const hook = getHook({ shadow, alternate, instance });\r\n const provider = shadow ? shadow.provider : alternate ? alternate.provider : null;\r\n let fiber = new Fiber({ hook, provider });\r\n\r\n componentFiberHelper.set(fiber);\r\n fiber.parent = nextFiber;\r\n\r\n const { performedInstance, performedShadow } = pertformInstance({\r\n instance,\r\n idx: 0,\r\n fiber,\r\n alternate,\r\n });\r\n instance = performedInstance || instance;\r\n shadow = performedShadow || shadow;\r\n alternate && mutateAlternate({ alternate, instance });\r\n mutateFiber({ fiber, alternate, instance });\r\n fiber = alternate ? performMemo({ fiber, alternate, instance }) : fiber;\r\n\r\n fiber.idx = 0;\r\n\r\n nextFiber.child = fiber;\r\n fiber.parent = nextFiber;\r\n fiber.shadow = shadow;\r\n nextFiber = fiber;\r\n\r\n cloneTagMap[fiber.parent.effectTag] && (fiber.effectTag = fiber.parent.effectTag);\r\n\r\n return {\r\n performedFiber: nextFiber,\r\n performedNextFiber: nextFiber,\r\n performedShadow: shadow,\r\n performedInstance: instance,\r\n };\r\n}\r\n\r\ntype PerformSiblingOptions = {\r\n nextFiber: Fiber;\r\n shadow: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction performSibling(options: PerformSiblingOptions) {\r\n fiberMountHelper.jumpToSibling();\r\n let nextFiber = options.nextFiber;\r\n let shadow = options.shadow;\r\n let instance = options.instance;\r\n const parent = nextFiber.parent.instance;\r\n const childrenIdx = fiberMountHelper.getIndex();\r\n const hasSibling = hasChildrenProp(parent) && parent.children[childrenIdx];\r\n\r\n if (hasSibling) {\r\n fiberMountHelper.deepWalking.set(true);\r\n\r\n shadow = shadow ? shadow.nextSibling : null;\r\n const alternate = getNextSiblingAlternate(nextFiber);\r\n const hook = getHook({ shadow, alternate, instance });\r\n const provider = shadow ? shadow.provider : alternate ? alternate.provider : null;\r\n let fiber = new Fiber({ hook, provider });\r\n\r\n componentFiberHelper.set(fiber);\r\n fiber.parent = nextFiber.parent;\r\n\r\n const { performedInstance, performedShadow } = pertformInstance({\r\n instance: parent,\r\n idx: childrenIdx,\r\n fiber,\r\n alternate,\r\n });\r\n instance = performedInstance || instance;\r\n shadow = performedShadow || shadow;\r\n alternate && mutateAlternate({ alternate, instance });\r\n mutateFiber({ fiber, alternate, instance });\r\n fiber = alternate ? performMemo({ fiber, alternate, instance }) : fiber;\r\n\r\n fiber.idx = childrenIdx;\r\n\r\n fiber.parent = nextFiber.parent;\r\n nextFiber.nextSibling = fiber;\r\n fiber.shadow = shadow;\r\n nextFiber = fiber;\r\n\r\n cloneTagMap[fiber.parent.effectTag] && (fiber.effectTag = fiber.parent.effectTag);\r\n\r\n return {\r\n performedFiber: nextFiber,\r\n performedNextFiber: nextFiber,\r\n performedShadow: shadow,\r\n performedInstance: instance,\r\n };\r\n } else {\r\n fiberMountHelper.jumpToParent();\r\n fiberMountHelper.deepWalking.set(false);\r\n shadow = shadow ? shadow.parent : null;\r\n nextFiber = nextFiber.parent;\r\n instance = nextFiber.instance;\r\n\r\n if (hasChildrenProp(nextFiber.instance)) {\r\n nextFiber.instance.children = [];\r\n }\r\n }\r\n\r\n return {\r\n performedFiber: null,\r\n performedNextFiber: nextFiber,\r\n performedShadow: shadow,\r\n performedInstance: instance,\r\n };\r\n}\r\n\r\ntype MutateFiberOptions = {\r\n fiber: Fiber;\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction mutateFiber(options: MutateFiberOptions) {\r\n const { fiber, alternate, instance } = options;\r\n const key = alternate ? getElementKey(alternate.instance) : null;\r\n const nextKey = alternate ? getElementKey(instance) : null;\r\n const isDifferentKeys = key !== nextKey;\r\n const isSameType = Boolean(alternate) && getInstanceType(alternate.instance) === getInstanceType(instance);\r\n const isUpdate = isSameType && !isDifferentKeys;\r\n\r\n fiber.instance = instance;\r\n fiber.alternate = alternate || null;\r\n fiber.nativeElement = isUpdate ? alternate.nativeElement : null;\r\n fiber.effectTag = isUpdate ? EffectTag.UPDATE : EffectTag.PLACEMENT;\r\n fiber.mountedToHost = isUpdate;\r\n\r\n if (hasChildrenProp(fiber.instance)) {\r\n fiber.childrenCount = fiber.instance.children.length;\r\n }\r\n\r\n if (fiber.alternate) {\r\n fiber.alternate.shadow = null;\r\n fiber.alternate.alternate = null;\r\n }\r\n\r\n if (!fiber.nativeElement && detectIsVirtualNode(fiber.instance)) {\r\n fiber.nativeElement = platform.createNativeElement(fiber.instance);\r\n }\r\n}\r\n\r\ntype PerformAlternateOptions = {\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction mutateAlternate(options: PerformAlternateOptions) {\r\n const { alternate, instance } = options;\r\n const alternateType = getInstanceType(alternate.instance);\r\n const elementType = getInstanceType(instance);\r\n const isSameType = elementType === alternateType;\r\n const prevKey = getElementKey(alternate.instance);\r\n const nextKey = getElementKey(instance);\r\n const isSameKeys = prevKey === nextKey;\r\n\r\n alternate.isUsed = true;\r\n\r\n if (!isSameType || !isSameKeys) {\r\n alternate.effectTag = EffectTag.DELETION;\r\n deletionsHelper.get().push(alternate);\r\n } else if (hasChildrenProp(alternate.instance) && hasChildrenProp(instance)) {\r\n const prevElementsCount = alternate.childrenCount;\r\n const nextElementsCount = instance.children.length;\r\n const isRequestedKeys = prevElementsCount !== nextElementsCount;\r\n\r\n if (isRequestedKeys) {\r\n const children = hasChildrenProp(instance) ? instance.children : [];\r\n const { prevKeys, nextKeys } = extractKeys(alternate.child, children);\r\n const hasPrevKeys = prevKeys.length > 0;\r\n const hasNextKeys = nextKeys.length > 0;\r\n const hasAnyKeys = hasPrevKeys || hasNextKeys;\r\n\r\n if (process.env.NODE_ENV === 'development') {\r\n if (!hasAnyKeys && prevElementsCount !== 0 && nextElementsCount !== 0) {\r\n error(`\r\n [Dark]: Operation of inserting, adding, replacing elements into list requires to have a unique key for every node (string or number, but not array index)!\r\n `);\r\n }\r\n }\r\n\r\n const performRemovingNodes = () => {\r\n const diffKeys = getDiffKeys(prevKeys, nextKeys);\r\n\r\n if (diffKeys.length > 0) {\r\n const fibersMap = createFibersByKeyMap(alternate.child);\r\n\r\n for (const key of diffKeys) {\r\n const fiber = fibersMap[key] || null;\r\n\r\n if (fiber) {\r\n fiber.effectTag = EffectTag.DELETION;\r\n deletionsHelper.get().push(fiber);\r\n }\r\n }\r\n } else {\r\n const diffCount = prevElementsCount - nextElementsCount;\r\n if (diffCount === 0) return;\r\n const fibers = takeListFromEnd(getSiblingFibers(alternate.child), diffCount);\r\n\r\n for (const fiber of fibers) {\r\n fiber.effectTag = EffectTag.DELETION;\r\n }\r\n\r\n deletionsHelper.get().push(...fibers);\r\n }\r\n };\r\n\r\n const performInsertingNodes = () => {\r\n const diffKeys = getDiffKeys(nextKeys, prevKeys);\r\n\r\n if (diffKeys.length === 0) return;\r\n\r\n const diffKeyMap = keyBy(diffKeys, x => x);\r\n const usedKeyMap = {};\r\n let keyIdx = 0;\r\n\r\n for (const nextKey of nextKeys) {\r\n if (process.env.NODE_ENV === 'development') {\r\n if (usedKeyMap[nextKey]) {\r\n error(`Some key of node already has been used!`);\r\n }\r\n }\r\n\r\n usedKeyMap[nextKey] = true;\r\n\r\n if (nextKey !== prevKeys[keyIdx] && diffKeyMap[nextKey]) {\r\n const insertionFiber = new Fiber({\r\n instance: createEmptyVirtualNode(),\r\n parent: alternate,\r\n effectTag: EffectTag.PLACEMENT,\r\n });\r\n\r\n if (keyIdx === 0) {\r\n insertionFiber.nextSibling = alternate.child;\r\n alternate.child = insertionFiber;\r\n } else {\r\n const [fiber, prevFiber] = getFibersByIdx(alternate.child, keyIdx);\r\n\r\n if (fiber && prevFiber) {\r\n insertionFiber.nextSibling = fiber;\r\n prevFiber.nextSibling = insertionFiber;\r\n }\r\n }\r\n }\r\n\r\n keyIdx++;\r\n }\r\n };\r\n\r\n performRemovingNodes();\r\n performInsertingNodes();\r\n }\r\n }\r\n}\r\n\r\ntype PerformMemoOptions = {\r\n fiber: Fiber;\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction performMemo(options: PerformMemoOptions) {\r\n const { fiber, alternate, instance } = options;\r\n\r\n if (detectIsMemo(fiber.instance)) {\r\n let memoFiber: Fiber = null;\r\n const factory = instance as ComponentFactory;\r\n const alternateFactory = alternate.instance as ComponentFactory;\r\n\r\n if (factory.type !== alternateFactory.type) return fiber;\r\n\r\n const props = alternateFactory.props;\r\n const nextProps = factory.props;\r\n const skip = !factory.shouldUpdate(props, nextProps);\r\n\r\n if (skip) {\r\n let nextFiber: Fiber = null;\r\n fiberMountHelper.deepWalking.set(false);\r\n\r\n memoFiber = new Fiber({\r\n ...alternate,\r\n alternate,\r\n effectTag: EffectTag.SKIP,\r\n nextSibling: alternate.nextSibling\r\n ? alternate.nextSibling.effectTag === EffectTag.DELETION\r\n ? null\r\n : alternate.nextSibling\r\n : null,\r\n });\r\n\r\n alternate.alternate = null;\r\n nextFiber = memoFiber.child;\r\n\r\n while (nextFiber) {\r\n nextFiber.parent = memoFiber;\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n if (memoFiber.effectHost) {\r\n fiber.markEffectHost();\r\n }\r\n\r\n if (memoFiber.layoutEffectHost) {\r\n fiber.markLayoutEffectHost();\r\n }\r\n\r\n if (memoFiber.mountedToHost) {\r\n fiber.markMountedToHost();\r\n }\r\n\r\n if (memoFiber.portalHost) {\r\n fiber.markPortalHost();\r\n }\r\n\r\n return memoFiber;\r\n }\r\n }\r\n\r\n return fiber;\r\n}\r\n\r\ntype PerformInstanceOptions = {\r\n instance: DarkElementInstance;\r\n idx: number;\r\n fiber: Fiber;\r\n alternate: Fiber;\r\n};\r\n\r\nfunction pertformInstance(options: PerformInstanceOptions) {\r\n const { instance, idx, fiber, alternate } = options;\r\n let performedInstance: DarkElementInstance = null;\r\n let performedShadow: Fiber = null;\r\n\r\n if (hasChildrenProp(instance)) {\r\n const elements = detectIsArray(instance.children[idx])\r\n ? flatten([instance.children[idx]])\r\n : [instance.children[idx]];\r\n\r\n instance.children.splice(idx, 1, ...elements);\r\n performedInstance = instance.children[idx];\r\n performedShadow = alternate\r\n ? getRootShadow({\r\n instance: performedInstance,\r\n fiber,\r\n alternate,\r\n })\r\n : performedShadow;\r\n performedInstance = mountInstance(fiber, performedInstance);\r\n }\r\n\r\n if (detectIsComponentFactory(performedInstance)) {\r\n if (hasEffects(fiber)) {\r\n fiber.markEffectHost();\r\n }\r\n\r\n if (hasLayoutEffects(fiber)) {\r\n fiber.markLayoutEffectHost();\r\n }\r\n\r\n if (platform.detectIsPortal(performedInstance)) {\r\n fiber.markPortalHost();\r\n }\r\n }\r\n\r\n return {\r\n performedInstance,\r\n performedShadow,\r\n };\r\n}\r\n\r\ntype GetRootShadowOptions = {\r\n instance: DarkElementInstance;\r\n fiber: Fiber;\r\n alternate: Fiber;\r\n};\r\n\r\nfunction getRootShadow(options: GetRootShadowOptions) {\r\n const { instance, fiber, alternate } = options;\r\n const key = getElementKey(alternate.instance);\r\n const nextKey = getElementKey(instance);\r\n let shadow: Fiber = null;\r\n\r\n if (key !== nextKey) {\r\n shadow = getAlternateByKey(nextKey, alternate.parent.child);\r\n\r\n if (shadow) {\r\n fiber.hook = shadow.hook;\r\n fiber.provider = shadow.provider;\r\n alternate.transposition = true;\r\n }\r\n }\r\n\r\n return shadow;\r\n}\r\n\r\nfunction mountInstance(fiber: Fiber, instance: DarkElementInstance) {\r\n const isComponentFactory = detectIsComponentFactory(instance);\r\n const factory = instance as ComponentFactory;\r\n\r\n if (isComponentFactory) {\r\n try {\r\n const result = factory.type(factory.props, factory.ref);\r\n\r\n factory.children = detectIsArray(result)\r\n ? (flatten([result]) as Array)\r\n : ([result] as Array);\r\n } catch (err) {\r\n factory.children = [];\r\n fiber.setError(err);\r\n error(err);\r\n }\r\n } else if (detectIsVirtualNodeFactory(instance)) {\r\n instance = instance();\r\n }\r\n\r\n if (hasChildrenProp(instance)) {\r\n for (let i = 0; i < instance.children.length; i++) {\r\n if (!instance.children[i]) {\r\n instance.children[i] = transformElementInstance(instance.children[i]) as DarkElementInstance;\r\n }\r\n }\r\n\r\n instance.children = isComponentFactory\r\n ? instance.children\r\n : detectIsArray(instance.children)\r\n ? flatten([instance.children])\r\n : [instance.children];\r\n\r\n if (isComponentFactory && factory.children.length === 0) {\r\n factory.children.push(createEmptyVirtualNode());\r\n }\r\n }\r\n\r\n return instance;\r\n}\r\n\r\nfunction getFibersByIdx(fiber: Fiber, idx: number): [Fiber | null, Fiber | null] {\r\n const map: Record = {};\r\n let nextFiber = fiber;\r\n let position = 0;\r\n\r\n while (nextFiber) {\r\n map[position] = nextFiber;\r\n\r\n if (position === idx) {\r\n return [map[position] || null, map[position - 1] || null];\r\n }\r\n\r\n position++;\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return [null, null];\r\n}\r\n\r\nfunction createFibersByKeyMap(fiber: Fiber) {\r\n let nextFiber = fiber;\r\n const map: Record = {};\r\n\r\n while (nextFiber) {\r\n const key = getElementKey(nextFiber.instance);\r\n\r\n if (!detectIsEmpty(key)) {\r\n map[key] = nextFiber;\r\n }\r\n\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return map;\r\n}\r\n\r\nfunction extractKeys(alternate: Fiber, children: Array) {\r\n let nextFiber = alternate;\r\n let idx = 0;\r\n const prevKeys: Array = [];\r\n const nextKeys: Array = [];\r\n\r\n while (nextFiber || idx < children.length) {\r\n const key = nextFiber && getElementKey(nextFiber.instance);\r\n const nextKey = children[idx] && getElementKey(children[idx]);\r\n\r\n if (!detectIsEmpty(key)) {\r\n prevKeys.push(key);\r\n }\r\n\r\n if (!detectIsEmpty(nextKey)) {\r\n nextKeys.push(nextKey);\r\n }\r\n\r\n nextFiber = nextFiber ? nextFiber.nextSibling : null;\r\n idx++;\r\n }\r\n\r\n return {\r\n prevKeys,\r\n nextKeys,\r\n };\r\n}\r\n\r\nfunction getAlternateByKey(key: DarkElementKey, fiber: Fiber) {\r\n if (detectIsEmpty(key)) return null;\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n if (key === getElementKey(nextFiber.instance)) {\r\n return nextFiber;\r\n }\r\n\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return null;\r\n}\r\n\r\nfunction getElementKey(instance: DarkElementInstance): DarkElementKey | null {\r\n const key = detectIsComponentFactory(instance)\r\n ? getComponentFactoryKey(instance)\r\n : detectIsTagVirtualNode(instance)\r\n ? getVirtualNodeKey(instance)\r\n : null;\r\n\r\n return key;\r\n}\r\n\r\nfunction getDiffKeys(keys: Array, nextKeys: Array): Array {\r\n const nextKeysMap = nextKeys.reduce((acc, key) => ((acc[key] = true), acc), {});\r\n const diff = [];\r\n\r\n for (const key of keys) {\r\n if (!nextKeysMap[key]) {\r\n diff.push(key);\r\n }\r\n }\r\n\r\n return diff;\r\n}\r\n\r\nfunction getChildAlternate(fiber: Fiber): Fiber | null {\r\n let alternate = fiber.alternate && fiber.alternate.effectTag !== EffectTag.DELETION ? fiber.alternate.child : null;\r\n\r\n while (alternate && alternate.effectTag === EffectTag.DELETION) {\r\n alternate = alternate.nextSibling;\r\n }\r\n\r\n return alternate;\r\n}\r\n\r\nfunction getNextSiblingAlternate(fiber: Fiber): Fiber | null {\r\n let alternate = fiber.alternate?.nextSibling || null;\r\n\r\n while (alternate && alternate.effectTag === EffectTag.DELETION) {\r\n alternate = alternate.nextSibling;\r\n }\r\n\r\n return alternate;\r\n}\r\n\r\nfunction transformElementInstance(instance: DarkElement) {\r\n return detectIsEmpty(instance) || instance === false ? createEmptyVirtualNode() : instance;\r\n}\r\n\r\nfunction getInstanceType(instance: DarkElementInstance): string | Function {\r\n return detectIsTagVirtualNode(instance)\r\n ? instance.name\r\n : detectIsVirtualNode(instance)\r\n ? instance.type\r\n : detectIsComponentFactory(instance)\r\n ? instance.type\r\n : null;\r\n}\r\n\r\nfunction getSiblingFibers(fiber: Fiber): Array {\r\n const list = [];\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n list.push(nextFiber);\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return list;\r\n}\r\n\r\nfunction hasChildrenProp(element: DarkElementInstance): element is TagVirtualNode | ComponentFactory {\r\n return detectIsTagVirtualNode(element) || detectIsComponentFactory(element);\r\n}\r\n\r\nfunction commitChanges() {\r\n const wipFiber = wipRootHelper.get();\r\n const fromHook = fromHookUpdateHelper.get();\r\n\r\n commitWork(wipFiber.child, () => {\r\n const layoutEffects = layoutEffectsHelper.get();\r\n const effects = effectsHelper.get();\r\n\r\n wipRootHelper.set(null);\r\n\r\n for (const layoutEffect of layoutEffects) {\r\n layoutEffect();\r\n }\r\n\r\n setTimeout(() => {\r\n for (const effect of effects) {\r\n effect();\r\n }\r\n });\r\n\r\n layoutEffectsHelper.reset();\r\n effectsHelper.reset();\r\n\r\n if (fromHook) {\r\n fromHookUpdateHelper.set(false);\r\n } else {\r\n currentRootHelper.set(wipFiber);\r\n }\r\n });\r\n}\r\n\r\nfunction commitWork(fiber: Fiber, onComplete: Function) {\r\n const deletions = deletionsHelper.get();\r\n\r\n // important order\r\n for (const fiber of deletions) {\r\n unmountFiber(fiber);\r\n platform.applyCommit(fiber);\r\n }\r\n\r\n walkFiber({\r\n fiber,\r\n onLoop: ({ nextFiber, isReturn, resetIsDeepWalking }) => {\r\n const skip = nextFiber.effectTag === EffectTag.SKIP;\r\n\r\n if (skip) {\r\n resetIsDeepWalking();\r\n } else if (!isReturn) {\r\n platform.applyCommit(nextFiber);\r\n }\r\n\r\n if (nextFiber && nextFiber.shadow) {\r\n nextFiber.shadow = null;\r\n }\r\n },\r\n });\r\n\r\n platform.finishCommitWork();\r\n deletionsHelper.set([]);\r\n onComplete();\r\n}\r\n\r\nfunction createHook(): Hook {\r\n return {\r\n idx: 0,\r\n values: [],\r\n };\r\n}\r\n\r\ntype GetHookOptions = {\r\n shadow: Fiber;\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction getHook(options: GetHookOptions) {\r\n const { shadow, alternate, instance } = options;\r\n\r\n if (shadow) return shadow.hook;\r\n\r\n if (alternate && getElementKey(alternate.instance) === getElementKey(instance)) {\r\n return alternate.hook;\r\n }\r\n\r\n return createHook();\r\n}\r\n\r\ntype CreateUpdateCallbackOptions = {\r\n rootId: number;\r\n fiber: Fiber;\r\n forceStart?: boolean;\r\n onStart: () => void;\r\n};\r\n\r\nfunction createUpdateCallback(options: CreateUpdateCallbackOptions) {\r\n const { rootId, fiber, forceStart = false, onStart } = options;\r\n const callback = () => {\r\n forceStart && onStart();\r\n if (fiber.isUsed) return;\r\n !forceStart && onStart();\r\n effectStoreHelper.set(rootId); // important order!\r\n fromHookUpdateHelper.set(true);\r\n fiberMountHelper.reset();\r\n\r\n fiber.alternate = new Fiber({\r\n ...fiber,\r\n alternate: null,\r\n });\r\n fiber.marker = PARTIAL_UPDATE;\r\n fiber.effectTag = EffectTag.UPDATE;\r\n fiber.child = null;\r\n\r\n wipRootHelper.set(fiber);\r\n componentFiberHelper.set(fiber);\r\n fiber.instance = mountInstance(fiber, fiber.instance);\r\n nextUnitOfWorkHelper.set(fiber);\r\n };\r\n\r\n return callback;\r\n}\r\n\r\nexport { Fiber, workLoop, createHook, hasChildrenProp, createUpdateCallback };\r\n","export * from './fiber';\r\nexport * from './types';\r\n","export enum EffectTag {\r\n PLACEMENT = 'PLACEMENT',\r\n UPDATE = 'UPDATE',\r\n DELETION = 'DELETION',\r\n SKIP = 'SKIP',\r\n}\r\n\r\nexport type NativeElement = unknown;\r\n\r\nexport type HookValue = {\r\n token?: Symbol;\r\n deps: Array;\r\n value: T;\r\n};\r\n\r\nexport type Hook = {\r\n idx: number;\r\n values: Array;\r\n};\r\n\r\nexport const cloneTagMap = {\r\n [EffectTag.PLACEMENT]: true,\r\n [EffectTag.SKIP]: true,\r\n};\r\n","import { type KeyProps, createComponent, detectIsComponentFactory } from '../component';\r\n\r\nconst $$fragment = Symbol('fragment');\r\n\r\nconst Fragment = createComponent(({ slot }) => slot || null, {\r\n token: $$fragment,\r\n});\r\n\r\nconst detectIsFragment = (factory: unknown) => detectIsComponentFactory(factory) && factory.token === $$fragment;\r\n\r\nexport { Fragment, detectIsFragment };\r\n","export * from './fragment';\r\n","import type { NestedArray } from '../shared';\r\n\r\nconst detectIsFunction = (o: any): o is Function => typeof o === 'function';\r\n\r\nconst detectIsUndefined = (o: any): o is undefined => typeof o === 'undefined';\r\n\r\nconst detectIsNumber = (o: any): o is number => typeof o === 'number';\r\n\r\nconst detectIsString = (o: any): o is string => typeof o === 'string';\r\n\r\nconst detectIsObject = (o: any): o is object => typeof o === 'object';\r\n\r\nconst detectIsBoolean = (o: any): o is boolean => typeof o === 'boolean';\r\n\r\nconst detectIsArray = (o: any): o is Array => Array.isArray(o);\r\n\r\nconst detectIsNull = (o: any): o is null => o === null;\r\n\r\nconst detectIsEmpty = (o: any) => detectIsNull(o) || detectIsUndefined(o);\r\n\r\nfunction error(str: string) {\r\n !detectIsUndefined(console) && console.error(str);\r\n}\r\n\r\nfunction flatten(source: Array>): Array {\r\n const list = [];\r\n const levelMap = { 0: { idx: 0, source } };\r\n let level = 0;\r\n\r\n do {\r\n const { source, idx } = levelMap[level];\r\n const item = source[idx];\r\n\r\n if (idx >= source.length) {\r\n level--;\r\n levelMap[level].idx++;\r\n continue;\r\n }\r\n\r\n if (detectIsArray(item)) {\r\n level++;\r\n levelMap[level] = {\r\n idx: 0,\r\n source: item,\r\n };\r\n } else {\r\n list.push(item);\r\n levelMap[level].idx++;\r\n }\r\n } while (level > 0 || levelMap[level].idx < levelMap[level].source.length);\r\n\r\n return list;\r\n}\r\n\r\nfunction getTime() {\r\n return Date.now();\r\n}\r\n\r\nfunction keyBy(\r\n list: Array,\r\n fn: (o: T) => string | number,\r\n value = false,\r\n): Record {\r\n return list.reduce((acc, x) => ((acc[fn(x)] = value ? x : true), acc), {});\r\n}\r\n\r\nfunction takeListFromEnd(source: Array, count: number) {\r\n return source.slice(source.length - count, source.length);\r\n}\r\n\r\nconst dummyFn = () => {};\r\n\r\nfunction detectIsDepsDifferent(deps: Array, prevDeps: Array): boolean {\r\n if (!detectIsUndefined(deps) && !detectIsUndefined(prevDeps) && deps.length > 0 && prevDeps.length > 0) {\r\n for (let i = 0; i < prevDeps.length; i++) {\r\n if (prevDeps[i] !== deps[i]) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n}\r\n\r\nexport {\r\n detectIsFunction,\r\n detectIsUndefined,\r\n detectIsNumber,\r\n detectIsString,\r\n detectIsObject,\r\n detectIsBoolean,\r\n detectIsArray,\r\n detectIsNull,\r\n detectIsEmpty,\r\n error,\r\n flatten,\r\n getTime,\r\n keyBy,\r\n takeListFromEnd,\r\n dummyFn,\r\n detectIsDepsDifferent,\r\n};\r\n","export * from './lazy';\r\n","import { type Component, createComponent, detectIsComponentFactory } from '../component';\r\nimport { useState } from '../use-state';\r\nimport { useEffect } from '../use-effect';\r\nimport { forwardRef } from '../ref';\r\nimport { SuspenseContext } from '../suspense';\r\nimport { useContext } from '../use-context';\r\n\r\nconst $$lazy = Symbol('lazy');\r\n\r\ntype LazyScope = {\r\n component: Component;\r\n};\r\n\r\nfunction lazy(dynamic: () => Promise<{ default: Component

}>) {\r\n return forwardRef(\r\n createComponent(\r\n (props, ref) => {\r\n const { fallback, trigger } = useContext(SuspenseContext);\r\n const [scope, setScope] = useState>({\r\n component: null,\r\n });\r\n\r\n useEffect(() => {\r\n fetchModule(dynamic).then(component => {\r\n setScope({ component });\r\n });\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (!scope.component) return;\r\n trigger();\r\n }, [scope.component]);\r\n\r\n return scope.component ? scope.component(props, ref) : fallback;\r\n },\r\n { token: $$lazy },\r\n ),\r\n );\r\n}\r\n\r\nconst detectIsLazy = (factory: unknown) => detectIsComponentFactory(factory) && factory.token === $$lazy;\r\n\r\nfunction fetchModule(dynamic: () => Promise<{ default: Component }>) {\r\n return new Promise(resolve => {\r\n dynamic().then(module => {\r\n if (!module.default) {\r\n throw new Error('[Dark]: lazy loaded component should be exported as default!');\r\n }\r\n\r\n resolve(module.default);\r\n });\r\n });\r\n}\r\n\r\nexport { lazy, detectIsLazy };\r\n","export * from './memo';\r\n","import {\r\n type Component,\r\n type ComponentFactory,\r\n type StandardComponentProps,\r\n type RefProps,\r\n type SlotProps,\r\n createComponent,\r\n detectIsComponentFactory,\r\n} from '../component';\r\nimport { type MutableRef, forwardRef } from '../ref';\r\n\r\ntype ShouldUpdate = (props: T, nextProps: T) => boolean;\r\n\r\nconst $$memo = Symbol('memo');\r\n\r\nconst defaultShouldUpdate = (props: {}, nextProps: {}): boolean => {\r\n const keys = Object.keys(nextProps);\r\n\r\n for (const key of keys) {\r\n if (key !== 'slot' && nextProps[key] !== props[key]) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n};\r\n\r\nconst detectIsMemo = (factory: unknown) => detectIsComponentFactory(factory) && factory.token === $$memo;\r\n\r\nfunction memo(\r\n component: (props: T, ref?: MutableRef) => ComponentFactory,\r\n shouldUpdate: ShouldUpdate = defaultShouldUpdate,\r\n): Component {\r\n return forwardRef(\r\n createComponent(\r\n (props: T & RefProps, ref) => {\r\n ref && (props.ref = ref);\r\n\r\n return component(props);\r\n },\r\n { token: $$memo, shouldUpdate },\r\n ),\r\n );\r\n}\r\n\r\nexport { $$memo, memo, detectIsMemo };\r\n","export * from './platform';\r\nexport * from './types';\r\n","import type { Platform } from './types';\r\n\r\nexport const platform: Platform = {\r\n scheduleCallback: () => {\r\n throw new Error('scheduleCallback not installed by renderer');\r\n },\r\n shouldYeildToHost: () => {\r\n throw new Error('shouldYeildToHost not installed by renderer');\r\n },\r\n createNativeElement: () => {\r\n throw new Error('createNativeElement not installed by renderer');\r\n },\r\n applyCommit: () => {\r\n throw new Error('applyCommit not installed by renderer');\r\n },\r\n finishCommitWork: () => {\r\n throw new Error('finishCommitWork not installed by renderer');\r\n },\r\n detectIsPortal: () => {\r\n throw new Error('detectIsPortal not installed by renderer');\r\n },\r\n unmountPortal: () => {\r\n throw new Error('unmountPortal not installed by renderer');\r\n },\r\n};\r\n","import { type Fiber } from '../fiber';\r\nimport { type TaskPriority } from '../constants';\r\nimport { type ComponentFactory } from '../component';\r\nimport { type VirtualNode } from '../view';\r\n\r\nexport type Platform = {\r\n scheduleCallback: (callback: () => void, options?: ScheduleCallbackOptions) => void;\r\n shouldYeildToHost: () => boolean;\r\n createNativeElement: (vNode: VirtualNode) => N;\r\n applyCommit: (fiber: Fiber) => void;\r\n finishCommitWork: () => void;\r\n detectIsPortal: (factory: ComponentFactory) => boolean;\r\n unmountPortal: (fiber: Fiber) => void;\r\n};\r\n\r\nexport type ScheduleCallbackOptions = {\r\n priority?: TaskPriority;\r\n timeoutMs?: number;\r\n};\r\n","export * from './ref';\r\nexport type { MutableRef } from './types';\r\n","import { detectIsObject, detectIsNull } from '../helpers';\r\nimport type { Component, RefProps, ComponentFactory } from '../component';\r\nimport type { MutableRef } from './types';\r\n\r\nfunction forwardRef(component: Component) {\r\n type Props = P & RefProps;\r\n\r\n return ({ ref, ...rest }: Props) => {\r\n return component(rest as P, ref) as ComponentFactory;\r\n };\r\n}\r\n\r\nconst detectIsRef = (ref: unknown) => {\r\n if (!detectIsObject(ref) || detectIsNull(ref)) return false;\r\n const mutableRef = ref as MutableRef;\r\n\r\n for (const key in mutableRef) {\r\n if (key === 'current' && mutableRef.hasOwnProperty(key)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n};\r\n\r\nexport { forwardRef, detectIsRef };\r\n","export * from './scope';\r\n","import type { Fiber } from '../fiber';\r\n\r\nclass Store {\r\n public wipRoot: Fiber = null;\r\n public currentRoot: Fiber = null;\r\n public nextUnitOfWork: Fiber = null;\r\n public fromHookUpdate = false;\r\n public events: Map> = new Map();\r\n public unsubscribers: Array<() => void> = [];\r\n public deletions: Array = [];\r\n public fiberMount = {\r\n level: 0,\r\n navigation: {},\r\n isDeepWalking: true,\r\n };\r\n public componentFiber: Fiber = null;\r\n public effects: Array<() => void> = [];\r\n public layoutEffects: Array<() => void> = [];\r\n}\r\n\r\nlet rootId = null;\r\nconst stores = new Map();\r\n\r\nconst effectStoreHelper = {\r\n set: (id: number) => effectStore(id),\r\n remove: (id: number) => stores.delete(id),\r\n};\r\n\r\nconst getRootId = (): number => rootId;\r\n\r\nconst effectStore = (id: number) => {\r\n rootId = id;\r\n !stores.get(rootId) && stores.set(rootId, new Store());\r\n};\r\n\r\nconst storeHelper = {\r\n get: (id: number = rootId) => stores.get(id),\r\n};\r\n\r\nconst wipRootHelper = {\r\n get: () => storeHelper.get()?.wipRoot || null,\r\n set: (fiber: Fiber) => (storeHelper.get().wipRoot = fiber),\r\n};\r\n\r\nconst currentRootHelper = {\r\n get: (id?: number) => storeHelper.get(id)?.currentRoot || null,\r\n set: (fiber: Fiber) => (storeHelper.get().currentRoot = fiber),\r\n};\r\n\r\nconst nextUnitOfWorkHelper = {\r\n get: () => storeHelper.get()?.nextUnitOfWork || null,\r\n set: (fiber: Fiber) => (storeHelper.get().nextUnitOfWork = fiber),\r\n};\r\n\r\nconst componentFiberHelper = {\r\n get: () => storeHelper.get()?.componentFiber,\r\n set: (fiber: Fiber) => (storeHelper.get().componentFiber = fiber),\r\n};\r\n\r\nconst fromHookUpdateHelper = {\r\n get: () => storeHelper.get()?.fromHookUpdate || false,\r\n set: (value: boolean) => (storeHelper.get().fromHookUpdate = value),\r\n};\r\n\r\nconst eventsHelper = {\r\n get: () => storeHelper.get().events,\r\n addUnsubscriber: (fn: () => void) => storeHelper.get().unsubscribers.push(fn),\r\n mapUnsubscribers: (id: number) => storeHelper.get(id).unsubscribers.forEach(fn => fn()),\r\n};\r\n\r\nconst deletionsHelper = {\r\n get: () => storeHelper.get().deletions,\r\n set: (deletions: Array) => (storeHelper.get().deletions = deletions),\r\n};\r\n\r\nconst fiberMountHelper = {\r\n reset: () => {\r\n storeHelper.get().fiberMount = {\r\n level: 0,\r\n navigation: {},\r\n isDeepWalking: true,\r\n };\r\n },\r\n getIndex: () => storeHelper.get().fiberMount.navigation[storeHelper.get().fiberMount.level],\r\n jumpToChild: () => {\r\n const { fiberMount } = storeHelper.get();\r\n const level = fiberMount.level;\r\n const nextLevel = level + 1;\r\n\r\n fiberMount.level = nextLevel;\r\n fiberMount.navigation[nextLevel] = 0;\r\n },\r\n jumpToParent: () => {\r\n const { fiberMount } = storeHelper.get();\r\n const level = fiberMount.level;\r\n const nextLevel = level - 1;\r\n\r\n fiberMount.navigation[level] = 0;\r\n fiberMount.level = nextLevel;\r\n },\r\n jumpToSibling: () => {\r\n const { fiberMount } = storeHelper.get();\r\n const level = fiberMount.level;\r\n const idx = fiberMount.navigation[level] + 1;\r\n\r\n fiberMount.navigation[level] = idx;\r\n },\r\n deepWalking: {\r\n get: () => storeHelper.get().fiberMount.isDeepWalking,\r\n set: (value: boolean) => (storeHelper.get().fiberMount.isDeepWalking = value),\r\n },\r\n};\r\n\r\nconst effectsHelper = {\r\n get: () => storeHelper.get().effects,\r\n reset: () => (storeHelper.get().effects = []),\r\n add: (effect: () => void) => storeHelper.get().effects.push(effect),\r\n};\r\n\r\nconst layoutEffectsHelper = {\r\n get: () => storeHelper.get().layoutEffects,\r\n reset: () => (storeHelper.get().layoutEffects = []),\r\n add: (effect: () => void) => storeHelper.get().layoutEffects.push(effect),\r\n};\r\n\r\nexport {\r\n getRootId,\r\n effectStoreHelper,\r\n wipRootHelper,\r\n currentRootHelper,\r\n nextUnitOfWorkHelper,\r\n componentFiberHelper,\r\n fromHookUpdateHelper,\r\n eventsHelper,\r\n deletionsHelper,\r\n fiberMountHelper,\r\n effectsHelper,\r\n layoutEffectsHelper,\r\n};\r\n","export * from './types';\r\n","import type { ComponentFactory } from '../component';\r\nimport type { VirtualNode, VirtualNodeFactory } from '../view';\r\n\r\nexport type DarkElement = NestedArray;\r\n\r\nexport type Nullable = null | false | undefined;\r\n\r\nexport type NestedArray = T | Array>;\r\n\r\nexport type RenderProps = (...args: Array) => DarkElement;\r\n\r\nexport type DarkElementKey = string | number;\r\n\r\nexport type DarkElementInstance = VirtualNode | VirtualNodeFactory | ComponentFactory;\r\n","export * from './suspense';\r\n","import { createComponent } from '../component';\r\nimport { useState } from '../use-state';\r\nimport { createContext } from '../context';\r\nimport { useContext } from '../use-context';\r\nimport { useMemo } from '../use-memo';\r\nimport { useCallback } from '../use-callback';\r\nimport type { DarkElement } from '../shared';\r\n\r\ntype SuspenseProps = {\r\n fallback: DarkElement;\r\n};\r\n\r\ntype SuspenseContextValue = {\r\n fallback: DarkElement;\r\n isLoaded: boolean;\r\n trigger: () => void;\r\n};\r\n\r\nconst SuspenseContext = createContext({\r\n fallback: null,\r\n isLoaded: true,\r\n trigger: () => {},\r\n});\r\n\r\nconst Suspense = createComponent(({ fallback, slot }) => {\r\n if (!fallback) {\r\n throw new Error(`[Dark]: Suspense fallback not found`);\r\n }\r\n const { isLoaded: isSuspenseLoaded } = useContext(SuspenseContext);\r\n const [isLoaded, setIsLoaded] = useState(false);\r\n const trigger = useCallback(() => setIsLoaded(true), []);\r\n const value = useMemo(() => ({ fallback, isLoaded, trigger }), [fallback, isLoaded]);\r\n\r\n return SuspenseContext.Provider({\r\n value,\r\n slot: isSuspenseLoaded ? slot : null,\r\n });\r\n});\r\n\r\nexport { SuspenseContext, Suspense };\r\n","export * from './unmount';\r\n","import { type Fiber } from '../fiber';\r\nimport { platform } from '../platform';\r\nimport { detectIsComponentFactory } from '../component';\r\nimport { dropEffects } from '../use-effect';\r\nimport { dropLayoutEffects } from '../use-layout-effect';\r\nimport { walkFiber } from '../walk';\r\nimport { detectIsUndefined } from '../helpers';\r\nimport { currentRootHelper, eventsHelper, effectStoreHelper } from '../scope';\r\n\r\nfunction unmountFiber(fiber: Fiber) {\r\n if (!fiber.effectHost && !fiber.layoutEffectHost && !fiber.portalHost) return;\r\n\r\n walkFiber({\r\n fiber,\r\n onLoop: ({ nextFiber, isReturn, stop }) => {\r\n if (nextFiber === fiber.nextSibling || fiber.transposition) return stop();\r\n\r\n if (!isReturn && detectIsComponentFactory(nextFiber.instance)) {\r\n nextFiber.layoutEffectHost && dropLayoutEffects(nextFiber.hook);\r\n nextFiber.effectHost && dropEffects(nextFiber.hook);\r\n nextFiber.portalHost && platform.unmountPortal(nextFiber);\r\n }\r\n },\r\n });\r\n}\r\n\r\nfunction unmountRoot(rootId: number, onComplete: () => void) {\r\n if (detectIsUndefined(rootId)) return;\r\n\r\n unmountFiber(currentRootHelper.get(rootId));\r\n eventsHelper.mapUnsubscribers(rootId);\r\n effectStoreHelper.remove(rootId);\r\n onComplete();\r\n}\r\n\r\nexport { unmountFiber, unmountRoot };\r\n","export * from './use-callback';\r\n","import { useMemo } from '../use-memo';\r\n\r\nfunction useCallback(callback: T, deps: Array): T {\r\n const value = useMemo(() => callback, deps);\r\n\r\n return value;\r\n}\r\n\r\nexport { useCallback };\r\n","export * from './use-context';\r\n","import { useEffect } from '../use-effect';\r\nimport { useMemo } from '../use-memo';\r\nimport { componentFiberHelper } from '../scope';\r\nimport { useUpdate } from '../use-update';\r\nimport type { Fiber } from '../fiber';\r\nimport type { Context, ContextProviderValue } from '../context';\r\n\r\nfunction useContext(context: Context): T {\r\n const { defaultValue } = context;\r\n const fiber = componentFiberHelper.get();\r\n const provider = getProvider(context, fiber);\r\n const value = provider ? provider.value : defaultValue;\r\n const update = useUpdate();\r\n const scope = useMemo(() => ({ prevValue: value }), []);\r\n const hasProvider = Boolean(provider);\r\n\r\n useEffect(() => {\r\n if (!hasProvider) return;\r\n\r\n const subscriber = (newValue: T) => {\r\n if (!Object.is(scope.prevValue, newValue)) {\r\n update();\r\n }\r\n };\r\n\r\n provider.subscribers.push(subscriber);\r\n\r\n return () => {\r\n const idx = provider.subscribers.findIndex(x => x === subscriber);\r\n\r\n if (idx !== -1) {\r\n provider.subscribers.splice(idx, 1);\r\n }\r\n };\r\n }, [hasProvider]);\r\n\r\n scope.prevValue = value;\r\n\r\n return value;\r\n}\r\n\r\nfunction getProvider(context: Context, fiber: Fiber): ContextProviderValue {\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n if (nextFiber.provider && nextFiber.provider.get(context)) {\r\n return nextFiber.provider.get(context) as ContextProviderValue;\r\n }\r\n\r\n nextFiber = nextFiber.parent;\r\n }\r\n\r\n return null;\r\n}\r\n\r\nexport { useContext };\r\n","export * from './use-deferred-value';\r\n","import { useState } from '../use-state';\r\nimport { useEffect } from '../use-effect';\r\nimport { TaskPriority } from '../constants';\r\n\r\ntype UseDeferredValueOprions = {\r\n timeoutMs: number;\r\n};\r\n\r\nfunction useDeferredValue(value: T, options?: UseDeferredValueOprions): T {\r\n const { timeoutMs } = options || {};\r\n const [deferredValue, setDeferredValue] = useState(value, {\r\n priority: TaskPriority.LOW,\r\n timeoutMs,\r\n });\r\n\r\n useEffect(() => {\r\n setDeferredValue(value);\r\n }, [value]);\r\n\r\n return deferredValue;\r\n}\r\n\r\nexport { useDeferredValue };\r\n","export * from './use-effect';\r\n","import { detectIsUndefined, detectIsFunction, detectIsDepsDifferent } from '../helpers';\r\nimport { componentFiberHelper, effectsHelper } from '../scope';\r\nimport type { Fiber, Hook, HookValue } from '../fiber';\r\nimport type { Effect, DropEffect } from './types';\r\n\r\nconst $$useEffect = Symbol('use-effect');\r\n\r\nconst { useEffect, hasEffects, dropEffects } = createEffect($$useEffect, effectsHelper);\r\n\r\nfunction createEffect(token: Symbol, store: typeof effectsHelper) {\r\n function useEffect(effect: Effect, deps?: Array) {\r\n const fiber = componentFiberHelper.get();\r\n const hook = fiber.hook as Hook>;\r\n const { idx, values } = hook;\r\n const runEffect = () => {\r\n values[idx] = {\r\n deps,\r\n token,\r\n value: undefined,\r\n };\r\n\r\n store.add(() => {\r\n values[idx].value = effect();\r\n });\r\n };\r\n\r\n if (detectIsUndefined(values[idx])) {\r\n runEffect();\r\n } else {\r\n const { deps: prevDeps, value: cleanup } = values[idx];\r\n const isDepsDifferent = deps ? detectIsDepsDifferent(deps, prevDeps) : true;\r\n\r\n if (isDepsDifferent) {\r\n detectIsFunction(cleanup) && cleanup();\r\n runEffect();\r\n }\r\n }\r\n\r\n hook.idx++;\r\n }\r\n\r\n function hasEffects(fiber: Fiber) {\r\n const { values } = fiber.hook as Hook;\r\n const hasEffect = values.some(x => x.token === token);\r\n\r\n return hasEffect;\r\n }\r\n\r\n function dropEffects(hook: Hook>) {\r\n const { values } = hook;\r\n\r\n for (const value of values) {\r\n if (value.token === token) {\r\n const cleanup = value.value;\r\n\r\n detectIsFunction(cleanup) && cleanup();\r\n }\r\n }\r\n }\r\n\r\n return {\r\n useEffect,\r\n hasEffects,\r\n dropEffects,\r\n };\r\n}\r\n\r\nexport { useEffect, hasEffects, dropEffects, createEffect };\r\n","export * from './use-error';\r\n","import { componentFiberHelper } from '../scope';\r\nimport { useEffect } from '../use-effect';\r\nimport { useUpdate } from '../use-update';\r\nimport { useMemo } from '../use-memo';\r\n\r\ntype ErrorScope = {\r\n error: Error;\r\n};\r\n\r\nfunction useError(): Error | null {\r\n const fiber = componentFiberHelper.get();\r\n const update = useUpdate();\r\n const scope: ErrorScope = useMemo(() => ({ error: null }), []);\r\n\r\n fiber.catchException = (error: Error) => {\r\n scope.error = error;\r\n update();\r\n };\r\n\r\n useEffect(() => {\r\n scope.error = null;\r\n }, [scope.error]);\r\n\r\n return scope.error;\r\n}\r\n\r\nexport { useError };\r\n","export * from './use-event';\r\n","import { useMemo } from '../use-memo';\r\nimport { useCallback } from '../use-callback';\r\n\r\nfunction useEvent any>(fn: T) {\r\n const scope = useMemo(() => ({ fn }), []);\r\n\r\n scope.fn = fn;\r\n\r\n const callback = useCallback((...args) => {\r\n return scope.fn(...args);\r\n }, []);\r\n\r\n return callback as unknown as T;\r\n}\r\n\r\nexport { useEvent };\r\n","export * from './use-imperative-handle';\r\n","import { useMemo } from '../use-memo';\r\nimport type { MutableRef } from '../ref';\r\n\r\nfunction useImperativeHandle(ref: MutableRef, createHandle: () => T, deps: Array) {\r\n const current = useMemo(() => createHandle(), deps);\r\n\r\n ref.current = current;\r\n}\r\n\r\nexport { useImperativeHandle };\r\n","export * from './use-layout-effect';\r\n","import { layoutEffectsHelper } from '../scope';\r\nimport { createEffect } from '../use-effect';\r\n\r\nconst $$useLayoutEffect = Symbol('use-layout-effect');\r\n\r\nconst {\r\n useEffect: useLayoutEffect,\r\n hasEffects: hasLayoutEffects,\r\n dropEffects: dropLayoutEffects,\r\n} = createEffect($$useLayoutEffect, layoutEffectsHelper);\r\n\r\nexport { useLayoutEffect, hasLayoutEffects, dropLayoutEffects };\r\n","export * from './use-memo';\r\n","import { type DarkElement } from '../shared';\r\nimport { detectIsUndefined, detectIsArray, detectIsDepsDifferent } from '../helpers';\r\nimport { detectIsComponentFactory, createComponent } from '../component';\r\nimport { detectIsVirtualNodeFactory } from '../view';\r\nimport { componentFiberHelper } from '../scope';\r\nimport { Fragment } from '../fragment';\r\nimport { $$memo } from '../memo';\r\n\r\nconst Memo = createComponent(({ slot }) => slot, { token: $$memo });\r\n\r\nfunction wrap(value: T, isDepsDifferent: boolean) {\r\n const check = (value: T) => detectIsVirtualNodeFactory(value) || detectIsComponentFactory(value);\r\n\r\n if (detectIsArray(value) ? check(value[0]) : check(value)) {\r\n const slot = value as unknown as DarkElement;\r\n const factory = Memo({\r\n slot: Fragment({ slot }),\r\n });\r\n\r\n factory.shouldUpdate = () => isDepsDifferent;\r\n\r\n return factory;\r\n }\r\n\r\n return value;\r\n}\r\n\r\nfunction processValue(getValue: () => T, isDepsDifferent = false) {\r\n return wrap(getValue(), isDepsDifferent);\r\n}\r\n\r\nfunction useMemo(getValue: () => T, deps: Array): T {\r\n const fiber = componentFiberHelper.get();\r\n const { hook } = fiber;\r\n const { idx, values } = hook;\r\n\r\n if (detectIsUndefined(values[idx])) {\r\n const value = processValue(getValue);\r\n\r\n values[idx] = {\r\n deps,\r\n value,\r\n };\r\n\r\n hook.idx++;\r\n\r\n return value as T;\r\n }\r\n\r\n const hookValue = values[idx];\r\n const prevDeps = hookValue.deps as Array;\r\n const isDepsDifferent = detectIsDepsDifferent(deps, prevDeps);\r\n const computedGetValue = isDepsDifferent ? getValue : () => hookValue.value;\r\n\r\n hookValue.deps = deps;\r\n hookValue.value = processValue(computedGetValue, isDepsDifferent);\r\n\r\n hook.idx++;\r\n\r\n return hookValue.value;\r\n}\r\n\r\nexport { useMemo };\r\n","export * from './use-reducer';\r\nexport type { Reducer } from './types';\r\n","import { useState } from '../use-state';\r\nimport { useCallback } from '../use-callback';\r\nimport { useMemo } from '../use-memo';\r\nimport { detectIsFunction } from '../helpers';\r\nimport type { Reducer, Dispatch, ReducerAction, ReducerState } from './types';\r\n\r\nfunction useReducer(\r\n reducer: R,\r\n initialState: ReducerState,\r\n initializer?: (state: ReducerState) => ReducerState,\r\n): [ReducerState, Dispatch>] {\r\n const initialValue = useMemo(() => {\r\n return detectIsFunction(initializer) ? initializer(initialState) : initialState;\r\n }, []);\r\n const [state, setState] = useState>(initialValue);\r\n const dispatch = useCallback((action: ReducerAction) => setState(state => reducer(state, action)), []) as Dispatch<\r\n ReducerAction\r\n >;\r\n\r\n return [state, dispatch];\r\n}\r\n\r\nexport { useReducer };\r\n","export * from './use-ref';\r\n","import { useMemo } from '../use-memo';\r\nimport type { MutableRef } from '../ref';\r\n\r\nfunction useRef(initialValue: T = null): MutableRef {\r\n const ref = useMemo(() => ({ current: initialValue }), []) as MutableRef;\r\n\r\n return ref;\r\n}\r\n\r\nexport { useRef };\r\n","export * from './use-state';\r\n","import { type ScheduleCallbackOptions } from '../platform';\r\nimport { detectIsUndefined, detectIsFunction } from '../helpers';\r\nimport { componentFiberHelper } from '../scope';\r\nimport { useUpdate } from '../use-update';\r\nimport { useMemo } from '../use-memo';\r\nimport { useCallback } from '../use-callback';\r\nimport { TaskPriority } from '../constants';\r\n\r\ntype Value = T | ((prevValue: T) => T);\r\ntype Scope = {\r\n idx: number;\r\n values: Array;\r\n};\r\n\r\nfunction useState(initialValue: T, options?: ScheduleCallbackOptions): [T, (value: Value) => void] {\r\n const fiber = componentFiberHelper.get();\r\n const update = useUpdate(options);\r\n const scope: Scope = useMemo(\r\n () => ({\r\n idx: fiber.hook.idx,\r\n values: fiber.hook.values,\r\n }),\r\n [],\r\n );\r\n const setState = useCallback((sourceValue: Value) => {\r\n const value = scope.values[scope.idx];\r\n const newValue = detectIsFunction(sourceValue) ? sourceValue(value) : sourceValue;\r\n\r\n if (!Object.is(value, newValue)) {\r\n const setValue = () => {\r\n scope.values[scope.idx] = newValue;\r\n };\r\n\r\n if (options?.priority === TaskPriority.LOW) {\r\n update(() => setValue());\r\n } else {\r\n setValue();\r\n update();\r\n }\r\n }\r\n }, []);\r\n const { hook } = fiber;\r\n const { idx, values } = hook;\r\n const value: T = !detectIsUndefined(values[idx]) ? values[idx] : initialValue;\r\n\r\n values[idx] = value;\r\n scope.idx = idx;\r\n scope.values = values;\r\n hook.idx++;\r\n\r\n return [value, setState];\r\n}\r\n\r\nexport { useState };\r\n","export * from './use-update';\r\n","import { platform, type ScheduleCallbackOptions } from '../platform';\r\nimport { getRootId, componentFiberHelper } from '../scope';\r\nimport { createUpdateCallback } from '../fiber';\r\nimport { useMemo } from '../use-memo';\r\nimport { dummyFn } from '../helpers';\r\n\r\nfunction useUpdate(options?: ScheduleCallbackOptions) {\r\n const rootId = getRootId();\r\n const fiber = componentFiberHelper.get();\r\n const scope = useMemo(() => ({ fiber }), []);\r\n\r\n scope.fiber = fiber;\r\n\r\n const update = (onStart?: () => void) => {\r\n const callback = createUpdateCallback({\r\n rootId,\r\n fiber: scope.fiber,\r\n forceStart: Boolean(options?.timeoutMs),\r\n onStart: onStart || dummyFn,\r\n });\r\n\r\n platform.scheduleCallback(callback, options);\r\n };\r\n\r\n return update;\r\n}\r\n\r\nexport { useUpdate };\r\n","export * from './view';\r\nexport * from './types';\r\n","export type ViewDef = {\r\n as: string;\r\n slot?: any;\r\n isVoid?: boolean;\r\n [prop: string]: any;\r\n};\r\n\r\nexport enum NodeType {\r\n TAG = 'TAG',\r\n TEXT = 'TEXT',\r\n COMMENT = 'COMMENT',\r\n}\r\n","import { EMPTY_NODE, ATTR_KEY } from '../constants';\r\nimport { detectIsArray, detectIsEmpty, detectIsFunction, detectIsString } from '../helpers';\r\nimport type { DarkElementKey } from '../shared';\r\nimport type { ComponentFactory, StandardComponentProps } from '../component';\r\nimport { NodeType, type ViewDef } from './types';\r\n\r\nexport type VirtualNodeFactory = () => VirtualNode;\r\nexport type TagVirtualNodeFactory = () => TagVirtualNode;\r\nexport type TextVirtualNodeFactory = () => TextVirtualNode;\r\nexport type CommentVirtualNodeFactory = () => CommentVirtualNode;\r\n\r\nconst $$virtualNode = Symbol('virtual-node');\r\n\r\nclass VirtualNode {\r\n public type: NodeType = null;\r\n\r\n constructor(options: Partial) {\r\n this.type = options.type;\r\n }\r\n}\r\n\r\nclass TagVirtualNode extends VirtualNode {\r\n public type = NodeType.TAG;\r\n public name: string = null;\r\n public isVoid = false;\r\n public attrs: Record = {};\r\n public children: Array = [];\r\n\r\n constructor(options: Partial) {\r\n super(options);\r\n this.name = options.name || this.name;\r\n this.isVoid = options.isVoid || this.isVoid;\r\n this.attrs = options.attrs || this.attrs;\r\n this.children = options.children || this.children;\r\n }\r\n}\r\n\r\nclass TextVirtualNode extends VirtualNode {\r\n public type = NodeType.TEXT;\r\n public value = '';\r\n\r\n constructor(text: string) {\r\n super({});\r\n this.value = text;\r\n }\r\n}\r\n\r\nclass CommentVirtualNode extends VirtualNode {\r\n public type = NodeType.COMMENT;\r\n public value = '';\r\n\r\n constructor(text: string) {\r\n super({});\r\n this.value = text;\r\n }\r\n}\r\n\r\nconst detectIsVirtualNode = (vNode: unknown): vNode is VirtualNode => vNode instanceof VirtualNode;\r\n\r\nconst detectIsTagVirtualNode = (vNode: unknown): vNode is TagVirtualNode => vNode instanceof TagVirtualNode;\r\n\r\nconst detectIsCommentVirtualNode = (vNode: unknown): vNode is CommentVirtualNode => vNode instanceof CommentVirtualNode;\r\n\r\nconst detectIsTextVirtualNode = (vNode: unknown): vNode is TextVirtualNode => vNode instanceof TextVirtualNode;\r\n\r\nconst detectIsEmptyVirtualNode = (vNode: unknown): boolean =>\r\n detectIsCommentVirtualNode(vNode) && vNode.value === EMPTY_NODE;\r\n\r\nfunction getVirtualNodeKey(vNode: TagVirtualNode): DarkElementKey | null {\r\n const key = vNode && vNode.attrs[ATTR_KEY];\r\n\r\n return !detectIsEmpty(key) ? key : null;\r\n}\r\n\r\nconst createEmptyVirtualNode = () => new CommentVirtualNode(EMPTY_NODE);\r\n\r\nconst detectIsVirtualNodeFactory = (factory: unknown): factory is VirtualNodeFactory =>\r\n detectIsFunction(factory) && factory[$$virtualNode] === true;\r\n\r\nfunction View(def: ViewDef): TagVirtualNodeFactory {\r\n const factory = () => {\r\n const { as, slot, isVoid = false, ...rest } = def;\r\n const children = isVoid ? [] : detectIsArray(slot) ? slot : slot ? [slot] : [];\r\n\r\n return new TagVirtualNode({\r\n name: as,\r\n isVoid,\r\n attrs: { ...rest },\r\n children: children as Array,\r\n });\r\n };\r\n\r\n factory[$$virtualNode] = true;\r\n\r\n return factory;\r\n}\r\n\r\nfunction Text(source: string | StandardComponentProps['slot']): string | TextVirtualNode {\r\n const text = detectIsString(source)\r\n ? new TextVirtualNode(source)\r\n : detectIsTextVirtualNode(source)\r\n ? source.value\r\n : '';\r\n\r\n return text;\r\n}\r\n\r\nfunction Comment(text: string): CommentVirtualNodeFactory {\r\n const factory = () => new CommentVirtualNode(text);\r\n\r\n factory[$$virtualNode] = true;\r\n\r\n return factory;\r\n}\r\n\r\nexport {\r\n VirtualNode,\r\n TagVirtualNode,\r\n TextVirtualNode,\r\n CommentVirtualNode,\r\n detectIsVirtualNode,\r\n detectIsTagVirtualNode,\r\n detectIsCommentVirtualNode,\r\n detectIsTextVirtualNode,\r\n detectIsEmptyVirtualNode,\r\n getVirtualNodeKey,\r\n createEmptyVirtualNode,\r\n detectIsVirtualNodeFactory,\r\n View,\r\n Text,\r\n Comment,\r\n};\r\n","export * from './walk';\r\n","import { type Fiber } from '../fiber';\r\n\r\ntype WalkFiberOptions = {\r\n fiber: Fiber;\r\n onLoop: (options: OnLoopOptions) => void;\r\n};\r\n\r\ntype OnLoopOptions = {\r\n nextFiber: Fiber;\r\n isReturn: boolean;\r\n resetIsDeepWalking: () => void;\r\n stop: () => void;\r\n};\r\n\r\nfunction walkFiber(options: WalkFiberOptions) {\r\n const { fiber, onLoop } = options;\r\n let nextFiber = fiber;\r\n let isDeepWalking = true;\r\n let isReturn = false;\r\n let isStopped = false;\r\n const visitedMap = new Map();\r\n const detectCanVisit = (fiber: Fiber) => !visitedMap.get(fiber);\r\n\r\n while (nextFiber) {\r\n onLoop({\r\n nextFiber: nextFiber as Fiber,\r\n isReturn,\r\n resetIsDeepWalking: () => (isDeepWalking = false),\r\n stop: () => (isStopped = true),\r\n });\r\n\r\n if (isStopped) {\r\n break;\r\n }\r\n\r\n if (nextFiber.child && isDeepWalking && detectCanVisit(nextFiber.child)) {\r\n const newFiber = nextFiber.child;\r\n\r\n isReturn = false;\r\n nextFiber = newFiber;\r\n visitedMap.set(newFiber, true);\r\n } else if (nextFiber.nextSibling && detectCanVisit(nextFiber.nextSibling)) {\r\n const newFiber = nextFiber.nextSibling;\r\n\r\n isDeepWalking = true;\r\n isReturn = false;\r\n nextFiber = newFiber;\r\n visitedMap.set(newFiber, true);\r\n } else if (\r\n nextFiber.parent &&\r\n nextFiber.parent === fiber &&\r\n nextFiber.parent.nextSibling &&\r\n detectCanVisit(nextFiber.parent.nextSibling)\r\n ) {\r\n const newFiber = nextFiber.parent.nextSibling;\r\n\r\n isDeepWalking = true;\r\n isReturn = false;\r\n nextFiber = newFiber;\r\n visitedMap.set(newFiber, true);\r\n } else if (nextFiber.parent && nextFiber.parent !== fiber) {\r\n isDeepWalking = false;\r\n isReturn = true;\r\n nextFiber = nextFiber.parent;\r\n } else {\r\n nextFiber = null;\r\n }\r\n }\r\n}\r\n\r\nexport { walkFiber };\r\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export * from './component';\r\nexport * from './context';\r\nexport { createElement as h } from './element';\r\nexport * from './fiber';\r\nexport * from './fragment';\r\nexport * from './platform';\r\nexport * from './helpers';\r\nexport * from './lazy';\r\nexport * from './memo';\r\nexport * from './ref';\r\nexport * from './scope';\r\nexport * from './shared';\r\nexport * from './suspense';\r\nexport * from './use-callback';\r\nexport * from './use-context';\r\nexport * from './use-deferred-value';\r\nexport { useEffect } from './use-effect';\r\nexport * from './use-error';\r\nexport * from './use-event';\r\nexport * from './use-imperative-handle';\r\nexport { useLayoutEffect } from './use-layout-effect';\r\nexport * from './use-memo';\r\nexport * from './use-reducer';\r\nexport * from './use-ref';\r\nexport * from './use-state';\r\nexport * from './use-update';\r\nexport * from './view';\r\nexport * from './constants';\r\nexport { walkFiber } from './walk';\r\nexport { unmountRoot } from './unmount';\r\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/packages/core/umd/dark-core.production.min.js b/packages/core/umd/dark-core.production.min.js index da4bc715..26d3a5b0 100644 --- a/packages/core/umd/dark-core.production.min.js +++ b/packages/core/umd/dark-core.production.min.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("DarkCore",[],t):"object"==typeof exports?exports.DarkCore=t():e.DarkCore=t()}(self,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{$$memo:()=>Se,ATTR_KEY:()=>i,ATTR_REF:()=>a,Comment:()=>ve,CommentVirtualNode:()=>ae,ComponentFactory:()=>O,EMPTY_NODE:()=>o,EffectTag:()=>Ce,Fiber:()=>Ge,Fragment:()=>ge,NodeType:()=>I,PARTIAL_UPDATE:()=>l,ROOT:()=>r,Suspense:()=>Et,SuspenseContext:()=>xt,TagVirtualNode:()=>oe,TaskPriority:()=>n,Text:()=>pe,TextVirtualNode:()=>ie,View:()=>he,VirtualNode:()=>re,cloneTagMap:()=>Me,componentFiberHelper:()=>W,createComponent:()=>H,createContext:()=>pt,createEmptyVirtualNode:()=>ye,createHook:()=>ut,createUpdateCallback:()=>ct,currentRootHelper:()=>V,deletionsHelper:()=>B,detectIsArray:()=>v,detectIsBoolean:()=>p,detectIsCommentVirtualNode:()=>fe,detectIsComponentFactory:()=>P,detectIsDepsDifferent:()=>S,detectIsEmpty:()=>y,detectIsEmptyVirtualNode:()=>se,detectIsFragment:()=>xe,detectIsFunction:()=>u,detectIsLazy:()=>kt,detectIsMemo:()=>Te,detectIsNull:()=>h,detectIsNumber:()=>c,detectIsObject:()=>d,detectIsRef:()=>we,detectIsString:()=>s,detectIsTagVirtualNode:()=>ue,detectIsTextVirtualNode:()=>ce,detectIsUndefined:()=>f,detectIsVirtualNode:()=>le,detectIsVirtualNodeFactory:()=>be,dummyFn:()=>w,effectStoreHelper:()=>F,effectsHelper:()=>Y,error:()=>b,eventsHelper:()=>K,fiberMountHelper:()=>G,flatten:()=>m,forwardRef:()=>Ee,fromHookUpdateHelper:()=>_,getComponentFactoryKey:()=>N,getRootId:()=>L,getTime:()=>g,getVirtualNodeKey:()=>de,h:()=>bt,hasChildrenProp:()=>lt,keyBy:()=>x,layoutEffectsHelper:()=>z,lazy:()=>St,memo:()=>Oe,nextUnitOfWorkHelper:()=>R,platform:()=>je,takeListFromEnd:()=>E,unmountRoot:()=>Re,useCallback:()=>mt,useContext:()=>dt,useDeferredValue:()=>Tt,useEffect:()=>$,useError:()=>Ot,useEvent:()=>Pt,useImperativeHandle:()=>Nt,useLayoutEffect:()=>Le,useMemo:()=>Pe,useReducer:()=>Ct,useRef:()=>jt,useState:()=>gt,useUpdate:()=>st,walkFiber:()=>Ue,wipRootHelper:()=>U,workLoop:()=>Ye});var n,r="root",o="dark:matter",i="key",a="ref",l="partial-update";!function(e){e[e.HIGH=2]="HIGH",e[e.NORMAL=1]="NORMAL",e[e.LOW=0]="LOW"}(n||(n={}));var u=function(e){return"function"==typeof e},f=function(e){return void 0===e},c=function(e){return"number"==typeof e},s=function(e){return"string"==typeof e},d=function(e){return"object"==typeof e},p=function(e){return"boolean"==typeof e},v=function(e){return Array.isArray(e)},h=function(e){return null===e},y=function(e){return h(e)||f(e)};function b(e){!f(console)&&console.error(e)}function m(e){var t=[],n={0:{idx:0,source:e}},r=0;do{var o=n[r],i=o.source,a=o.idx,l=i[a];a>=i.length?n[--r].idx++:v(l)?n[++r]={idx:0,source:l}:(t.push(l),n[r].idx++)}while(r>0||n[r].idx0&&t.length>0)for(var n=0;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(o),a=i.next();!a.done;a=i.next()){var l=a.value;if(l.token===e){var f=l.value;u(f)&&f()}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}}}!function(e){e.TAG="TAG",e.TEXT="TEXT",e.COMMENT="COMMENT"}(I||(I={}));var Z,ee=(Z=function(e,t){return Z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Z(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Z(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),te=function(){return te=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(o),a=i.next();!a.done;a=i.next()){var l=a.value;if("slot"!==l&&t[l]!==e[l])return!0}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1},Te=function(e){return P(e)&&e.token===Se};function Oe(e,t){return void 0===t&&(t=ke),Ee(H((function(t,n){return n&&(t.ref=n),e(t)}),{token:Se,shouldUpdate:t}))}var He=H((function(e){return e.slot}),{token:Se});function Ie(e,t){return void 0===t&&(t=!1),function(e,t){var n=function(e){return be(e)||P(e)};if(v(e)?n(e[0]):n(e)){var r=He({slot:ge({slot:e})});return r.shouldUpdate=function(){return t},r}return e}(e(),t)}function Pe(e,t){var n=W.get().hook,r=n.idx,o=n.values;if(f(o[r])){var i=Ie(e);return o[r]={deps:t,value:i},n.idx++,i}var a=o[r],l=S(t,a.deps),u=l?e:function(){return a.value};return a.deps=t,a.value=Ie(u,l),n.idx++,a.value}var Ne,Ce,je={scheduleCallback:function(){throw new Error("scheduleCallback not installed by renderer")},shouldYeildToHost:function(){throw new Error("shouldYeildToHost not installed by renderer")},createNativeElement:function(){throw new Error("createNativeElement not installed by renderer")},applyCommit:function(){throw new Error("applyCommit not installed by renderer")},finishCommitWork:function(){throw new Error("finishCommitWork not installed by renderer")},detectIsPortal:function(){throw new Error("detectIsPortal not installed by renderer")},unmountPortal:function(){throw new Error("unmountPortal not installed by renderer")}};!function(e){e.PLACEMENT="PLACEMENT",e.UPDATE="UPDATE",e.DELETION="DELETION",e.SKIP="SKIP"}(Ce||(Ce={}));var Me=((Ne={})[Ce.PLACEMENT]=!0,Ne[Ce.SKIP]=!0,Ne),Fe=Q(Symbol("use-layout-effect"),z),Le=Fe.useEffect,Ae=Fe.hasEffects,De=Fe.dropEffects;function Ue(e){for(var t=e.fiber,n=e.onLoop,r=t,o=!0,i=!1,a=!1,l=new Map,u=function(e){return!l.get(e)};r&&(n({nextFiber:r,isReturn:i,resetIsDeepWalking:function(){return o=!1},stop:function(){return a=!0}}),!a);)if(r.child&&o&&u(r.child))i=!1,r=f=r.child,l.set(f,!0);else if(r.nextSibling&&u(r.nextSibling)){var f=r.nextSibling;o=!0,i=!1,r=f,l.set(f,!0)}else r.parent&&r.parent===t&&r.parent.nextSibling&&u(r.parent.nextSibling)?(f=r.parent.nextSibling,o=!0,i=!1,r=f,l.set(f,!0)):r.parent&&r.parent!==t?(o=!1,i=!0,r=r.parent):r=null}function Ve(e){(e.effectHost||e.layoutEffectHost||e.portalHost)&&Ue({fiber:e,onLoop:function(t){var n=t.nextFiber,r=t.isReturn,o=t.stop;if(n===e.nextSibling||e.transposition)return o();!r&&P(n.instance)&&(n.layoutEffectHost&&De(n.hook),n.effectHost&&J(n.hook),n.portalHost&&je.unmountPortal(n))}})}function Re(e,t){f(e)||(Ve(V.get(e)),K.mapUnsubscribers(e),F.remove(e),t())}var We=function(){return We=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},Ke=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ge=function(){function e(e){this.nativeElement=e.nativeElement||null,this.parent=e.parent||null,this.child=e.child||null,this.nextSibling=e.nextSibling||null,this.alternate=e.alternate||null,this.effectTag=e.effectTag||null,this.instance=e.instance||null,this.hook=e.hook||{idx:0,values:[]},this.shadow=e.shadow||null,this.provider=e.provider||null,this.transposition=!f(e.transposition)&&e.transposition,this.mountedToHost=!f(e.mountedToHost)||!1,this.portalHost=!f(e.portalHost)&&e.portalHost,this.effectHost=!f(e.effectHost)&&e.effectHost,this.layoutEffectHost=!f(e.layoutEffectHost)&&e.layoutEffectHost,this.childrenCount=e.childrenCount||0,this.marker=e.marker||"",this.idx=e.idx||0,this.isUsed=e.isUsed||!1}return e.prototype.markPortalHost=function(){this.portalHost=!0,this.parent&&!this.parent.portalHost&&this.parent.markPortalHost()},e.prototype.markEffectHost=function(){this.effectHost=!0,this.parent&&!this.parent.effectHost&&this.parent.markEffectHost()},e.prototype.markLayoutEffectHost=function(){this.layoutEffectHost=!0,this.parent&&!this.parent.layoutEffectHost&&this.parent.markLayoutEffectHost()},e.prototype.markMountedToHost=function(){this.mountedToHost=!0,this.parent&&!this.parent.mountedToHost&&this.parent.markMountedToHost()},e.prototype.setError=function(e){"function"==typeof this.catchException?this.catchException(e):this.parent&&this.parent.setError(e)},e}();function Ye(){for(var e=U.get(),t=R.get(),n=!1,r=Boolean(t);t&&!n;)t=ze(t),R.set(t),r=Boolean(t),n=je.shouldYeildToHost();return!t&&e&&function(){var e=U.get(),t=_.get();!function(n,r){var o,i,a=B.get();try{for(var l=Be(a),u=l.next();!u.done;u=l.next()){var f=u.value;Ve(f),je.applyCommit(f)}}catch(e){o={error:e}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}Ue({fiber:n,onLoop:function(e){var t=e.nextFiber,n=e.isReturn,r=e.resetIsDeepWalking;t.effectTag===Ce.SKIP?r():n||je.applyCommit(t),t&&t.shadow&&(t.shadow=null)}}),je.finishCommitWork(),B.set([]),function(){var n,r,o=z.get(),i=Y.get();U.set(null);try{for(var a=Be(o),l=a.next();!l.done;l=a.next())(0,l.value)()}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}setTimeout((function(){var e,t;try{for(var n=Be(i),r=n.next();!r.done;r=n.next())(0,r.value)()}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}})),z.reset(),Y.reset(),t?_.set(!1):V.set(e)}()}(e.child)}(),r}function ze(e){for(var t=!0,n=e,r=e.shadow,o=e.instance;;){if(t=G.deepWalking.get(),n.hook.idx=0,t)if(lt(o)&&o.children.length>0){var i=$e({nextFiber:n,shadow:r,instance:o}),a=i.performedFiber;if(n=i.performedNextFiber,r=i.performedShadow,o=i.performedInstance,a)return a}else{var l=qe({nextFiber:n,shadow:r,instance:o});if(a=l.performedFiber,n=l.performedNextFiber,r=l.performedShadow,o=l.performedInstance,a)return a}else{var u=qe({nextFiber:n,shadow:r,instance:o});if(a=u.performedFiber,n=u.performedNextFiber,r=u.performedShadow,o=u.performedInstance,a)return a}if(Xe(n),null===n.parent)return null}}function Xe(e){var t,n;if(e.marker===l){var r=(null===(n=e.child)||void 0===n?void 0:n.alternate)||null,o=e.child||null;if(r&&o&&r.nextSibling&&!o.nextSibling){for(var i=r.nextSibling,a=[];i;)i.effectTag=Ce.DELETION,a.push(i),i=i.nextSibling;(t=B.get()).push.apply(t,Ke([],_e(a),!1))}}}function $e(e){G.jumpToChild();var t=e.nextFiber,n=e.shadow,r=e.instance;n=n?n.child:null;var o=function(e){for(var t=e.alternate&&e.alternate.effectTag!==Ce.DELETION?e.alternate.child:null;t&&t.effectTag===Ce.DELETION;)t=t.nextSibling;return t}(t),i=ft({shadow:n,alternate:o,instance:r}),a=n?n.provider:o?o.provider:null,l=new Ge({hook:i,provider:a});W.set(l),l.parent=t;var u=et({instance:r,idx:0,fiber:l,alternate:o});return r=u.performedInstance||r,n=u.performedShadow||n,o&&Qe({alternate:o,instance:r}),Je({fiber:l,alternate:o,instance:r}),(l=o?Ze({fiber:l,alternate:o,instance:r}):l).idx=0,t.child=l,l.parent=t,l.shadow=n,t=l,Me[l.parent.effectTag]&&(l.effectTag=l.parent.effectTag),{performedFiber:t,performedNextFiber:t,performedShadow:n,performedInstance:r}}function qe(e){G.jumpToSibling();var t=e.nextFiber,n=e.shadow,r=e.instance,o=t.parent.instance,i=G.getIndex();if(lt(o)&&o.children[i]){G.deepWalking.set(!0),n=n?n.nextSibling:null;var a=function(e){for(var t,n=(null===(t=e.alternate)||void 0===t?void 0:t.nextSibling)||null;n&&n.effectTag===Ce.DELETION;)n=n.nextSibling;return n}(t),l=ft({shadow:n,alternate:a,instance:r}),u=n?n.provider:a?a.provider:null,f=new Ge({hook:l,provider:u});W.set(f),f.parent=t.parent;var c=et({instance:o,idx:i,fiber:f,alternate:a});return r=c.performedInstance||r,n=c.performedShadow||n,a&&Qe({alternate:a,instance:r}),Je({fiber:f,alternate:a,instance:r}),(f=a?Ze({fiber:f,alternate:a,instance:r}):f).idx=i,f.parent=t.parent,t.nextSibling=f,f.shadow=n,t=f,Me[f.parent.effectTag]&&(f.effectTag=f.parent.effectTag),{performedFiber:t,performedNextFiber:t,performedShadow:n,performedInstance:r}}return G.jumpToParent(),G.deepWalking.set(!1),n=n?n.parent:null,r=(t=t.parent).instance,lt(t.instance)&&(t.instance.children=[]),{performedFiber:null,performedNextFiber:t,performedShadow:n,performedInstance:r}}function Je(e){var t=e.fiber,n=e.alternate,r=e.instance,o=(n?rt(n.instance):null)!==(n?rt(r):null),i=Boolean(n)&&at(n.instance)===at(r)&&!o;t.instance=r,t.alternate=n||null,t.nativeElement=i?n.nativeElement:null,t.effectTag=i?Ce.UPDATE:Ce.PLACEMENT,t.mountedToHost=i,lt(t.instance)&&(t.childrenCount=t.instance.children.length),t.alternate&&(t.alternate.shadow=null,t.alternate.alternate=null),!t.nativeElement&&le(t.instance)&&(t.nativeElement=je.createNativeElement(t))}function Qe(e){var t=e.alternate,n=e.instance,r=at(t.instance),o=at(n)===r,i=rt(t.instance)===rt(n);if(t.isUsed=!0,o&&i){if(lt(t.instance)&<(n)){var a=t.childrenCount,l=n.children.length;if(a!==l){var u=lt(n)?n.children:[],f=function(e,t){for(var n=e,r=0,o=[],i=[];n||r0){var f=function(e){for(var t=e,n={};t;){var r=rt(t.instance);y(r)||(n[r]=t),t=t.nextSibling}return n}(t.child);try{for(var d=Be(u),p=d.next();!p.done;p=d.next())(g=f[p.value]||null)&&(g.effectTag=Ce.DELETION,B.get().push(g))}catch(t){e={error:t}}finally{try{p&&!p.done&&(n=d.return)&&n.call(d)}finally{if(e)throw e.error}}}else{var v=a-l;if(0===v)return;var h=E(function(e){for(var t=[],n=e;n;)t.push(n),n=n.nextSibling;return t}(t.child),v);try{for(var b=Be(h),m=b.next();!m.done;m=b.next()){var g;(g=m.value).effectTag=Ce.DELETION}}catch(e){r={error:e}}finally{try{m&&!m.done&&(o=b.return)&&o.call(b)}finally{if(r)throw r.error}}(i=B.get()).push.apply(i,Ke([],_e(h),!1))}}(),function(){var e,n,r=ot(s,c);if(0!==r.length){var o=x(r,(function(e){return e})),i={},a=0;try{for(var l=Be(s),u=l.next();!u.done;u=l.next()){var f=u.value;if(i[f]=!0,f!==c[a]&&o[f]){var d=new Ge({instance:ye(),parent:t,effectTag:Ce.PLACEMENT});if(0===a)d.nextSibling=t.child,t.child=d;else{var p=_e(nt(t.child,a),2),v=p[0],h=p[1];v&&h&&(d.nextSibling=v,h.nextSibling=d)}}a++}}catch(t){e={error:t}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(e)throw e.error}}}}()}}}else t.effectTag=Ce.DELETION,B.get().push(t)}function Ze(e){var t=e.fiber,n=e.alternate,r=e.instance;if(Te(t.instance)){var o=null,i=r,a=n.instance;if(i.type!==a.type)return t;var l=a.props,u=i.props;if(!i.shouldUpdate(l,u)){var f=null;for(G.deepWalking.set(!1),o=new Ge(We(We({},n),{alternate:n,effectTag:Ce.SKIP,nextSibling:n.nextSibling?n.nextSibling.effectTag===Ce.DELETION?null:n.nextSibling:null})),n.alternate=null,f=o.child;f;)f.parent=o,f=f.nextSibling;return o.effectHost&&t.markEffectHost(),o.layoutEffectHost&&t.markLayoutEffectHost(),o.mountedToHost&&t.markMountedToHost(),o.portalHost&&t.markPortalHost(),o}}return t}function et(e){var t,n=e.instance,r=e.idx,o=e.fiber,i=e.alternate,a=null,l=null;if(lt(n)){var u=v(n.children[r])?m([n.children[r]]):[n.children[r]];(t=n.children).splice.apply(t,Ke([r,1],_e(u),!1)),a=n.children[r],l=i?function(e){var t=e.instance,n=e.fiber,r=e.alternate,o=rt(r.instance),i=rt(t),a=null;return o!==i&&(a=function(e,t){if(y(e))return null;for(var n=t;n;){if(e===rt(n.instance))return n;n=n.nextSibling}return null}(i,r.parent.child),a&&(n.hook=a.hook,n.provider=a.provider,r.transposition=!0)),a}({instance:a,fiber:o,alternate:i}):l,a=tt(o,a)}return P(a)&&(q(o)&&o.markEffectHost(),Ae(o)&&o.markLayoutEffectHost(),je.detectIsPortal(a)&&o.markPortalHost()),{performedInstance:a,performedShadow:l}}function tt(e,t){var n=P(t),r=t;if(n)try{var o=r.type(r.props,r.ref);r.children=v(o)?m([o]):[o]}catch(t){r.children=[],e.setError(t),b(t)}else be(t)&&(t=t());if(lt(t)){for(var i=0;i=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(l.subscribers),r=n.next();!r.done;r=n.next())(0,r.value)(o)}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}}),[o]),l.value=o,i}),{displayName:"".concat(n,".Provider")})}(e,t,n),e.Consumer=function(e,t){return H((function(t){var n=t.slot,r=dt(e);return u(n)?n(r):null}),{displayName:"".concat(t,".Consumer")})}(e,n)}var ht=function(){return ht=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}(e),!1):[e]:[]}function bt(e,t){for(var n=[],r=2;r0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}(gt(!1),2),i=o[0],a=o[1],l=mt((function(){return a(!0)}),[]),u=Pe((function(){return{fallback:t,isLoaded:i,trigger:l}}),[t,i]);return xt.Provider({value:u,slot:r?n:null})})),wt=Symbol("lazy");function St(e){return Ee(H((function(t,n){var r=dt(xt),o=r.fallback,i=r.trigger,a=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}(gt({component:null}),2),l=a[0],u=a[1];return $((function(){(function(e){return new Promise((function(t){e().then((function(e){if(!e.default)throw new Error("[Dark]: lazy loaded component should be exported as default!");t(e.default)}))}))})(e).then((function(e){u({component:e})}))}),[]),$((function(){l.component&&i()}),[l.component]),l.component?l.component(t,n):o}),{token:wt}))}var kt=function(e){return P(e)&&e.token===wt};function Tt(e,t){var r=(t||{}).timeoutMs,o=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}(gt(e,{priority:n.LOW,timeoutMs:r}),2),i=o[0],a=o[1];return $((function(){a(e)}),[e]),i}function Ot(){var e=W.get(),t=st(),n=Pe((function(){return{error:null}}),[]);return e.catchException=function(e){n.error=e,t()},$((function(){n.error=null}),[n.error]),n.error}var Ht=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},It=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}(gt(Pe((function(){return u(n)?n(t):t}),[])),2),o=r[0],i=r[1],a=mt((function(t){return i((function(n){return e(n,t)}))}),[]);return[o,a]}function jt(e){return void 0===e&&(e=null),Pe((function(){return{current:e}}),[])}return t})())); +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("DarkCore",[],t):"object"==typeof exports?exports.DarkCore=t():e.DarkCore=t()}(self,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{$$memo:()=>Se,ATTR_KEY:()=>i,ATTR_REF:()=>a,Comment:()=>be,CommentVirtualNode:()=>ae,ComponentFactory:()=>O,EMPTY_NODE:()=>o,EffectTag:()=>Ce,Fiber:()=>Ge,Fragment:()=>ge,NodeType:()=>I,PARTIAL_UPDATE:()=>l,ROOT:()=>r,Suspense:()=>Et,SuspenseContext:()=>xt,TagVirtualNode:()=>oe,TaskPriority:()=>n,Text:()=>ye,TextVirtualNode:()=>ie,View:()=>he,VirtualNode:()=>re,cloneTagMap:()=>Me,componentFiberHelper:()=>W,createComponent:()=>H,createContext:()=>pt,createEmptyVirtualNode:()=>pe,createHook:()=>ut,createUpdateCallback:()=>ct,currentRootHelper:()=>V,deletionsHelper:()=>B,detectIsArray:()=>v,detectIsBoolean:()=>p,detectIsCommentVirtualNode:()=>fe,detectIsComponentFactory:()=>P,detectIsDepsDifferent:()=>S,detectIsEmpty:()=>y,detectIsEmptyVirtualNode:()=>se,detectIsFragment:()=>xe,detectIsFunction:()=>u,detectIsLazy:()=>kt,detectIsMemo:()=>Te,detectIsNull:()=>h,detectIsNumber:()=>c,detectIsObject:()=>d,detectIsRef:()=>we,detectIsString:()=>s,detectIsTagVirtualNode:()=>ue,detectIsTextVirtualNode:()=>ce,detectIsUndefined:()=>f,detectIsVirtualNode:()=>le,detectIsVirtualNodeFactory:()=>ve,dummyFn:()=>w,effectStoreHelper:()=>F,effectsHelper:()=>Y,error:()=>b,eventsHelper:()=>K,fiberMountHelper:()=>G,flatten:()=>m,forwardRef:()=>Ee,fromHookUpdateHelper:()=>_,getComponentFactoryKey:()=>N,getRootId:()=>L,getTime:()=>g,getVirtualNodeKey:()=>de,h:()=>bt,hasChildrenProp:()=>lt,keyBy:()=>x,layoutEffectsHelper:()=>z,lazy:()=>St,memo:()=>Oe,nextUnitOfWorkHelper:()=>R,platform:()=>je,takeListFromEnd:()=>E,unmountRoot:()=>Re,useCallback:()=>mt,useContext:()=>dt,useDeferredValue:()=>Tt,useEffect:()=>$,useError:()=>Ot,useEvent:()=>Pt,useImperativeHandle:()=>Nt,useLayoutEffect:()=>Le,useMemo:()=>Pe,useReducer:()=>Ct,useRef:()=>jt,useState:()=>gt,useUpdate:()=>st,walkFiber:()=>Ue,wipRootHelper:()=>U,workLoop:()=>Ye});var n,r="root",o="dark:matter",i="key",a="ref",l="partial-update";!function(e){e[e.HIGH=2]="HIGH",e[e.NORMAL=1]="NORMAL",e[e.LOW=0]="LOW"}(n||(n={}));var u=function(e){return"function"==typeof e},f=function(e){return void 0===e},c=function(e){return"number"==typeof e},s=function(e){return"string"==typeof e},d=function(e){return"object"==typeof e},p=function(e){return"boolean"==typeof e},v=function(e){return Array.isArray(e)},h=function(e){return null===e},y=function(e){return h(e)||f(e)};function b(e){!f(console)&&console.error(e)}function m(e){var t=[],n={0:{idx:0,source:e}},r=0;do{var o=n[r],i=o.source,a=o.idx,l=i[a];a>=i.length?n[--r].idx++:v(l)?n[++r]={idx:0,source:l}:(t.push(l),n[r].idx++)}while(r>0||n[r].idx0&&t.length>0)for(var n=0;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(o),a=i.next();!a.done;a=i.next()){var l=a.value;if(l.token===e){var f=l.value;u(f)&&f()}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}}}!function(e){e.TAG="TAG",e.TEXT="TEXT",e.COMMENT="COMMENT"}(I||(I={}));var Z,ee=(Z=function(e,t){return Z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Z(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Z(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),te=function(){return te=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(o),a=i.next();!a.done;a=i.next()){var l=a.value;if("slot"!==l&&t[l]!==e[l])return!0}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1},Te=function(e){return P(e)&&e.token===Se};function Oe(e,t){return void 0===t&&(t=ke),Ee(H((function(t,n){return n&&(t.ref=n),e(t)}),{token:Se,shouldUpdate:t}))}var He=H((function(e){return e.slot}),{token:Se});function Ie(e,t){return void 0===t&&(t=!1),function(e,t){var n=function(e){return ve(e)||P(e)};if(v(e)?n(e[0]):n(e)){var r=He({slot:ge({slot:e})});return r.shouldUpdate=function(){return t},r}return e}(e(),t)}function Pe(e,t){var n=W.get().hook,r=n.idx,o=n.values;if(f(o[r])){var i=Ie(e);return o[r]={deps:t,value:i},n.idx++,i}var a=o[r],l=S(t,a.deps),u=l?e:function(){return a.value};return a.deps=t,a.value=Ie(u,l),n.idx++,a.value}var Ne,Ce,je={scheduleCallback:function(){throw new Error("scheduleCallback not installed by renderer")},shouldYeildToHost:function(){throw new Error("shouldYeildToHost not installed by renderer")},createNativeElement:function(){throw new Error("createNativeElement not installed by renderer")},applyCommit:function(){throw new Error("applyCommit not installed by renderer")},finishCommitWork:function(){throw new Error("finishCommitWork not installed by renderer")},detectIsPortal:function(){throw new Error("detectIsPortal not installed by renderer")},unmountPortal:function(){throw new Error("unmountPortal not installed by renderer")}};!function(e){e.PLACEMENT="PLACEMENT",e.UPDATE="UPDATE",e.DELETION="DELETION",e.SKIP="SKIP"}(Ce||(Ce={}));var Me=((Ne={})[Ce.PLACEMENT]=!0,Ne[Ce.SKIP]=!0,Ne),Fe=Q(Symbol("use-layout-effect"),z),Le=Fe.useEffect,Ae=Fe.hasEffects,De=Fe.dropEffects;function Ue(e){for(var t=e.fiber,n=e.onLoop,r=t,o=!0,i=!1,a=!1,l=new Map,u=function(e){return!l.get(e)};r&&(n({nextFiber:r,isReturn:i,resetIsDeepWalking:function(){return o=!1},stop:function(){return a=!0}}),!a);)if(r.child&&o&&u(r.child))i=!1,r=f=r.child,l.set(f,!0);else if(r.nextSibling&&u(r.nextSibling)){var f=r.nextSibling;o=!0,i=!1,r=f,l.set(f,!0)}else r.parent&&r.parent===t&&r.parent.nextSibling&&u(r.parent.nextSibling)?(f=r.parent.nextSibling,o=!0,i=!1,r=f,l.set(f,!0)):r.parent&&r.parent!==t?(o=!1,i=!0,r=r.parent):r=null}function Ve(e){(e.effectHost||e.layoutEffectHost||e.portalHost)&&Ue({fiber:e,onLoop:function(t){var n=t.nextFiber,r=t.isReturn,o=t.stop;if(n===e.nextSibling||e.transposition)return o();!r&&P(n.instance)&&(n.layoutEffectHost&&De(n.hook),n.effectHost&&J(n.hook),n.portalHost&&je.unmountPortal(n))}})}function Re(e,t){f(e)||(Ve(V.get(e)),K.mapUnsubscribers(e),F.remove(e),t())}var We=function(){return We=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},Ke=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ge=function(){function e(e){this.nativeElement=e.nativeElement||null,this.parent=e.parent||null,this.child=e.child||null,this.nextSibling=e.nextSibling||null,this.alternate=e.alternate||null,this.effectTag=e.effectTag||null,this.instance=e.instance||null,this.hook=e.hook||{idx:0,values:[]},this.shadow=e.shadow||null,this.provider=e.provider||null,this.transposition=!f(e.transposition)&&e.transposition,this.mountedToHost=!f(e.mountedToHost)||!1,this.portalHost=!f(e.portalHost)&&e.portalHost,this.effectHost=!f(e.effectHost)&&e.effectHost,this.layoutEffectHost=!f(e.layoutEffectHost)&&e.layoutEffectHost,this.childrenCount=e.childrenCount||0,this.marker=e.marker||"",this.idx=e.idx||0,this.isUsed=e.isUsed||!1}return e.prototype.markPortalHost=function(){this.portalHost=!0,this.parent&&!this.parent.portalHost&&this.parent.markPortalHost()},e.prototype.markEffectHost=function(){this.effectHost=!0,this.parent&&!this.parent.effectHost&&this.parent.markEffectHost()},e.prototype.markLayoutEffectHost=function(){this.layoutEffectHost=!0,this.parent&&!this.parent.layoutEffectHost&&this.parent.markLayoutEffectHost()},e.prototype.markMountedToHost=function(){this.mountedToHost=!0,this.parent&&!this.parent.mountedToHost&&this.parent.markMountedToHost()},e.prototype.setError=function(e){"function"==typeof this.catchException?this.catchException(e):this.parent&&this.parent.setError(e)},e}();function Ye(){for(var e=U.get(),t=R.get(),n=!1,r=Boolean(t);t&&!n;)t=ze(t),R.set(t),r=Boolean(t),n=je.shouldYeildToHost();return!t&&e&&function(){var e=U.get(),t=_.get();!function(n,r){var o,i,a=B.get();try{for(var l=Be(a),u=l.next();!u.done;u=l.next()){var f=u.value;Ve(f),je.applyCommit(f)}}catch(e){o={error:e}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}Ue({fiber:n,onLoop:function(e){var t=e.nextFiber,n=e.isReturn,r=e.resetIsDeepWalking;t.effectTag===Ce.SKIP?r():n||je.applyCommit(t),t&&t.shadow&&(t.shadow=null)}}),je.finishCommitWork(),B.set([]),function(){var n,r,o=z.get(),i=Y.get();U.set(null);try{for(var a=Be(o),l=a.next();!l.done;l=a.next())(0,l.value)()}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}setTimeout((function(){var e,t;try{for(var n=Be(i),r=n.next();!r.done;r=n.next())(0,r.value)()}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}})),z.reset(),Y.reset(),t?_.set(!1):V.set(e)}()}(e.child)}(),r}function ze(e){for(var t=!0,n=e,r=e.shadow,o=e.instance;;){if(t=G.deepWalking.get(),n.hook.idx=0,t)if(lt(o)&&o.children.length>0){var i=$e({nextFiber:n,shadow:r,instance:o}),a=i.performedFiber;if(n=i.performedNextFiber,r=i.performedShadow,o=i.performedInstance,a)return a}else{var l=qe({nextFiber:n,shadow:r,instance:o});if(a=l.performedFiber,n=l.performedNextFiber,r=l.performedShadow,o=l.performedInstance,a)return a}else{var u=qe({nextFiber:n,shadow:r,instance:o});if(a=u.performedFiber,n=u.performedNextFiber,r=u.performedShadow,o=u.performedInstance,a)return a}if(Xe(n),null===n.parent)return null}}function Xe(e){var t,n;if(e.marker===l){var r=(null===(n=e.child)||void 0===n?void 0:n.alternate)||null,o=e.child||null;if(r&&o&&r.nextSibling&&!o.nextSibling){for(var i=r.nextSibling,a=[];i;)i.effectTag=Ce.DELETION,a.push(i),i=i.nextSibling;(t=B.get()).push.apply(t,Ke([],_e(a),!1))}}}function $e(e){G.jumpToChild();var t=e.nextFiber,n=e.shadow,r=e.instance;n=n?n.child:null;var o=function(e){for(var t=e.alternate&&e.alternate.effectTag!==Ce.DELETION?e.alternate.child:null;t&&t.effectTag===Ce.DELETION;)t=t.nextSibling;return t}(t),i=ft({shadow:n,alternate:o,instance:r}),a=n?n.provider:o?o.provider:null,l=new Ge({hook:i,provider:a});W.set(l),l.parent=t;var u=et({instance:r,idx:0,fiber:l,alternate:o});return r=u.performedInstance||r,n=u.performedShadow||n,o&&Qe({alternate:o,instance:r}),Je({fiber:l,alternate:o,instance:r}),(l=o?Ze({fiber:l,alternate:o,instance:r}):l).idx=0,t.child=l,l.parent=t,l.shadow=n,t=l,Me[l.parent.effectTag]&&(l.effectTag=l.parent.effectTag),{performedFiber:t,performedNextFiber:t,performedShadow:n,performedInstance:r}}function qe(e){G.jumpToSibling();var t=e.nextFiber,n=e.shadow,r=e.instance,o=t.parent.instance,i=G.getIndex();if(lt(o)&&o.children[i]){G.deepWalking.set(!0),n=n?n.nextSibling:null;var a=function(e){for(var t,n=(null===(t=e.alternate)||void 0===t?void 0:t.nextSibling)||null;n&&n.effectTag===Ce.DELETION;)n=n.nextSibling;return n}(t),l=ft({shadow:n,alternate:a,instance:r}),u=n?n.provider:a?a.provider:null,f=new Ge({hook:l,provider:u});W.set(f),f.parent=t.parent;var c=et({instance:o,idx:i,fiber:f,alternate:a});return r=c.performedInstance||r,n=c.performedShadow||n,a&&Qe({alternate:a,instance:r}),Je({fiber:f,alternate:a,instance:r}),(f=a?Ze({fiber:f,alternate:a,instance:r}):f).idx=i,f.parent=t.parent,t.nextSibling=f,f.shadow=n,t=f,Me[f.parent.effectTag]&&(f.effectTag=f.parent.effectTag),{performedFiber:t,performedNextFiber:t,performedShadow:n,performedInstance:r}}return G.jumpToParent(),G.deepWalking.set(!1),n=n?n.parent:null,r=(t=t.parent).instance,lt(t.instance)&&(t.instance.children=[]),{performedFiber:null,performedNextFiber:t,performedShadow:n,performedInstance:r}}function Je(e){var t=e.fiber,n=e.alternate,r=e.instance,o=(n?rt(n.instance):null)!==(n?rt(r):null),i=Boolean(n)&&at(n.instance)===at(r)&&!o;t.instance=r,t.alternate=n||null,t.nativeElement=i?n.nativeElement:null,t.effectTag=i?Ce.UPDATE:Ce.PLACEMENT,t.mountedToHost=i,lt(t.instance)&&(t.childrenCount=t.instance.children.length),t.alternate&&(t.alternate.shadow=null,t.alternate.alternate=null),!t.nativeElement&&le(t.instance)&&(t.nativeElement=je.createNativeElement(t.instance))}function Qe(e){var t=e.alternate,n=e.instance,r=at(t.instance),o=at(n)===r,i=rt(t.instance)===rt(n);if(t.isUsed=!0,o&&i){if(lt(t.instance)&<(n)){var a=t.childrenCount,l=n.children.length;if(a!==l){var u=lt(n)?n.children:[],f=function(e,t){for(var n=e,r=0,o=[],i=[];n||r0){var f=function(e){for(var t=e,n={};t;){var r=rt(t.instance);y(r)||(n[r]=t),t=t.nextSibling}return n}(t.child);try{for(var d=Be(u),p=d.next();!p.done;p=d.next())(g=f[p.value]||null)&&(g.effectTag=Ce.DELETION,B.get().push(g))}catch(t){e={error:t}}finally{try{p&&!p.done&&(n=d.return)&&n.call(d)}finally{if(e)throw e.error}}}else{var v=a-l;if(0===v)return;var h=E(function(e){for(var t=[],n=e;n;)t.push(n),n=n.nextSibling;return t}(t.child),v);try{for(var b=Be(h),m=b.next();!m.done;m=b.next()){var g;(g=m.value).effectTag=Ce.DELETION}}catch(e){r={error:e}}finally{try{m&&!m.done&&(o=b.return)&&o.call(b)}finally{if(r)throw r.error}}(i=B.get()).push.apply(i,Ke([],_e(h),!1))}}(),function(){var e,n,r=ot(s,c);if(0!==r.length){var o=x(r,(function(e){return e})),i={},a=0;try{for(var l=Be(s),u=l.next();!u.done;u=l.next()){var f=u.value;if(i[f]=!0,f!==c[a]&&o[f]){var d=new Ge({instance:pe(),parent:t,effectTag:Ce.PLACEMENT});if(0===a)d.nextSibling=t.child,t.child=d;else{var p=_e(nt(t.child,a),2),v=p[0],h=p[1];v&&h&&(d.nextSibling=v,h.nextSibling=d)}}a++}}catch(t){e={error:t}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(e)throw e.error}}}}()}}}else t.effectTag=Ce.DELETION,B.get().push(t)}function Ze(e){var t=e.fiber,n=e.alternate,r=e.instance;if(Te(t.instance)){var o=null,i=r,a=n.instance;if(i.type!==a.type)return t;var l=a.props,u=i.props;if(!i.shouldUpdate(l,u)){var f=null;for(G.deepWalking.set(!1),o=new Ge(We(We({},n),{alternate:n,effectTag:Ce.SKIP,nextSibling:n.nextSibling?n.nextSibling.effectTag===Ce.DELETION?null:n.nextSibling:null})),n.alternate=null,f=o.child;f;)f.parent=o,f=f.nextSibling;return o.effectHost&&t.markEffectHost(),o.layoutEffectHost&&t.markLayoutEffectHost(),o.mountedToHost&&t.markMountedToHost(),o.portalHost&&t.markPortalHost(),o}}return t}function et(e){var t,n=e.instance,r=e.idx,o=e.fiber,i=e.alternate,a=null,l=null;if(lt(n)){var u=v(n.children[r])?m([n.children[r]]):[n.children[r]];(t=n.children).splice.apply(t,Ke([r,1],_e(u),!1)),a=n.children[r],l=i?function(e){var t=e.instance,n=e.fiber,r=e.alternate,o=rt(r.instance),i=rt(t),a=null;return o!==i&&(a=function(e,t){if(y(e))return null;for(var n=t;n;){if(e===rt(n.instance))return n;n=n.nextSibling}return null}(i,r.parent.child),a&&(n.hook=a.hook,n.provider=a.provider,r.transposition=!0)),a}({instance:a,fiber:o,alternate:i}):l,a=tt(o,a)}return P(a)&&(q(o)&&o.markEffectHost(),Ae(o)&&o.markLayoutEffectHost(),je.detectIsPortal(a)&&o.markPortalHost()),{performedInstance:a,performedShadow:l}}function tt(e,t){var n=P(t),r=t;if(n)try{var o=r.type(r.props,r.ref);r.children=v(o)?m([o]):[o]}catch(t){r.children=[],e.setError(t),b(t)}else ve(t)&&(t=t());if(lt(t)){for(var i=0;i=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(l.subscribers),r=n.next();!r.done;r=n.next())(0,r.value)(o)}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}}),[o]),l.value=o,i}),{displayName:"".concat(n,".Provider")})}(e,t,n),e.Consumer=function(e,t){return H((function(t){var n=t.slot,r=dt(e);return u(n)?n(r):null}),{displayName:"".concat(t,".Consumer")})}(e,n)}var ht=function(){return ht=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}(e),!1):[e]:[]}function bt(e,t){for(var n=[],r=2;r0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}(gt(!1),2),i=o[0],a=o[1],l=mt((function(){return a(!0)}),[]),u=Pe((function(){return{fallback:t,isLoaded:i,trigger:l}}),[t,i]);return xt.Provider({value:u,slot:r?n:null})})),wt=Symbol("lazy");function St(e){return Ee(H((function(t,n){var r=dt(xt),o=r.fallback,i=r.trigger,a=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}(gt({component:null}),2),l=a[0],u=a[1];return $((function(){(function(e){return new Promise((function(t){e().then((function(e){if(!e.default)throw new Error("[Dark]: lazy loaded component should be exported as default!");t(e.default)}))}))})(e).then((function(e){u({component:e})}))}),[]),$((function(){l.component&&i()}),[l.component]),l.component?l.component(t,n):o}),{token:wt}))}var kt=function(e){return P(e)&&e.token===wt};function Tt(e,t){var r=(t||{}).timeoutMs,o=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}(gt(e,{priority:n.LOW,timeoutMs:r}),2),i=o[0],a=o[1];return $((function(){a(e)}),[e]),i}function Ot(){var e=W.get(),t=st(),n=Pe((function(){return{error:null}}),[]);return e.catchException=function(e){n.error=e,t()},$((function(){n.error=null}),[n.error]),n.error}var Ht=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},It=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}(gt(Pe((function(){return u(n)?n(t):t}),[])),2),o=r[0],i=r[1],a=mt((function(t){return i((function(n){return e(n,t)}))}),[]);return[o,a]}function jt(e){return void 0===e&&(e=null),Pe((function(){return{current:e}}),[])}return t})())); //# sourceMappingURL=dark-core.production.min.js.map \ No newline at end of file diff --git a/packages/core/umd/dark-core.production.min.js.map b/packages/core/umd/dark-core.production.min.js.map index 7a215914..1817d143 100644 --- a/packages/core/umd/dark-core.production.min.js.map +++ b/packages/core/umd/dark-core.production.min.js.map @@ -1 +1 @@ -{"version":3,"file":"dark-core.production.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,WAAY,GAAIH,GACG,iBAAZC,QACdA,QAAkB,SAAID,IAEtBD,EAAe,SAAIC,IARrB,CASGK,MAAM,I,mBCRT,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBL,IACH,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,M,kzDCLhD,IAMKC,EANCC,EAAO,OACPC,EAAa,cACbC,EAAW,MACXC,EAAW,MACXC,EAAiB,kBAE9B,SAAYL,GACV,mBACA,uBACA,iBAHF,CAAYA,IAAAA,EAAY,KCJxB,IAAMM,EAAmB,SAACnB,GAA0B,MAAa,mBAANA,GACrDoB,EAAoB,SAACpB,GAAW,YAAa,IAANA,GACvCqB,EAAiB,SAACrB,GAAW,MAAa,iBAANA,GACpC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a4U,IACvB5B,UAAS,IACT,GAHK+C,EAAa,KAAEC,EAAgB,KAStC,OAJA/O,GAAU,WACR+O,EAAiBjW,KAChB,CAACA,IAEGgW,ECVT,SAASE,KACP,IAAMvQ,EAAQG,EAAqBtG,MAC7B8T,EAASR,KACTC,EAAoBpI,IAAQ,WAAM,OAAGzJ,MAAO,QAAS,IAW3D,OATAyE,EAAMsI,eAAiB,SAAC/M,GACtB6R,EAAM7R,MAAQA,EACdoS,KAGFpM,GAAU,WACR6L,EAAM7R,MAAQ,OACb,CAAC6R,EAAM7R,QAEH6R,EAAM7R,M,keCpBf,SAASiV,GAAqCjU,GAC5C,IAAM6Q,EAAQpI,IAAQ,WAAM,OAAGzI,GAAE,KAAK,IAEtC6Q,EAAM7Q,GAAKA,EAEX,IAAM8Q,EAAWuB,IAAY,W,IAAC,sDAC5B,OAAOxB,EAAM7Q,GAAE,MAAR6Q,EAAK,SAAOqD,IAAI,MACtB,IAEH,OAAOpD,ECTT,SAASqD,GAAuB9S,EAAoB+S,EAAuB3T,GACzE,IAAM4T,EAAU5L,IAAQ,WAAM,OAAA2L,MAAgB3T,GAE9CY,EAAIgT,QAAUA,ECAhB,SAASC,GACPC,EACAC,EACAC,GAEA,IAGM,E,uRAAA,CAAoBnC,GAHL7J,IAAQ,WAC3B,OAAOpK,EAAiBoW,GAAeA,EAAYD,GAAgBA,IAClE,KAC8D,GAA1DE,EAAK,KAAElC,EAAQ,KAChBmC,EAAWtC,IAAY,SAACuC,GAA6B,OAAApC,GAAS,SAAAkC,GAAS,OAAAH,EAAQG,EAAOE,QAAU,IAItG,MAAO,CAACF,EAAOC,GChBjB,SAASE,GAAUtC,GAGjB,YAHiB,IAAAA,IAAAA,EAAA,MACL9J,IAAQ,WAAM,OAAG4L,QAAS9B,KAAiB,I","sources":["webpack://DarkCore/webpack/universalModuleDefinition","webpack://DarkCore/webpack/bootstrap","webpack://DarkCore/webpack/runtime/define property getters","webpack://DarkCore/webpack/runtime/hasOwnProperty shorthand","webpack://DarkCore/webpack/runtime/make namespace object","webpack://DarkCore/./src/constants.ts","webpack://DarkCore/./src/helpers/index.ts","webpack://DarkCore/./src/component/component.ts","webpack://DarkCore/./src/view/types.ts","webpack://DarkCore/./src/scope/scope.ts","webpack://DarkCore/./src/use-effect/use-effect.ts","webpack://DarkCore/./src/view/view.ts","webpack://DarkCore/./src/fragment/fragment.ts","webpack://DarkCore/./src/ref/ref.ts","webpack://DarkCore/./src/memo/memo.ts","webpack://DarkCore/./src/use-memo/use-memo.ts","webpack://DarkCore/./src/platform/platform.ts","webpack://DarkCore/./src/fiber/types.ts","webpack://DarkCore/./src/use-layout-effect/use-layout-effect.ts","webpack://DarkCore/./src/walk/walk.ts","webpack://DarkCore/./src/unmount/unmount.ts","webpack://DarkCore/./src/fiber/fiber.ts","webpack://DarkCore/./src/use-update/use-update.ts","webpack://DarkCore/./src/use-context/use-context.ts","webpack://DarkCore/./src/context/context.ts","webpack://DarkCore/./src/element/element.ts","webpack://DarkCore/./src/use-callback/use-callback.ts","webpack://DarkCore/./src/use-state/use-state.ts","webpack://DarkCore/./src/suspense/suspense.ts","webpack://DarkCore/./src/lazy/lazy.ts","webpack://DarkCore/./src/use-deferred-value/use-deferred-value.ts","webpack://DarkCore/./src/use-error/use-error.ts","webpack://DarkCore/./src/use-event/use-event.ts","webpack://DarkCore/./src/use-imperative-handle/use-imperative-handle.ts","webpack://DarkCore/./src/use-reducer/use-reducer.ts","webpack://DarkCore/./src/use-ref/use-ref.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"DarkCore\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"DarkCore\"] = factory();\n\telse\n\t\troot[\"DarkCore\"] = factory();\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const ROOT = 'root';\r\nexport const EMPTY_NODE = 'dark:matter';\r\nexport const ATTR_KEY = 'key';\r\nexport const ATTR_REF = 'ref';\r\nexport const PARTIAL_UPDATE = 'partial-update';\r\n\r\nexport enum TaskPriority {\r\n HIGH = 2,\r\n NORMAL = 1,\r\n LOW = 0,\r\n}\r\n","import type { NestedArray } from '../shared';\r\n\r\nconst detectIsFunction = (o: any): o is Function => typeof o === 'function';\r\nconst detectIsUndefined = (o: any) => typeof o === 'undefined';\r\nconst detectIsNumber = (o: any) => typeof o === 'number';\r\nconst detectIsString = (o: any) => typeof o === 'string';\r\nconst detectIsObject = (o: any) => typeof o === 'object';\r\nconst detectIsBoolean = (o: any) => typeof o === 'boolean';\r\nconst detectIsArray = (o: any): o is Array => Array.isArray(o);\r\nconst detectIsNull = (o: any) => o === null;\r\nconst detectIsEmpty = (o: any) => detectIsNull(o) || detectIsUndefined(o);\r\n\r\nfunction error(str: string) {\r\n !detectIsUndefined(console) && console.error(str);\r\n}\r\n\r\nfunction flatten(source: Array>): Array {\r\n const list = [];\r\n const levelMap = { 0: { idx: 0, source } };\r\n let level = 0;\r\n\r\n do {\r\n const { source, idx } = levelMap[level];\r\n const item = source[idx];\r\n\r\n if (idx >= source.length) {\r\n level--;\r\n levelMap[level].idx++;\r\n continue;\r\n }\r\n\r\n if (detectIsArray(item)) {\r\n level++;\r\n levelMap[level] = {\r\n idx: 0,\r\n source: item,\r\n };\r\n } else {\r\n list.push(item);\r\n levelMap[level].idx++;\r\n }\r\n } while (level > 0 || levelMap[level].idx < levelMap[level].source.length);\r\n\r\n return list;\r\n}\r\n\r\nfunction getTime() {\r\n return Date.now();\r\n}\r\n\r\nfunction keyBy(\r\n list: Array,\r\n fn: (o: T) => string | number,\r\n value = false,\r\n): Record {\r\n return list.reduce((acc, x) => ((acc[fn(x)] = value ? x : true), acc), {});\r\n}\r\n\r\nfunction takeListFromEnd(source: Array, count: number) {\r\n return source.slice(source.length - count, source.length);\r\n}\r\n\r\nconst dummyFn = () => {};\r\n\r\nfunction detectIsDepsDifferent(deps: Array, prevDeps: Array): boolean {\r\n if (!detectIsUndefined(deps) && !detectIsUndefined(prevDeps) && deps.length > 0 && prevDeps.length > 0) {\r\n for (let i = 0; i < prevDeps.length; i++) {\r\n if (prevDeps[i] !== deps[i]) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n}\r\n\r\nexport {\r\n detectIsFunction,\r\n detectIsUndefined,\r\n detectIsNumber,\r\n detectIsString,\r\n detectIsObject,\r\n detectIsBoolean,\r\n detectIsArray,\r\n detectIsNull,\r\n detectIsEmpty,\r\n error,\r\n flatten,\r\n getTime,\r\n keyBy,\r\n takeListFromEnd,\r\n dummyFn,\r\n detectIsDepsDifferent,\r\n};\r\n","import { ATTR_KEY } from '../constants';\r\nimport { error, detectIsEmpty } from '../helpers';\r\nimport type { DarkElementKey, DarkElementInstance } from '../shared';\r\nimport type { MutableRef } from '../ref';\r\nimport type { CreateElement, ComponentOptions, StandardComponentProps, SlotProps } from './types';\r\n\r\nconst $$component = Symbol('component');\r\nconst defaultOptions: ComponentOptions = {\r\n displayName: '',\r\n defaultProps: {},\r\n token: $$component,\r\n};\r\nclass ComponentFactory

{\r\n public type: CreateElement

;\r\n public token: Symbol;\r\n public props: P;\r\n public ref: MutableRef;\r\n public displayName: string;\r\n public children: Array = [];\r\n public shouldUpdate?: (props: P, nextProps: P) => boolean;\r\n\r\n constructor(options: ComponentFactory

) {\r\n this.type = options.type || null;\r\n this.token = options.token || null;\r\n this.props = options.props || null;\r\n this.ref = options.ref || null;\r\n this.displayName = options.displayName || '';\r\n this.shouldUpdate = options.shouldUpdate || null;\r\n }\r\n}\r\n\r\nfunction createComponent(\r\n createElement: CreateElement

,\r\n options: ComponentOptions

= {},\r\n) {\r\n type Props = P & StandardComponentProps;\r\n const computedOptions = { ...defaultOptions, ...options };\r\n const { token, defaultProps, displayName, shouldUpdate } = computedOptions;\r\n\r\n return (props = {} as Props, ref?: MutableRef): ComponentFactory => {\r\n const computedProps = { ...defaultProps, ...props };\r\n const factory = new ComponentFactory({\r\n token,\r\n ref,\r\n displayName,\r\n shouldUpdate,\r\n props: computedProps,\r\n type: createElement,\r\n children: [],\r\n });\r\n\r\n if (computedProps.ref) {\r\n delete computedProps.ref;\r\n\r\n if (process.env.NODE_ENV === 'development') {\r\n error(`[Dark]: To use ref you need to wrap the createComponent with forwardRef!`);\r\n }\r\n }\r\n\r\n return factory;\r\n };\r\n}\r\n\r\nconst detectIsComponentFactory = (factory: unknown): factory is ComponentFactory => factory instanceof ComponentFactory;\r\n\r\nconst getComponentFactoryKey = (factory: ComponentFactory): DarkElementKey =>\r\n !detectIsEmpty(factory.props[ATTR_KEY]) ? factory.props[ATTR_KEY] : null;\r\n\r\nexport { ComponentFactory, createComponent, detectIsComponentFactory, getComponentFactoryKey };\r\n","export type ViewDef = {\r\n as: string;\r\n slot?: any;\r\n isVoid?: boolean;\r\n [prop: string]: any;\r\n};\r\n\r\nexport enum NodeType {\r\n TAG = 'TAG',\r\n TEXT = 'TEXT',\r\n COMMENT = 'COMMENT',\r\n}\r\n","import type { Fiber } from '../fiber';\r\n\r\nclass Store {\r\n public wipRoot: Fiber = null;\r\n public currentRoot: Fiber = null;\r\n public nextUnitOfWork: Fiber = null;\r\n public fromHookUpdate = false;\r\n public events: Map> = new Map();\r\n public unsubscribers: Array<() => void> = [];\r\n public deletions: Array = [];\r\n public fiberMount = {\r\n level: 0,\r\n navigation: {},\r\n isDeepWalking: true,\r\n };\r\n public componentFiber: Fiber = null;\r\n public effects: Array<() => void> = [];\r\n public layoutEffects: Array<() => void> = [];\r\n}\r\n\r\nlet rootId = null;\r\nconst stores = new Map();\r\n\r\nconst effectStoreHelper = {\r\n set: (id: number) => effectStore(id),\r\n remove: (id: number) => stores.delete(id),\r\n};\r\n\r\nconst getRootId = (): number => rootId;\r\n\r\nconst effectStore = (id: number) => {\r\n rootId = id;\r\n !stores.get(rootId) && stores.set(rootId, new Store());\r\n};\r\n\r\nconst storeHelper = {\r\n get: (id: number = rootId) => stores.get(id),\r\n};\r\n\r\nconst wipRootHelper = {\r\n get: () => storeHelper.get()?.wipRoot || null,\r\n set: (fiber: Fiber) => (storeHelper.get().wipRoot = fiber),\r\n};\r\n\r\nconst currentRootHelper = {\r\n get: (id?: number) => storeHelper.get(id)?.currentRoot || null,\r\n set: (fiber: Fiber) => (storeHelper.get().currentRoot = fiber),\r\n};\r\n\r\nconst nextUnitOfWorkHelper = {\r\n get: () => storeHelper.get()?.nextUnitOfWork || null,\r\n set: (fiber: Fiber) => (storeHelper.get().nextUnitOfWork = fiber),\r\n};\r\n\r\nconst componentFiberHelper = {\r\n get: () => storeHelper.get()?.componentFiber,\r\n set: (fiber: Fiber) => (storeHelper.get().componentFiber = fiber),\r\n};\r\n\r\nconst fromHookUpdateHelper = {\r\n get: () => storeHelper.get()?.fromHookUpdate || false,\r\n set: (value: boolean) => (storeHelper.get().fromHookUpdate = value),\r\n};\r\n\r\nconst eventsHelper = {\r\n get: () => storeHelper.get().events,\r\n addUnsubscriber: (fn: () => void) => storeHelper.get().unsubscribers.push(fn),\r\n mapUnsubscribers: (id: number) => storeHelper.get(id).unsubscribers.forEach(fn => fn()),\r\n};\r\n\r\nconst deletionsHelper = {\r\n get: () => storeHelper.get().deletions,\r\n set: (deletions: Array) => (storeHelper.get().deletions = deletions),\r\n};\r\n\r\nconst fiberMountHelper = {\r\n reset: () => {\r\n storeHelper.get().fiberMount = {\r\n level: 0,\r\n navigation: {},\r\n isDeepWalking: true,\r\n };\r\n },\r\n getIndex: () => storeHelper.get().fiberMount.navigation[storeHelper.get().fiberMount.level],\r\n jumpToChild: () => {\r\n const { fiberMount } = storeHelper.get();\r\n const level = fiberMount.level;\r\n const nextLevel = level + 1;\r\n\r\n fiberMount.level = nextLevel;\r\n fiberMount.navigation[nextLevel] = 0;\r\n },\r\n jumpToParent: () => {\r\n const { fiberMount } = storeHelper.get();\r\n const level = fiberMount.level;\r\n const nextLevel = level - 1;\r\n\r\n fiberMount.navigation[level] = 0;\r\n fiberMount.level = nextLevel;\r\n },\r\n jumpToSibling: () => {\r\n const { fiberMount } = storeHelper.get();\r\n const level = fiberMount.level;\r\n const idx = fiberMount.navigation[level] + 1;\r\n\r\n fiberMount.navigation[level] = idx;\r\n },\r\n deepWalking: {\r\n get: () => storeHelper.get().fiberMount.isDeepWalking,\r\n set: (value: boolean) => (storeHelper.get().fiberMount.isDeepWalking = value),\r\n },\r\n};\r\n\r\nconst effectsHelper = {\r\n get: () => storeHelper.get().effects,\r\n reset: () => (storeHelper.get().effects = []),\r\n add: (effect: () => void) => storeHelper.get().effects.push(effect),\r\n};\r\n\r\nconst layoutEffectsHelper = {\r\n get: () => storeHelper.get().layoutEffects,\r\n reset: () => (storeHelper.get().layoutEffects = []),\r\n add: (effect: () => void) => storeHelper.get().layoutEffects.push(effect),\r\n};\r\n\r\nexport {\r\n getRootId,\r\n effectStoreHelper,\r\n wipRootHelper,\r\n currentRootHelper,\r\n nextUnitOfWorkHelper,\r\n componentFiberHelper,\r\n fromHookUpdateHelper,\r\n eventsHelper,\r\n deletionsHelper,\r\n fiberMountHelper,\r\n effectsHelper,\r\n layoutEffectsHelper,\r\n};\r\n","import { detectIsUndefined, detectIsFunction, detectIsDepsDifferent } from '../helpers';\r\nimport { componentFiberHelper, effectsHelper } from '../scope';\r\nimport type { Fiber, Hook, HookValue } from '../fiber';\r\nimport type { Effect, DropEffect } from './types';\r\n\r\nconst $$useEffect = Symbol('use-effect');\r\n\r\nconst { useEffect, hasEffects, dropEffects } = createEffect($$useEffect, effectsHelper);\r\n\r\nfunction createEffect(token: Symbol, store: typeof effectsHelper) {\r\n function useEffect(effect: Effect, deps?: Array) {\r\n const fiber = componentFiberHelper.get();\r\n const hook = fiber.hook as Hook>;\r\n const { idx, values } = hook;\r\n const runEffect = () => {\r\n values[idx] = {\r\n deps,\r\n token,\r\n value: undefined,\r\n };\r\n\r\n store.add(() => {\r\n values[idx].value = effect();\r\n });\r\n };\r\n\r\n if (detectIsUndefined(values[idx])) {\r\n runEffect();\r\n } else {\r\n const { deps: prevDeps, value: cleanup } = values[idx];\r\n const isDepsDifferent = deps ? detectIsDepsDifferent(deps, prevDeps) : true;\r\n\r\n if (isDepsDifferent) {\r\n detectIsFunction(cleanup) && cleanup();\r\n runEffect();\r\n }\r\n }\r\n\r\n hook.idx++;\r\n }\r\n\r\n function hasEffects(fiber: Fiber) {\r\n const { values } = fiber.hook as Hook;\r\n const hasEffect = values.some(x => x.token === token);\r\n\r\n return hasEffect;\r\n }\r\n\r\n function dropEffects(hook: Hook>) {\r\n const { values } = hook;\r\n\r\n for (const value of values) {\r\n if (value.token === token) {\r\n const cleanup = value.value;\r\n\r\n detectIsFunction(cleanup) && cleanup();\r\n }\r\n }\r\n }\r\n\r\n return {\r\n useEffect,\r\n hasEffects,\r\n dropEffects,\r\n };\r\n}\r\n\r\nexport { useEffect, hasEffects, dropEffects, createEffect };\r\n","import { EMPTY_NODE, ATTR_KEY } from '../constants';\r\nimport { detectIsArray, detectIsEmpty, detectIsFunction } from '../helpers';\r\nimport type { DarkElementKey } from '../shared';\r\nimport type { ComponentFactory, StandardComponentProps } from '../component';\r\nimport { NodeType, type ViewDef } from './types';\r\n\r\nexport type VirtualNodeFactory = () => VirtualNode;\r\nexport type TagVirtualNodeFactory = () => TagVirtualNode;\r\nexport type TextVirtualNodeFactory = () => TextVirtualNode;\r\nexport type CommentVirtualNodeFactory = () => CommentVirtualNode;\r\n\r\nconst $$virtualNode = Symbol('virtual-node');\r\n\r\nclass VirtualNode {\r\n public type: NodeType = null;\r\n\r\n constructor(options: Partial) {\r\n this.type = options.type;\r\n }\r\n}\r\n\r\nclass TagVirtualNode extends VirtualNode {\r\n public type = NodeType.TAG;\r\n public name: string = null;\r\n public isVoid = false;\r\n public attrs: Record = {};\r\n public children: Array = [];\r\n\r\n constructor(options: Partial) {\r\n super(options);\r\n this.name = options.name || this.name;\r\n this.isVoid = options.isVoid || this.isVoid;\r\n this.attrs = options.attrs || this.attrs;\r\n this.children = options.children || this.children;\r\n }\r\n}\r\n\r\nclass TextVirtualNode extends VirtualNode {\r\n public type = NodeType.TEXT;\r\n public value = '';\r\n\r\n constructor(text: string) {\r\n super({});\r\n this.value = text;\r\n }\r\n}\r\n\r\nclass CommentVirtualNode extends VirtualNode {\r\n public type = NodeType.COMMENT;\r\n public value = '';\r\n\r\n constructor(text: string) {\r\n super({});\r\n this.value = text;\r\n }\r\n}\r\n\r\nconst detectIsVirtualNode = (vNode: unknown): vNode is VirtualNode => vNode instanceof VirtualNode;\r\nconst detectIsTagVirtualNode = (vNode: unknown): vNode is TagVirtualNode => vNode instanceof TagVirtualNode;\r\nconst detectIsCommentVirtualNode = (vNode: unknown): vNode is CommentVirtualNode => vNode instanceof CommentVirtualNode;\r\nconst detectIsTextVirtualNode = (vNode: unknown): vNode is TextVirtualNode => vNode instanceof TextVirtualNode;\r\nconst detectIsEmptyVirtualNode = (vNode: unknown): boolean =>\r\n detectIsCommentVirtualNode(vNode) && vNode.value === EMPTY_NODE;\r\n\r\nfunction getVirtualNodeKey(vNode: TagVirtualNode): DarkElementKey | null {\r\n const key = vNode && vNode.attrs[ATTR_KEY];\r\n\r\n return !detectIsEmpty(key) ? key : null;\r\n}\r\n\r\nfunction Text(source: string | StandardComponentProps['slot']): string | TextVirtualNode {\r\n const text =\r\n typeof source === 'string' ? new TextVirtualNode(source) : detectIsTextVirtualNode(source) ? source.value : '';\r\n\r\n return text;\r\n}\r\n\r\nfunction Comment(text: string): CommentVirtualNodeFactory {\r\n const factory = () => new CommentVirtualNode(text);\r\n\r\n factory[$$virtualNode] = true;\r\n\r\n return factory;\r\n}\r\n\r\nfunction View(def: ViewDef): TagVirtualNodeFactory {\r\n const factory = () => {\r\n const { as, slot, isVoid = false, ...rest } = def;\r\n const children = isVoid ? [] : detectIsArray(slot) ? slot : slot ? [slot] : [];\r\n\r\n return new TagVirtualNode({\r\n name: as,\r\n isVoid,\r\n attrs: { ...rest },\r\n children: children as Array,\r\n });\r\n };\r\n\r\n factory[$$virtualNode] = true;\r\n\r\n return factory;\r\n}\r\n\r\nconst createEmptyVirtualNode = () => new CommentVirtualNode(EMPTY_NODE);\r\n\r\nconst detectIsVirtualNodeFactory = (factory: unknown): factory is VirtualNodeFactory =>\r\n detectIsFunction(factory) && factory[$$virtualNode] === true;\r\n\r\nexport {\r\n VirtualNode,\r\n TagVirtualNode,\r\n TextVirtualNode,\r\n CommentVirtualNode,\r\n detectIsVirtualNode,\r\n detectIsTagVirtualNode,\r\n detectIsCommentVirtualNode,\r\n detectIsTextVirtualNode,\r\n detectIsEmptyVirtualNode,\r\n getVirtualNodeKey,\r\n Text,\r\n Comment,\r\n View,\r\n createEmptyVirtualNode,\r\n detectIsVirtualNodeFactory,\r\n};\r\n","import { type KeyProps, createComponent, detectIsComponentFactory } from '../component';\r\n\r\nconst $$fragment = Symbol('fragment');\r\n\r\nconst Fragment = createComponent(({ slot }) => slot || null, {\r\n token: $$fragment,\r\n});\r\n\r\nconst detectIsFragment = (factory: unknown) => detectIsComponentFactory(factory) && factory.token === $$fragment;\r\n\r\nexport { Fragment, detectIsFragment };\r\n","import { detectIsObject, detectIsNull } from '../helpers';\r\nimport type { Component, RefProps, ComponentFactory } from '../component';\r\nimport type { MutableRef } from './types';\r\n\r\nfunction forwardRef(component: Component) {\r\n type Props = P & RefProps;\r\n\r\n return ({ ref, ...rest }: Props) => {\r\n return component(rest as P, ref) as ComponentFactory;\r\n };\r\n}\r\n\r\nconst detectIsRef = (ref: unknown) => {\r\n if (!detectIsObject(ref) || detectIsNull(ref)) return false;\r\n const mutableRef = ref as MutableRef;\r\n\r\n for (const key in mutableRef) {\r\n if (key === 'current' && mutableRef.hasOwnProperty(key)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n};\r\n\r\nexport { forwardRef, detectIsRef };\r\n","import {\r\n type Component,\r\n type ComponentFactory,\r\n type StandardComponentProps,\r\n type RefProps,\r\n type SlotProps,\r\n createComponent,\r\n detectIsComponentFactory,\r\n} from '../component';\r\nimport { type MutableRef, forwardRef } from '../ref';\r\n\r\ntype ShouldUpdate = (props: T, nextProps: T) => boolean;\r\n\r\nconst $$memo = Symbol('memo');\r\n\r\nconst defaultShouldUpdate = (props: {}, nextProps: {}): boolean => {\r\n const keys = Object.keys(nextProps);\r\n\r\n for (const key of keys) {\r\n if (key !== 'slot' && nextProps[key] !== props[key]) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n};\r\n\r\nconst detectIsMemo = (factory: unknown) => detectIsComponentFactory(factory) && factory.token === $$memo;\r\n\r\nfunction memo(\r\n component: (props: T, ref?: MutableRef) => ComponentFactory,\r\n shouldUpdate: ShouldUpdate = defaultShouldUpdate,\r\n): Component {\r\n return forwardRef(\r\n createComponent(\r\n (props: T & RefProps, ref) => {\r\n ref && (props.ref = ref);\r\n\r\n return component(props);\r\n },\r\n { token: $$memo, shouldUpdate },\r\n ),\r\n );\r\n}\r\n\r\nexport { $$memo, memo, detectIsMemo };\r\n","import { type DarkElement } from '../shared';\r\nimport { detectIsUndefined, detectIsArray, detectIsDepsDifferent } from '../helpers';\r\nimport { detectIsComponentFactory, createComponent } from '../component';\r\nimport { detectIsVirtualNodeFactory } from '../view';\r\nimport { componentFiberHelper } from '../scope';\r\nimport { Fragment } from '../fragment';\r\nimport { $$memo } from '../memo';\r\n\r\nconst Memo = createComponent(({ slot }) => slot, { token: $$memo });\r\n\r\nfunction wrap(value: T, isDepsDifferent: boolean) {\r\n const check = (value: T) => detectIsVirtualNodeFactory(value) || detectIsComponentFactory(value);\r\n\r\n if (detectIsArray(value) ? check(value[0]) : check(value)) {\r\n const slot = value as unknown as DarkElement;\r\n const factory = Memo({\r\n slot: Fragment({ slot }),\r\n });\r\n\r\n factory.shouldUpdate = () => isDepsDifferent;\r\n\r\n return factory;\r\n }\r\n\r\n return value;\r\n}\r\n\r\nfunction processValue(getValue: () => T, isDepsDifferent = false) {\r\n return wrap(getValue(), isDepsDifferent);\r\n}\r\n\r\nfunction useMemo(getValue: () => T, deps: Array): T {\r\n const fiber = componentFiberHelper.get();\r\n const { hook } = fiber;\r\n const { idx, values } = hook;\r\n\r\n if (detectIsUndefined(values[idx])) {\r\n const value = processValue(getValue);\r\n\r\n values[idx] = {\r\n deps,\r\n value,\r\n };\r\n\r\n hook.idx++;\r\n\r\n return value as T;\r\n }\r\n\r\n const hookValue = values[idx];\r\n const prevDeps = hookValue.deps as Array;\r\n const isDepsDifferent = detectIsDepsDifferent(deps, prevDeps);\r\n const computedGetValue = isDepsDifferent ? getValue : () => hookValue.value;\r\n\r\n hookValue.deps = deps;\r\n hookValue.value = processValue(computedGetValue, isDepsDifferent);\r\n\r\n hook.idx++;\r\n\r\n return hookValue.value;\r\n}\r\n\r\nexport { useMemo };\r\n","import type { Platform } from './types';\r\n\r\nexport const platform: Platform = {\r\n scheduleCallback: () => {\r\n throw new Error('scheduleCallback not installed by renderer');\r\n },\r\n shouldYeildToHost: () => {\r\n throw new Error('shouldYeildToHost not installed by renderer');\r\n },\r\n createNativeElement: () => {\r\n throw new Error('createNativeElement not installed by renderer');\r\n },\r\n applyCommit: () => {\r\n throw new Error('applyCommit not installed by renderer');\r\n },\r\n finishCommitWork: () => {\r\n throw new Error('finishCommitWork not installed by renderer');\r\n },\r\n detectIsPortal: () => {\r\n throw new Error('detectIsPortal not installed by renderer');\r\n },\r\n unmountPortal: () => {\r\n throw new Error('unmountPortal not installed by renderer');\r\n },\r\n};\r\n","export enum EffectTag {\r\n PLACEMENT = 'PLACEMENT',\r\n UPDATE = 'UPDATE',\r\n DELETION = 'DELETION',\r\n SKIP = 'SKIP',\r\n}\r\n\r\nexport type NativeElement = unknown;\r\n\r\nexport type HookValue = {\r\n token?: Symbol;\r\n deps: Array;\r\n value: T;\r\n};\r\n\r\nexport type Hook = {\r\n idx: number;\r\n values: Array;\r\n};\r\n\r\nexport const cloneTagMap = {\r\n [EffectTag.PLACEMENT]: true,\r\n [EffectTag.SKIP]: true,\r\n};\r\n","import { layoutEffectsHelper } from '../scope';\r\nimport { createEffect } from '../use-effect';\r\n\r\nconst $$useLayoutEffect = Symbol('use-layout-effect');\r\n\r\nconst {\r\n useEffect: useLayoutEffect,\r\n hasEffects: hasLayoutEffects,\r\n dropEffects: dropLayoutEffects,\r\n} = createEffect($$useLayoutEffect, layoutEffectsHelper);\r\n\r\nexport { useLayoutEffect, hasLayoutEffects, dropLayoutEffects };\r\n","import { type Fiber } from '../fiber';\r\n\r\ntype WalkFiberOptions = {\r\n fiber: Fiber;\r\n onLoop: (options: OnLoopOptions) => void;\r\n};\r\n\r\ntype OnLoopOptions = {\r\n nextFiber: Fiber;\r\n isReturn: boolean;\r\n resetIsDeepWalking: () => void;\r\n stop: () => void;\r\n};\r\n\r\nfunction walkFiber(options: WalkFiberOptions) {\r\n const { fiber, onLoop } = options;\r\n let nextFiber = fiber;\r\n let isDeepWalking = true;\r\n let isReturn = false;\r\n let isStopped = false;\r\n const visitedMap = new Map();\r\n const detectCanVisit = (fiber: Fiber) => !visitedMap.get(fiber);\r\n\r\n while (nextFiber) {\r\n onLoop({\r\n nextFiber: nextFiber as Fiber,\r\n isReturn,\r\n resetIsDeepWalking: () => (isDeepWalking = false),\r\n stop: () => (isStopped = true),\r\n });\r\n\r\n if (isStopped) {\r\n break;\r\n }\r\n\r\n if (nextFiber.child && isDeepWalking && detectCanVisit(nextFiber.child)) {\r\n const newFiber = nextFiber.child;\r\n\r\n isReturn = false;\r\n nextFiber = newFiber;\r\n visitedMap.set(newFiber, true);\r\n } else if (nextFiber.nextSibling && detectCanVisit(nextFiber.nextSibling)) {\r\n const newFiber = nextFiber.nextSibling;\r\n\r\n isDeepWalking = true;\r\n isReturn = false;\r\n nextFiber = newFiber;\r\n visitedMap.set(newFiber, true);\r\n } else if (\r\n nextFiber.parent &&\r\n nextFiber.parent === fiber &&\r\n nextFiber.parent.nextSibling &&\r\n detectCanVisit(nextFiber.parent.nextSibling)\r\n ) {\r\n const newFiber = nextFiber.parent.nextSibling;\r\n\r\n isDeepWalking = true;\r\n isReturn = false;\r\n nextFiber = newFiber;\r\n visitedMap.set(newFiber, true);\r\n } else if (nextFiber.parent && nextFiber.parent !== fiber) {\r\n isDeepWalking = false;\r\n isReturn = true;\r\n nextFiber = nextFiber.parent;\r\n } else {\r\n nextFiber = null;\r\n }\r\n }\r\n}\r\n\r\nexport { walkFiber };\r\n","import { type Fiber } from '../fiber';\r\nimport { platform } from '../platform';\r\nimport { detectIsComponentFactory } from '../component';\r\nimport { dropEffects } from '../use-effect';\r\nimport { dropLayoutEffects } from '../use-layout-effect';\r\nimport { walkFiber } from '../walk';\r\nimport { detectIsUndefined } from '../helpers';\r\nimport { currentRootHelper, eventsHelper, effectStoreHelper } from '../scope';\r\n\r\nfunction unmountFiber(fiber: Fiber) {\r\n if (!fiber.effectHost && !fiber.layoutEffectHost && !fiber.portalHost) return;\r\n\r\n walkFiber({\r\n fiber,\r\n onLoop: ({ nextFiber, isReturn, stop }) => {\r\n if (nextFiber === fiber.nextSibling || fiber.transposition) return stop();\r\n\r\n if (!isReturn && detectIsComponentFactory(nextFiber.instance)) {\r\n nextFiber.layoutEffectHost && dropLayoutEffects(nextFiber.hook);\r\n nextFiber.effectHost && dropEffects(nextFiber.hook);\r\n nextFiber.portalHost && platform.unmountPortal(nextFiber);\r\n }\r\n },\r\n });\r\n}\r\n\r\nfunction unmountRoot(rootId: number, onComplete: () => void) {\r\n if (detectIsUndefined(rootId)) return;\r\n\r\n unmountFiber(currentRootHelper.get(rootId));\r\n eventsHelper.mapUnsubscribers(rootId);\r\n effectStoreHelper.remove(rootId);\r\n onComplete();\r\n}\r\n\r\nexport { unmountFiber, unmountRoot };\r\n","import { flatten, detectIsEmpty, error, keyBy, takeListFromEnd, detectIsUndefined, detectIsArray } from '../helpers';\r\nimport { platform } from '../platform';\r\nimport {\r\n wipRootHelper,\r\n currentRootHelper,\r\n nextUnitOfWorkHelper,\r\n deletionsHelper,\r\n fiberMountHelper,\r\n componentFiberHelper,\r\n fromHookUpdateHelper,\r\n effectStoreHelper,\r\n effectsHelper,\r\n layoutEffectsHelper,\r\n} from '../scope';\r\nimport { type ComponentFactory, detectIsComponentFactory, getComponentFactoryKey } from '../component';\r\nimport {\r\n type TagVirtualNode,\r\n detectIsTagVirtualNode,\r\n createEmptyVirtualNode,\r\n getVirtualNodeKey,\r\n detectIsVirtualNode,\r\n detectIsVirtualNodeFactory,\r\n} from '../view';\r\nimport { detectIsMemo } from '../memo';\r\nimport type { Context, ContextProviderValue } from '../context';\r\nimport type { DarkElementKey, DarkElement, DarkElementInstance } from '../shared';\r\nimport { PARTIAL_UPDATE } from '../constants';\r\nimport { type NativeElement, type Hook, EffectTag, cloneTagMap } from './types';\r\nimport { hasEffects } from '../use-effect';\r\nimport { hasLayoutEffects } from '../use-layout-effect';\r\nimport { walkFiber } from '../walk';\r\nimport { unmountFiber } from '../unmount';\r\n\r\nclass Fiber {\r\n public nativeElement: N;\r\n public parent: Fiber;\r\n public child: Fiber;\r\n public nextSibling: Fiber;\r\n public alternate: Fiber;\r\n public effectTag: EffectTag;\r\n public instance: DarkElementInstance;\r\n public hook: Hook;\r\n public shadow: Fiber;\r\n public provider: Map;\r\n public transposition: boolean;\r\n public mountedToHost: boolean;\r\n public portalHost: boolean;\r\n public effectHost: boolean;\r\n public layoutEffectHost: boolean;\r\n public childrenCount: number;\r\n public marker: string;\r\n public isUsed: boolean;\r\n public idx: number;\r\n public catchException: (error: Error) => void;\r\n\r\n constructor(options: Partial>) {\r\n this.nativeElement = options.nativeElement || null;\r\n this.parent = options.parent || null;\r\n this.child = options.child || null;\r\n this.nextSibling = options.nextSibling || null;\r\n this.alternate = options.alternate || null;\r\n this.effectTag = options.effectTag || null;\r\n this.instance = options.instance || null;\r\n this.hook = options.hook || createHook();\r\n this.shadow = options.shadow || null;\r\n this.provider = options.provider || null;\r\n this.transposition = !detectIsUndefined(options.transposition) ? options.transposition : false;\r\n this.mountedToHost = !detectIsUndefined(options.mountedToHost) || false;\r\n this.portalHost = !detectIsUndefined(options.portalHost) ? options.portalHost : false;\r\n this.effectHost = !detectIsUndefined(options.effectHost) ? options.effectHost : false;\r\n this.layoutEffectHost = !detectIsUndefined(options.layoutEffectHost) ? options.layoutEffectHost : false;\r\n this.childrenCount = options.childrenCount || 0;\r\n this.marker = options.marker || '';\r\n this.idx = options.idx || 0;\r\n this.isUsed = options.isUsed || false;\r\n }\r\n\r\n public markPortalHost() {\r\n this.portalHost = true;\r\n this.parent && !this.parent.portalHost && this.parent.markPortalHost();\r\n }\r\n\r\n public markEffectHost() {\r\n this.effectHost = true;\r\n this.parent && !this.parent.effectHost && this.parent.markEffectHost();\r\n }\r\n\r\n public markLayoutEffectHost() {\r\n this.layoutEffectHost = true;\r\n this.parent && !this.parent.layoutEffectHost && this.parent.markLayoutEffectHost();\r\n }\r\n\r\n public markMountedToHost() {\r\n this.mountedToHost = true;\r\n this.parent && !this.parent.mountedToHost && this.parent.markMountedToHost();\r\n }\r\n\r\n public setError(error: Error) {\r\n if (typeof this.catchException === 'function') {\r\n this.catchException(error);\r\n } else if (this.parent) {\r\n this.parent.setError(error);\r\n }\r\n }\r\n}\r\n\r\nfunction workLoop() {\r\n const wipFiber = wipRootHelper.get();\r\n let nextUnitOfWork = nextUnitOfWorkHelper.get();\r\n let shouldYield = false;\r\n let hasMoreWork = Boolean(nextUnitOfWork);\r\n\r\n while (nextUnitOfWork && !shouldYield) {\r\n nextUnitOfWork = performUnitOfWork(nextUnitOfWork);\r\n nextUnitOfWorkHelper.set(nextUnitOfWork);\r\n hasMoreWork = Boolean(nextUnitOfWork);\r\n shouldYield = platform.shouldYeildToHost();\r\n }\r\n\r\n if (!nextUnitOfWork && wipFiber) {\r\n commitChanges();\r\n }\r\n\r\n return hasMoreWork;\r\n}\r\n\r\nfunction performUnitOfWork(fiber: Fiber) {\r\n let isDeepWalking = true;\r\n let nextFiber = fiber;\r\n let shadow: Fiber = fiber.shadow;\r\n let instance = fiber.instance;\r\n\r\n while (true) {\r\n isDeepWalking = fiberMountHelper.deepWalking.get();\r\n nextFiber.hook.idx = 0;\r\n\r\n if (isDeepWalking) {\r\n const hasChildren = hasChildrenProp(instance) && instance.children.length > 0;\r\n\r\n if (hasChildren) {\r\n const { performedFiber, performedNextFiber, performedShadow, performedInstance } = performChild({\r\n nextFiber,\r\n shadow,\r\n instance,\r\n });\r\n\r\n nextFiber = performedNextFiber;\r\n shadow = performedShadow;\r\n instance = performedInstance;\r\n\r\n if (performedFiber) return performedFiber;\r\n } else {\r\n const { performedFiber, performedNextFiber, performedShadow, performedInstance } = performSibling({\r\n nextFiber,\r\n shadow,\r\n instance,\r\n });\r\n\r\n nextFiber = performedNextFiber;\r\n shadow = performedShadow;\r\n instance = performedInstance;\r\n\r\n if (performedFiber) return performedFiber;\r\n }\r\n } else {\r\n const { performedFiber, performedNextFiber, performedShadow, performedInstance } = performSibling({\r\n nextFiber,\r\n shadow,\r\n instance,\r\n });\r\n\r\n nextFiber = performedNextFiber;\r\n shadow = performedShadow;\r\n instance = performedInstance;\r\n\r\n if (performedFiber) return performedFiber;\r\n }\r\n\r\n performPartialUpdateEffects(nextFiber);\r\n\r\n if (nextFiber.parent === null) return null;\r\n }\r\n}\r\n\r\nfunction performPartialUpdateEffects(nextFiber: Fiber) {\r\n if (nextFiber.marker === PARTIAL_UPDATE) {\r\n const alternate = nextFiber.child?.alternate || null;\r\n const fiber = nextFiber.child || null;\r\n\r\n if (alternate && fiber && alternate.nextSibling && !fiber.nextSibling) {\r\n let nextFiber = alternate.nextSibling;\r\n const deletions: Array = [];\r\n\r\n while (nextFiber) {\r\n nextFiber.effectTag = EffectTag.DELETION;\r\n deletions.push(nextFiber);\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n deletionsHelper.get().push(...deletions);\r\n }\r\n }\r\n}\r\n\r\ntype PerformChildOptions = {\r\n nextFiber: Fiber;\r\n shadow: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction performChild(options: PerformChildOptions) {\r\n fiberMountHelper.jumpToChild();\r\n let nextFiber = options.nextFiber;\r\n let shadow = options.shadow;\r\n let instance = options.instance;\r\n\r\n shadow = shadow ? shadow.child : null;\r\n\r\n const alternate = getChildAlternate(nextFiber);\r\n const hook = getHook({ shadow, alternate, instance });\r\n const provider = shadow ? shadow.provider : alternate ? alternate.provider : null;\r\n let fiber = new Fiber({ hook, provider });\r\n\r\n componentFiberHelper.set(fiber);\r\n fiber.parent = nextFiber;\r\n\r\n const { performedInstance, performedShadow } = pertformInstance({\r\n instance,\r\n idx: 0,\r\n fiber,\r\n alternate,\r\n });\r\n instance = performedInstance || instance;\r\n shadow = performedShadow || shadow;\r\n alternate && mutateAlternate({ alternate, instance });\r\n mutateFiber({ fiber, alternate, instance });\r\n fiber = alternate ? performMemo({ fiber, alternate, instance }) : fiber;\r\n\r\n fiber.idx = 0;\r\n\r\n nextFiber.child = fiber;\r\n fiber.parent = nextFiber;\r\n fiber.shadow = shadow;\r\n nextFiber = fiber;\r\n\r\n cloneTagMap[fiber.parent.effectTag] && (fiber.effectTag = fiber.parent.effectTag);\r\n\r\n return {\r\n performedFiber: nextFiber,\r\n performedNextFiber: nextFiber,\r\n performedShadow: shadow,\r\n performedInstance: instance,\r\n };\r\n}\r\n\r\ntype PerformSiblingOptions = {\r\n nextFiber: Fiber;\r\n shadow: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction performSibling(options: PerformSiblingOptions) {\r\n fiberMountHelper.jumpToSibling();\r\n let nextFiber = options.nextFiber;\r\n let shadow = options.shadow;\r\n let instance = options.instance;\r\n const parent = nextFiber.parent.instance;\r\n const childrenIdx = fiberMountHelper.getIndex();\r\n const hasSibling = hasChildrenProp(parent) && parent.children[childrenIdx];\r\n\r\n if (hasSibling) {\r\n fiberMountHelper.deepWalking.set(true);\r\n\r\n shadow = shadow ? shadow.nextSibling : null;\r\n const alternate = getNextSiblingAlternate(nextFiber);\r\n const hook = getHook({ shadow, alternate, instance });\r\n const provider = shadow ? shadow.provider : alternate ? alternate.provider : null;\r\n let fiber = new Fiber({ hook, provider });\r\n\r\n componentFiberHelper.set(fiber);\r\n fiber.parent = nextFiber.parent;\r\n\r\n const { performedInstance, performedShadow } = pertformInstance({\r\n instance: parent,\r\n idx: childrenIdx,\r\n fiber,\r\n alternate,\r\n });\r\n instance = performedInstance || instance;\r\n shadow = performedShadow || shadow;\r\n alternate && mutateAlternate({ alternate, instance });\r\n mutateFiber({ fiber, alternate, instance });\r\n fiber = alternate ? performMemo({ fiber, alternate, instance }) : fiber;\r\n\r\n fiber.idx = childrenIdx;\r\n\r\n fiber.parent = nextFiber.parent;\r\n nextFiber.nextSibling = fiber;\r\n fiber.shadow = shadow;\r\n nextFiber = fiber;\r\n\r\n cloneTagMap[fiber.parent.effectTag] && (fiber.effectTag = fiber.parent.effectTag);\r\n\r\n return {\r\n performedFiber: nextFiber,\r\n performedNextFiber: nextFiber,\r\n performedShadow: shadow,\r\n performedInstance: instance,\r\n };\r\n } else {\r\n fiberMountHelper.jumpToParent();\r\n fiberMountHelper.deepWalking.set(false);\r\n shadow = shadow ? shadow.parent : null;\r\n nextFiber = nextFiber.parent;\r\n instance = nextFiber.instance;\r\n\r\n if (hasChildrenProp(nextFiber.instance)) {\r\n nextFiber.instance.children = [];\r\n }\r\n }\r\n\r\n return {\r\n performedFiber: null,\r\n performedNextFiber: nextFiber,\r\n performedShadow: shadow,\r\n performedInstance: instance,\r\n };\r\n}\r\n\r\ntype MutateFiberOptions = {\r\n fiber: Fiber;\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction mutateFiber(options: MutateFiberOptions) {\r\n const { fiber, alternate, instance } = options;\r\n const key = alternate ? getElementKey(alternate.instance) : null;\r\n const nextKey = alternate ? getElementKey(instance) : null;\r\n const isDifferentKeys = key !== nextKey;\r\n const isSameType = Boolean(alternate) && getInstanceType(alternate.instance) === getInstanceType(instance);\r\n const isUpdate = isSameType && !isDifferentKeys;\r\n\r\n fiber.instance = instance;\r\n fiber.alternate = alternate || null;\r\n fiber.nativeElement = isUpdate ? alternate.nativeElement : null;\r\n fiber.effectTag = isUpdate ? EffectTag.UPDATE : EffectTag.PLACEMENT;\r\n fiber.mountedToHost = isUpdate;\r\n\r\n if (hasChildrenProp(fiber.instance)) {\r\n fiber.childrenCount = fiber.instance.children.length;\r\n }\r\n\r\n if (fiber.alternate) {\r\n fiber.alternate.shadow = null;\r\n fiber.alternate.alternate = null;\r\n }\r\n\r\n if (!fiber.nativeElement && detectIsVirtualNode(fiber.instance)) {\r\n fiber.nativeElement = platform.createNativeElement(fiber);\r\n }\r\n}\r\n\r\ntype PerformAlternateOptions = {\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction mutateAlternate(options: PerformAlternateOptions) {\r\n const { alternate, instance } = options;\r\n const alternateType = getInstanceType(alternate.instance);\r\n const elementType = getInstanceType(instance);\r\n const isSameType = elementType === alternateType;\r\n const prevKey = getElementKey(alternate.instance);\r\n const nextKey = getElementKey(instance);\r\n const isSameKeys = prevKey === nextKey;\r\n\r\n alternate.isUsed = true;\r\n\r\n if (!isSameType || !isSameKeys) {\r\n alternate.effectTag = EffectTag.DELETION;\r\n deletionsHelper.get().push(alternate);\r\n } else if (hasChildrenProp(alternate.instance) && hasChildrenProp(instance)) {\r\n const prevElementsCount = alternate.childrenCount;\r\n const nextElementsCount = instance.children.length;\r\n const isRequestedKeys = prevElementsCount !== nextElementsCount;\r\n\r\n if (isRequestedKeys) {\r\n const children = hasChildrenProp(instance) ? instance.children : [];\r\n const { prevKeys, nextKeys } = extractKeys(alternate.child, children);\r\n const hasPrevKeys = prevKeys.length > 0;\r\n const hasNextKeys = nextKeys.length > 0;\r\n const hasAnyKeys = hasPrevKeys || hasNextKeys;\r\n\r\n if (process.env.NODE_ENV === 'development') {\r\n if (!hasAnyKeys && prevElementsCount !== 0 && nextElementsCount !== 0) {\r\n error(`\r\n [Dark]: Operation of inserting, adding, replacing elements into list requires to have a unique key for every node (string or number, but not array index)!\r\n `);\r\n }\r\n }\r\n\r\n const performRemovingNodes = () => {\r\n const diffKeys = getDiffKeys(prevKeys, nextKeys);\r\n\r\n if (diffKeys.length > 0) {\r\n const fibersMap = createFibersByKeyMap(alternate.child);\r\n\r\n for (const key of diffKeys) {\r\n const fiber = fibersMap[key] || null;\r\n\r\n if (fiber) {\r\n fiber.effectTag = EffectTag.DELETION;\r\n deletionsHelper.get().push(fiber);\r\n }\r\n }\r\n } else {\r\n const diffCount = prevElementsCount - nextElementsCount;\r\n if (diffCount === 0) return;\r\n const fibers = takeListFromEnd(getSiblingFibers(alternate.child), diffCount);\r\n\r\n for (const fiber of fibers) {\r\n fiber.effectTag = EffectTag.DELETION;\r\n }\r\n\r\n deletionsHelper.get().push(...fibers);\r\n }\r\n };\r\n\r\n const performInsertingNodes = () => {\r\n const diffKeys = getDiffKeys(nextKeys, prevKeys);\r\n\r\n if (diffKeys.length === 0) return;\r\n\r\n const diffKeyMap = keyBy(diffKeys, x => x);\r\n const usedKeyMap = {};\r\n let keyIdx = 0;\r\n\r\n for (const nextKey of nextKeys) {\r\n if (process.env.NODE_ENV === 'development') {\r\n if (usedKeyMap[nextKey]) {\r\n error(`Some key of node already has been used!`);\r\n }\r\n }\r\n\r\n usedKeyMap[nextKey] = true;\r\n\r\n if (nextKey !== prevKeys[keyIdx] && diffKeyMap[nextKey]) {\r\n const insertionFiber = new Fiber({\r\n instance: createEmptyVirtualNode(),\r\n parent: alternate,\r\n effectTag: EffectTag.PLACEMENT,\r\n });\r\n\r\n if (keyIdx === 0) {\r\n insertionFiber.nextSibling = alternate.child;\r\n alternate.child = insertionFiber;\r\n } else {\r\n const [fiber, prevFiber] = getFibersByIdx(alternate.child, keyIdx);\r\n\r\n if (fiber && prevFiber) {\r\n insertionFiber.nextSibling = fiber;\r\n prevFiber.nextSibling = insertionFiber;\r\n }\r\n }\r\n }\r\n\r\n keyIdx++;\r\n }\r\n };\r\n\r\n performRemovingNodes();\r\n performInsertingNodes();\r\n }\r\n }\r\n}\r\n\r\ntype PerformMemoOptions = {\r\n fiber: Fiber;\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction performMemo(options: PerformMemoOptions) {\r\n const { fiber, alternate, instance } = options;\r\n\r\n if (detectIsMemo(fiber.instance)) {\r\n let memoFiber: Fiber = null;\r\n const factory = instance as ComponentFactory;\r\n const alternateFactory = alternate.instance as ComponentFactory;\r\n\r\n if (factory.type !== alternateFactory.type) return fiber;\r\n\r\n const props = alternateFactory.props;\r\n const nextProps = factory.props;\r\n const skip = !factory.shouldUpdate(props, nextProps);\r\n\r\n if (skip) {\r\n let nextFiber: Fiber = null;\r\n fiberMountHelper.deepWalking.set(false);\r\n\r\n memoFiber = new Fiber({\r\n ...alternate,\r\n alternate,\r\n effectTag: EffectTag.SKIP,\r\n nextSibling: alternate.nextSibling\r\n ? alternate.nextSibling.effectTag === EffectTag.DELETION\r\n ? null\r\n : alternate.nextSibling\r\n : null,\r\n });\r\n\r\n alternate.alternate = null;\r\n nextFiber = memoFiber.child;\r\n\r\n while (nextFiber) {\r\n nextFiber.parent = memoFiber;\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n if (memoFiber.effectHost) {\r\n fiber.markEffectHost();\r\n }\r\n\r\n if (memoFiber.layoutEffectHost) {\r\n fiber.markLayoutEffectHost();\r\n }\r\n\r\n if (memoFiber.mountedToHost) {\r\n fiber.markMountedToHost();\r\n }\r\n\r\n if (memoFiber.portalHost) {\r\n fiber.markPortalHost();\r\n }\r\n\r\n return memoFiber;\r\n }\r\n }\r\n\r\n return fiber;\r\n}\r\n\r\ntype PerformInstanceOptions = {\r\n instance: DarkElementInstance;\r\n idx: number;\r\n fiber: Fiber;\r\n alternate: Fiber;\r\n};\r\n\r\nfunction pertformInstance(options: PerformInstanceOptions) {\r\n const { instance, idx, fiber, alternate } = options;\r\n let performedInstance: DarkElementInstance = null;\r\n let performedShadow: Fiber = null;\r\n\r\n if (hasChildrenProp(instance)) {\r\n const elements = detectIsArray(instance.children[idx])\r\n ? flatten([instance.children[idx]])\r\n : [instance.children[idx]];\r\n\r\n instance.children.splice(idx, 1, ...elements);\r\n performedInstance = instance.children[idx];\r\n performedShadow = alternate\r\n ? getRootShadow({\r\n instance: performedInstance,\r\n fiber,\r\n alternate,\r\n })\r\n : performedShadow;\r\n performedInstance = mountInstance(fiber, performedInstance);\r\n }\r\n\r\n if (detectIsComponentFactory(performedInstance)) {\r\n if (hasEffects(fiber)) {\r\n fiber.markEffectHost();\r\n }\r\n\r\n if (hasLayoutEffects(fiber)) {\r\n fiber.markLayoutEffectHost();\r\n }\r\n\r\n if (platform.detectIsPortal(performedInstance)) {\r\n fiber.markPortalHost();\r\n }\r\n }\r\n\r\n return {\r\n performedInstance,\r\n performedShadow,\r\n };\r\n}\r\n\r\ntype GetRootShadowOptions = {\r\n instance: DarkElementInstance;\r\n fiber: Fiber;\r\n alternate: Fiber;\r\n};\r\n\r\nfunction getRootShadow(options: GetRootShadowOptions) {\r\n const { instance, fiber, alternate } = options;\r\n const key = getElementKey(alternate.instance);\r\n const nextKey = getElementKey(instance);\r\n let shadow: Fiber = null;\r\n\r\n if (key !== nextKey) {\r\n shadow = getAlternateByKey(nextKey, alternate.parent.child);\r\n\r\n if (shadow) {\r\n fiber.hook = shadow.hook;\r\n fiber.provider = shadow.provider;\r\n alternate.transposition = true;\r\n }\r\n }\r\n\r\n return shadow;\r\n}\r\n\r\nfunction mountInstance(fiber: Fiber, instance: DarkElementInstance) {\r\n const isComponentFactory = detectIsComponentFactory(instance);\r\n const factory = instance as ComponentFactory;\r\n\r\n if (isComponentFactory) {\r\n try {\r\n const result = factory.type(factory.props, factory.ref);\r\n\r\n factory.children = detectIsArray(result)\r\n ? (flatten([result]) as Array)\r\n : ([result] as Array);\r\n } catch (err) {\r\n factory.children = [];\r\n fiber.setError(err);\r\n error(err);\r\n }\r\n } else if (detectIsVirtualNodeFactory(instance)) {\r\n instance = instance();\r\n }\r\n\r\n if (hasChildrenProp(instance)) {\r\n for (let i = 0; i < instance.children.length; i++) {\r\n if (!instance.children[i]) {\r\n instance.children[i] = transformElementInstance(instance.children[i]) as DarkElementInstance;\r\n }\r\n }\r\n\r\n instance.children = isComponentFactory\r\n ? instance.children\r\n : detectIsArray(instance.children)\r\n ? flatten([instance.children])\r\n : [instance.children];\r\n\r\n if (isComponentFactory && factory.children.length === 0) {\r\n factory.children.push(createEmptyVirtualNode());\r\n }\r\n }\r\n\r\n return instance;\r\n}\r\n\r\nfunction getFibersByIdx(fiber: Fiber, idx: number): [Fiber | null, Fiber | null] {\r\n const map: Record = {};\r\n let nextFiber = fiber;\r\n let position = 0;\r\n\r\n while (nextFiber) {\r\n map[position] = nextFiber;\r\n\r\n if (position === idx) {\r\n return [map[position] || null, map[position - 1] || null];\r\n }\r\n\r\n position++;\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return [null, null];\r\n}\r\n\r\nfunction createFibersByKeyMap(fiber: Fiber) {\r\n let nextFiber = fiber;\r\n const map: Record = {};\r\n\r\n while (nextFiber) {\r\n const key = getElementKey(nextFiber.instance);\r\n\r\n if (!detectIsEmpty(key)) {\r\n map[key] = nextFiber;\r\n }\r\n\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return map;\r\n}\r\n\r\nfunction extractKeys(alternate: Fiber, children: Array) {\r\n let nextFiber = alternate;\r\n let idx = 0;\r\n const prevKeys: Array = [];\r\n const nextKeys: Array = [];\r\n\r\n while (nextFiber || idx < children.length) {\r\n const key = nextFiber && getElementKey(nextFiber.instance);\r\n const nextKey = children[idx] && getElementKey(children[idx]);\r\n\r\n if (!detectIsEmpty(key)) {\r\n prevKeys.push(key);\r\n }\r\n\r\n if (!detectIsEmpty(nextKey)) {\r\n nextKeys.push(nextKey);\r\n }\r\n\r\n nextFiber = nextFiber ? nextFiber.nextSibling : null;\r\n idx++;\r\n }\r\n\r\n return {\r\n prevKeys,\r\n nextKeys,\r\n };\r\n}\r\n\r\nfunction getAlternateByKey(key: DarkElementKey, fiber: Fiber) {\r\n if (detectIsEmpty(key)) return null;\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n if (key === getElementKey(nextFiber.instance)) {\r\n return nextFiber;\r\n }\r\n\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return null;\r\n}\r\n\r\nfunction getElementKey(instance: DarkElementInstance): DarkElementKey | null {\r\n const key = detectIsComponentFactory(instance)\r\n ? getComponentFactoryKey(instance)\r\n : detectIsTagVirtualNode(instance)\r\n ? getVirtualNodeKey(instance)\r\n : null;\r\n\r\n return key;\r\n}\r\n\r\nfunction getDiffKeys(keys: Array, nextKeys: Array): Array {\r\n const nextKeysMap = nextKeys.reduce((acc, key) => ((acc[key] = true), acc), {});\r\n const diff = [];\r\n\r\n for (const key of keys) {\r\n if (!nextKeysMap[key]) {\r\n diff.push(key);\r\n }\r\n }\r\n\r\n return diff;\r\n}\r\n\r\nfunction getChildAlternate(fiber: Fiber): Fiber | null {\r\n let alternate = fiber.alternate && fiber.alternate.effectTag !== EffectTag.DELETION ? fiber.alternate.child : null;\r\n\r\n while (alternate && alternate.effectTag === EffectTag.DELETION) {\r\n alternate = alternate.nextSibling;\r\n }\r\n\r\n return alternate;\r\n}\r\n\r\nfunction getNextSiblingAlternate(fiber: Fiber): Fiber | null {\r\n let alternate = fiber.alternate?.nextSibling || null;\r\n\r\n while (alternate && alternate.effectTag === EffectTag.DELETION) {\r\n alternate = alternate.nextSibling;\r\n }\r\n\r\n return alternate;\r\n}\r\n\r\nfunction transformElementInstance(instance: DarkElement) {\r\n return detectIsEmpty(instance) || instance === false ? createEmptyVirtualNode() : instance;\r\n}\r\n\r\nfunction getInstanceType(instance: DarkElementInstance): string | Function {\r\n return detectIsTagVirtualNode(instance)\r\n ? instance.name\r\n : detectIsVirtualNode(instance)\r\n ? instance.type\r\n : detectIsComponentFactory(instance)\r\n ? instance.type\r\n : null;\r\n}\r\n\r\nfunction getSiblingFibers(fiber: Fiber): Array {\r\n const list = [];\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n list.push(nextFiber);\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return list;\r\n}\r\n\r\nfunction hasChildrenProp(element: DarkElementInstance): element is TagVirtualNode | ComponentFactory {\r\n return detectIsTagVirtualNode(element) || detectIsComponentFactory(element);\r\n}\r\n\r\nfunction commitChanges() {\r\n const wipFiber = wipRootHelper.get();\r\n const fromHook = fromHookUpdateHelper.get();\r\n\r\n commitWork(wipFiber.child, () => {\r\n const layoutEffects = layoutEffectsHelper.get();\r\n const effects = effectsHelper.get();\r\n\r\n wipRootHelper.set(null);\r\n\r\n for (const layoutEffect of layoutEffects) {\r\n layoutEffect();\r\n }\r\n\r\n setTimeout(() => {\r\n for (const effect of effects) {\r\n effect();\r\n }\r\n });\r\n\r\n layoutEffectsHelper.reset();\r\n effectsHelper.reset();\r\n\r\n if (fromHook) {\r\n fromHookUpdateHelper.set(false);\r\n } else {\r\n currentRootHelper.set(wipFiber);\r\n }\r\n });\r\n}\r\n\r\nfunction commitWork(fiber: Fiber, onComplete: Function) {\r\n const deletions = deletionsHelper.get();\r\n\r\n // important order\r\n for (const fiber of deletions) {\r\n unmountFiber(fiber);\r\n platform.applyCommit(fiber);\r\n }\r\n\r\n walkFiber({\r\n fiber,\r\n onLoop: ({ nextFiber, isReturn, resetIsDeepWalking }) => {\r\n const skip = nextFiber.effectTag === EffectTag.SKIP;\r\n\r\n if (skip) {\r\n resetIsDeepWalking();\r\n } else if (!isReturn) {\r\n platform.applyCommit(nextFiber);\r\n }\r\n\r\n if (nextFiber && nextFiber.shadow) {\r\n nextFiber.shadow = null;\r\n }\r\n },\r\n });\r\n\r\n platform.finishCommitWork();\r\n deletionsHelper.set([]);\r\n onComplete();\r\n}\r\n\r\nfunction createHook(): Hook {\r\n return {\r\n idx: 0,\r\n values: [],\r\n };\r\n}\r\n\r\ntype GetHookOptions = {\r\n shadow: Fiber;\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction getHook(options: GetHookOptions) {\r\n const { shadow, alternate, instance } = options;\r\n\r\n if (shadow) return shadow.hook;\r\n\r\n if (alternate && getElementKey(alternate.instance) === getElementKey(instance)) {\r\n return alternate.hook;\r\n }\r\n\r\n return createHook();\r\n}\r\n\r\ntype CreateUpdateCallbackOptions = {\r\n rootId: number;\r\n fiber: Fiber;\r\n forceStart?: boolean;\r\n onStart: () => void;\r\n};\r\n\r\nfunction createUpdateCallback(options: CreateUpdateCallbackOptions) {\r\n const { rootId, fiber, forceStart = false, onStart } = options;\r\n const callback = () => {\r\n forceStart && onStart();\r\n if (fiber.isUsed) return;\r\n !forceStart && onStart();\r\n effectStoreHelper.set(rootId); // important order!\r\n fromHookUpdateHelper.set(true);\r\n fiberMountHelper.reset();\r\n\r\n fiber.alternate = new Fiber({\r\n ...fiber,\r\n alternate: null,\r\n });\r\n fiber.marker = PARTIAL_UPDATE;\r\n fiber.effectTag = EffectTag.UPDATE;\r\n fiber.child = null;\r\n\r\n wipRootHelper.set(fiber);\r\n componentFiberHelper.set(fiber);\r\n fiber.instance = mountInstance(fiber, fiber.instance);\r\n nextUnitOfWorkHelper.set(fiber);\r\n };\r\n\r\n return callback;\r\n}\r\n\r\nexport { Fiber, workLoop, createHook, hasChildrenProp, createUpdateCallback };\r\n","import { platform, type ScheduleCallbackOptions } from '../platform';\r\nimport { getRootId, componentFiberHelper } from '../scope';\r\nimport { createUpdateCallback } from '../fiber';\r\nimport { useMemo } from '../use-memo';\r\nimport { dummyFn } from '../helpers';\r\n\r\nfunction useUpdate(options?: ScheduleCallbackOptions) {\r\n const rootId = getRootId();\r\n const fiber = componentFiberHelper.get();\r\n const scope = useMemo(() => ({ fiber }), []);\r\n\r\n scope.fiber = fiber;\r\n\r\n const update = (onStart?: () => void) => {\r\n const callback = createUpdateCallback({\r\n rootId,\r\n fiber: scope.fiber,\r\n forceStart: Boolean(options?.timeoutMs),\r\n onStart: onStart || dummyFn,\r\n });\r\n\r\n platform.scheduleCallback(callback, options);\r\n };\r\n\r\n return update;\r\n}\r\n\r\nexport { useUpdate };\r\n","import { useEffect } from '../use-effect';\r\nimport { useMemo } from '../use-memo';\r\nimport { componentFiberHelper } from '../scope';\r\nimport { useUpdate } from '../use-update';\r\nimport type { Fiber } from '../fiber';\r\nimport type { Context, ContextProviderValue } from '../context';\r\n\r\nfunction useContext(context: Context): T {\r\n const { defaultValue } = context;\r\n const fiber = componentFiberHelper.get();\r\n const provider = getProvider(context, fiber);\r\n const value = provider ? provider.value : defaultValue;\r\n const update = useUpdate();\r\n const scope = useMemo(() => ({ prevValue: value }), []);\r\n const hasProvider = Boolean(provider);\r\n\r\n useEffect(() => {\r\n if (!hasProvider) return;\r\n\r\n const subscriber = (newValue: T) => {\r\n if (!Object.is(scope.prevValue, newValue)) {\r\n update();\r\n }\r\n };\r\n\r\n provider.subscribers.push(subscriber);\r\n\r\n return () => {\r\n const idx = provider.subscribers.findIndex(x => x === subscriber);\r\n\r\n if (idx !== -1) {\r\n provider.subscribers.splice(idx, 1);\r\n }\r\n };\r\n }, [hasProvider]);\r\n\r\n scope.prevValue = value;\r\n\r\n return value;\r\n}\r\n\r\nfunction getProvider(context: Context, fiber: Fiber): ContextProviderValue {\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n if (nextFiber.provider && nextFiber.provider.get(context)) {\r\n return nextFiber.provider.get(context) as ContextProviderValue;\r\n }\r\n\r\n nextFiber = nextFiber.parent;\r\n }\r\n\r\n return null;\r\n}\r\n\r\nexport { useContext };\r\n","import { createComponent } from '../component';\r\nimport { useEffect } from '../use-effect';\r\nimport { componentFiberHelper } from '../scope';\r\nimport { useContext } from '../use-context';\r\nimport { detectIsFunction } from '../helpers';\r\nimport type { Context, ContexProviderProps } from './types';\r\n\r\nfunction createContext(defaultValue: T): Context {\r\n let displayName = 'Context';\r\n const context: Context = {\r\n displayName,\r\n defaultValue,\r\n Provider: null,\r\n Consumer: null,\r\n };\r\n\r\n mutateContext(context, defaultValue, displayName);\r\n\r\n Object.defineProperty(context, 'displayName', {\r\n get: () => displayName,\r\n set: (newValue: string) => {\r\n displayName = newValue;\r\n mutateContext(context, defaultValue, displayName);\r\n },\r\n });\r\n\r\n return context;\r\n}\r\n\r\nfunction mutateContext(context: Context, defaultValue: T, displayName: string) {\r\n context.Provider = createProvider(context, defaultValue, displayName);\r\n context.Consumer = createConsumer(context, displayName);\r\n}\r\n\r\nfunction createProvider(context: Context, defaultValue: T, displayName: string) {\r\n return createComponent>(\r\n ({ value = defaultValue, slot }) => {\r\n const fiber = componentFiberHelper.get();\r\n\r\n if (!fiber.provider) {\r\n fiber.provider = new Map();\r\n }\r\n\r\n if (!fiber.provider.get(context)) {\r\n fiber.provider.set(context, {\r\n subscribers: [],\r\n value,\r\n });\r\n }\r\n\r\n const provider = fiber.provider.get(context);\r\n\r\n useEffect(() => {\r\n for (const subscriber of provider.subscribers) {\r\n subscriber(value);\r\n }\r\n }, [value]);\r\n\r\n provider.value = value;\r\n\r\n return slot;\r\n },\r\n { displayName: `${displayName}.Provider` },\r\n );\r\n}\r\n\r\nfunction createConsumer(context: Context, displayName: string) {\r\n return createComponent(\r\n ({ slot }) => {\r\n const value = useContext(context);\r\n\r\n return detectIsFunction(slot) ? slot(value) : null;\r\n },\r\n { displayName: `${displayName}.Consumer` },\r\n );\r\n}\r\n\r\nexport { createContext };\r\n","import { detectIsNumber, detectIsString, detectIsFunction } from '../helpers';\r\nimport { View, Text, type TagVirtualNodeFactory } from '../view';\r\n\r\nfunction getChildren(children: Array) {\r\n children = children.map(x => (detectIsString(x) || detectIsNumber(x) ? Text(x.toString()) : x));\r\n\r\n return children ? (Array.isArray(children) ? [...children] : [children]) : [];\r\n}\r\n\r\nfunction createElement(\r\n tag: string | Function,\r\n props: any,\r\n ...children: Array\r\n): TagVirtualNodeFactory | Function | null {\r\n if (detectIsString(tag)) {\r\n return View({\r\n ...props,\r\n as: tag,\r\n slot: getChildren(children),\r\n });\r\n }\r\n\r\n if (detectIsFunction(tag)) {\r\n let slot = getChildren(children);\r\n\r\n slot = slot.length === 1 ? slot[0] : slot;\r\n\r\n return tag({ ...props, slot });\r\n }\r\n\r\n return null;\r\n}\r\n\r\nexport { createElement };\r\n","import { useMemo } from '../use-memo';\r\n\r\nfunction useCallback(callback: T, deps: Array): T {\r\n const value = useMemo(() => callback, deps);\r\n\r\n return value;\r\n}\r\n\r\nexport { useCallback };\r\n","import { type ScheduleCallbackOptions } from '../platform';\r\nimport { detectIsUndefined, detectIsFunction } from '../helpers';\r\nimport { componentFiberHelper } from '../scope';\r\nimport { useUpdate } from '../use-update';\r\nimport { useMemo } from '../use-memo';\r\nimport { useCallback } from '../use-callback';\r\nimport { TaskPriority } from '../constants';\r\n\r\ntype Value = T | ((prevValue: T) => T);\r\ntype Scope = {\r\n idx: number;\r\n values: Array;\r\n};\r\n\r\nfunction useState(initialValue: T, options?: ScheduleCallbackOptions): [T, (value: Value) => void] {\r\n const fiber = componentFiberHelper.get();\r\n const update = useUpdate(options);\r\n const scope: Scope = useMemo(\r\n () => ({\r\n idx: fiber.hook.idx,\r\n values: fiber.hook.values,\r\n }),\r\n [],\r\n );\r\n const setState = useCallback((sourceValue: Value) => {\r\n const value = scope.values[scope.idx];\r\n const newValue = detectIsFunction(sourceValue) ? sourceValue(value) : sourceValue;\r\n\r\n if (!Object.is(value, newValue)) {\r\n const setValue = () => {\r\n scope.values[scope.idx] = newValue;\r\n };\r\n\r\n if (options?.priority === TaskPriority.LOW) {\r\n update(() => setValue());\r\n } else {\r\n setValue();\r\n update();\r\n }\r\n }\r\n }, []);\r\n const { hook } = fiber;\r\n const { idx, values } = hook;\r\n const value: T = !detectIsUndefined(values[idx]) ? values[idx] : initialValue;\r\n\r\n values[idx] = value;\r\n scope.idx = idx;\r\n scope.values = values;\r\n hook.idx++;\r\n\r\n return [value, setState];\r\n}\r\n\r\nexport { useState };\r\n","import { createComponent } from '../component';\r\nimport { useState } from '../use-state';\r\nimport { createContext } from '../context';\r\nimport { useContext } from '../use-context';\r\nimport { useMemo } from '../use-memo';\r\nimport { useCallback } from '../use-callback';\r\nimport type { DarkElement } from '../shared';\r\n\r\ntype SuspenseProps = {\r\n fallback: DarkElement;\r\n};\r\n\r\ntype SuspenseContextValue = {\r\n fallback: DarkElement;\r\n isLoaded: boolean;\r\n trigger: () => void;\r\n};\r\n\r\nconst SuspenseContext = createContext({\r\n fallback: null,\r\n isLoaded: true,\r\n trigger: () => {},\r\n});\r\n\r\nconst Suspense = createComponent(({ fallback, slot }) => {\r\n if (!fallback) {\r\n throw new Error(`[Dark]: Suspense fallback not found`);\r\n }\r\n const { isLoaded: isSuspenseLoaded } = useContext(SuspenseContext);\r\n const [isLoaded, setIsLoaded] = useState(false);\r\n const trigger = useCallback(() => setIsLoaded(true), []);\r\n const value = useMemo(() => ({ fallback, isLoaded, trigger }), [fallback, isLoaded]);\r\n\r\n return SuspenseContext.Provider({\r\n value,\r\n slot: isSuspenseLoaded ? slot : null,\r\n });\r\n});\r\n\r\nexport { SuspenseContext, Suspense };\r\n","import { type Component, createComponent, detectIsComponentFactory } from '../component';\r\nimport { useState } from '../use-state';\r\nimport { useEffect } from '../use-effect';\r\nimport { forwardRef } from '../ref';\r\nimport { SuspenseContext } from '../suspense';\r\nimport { useContext } from '../use-context';\r\n\r\nconst $$lazy = Symbol('lazy');\r\n\r\ntype LazyScope = {\r\n component: Component;\r\n};\r\n\r\nfunction lazy(dynamic: () => Promise<{ default: Component

}>) {\r\n return forwardRef(\r\n createComponent(\r\n (props, ref) => {\r\n const { fallback, trigger } = useContext(SuspenseContext);\r\n const [scope, setScope] = useState>({\r\n component: null,\r\n });\r\n\r\n useEffect(() => {\r\n fetchModule(dynamic).then(component => {\r\n setScope({ component });\r\n });\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (!scope.component) return;\r\n trigger();\r\n }, [scope.component]);\r\n\r\n return scope.component ? scope.component(props, ref) : fallback;\r\n },\r\n { token: $$lazy },\r\n ),\r\n );\r\n}\r\n\r\nconst detectIsLazy = (factory: unknown) => detectIsComponentFactory(factory) && factory.token === $$lazy;\r\n\r\nfunction fetchModule(dynamic: () => Promise<{ default: Component }>) {\r\n return new Promise(resolve => {\r\n dynamic().then(module => {\r\n if (!module.default) {\r\n throw new Error('[Dark]: lazy loaded component should be exported as default!');\r\n }\r\n\r\n resolve(module.default);\r\n });\r\n });\r\n}\r\n\r\nexport { lazy, detectIsLazy };\r\n","import { useState } from '../use-state';\r\nimport { useEffect } from '../use-effect';\r\nimport { TaskPriority } from '../constants';\r\n\r\ntype UseDeferredValueOprions = {\r\n timeoutMs: number;\r\n};\r\n\r\nfunction useDeferredValue(value: T, options?: UseDeferredValueOprions): T {\r\n const { timeoutMs } = options || {};\r\n const [deferredValue, setDeferredValue] = useState(value, {\r\n priority: TaskPriority.LOW,\r\n timeoutMs,\r\n });\r\n\r\n useEffect(() => {\r\n setDeferredValue(value);\r\n }, [value]);\r\n\r\n return deferredValue;\r\n}\r\n\r\nexport { useDeferredValue };\r\n","import { componentFiberHelper } from '../scope';\r\nimport { useEffect } from '../use-effect';\r\nimport { useUpdate } from '../use-update';\r\nimport { useMemo } from '../use-memo';\r\n\r\ntype ErrorScope = {\r\n error: Error;\r\n};\r\n\r\nfunction useError(): Error | null {\r\n const fiber = componentFiberHelper.get();\r\n const update = useUpdate();\r\n const scope: ErrorScope = useMemo(() => ({ error: null }), []);\r\n\r\n fiber.catchException = (error: Error) => {\r\n scope.error = error;\r\n update();\r\n };\r\n\r\n useEffect(() => {\r\n scope.error = null;\r\n }, [scope.error]);\r\n\r\n return scope.error;\r\n}\r\n\r\nexport { useError };\r\n","import { useMemo } from '../use-memo';\r\nimport { useCallback } from '../use-callback';\r\n\r\nfunction useEvent any>(fn: T) {\r\n const scope = useMemo(() => ({ fn }), []);\r\n\r\n scope.fn = fn;\r\n\r\n const callback = useCallback((...args) => {\r\n return scope.fn(...args);\r\n }, []);\r\n\r\n return callback as unknown as T;\r\n}\r\n\r\nexport { useEvent };\r\n","import { useMemo } from '../use-memo';\r\nimport type { MutableRef } from '../ref';\r\n\r\nfunction useImperativeHandle(ref: MutableRef, createHandle: () => T, deps: Array) {\r\n const current = useMemo(() => createHandle(), deps);\r\n\r\n ref.current = current;\r\n}\r\n\r\nexport { useImperativeHandle };\r\n","import { useState } from '../use-state';\r\nimport { useCallback } from '../use-callback';\r\nimport { useMemo } from '../use-memo';\r\nimport { detectIsFunction } from '../helpers';\r\nimport type { Reducer, Dispatch, ReducerAction, ReducerState } from './types';\r\n\r\nfunction useReducer(\r\n reducer: R,\r\n initialState: ReducerState,\r\n initializer?: (state: ReducerState) => ReducerState,\r\n): [ReducerState, Dispatch>] {\r\n const initialValue = useMemo(() => {\r\n return detectIsFunction(initializer) ? initializer(initialState) : initialState;\r\n }, []);\r\n const [state, setState] = useState>(initialValue);\r\n const dispatch = useCallback((action: ReducerAction) => setState(state => reducer(state, action)), []) as Dispatch<\r\n ReducerAction\r\n >;\r\n\r\n return [state, dispatch];\r\n}\r\n\r\nexport { useReducer };\r\n","import { useMemo } from '../use-memo';\r\nimport type { MutableRef } from '../ref';\r\n\r\nfunction useRef(initialValue: T = null): MutableRef {\r\n const ref = useMemo(() => ({ current: initialValue }), []) as MutableRef;\r\n\r\n return ref;\r\n}\r\n\r\nexport { useRef };\r\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","TaskPriority","ROOT","EMPTY_NODE","ATTR_KEY","ATTR_REF","PARTIAL_UPDATE","detectIsFunction","detectIsUndefined","detectIsNumber","detectIsString","detectIsObject","detectIsBoolean","detectIsArray","Array","isArray","detectIsNull","detectIsEmpty","error","str","console","flatten","source","list","levelMap","idx","level","item","length","push","getTime","Date","now","keyBy","fn","reduce","acc","x","takeListFromEnd","count","slice","dummyFn","detectIsDepsDifferent","deps","prevDeps","i","defaultOptions","displayName","defaultProps","token","options","children","this","type","props","ref","shouldUpdate","createComponent","createElement","computedOptions","computedProps","ComponentFactory","NodeType","detectIsComponentFactory","getComponentFactoryKey","wipRoot","currentRoot","nextUnitOfWork","fromHookUpdate","events","Map","unsubscribers","deletions","fiberMount","navigation","isDeepWalking","componentFiber","effects","layoutEffects","rootId","stores","effectStoreHelper","set","id","effectStore","remove","delete","getRootId","Store","storeHelper","wipRootHelper","fiber","currentRootHelper","nextUnitOfWorkHelper","componentFiberHelper","fromHookUpdateHelper","eventsHelper","addUnsubscriber","mapUnsubscribers","forEach","deletionsHelper","fiberMountHelper","reset","getIndex","jumpToChild","nextLevel","jumpToParent","jumpToSibling","deepWalking","effectsHelper","add","effect","layoutEffectsHelper","createEffect","useEffect","hasEffects","dropEffects","store","hook","values","runEffect","undefined","cleanup","some","$$virtualNode","TAG","name","isVoid","attrs","VirtualNode","text","TEXT","COMMENT","detectIsVirtualNode","vNode","detectIsTagVirtualNode","TagVirtualNode","detectIsCommentVirtualNode","CommentVirtualNode","detectIsTextVirtualNode","TextVirtualNode","detectIsEmptyVirtualNode","getVirtualNodeKey","Text","Comment","View","def","as","slot","rest","createEmptyVirtualNode","detectIsVirtualNodeFactory","$$fragment","Fragment","detectIsFragment","forwardRef","component","detectIsRef","mutableRef","$$memo","defaultShouldUpdate","nextProps","keys","detectIsMemo","memo","Memo","processValue","getValue","isDepsDifferent","check","wrap","useMemo","hookValue","computedGetValue","EffectTag","platform","scheduleCallback","Error","shouldYeildToHost","createNativeElement","applyCommit","finishCommitWork","detectIsPortal","unmountPortal","cloneTagMap","PLACEMENT","SKIP","useLayoutEffect","hasLayoutEffects","dropLayoutEffects","walkFiber","onLoop","nextFiber","isReturn","isStopped","visitedMap","detectCanVisit","resetIsDeepWalking","stop","child","newFiber","nextSibling","parent","unmountFiber","effectHost","layoutEffectHost","portalHost","transposition","instance","unmountRoot","onComplete","nativeElement","alternate","effectTag","shadow","provider","mountedToHost","childrenCount","marker","isUsed","markPortalHost","markEffectHost","markLayoutEffectHost","markMountedToHost","setError","catchException","workLoop","wipFiber","shouldYield","hasMoreWork","Boolean","performUnitOfWork","fromHook","layoutEffect","setTimeout","commitWork","commitChanges","hasChildrenProp","performChild","performedFiber","performSibling","performPartialUpdateEffects","DELETION","getChildAlternate","getHook","Fiber","pertformInstance","mutateAlternate","mutateFiber","performMemo","performedNextFiber","performedShadow","performedInstance","childrenIdx","getNextSiblingAlternate","isDifferentKeys","getElementKey","isUpdate","getInstanceType","UPDATE","alternateType","isSameType","isSameKeys","prevKeys","nextKeys","nextKey","extractKeys","diffKeys","getDiffKeys","fibersMap","map","createFibersByKeyMap","diffCount","fibers","getSiblingFibers","performRemovingNodes","diffKeyMap","usedKeyMap","keyIdx","insertionFiber","getFibersByIdx","prevFiber","performInsertingNodes","memoFiber","alternateFactory","elements","splice","getAlternateByKey","getRootShadow","mountInstance","isComponentFactory","result","err","transformElementInstance","position","nextKeysMap","diff","element","createHook","createUpdateCallback","forceStart","onStart","useUpdate","scope","callback","timeoutMs","useContext","context","defaultValue","getProvider","update","prevValue","hasProvider","subscriber","newValue","is","subscribers","findIndex","createContext","Provider","Consumer","mutateContext","createProvider","createConsumer","getChildren","toString","tag","useCallback","useState","initialValue","setState","sourceValue","priority","LOW","SuspenseContext","fallback","isLoaded","trigger","Suspense","isSuspenseLoaded","setIsLoaded","$$lazy","lazy","dynamic","setScope","Promise","resolve","then","default","fetchModule","detectIsLazy","useDeferredValue","deferredValue","setDeferredValue","useError","useEvent","args","useImperativeHandle","createHandle","current","useReducer","reducer","initialState","initializer","state","dispatch","action","useRef"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"dark-core.production.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,WAAY,GAAIH,GACG,iBAAZC,QACdA,QAAkB,SAAID,IAEtBD,EAAe,SAAIC,IARrB,CASGK,MAAM,I,mBCRT,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBL,IACH,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,M,kzDCLhD,IAMKC,EANCC,EAAO,OACPC,EAAa,cACbC,EAAW,MACXC,EAAW,MACXC,EAAiB,kBAE9B,SAAYL,GACV,mBACA,uBACA,iBAHF,CAAYA,IAAAA,EAAY,KCJxB,IAAMM,EAAmB,SAACnB,GAA0B,MAAa,mBAANA,GAErDoB,EAAoB,SAACpB,GAA2B,YAAa,IAANA,GAEvDqB,EAAiB,SAACrB,GAAwB,MAAa,iBAANA,GAEjDsB,EAAiB,SAACtB,GAAwB,MAAa,iBAANA,GAEjDuB,EAAiB,SAACvB,GAAwB,MAAa,iBAANA,GAEjDwB,EAAkB,SAACxB,GAAyB,MAAa,kBAANA,GAEnDyB,EAAgB,SAACzB,GAA4B,OAAA0B,MAAM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,MAC7B8T,EAASR,KACTC,EAAoBpI,IAAQ,WAAM,OAAGzJ,MAAO,QAAS,IAW3D,OATAyE,EAAMsI,eAAiB,SAAC/M,GACtB6R,EAAM7R,MAAQA,EACdoS,KAGFpM,GAAU,WACR6L,EAAM7R,MAAQ,OACb,CAAC6R,EAAM7R,QAEH6R,EAAM7R,M,keCpBf,SAASiV,GAAqCjU,GAC5C,IAAM6Q,EAAQpI,IAAQ,WAAM,OAAGzI,GAAE,KAAK,IAEtC6Q,EAAM7Q,GAAKA,EAEX,IAAM8Q,EAAWuB,IAAY,W,IAAC,sDAC5B,OAAOxB,EAAM7Q,GAAE,MAAR6Q,EAAK,SAAOqD,IAAI,MACtB,IAEH,OAAOpD,ECTT,SAASqD,GAAuB9S,EAAoB+S,EAAuB3T,GACzE,IAAM4T,EAAU5L,IAAQ,WAAM,OAAA2L,MAAgB3T,GAE9CY,EAAIgT,QAAUA,ECAhB,SAASC,GACPC,EACAC,EACAC,GAEA,IAGM,E,uRAAA,CAAoBnC,GAHL7J,IAAQ,WAC3B,OAAOpK,EAAiBoW,GAAeA,EAAYD,GAAgBA,IAClE,KAC8D,GAA1DE,EAAK,KAAElC,EAAQ,KAChBmC,EAAWtC,IAAY,SAACuC,GAA6B,OAAApC,GAAS,SAAAkC,GAAS,OAAAH,EAAQG,EAAOE,QAAU,IAItG,MAAO,CAACF,EAAOC,GChBjB,SAASE,GAAUtC,GAGjB,YAHiB,IAAAA,IAAAA,EAAA,MACL9J,IAAQ,WAAM,OAAG4L,QAAS9B,KAAiB,I","sources":["webpack://DarkCore/webpack/universalModuleDefinition","webpack://DarkCore/webpack/bootstrap","webpack://DarkCore/webpack/runtime/define property getters","webpack://DarkCore/webpack/runtime/hasOwnProperty shorthand","webpack://DarkCore/webpack/runtime/make namespace object","webpack://DarkCore/./src/constants.ts","webpack://DarkCore/./src/helpers/index.ts","webpack://DarkCore/./src/component/component.ts","webpack://DarkCore/./src/view/types.ts","webpack://DarkCore/./src/scope/scope.ts","webpack://DarkCore/./src/use-effect/use-effect.ts","webpack://DarkCore/./src/view/view.ts","webpack://DarkCore/./src/fragment/fragment.ts","webpack://DarkCore/./src/ref/ref.ts","webpack://DarkCore/./src/memo/memo.ts","webpack://DarkCore/./src/use-memo/use-memo.ts","webpack://DarkCore/./src/platform/platform.ts","webpack://DarkCore/./src/fiber/types.ts","webpack://DarkCore/./src/use-layout-effect/use-layout-effect.ts","webpack://DarkCore/./src/walk/walk.ts","webpack://DarkCore/./src/unmount/unmount.ts","webpack://DarkCore/./src/fiber/fiber.ts","webpack://DarkCore/./src/use-update/use-update.ts","webpack://DarkCore/./src/use-context/use-context.ts","webpack://DarkCore/./src/context/context.ts","webpack://DarkCore/./src/element/element.ts","webpack://DarkCore/./src/use-callback/use-callback.ts","webpack://DarkCore/./src/use-state/use-state.ts","webpack://DarkCore/./src/suspense/suspense.ts","webpack://DarkCore/./src/lazy/lazy.ts","webpack://DarkCore/./src/use-deferred-value/use-deferred-value.ts","webpack://DarkCore/./src/use-error/use-error.ts","webpack://DarkCore/./src/use-event/use-event.ts","webpack://DarkCore/./src/use-imperative-handle/use-imperative-handle.ts","webpack://DarkCore/./src/use-reducer/use-reducer.ts","webpack://DarkCore/./src/use-ref/use-ref.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"DarkCore\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"DarkCore\"] = factory();\n\telse\n\t\troot[\"DarkCore\"] = factory();\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const ROOT = 'root';\r\nexport const EMPTY_NODE = 'dark:matter';\r\nexport const ATTR_KEY = 'key';\r\nexport const ATTR_REF = 'ref';\r\nexport const PARTIAL_UPDATE = 'partial-update';\r\n\r\nexport enum TaskPriority {\r\n HIGH = 2,\r\n NORMAL = 1,\r\n LOW = 0,\r\n}\r\n","import type { NestedArray } from '../shared';\r\n\r\nconst detectIsFunction = (o: any): o is Function => typeof o === 'function';\r\n\r\nconst detectIsUndefined = (o: any): o is undefined => typeof o === 'undefined';\r\n\r\nconst detectIsNumber = (o: any): o is number => typeof o === 'number';\r\n\r\nconst detectIsString = (o: any): o is string => typeof o === 'string';\r\n\r\nconst detectIsObject = (o: any): o is object => typeof o === 'object';\r\n\r\nconst detectIsBoolean = (o: any): o is boolean => typeof o === 'boolean';\r\n\r\nconst detectIsArray = (o: any): o is Array => Array.isArray(o);\r\n\r\nconst detectIsNull = (o: any): o is null => o === null;\r\n\r\nconst detectIsEmpty = (o: any) => detectIsNull(o) || detectIsUndefined(o);\r\n\r\nfunction error(str: string) {\r\n !detectIsUndefined(console) && console.error(str);\r\n}\r\n\r\nfunction flatten(source: Array>): Array {\r\n const list = [];\r\n const levelMap = { 0: { idx: 0, source } };\r\n let level = 0;\r\n\r\n do {\r\n const { source, idx } = levelMap[level];\r\n const item = source[idx];\r\n\r\n if (idx >= source.length) {\r\n level--;\r\n levelMap[level].idx++;\r\n continue;\r\n }\r\n\r\n if (detectIsArray(item)) {\r\n level++;\r\n levelMap[level] = {\r\n idx: 0,\r\n source: item,\r\n };\r\n } else {\r\n list.push(item);\r\n levelMap[level].idx++;\r\n }\r\n } while (level > 0 || levelMap[level].idx < levelMap[level].source.length);\r\n\r\n return list;\r\n}\r\n\r\nfunction getTime() {\r\n return Date.now();\r\n}\r\n\r\nfunction keyBy(\r\n list: Array,\r\n fn: (o: T) => string | number,\r\n value = false,\r\n): Record {\r\n return list.reduce((acc, x) => ((acc[fn(x)] = value ? x : true), acc), {});\r\n}\r\n\r\nfunction takeListFromEnd(source: Array, count: number) {\r\n return source.slice(source.length - count, source.length);\r\n}\r\n\r\nconst dummyFn = () => {};\r\n\r\nfunction detectIsDepsDifferent(deps: Array, prevDeps: Array): boolean {\r\n if (!detectIsUndefined(deps) && !detectIsUndefined(prevDeps) && deps.length > 0 && prevDeps.length > 0) {\r\n for (let i = 0; i < prevDeps.length; i++) {\r\n if (prevDeps[i] !== deps[i]) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n}\r\n\r\nexport {\r\n detectIsFunction,\r\n detectIsUndefined,\r\n detectIsNumber,\r\n detectIsString,\r\n detectIsObject,\r\n detectIsBoolean,\r\n detectIsArray,\r\n detectIsNull,\r\n detectIsEmpty,\r\n error,\r\n flatten,\r\n getTime,\r\n keyBy,\r\n takeListFromEnd,\r\n dummyFn,\r\n detectIsDepsDifferent,\r\n};\r\n","import { ATTR_KEY } from '../constants';\r\nimport { error, detectIsEmpty } from '../helpers';\r\nimport type { DarkElementKey, DarkElementInstance } from '../shared';\r\nimport type { MutableRef } from '../ref';\r\nimport type { CreateElement, ComponentOptions, StandardComponentProps, SlotProps } from './types';\r\n\r\nconst $$component = Symbol('component');\r\nconst defaultOptions: ComponentOptions = {\r\n displayName: '',\r\n defaultProps: {},\r\n token: $$component,\r\n};\r\nclass ComponentFactory

{\r\n public type: CreateElement

;\r\n public token: Symbol;\r\n public props: P;\r\n public ref: MutableRef;\r\n public displayName: string;\r\n public children: Array = [];\r\n public shouldUpdate?: (props: P, nextProps: P) => boolean;\r\n\r\n constructor(options: ComponentFactory

) {\r\n this.type = options.type || null;\r\n this.token = options.token || null;\r\n this.props = options.props || null;\r\n this.ref = options.ref || null;\r\n this.displayName = options.displayName || '';\r\n this.shouldUpdate = options.shouldUpdate || null;\r\n }\r\n}\r\n\r\nfunction createComponent(\r\n createElement: CreateElement

,\r\n options: ComponentOptions

= {},\r\n) {\r\n type Props = P & StandardComponentProps;\r\n const computedOptions = { ...defaultOptions, ...options };\r\n const { token, defaultProps, displayName, shouldUpdate } = computedOptions;\r\n\r\n return (props = {} as Props, ref?: MutableRef): ComponentFactory => {\r\n const computedProps = { ...defaultProps, ...props };\r\n const factory = new ComponentFactory({\r\n token,\r\n ref,\r\n displayName,\r\n shouldUpdate,\r\n props: computedProps,\r\n type: createElement,\r\n children: [],\r\n });\r\n\r\n if (computedProps.ref) {\r\n delete computedProps.ref;\r\n\r\n if (process.env.NODE_ENV === 'development') {\r\n error(`[Dark]: To use ref you need to wrap the createComponent with forwardRef!`);\r\n }\r\n }\r\n\r\n return factory;\r\n };\r\n}\r\n\r\nconst detectIsComponentFactory = (factory: unknown): factory is ComponentFactory => factory instanceof ComponentFactory;\r\n\r\nconst getComponentFactoryKey = (factory: ComponentFactory): DarkElementKey =>\r\n !detectIsEmpty(factory.props[ATTR_KEY]) ? factory.props[ATTR_KEY] : null;\r\n\r\nexport { ComponentFactory, createComponent, detectIsComponentFactory, getComponentFactoryKey };\r\n","export type ViewDef = {\r\n as: string;\r\n slot?: any;\r\n isVoid?: boolean;\r\n [prop: string]: any;\r\n};\r\n\r\nexport enum NodeType {\r\n TAG = 'TAG',\r\n TEXT = 'TEXT',\r\n COMMENT = 'COMMENT',\r\n}\r\n","import type { Fiber } from '../fiber';\r\n\r\nclass Store {\r\n public wipRoot: Fiber = null;\r\n public currentRoot: Fiber = null;\r\n public nextUnitOfWork: Fiber = null;\r\n public fromHookUpdate = false;\r\n public events: Map> = new Map();\r\n public unsubscribers: Array<() => void> = [];\r\n public deletions: Array = [];\r\n public fiberMount = {\r\n level: 0,\r\n navigation: {},\r\n isDeepWalking: true,\r\n };\r\n public componentFiber: Fiber = null;\r\n public effects: Array<() => void> = [];\r\n public layoutEffects: Array<() => void> = [];\r\n}\r\n\r\nlet rootId = null;\r\nconst stores = new Map();\r\n\r\nconst effectStoreHelper = {\r\n set: (id: number) => effectStore(id),\r\n remove: (id: number) => stores.delete(id),\r\n};\r\n\r\nconst getRootId = (): number => rootId;\r\n\r\nconst effectStore = (id: number) => {\r\n rootId = id;\r\n !stores.get(rootId) && stores.set(rootId, new Store());\r\n};\r\n\r\nconst storeHelper = {\r\n get: (id: number = rootId) => stores.get(id),\r\n};\r\n\r\nconst wipRootHelper = {\r\n get: () => storeHelper.get()?.wipRoot || null,\r\n set: (fiber: Fiber) => (storeHelper.get().wipRoot = fiber),\r\n};\r\n\r\nconst currentRootHelper = {\r\n get: (id?: number) => storeHelper.get(id)?.currentRoot || null,\r\n set: (fiber: Fiber) => (storeHelper.get().currentRoot = fiber),\r\n};\r\n\r\nconst nextUnitOfWorkHelper = {\r\n get: () => storeHelper.get()?.nextUnitOfWork || null,\r\n set: (fiber: Fiber) => (storeHelper.get().nextUnitOfWork = fiber),\r\n};\r\n\r\nconst componentFiberHelper = {\r\n get: () => storeHelper.get()?.componentFiber,\r\n set: (fiber: Fiber) => (storeHelper.get().componentFiber = fiber),\r\n};\r\n\r\nconst fromHookUpdateHelper = {\r\n get: () => storeHelper.get()?.fromHookUpdate || false,\r\n set: (value: boolean) => (storeHelper.get().fromHookUpdate = value),\r\n};\r\n\r\nconst eventsHelper = {\r\n get: () => storeHelper.get().events,\r\n addUnsubscriber: (fn: () => void) => storeHelper.get().unsubscribers.push(fn),\r\n mapUnsubscribers: (id: number) => storeHelper.get(id).unsubscribers.forEach(fn => fn()),\r\n};\r\n\r\nconst deletionsHelper = {\r\n get: () => storeHelper.get().deletions,\r\n set: (deletions: Array) => (storeHelper.get().deletions = deletions),\r\n};\r\n\r\nconst fiberMountHelper = {\r\n reset: () => {\r\n storeHelper.get().fiberMount = {\r\n level: 0,\r\n navigation: {},\r\n isDeepWalking: true,\r\n };\r\n },\r\n getIndex: () => storeHelper.get().fiberMount.navigation[storeHelper.get().fiberMount.level],\r\n jumpToChild: () => {\r\n const { fiberMount } = storeHelper.get();\r\n const level = fiberMount.level;\r\n const nextLevel = level + 1;\r\n\r\n fiberMount.level = nextLevel;\r\n fiberMount.navigation[nextLevel] = 0;\r\n },\r\n jumpToParent: () => {\r\n const { fiberMount } = storeHelper.get();\r\n const level = fiberMount.level;\r\n const nextLevel = level - 1;\r\n\r\n fiberMount.navigation[level] = 0;\r\n fiberMount.level = nextLevel;\r\n },\r\n jumpToSibling: () => {\r\n const { fiberMount } = storeHelper.get();\r\n const level = fiberMount.level;\r\n const idx = fiberMount.navigation[level] + 1;\r\n\r\n fiberMount.navigation[level] = idx;\r\n },\r\n deepWalking: {\r\n get: () => storeHelper.get().fiberMount.isDeepWalking,\r\n set: (value: boolean) => (storeHelper.get().fiberMount.isDeepWalking = value),\r\n },\r\n};\r\n\r\nconst effectsHelper = {\r\n get: () => storeHelper.get().effects,\r\n reset: () => (storeHelper.get().effects = []),\r\n add: (effect: () => void) => storeHelper.get().effects.push(effect),\r\n};\r\n\r\nconst layoutEffectsHelper = {\r\n get: () => storeHelper.get().layoutEffects,\r\n reset: () => (storeHelper.get().layoutEffects = []),\r\n add: (effect: () => void) => storeHelper.get().layoutEffects.push(effect),\r\n};\r\n\r\nexport {\r\n getRootId,\r\n effectStoreHelper,\r\n wipRootHelper,\r\n currentRootHelper,\r\n nextUnitOfWorkHelper,\r\n componentFiberHelper,\r\n fromHookUpdateHelper,\r\n eventsHelper,\r\n deletionsHelper,\r\n fiberMountHelper,\r\n effectsHelper,\r\n layoutEffectsHelper,\r\n};\r\n","import { detectIsUndefined, detectIsFunction, detectIsDepsDifferent } from '../helpers';\r\nimport { componentFiberHelper, effectsHelper } from '../scope';\r\nimport type { Fiber, Hook, HookValue } from '../fiber';\r\nimport type { Effect, DropEffect } from './types';\r\n\r\nconst $$useEffect = Symbol('use-effect');\r\n\r\nconst { useEffect, hasEffects, dropEffects } = createEffect($$useEffect, effectsHelper);\r\n\r\nfunction createEffect(token: Symbol, store: typeof effectsHelper) {\r\n function useEffect(effect: Effect, deps?: Array) {\r\n const fiber = componentFiberHelper.get();\r\n const hook = fiber.hook as Hook>;\r\n const { idx, values } = hook;\r\n const runEffect = () => {\r\n values[idx] = {\r\n deps,\r\n token,\r\n value: undefined,\r\n };\r\n\r\n store.add(() => {\r\n values[idx].value = effect();\r\n });\r\n };\r\n\r\n if (detectIsUndefined(values[idx])) {\r\n runEffect();\r\n } else {\r\n const { deps: prevDeps, value: cleanup } = values[idx];\r\n const isDepsDifferent = deps ? detectIsDepsDifferent(deps, prevDeps) : true;\r\n\r\n if (isDepsDifferent) {\r\n detectIsFunction(cleanup) && cleanup();\r\n runEffect();\r\n }\r\n }\r\n\r\n hook.idx++;\r\n }\r\n\r\n function hasEffects(fiber: Fiber) {\r\n const { values } = fiber.hook as Hook;\r\n const hasEffect = values.some(x => x.token === token);\r\n\r\n return hasEffect;\r\n }\r\n\r\n function dropEffects(hook: Hook>) {\r\n const { values } = hook;\r\n\r\n for (const value of values) {\r\n if (value.token === token) {\r\n const cleanup = value.value;\r\n\r\n detectIsFunction(cleanup) && cleanup();\r\n }\r\n }\r\n }\r\n\r\n return {\r\n useEffect,\r\n hasEffects,\r\n dropEffects,\r\n };\r\n}\r\n\r\nexport { useEffect, hasEffects, dropEffects, createEffect };\r\n","import { EMPTY_NODE, ATTR_KEY } from '../constants';\r\nimport { detectIsArray, detectIsEmpty, detectIsFunction, detectIsString } from '../helpers';\r\nimport type { DarkElementKey } from '../shared';\r\nimport type { ComponentFactory, StandardComponentProps } from '../component';\r\nimport { NodeType, type ViewDef } from './types';\r\n\r\nexport type VirtualNodeFactory = () => VirtualNode;\r\nexport type TagVirtualNodeFactory = () => TagVirtualNode;\r\nexport type TextVirtualNodeFactory = () => TextVirtualNode;\r\nexport type CommentVirtualNodeFactory = () => CommentVirtualNode;\r\n\r\nconst $$virtualNode = Symbol('virtual-node');\r\n\r\nclass VirtualNode {\r\n public type: NodeType = null;\r\n\r\n constructor(options: Partial) {\r\n this.type = options.type;\r\n }\r\n}\r\n\r\nclass TagVirtualNode extends VirtualNode {\r\n public type = NodeType.TAG;\r\n public name: string = null;\r\n public isVoid = false;\r\n public attrs: Record = {};\r\n public children: Array = [];\r\n\r\n constructor(options: Partial) {\r\n super(options);\r\n this.name = options.name || this.name;\r\n this.isVoid = options.isVoid || this.isVoid;\r\n this.attrs = options.attrs || this.attrs;\r\n this.children = options.children || this.children;\r\n }\r\n}\r\n\r\nclass TextVirtualNode extends VirtualNode {\r\n public type = NodeType.TEXT;\r\n public value = '';\r\n\r\n constructor(text: string) {\r\n super({});\r\n this.value = text;\r\n }\r\n}\r\n\r\nclass CommentVirtualNode extends VirtualNode {\r\n public type = NodeType.COMMENT;\r\n public value = '';\r\n\r\n constructor(text: string) {\r\n super({});\r\n this.value = text;\r\n }\r\n}\r\n\r\nconst detectIsVirtualNode = (vNode: unknown): vNode is VirtualNode => vNode instanceof VirtualNode;\r\n\r\nconst detectIsTagVirtualNode = (vNode: unknown): vNode is TagVirtualNode => vNode instanceof TagVirtualNode;\r\n\r\nconst detectIsCommentVirtualNode = (vNode: unknown): vNode is CommentVirtualNode => vNode instanceof CommentVirtualNode;\r\n\r\nconst detectIsTextVirtualNode = (vNode: unknown): vNode is TextVirtualNode => vNode instanceof TextVirtualNode;\r\n\r\nconst detectIsEmptyVirtualNode = (vNode: unknown): boolean =>\r\n detectIsCommentVirtualNode(vNode) && vNode.value === EMPTY_NODE;\r\n\r\nfunction getVirtualNodeKey(vNode: TagVirtualNode): DarkElementKey | null {\r\n const key = vNode && vNode.attrs[ATTR_KEY];\r\n\r\n return !detectIsEmpty(key) ? key : null;\r\n}\r\n\r\nconst createEmptyVirtualNode = () => new CommentVirtualNode(EMPTY_NODE);\r\n\r\nconst detectIsVirtualNodeFactory = (factory: unknown): factory is VirtualNodeFactory =>\r\n detectIsFunction(factory) && factory[$$virtualNode] === true;\r\n\r\nfunction View(def: ViewDef): TagVirtualNodeFactory {\r\n const factory = () => {\r\n const { as, slot, isVoid = false, ...rest } = def;\r\n const children = isVoid ? [] : detectIsArray(slot) ? slot : slot ? [slot] : [];\r\n\r\n return new TagVirtualNode({\r\n name: as,\r\n isVoid,\r\n attrs: { ...rest },\r\n children: children as Array,\r\n });\r\n };\r\n\r\n factory[$$virtualNode] = true;\r\n\r\n return factory;\r\n}\r\n\r\nfunction Text(source: string | StandardComponentProps['slot']): string | TextVirtualNode {\r\n const text = detectIsString(source)\r\n ? new TextVirtualNode(source)\r\n : detectIsTextVirtualNode(source)\r\n ? source.value\r\n : '';\r\n\r\n return text;\r\n}\r\n\r\nfunction Comment(text: string): CommentVirtualNodeFactory {\r\n const factory = () => new CommentVirtualNode(text);\r\n\r\n factory[$$virtualNode] = true;\r\n\r\n return factory;\r\n}\r\n\r\nexport {\r\n VirtualNode,\r\n TagVirtualNode,\r\n TextVirtualNode,\r\n CommentVirtualNode,\r\n detectIsVirtualNode,\r\n detectIsTagVirtualNode,\r\n detectIsCommentVirtualNode,\r\n detectIsTextVirtualNode,\r\n detectIsEmptyVirtualNode,\r\n getVirtualNodeKey,\r\n createEmptyVirtualNode,\r\n detectIsVirtualNodeFactory,\r\n View,\r\n Text,\r\n Comment,\r\n};\r\n","import { type KeyProps, createComponent, detectIsComponentFactory } from '../component';\r\n\r\nconst $$fragment = Symbol('fragment');\r\n\r\nconst Fragment = createComponent(({ slot }) => slot || null, {\r\n token: $$fragment,\r\n});\r\n\r\nconst detectIsFragment = (factory: unknown) => detectIsComponentFactory(factory) && factory.token === $$fragment;\r\n\r\nexport { Fragment, detectIsFragment };\r\n","import { detectIsObject, detectIsNull } from '../helpers';\r\nimport type { Component, RefProps, ComponentFactory } from '../component';\r\nimport type { MutableRef } from './types';\r\n\r\nfunction forwardRef(component: Component) {\r\n type Props = P & RefProps;\r\n\r\n return ({ ref, ...rest }: Props) => {\r\n return component(rest as P, ref) as ComponentFactory;\r\n };\r\n}\r\n\r\nconst detectIsRef = (ref: unknown) => {\r\n if (!detectIsObject(ref) || detectIsNull(ref)) return false;\r\n const mutableRef = ref as MutableRef;\r\n\r\n for (const key in mutableRef) {\r\n if (key === 'current' && mutableRef.hasOwnProperty(key)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n};\r\n\r\nexport { forwardRef, detectIsRef };\r\n","import {\r\n type Component,\r\n type ComponentFactory,\r\n type StandardComponentProps,\r\n type RefProps,\r\n type SlotProps,\r\n createComponent,\r\n detectIsComponentFactory,\r\n} from '../component';\r\nimport { type MutableRef, forwardRef } from '../ref';\r\n\r\ntype ShouldUpdate = (props: T, nextProps: T) => boolean;\r\n\r\nconst $$memo = Symbol('memo');\r\n\r\nconst defaultShouldUpdate = (props: {}, nextProps: {}): boolean => {\r\n const keys = Object.keys(nextProps);\r\n\r\n for (const key of keys) {\r\n if (key !== 'slot' && nextProps[key] !== props[key]) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n};\r\n\r\nconst detectIsMemo = (factory: unknown) => detectIsComponentFactory(factory) && factory.token === $$memo;\r\n\r\nfunction memo(\r\n component: (props: T, ref?: MutableRef) => ComponentFactory,\r\n shouldUpdate: ShouldUpdate = defaultShouldUpdate,\r\n): Component {\r\n return forwardRef(\r\n createComponent(\r\n (props: T & RefProps, ref) => {\r\n ref && (props.ref = ref);\r\n\r\n return component(props);\r\n },\r\n { token: $$memo, shouldUpdate },\r\n ),\r\n );\r\n}\r\n\r\nexport { $$memo, memo, detectIsMemo };\r\n","import { type DarkElement } from '../shared';\r\nimport { detectIsUndefined, detectIsArray, detectIsDepsDifferent } from '../helpers';\r\nimport { detectIsComponentFactory, createComponent } from '../component';\r\nimport { detectIsVirtualNodeFactory } from '../view';\r\nimport { componentFiberHelper } from '../scope';\r\nimport { Fragment } from '../fragment';\r\nimport { $$memo } from '../memo';\r\n\r\nconst Memo = createComponent(({ slot }) => slot, { token: $$memo });\r\n\r\nfunction wrap(value: T, isDepsDifferent: boolean) {\r\n const check = (value: T) => detectIsVirtualNodeFactory(value) || detectIsComponentFactory(value);\r\n\r\n if (detectIsArray(value) ? check(value[0]) : check(value)) {\r\n const slot = value as unknown as DarkElement;\r\n const factory = Memo({\r\n slot: Fragment({ slot }),\r\n });\r\n\r\n factory.shouldUpdate = () => isDepsDifferent;\r\n\r\n return factory;\r\n }\r\n\r\n return value;\r\n}\r\n\r\nfunction processValue(getValue: () => T, isDepsDifferent = false) {\r\n return wrap(getValue(), isDepsDifferent);\r\n}\r\n\r\nfunction useMemo(getValue: () => T, deps: Array): T {\r\n const fiber = componentFiberHelper.get();\r\n const { hook } = fiber;\r\n const { idx, values } = hook;\r\n\r\n if (detectIsUndefined(values[idx])) {\r\n const value = processValue(getValue);\r\n\r\n values[idx] = {\r\n deps,\r\n value,\r\n };\r\n\r\n hook.idx++;\r\n\r\n return value as T;\r\n }\r\n\r\n const hookValue = values[idx];\r\n const prevDeps = hookValue.deps as Array;\r\n const isDepsDifferent = detectIsDepsDifferent(deps, prevDeps);\r\n const computedGetValue = isDepsDifferent ? getValue : () => hookValue.value;\r\n\r\n hookValue.deps = deps;\r\n hookValue.value = processValue(computedGetValue, isDepsDifferent);\r\n\r\n hook.idx++;\r\n\r\n return hookValue.value;\r\n}\r\n\r\nexport { useMemo };\r\n","import type { Platform } from './types';\r\n\r\nexport const platform: Platform = {\r\n scheduleCallback: () => {\r\n throw new Error('scheduleCallback not installed by renderer');\r\n },\r\n shouldYeildToHost: () => {\r\n throw new Error('shouldYeildToHost not installed by renderer');\r\n },\r\n createNativeElement: () => {\r\n throw new Error('createNativeElement not installed by renderer');\r\n },\r\n applyCommit: () => {\r\n throw new Error('applyCommit not installed by renderer');\r\n },\r\n finishCommitWork: () => {\r\n throw new Error('finishCommitWork not installed by renderer');\r\n },\r\n detectIsPortal: () => {\r\n throw new Error('detectIsPortal not installed by renderer');\r\n },\r\n unmountPortal: () => {\r\n throw new Error('unmountPortal not installed by renderer');\r\n },\r\n};\r\n","export enum EffectTag {\r\n PLACEMENT = 'PLACEMENT',\r\n UPDATE = 'UPDATE',\r\n DELETION = 'DELETION',\r\n SKIP = 'SKIP',\r\n}\r\n\r\nexport type NativeElement = unknown;\r\n\r\nexport type HookValue = {\r\n token?: Symbol;\r\n deps: Array;\r\n value: T;\r\n};\r\n\r\nexport type Hook = {\r\n idx: number;\r\n values: Array;\r\n};\r\n\r\nexport const cloneTagMap = {\r\n [EffectTag.PLACEMENT]: true,\r\n [EffectTag.SKIP]: true,\r\n};\r\n","import { layoutEffectsHelper } from '../scope';\r\nimport { createEffect } from '../use-effect';\r\n\r\nconst $$useLayoutEffect = Symbol('use-layout-effect');\r\n\r\nconst {\r\n useEffect: useLayoutEffect,\r\n hasEffects: hasLayoutEffects,\r\n dropEffects: dropLayoutEffects,\r\n} = createEffect($$useLayoutEffect, layoutEffectsHelper);\r\n\r\nexport { useLayoutEffect, hasLayoutEffects, dropLayoutEffects };\r\n","import { type Fiber } from '../fiber';\r\n\r\ntype WalkFiberOptions = {\r\n fiber: Fiber;\r\n onLoop: (options: OnLoopOptions) => void;\r\n};\r\n\r\ntype OnLoopOptions = {\r\n nextFiber: Fiber;\r\n isReturn: boolean;\r\n resetIsDeepWalking: () => void;\r\n stop: () => void;\r\n};\r\n\r\nfunction walkFiber(options: WalkFiberOptions) {\r\n const { fiber, onLoop } = options;\r\n let nextFiber = fiber;\r\n let isDeepWalking = true;\r\n let isReturn = false;\r\n let isStopped = false;\r\n const visitedMap = new Map();\r\n const detectCanVisit = (fiber: Fiber) => !visitedMap.get(fiber);\r\n\r\n while (nextFiber) {\r\n onLoop({\r\n nextFiber: nextFiber as Fiber,\r\n isReturn,\r\n resetIsDeepWalking: () => (isDeepWalking = false),\r\n stop: () => (isStopped = true),\r\n });\r\n\r\n if (isStopped) {\r\n break;\r\n }\r\n\r\n if (nextFiber.child && isDeepWalking && detectCanVisit(nextFiber.child)) {\r\n const newFiber = nextFiber.child;\r\n\r\n isReturn = false;\r\n nextFiber = newFiber;\r\n visitedMap.set(newFiber, true);\r\n } else if (nextFiber.nextSibling && detectCanVisit(nextFiber.nextSibling)) {\r\n const newFiber = nextFiber.nextSibling;\r\n\r\n isDeepWalking = true;\r\n isReturn = false;\r\n nextFiber = newFiber;\r\n visitedMap.set(newFiber, true);\r\n } else if (\r\n nextFiber.parent &&\r\n nextFiber.parent === fiber &&\r\n nextFiber.parent.nextSibling &&\r\n detectCanVisit(nextFiber.parent.nextSibling)\r\n ) {\r\n const newFiber = nextFiber.parent.nextSibling;\r\n\r\n isDeepWalking = true;\r\n isReturn = false;\r\n nextFiber = newFiber;\r\n visitedMap.set(newFiber, true);\r\n } else if (nextFiber.parent && nextFiber.parent !== fiber) {\r\n isDeepWalking = false;\r\n isReturn = true;\r\n nextFiber = nextFiber.parent;\r\n } else {\r\n nextFiber = null;\r\n }\r\n }\r\n}\r\n\r\nexport { walkFiber };\r\n","import { type Fiber } from '../fiber';\r\nimport { platform } from '../platform';\r\nimport { detectIsComponentFactory } from '../component';\r\nimport { dropEffects } from '../use-effect';\r\nimport { dropLayoutEffects } from '../use-layout-effect';\r\nimport { walkFiber } from '../walk';\r\nimport { detectIsUndefined } from '../helpers';\r\nimport { currentRootHelper, eventsHelper, effectStoreHelper } from '../scope';\r\n\r\nfunction unmountFiber(fiber: Fiber) {\r\n if (!fiber.effectHost && !fiber.layoutEffectHost && !fiber.portalHost) return;\r\n\r\n walkFiber({\r\n fiber,\r\n onLoop: ({ nextFiber, isReturn, stop }) => {\r\n if (nextFiber === fiber.nextSibling || fiber.transposition) return stop();\r\n\r\n if (!isReturn && detectIsComponentFactory(nextFiber.instance)) {\r\n nextFiber.layoutEffectHost && dropLayoutEffects(nextFiber.hook);\r\n nextFiber.effectHost && dropEffects(nextFiber.hook);\r\n nextFiber.portalHost && platform.unmountPortal(nextFiber);\r\n }\r\n },\r\n });\r\n}\r\n\r\nfunction unmountRoot(rootId: number, onComplete: () => void) {\r\n if (detectIsUndefined(rootId)) return;\r\n\r\n unmountFiber(currentRootHelper.get(rootId));\r\n eventsHelper.mapUnsubscribers(rootId);\r\n effectStoreHelper.remove(rootId);\r\n onComplete();\r\n}\r\n\r\nexport { unmountFiber, unmountRoot };\r\n","import { flatten, detectIsEmpty, error, keyBy, takeListFromEnd, detectIsUndefined, detectIsArray } from '../helpers';\r\nimport { platform } from '../platform';\r\nimport {\r\n wipRootHelper,\r\n currentRootHelper,\r\n nextUnitOfWorkHelper,\r\n deletionsHelper,\r\n fiberMountHelper,\r\n componentFiberHelper,\r\n fromHookUpdateHelper,\r\n effectStoreHelper,\r\n effectsHelper,\r\n layoutEffectsHelper,\r\n} from '../scope';\r\nimport { type ComponentFactory, detectIsComponentFactory, getComponentFactoryKey } from '../component';\r\nimport {\r\n type TagVirtualNode,\r\n detectIsTagVirtualNode,\r\n createEmptyVirtualNode,\r\n getVirtualNodeKey,\r\n detectIsVirtualNode,\r\n detectIsVirtualNodeFactory,\r\n} from '../view';\r\nimport { detectIsMemo } from '../memo';\r\nimport type { Context, ContextProviderValue } from '../context';\r\nimport type { DarkElementKey, DarkElement, DarkElementInstance } from '../shared';\r\nimport { PARTIAL_UPDATE } from '../constants';\r\nimport { type NativeElement, type Hook, EffectTag, cloneTagMap } from './types';\r\nimport { hasEffects } from '../use-effect';\r\nimport { hasLayoutEffects } from '../use-layout-effect';\r\nimport { walkFiber } from '../walk';\r\nimport { unmountFiber } from '../unmount';\r\n\r\nclass Fiber {\r\n public nativeElement: N;\r\n public parent: Fiber;\r\n public child: Fiber;\r\n public nextSibling: Fiber;\r\n public alternate: Fiber;\r\n public effectTag: EffectTag;\r\n public instance: DarkElementInstance;\r\n public hook: Hook;\r\n public shadow: Fiber;\r\n public provider: Map;\r\n public transposition: boolean;\r\n public mountedToHost: boolean;\r\n public portalHost: boolean;\r\n public effectHost: boolean;\r\n public layoutEffectHost: boolean;\r\n public childrenCount: number;\r\n public marker: string;\r\n public isUsed: boolean;\r\n public idx: number;\r\n public catchException: (error: Error) => void;\r\n\r\n constructor(options: Partial>) {\r\n this.nativeElement = options.nativeElement || null;\r\n this.parent = options.parent || null;\r\n this.child = options.child || null;\r\n this.nextSibling = options.nextSibling || null;\r\n this.alternate = options.alternate || null;\r\n this.effectTag = options.effectTag || null;\r\n this.instance = options.instance || null;\r\n this.hook = options.hook || createHook();\r\n this.shadow = options.shadow || null;\r\n this.provider = options.provider || null;\r\n this.transposition = !detectIsUndefined(options.transposition) ? options.transposition : false;\r\n this.mountedToHost = !detectIsUndefined(options.mountedToHost) || false;\r\n this.portalHost = !detectIsUndefined(options.portalHost) ? options.portalHost : false;\r\n this.effectHost = !detectIsUndefined(options.effectHost) ? options.effectHost : false;\r\n this.layoutEffectHost = !detectIsUndefined(options.layoutEffectHost) ? options.layoutEffectHost : false;\r\n this.childrenCount = options.childrenCount || 0;\r\n this.marker = options.marker || '';\r\n this.idx = options.idx || 0;\r\n this.isUsed = options.isUsed || false;\r\n }\r\n\r\n public markPortalHost() {\r\n this.portalHost = true;\r\n this.parent && !this.parent.portalHost && this.parent.markPortalHost();\r\n }\r\n\r\n public markEffectHost() {\r\n this.effectHost = true;\r\n this.parent && !this.parent.effectHost && this.parent.markEffectHost();\r\n }\r\n\r\n public markLayoutEffectHost() {\r\n this.layoutEffectHost = true;\r\n this.parent && !this.parent.layoutEffectHost && this.parent.markLayoutEffectHost();\r\n }\r\n\r\n public markMountedToHost() {\r\n this.mountedToHost = true;\r\n this.parent && !this.parent.mountedToHost && this.parent.markMountedToHost();\r\n }\r\n\r\n public setError(error: Error) {\r\n if (typeof this.catchException === 'function') {\r\n this.catchException(error);\r\n } else if (this.parent) {\r\n this.parent.setError(error);\r\n }\r\n }\r\n}\r\n\r\nfunction workLoop() {\r\n const wipFiber = wipRootHelper.get();\r\n let nextUnitOfWork = nextUnitOfWorkHelper.get();\r\n let shouldYield = false;\r\n let hasMoreWork = Boolean(nextUnitOfWork);\r\n\r\n while (nextUnitOfWork && !shouldYield) {\r\n nextUnitOfWork = performUnitOfWork(nextUnitOfWork);\r\n nextUnitOfWorkHelper.set(nextUnitOfWork);\r\n hasMoreWork = Boolean(nextUnitOfWork);\r\n shouldYield = platform.shouldYeildToHost();\r\n }\r\n\r\n if (!nextUnitOfWork && wipFiber) {\r\n commitChanges();\r\n }\r\n\r\n return hasMoreWork;\r\n}\r\n\r\nfunction performUnitOfWork(fiber: Fiber) {\r\n let isDeepWalking = true;\r\n let nextFiber = fiber;\r\n let shadow: Fiber = fiber.shadow;\r\n let instance = fiber.instance;\r\n\r\n while (true) {\r\n isDeepWalking = fiberMountHelper.deepWalking.get();\r\n nextFiber.hook.idx = 0;\r\n\r\n if (isDeepWalking) {\r\n const hasChildren = hasChildrenProp(instance) && instance.children.length > 0;\r\n\r\n if (hasChildren) {\r\n const { performedFiber, performedNextFiber, performedShadow, performedInstance } = performChild({\r\n nextFiber,\r\n shadow,\r\n instance,\r\n });\r\n\r\n nextFiber = performedNextFiber;\r\n shadow = performedShadow;\r\n instance = performedInstance;\r\n\r\n if (performedFiber) return performedFiber;\r\n } else {\r\n const { performedFiber, performedNextFiber, performedShadow, performedInstance } = performSibling({\r\n nextFiber,\r\n shadow,\r\n instance,\r\n });\r\n\r\n nextFiber = performedNextFiber;\r\n shadow = performedShadow;\r\n instance = performedInstance;\r\n\r\n if (performedFiber) return performedFiber;\r\n }\r\n } else {\r\n const { performedFiber, performedNextFiber, performedShadow, performedInstance } = performSibling({\r\n nextFiber,\r\n shadow,\r\n instance,\r\n });\r\n\r\n nextFiber = performedNextFiber;\r\n shadow = performedShadow;\r\n instance = performedInstance;\r\n\r\n if (performedFiber) return performedFiber;\r\n }\r\n\r\n performPartialUpdateEffects(nextFiber);\r\n\r\n if (nextFiber.parent === null) return null;\r\n }\r\n}\r\n\r\nfunction performPartialUpdateEffects(nextFiber: Fiber) {\r\n if (nextFiber.marker === PARTIAL_UPDATE) {\r\n const alternate = nextFiber.child?.alternate || null;\r\n const fiber = nextFiber.child || null;\r\n\r\n if (alternate && fiber && alternate.nextSibling && !fiber.nextSibling) {\r\n let nextFiber = alternate.nextSibling;\r\n const deletions: Array = [];\r\n\r\n while (nextFiber) {\r\n nextFiber.effectTag = EffectTag.DELETION;\r\n deletions.push(nextFiber);\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n deletionsHelper.get().push(...deletions);\r\n }\r\n }\r\n}\r\n\r\ntype PerformChildOptions = {\r\n nextFiber: Fiber;\r\n shadow: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction performChild(options: PerformChildOptions) {\r\n fiberMountHelper.jumpToChild();\r\n let nextFiber = options.nextFiber;\r\n let shadow = options.shadow;\r\n let instance = options.instance;\r\n\r\n shadow = shadow ? shadow.child : null;\r\n\r\n const alternate = getChildAlternate(nextFiber);\r\n const hook = getHook({ shadow, alternate, instance });\r\n const provider = shadow ? shadow.provider : alternate ? alternate.provider : null;\r\n let fiber = new Fiber({ hook, provider });\r\n\r\n componentFiberHelper.set(fiber);\r\n fiber.parent = nextFiber;\r\n\r\n const { performedInstance, performedShadow } = pertformInstance({\r\n instance,\r\n idx: 0,\r\n fiber,\r\n alternate,\r\n });\r\n instance = performedInstance || instance;\r\n shadow = performedShadow || shadow;\r\n alternate && mutateAlternate({ alternate, instance });\r\n mutateFiber({ fiber, alternate, instance });\r\n fiber = alternate ? performMemo({ fiber, alternate, instance }) : fiber;\r\n\r\n fiber.idx = 0;\r\n\r\n nextFiber.child = fiber;\r\n fiber.parent = nextFiber;\r\n fiber.shadow = shadow;\r\n nextFiber = fiber;\r\n\r\n cloneTagMap[fiber.parent.effectTag] && (fiber.effectTag = fiber.parent.effectTag);\r\n\r\n return {\r\n performedFiber: nextFiber,\r\n performedNextFiber: nextFiber,\r\n performedShadow: shadow,\r\n performedInstance: instance,\r\n };\r\n}\r\n\r\ntype PerformSiblingOptions = {\r\n nextFiber: Fiber;\r\n shadow: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction performSibling(options: PerformSiblingOptions) {\r\n fiberMountHelper.jumpToSibling();\r\n let nextFiber = options.nextFiber;\r\n let shadow = options.shadow;\r\n let instance = options.instance;\r\n const parent = nextFiber.parent.instance;\r\n const childrenIdx = fiberMountHelper.getIndex();\r\n const hasSibling = hasChildrenProp(parent) && parent.children[childrenIdx];\r\n\r\n if (hasSibling) {\r\n fiberMountHelper.deepWalking.set(true);\r\n\r\n shadow = shadow ? shadow.nextSibling : null;\r\n const alternate = getNextSiblingAlternate(nextFiber);\r\n const hook = getHook({ shadow, alternate, instance });\r\n const provider = shadow ? shadow.provider : alternate ? alternate.provider : null;\r\n let fiber = new Fiber({ hook, provider });\r\n\r\n componentFiberHelper.set(fiber);\r\n fiber.parent = nextFiber.parent;\r\n\r\n const { performedInstance, performedShadow } = pertformInstance({\r\n instance: parent,\r\n idx: childrenIdx,\r\n fiber,\r\n alternate,\r\n });\r\n instance = performedInstance || instance;\r\n shadow = performedShadow || shadow;\r\n alternate && mutateAlternate({ alternate, instance });\r\n mutateFiber({ fiber, alternate, instance });\r\n fiber = alternate ? performMemo({ fiber, alternate, instance }) : fiber;\r\n\r\n fiber.idx = childrenIdx;\r\n\r\n fiber.parent = nextFiber.parent;\r\n nextFiber.nextSibling = fiber;\r\n fiber.shadow = shadow;\r\n nextFiber = fiber;\r\n\r\n cloneTagMap[fiber.parent.effectTag] && (fiber.effectTag = fiber.parent.effectTag);\r\n\r\n return {\r\n performedFiber: nextFiber,\r\n performedNextFiber: nextFiber,\r\n performedShadow: shadow,\r\n performedInstance: instance,\r\n };\r\n } else {\r\n fiberMountHelper.jumpToParent();\r\n fiberMountHelper.deepWalking.set(false);\r\n shadow = shadow ? shadow.parent : null;\r\n nextFiber = nextFiber.parent;\r\n instance = nextFiber.instance;\r\n\r\n if (hasChildrenProp(nextFiber.instance)) {\r\n nextFiber.instance.children = [];\r\n }\r\n }\r\n\r\n return {\r\n performedFiber: null,\r\n performedNextFiber: nextFiber,\r\n performedShadow: shadow,\r\n performedInstance: instance,\r\n };\r\n}\r\n\r\ntype MutateFiberOptions = {\r\n fiber: Fiber;\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction mutateFiber(options: MutateFiberOptions) {\r\n const { fiber, alternate, instance } = options;\r\n const key = alternate ? getElementKey(alternate.instance) : null;\r\n const nextKey = alternate ? getElementKey(instance) : null;\r\n const isDifferentKeys = key !== nextKey;\r\n const isSameType = Boolean(alternate) && getInstanceType(alternate.instance) === getInstanceType(instance);\r\n const isUpdate = isSameType && !isDifferentKeys;\r\n\r\n fiber.instance = instance;\r\n fiber.alternate = alternate || null;\r\n fiber.nativeElement = isUpdate ? alternate.nativeElement : null;\r\n fiber.effectTag = isUpdate ? EffectTag.UPDATE : EffectTag.PLACEMENT;\r\n fiber.mountedToHost = isUpdate;\r\n\r\n if (hasChildrenProp(fiber.instance)) {\r\n fiber.childrenCount = fiber.instance.children.length;\r\n }\r\n\r\n if (fiber.alternate) {\r\n fiber.alternate.shadow = null;\r\n fiber.alternate.alternate = null;\r\n }\r\n\r\n if (!fiber.nativeElement && detectIsVirtualNode(fiber.instance)) {\r\n fiber.nativeElement = platform.createNativeElement(fiber.instance);\r\n }\r\n}\r\n\r\ntype PerformAlternateOptions = {\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction mutateAlternate(options: PerformAlternateOptions) {\r\n const { alternate, instance } = options;\r\n const alternateType = getInstanceType(alternate.instance);\r\n const elementType = getInstanceType(instance);\r\n const isSameType = elementType === alternateType;\r\n const prevKey = getElementKey(alternate.instance);\r\n const nextKey = getElementKey(instance);\r\n const isSameKeys = prevKey === nextKey;\r\n\r\n alternate.isUsed = true;\r\n\r\n if (!isSameType || !isSameKeys) {\r\n alternate.effectTag = EffectTag.DELETION;\r\n deletionsHelper.get().push(alternate);\r\n } else if (hasChildrenProp(alternate.instance) && hasChildrenProp(instance)) {\r\n const prevElementsCount = alternate.childrenCount;\r\n const nextElementsCount = instance.children.length;\r\n const isRequestedKeys = prevElementsCount !== nextElementsCount;\r\n\r\n if (isRequestedKeys) {\r\n const children = hasChildrenProp(instance) ? instance.children : [];\r\n const { prevKeys, nextKeys } = extractKeys(alternate.child, children);\r\n const hasPrevKeys = prevKeys.length > 0;\r\n const hasNextKeys = nextKeys.length > 0;\r\n const hasAnyKeys = hasPrevKeys || hasNextKeys;\r\n\r\n if (process.env.NODE_ENV === 'development') {\r\n if (!hasAnyKeys && prevElementsCount !== 0 && nextElementsCount !== 0) {\r\n error(`\r\n [Dark]: Operation of inserting, adding, replacing elements into list requires to have a unique key for every node (string or number, but not array index)!\r\n `);\r\n }\r\n }\r\n\r\n const performRemovingNodes = () => {\r\n const diffKeys = getDiffKeys(prevKeys, nextKeys);\r\n\r\n if (diffKeys.length > 0) {\r\n const fibersMap = createFibersByKeyMap(alternate.child);\r\n\r\n for (const key of diffKeys) {\r\n const fiber = fibersMap[key] || null;\r\n\r\n if (fiber) {\r\n fiber.effectTag = EffectTag.DELETION;\r\n deletionsHelper.get().push(fiber);\r\n }\r\n }\r\n } else {\r\n const diffCount = prevElementsCount - nextElementsCount;\r\n if (diffCount === 0) return;\r\n const fibers = takeListFromEnd(getSiblingFibers(alternate.child), diffCount);\r\n\r\n for (const fiber of fibers) {\r\n fiber.effectTag = EffectTag.DELETION;\r\n }\r\n\r\n deletionsHelper.get().push(...fibers);\r\n }\r\n };\r\n\r\n const performInsertingNodes = () => {\r\n const diffKeys = getDiffKeys(nextKeys, prevKeys);\r\n\r\n if (diffKeys.length === 0) return;\r\n\r\n const diffKeyMap = keyBy(diffKeys, x => x);\r\n const usedKeyMap = {};\r\n let keyIdx = 0;\r\n\r\n for (const nextKey of nextKeys) {\r\n if (process.env.NODE_ENV === 'development') {\r\n if (usedKeyMap[nextKey]) {\r\n error(`Some key of node already has been used!`);\r\n }\r\n }\r\n\r\n usedKeyMap[nextKey] = true;\r\n\r\n if (nextKey !== prevKeys[keyIdx] && diffKeyMap[nextKey]) {\r\n const insertionFiber = new Fiber({\r\n instance: createEmptyVirtualNode(),\r\n parent: alternate,\r\n effectTag: EffectTag.PLACEMENT,\r\n });\r\n\r\n if (keyIdx === 0) {\r\n insertionFiber.nextSibling = alternate.child;\r\n alternate.child = insertionFiber;\r\n } else {\r\n const [fiber, prevFiber] = getFibersByIdx(alternate.child, keyIdx);\r\n\r\n if (fiber && prevFiber) {\r\n insertionFiber.nextSibling = fiber;\r\n prevFiber.nextSibling = insertionFiber;\r\n }\r\n }\r\n }\r\n\r\n keyIdx++;\r\n }\r\n };\r\n\r\n performRemovingNodes();\r\n performInsertingNodes();\r\n }\r\n }\r\n}\r\n\r\ntype PerformMemoOptions = {\r\n fiber: Fiber;\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction performMemo(options: PerformMemoOptions) {\r\n const { fiber, alternate, instance } = options;\r\n\r\n if (detectIsMemo(fiber.instance)) {\r\n let memoFiber: Fiber = null;\r\n const factory = instance as ComponentFactory;\r\n const alternateFactory = alternate.instance as ComponentFactory;\r\n\r\n if (factory.type !== alternateFactory.type) return fiber;\r\n\r\n const props = alternateFactory.props;\r\n const nextProps = factory.props;\r\n const skip = !factory.shouldUpdate(props, nextProps);\r\n\r\n if (skip) {\r\n let nextFiber: Fiber = null;\r\n fiberMountHelper.deepWalking.set(false);\r\n\r\n memoFiber = new Fiber({\r\n ...alternate,\r\n alternate,\r\n effectTag: EffectTag.SKIP,\r\n nextSibling: alternate.nextSibling\r\n ? alternate.nextSibling.effectTag === EffectTag.DELETION\r\n ? null\r\n : alternate.nextSibling\r\n : null,\r\n });\r\n\r\n alternate.alternate = null;\r\n nextFiber = memoFiber.child;\r\n\r\n while (nextFiber) {\r\n nextFiber.parent = memoFiber;\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n if (memoFiber.effectHost) {\r\n fiber.markEffectHost();\r\n }\r\n\r\n if (memoFiber.layoutEffectHost) {\r\n fiber.markLayoutEffectHost();\r\n }\r\n\r\n if (memoFiber.mountedToHost) {\r\n fiber.markMountedToHost();\r\n }\r\n\r\n if (memoFiber.portalHost) {\r\n fiber.markPortalHost();\r\n }\r\n\r\n return memoFiber;\r\n }\r\n }\r\n\r\n return fiber;\r\n}\r\n\r\ntype PerformInstanceOptions = {\r\n instance: DarkElementInstance;\r\n idx: number;\r\n fiber: Fiber;\r\n alternate: Fiber;\r\n};\r\n\r\nfunction pertformInstance(options: PerformInstanceOptions) {\r\n const { instance, idx, fiber, alternate } = options;\r\n let performedInstance: DarkElementInstance = null;\r\n let performedShadow: Fiber = null;\r\n\r\n if (hasChildrenProp(instance)) {\r\n const elements = detectIsArray(instance.children[idx])\r\n ? flatten([instance.children[idx]])\r\n : [instance.children[idx]];\r\n\r\n instance.children.splice(idx, 1, ...elements);\r\n performedInstance = instance.children[idx];\r\n performedShadow = alternate\r\n ? getRootShadow({\r\n instance: performedInstance,\r\n fiber,\r\n alternate,\r\n })\r\n : performedShadow;\r\n performedInstance = mountInstance(fiber, performedInstance);\r\n }\r\n\r\n if (detectIsComponentFactory(performedInstance)) {\r\n if (hasEffects(fiber)) {\r\n fiber.markEffectHost();\r\n }\r\n\r\n if (hasLayoutEffects(fiber)) {\r\n fiber.markLayoutEffectHost();\r\n }\r\n\r\n if (platform.detectIsPortal(performedInstance)) {\r\n fiber.markPortalHost();\r\n }\r\n }\r\n\r\n return {\r\n performedInstance,\r\n performedShadow,\r\n };\r\n}\r\n\r\ntype GetRootShadowOptions = {\r\n instance: DarkElementInstance;\r\n fiber: Fiber;\r\n alternate: Fiber;\r\n};\r\n\r\nfunction getRootShadow(options: GetRootShadowOptions) {\r\n const { instance, fiber, alternate } = options;\r\n const key = getElementKey(alternate.instance);\r\n const nextKey = getElementKey(instance);\r\n let shadow: Fiber = null;\r\n\r\n if (key !== nextKey) {\r\n shadow = getAlternateByKey(nextKey, alternate.parent.child);\r\n\r\n if (shadow) {\r\n fiber.hook = shadow.hook;\r\n fiber.provider = shadow.provider;\r\n alternate.transposition = true;\r\n }\r\n }\r\n\r\n return shadow;\r\n}\r\n\r\nfunction mountInstance(fiber: Fiber, instance: DarkElementInstance) {\r\n const isComponentFactory = detectIsComponentFactory(instance);\r\n const factory = instance as ComponentFactory;\r\n\r\n if (isComponentFactory) {\r\n try {\r\n const result = factory.type(factory.props, factory.ref);\r\n\r\n factory.children = detectIsArray(result)\r\n ? (flatten([result]) as Array)\r\n : ([result] as Array);\r\n } catch (err) {\r\n factory.children = [];\r\n fiber.setError(err);\r\n error(err);\r\n }\r\n } else if (detectIsVirtualNodeFactory(instance)) {\r\n instance = instance();\r\n }\r\n\r\n if (hasChildrenProp(instance)) {\r\n for (let i = 0; i < instance.children.length; i++) {\r\n if (!instance.children[i]) {\r\n instance.children[i] = transformElementInstance(instance.children[i]) as DarkElementInstance;\r\n }\r\n }\r\n\r\n instance.children = isComponentFactory\r\n ? instance.children\r\n : detectIsArray(instance.children)\r\n ? flatten([instance.children])\r\n : [instance.children];\r\n\r\n if (isComponentFactory && factory.children.length === 0) {\r\n factory.children.push(createEmptyVirtualNode());\r\n }\r\n }\r\n\r\n return instance;\r\n}\r\n\r\nfunction getFibersByIdx(fiber: Fiber, idx: number): [Fiber | null, Fiber | null] {\r\n const map: Record = {};\r\n let nextFiber = fiber;\r\n let position = 0;\r\n\r\n while (nextFiber) {\r\n map[position] = nextFiber;\r\n\r\n if (position === idx) {\r\n return [map[position] || null, map[position - 1] || null];\r\n }\r\n\r\n position++;\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return [null, null];\r\n}\r\n\r\nfunction createFibersByKeyMap(fiber: Fiber) {\r\n let nextFiber = fiber;\r\n const map: Record = {};\r\n\r\n while (nextFiber) {\r\n const key = getElementKey(nextFiber.instance);\r\n\r\n if (!detectIsEmpty(key)) {\r\n map[key] = nextFiber;\r\n }\r\n\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return map;\r\n}\r\n\r\nfunction extractKeys(alternate: Fiber, children: Array) {\r\n let nextFiber = alternate;\r\n let idx = 0;\r\n const prevKeys: Array = [];\r\n const nextKeys: Array = [];\r\n\r\n while (nextFiber || idx < children.length) {\r\n const key = nextFiber && getElementKey(nextFiber.instance);\r\n const nextKey = children[idx] && getElementKey(children[idx]);\r\n\r\n if (!detectIsEmpty(key)) {\r\n prevKeys.push(key);\r\n }\r\n\r\n if (!detectIsEmpty(nextKey)) {\r\n nextKeys.push(nextKey);\r\n }\r\n\r\n nextFiber = nextFiber ? nextFiber.nextSibling : null;\r\n idx++;\r\n }\r\n\r\n return {\r\n prevKeys,\r\n nextKeys,\r\n };\r\n}\r\n\r\nfunction getAlternateByKey(key: DarkElementKey, fiber: Fiber) {\r\n if (detectIsEmpty(key)) return null;\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n if (key === getElementKey(nextFiber.instance)) {\r\n return nextFiber;\r\n }\r\n\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return null;\r\n}\r\n\r\nfunction getElementKey(instance: DarkElementInstance): DarkElementKey | null {\r\n const key = detectIsComponentFactory(instance)\r\n ? getComponentFactoryKey(instance)\r\n : detectIsTagVirtualNode(instance)\r\n ? getVirtualNodeKey(instance)\r\n : null;\r\n\r\n return key;\r\n}\r\n\r\nfunction getDiffKeys(keys: Array, nextKeys: Array): Array {\r\n const nextKeysMap = nextKeys.reduce((acc, key) => ((acc[key] = true), acc), {});\r\n const diff = [];\r\n\r\n for (const key of keys) {\r\n if (!nextKeysMap[key]) {\r\n diff.push(key);\r\n }\r\n }\r\n\r\n return diff;\r\n}\r\n\r\nfunction getChildAlternate(fiber: Fiber): Fiber | null {\r\n let alternate = fiber.alternate && fiber.alternate.effectTag !== EffectTag.DELETION ? fiber.alternate.child : null;\r\n\r\n while (alternate && alternate.effectTag === EffectTag.DELETION) {\r\n alternate = alternate.nextSibling;\r\n }\r\n\r\n return alternate;\r\n}\r\n\r\nfunction getNextSiblingAlternate(fiber: Fiber): Fiber | null {\r\n let alternate = fiber.alternate?.nextSibling || null;\r\n\r\n while (alternate && alternate.effectTag === EffectTag.DELETION) {\r\n alternate = alternate.nextSibling;\r\n }\r\n\r\n return alternate;\r\n}\r\n\r\nfunction transformElementInstance(instance: DarkElement) {\r\n return detectIsEmpty(instance) || instance === false ? createEmptyVirtualNode() : instance;\r\n}\r\n\r\nfunction getInstanceType(instance: DarkElementInstance): string | Function {\r\n return detectIsTagVirtualNode(instance)\r\n ? instance.name\r\n : detectIsVirtualNode(instance)\r\n ? instance.type\r\n : detectIsComponentFactory(instance)\r\n ? instance.type\r\n : null;\r\n}\r\n\r\nfunction getSiblingFibers(fiber: Fiber): Array {\r\n const list = [];\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n list.push(nextFiber);\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return list;\r\n}\r\n\r\nfunction hasChildrenProp(element: DarkElementInstance): element is TagVirtualNode | ComponentFactory {\r\n return detectIsTagVirtualNode(element) || detectIsComponentFactory(element);\r\n}\r\n\r\nfunction commitChanges() {\r\n const wipFiber = wipRootHelper.get();\r\n const fromHook = fromHookUpdateHelper.get();\r\n\r\n commitWork(wipFiber.child, () => {\r\n const layoutEffects = layoutEffectsHelper.get();\r\n const effects = effectsHelper.get();\r\n\r\n wipRootHelper.set(null);\r\n\r\n for (const layoutEffect of layoutEffects) {\r\n layoutEffect();\r\n }\r\n\r\n setTimeout(() => {\r\n for (const effect of effects) {\r\n effect();\r\n }\r\n });\r\n\r\n layoutEffectsHelper.reset();\r\n effectsHelper.reset();\r\n\r\n if (fromHook) {\r\n fromHookUpdateHelper.set(false);\r\n } else {\r\n currentRootHelper.set(wipFiber);\r\n }\r\n });\r\n}\r\n\r\nfunction commitWork(fiber: Fiber, onComplete: Function) {\r\n const deletions = deletionsHelper.get();\r\n\r\n // important order\r\n for (const fiber of deletions) {\r\n unmountFiber(fiber);\r\n platform.applyCommit(fiber);\r\n }\r\n\r\n walkFiber({\r\n fiber,\r\n onLoop: ({ nextFiber, isReturn, resetIsDeepWalking }) => {\r\n const skip = nextFiber.effectTag === EffectTag.SKIP;\r\n\r\n if (skip) {\r\n resetIsDeepWalking();\r\n } else if (!isReturn) {\r\n platform.applyCommit(nextFiber);\r\n }\r\n\r\n if (nextFiber && nextFiber.shadow) {\r\n nextFiber.shadow = null;\r\n }\r\n },\r\n });\r\n\r\n platform.finishCommitWork();\r\n deletionsHelper.set([]);\r\n onComplete();\r\n}\r\n\r\nfunction createHook(): Hook {\r\n return {\r\n idx: 0,\r\n values: [],\r\n };\r\n}\r\n\r\ntype GetHookOptions = {\r\n shadow: Fiber;\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction getHook(options: GetHookOptions) {\r\n const { shadow, alternate, instance } = options;\r\n\r\n if (shadow) return shadow.hook;\r\n\r\n if (alternate && getElementKey(alternate.instance) === getElementKey(instance)) {\r\n return alternate.hook;\r\n }\r\n\r\n return createHook();\r\n}\r\n\r\ntype CreateUpdateCallbackOptions = {\r\n rootId: number;\r\n fiber: Fiber;\r\n forceStart?: boolean;\r\n onStart: () => void;\r\n};\r\n\r\nfunction createUpdateCallback(options: CreateUpdateCallbackOptions) {\r\n const { rootId, fiber, forceStart = false, onStart } = options;\r\n const callback = () => {\r\n forceStart && onStart();\r\n if (fiber.isUsed) return;\r\n !forceStart && onStart();\r\n effectStoreHelper.set(rootId); // important order!\r\n fromHookUpdateHelper.set(true);\r\n fiberMountHelper.reset();\r\n\r\n fiber.alternate = new Fiber({\r\n ...fiber,\r\n alternate: null,\r\n });\r\n fiber.marker = PARTIAL_UPDATE;\r\n fiber.effectTag = EffectTag.UPDATE;\r\n fiber.child = null;\r\n\r\n wipRootHelper.set(fiber);\r\n componentFiberHelper.set(fiber);\r\n fiber.instance = mountInstance(fiber, fiber.instance);\r\n nextUnitOfWorkHelper.set(fiber);\r\n };\r\n\r\n return callback;\r\n}\r\n\r\nexport { Fiber, workLoop, createHook, hasChildrenProp, createUpdateCallback };\r\n","import { platform, type ScheduleCallbackOptions } from '../platform';\r\nimport { getRootId, componentFiberHelper } from '../scope';\r\nimport { createUpdateCallback } from '../fiber';\r\nimport { useMemo } from '../use-memo';\r\nimport { dummyFn } from '../helpers';\r\n\r\nfunction useUpdate(options?: ScheduleCallbackOptions) {\r\n const rootId = getRootId();\r\n const fiber = componentFiberHelper.get();\r\n const scope = useMemo(() => ({ fiber }), []);\r\n\r\n scope.fiber = fiber;\r\n\r\n const update = (onStart?: () => void) => {\r\n const callback = createUpdateCallback({\r\n rootId,\r\n fiber: scope.fiber,\r\n forceStart: Boolean(options?.timeoutMs),\r\n onStart: onStart || dummyFn,\r\n });\r\n\r\n platform.scheduleCallback(callback, options);\r\n };\r\n\r\n return update;\r\n}\r\n\r\nexport { useUpdate };\r\n","import { useEffect } from '../use-effect';\r\nimport { useMemo } from '../use-memo';\r\nimport { componentFiberHelper } from '../scope';\r\nimport { useUpdate } from '../use-update';\r\nimport type { Fiber } from '../fiber';\r\nimport type { Context, ContextProviderValue } from '../context';\r\n\r\nfunction useContext(context: Context): T {\r\n const { defaultValue } = context;\r\n const fiber = componentFiberHelper.get();\r\n const provider = getProvider(context, fiber);\r\n const value = provider ? provider.value : defaultValue;\r\n const update = useUpdate();\r\n const scope = useMemo(() => ({ prevValue: value }), []);\r\n const hasProvider = Boolean(provider);\r\n\r\n useEffect(() => {\r\n if (!hasProvider) return;\r\n\r\n const subscriber = (newValue: T) => {\r\n if (!Object.is(scope.prevValue, newValue)) {\r\n update();\r\n }\r\n };\r\n\r\n provider.subscribers.push(subscriber);\r\n\r\n return () => {\r\n const idx = provider.subscribers.findIndex(x => x === subscriber);\r\n\r\n if (idx !== -1) {\r\n provider.subscribers.splice(idx, 1);\r\n }\r\n };\r\n }, [hasProvider]);\r\n\r\n scope.prevValue = value;\r\n\r\n return value;\r\n}\r\n\r\nfunction getProvider(context: Context, fiber: Fiber): ContextProviderValue {\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n if (nextFiber.provider && nextFiber.provider.get(context)) {\r\n return nextFiber.provider.get(context) as ContextProviderValue;\r\n }\r\n\r\n nextFiber = nextFiber.parent;\r\n }\r\n\r\n return null;\r\n}\r\n\r\nexport { useContext };\r\n","import { createComponent } from '../component';\r\nimport { useEffect } from '../use-effect';\r\nimport { componentFiberHelper } from '../scope';\r\nimport { useContext } from '../use-context';\r\nimport { detectIsFunction } from '../helpers';\r\nimport type { Context, ContexProviderProps } from './types';\r\n\r\nfunction createContext(defaultValue: T): Context {\r\n let displayName = 'Context';\r\n const context: Context = {\r\n displayName,\r\n defaultValue,\r\n Provider: null,\r\n Consumer: null,\r\n };\r\n\r\n mutateContext(context, defaultValue, displayName);\r\n\r\n Object.defineProperty(context, 'displayName', {\r\n get: () => displayName,\r\n set: (newValue: string) => {\r\n displayName = newValue;\r\n mutateContext(context, defaultValue, displayName);\r\n },\r\n });\r\n\r\n return context;\r\n}\r\n\r\nfunction mutateContext(context: Context, defaultValue: T, displayName: string) {\r\n context.Provider = createProvider(context, defaultValue, displayName);\r\n context.Consumer = createConsumer(context, displayName);\r\n}\r\n\r\nfunction createProvider(context: Context, defaultValue: T, displayName: string) {\r\n return createComponent>(\r\n ({ value = defaultValue, slot }) => {\r\n const fiber = componentFiberHelper.get();\r\n\r\n if (!fiber.provider) {\r\n fiber.provider = new Map();\r\n }\r\n\r\n if (!fiber.provider.get(context)) {\r\n fiber.provider.set(context, {\r\n subscribers: [],\r\n value,\r\n });\r\n }\r\n\r\n const provider = fiber.provider.get(context);\r\n\r\n useEffect(() => {\r\n for (const subscriber of provider.subscribers) {\r\n subscriber(value);\r\n }\r\n }, [value]);\r\n\r\n provider.value = value;\r\n\r\n return slot;\r\n },\r\n { displayName: `${displayName}.Provider` },\r\n );\r\n}\r\n\r\nfunction createConsumer(context: Context, displayName: string) {\r\n return createComponent(\r\n ({ slot }) => {\r\n const value = useContext(context);\r\n\r\n return detectIsFunction(slot) ? slot(value) : null;\r\n },\r\n { displayName: `${displayName}.Consumer` },\r\n );\r\n}\r\n\r\nexport { createContext };\r\n","import { detectIsNumber, detectIsString, detectIsFunction } from '../helpers';\r\nimport { View, Text, type TagVirtualNodeFactory } from '../view';\r\n\r\nfunction getChildren(children: Array) {\r\n children = children.map(x => (detectIsString(x) || detectIsNumber(x) ? Text(x.toString()) : x));\r\n\r\n return children ? (Array.isArray(children) ? [...children] : [children]) : [];\r\n}\r\n\r\nfunction createElement(\r\n tag: string | Function,\r\n props: any,\r\n ...children: Array\r\n): TagVirtualNodeFactory | Function | null {\r\n if (detectIsString(tag)) {\r\n return View({\r\n ...props,\r\n as: tag,\r\n slot: getChildren(children),\r\n });\r\n }\r\n\r\n if (detectIsFunction(tag)) {\r\n let slot = getChildren(children);\r\n\r\n slot = slot.length === 1 ? slot[0] : slot;\r\n\r\n return tag({ ...props, slot });\r\n }\r\n\r\n return null;\r\n}\r\n\r\nexport { createElement };\r\n","import { useMemo } from '../use-memo';\r\n\r\nfunction useCallback(callback: T, deps: Array): T {\r\n const value = useMemo(() => callback, deps);\r\n\r\n return value;\r\n}\r\n\r\nexport { useCallback };\r\n","import { type ScheduleCallbackOptions } from '../platform';\r\nimport { detectIsUndefined, detectIsFunction } from '../helpers';\r\nimport { componentFiberHelper } from '../scope';\r\nimport { useUpdate } from '../use-update';\r\nimport { useMemo } from '../use-memo';\r\nimport { useCallback } from '../use-callback';\r\nimport { TaskPriority } from '../constants';\r\n\r\ntype Value = T | ((prevValue: T) => T);\r\ntype Scope = {\r\n idx: number;\r\n values: Array;\r\n};\r\n\r\nfunction useState(initialValue: T, options?: ScheduleCallbackOptions): [T, (value: Value) => void] {\r\n const fiber = componentFiberHelper.get();\r\n const update = useUpdate(options);\r\n const scope: Scope = useMemo(\r\n () => ({\r\n idx: fiber.hook.idx,\r\n values: fiber.hook.values,\r\n }),\r\n [],\r\n );\r\n const setState = useCallback((sourceValue: Value) => {\r\n const value = scope.values[scope.idx];\r\n const newValue = detectIsFunction(sourceValue) ? sourceValue(value) : sourceValue;\r\n\r\n if (!Object.is(value, newValue)) {\r\n const setValue = () => {\r\n scope.values[scope.idx] = newValue;\r\n };\r\n\r\n if (options?.priority === TaskPriority.LOW) {\r\n update(() => setValue());\r\n } else {\r\n setValue();\r\n update();\r\n }\r\n }\r\n }, []);\r\n const { hook } = fiber;\r\n const { idx, values } = hook;\r\n const value: T = !detectIsUndefined(values[idx]) ? values[idx] : initialValue;\r\n\r\n values[idx] = value;\r\n scope.idx = idx;\r\n scope.values = values;\r\n hook.idx++;\r\n\r\n return [value, setState];\r\n}\r\n\r\nexport { useState };\r\n","import { createComponent } from '../component';\r\nimport { useState } from '../use-state';\r\nimport { createContext } from '../context';\r\nimport { useContext } from '../use-context';\r\nimport { useMemo } from '../use-memo';\r\nimport { useCallback } from '../use-callback';\r\nimport type { DarkElement } from '../shared';\r\n\r\ntype SuspenseProps = {\r\n fallback: DarkElement;\r\n};\r\n\r\ntype SuspenseContextValue = {\r\n fallback: DarkElement;\r\n isLoaded: boolean;\r\n trigger: () => void;\r\n};\r\n\r\nconst SuspenseContext = createContext({\r\n fallback: null,\r\n isLoaded: true,\r\n trigger: () => {},\r\n});\r\n\r\nconst Suspense = createComponent(({ fallback, slot }) => {\r\n if (!fallback) {\r\n throw new Error(`[Dark]: Suspense fallback not found`);\r\n }\r\n const { isLoaded: isSuspenseLoaded } = useContext(SuspenseContext);\r\n const [isLoaded, setIsLoaded] = useState(false);\r\n const trigger = useCallback(() => setIsLoaded(true), []);\r\n const value = useMemo(() => ({ fallback, isLoaded, trigger }), [fallback, isLoaded]);\r\n\r\n return SuspenseContext.Provider({\r\n value,\r\n slot: isSuspenseLoaded ? slot : null,\r\n });\r\n});\r\n\r\nexport { SuspenseContext, Suspense };\r\n","import { type Component, createComponent, detectIsComponentFactory } from '../component';\r\nimport { useState } from '../use-state';\r\nimport { useEffect } from '../use-effect';\r\nimport { forwardRef } from '../ref';\r\nimport { SuspenseContext } from '../suspense';\r\nimport { useContext } from '../use-context';\r\n\r\nconst $$lazy = Symbol('lazy');\r\n\r\ntype LazyScope = {\r\n component: Component;\r\n};\r\n\r\nfunction lazy(dynamic: () => Promise<{ default: Component

}>) {\r\n return forwardRef(\r\n createComponent(\r\n (props, ref) => {\r\n const { fallback, trigger } = useContext(SuspenseContext);\r\n const [scope, setScope] = useState>({\r\n component: null,\r\n });\r\n\r\n useEffect(() => {\r\n fetchModule(dynamic).then(component => {\r\n setScope({ component });\r\n });\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (!scope.component) return;\r\n trigger();\r\n }, [scope.component]);\r\n\r\n return scope.component ? scope.component(props, ref) : fallback;\r\n },\r\n { token: $$lazy },\r\n ),\r\n );\r\n}\r\n\r\nconst detectIsLazy = (factory: unknown) => detectIsComponentFactory(factory) && factory.token === $$lazy;\r\n\r\nfunction fetchModule(dynamic: () => Promise<{ default: Component }>) {\r\n return new Promise(resolve => {\r\n dynamic().then(module => {\r\n if (!module.default) {\r\n throw new Error('[Dark]: lazy loaded component should be exported as default!');\r\n }\r\n\r\n resolve(module.default);\r\n });\r\n });\r\n}\r\n\r\nexport { lazy, detectIsLazy };\r\n","import { useState } from '../use-state';\r\nimport { useEffect } from '../use-effect';\r\nimport { TaskPriority } from '../constants';\r\n\r\ntype UseDeferredValueOprions = {\r\n timeoutMs: number;\r\n};\r\n\r\nfunction useDeferredValue(value: T, options?: UseDeferredValueOprions): T {\r\n const { timeoutMs } = options || {};\r\n const [deferredValue, setDeferredValue] = useState(value, {\r\n priority: TaskPriority.LOW,\r\n timeoutMs,\r\n });\r\n\r\n useEffect(() => {\r\n setDeferredValue(value);\r\n }, [value]);\r\n\r\n return deferredValue;\r\n}\r\n\r\nexport { useDeferredValue };\r\n","import { componentFiberHelper } from '../scope';\r\nimport { useEffect } from '../use-effect';\r\nimport { useUpdate } from '../use-update';\r\nimport { useMemo } from '../use-memo';\r\n\r\ntype ErrorScope = {\r\n error: Error;\r\n};\r\n\r\nfunction useError(): Error | null {\r\n const fiber = componentFiberHelper.get();\r\n const update = useUpdate();\r\n const scope: ErrorScope = useMemo(() => ({ error: null }), []);\r\n\r\n fiber.catchException = (error: Error) => {\r\n scope.error = error;\r\n update();\r\n };\r\n\r\n useEffect(() => {\r\n scope.error = null;\r\n }, [scope.error]);\r\n\r\n return scope.error;\r\n}\r\n\r\nexport { useError };\r\n","import { useMemo } from '../use-memo';\r\nimport { useCallback } from '../use-callback';\r\n\r\nfunction useEvent any>(fn: T) {\r\n const scope = useMemo(() => ({ fn }), []);\r\n\r\n scope.fn = fn;\r\n\r\n const callback = useCallback((...args) => {\r\n return scope.fn(...args);\r\n }, []);\r\n\r\n return callback as unknown as T;\r\n}\r\n\r\nexport { useEvent };\r\n","import { useMemo } from '../use-memo';\r\nimport type { MutableRef } from '../ref';\r\n\r\nfunction useImperativeHandle(ref: MutableRef, createHandle: () => T, deps: Array) {\r\n const current = useMemo(() => createHandle(), deps);\r\n\r\n ref.current = current;\r\n}\r\n\r\nexport { useImperativeHandle };\r\n","import { useState } from '../use-state';\r\nimport { useCallback } from '../use-callback';\r\nimport { useMemo } from '../use-memo';\r\nimport { detectIsFunction } from '../helpers';\r\nimport type { Reducer, Dispatch, ReducerAction, ReducerState } from './types';\r\n\r\nfunction useReducer(\r\n reducer: R,\r\n initialState: ReducerState,\r\n initializer?: (state: ReducerState) => ReducerState,\r\n): [ReducerState, Dispatch>] {\r\n const initialValue = useMemo(() => {\r\n return detectIsFunction(initializer) ? initializer(initialState) : initialState;\r\n }, []);\r\n const [state, setState] = useState>(initialValue);\r\n const dispatch = useCallback((action: ReducerAction) => setState(state => reducer(state, action)), []) as Dispatch<\r\n ReducerAction\r\n >;\r\n\r\n return [state, dispatch];\r\n}\r\n\r\nexport { useReducer };\r\n","import { useMemo } from '../use-memo';\r\nimport type { MutableRef } from '../ref';\r\n\r\nfunction useRef(initialValue: T = null): MutableRef {\r\n const ref = useMemo(() => ({ current: initialValue }), []) as MutableRef;\r\n\r\n return ref;\r\n}\r\n\r\nexport { useRef };\r\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","TaskPriority","ROOT","EMPTY_NODE","ATTR_KEY","ATTR_REF","PARTIAL_UPDATE","detectIsFunction","detectIsUndefined","detectIsNumber","detectIsString","detectIsObject","detectIsBoolean","detectIsArray","Array","isArray","detectIsNull","detectIsEmpty","error","str","console","flatten","source","list","levelMap","idx","level","item","length","push","getTime","Date","now","keyBy","fn","reduce","acc","x","takeListFromEnd","count","slice","dummyFn","detectIsDepsDifferent","deps","prevDeps","i","defaultOptions","displayName","defaultProps","token","options","children","this","type","props","ref","shouldUpdate","createComponent","createElement","computedOptions","computedProps","ComponentFactory","NodeType","detectIsComponentFactory","getComponentFactoryKey","wipRoot","currentRoot","nextUnitOfWork","fromHookUpdate","events","Map","unsubscribers","deletions","fiberMount","navigation","isDeepWalking","componentFiber","effects","layoutEffects","rootId","stores","effectStoreHelper","set","id","effectStore","remove","delete","getRootId","Store","storeHelper","wipRootHelper","fiber","currentRootHelper","nextUnitOfWorkHelper","componentFiberHelper","fromHookUpdateHelper","eventsHelper","addUnsubscriber","mapUnsubscribers","forEach","deletionsHelper","fiberMountHelper","reset","getIndex","jumpToChild","nextLevel","jumpToParent","jumpToSibling","deepWalking","effectsHelper","add","effect","layoutEffectsHelper","createEffect","useEffect","hasEffects","dropEffects","store","hook","values","runEffect","undefined","cleanup","some","$$virtualNode","TAG","name","isVoid","attrs","VirtualNode","text","TEXT","COMMENT","detectIsVirtualNode","vNode","detectIsTagVirtualNode","TagVirtualNode","detectIsCommentVirtualNode","CommentVirtualNode","detectIsTextVirtualNode","TextVirtualNode","detectIsEmptyVirtualNode","getVirtualNodeKey","createEmptyVirtualNode","detectIsVirtualNodeFactory","View","def","as","slot","rest","Text","Comment","$$fragment","Fragment","detectIsFragment","forwardRef","component","detectIsRef","mutableRef","$$memo","defaultShouldUpdate","nextProps","keys","detectIsMemo","memo","Memo","processValue","getValue","isDepsDifferent","check","wrap","useMemo","hookValue","computedGetValue","EffectTag","platform","scheduleCallback","Error","shouldYeildToHost","createNativeElement","applyCommit","finishCommitWork","detectIsPortal","unmountPortal","cloneTagMap","PLACEMENT","SKIP","useLayoutEffect","hasLayoutEffects","dropLayoutEffects","walkFiber","onLoop","nextFiber","isReturn","isStopped","visitedMap","detectCanVisit","resetIsDeepWalking","stop","child","newFiber","nextSibling","parent","unmountFiber","effectHost","layoutEffectHost","portalHost","transposition","instance","unmountRoot","onComplete","nativeElement","alternate","effectTag","shadow","provider","mountedToHost","childrenCount","marker","isUsed","markPortalHost","markEffectHost","markLayoutEffectHost","markMountedToHost","setError","catchException","workLoop","wipFiber","shouldYield","hasMoreWork","Boolean","performUnitOfWork","fromHook","layoutEffect","setTimeout","commitWork","commitChanges","hasChildrenProp","performChild","performedFiber","performSibling","performPartialUpdateEffects","DELETION","getChildAlternate","getHook","Fiber","pertformInstance","mutateAlternate","mutateFiber","performMemo","performedNextFiber","performedShadow","performedInstance","childrenIdx","getNextSiblingAlternate","isDifferentKeys","getElementKey","isUpdate","getInstanceType","UPDATE","alternateType","isSameType","isSameKeys","prevKeys","nextKeys","nextKey","extractKeys","diffKeys","getDiffKeys","fibersMap","map","createFibersByKeyMap","diffCount","fibers","getSiblingFibers","performRemovingNodes","diffKeyMap","usedKeyMap","keyIdx","insertionFiber","getFibersByIdx","prevFiber","performInsertingNodes","memoFiber","alternateFactory","elements","splice","getAlternateByKey","getRootShadow","mountInstance","isComponentFactory","result","err","transformElementInstance","position","nextKeysMap","diff","element","createHook","createUpdateCallback","forceStart","onStart","useUpdate","scope","callback","timeoutMs","useContext","context","defaultValue","getProvider","update","prevValue","hasProvider","subscriber","newValue","is","subscribers","findIndex","createContext","Provider","Consumer","mutateContext","createProvider","createConsumer","getChildren","toString","tag","useCallback","useState","initialValue","setState","sourceValue","priority","LOW","SuspenseContext","fallback","isLoaded","trigger","Suspense","isSuspenseLoaded","setIsLoaded","$$lazy","lazy","dynamic","setScope","Promise","resolve","then","default","fetchModule","detectIsLazy","useDeferredValue","deferredValue","setDeferredValue","useError","useEvent","args","useImperativeHandle","createHandle","current","useReducer","reducer","initialState","initializer","state","dispatch","action","useRef"],"sourceRoot":""} \ No newline at end of file diff --git a/packages/platform-browser/package.json b/packages/platform-browser/package.json index 2cd849f3..41f68de0 100644 --- a/packages/platform-browser/package.json +++ b/packages/platform-browser/package.json @@ -1,6 +1,6 @@ { "name": "@dark-engine/platform-browser", - "version": "0.7.6", + "version": "0.7.7", "description": "Dark is lightweight (10 Kb gzipped) component-and-hook-based UI rendering engine for javascript apps without dependencies and written in Typescript 💫", "author": "AlexPlex", "license": "MIT", diff --git a/packages/platform-browser/umd/dark-platform-browser.development.js b/packages/platform-browser/umd/dark-platform-browser.development.js index a0c7ffd2..7a58f103 100644 --- a/packages/platform-browser/umd/dark-platform-browser.development.js +++ b/packages/platform-browser/umd/dark-platform-browser.development.js @@ -121,7 +121,7 @@ var attrBlackListMap = (_a = {}, _a[_dark_engine_core__WEBPACK_IMPORTED_MODULE_0__.ATTR_REF] = true, _a); var fragmentsMap = new Map(); -function createElement(vNode) { +function createNativeElement(vNode) { var _a; var map = (_a = {}, _a[_dark_engine_core__WEBPACK_IMPORTED_MODULE_0__.NodeType.TAG] = function (vNode) { @@ -172,12 +172,6 @@ function detectIsSvgElement(tagName) { }; return Boolean(tagMap[tagName]); } -function createNativeElement(fiber) { - if (!(0,_dark_engine_core__WEBPACK_IMPORTED_MODULE_0__.detectIsVirtualNode)(fiber.instance)) { - throw new Error('[Dark]: createNativeElement receives only virtual node!'); - } - return createElement(fiber.instance); -} function applyRef(ref, element) { if ((0,_dark_engine_core__WEBPACK_IMPORTED_MODULE_0__.detectIsRef)(ref)) { ref.current = element; diff --git a/packages/platform-browser/umd/dark-platform-browser.development.js.map b/packages/platform-browser/umd/dark-platform-browser.development.js.map index 87e4c305..c41c979b 100644 --- a/packages/platform-browser/umd/dark-platform-browser.development.js.map +++ b/packages/platform-browser/umd/dark-platform-browser.development.js.map @@ -1 +1 @@ -{"version":3,"file":"dark-platform-browser.development.js","mappings":"AAAA;AACA;AACA;AACA;A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;;;;;;ACNkC;AACS;AACH;AACD","sources":["webpack://DarkPlatformBrowser/webpack/universalModuleDefinition","webpack://DarkPlatformBrowser/./src/create-root/create-root.tsx","webpack://DarkPlatformBrowser/./src/create-root/index.ts","webpack://DarkPlatformBrowser/./src/dom/dom.ts","webpack://DarkPlatformBrowser/./src/dom/index.ts","webpack://DarkPlatformBrowser/./src/dom/types.ts","webpack://DarkPlatformBrowser/./src/events/events.ts","webpack://DarkPlatformBrowser/./src/events/index.ts","webpack://DarkPlatformBrowser/./src/portal/index.ts","webpack://DarkPlatformBrowser/./src/portal/portal.tsx","webpack://DarkPlatformBrowser/./src/render/index.ts","webpack://DarkPlatformBrowser/./src/render/render.ts","webpack://DarkPlatformBrowser/./src/scheduling/index.ts","webpack://DarkPlatformBrowser/./src/scheduling/scheduling.ts","webpack://DarkPlatformBrowser/./src/scheduling/types.ts","webpack://DarkPlatformBrowser/./src/use-style/index.ts","webpack://DarkPlatformBrowser/./src/use-style/use-style.ts","webpack://DarkPlatformBrowser/external umd {\"root\":\"DarkCore\",\"commonjs2\":\"@dark-engine/core\",\"commonjs\":\"@dark-engine/core\",\"amd\":\"@dark-engine/core\"}","webpack://DarkPlatformBrowser/webpack/bootstrap","webpack://DarkPlatformBrowser/webpack/runtime/compat get default export","webpack://DarkPlatformBrowser/webpack/runtime/define property getters","webpack://DarkPlatformBrowser/webpack/runtime/hasOwnProperty shorthand","webpack://DarkPlatformBrowser/webpack/runtime/make namespace object","webpack://DarkPlatformBrowser/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@dark-engine/core\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"DarkPlatformBrowser\", [\"@dark-engine/core\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"DarkPlatformBrowser\"] = factory(require(\"@dark-engine/core\"));\n\telse\n\t\troot[\"DarkPlatformBrowser\"] = factory(root[\"DarkCore\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__dark_engine_core__) => {\nreturn ","import { type DarkElement, unmountRoot } from '@dark-engine/core';\r\nimport { render, roots } from '../render';\r\n\r\nfunction createRoot(container: Element) {\r\n return {\r\n render: (element: DarkElement) => render(element, container),\r\n unmount: () => {\r\n const rootId = roots.get(container);\r\n\r\n unmountRoot(rootId, () => {\r\n roots.delete(container);\r\n container.innerHTML = '';\r\n });\r\n },\r\n };\r\n}\r\n\r\nexport { createRoot };\r\n","export * from './create-root';\r\n","import {\r\n type Fiber,\r\n type VirtualNode,\r\n type TagVirtualNode,\r\n type TextVirtualNode,\r\n type CommentVirtualNode,\r\n type MutableRef,\r\n ATTR_KEY,\r\n ATTR_REF,\r\n EffectTag,\r\n detectIsFunction,\r\n detectIsUndefined,\r\n NodeType,\r\n detectIsVirtualNode,\r\n detectIsTagVirtualNode,\r\n detectIsTextVirtualNode,\r\n detectIsRef,\r\n walkFiber,\r\n} from '@dark-engine/core';\r\nimport { detectIsPortal, getPortalContainer } from '../portal';\r\nimport { delegateEvent, detectIsEvent, getEventName } from '../events';\r\nimport type { DOMElement, DOMFragment } from './types';\r\n\r\nconst attrBlackListMap = {\r\n [ATTR_KEY]: true,\r\n [ATTR_REF]: true,\r\n};\r\n\r\nlet fragmentsMap: Map = new Map();\r\n\r\nfunction createElement(vNode: VirtualNode): DOMElement {\r\n const map = {\r\n [NodeType.TAG]: (vNode: VirtualNode) => {\r\n const tagNode = vNode as TagVirtualNode;\r\n const node = detectIsSvgElement(tagNode.name)\r\n ? document.createElementNS('http://www.w3.org/2000/svg', tagNode.name)\r\n : document.createElement(tagNode.name);\r\n\r\n return node;\r\n },\r\n [NodeType.TEXT]: (vNode: VirtualNode) => {\r\n const textNode = vNode as TextVirtualNode;\r\n const node = document.createTextNode(textNode.value);\r\n\r\n return node;\r\n },\r\n [NodeType.COMMENT]: (vNode: VirtualNode) => {\r\n const commentNode = vNode as CommentVirtualNode;\r\n const node = document.createComment(commentNode.value);\r\n\r\n return node;\r\n },\r\n };\r\n\r\n return map[vNode.type](vNode);\r\n}\r\n\r\nfunction detectIsSvgElement(tagName) {\r\n const tagMap = {\r\n svg: true,\r\n circle: true,\r\n ellipse: true,\r\n g: true,\r\n text: true,\r\n tspan: true,\r\n textPath: true,\r\n path: true,\r\n polygon: true,\r\n polyline: true,\r\n line: true,\r\n rect: true,\r\n use: true,\r\n image: true,\r\n symbol: true,\r\n defs: true,\r\n linearGradient: true,\r\n radialGradient: true,\r\n stop: true,\r\n clipPath: true,\r\n pattern: true,\r\n mask: true,\r\n marker: true,\r\n };\r\n\r\n return Boolean(tagMap[tagName]);\r\n}\r\n\r\nfunction createNativeElement(fiber: Fiber): DOMElement {\r\n if (!detectIsVirtualNode(fiber.instance)) {\r\n throw new Error('[Dark]: createNativeElement receives only virtual node!');\r\n }\r\n\r\n return createElement(fiber.instance);\r\n}\r\n\r\nfunction applyRef(ref: MutableRef, element: Element) {\r\n if (detectIsRef(ref)) {\r\n ref.current = element;\r\n }\r\n}\r\n\r\nfunction addAttributes(element: Element, vNode: VirtualNode) {\r\n if (!detectIsTagVirtualNode(vNode)) return;\r\n const attrNames = Object.keys(vNode.attrs);\r\n\r\n for (const attrName of attrNames) {\r\n const attrValue = vNode.attrs[attrName];\r\n\r\n if (attrName === ATTR_REF) {\r\n applyRef(attrValue as MutableRef, element);\r\n continue;\r\n }\r\n\r\n if (detectIsFunction(attrValue)) {\r\n if (detectIsEvent(attrName)) {\r\n delegateEvent({\r\n target: element,\r\n handler: attrValue,\r\n eventName: getEventName(attrName),\r\n });\r\n }\r\n } else if (!detectIsUndefined(attrValue) && !attrBlackListMap[attrName]) {\r\n upgradeInputAttributes({\r\n tagName: vNode.name,\r\n value: attrValue,\r\n attrName,\r\n element,\r\n });\r\n\r\n element.setAttribute(attrName, attrValue);\r\n }\r\n }\r\n}\r\n\r\nfunction updateAttributes(element: Element, vNode: TagVirtualNode, nextVNode: TagVirtualNode) {\r\n const attrNames = new Set([...Object.keys(vNode.attrs), ...Object.keys(nextVNode.attrs)]);\r\n\r\n for (const attrName of attrNames) {\r\n const prevAttrValue = vNode.attrs[attrName];\r\n const nextAttrValue = nextVNode.attrs[attrName];\r\n\r\n if (attrName === ATTR_REF) {\r\n applyRef(prevAttrValue as MutableRef, element);\r\n continue;\r\n }\r\n\r\n if (!detectIsUndefined(nextAttrValue)) {\r\n if (detectIsFunction(prevAttrValue)) {\r\n if (detectIsEvent(attrName) && prevAttrValue !== nextAttrValue) {\r\n delegateEvent({\r\n target: element,\r\n handler: nextAttrValue,\r\n eventName: getEventName(attrName),\r\n });\r\n }\r\n } else if (!attrBlackListMap[attrName] && prevAttrValue !== nextAttrValue) {\r\n upgradeInputAttributes({\r\n tagName: nextVNode.name,\r\n value: nextAttrValue,\r\n attrName,\r\n element,\r\n });\r\n\r\n element.setAttribute(attrName, nextAttrValue);\r\n }\r\n } else {\r\n element.removeAttribute(attrName);\r\n }\r\n }\r\n}\r\n\r\ntype UpgradeInputAttributesOptions = {\r\n tagName: string;\r\n element: Element;\r\n attrName: string;\r\n value: string | boolean;\r\n};\r\n\r\nfunction upgradeInputAttributes(options: UpgradeInputAttributesOptions) {\r\n const { tagName, element, attrName, value } = options;\r\n const map = {\r\n input: () => {\r\n const attrsMap = {\r\n value: true,\r\n checked: true,\r\n };\r\n\r\n if (attrsMap[attrName]) {\r\n element[attrName] = value;\r\n }\r\n },\r\n option: () => {\r\n const attrsMap = {\r\n selected: true,\r\n };\r\n\r\n if (attrsMap[attrName]) {\r\n element[attrName] = value;\r\n }\r\n },\r\n };\r\n\r\n map[tagName] && map[tagName]();\r\n}\r\n\r\nfunction getParentFiberWithNativeElement(fiber: Fiber): Fiber {\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n nextFiber = nextFiber.parent;\r\n\r\n if (detectIsPortal(nextFiber.instance)) {\r\n nextFiber.nativeElement = getPortalContainer(nextFiber.instance);\r\n }\r\n\r\n if (nextFiber.nativeElement) return nextFiber;\r\n }\r\n\r\n return nextFiber;\r\n}\r\n\r\nfunction getNodeOnTheRight(fiber: Fiber, parentElement: Element) {\r\n let node: Element = null;\r\n\r\n walkFiber({\r\n fiber,\r\n onLoop: ({ nextFiber, stop, resetIsDeepWalking }) => {\r\n if (nextFiber.nativeElement && nextFiber.nativeElement.parentElement === parentElement) {\r\n node = nextFiber.nativeElement;\r\n\r\n return stop();\r\n }\r\n\r\n if (!nextFiber.mountedToHost) {\r\n return resetIsDeepWalking();\r\n }\r\n },\r\n });\r\n\r\n return node;\r\n}\r\n\r\nfunction getChildIndex(fiber: Fiber, parentNativeElement: Element) {\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n if (nextFiber?.parent?.nativeElement === parentNativeElement) {\r\n return nextFiber.idx;\r\n }\r\n\r\n nextFiber = nextFiber.parent;\r\n }\r\n\r\n return -1;\r\n}\r\n\r\nfunction commitPlacement(fiber: Fiber, parentFiber: Fiber) {\r\n const parentNativeElement = parentFiber.nativeElement;\r\n const childNodes = parentNativeElement.childNodes;\r\n\r\n const append = () => {\r\n const { fragment } =\r\n fragmentsMap.get(parentNativeElement) ||\r\n ({\r\n fragment: document.createDocumentFragment(),\r\n callback: () => {},\r\n } as DOMFragment);\r\n\r\n fragmentsMap.set(parentNativeElement, {\r\n fragment,\r\n callback: () => {\r\n parentNativeElement.appendChild(fragment);\r\n },\r\n });\r\n fragment.appendChild(fiber.nativeElement);\r\n fiber.markMountedToHost();\r\n };\r\n\r\n const insert = () => {\r\n parentNativeElement.insertBefore(fiber.nativeElement, getNodeOnTheRight(fiber, parentNativeElement));\r\n fiber.markMountedToHost();\r\n };\r\n\r\n if (childNodes.length === 0 || getChildIndex(fiber, parentNativeElement) > childNodes.length - 1) {\r\n append();\r\n } else {\r\n insert();\r\n }\r\n\r\n addAttributes(fiber.nativeElement, fiber.instance as VirtualNode);\r\n}\r\n\r\nfunction commitUpdate(element: Element, instance: VirtualNode, nextInstance: VirtualNode) {\r\n if (\r\n detectIsTextVirtualNode(instance) &&\r\n detectIsTextVirtualNode(nextInstance) &&\r\n instance.value !== nextInstance.value\r\n ) {\r\n return (element.textContent = nextInstance.value);\r\n }\r\n\r\n if (detectIsTagVirtualNode(instance) && detectIsTagVirtualNode(nextInstance)) {\r\n return updateAttributes(element, instance, nextInstance);\r\n }\r\n}\r\n\r\nfunction commitDeletion(fiber: Fiber, parentFiber: Fiber) {\r\n walkFiber({\r\n fiber,\r\n onLoop: ({ nextFiber, isReturn, resetIsDeepWalking, stop }) => {\r\n if (nextFiber === fiber.nextSibling || nextFiber === fiber.parent) {\r\n return stop();\r\n }\r\n\r\n if (!isReturn && nextFiber.nativeElement) {\r\n !detectIsPortal(nextFiber.instance) && parentFiber.nativeElement.removeChild(nextFiber.nativeElement);\r\n\r\n return resetIsDeepWalking();\r\n }\r\n },\r\n });\r\n}\r\n\r\nfunction applyCommit(fiber: Fiber) {\r\n const parentFiber = getParentFiberWithNativeElement(fiber);\r\n\r\n if (fiber.nativeElement !== null && fiber.effectTag === EffectTag.PLACEMENT) {\r\n commitPlacement(fiber, parentFiber);\r\n } else if (fiber.nativeElement !== null && fiber.effectTag === EffectTag.UPDATE) {\r\n if (!detectIsVirtualNode(fiber.alternate.instance) || !detectIsVirtualNode(fiber.instance)) return;\r\n const vNode: VirtualNode = fiber.alternate.instance;\r\n const nextVNode: VirtualNode = fiber.instance;\r\n\r\n commitUpdate(fiber.nativeElement, vNode, nextVNode);\r\n } else if (fiber.effectTag === EffectTag.DELETION) {\r\n commitDeletion(fiber, parentFiber);\r\n }\r\n}\r\n\r\nfunction finishCommitWork() {\r\n for (const { callback } of fragmentsMap.values()) {\r\n callback();\r\n }\r\n\r\n fragmentsMap = new Map();\r\n}\r\n\r\nexport { createNativeElement, applyCommit, finishCommitWork };\r\n","export * from './dom';\r\nexport * from './types';\r\n","export type DOMElement = HTMLElement | SVGElement | Text | Comment;\r\n\r\nexport type DOMFragment = {\r\n fragment: DocumentFragment;\r\n callback: () => void;\r\n};\r\n","import { detectIsFunction, eventsHelper } from '@dark-engine/core';\r\n\r\ntype BrowserEventConstructor = (type: string, event: Event) => void;\r\n\r\nclass SyntheticEvent {\r\n public type = '';\r\n public sourceEvent: E = null;\r\n public target: T = null;\r\n private propagation = true;\r\n\r\n constructor(options: Pick, 'sourceEvent' | 'target'>) {\r\n this.type = options.sourceEvent.type;\r\n this.sourceEvent = options.sourceEvent;\r\n this.target = options.target;\r\n }\r\n\r\n public stopPropagation() {\r\n this.propagation = false;\r\n this.sourceEvent.stopPropagation();\r\n }\r\n\r\n public preventDefault() {\r\n this.sourceEvent.preventDefault();\r\n }\r\n\r\n public getPropagation() {\r\n return this.propagation;\r\n }\r\n}\r\n\r\ntype DelegateEventOptions = {\r\n target: Element;\r\n eventName: string;\r\n handler: (e: Event) => void;\r\n};\r\n\r\nfunction delegateEvent(options: DelegateEventOptions) {\r\n const { target, eventName, handler } = options;\r\n const eventsStore = eventsHelper.get();\r\n const handlerMap = eventsStore.get(eventName);\r\n\r\n if (!handlerMap) {\r\n const rootHandler = (event: Event) => {\r\n const fireEvent = eventsStore.get(eventName).get(event.target);\r\n const target = event.target as Element;\r\n let syntheticEvent: SyntheticEvent = null;\r\n\r\n if (detectIsFunction(fireEvent)) {\r\n syntheticEvent = new SyntheticEvent({\r\n sourceEvent: event,\r\n target,\r\n });\r\n fireEvent(syntheticEvent);\r\n }\r\n\r\n if (syntheticEvent ? syntheticEvent.getPropagation() : target.parentElement) {\r\n target.parentElement.dispatchEvent(new (event.constructor as BrowserEventConstructor)(event.type, event));\r\n }\r\n };\r\n\r\n eventsStore.set(eventName, new WeakMap([[target, handler]]));\r\n document.addEventListener(eventName, rootHandler, true);\r\n eventsHelper.addUnsubscriber(() => document.removeEventListener(eventName, rootHandler, true));\r\n } else {\r\n handlerMap.set(target, handler);\r\n }\r\n}\r\n\r\nconst detectIsEvent = (attrName: string) => attrName.startsWith('on');\r\n\r\nconst getEventName = (attrName: string) => attrName.slice(2, attrName.length).toLowerCase();\r\n\r\nexport { SyntheticEvent, delegateEvent, detectIsEvent, getEventName };\r\n","export * from './events';\r\n","export * from './portal';\r\n","import {\r\n type Fiber,\r\n type DarkElement,\r\n type ComponentFactory,\r\n createComponent,\r\n detectIsComponentFactory,\r\n useMemo,\r\n} from '@dark-engine/core';\r\n\r\nconst $$portal = Symbol('portal');\r\n\r\nfunction createPortal(slot: DarkElement, container: Element) {\r\n if (!(container instanceof Element)) {\r\n throw new Error(`[Dark]: createPortal receives only Element as container!`);\r\n }\r\n\r\n return Portal({ [$$portal]: container, slot });\r\n}\r\n\r\ntype PortalProps = {\r\n [$$portal]: Element;\r\n slot: DarkElement;\r\n};\r\n\r\nconst Portal = createComponent(\r\n ({ slot, ...rest }) => {\r\n useMemo(() => (rest[$$portal].innerHTML = ''), []);\r\n\r\n return slot;\r\n },\r\n { token: $$portal },\r\n);\r\n\r\nconst detectIsPortal = (factory: unknown): factory is ComponentFactory =>\r\n detectIsComponentFactory(factory) && factory.token === $$portal;\r\n\r\nconst getPortalContainer = (factory: unknown): Element | null =>\r\n detectIsPortal(factory) ? factory.props[$$portal] : null;\r\n\r\nfunction unmountPortal(fiber: Fiber) {\r\n const container = getPortalContainer(fiber.instance);\r\n\r\n if (container) {\r\n container.innerHTML = '';\r\n }\r\n}\r\n\r\nexport { createPortal, detectIsPortal, getPortalContainer, unmountPortal };\r\n","export * from './render';\r\n","import {\r\n type DarkElement,\r\n type VirtualNodeFactory,\r\n type ComponentFactory,\r\n ROOT,\r\n Fiber,\r\n EffectTag,\r\n platform,\r\n flatten,\r\n detectIsUndefined,\r\n TagVirtualNode,\r\n effectStoreHelper,\r\n wipRootHelper,\r\n currentRootHelper,\r\n nextUnitOfWorkHelper,\r\n fiberMountHelper,\r\n TaskPriority,\r\n createEmptyVirtualNode,\r\n} from '@dark-engine/core';\r\nimport { createNativeElement, applyCommit, finishCommitWork } from '../dom';\r\nimport { detectIsPortal, unmountPortal } from '../portal';\r\nimport { scheduleCallback, shouldYeildToHost } from '../scheduling';\r\n\r\nplatform.scheduleCallback = scheduleCallback;\r\nplatform.shouldYeildToHost = shouldYeildToHost;\r\nplatform.createNativeElement = createNativeElement as typeof platform.createNativeElement;\r\nplatform.applyCommit = applyCommit as typeof platform.applyCommit;\r\nplatform.finishCommitWork = finishCommitWork as typeof platform.finishCommitWork;\r\nplatform.detectIsPortal = detectIsPortal as typeof platform.detectIsPortal;\r\nplatform.unmountPortal = unmountPortal as typeof platform.unmountPortal;\r\n\r\nconst roots = new Map();\r\n\r\nfunction render(element: DarkElement, container: Element) {\r\n if (!(container instanceof Element)) {\r\n throw new Error(`[Dark]: render receives only Element as container!`);\r\n }\r\n\r\n const isMounted = !detectIsUndefined(roots.get(container));\r\n let rootId = null;\r\n\r\n if (!isMounted) {\r\n rootId = roots.size;\r\n\r\n roots.set(container, rootId);\r\n container.innerHTML = '';\r\n } else {\r\n rootId = roots.get(container);\r\n }\r\n\r\n const callback = () => {\r\n effectStoreHelper.set(rootId); // important order!\r\n const currentRootFiber = currentRootHelper.get();\r\n const fiber = new Fiber({\r\n nativeElement: container,\r\n instance: new TagVirtualNode({\r\n name: ROOT,\r\n children: flatten([element || createEmptyVirtualNode()]) as Array,\r\n }),\r\n alternate: currentRootFiber,\r\n effectTag: isMounted ? EffectTag.UPDATE : EffectTag.PLACEMENT,\r\n });\r\n\r\n currentRootFiber && (currentRootFiber.alternate = null);\r\n fiberMountHelper.reset();\r\n wipRootHelper.set(fiber);\r\n nextUnitOfWorkHelper.set(fiber);\r\n };\r\n\r\n platform.scheduleCallback(callback, { priority: TaskPriority.NORMAL });\r\n}\r\n\r\nexport { render, roots };\r\n","export * from './scheduling';\r\nexport * from './types';\r\n","import { type ScheduleCallbackOptions, getTime, workLoop, wipRootHelper, TaskPriority } from '@dark-engine/core';\r\nimport { type Callback } from './types';\r\n\r\ntype QueueByPriority = {\r\n hight: Array;\r\n normal: Array;\r\n low: Array;\r\n};\r\n\r\nconst queueByPriority: QueueByPriority = {\r\n hight: [],\r\n normal: [],\r\n low: [],\r\n};\r\nconst YEILD_INTERVAL = 10;\r\nlet scheduledCallback: Callback = null;\r\nlet deadline = 0;\r\nlet isMessageLoopRunning = false;\r\nlet currentTask: Task = null;\r\n\r\nclass Task {\r\n public static nextTaskId = 0;\r\n public id: number;\r\n public time: number;\r\n public timeoutMs: number;\r\n public priority: TaskPriority;\r\n public callback: () => void;\r\n\r\n constructor(options: Omit) {\r\n this.id = ++Task.nextTaskId;\r\n this.time = options.time;\r\n this.timeoutMs = options.timeoutMs;\r\n this.priority = options.priority;\r\n this.callback = options.callback;\r\n }\r\n}\r\n\r\nconst shouldYeildToHost = () => getTime() >= deadline;\r\n\r\nfunction scheduleCallback(callback: () => void, options?: ScheduleCallbackOptions) {\r\n const { priority = TaskPriority.NORMAL, timeoutMs } = options || {};\r\n const task = new Task({ time: getTime(), timeoutMs, priority, callback });\r\n const map: Record void> = {\r\n [TaskPriority.HIGH]: () => queueByPriority.hight.push(task),\r\n [TaskPriority.NORMAL]: () => queueByPriority.normal.push(task),\r\n [TaskPriority.LOW]: () => queueByPriority.low.push(task),\r\n };\r\n\r\n map[task.priority]();\r\n executeTasks();\r\n}\r\n\r\nfunction pick(queue: Array) {\r\n if (!queue.length) return false;\r\n currentTask = queue.shift();\r\n\r\n currentTask.callback();\r\n requestCallback(workLoop);\r\n\r\n return true;\r\n}\r\n\r\nfunction executeTasks() {\r\n const isBusy = Boolean(wipRootHelper.get());\r\n\r\n if (!isBusy) {\r\n checkOverdueTasks() ||\r\n pick(queueByPriority.hight) ||\r\n pick(queueByPriority.normal) ||\r\n requestIdleCallback(() => pick(queueByPriority.low));\r\n }\r\n}\r\n\r\nfunction checkOverdueTasks() {\r\n const [task] = queueByPriority.low;\r\n\r\n if (task && task.timeoutMs > 0 && getTime() - task.time > task.timeoutMs) {\r\n pick(queueByPriority.low);\r\n return true;\r\n }\r\n\r\n return false;\r\n}\r\n\r\nfunction performWorkUntilDeadline() {\r\n if (scheduledCallback) {\r\n deadline = getTime() + YEILD_INTERVAL;\r\n\r\n try {\r\n const hasMoreWork = scheduledCallback();\r\n\r\n if (!hasMoreWork) {\r\n currentTask = null;\r\n isMessageLoopRunning = false;\r\n scheduledCallback = null;\r\n executeTasks();\r\n } else {\r\n port.postMessage(null);\r\n }\r\n } catch (error) {\r\n port.postMessage(null);\r\n throw error;\r\n }\r\n } else {\r\n isMessageLoopRunning = false;\r\n }\r\n}\r\n\r\nfunction requestCallback(callback: Callback) {\r\n if (process.env.NODE_ENV === 'test') {\r\n return requestCallbackSync(callback);\r\n }\r\n\r\n scheduledCallback = callback;\r\n\r\n if (!isMessageLoopRunning) {\r\n isMessageLoopRunning = true;\r\n port.postMessage(null);\r\n }\r\n}\r\n\r\nfunction requestCallbackSync(callback: Callback) {\r\n while (callback()) {\r\n //\r\n }\r\n executeTasks();\r\n currentTask = null;\r\n}\r\n\r\nlet channel: MessageChannel = null;\r\nlet port: MessagePort = null;\r\n\r\nfunction setup() {\r\n if (process.env.NODE_ENV === 'test') {\r\n return;\r\n }\r\n\r\n channel = new MessageChannel();\r\n port = channel.port2;\r\n\r\n channel.port1.onmessage = performWorkUntilDeadline;\r\n}\r\n\r\nsetup();\r\n\r\nexport { shouldYeildToHost, scheduleCallback };\r\n","export type Callback = () => boolean;\r\n\r\nexport type Task = {\r\n id: number;\r\n priority: TaskPriority;\r\n calllback: () => void;\r\n};\r\n\r\nexport enum TaskPriority {\r\n HIGH = 2,\r\n NORMAL = 1,\r\n}\r\n","export * from './use-style';\r\n","import { useMemo, detectIsUndefined } from '@dark-engine/core';\r\n\r\nfunction styled(strings: TemplateStringsArray, ...args: Array): string {\r\n const style = useMemo(() => {\r\n return strings\r\n .map((x, idx) => x + (!detectIsUndefined(args[idx]) ? args[idx] : ''))\r\n .join('')\r\n .replace(/;\\s*/gm, ';')\r\n .replace(/:\\s*/gm, ':')\r\n .trim();\r\n }, [strings, ...args]);\r\n\r\n return style;\r\n}\r\n\r\ntype Style = Record;\r\n\r\ntype Config = (x: typeof styled) => T;\r\n\r\nfunction useStyle(config: Config) {\r\n return config(styled);\r\n}\r\n\r\nexport { useStyle };\r\n","module.exports = __WEBPACK_EXTERNAL_MODULE__dark_engine_core__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export { render } from './render';\r\nexport { createRoot } from './create-root';\r\nexport { createPortal } from './portal';\r\nexport { useStyle } from './use-style';\r\nexport type { SyntheticEvent } from './events';\r\n"],"names":[],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"dark-platform-browser.development.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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+B,EAA/B,qBAA+B,EAA/B,IAA+B;QAA/B,6BAA+B;;IAC5E,IAAM,KAAK,GAAG,0DAAO,CAAC;QACpB,OAAO,OAAO;aACX,GAAG,CAAC,UAAC,CAAC,EAAE,GAAG,IAAK,QAAC,GAAG,CAAC,CAAC,oEAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAApD,CAAoD,CAAC;aACrE,IAAI,CAAC,EAAE,CAAC;aACR,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;aACtB,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;aACtB,IAAI,EAAE,CAAC;IACZ,CAAC,iBAAG,OAAO,UAAK,IAAI,UAAE,CAAC;IAEvB,OAAO,KAAK,CAAC;AACf,CAAC;AAMD,SAAS,QAAQ,CAAkB,MAAiB;IAClD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAEmB;;;;;;;;;;;ACvBpB;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;;;;;;ACNkC;AACS;AACH;AACD","sources":["webpack://DarkPlatformBrowser/webpack/universalModuleDefinition","webpack://DarkPlatformBrowser/./src/create-root/create-root.tsx","webpack://DarkPlatformBrowser/./src/create-root/index.ts","webpack://DarkPlatformBrowser/./src/dom/dom.ts","webpack://DarkPlatformBrowser/./src/dom/index.ts","webpack://DarkPlatformBrowser/./src/dom/types.ts","webpack://DarkPlatformBrowser/./src/events/events.ts","webpack://DarkPlatformBrowser/./src/events/index.ts","webpack://DarkPlatformBrowser/./src/portal/index.ts","webpack://DarkPlatformBrowser/./src/portal/portal.tsx","webpack://DarkPlatformBrowser/./src/render/index.ts","webpack://DarkPlatformBrowser/./src/render/render.ts","webpack://DarkPlatformBrowser/./src/scheduling/index.ts","webpack://DarkPlatformBrowser/./src/scheduling/scheduling.ts","webpack://DarkPlatformBrowser/./src/scheduling/types.ts","webpack://DarkPlatformBrowser/./src/use-style/index.ts","webpack://DarkPlatformBrowser/./src/use-style/use-style.ts","webpack://DarkPlatformBrowser/external umd {\"root\":\"DarkCore\",\"commonjs2\":\"@dark-engine/core\",\"commonjs\":\"@dark-engine/core\",\"amd\":\"@dark-engine/core\"}","webpack://DarkPlatformBrowser/webpack/bootstrap","webpack://DarkPlatformBrowser/webpack/runtime/compat get default export","webpack://DarkPlatformBrowser/webpack/runtime/define property getters","webpack://DarkPlatformBrowser/webpack/runtime/hasOwnProperty shorthand","webpack://DarkPlatformBrowser/webpack/runtime/make namespace object","webpack://DarkPlatformBrowser/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@dark-engine/core\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"DarkPlatformBrowser\", [\"@dark-engine/core\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"DarkPlatformBrowser\"] = factory(require(\"@dark-engine/core\"));\n\telse\n\t\troot[\"DarkPlatformBrowser\"] = factory(root[\"DarkCore\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__dark_engine_core__) => {\nreturn ","import { type DarkElement, unmountRoot } from '@dark-engine/core';\r\nimport { render, roots } from '../render';\r\n\r\nfunction createRoot(container: Element) {\r\n return {\r\n render: (element: DarkElement) => render(element, container),\r\n unmount: () => {\r\n const rootId = roots.get(container);\r\n\r\n unmountRoot(rootId, () => {\r\n roots.delete(container);\r\n container.innerHTML = '';\r\n });\r\n },\r\n };\r\n}\r\n\r\nexport { createRoot };\r\n","export * from './create-root';\r\n","import {\r\n type Fiber,\r\n type VirtualNode,\r\n type TagVirtualNode,\r\n type TextVirtualNode,\r\n type CommentVirtualNode,\r\n type MutableRef,\r\n ATTR_KEY,\r\n ATTR_REF,\r\n EffectTag,\r\n detectIsFunction,\r\n detectIsUndefined,\r\n NodeType,\r\n detectIsVirtualNode,\r\n detectIsTagVirtualNode,\r\n detectIsTextVirtualNode,\r\n detectIsRef,\r\n walkFiber,\r\n} from '@dark-engine/core';\r\nimport { detectIsPortal, getPortalContainer } from '../portal';\r\nimport { delegateEvent, detectIsEvent, getEventName } from '../events';\r\nimport type { DOMElement, DOMFragment } from './types';\r\n\r\nconst attrBlackListMap = {\r\n [ATTR_KEY]: true,\r\n [ATTR_REF]: true,\r\n};\r\n\r\nlet fragmentsMap: Map = new Map();\r\n\r\nfunction createNativeElement(vNode: VirtualNode): DOMElement {\r\n const map = {\r\n [NodeType.TAG]: (vNode: VirtualNode) => {\r\n const tagNode = vNode as TagVirtualNode;\r\n const node = detectIsSvgElement(tagNode.name)\r\n ? document.createElementNS('http://www.w3.org/2000/svg', tagNode.name)\r\n : document.createElement(tagNode.name);\r\n\r\n return node;\r\n },\r\n [NodeType.TEXT]: (vNode: VirtualNode) => {\r\n const textNode = vNode as TextVirtualNode;\r\n const node = document.createTextNode(textNode.value);\r\n\r\n return node;\r\n },\r\n [NodeType.COMMENT]: (vNode: VirtualNode) => {\r\n const commentNode = vNode as CommentVirtualNode;\r\n const node = document.createComment(commentNode.value);\r\n\r\n return node;\r\n },\r\n };\r\n\r\n return map[vNode.type](vNode);\r\n}\r\n\r\nfunction detectIsSvgElement(tagName: string) {\r\n const tagMap = {\r\n svg: true,\r\n circle: true,\r\n ellipse: true,\r\n g: true,\r\n text: true,\r\n tspan: true,\r\n textPath: true,\r\n path: true,\r\n polygon: true,\r\n polyline: true,\r\n line: true,\r\n rect: true,\r\n use: true,\r\n image: true,\r\n symbol: true,\r\n defs: true,\r\n linearGradient: true,\r\n radialGradient: true,\r\n stop: true,\r\n clipPath: true,\r\n pattern: true,\r\n mask: true,\r\n marker: true,\r\n };\r\n\r\n return Boolean(tagMap[tagName]);\r\n}\r\n\r\nfunction applyRef(ref: MutableRef, element: Element) {\r\n if (detectIsRef(ref)) {\r\n ref.current = element;\r\n }\r\n}\r\n\r\nfunction addAttributes(element: Element, vNode: VirtualNode) {\r\n if (!detectIsTagVirtualNode(vNode)) return;\r\n const attrNames = Object.keys(vNode.attrs);\r\n\r\n for (const attrName of attrNames) {\r\n const attrValue = vNode.attrs[attrName];\r\n\r\n if (attrName === ATTR_REF) {\r\n applyRef(attrValue as MutableRef, element);\r\n continue;\r\n }\r\n\r\n if (detectIsFunction(attrValue)) {\r\n if (detectIsEvent(attrName)) {\r\n delegateEvent({\r\n target: element,\r\n handler: attrValue,\r\n eventName: getEventName(attrName),\r\n });\r\n }\r\n } else if (!detectIsUndefined(attrValue) && !attrBlackListMap[attrName]) {\r\n upgradeInputAttributes({\r\n tagName: vNode.name,\r\n value: attrValue,\r\n attrName,\r\n element,\r\n });\r\n\r\n element.setAttribute(attrName, attrValue);\r\n }\r\n }\r\n}\r\n\r\nfunction updateAttributes(element: Element, vNode: TagVirtualNode, nextVNode: TagVirtualNode) {\r\n const attrNames = new Set([...Object.keys(vNode.attrs), ...Object.keys(nextVNode.attrs)]);\r\n\r\n for (const attrName of attrNames) {\r\n const prevAttrValue = vNode.attrs[attrName];\r\n const nextAttrValue = nextVNode.attrs[attrName];\r\n\r\n if (attrName === ATTR_REF) {\r\n applyRef(prevAttrValue as MutableRef, element);\r\n continue;\r\n }\r\n\r\n if (!detectIsUndefined(nextAttrValue)) {\r\n if (detectIsFunction(prevAttrValue)) {\r\n if (detectIsEvent(attrName) && prevAttrValue !== nextAttrValue) {\r\n delegateEvent({\r\n target: element,\r\n handler: nextAttrValue,\r\n eventName: getEventName(attrName),\r\n });\r\n }\r\n } else if (!attrBlackListMap[attrName] && prevAttrValue !== nextAttrValue) {\r\n upgradeInputAttributes({\r\n tagName: nextVNode.name,\r\n value: nextAttrValue,\r\n attrName,\r\n element,\r\n });\r\n\r\n element.setAttribute(attrName, nextAttrValue);\r\n }\r\n } else {\r\n element.removeAttribute(attrName);\r\n }\r\n }\r\n}\r\n\r\ntype UpgradeInputAttributesOptions = {\r\n tagName: string;\r\n element: Element;\r\n attrName: string;\r\n value: string | boolean;\r\n};\r\n\r\nfunction upgradeInputAttributes(options: UpgradeInputAttributesOptions) {\r\n const { tagName, element, attrName, value } = options;\r\n const map = {\r\n input: () => {\r\n const attrsMap = {\r\n value: true,\r\n checked: true,\r\n };\r\n\r\n if (attrsMap[attrName]) {\r\n element[attrName] = value;\r\n }\r\n },\r\n option: () => {\r\n const attrsMap = {\r\n selected: true,\r\n };\r\n\r\n if (attrsMap[attrName]) {\r\n element[attrName] = value;\r\n }\r\n },\r\n };\r\n\r\n map[tagName] && map[tagName]();\r\n}\r\n\r\nfunction getParentFiberWithNativeElement(fiber: Fiber): Fiber {\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n nextFiber = nextFiber.parent;\r\n\r\n if (detectIsPortal(nextFiber.instance)) {\r\n nextFiber.nativeElement = getPortalContainer(nextFiber.instance);\r\n }\r\n\r\n if (nextFiber.nativeElement) return nextFiber;\r\n }\r\n\r\n return nextFiber;\r\n}\r\n\r\nfunction getNodeOnTheRight(fiber: Fiber, parentElement: Element) {\r\n let node: Element = null;\r\n\r\n walkFiber({\r\n fiber,\r\n onLoop: ({ nextFiber, stop, resetIsDeepWalking }) => {\r\n if (nextFiber.nativeElement && nextFiber.nativeElement.parentElement === parentElement) {\r\n node = nextFiber.nativeElement;\r\n\r\n return stop();\r\n }\r\n\r\n if (!nextFiber.mountedToHost) {\r\n return resetIsDeepWalking();\r\n }\r\n },\r\n });\r\n\r\n return node;\r\n}\r\n\r\nfunction getChildIndex(fiber: Fiber, parentNativeElement: Element) {\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n if (nextFiber?.parent?.nativeElement === parentNativeElement) {\r\n return nextFiber.idx;\r\n }\r\n\r\n nextFiber = nextFiber.parent;\r\n }\r\n\r\n return -1;\r\n}\r\n\r\nfunction commitPlacement(fiber: Fiber, parentFiber: Fiber) {\r\n const parentNativeElement = parentFiber.nativeElement;\r\n const childNodes = parentNativeElement.childNodes;\r\n\r\n const append = () => {\r\n const { fragment } =\r\n fragmentsMap.get(parentNativeElement) ||\r\n ({\r\n fragment: document.createDocumentFragment(),\r\n callback: () => {},\r\n } as DOMFragment);\r\n\r\n fragmentsMap.set(parentNativeElement, {\r\n fragment,\r\n callback: () => {\r\n parentNativeElement.appendChild(fragment);\r\n },\r\n });\r\n fragment.appendChild(fiber.nativeElement);\r\n fiber.markMountedToHost();\r\n };\r\n\r\n const insert = () => {\r\n parentNativeElement.insertBefore(fiber.nativeElement, getNodeOnTheRight(fiber, parentNativeElement));\r\n fiber.markMountedToHost();\r\n };\r\n\r\n if (childNodes.length === 0 || getChildIndex(fiber, parentNativeElement) > childNodes.length - 1) {\r\n append();\r\n } else {\r\n insert();\r\n }\r\n\r\n addAttributes(fiber.nativeElement, fiber.instance as VirtualNode);\r\n}\r\n\r\nfunction commitUpdate(element: Element, instance: VirtualNode, nextInstance: VirtualNode) {\r\n if (\r\n detectIsTextVirtualNode(instance) &&\r\n detectIsTextVirtualNode(nextInstance) &&\r\n instance.value !== nextInstance.value\r\n ) {\r\n return (element.textContent = nextInstance.value);\r\n }\r\n\r\n if (detectIsTagVirtualNode(instance) && detectIsTagVirtualNode(nextInstance)) {\r\n return updateAttributes(element, instance, nextInstance);\r\n }\r\n}\r\n\r\nfunction commitDeletion(fiber: Fiber, parentFiber: Fiber) {\r\n walkFiber({\r\n fiber,\r\n onLoop: ({ nextFiber, isReturn, resetIsDeepWalking, stop }) => {\r\n if (nextFiber === fiber.nextSibling || nextFiber === fiber.parent) {\r\n return stop();\r\n }\r\n\r\n if (!isReturn && nextFiber.nativeElement) {\r\n !detectIsPortal(nextFiber.instance) && parentFiber.nativeElement.removeChild(nextFiber.nativeElement);\r\n\r\n return resetIsDeepWalking();\r\n }\r\n },\r\n });\r\n}\r\n\r\nfunction applyCommit(fiber: Fiber) {\r\n const parentFiber = getParentFiberWithNativeElement(fiber);\r\n\r\n if (fiber.nativeElement !== null && fiber.effectTag === EffectTag.PLACEMENT) {\r\n commitPlacement(fiber, parentFiber);\r\n } else if (fiber.nativeElement !== null && fiber.effectTag === EffectTag.UPDATE) {\r\n if (!detectIsVirtualNode(fiber.alternate.instance) || !detectIsVirtualNode(fiber.instance)) return;\r\n const vNode: VirtualNode = fiber.alternate.instance;\r\n const nextVNode: VirtualNode = fiber.instance;\r\n\r\n commitUpdate(fiber.nativeElement, vNode, nextVNode);\r\n } else if (fiber.effectTag === EffectTag.DELETION) {\r\n commitDeletion(fiber, parentFiber);\r\n }\r\n}\r\n\r\nfunction finishCommitWork() {\r\n for (const { callback } of fragmentsMap.values()) {\r\n callback();\r\n }\r\n\r\n fragmentsMap = new Map();\r\n}\r\n\r\nexport { createNativeElement, applyCommit, finishCommitWork };\r\n","export * from './dom';\r\nexport * from './types';\r\n","export type DOMElement = HTMLElement | SVGElement | Text | Comment;\r\n\r\nexport type DOMFragment = {\r\n fragment: DocumentFragment;\r\n callback: () => void;\r\n};\r\n","import { detectIsFunction, eventsHelper } from '@dark-engine/core';\r\n\r\ntype BrowserEventConstructor = (type: string, event: Event) => void;\r\n\r\nclass SyntheticEvent {\r\n public type = '';\r\n public sourceEvent: E = null;\r\n public target: T = null;\r\n private propagation = true;\r\n\r\n constructor(options: Pick, 'sourceEvent' | 'target'>) {\r\n this.type = options.sourceEvent.type;\r\n this.sourceEvent = options.sourceEvent;\r\n this.target = options.target;\r\n }\r\n\r\n public stopPropagation() {\r\n this.propagation = false;\r\n this.sourceEvent.stopPropagation();\r\n }\r\n\r\n public preventDefault() {\r\n this.sourceEvent.preventDefault();\r\n }\r\n\r\n public getPropagation() {\r\n return this.propagation;\r\n }\r\n}\r\n\r\ntype DelegateEventOptions = {\r\n target: Element;\r\n eventName: string;\r\n handler: (e: Event) => void;\r\n};\r\n\r\nfunction delegateEvent(options: DelegateEventOptions) {\r\n const { target, eventName, handler } = options;\r\n const eventsStore = eventsHelper.get();\r\n const handlerMap = eventsStore.get(eventName);\r\n\r\n if (!handlerMap) {\r\n const rootHandler = (event: Event) => {\r\n const fireEvent = eventsStore.get(eventName).get(event.target);\r\n const target = event.target as Element;\r\n let syntheticEvent: SyntheticEvent = null;\r\n\r\n if (detectIsFunction(fireEvent)) {\r\n syntheticEvent = new SyntheticEvent({\r\n sourceEvent: event,\r\n target,\r\n });\r\n fireEvent(syntheticEvent);\r\n }\r\n\r\n if (syntheticEvent ? syntheticEvent.getPropagation() : target.parentElement) {\r\n target.parentElement.dispatchEvent(new (event.constructor as BrowserEventConstructor)(event.type, event));\r\n }\r\n };\r\n\r\n eventsStore.set(eventName, new WeakMap([[target, handler]]));\r\n document.addEventListener(eventName, rootHandler, true);\r\n eventsHelper.addUnsubscriber(() => document.removeEventListener(eventName, rootHandler, true));\r\n } else {\r\n handlerMap.set(target, handler);\r\n }\r\n}\r\n\r\nconst detectIsEvent = (attrName: string) => attrName.startsWith('on');\r\n\r\nconst getEventName = (attrName: string) => attrName.slice(2, attrName.length).toLowerCase();\r\n\r\nexport { SyntheticEvent, delegateEvent, detectIsEvent, getEventName };\r\n","export * from './events';\r\n","export * from './portal';\r\n","import {\r\n type Fiber,\r\n type DarkElement,\r\n type ComponentFactory,\r\n createComponent,\r\n detectIsComponentFactory,\r\n useMemo,\r\n} from '@dark-engine/core';\r\n\r\nconst $$portal = Symbol('portal');\r\n\r\nfunction createPortal(slot: DarkElement, container: Element) {\r\n if (!(container instanceof Element)) {\r\n throw new Error(`[Dark]: createPortal receives only Element as container!`);\r\n }\r\n\r\n return Portal({ [$$portal]: container, slot });\r\n}\r\n\r\ntype PortalProps = {\r\n [$$portal]: Element;\r\n slot: DarkElement;\r\n};\r\n\r\nconst Portal = createComponent(\r\n ({ slot, ...rest }) => {\r\n useMemo(() => (rest[$$portal].innerHTML = ''), []);\r\n\r\n return slot;\r\n },\r\n { token: $$portal },\r\n);\r\n\r\nconst detectIsPortal = (factory: unknown): factory is ComponentFactory =>\r\n detectIsComponentFactory(factory) && factory.token === $$portal;\r\n\r\nconst getPortalContainer = (factory: unknown): Element | null =>\r\n detectIsPortal(factory) ? factory.props[$$portal] : null;\r\n\r\nfunction unmountPortal(fiber: Fiber) {\r\n const container = getPortalContainer(fiber.instance);\r\n\r\n if (container) {\r\n container.innerHTML = '';\r\n }\r\n}\r\n\r\nexport { createPortal, detectIsPortal, getPortalContainer, unmountPortal };\r\n","export * from './render';\r\n","import {\r\n type DarkElement,\r\n type VirtualNodeFactory,\r\n type ComponentFactory,\r\n ROOT,\r\n Fiber,\r\n EffectTag,\r\n platform,\r\n flatten,\r\n detectIsUndefined,\r\n TagVirtualNode,\r\n effectStoreHelper,\r\n wipRootHelper,\r\n currentRootHelper,\r\n nextUnitOfWorkHelper,\r\n fiberMountHelper,\r\n TaskPriority,\r\n createEmptyVirtualNode,\r\n} from '@dark-engine/core';\r\nimport { createNativeElement, applyCommit, finishCommitWork } from '../dom';\r\nimport { detectIsPortal, unmountPortal } from '../portal';\r\nimport { scheduleCallback, shouldYeildToHost } from '../scheduling';\r\n\r\nplatform.scheduleCallback = scheduleCallback;\r\nplatform.shouldYeildToHost = shouldYeildToHost;\r\nplatform.createNativeElement = createNativeElement as typeof platform.createNativeElement;\r\nplatform.applyCommit = applyCommit as typeof platform.applyCommit;\r\nplatform.finishCommitWork = finishCommitWork as typeof platform.finishCommitWork;\r\nplatform.detectIsPortal = detectIsPortal as typeof platform.detectIsPortal;\r\nplatform.unmountPortal = unmountPortal as typeof platform.unmountPortal;\r\n\r\nconst roots = new Map();\r\n\r\nfunction render(element: DarkElement, container: Element) {\r\n if (!(container instanceof Element)) {\r\n throw new Error(`[Dark]: render receives only Element as container!`);\r\n }\r\n\r\n const isMounted = !detectIsUndefined(roots.get(container));\r\n let rootId = null;\r\n\r\n if (!isMounted) {\r\n rootId = roots.size;\r\n\r\n roots.set(container, rootId);\r\n container.innerHTML = '';\r\n } else {\r\n rootId = roots.get(container);\r\n }\r\n\r\n const callback = () => {\r\n effectStoreHelper.set(rootId); // important order!\r\n const currentRootFiber = currentRootHelper.get();\r\n const fiber = new Fiber({\r\n nativeElement: container,\r\n instance: new TagVirtualNode({\r\n name: ROOT,\r\n children: flatten([element || createEmptyVirtualNode()]) as Array,\r\n }),\r\n alternate: currentRootFiber,\r\n effectTag: isMounted ? EffectTag.UPDATE : EffectTag.PLACEMENT,\r\n });\r\n\r\n currentRootFiber && (currentRootFiber.alternate = null);\r\n fiberMountHelper.reset();\r\n wipRootHelper.set(fiber);\r\n nextUnitOfWorkHelper.set(fiber);\r\n };\r\n\r\n platform.scheduleCallback(callback, { priority: TaskPriority.NORMAL });\r\n}\r\n\r\nexport { render, roots };\r\n","export * from './scheduling';\r\nexport * from './types';\r\n","import { type ScheduleCallbackOptions, getTime, workLoop, wipRootHelper, TaskPriority } from '@dark-engine/core';\r\nimport { type Callback } from './types';\r\n\r\ntype QueueByPriority = {\r\n hight: Array;\r\n normal: Array;\r\n low: Array;\r\n};\r\n\r\nconst queueByPriority: QueueByPriority = {\r\n hight: [],\r\n normal: [],\r\n low: [],\r\n};\r\nconst YEILD_INTERVAL = 10;\r\nlet scheduledCallback: Callback = null;\r\nlet deadline = 0;\r\nlet isMessageLoopRunning = false;\r\nlet currentTask: Task = null;\r\n\r\nclass Task {\r\n public static nextTaskId = 0;\r\n public id: number;\r\n public time: number;\r\n public timeoutMs: number;\r\n public priority: TaskPriority;\r\n public callback: () => void;\r\n\r\n constructor(options: Omit) {\r\n this.id = ++Task.nextTaskId;\r\n this.time = options.time;\r\n this.timeoutMs = options.timeoutMs;\r\n this.priority = options.priority;\r\n this.callback = options.callback;\r\n }\r\n}\r\n\r\nconst shouldYeildToHost = () => getTime() >= deadline;\r\n\r\nfunction scheduleCallback(callback: () => void, options?: ScheduleCallbackOptions) {\r\n const { priority = TaskPriority.NORMAL, timeoutMs } = options || {};\r\n const task = new Task({ time: getTime(), timeoutMs, priority, callback });\r\n const map: Record void> = {\r\n [TaskPriority.HIGH]: () => queueByPriority.hight.push(task),\r\n [TaskPriority.NORMAL]: () => queueByPriority.normal.push(task),\r\n [TaskPriority.LOW]: () => queueByPriority.low.push(task),\r\n };\r\n\r\n map[task.priority]();\r\n executeTasks();\r\n}\r\n\r\nfunction pick(queue: Array) {\r\n if (!queue.length) return false;\r\n currentTask = queue.shift();\r\n\r\n currentTask.callback();\r\n requestCallback(workLoop);\r\n\r\n return true;\r\n}\r\n\r\nfunction executeTasks() {\r\n const isBusy = Boolean(wipRootHelper.get());\r\n\r\n if (!isBusy) {\r\n checkOverdueTasks() ||\r\n pick(queueByPriority.hight) ||\r\n pick(queueByPriority.normal) ||\r\n requestIdleCallback(() => pick(queueByPriority.low));\r\n }\r\n}\r\n\r\nfunction checkOverdueTasks() {\r\n const [task] = queueByPriority.low;\r\n\r\n if (task && task.timeoutMs > 0 && getTime() - task.time > task.timeoutMs) {\r\n pick(queueByPriority.low);\r\n return true;\r\n }\r\n\r\n return false;\r\n}\r\n\r\nfunction performWorkUntilDeadline() {\r\n if (scheduledCallback) {\r\n deadline = getTime() + YEILD_INTERVAL;\r\n\r\n try {\r\n const hasMoreWork = scheduledCallback();\r\n\r\n if (!hasMoreWork) {\r\n currentTask = null;\r\n isMessageLoopRunning = false;\r\n scheduledCallback = null;\r\n executeTasks();\r\n } else {\r\n port.postMessage(null);\r\n }\r\n } catch (error) {\r\n port.postMessage(null);\r\n throw error;\r\n }\r\n } else {\r\n isMessageLoopRunning = false;\r\n }\r\n}\r\n\r\nfunction requestCallback(callback: Callback) {\r\n if (process.env.NODE_ENV === 'test') {\r\n return requestCallbackSync(callback);\r\n }\r\n\r\n scheduledCallback = callback;\r\n\r\n if (!isMessageLoopRunning) {\r\n isMessageLoopRunning = true;\r\n port.postMessage(null);\r\n }\r\n}\r\n\r\nfunction requestCallbackSync(callback: Callback) {\r\n while (callback()) {\r\n //\r\n }\r\n executeTasks();\r\n currentTask = null;\r\n}\r\n\r\nlet channel: MessageChannel = null;\r\nlet port: MessagePort = null;\r\n\r\nfunction setup() {\r\n if (process.env.NODE_ENV === 'test') {\r\n return;\r\n }\r\n\r\n channel = new MessageChannel();\r\n port = channel.port2;\r\n\r\n channel.port1.onmessage = performWorkUntilDeadline;\r\n}\r\n\r\nsetup();\r\n\r\nexport { shouldYeildToHost, scheduleCallback };\r\n","export type Callback = () => boolean;\r\n\r\nexport type Task = {\r\n id: number;\r\n priority: TaskPriority;\r\n calllback: () => void;\r\n};\r\n\r\nexport enum TaskPriority {\r\n HIGH = 2,\r\n NORMAL = 1,\r\n}\r\n","export * from './use-style';\r\n","import { useMemo, detectIsUndefined } from '@dark-engine/core';\r\n\r\nfunction styled(strings: TemplateStringsArray, ...args: Array): string {\r\n const style = useMemo(() => {\r\n return strings\r\n .map((x, idx) => x + (!detectIsUndefined(args[idx]) ? args[idx] : ''))\r\n .join('')\r\n .replace(/;\\s*/gm, ';')\r\n .replace(/:\\s*/gm, ':')\r\n .trim();\r\n }, [strings, ...args]);\r\n\r\n return style;\r\n}\r\n\r\ntype Style = Record;\r\n\r\ntype Config = (x: typeof styled) => T;\r\n\r\nfunction useStyle(config: Config) {\r\n return config(styled);\r\n}\r\n\r\nexport { useStyle };\r\n","module.exports = __WEBPACK_EXTERNAL_MODULE__dark_engine_core__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export { render } from './render';\r\nexport { createRoot } from './create-root';\r\nexport { createPortal } from './portal';\r\nexport { useStyle } from './use-style';\r\nexport type { SyntheticEvent } from './events';\r\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/packages/platform-browser/umd/dark-platform-browser.production.min.js b/packages/platform-browser/umd/dark-platform-browser.production.min.js index ae6c2670..071118ca 100644 --- a/packages/platform-browser/umd/dark-platform-browser.production.min.js +++ b/packages/platform-browser/umd/dark-platform-browser.production.min.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@dark-engine/core")):"function"==typeof define&&define.amd?define("DarkPlatformBrowser",["@dark-engine/core"],t):"object"==typeof exports?exports.DarkPlatformBrowser=t(require("@dark-engine/core")):e.DarkPlatformBrowser=t(e.DarkCore)}(self,(e=>(()=>{"use strict";var t={317:t=>{t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,r),a.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{r.r(o),r.d(o,{createPortal:()=>n,createRoot:()=>A,render:()=>S,useStyle:()=>j});var e=r(317),t=Symbol("portal");function n(e,n){var r;if(!(n instanceof Element))throw new Error("[Dark]: createPortal receives only Element as container!");return a(((r={})[t]=n,r.slot=e,r))}var a=(0,e.createComponent)((function(n){var r=n.slot,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},v=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i},d=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}(b.low,1)[0])&&t.timeoutMs>0&&(0,e.getTime)()-t.time>t.timeoutMs&&(x(b.low),1)||x(b.hight)||x(b.normal)||requestIdleCallback((function(){return x(b.low)}))}var O,P=null,I=null;P=new MessageChannel,I=P.port2,P.port1.onmessage=function(){if(T){w=(0,e.getTime)()+10;try{T()?I.postMessage(null):(k=!1,T=null,M())}catch(e){throw I.postMessage(null),e}}else k=!1},function(e){e[e.HIGH=2]="HIGH",e[e.NORMAL=1]="NORMAL"}(O||(O={})),e.platform.scheduleCallback=function(t,n){var r,o=n||{},a=o.priority,i=void 0===a?e.TaskPriority.NORMAL:a,l=o.timeoutMs,u=new N({time:(0,e.getTime)(),timeoutMs:l,priority:i,callback:t});((r={})[e.TaskPriority.HIGH]=function(){return b.hight.push(u)},r[e.TaskPriority.NORMAL]=function(){return b.normal.push(u)},r[e.TaskPriority.LOW]=function(){return b.low.push(u)},r)[u.priority](),M()},e.platform.shouldYeildToHost=function(){return(0,e.getTime)()>=w},e.platform.createNativeElement=function(t){if(!(0,e.detectIsVirtualNode)(t.instance))throw new Error("[Dark]: createNativeElement receives only virtual node!");return function(t){var n,r=((n={})[e.NodeType.TAG]=function(e){var t,n=e;return t=n.name,Boolean({svg:!0,circle:!0,ellipse:!0,g:!0,text:!0,tspan:!0,textPath:!0,path:!0,polygon:!0,polyline:!0,line:!0,rect:!0,use:!0,image:!0,symbol:!0,defs:!0,linearGradient:!0,radialGradient:!0,stop:!0,clipPath:!0,pattern:!0,mask:!0,marker:!0}[t])?document.createElementNS("http://www.w3.org/2000/svg",n.name):document.createElement(n.name)},n[e.NodeType.TEXT]=function(e){var t=e;return document.createTextNode(t.value)},n[e.NodeType.COMMENT]=function(e){var t=e;return document.createComment(t.value)},n);return r[t.type](t)}(t.instance)},e.platform.applyCommit=function(t){var n,r,o,a=function(e){for(var t=e;t;)if(t=t.parent,i(t.instance)&&(t.nativeElement=l(t.instance)),t.nativeElement)return t;return t}(t);if(null!==t.nativeElement&&t.effectTag===e.EffectTag.PLACEMENT)!function(t,n){var r,o=n.nativeElement,a=o.childNodes;0===a.length||function(e,t){for(var n,r=e;r;){if((null===(n=null==r?void 0:r.parent)||void 0===n?void 0:n.nativeElement)===t)return r.idx;r=r.parent}return-1}(t,o)>a.length-1?(r=(g.get(o)||{fragment:document.createDocumentFragment(),callback:function(){}}).fragment,g.set(o,{fragment:r,callback:function(){o.appendChild(r)}}),r.appendChild(t.nativeElement),t.markMountedToHost()):(o.insertBefore(t.nativeElement,function(t,n){var r=null;return(0,e.walkFiber)({fiber:t,onLoop:function(e){var t=e.nextFiber,o=e.stop,a=e.resetIsDeepWalking;return t.nativeElement&&t.nativeElement.parentElement===n?(r=t.nativeElement,o()):t.mountedToHost?void 0:a()}}),r}(t,o)),t.markMountedToHost()),function(t,n){var r,o;if((0,e.detectIsTagVirtualNode)(n)){var a=Object.keys(n.attrs);try{for(var i=m(a),l=i.next();!l.done;l=i.next()){var u=l.value,f=n.attrs[u];u!==e.ATTR_REF?(0,e.detectIsFunction)(f)?s(u)&&c({target:t,handler:f,eventName:p(u)}):(0,e.detectIsUndefined)(f)||y[u]||(E({tagName:n.name,value:f,attrName:u,element:t}),t.setAttribute(u,f)):h(f,t)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}}(t.nativeElement,t.instance)}(t,a);else if(null!==t.nativeElement&&t.effectTag===e.EffectTag.UPDATE){if(!(0,e.detectIsVirtualNode)(t.alternate.instance)||!(0,e.detectIsVirtualNode)(t.instance))return;var u=t.alternate.instance,f=t.instance;n=t.nativeElement,r=u,o=f,(0,e.detectIsTextVirtualNode)(r)&&(0,e.detectIsTextVirtualNode)(o)&&r.value!==o.value?n.textContent=o.value:(0,e.detectIsTagVirtualNode)(r)&&(0,e.detectIsTagVirtualNode)(o)&&function(t,n,r){var o,a,i=new Set(d(d([],v(Object.keys(n.attrs)),!1),v(Object.keys(r.attrs)),!1));try{for(var l=m(i),u=l.next();!u.done;u=l.next()){var f=u.value,g=n.attrs[f],b=r.attrs[f];f!==e.ATTR_REF?(0,e.detectIsUndefined)(b)?t.removeAttribute(f):(0,e.detectIsFunction)(g)?s(f)&&g!==b&&c({target:t,handler:b,eventName:p(f)}):y[f]||g===b||(E({tagName:r.name,value:b,attrName:f,element:t}),t.setAttribute(f,b)):h(g,t)}}catch(e){o={error:e}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(o)throw o.error}}}(n,r,o)}else t.effectTag===e.EffectTag.DELETION&&function(t,n){(0,e.walkFiber)({fiber:t,onLoop:function(e){var r=e.nextFiber,o=e.isReturn,a=e.resetIsDeepWalking,l=e.stop;return r===t.nextSibling||r===t.parent?l():!o&&r.nativeElement?(!i(r.instance)&&n.nativeElement.removeChild(r.nativeElement),a()):void 0}})}(t,a)},e.platform.finishCommitWork=function(){var e,t;try{for(var n=m(g.values()),r=n.next();!r.done;r=n.next())(0,r.value.callback)()}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}g=new Map},e.platform.detectIsPortal=i,e.platform.unmountPortal=function(e){var t=l(e.instance);t&&(t.innerHTML="")};var H=new Map;function S(t,n){if(!(n instanceof Element))throw new Error("[Dark]: render receives only Element as container!");var r=!(0,e.detectIsUndefined)(H.get(n)),o=null;r?o=H.get(n):(o=H.size,H.set(n,o),n.innerHTML=""),e.platform.scheduleCallback((function(){e.effectStoreHelper.set(o);var a=e.currentRootHelper.get(),i=new e.Fiber({nativeElement:n,instance:new e.TagVirtualNode({name:e.ROOT,children:(0,e.flatten)([t||(0,e.createEmptyVirtualNode)()])}),alternate:a,effectTag:r?e.EffectTag.UPDATE:e.EffectTag.PLACEMENT});a&&(a.alternate=null),e.fiberMountHelper.reset(),e.wipRootHelper.set(i),e.nextUnitOfWorkHelper.set(i)}),{priority:e.TaskPriority.NORMAL})}function A(t){return{render:function(e){return S(e,t)},unmount:function(){var n=H.get(t);(0,e.unmountRoot)(n,(function(){H.delete(t),t.innerHTML=""}))}}}var R=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i},L=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o(()=>{"use strict";var t={317:t=>{t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,r),a.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{r.r(o),r.d(o,{createPortal:()=>n,createRoot:()=>A,render:()=>S,useStyle:()=>j});var e=r(317),t=Symbol("portal");function n(e,n){var r;if(!(n instanceof Element))throw new Error("[Dark]: createPortal receives only Element as container!");return a(((r={})[t]=n,r.slot=e,r))}var a=(0,e.createComponent)((function(n){var r=n.slot,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},v=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i},d=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}(b.low,1)[0])&&t.timeoutMs>0&&(0,e.getTime)()-t.time>t.timeoutMs&&(M(b.low),1)||M(b.hight)||M(b.normal)||requestIdleCallback((function(){return M(b.low)}))}var O,P=null,I=null;P=new MessageChannel,I=P.port2,P.port1.onmessage=function(){if(T){w=(0,e.getTime)()+10;try{T()?I.postMessage(null):(k=!1,T=null,N())}catch(e){throw I.postMessage(null),e}}else k=!1},function(e){e[e.HIGH=2]="HIGH",e[e.NORMAL=1]="NORMAL"}(O||(O={})),e.platform.scheduleCallback=function(t,n){var r,o=n||{},a=o.priority,i=void 0===a?e.TaskPriority.NORMAL:a,l=o.timeoutMs,u=new x({time:(0,e.getTime)(),timeoutMs:l,priority:i,callback:t});((r={})[e.TaskPriority.HIGH]=function(){return b.hight.push(u)},r[e.TaskPriority.NORMAL]=function(){return b.normal.push(u)},r[e.TaskPriority.LOW]=function(){return b.low.push(u)},r)[u.priority](),N()},e.platform.shouldYeildToHost=function(){return(0,e.getTime)()>=w},e.platform.createNativeElement=function(t){var n,r=((n={})[e.NodeType.TAG]=function(e){var t,n=e;return t=n.name,Boolean({svg:!0,circle:!0,ellipse:!0,g:!0,text:!0,tspan:!0,textPath:!0,path:!0,polygon:!0,polyline:!0,line:!0,rect:!0,use:!0,image:!0,symbol:!0,defs:!0,linearGradient:!0,radialGradient:!0,stop:!0,clipPath:!0,pattern:!0,mask:!0,marker:!0}[t])?document.createElementNS("http://www.w3.org/2000/svg",n.name):document.createElement(n.name)},n[e.NodeType.TEXT]=function(e){var t=e;return document.createTextNode(t.value)},n[e.NodeType.COMMENT]=function(e){var t=e;return document.createComment(t.value)},n);return r[t.type](t)},e.platform.applyCommit=function(t){var n,r,o,a=function(e){for(var t=e;t;)if(t=t.parent,i(t.instance)&&(t.nativeElement=l(t.instance)),t.nativeElement)return t;return t}(t);if(null!==t.nativeElement&&t.effectTag===e.EffectTag.PLACEMENT)!function(t,n){var r,o=n.nativeElement,a=o.childNodes;0===a.length||function(e,t){for(var n,r=e;r;){if((null===(n=null==r?void 0:r.parent)||void 0===n?void 0:n.nativeElement)===t)return r.idx;r=r.parent}return-1}(t,o)>a.length-1?(r=(g.get(o)||{fragment:document.createDocumentFragment(),callback:function(){}}).fragment,g.set(o,{fragment:r,callback:function(){o.appendChild(r)}}),r.appendChild(t.nativeElement),t.markMountedToHost()):(o.insertBefore(t.nativeElement,function(t,n){var r=null;return(0,e.walkFiber)({fiber:t,onLoop:function(e){var t=e.nextFiber,o=e.stop,a=e.resetIsDeepWalking;return t.nativeElement&&t.nativeElement.parentElement===n?(r=t.nativeElement,o()):t.mountedToHost?void 0:a()}}),r}(t,o)),t.markMountedToHost()),function(t,n){var r,o;if((0,e.detectIsTagVirtualNode)(n)){var a=Object.keys(n.attrs);try{for(var i=m(a),l=i.next();!l.done;l=i.next()){var u=l.value,f=n.attrs[u];u!==e.ATTR_REF?(0,e.detectIsFunction)(f)?s(u)&&c({target:t,handler:f,eventName:p(u)}):(0,e.detectIsUndefined)(f)||y[u]||(E({tagName:n.name,value:f,attrName:u,element:t}),t.setAttribute(u,f)):h(f,t)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}}(t.nativeElement,t.instance)}(t,a);else if(null!==t.nativeElement&&t.effectTag===e.EffectTag.UPDATE){if(!(0,e.detectIsVirtualNode)(t.alternate.instance)||!(0,e.detectIsVirtualNode)(t.instance))return;var u=t.alternate.instance,f=t.instance;n=t.nativeElement,r=u,o=f,(0,e.detectIsTextVirtualNode)(r)&&(0,e.detectIsTextVirtualNode)(o)&&r.value!==o.value?n.textContent=o.value:(0,e.detectIsTagVirtualNode)(r)&&(0,e.detectIsTagVirtualNode)(o)&&function(t,n,r){var o,a,i=new Set(d(d([],v(Object.keys(n.attrs)),!1),v(Object.keys(r.attrs)),!1));try{for(var l=m(i),u=l.next();!u.done;u=l.next()){var f=u.value,g=n.attrs[f],b=r.attrs[f];f!==e.ATTR_REF?(0,e.detectIsUndefined)(b)?t.removeAttribute(f):(0,e.detectIsFunction)(g)?s(f)&&g!==b&&c({target:t,handler:b,eventName:p(f)}):y[f]||g===b||(E({tagName:r.name,value:b,attrName:f,element:t}),t.setAttribute(f,b)):h(g,t)}}catch(e){o={error:e}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(o)throw o.error}}}(n,r,o)}else t.effectTag===e.EffectTag.DELETION&&function(t,n){(0,e.walkFiber)({fiber:t,onLoop:function(e){var r=e.nextFiber,o=e.isReturn,a=e.resetIsDeepWalking,l=e.stop;return r===t.nextSibling||r===t.parent?l():!o&&r.nativeElement?(!i(r.instance)&&n.nativeElement.removeChild(r.nativeElement),a()):void 0}})}(t,a)},e.platform.finishCommitWork=function(){var e,t;try{for(var n=m(g.values()),r=n.next();!r.done;r=n.next())(0,r.value.callback)()}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}g=new Map},e.platform.detectIsPortal=i,e.platform.unmountPortal=function(e){var t=l(e.instance);t&&(t.innerHTML="")};var H=new Map;function S(t,n){if(!(n instanceof Element))throw new Error("[Dark]: render receives only Element as container!");var r=!(0,e.detectIsUndefined)(H.get(n)),o=null;r?o=H.get(n):(o=H.size,H.set(n,o),n.innerHTML=""),e.platform.scheduleCallback((function(){e.effectStoreHelper.set(o);var a=e.currentRootHelper.get(),i=new e.Fiber({nativeElement:n,instance:new e.TagVirtualNode({name:e.ROOT,children:(0,e.flatten)([t||(0,e.createEmptyVirtualNode)()])}),alternate:a,effectTag:r?e.EffectTag.UPDATE:e.EffectTag.PLACEMENT});a&&(a.alternate=null),e.fiberMountHelper.reset(),e.wipRootHelper.set(i),e.nextUnitOfWorkHelper.set(i)}),{priority:e.TaskPriority.NORMAL})}function A(t){return{render:function(e){return S(e,t)},unmount:function(){var n=H.get(t);(0,e.unmountRoot)(n,(function(){H.delete(t),t.innerHTML=""}))}}}var R=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i},L=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE__317__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import {\r\n type Fiber,\r\n type DarkElement,\r\n type ComponentFactory,\r\n createComponent,\r\n detectIsComponentFactory,\r\n useMemo,\r\n} from '@dark-engine/core';\r\n\r\nconst $$portal = Symbol('portal');\r\n\r\nfunction createPortal(slot: DarkElement, container: Element) {\r\n if (!(container instanceof Element)) {\r\n throw new Error(`[Dark]: createPortal receives only Element as container!`);\r\n }\r\n\r\n return Portal({ [$$portal]: container, slot });\r\n}\r\n\r\ntype PortalProps = {\r\n [$$portal]: Element;\r\n slot: DarkElement;\r\n};\r\n\r\nconst Portal = createComponent(\r\n ({ slot, ...rest }) => {\r\n useMemo(() => (rest[$$portal].innerHTML = ''), []);\r\n\r\n return slot;\r\n },\r\n { token: $$portal },\r\n);\r\n\r\nconst detectIsPortal = (factory: unknown): factory is ComponentFactory =>\r\n detectIsComponentFactory(factory) && factory.token === $$portal;\r\n\r\nconst getPortalContainer = (factory: unknown): Element | null =>\r\n detectIsPortal(factory) ? factory.props[$$portal] : null;\r\n\r\nfunction unmountPortal(fiber: Fiber) {\r\n const container = getPortalContainer(fiber.instance);\r\n\r\n if (container) {\r\n container.innerHTML = '';\r\n }\r\n}\r\n\r\nexport { createPortal, detectIsPortal, getPortalContainer, unmountPortal };\r\n","import { detectIsFunction, eventsHelper } from '@dark-engine/core';\r\n\r\ntype BrowserEventConstructor = (type: string, event: Event) => void;\r\n\r\nclass SyntheticEvent {\r\n public type = '';\r\n public sourceEvent: E = null;\r\n public target: T = null;\r\n private propagation = true;\r\n\r\n constructor(options: Pick, 'sourceEvent' | 'target'>) {\r\n this.type = options.sourceEvent.type;\r\n this.sourceEvent = options.sourceEvent;\r\n this.target = options.target;\r\n }\r\n\r\n public stopPropagation() {\r\n this.propagation = false;\r\n this.sourceEvent.stopPropagation();\r\n }\r\n\r\n public preventDefault() {\r\n this.sourceEvent.preventDefault();\r\n }\r\n\r\n public getPropagation() {\r\n return this.propagation;\r\n }\r\n}\r\n\r\ntype DelegateEventOptions = {\r\n target: Element;\r\n eventName: string;\r\n handler: (e: Event) => void;\r\n};\r\n\r\nfunction delegateEvent(options: DelegateEventOptions) {\r\n const { target, eventName, handler } = options;\r\n const eventsStore = eventsHelper.get();\r\n const handlerMap = eventsStore.get(eventName);\r\n\r\n if (!handlerMap) {\r\n const rootHandler = (event: Event) => {\r\n const fireEvent = eventsStore.get(eventName).get(event.target);\r\n const target = event.target as Element;\r\n let syntheticEvent: SyntheticEvent = null;\r\n\r\n if (detectIsFunction(fireEvent)) {\r\n syntheticEvent = new SyntheticEvent({\r\n sourceEvent: event,\r\n target,\r\n });\r\n fireEvent(syntheticEvent);\r\n }\r\n\r\n if (syntheticEvent ? syntheticEvent.getPropagation() : target.parentElement) {\r\n target.parentElement.dispatchEvent(new (event.constructor as BrowserEventConstructor)(event.type, event));\r\n }\r\n };\r\n\r\n eventsStore.set(eventName, new WeakMap([[target, handler]]));\r\n document.addEventListener(eventName, rootHandler, true);\r\n eventsHelper.addUnsubscriber(() => document.removeEventListener(eventName, rootHandler, true));\r\n } else {\r\n handlerMap.set(target, handler);\r\n }\r\n}\r\n\r\nconst detectIsEvent = (attrName: string) => attrName.startsWith('on');\r\n\r\nconst getEventName = (attrName: string) => attrName.slice(2, attrName.length).toLowerCase();\r\n\r\nexport { SyntheticEvent, delegateEvent, detectIsEvent, getEventName };\r\n","import {\r\n type Fiber,\r\n type VirtualNode,\r\n type TagVirtualNode,\r\n type TextVirtualNode,\r\n type CommentVirtualNode,\r\n type MutableRef,\r\n ATTR_KEY,\r\n ATTR_REF,\r\n EffectTag,\r\n detectIsFunction,\r\n detectIsUndefined,\r\n NodeType,\r\n detectIsVirtualNode,\r\n detectIsTagVirtualNode,\r\n detectIsTextVirtualNode,\r\n detectIsRef,\r\n walkFiber,\r\n} from '@dark-engine/core';\r\nimport { detectIsPortal, getPortalContainer } from '../portal';\r\nimport { delegateEvent, detectIsEvent, getEventName } from '../events';\r\nimport type { DOMElement, DOMFragment } from './types';\r\n\r\nconst attrBlackListMap = {\r\n [ATTR_KEY]: true,\r\n [ATTR_REF]: true,\r\n};\r\n\r\nlet fragmentsMap: Map = new Map();\r\n\r\nfunction createElement(vNode: VirtualNode): DOMElement {\r\n const map = {\r\n [NodeType.TAG]: (vNode: VirtualNode) => {\r\n const tagNode = vNode as TagVirtualNode;\r\n const node = detectIsSvgElement(tagNode.name)\r\n ? document.createElementNS('http://www.w3.org/2000/svg', tagNode.name)\r\n : document.createElement(tagNode.name);\r\n\r\n return node;\r\n },\r\n [NodeType.TEXT]: (vNode: VirtualNode) => {\r\n const textNode = vNode as TextVirtualNode;\r\n const node = document.createTextNode(textNode.value);\r\n\r\n return node;\r\n },\r\n [NodeType.COMMENT]: (vNode: VirtualNode) => {\r\n const commentNode = vNode as CommentVirtualNode;\r\n const node = document.createComment(commentNode.value);\r\n\r\n return node;\r\n },\r\n };\r\n\r\n return map[vNode.type](vNode);\r\n}\r\n\r\nfunction detectIsSvgElement(tagName) {\r\n const tagMap = {\r\n svg: true,\r\n circle: true,\r\n ellipse: true,\r\n g: true,\r\n text: true,\r\n tspan: true,\r\n textPath: true,\r\n path: true,\r\n polygon: true,\r\n polyline: true,\r\n line: true,\r\n rect: true,\r\n use: true,\r\n image: true,\r\n symbol: true,\r\n defs: true,\r\n linearGradient: true,\r\n radialGradient: true,\r\n stop: true,\r\n clipPath: true,\r\n pattern: true,\r\n mask: true,\r\n marker: true,\r\n };\r\n\r\n return Boolean(tagMap[tagName]);\r\n}\r\n\r\nfunction createNativeElement(fiber: Fiber): DOMElement {\r\n if (!detectIsVirtualNode(fiber.instance)) {\r\n throw new Error('[Dark]: createNativeElement receives only virtual node!');\r\n }\r\n\r\n return createElement(fiber.instance);\r\n}\r\n\r\nfunction applyRef(ref: MutableRef, element: Element) {\r\n if (detectIsRef(ref)) {\r\n ref.current = element;\r\n }\r\n}\r\n\r\nfunction addAttributes(element: Element, vNode: VirtualNode) {\r\n if (!detectIsTagVirtualNode(vNode)) return;\r\n const attrNames = Object.keys(vNode.attrs);\r\n\r\n for (const attrName of attrNames) {\r\n const attrValue = vNode.attrs[attrName];\r\n\r\n if (attrName === ATTR_REF) {\r\n applyRef(attrValue as MutableRef, element);\r\n continue;\r\n }\r\n\r\n if (detectIsFunction(attrValue)) {\r\n if (detectIsEvent(attrName)) {\r\n delegateEvent({\r\n target: element,\r\n handler: attrValue,\r\n eventName: getEventName(attrName),\r\n });\r\n }\r\n } else if (!detectIsUndefined(attrValue) && !attrBlackListMap[attrName]) {\r\n upgradeInputAttributes({\r\n tagName: vNode.name,\r\n value: attrValue,\r\n attrName,\r\n element,\r\n });\r\n\r\n element.setAttribute(attrName, attrValue);\r\n }\r\n }\r\n}\r\n\r\nfunction updateAttributes(element: Element, vNode: TagVirtualNode, nextVNode: TagVirtualNode) {\r\n const attrNames = new Set([...Object.keys(vNode.attrs), ...Object.keys(nextVNode.attrs)]);\r\n\r\n for (const attrName of attrNames) {\r\n const prevAttrValue = vNode.attrs[attrName];\r\n const nextAttrValue = nextVNode.attrs[attrName];\r\n\r\n if (attrName === ATTR_REF) {\r\n applyRef(prevAttrValue as MutableRef, element);\r\n continue;\r\n }\r\n\r\n if (!detectIsUndefined(nextAttrValue)) {\r\n if (detectIsFunction(prevAttrValue)) {\r\n if (detectIsEvent(attrName) && prevAttrValue !== nextAttrValue) {\r\n delegateEvent({\r\n target: element,\r\n handler: nextAttrValue,\r\n eventName: getEventName(attrName),\r\n });\r\n }\r\n } else if (!attrBlackListMap[attrName] && prevAttrValue !== nextAttrValue) {\r\n upgradeInputAttributes({\r\n tagName: nextVNode.name,\r\n value: nextAttrValue,\r\n attrName,\r\n element,\r\n });\r\n\r\n element.setAttribute(attrName, nextAttrValue);\r\n }\r\n } else {\r\n element.removeAttribute(attrName);\r\n }\r\n }\r\n}\r\n\r\ntype UpgradeInputAttributesOptions = {\r\n tagName: string;\r\n element: Element;\r\n attrName: string;\r\n value: string | boolean;\r\n};\r\n\r\nfunction upgradeInputAttributes(options: UpgradeInputAttributesOptions) {\r\n const { tagName, element, attrName, value } = options;\r\n const map = {\r\n input: () => {\r\n const attrsMap = {\r\n value: true,\r\n checked: true,\r\n };\r\n\r\n if (attrsMap[attrName]) {\r\n element[attrName] = value;\r\n }\r\n },\r\n option: () => {\r\n const attrsMap = {\r\n selected: true,\r\n };\r\n\r\n if (attrsMap[attrName]) {\r\n element[attrName] = value;\r\n }\r\n },\r\n };\r\n\r\n map[tagName] && map[tagName]();\r\n}\r\n\r\nfunction getParentFiberWithNativeElement(fiber: Fiber): Fiber {\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n nextFiber = nextFiber.parent;\r\n\r\n if (detectIsPortal(nextFiber.instance)) {\r\n nextFiber.nativeElement = getPortalContainer(nextFiber.instance);\r\n }\r\n\r\n if (nextFiber.nativeElement) return nextFiber;\r\n }\r\n\r\n return nextFiber;\r\n}\r\n\r\nfunction getNodeOnTheRight(fiber: Fiber, parentElement: Element) {\r\n let node: Element = null;\r\n\r\n walkFiber({\r\n fiber,\r\n onLoop: ({ nextFiber, stop, resetIsDeepWalking }) => {\r\n if (nextFiber.nativeElement && nextFiber.nativeElement.parentElement === parentElement) {\r\n node = nextFiber.nativeElement;\r\n\r\n return stop();\r\n }\r\n\r\n if (!nextFiber.mountedToHost) {\r\n return resetIsDeepWalking();\r\n }\r\n },\r\n });\r\n\r\n return node;\r\n}\r\n\r\nfunction getChildIndex(fiber: Fiber, parentNativeElement: Element) {\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n if (nextFiber?.parent?.nativeElement === parentNativeElement) {\r\n return nextFiber.idx;\r\n }\r\n\r\n nextFiber = nextFiber.parent;\r\n }\r\n\r\n return -1;\r\n}\r\n\r\nfunction commitPlacement(fiber: Fiber, parentFiber: Fiber) {\r\n const parentNativeElement = parentFiber.nativeElement;\r\n const childNodes = parentNativeElement.childNodes;\r\n\r\n const append = () => {\r\n const { fragment } =\r\n fragmentsMap.get(parentNativeElement) ||\r\n ({\r\n fragment: document.createDocumentFragment(),\r\n callback: () => {},\r\n } as DOMFragment);\r\n\r\n fragmentsMap.set(parentNativeElement, {\r\n fragment,\r\n callback: () => {\r\n parentNativeElement.appendChild(fragment);\r\n },\r\n });\r\n fragment.appendChild(fiber.nativeElement);\r\n fiber.markMountedToHost();\r\n };\r\n\r\n const insert = () => {\r\n parentNativeElement.insertBefore(fiber.nativeElement, getNodeOnTheRight(fiber, parentNativeElement));\r\n fiber.markMountedToHost();\r\n };\r\n\r\n if (childNodes.length === 0 || getChildIndex(fiber, parentNativeElement) > childNodes.length - 1) {\r\n append();\r\n } else {\r\n insert();\r\n }\r\n\r\n addAttributes(fiber.nativeElement, fiber.instance as VirtualNode);\r\n}\r\n\r\nfunction commitUpdate(element: Element, instance: VirtualNode, nextInstance: VirtualNode) {\r\n if (\r\n detectIsTextVirtualNode(instance) &&\r\n detectIsTextVirtualNode(nextInstance) &&\r\n instance.value !== nextInstance.value\r\n ) {\r\n return (element.textContent = nextInstance.value);\r\n }\r\n\r\n if (detectIsTagVirtualNode(instance) && detectIsTagVirtualNode(nextInstance)) {\r\n return updateAttributes(element, instance, nextInstance);\r\n }\r\n}\r\n\r\nfunction commitDeletion(fiber: Fiber, parentFiber: Fiber) {\r\n walkFiber({\r\n fiber,\r\n onLoop: ({ nextFiber, isReturn, resetIsDeepWalking, stop }) => {\r\n if (nextFiber === fiber.nextSibling || nextFiber === fiber.parent) {\r\n return stop();\r\n }\r\n\r\n if (!isReturn && nextFiber.nativeElement) {\r\n !detectIsPortal(nextFiber.instance) && parentFiber.nativeElement.removeChild(nextFiber.nativeElement);\r\n\r\n return resetIsDeepWalking();\r\n }\r\n },\r\n });\r\n}\r\n\r\nfunction applyCommit(fiber: Fiber) {\r\n const parentFiber = getParentFiberWithNativeElement(fiber);\r\n\r\n if (fiber.nativeElement !== null && fiber.effectTag === EffectTag.PLACEMENT) {\r\n commitPlacement(fiber, parentFiber);\r\n } else if (fiber.nativeElement !== null && fiber.effectTag === EffectTag.UPDATE) {\r\n if (!detectIsVirtualNode(fiber.alternate.instance) || !detectIsVirtualNode(fiber.instance)) return;\r\n const vNode: VirtualNode = fiber.alternate.instance;\r\n const nextVNode: VirtualNode = fiber.instance;\r\n\r\n commitUpdate(fiber.nativeElement, vNode, nextVNode);\r\n } else if (fiber.effectTag === EffectTag.DELETION) {\r\n commitDeletion(fiber, parentFiber);\r\n }\r\n}\r\n\r\nfunction finishCommitWork() {\r\n for (const { callback } of fragmentsMap.values()) {\r\n callback();\r\n }\r\n\r\n fragmentsMap = new Map();\r\n}\r\n\r\nexport { createNativeElement, applyCommit, finishCommitWork };\r\n","import { type ScheduleCallbackOptions, getTime, workLoop, wipRootHelper, TaskPriority } from '@dark-engine/core';\r\nimport { type Callback } from './types';\r\n\r\ntype QueueByPriority = {\r\n hight: Array;\r\n normal: Array;\r\n low: Array;\r\n};\r\n\r\nconst queueByPriority: QueueByPriority = {\r\n hight: [],\r\n normal: [],\r\n low: [],\r\n};\r\nconst YEILD_INTERVAL = 10;\r\nlet scheduledCallback: Callback = null;\r\nlet deadline = 0;\r\nlet isMessageLoopRunning = false;\r\nlet currentTask: Task = null;\r\n\r\nclass Task {\r\n public static nextTaskId = 0;\r\n public id: number;\r\n public time: number;\r\n public timeoutMs: number;\r\n public priority: TaskPriority;\r\n public callback: () => void;\r\n\r\n constructor(options: Omit) {\r\n this.id = ++Task.nextTaskId;\r\n this.time = options.time;\r\n this.timeoutMs = options.timeoutMs;\r\n this.priority = options.priority;\r\n this.callback = options.callback;\r\n }\r\n}\r\n\r\nconst shouldYeildToHost = () => getTime() >= deadline;\r\n\r\nfunction scheduleCallback(callback: () => void, options?: ScheduleCallbackOptions) {\r\n const { priority = TaskPriority.NORMAL, timeoutMs } = options || {};\r\n const task = new Task({ time: getTime(), timeoutMs, priority, callback });\r\n const map: Record void> = {\r\n [TaskPriority.HIGH]: () => queueByPriority.hight.push(task),\r\n [TaskPriority.NORMAL]: () => queueByPriority.normal.push(task),\r\n [TaskPriority.LOW]: () => queueByPriority.low.push(task),\r\n };\r\n\r\n map[task.priority]();\r\n executeTasks();\r\n}\r\n\r\nfunction pick(queue: Array) {\r\n if (!queue.length) return false;\r\n currentTask = queue.shift();\r\n\r\n currentTask.callback();\r\n requestCallback(workLoop);\r\n\r\n return true;\r\n}\r\n\r\nfunction executeTasks() {\r\n const isBusy = Boolean(wipRootHelper.get());\r\n\r\n if (!isBusy) {\r\n checkOverdueTasks() ||\r\n pick(queueByPriority.hight) ||\r\n pick(queueByPriority.normal) ||\r\n requestIdleCallback(() => pick(queueByPriority.low));\r\n }\r\n}\r\n\r\nfunction checkOverdueTasks() {\r\n const [task] = queueByPriority.low;\r\n\r\n if (task && task.timeoutMs > 0 && getTime() - task.time > task.timeoutMs) {\r\n pick(queueByPriority.low);\r\n return true;\r\n }\r\n\r\n return false;\r\n}\r\n\r\nfunction performWorkUntilDeadline() {\r\n if (scheduledCallback) {\r\n deadline = getTime() + YEILD_INTERVAL;\r\n\r\n try {\r\n const hasMoreWork = scheduledCallback();\r\n\r\n if (!hasMoreWork) {\r\n currentTask = null;\r\n isMessageLoopRunning = false;\r\n scheduledCallback = null;\r\n executeTasks();\r\n } else {\r\n port.postMessage(null);\r\n }\r\n } catch (error) {\r\n port.postMessage(null);\r\n throw error;\r\n }\r\n } else {\r\n isMessageLoopRunning = false;\r\n }\r\n}\r\n\r\nfunction requestCallback(callback: Callback) {\r\n if (process.env.NODE_ENV === 'test') {\r\n return requestCallbackSync(callback);\r\n }\r\n\r\n scheduledCallback = callback;\r\n\r\n if (!isMessageLoopRunning) {\r\n isMessageLoopRunning = true;\r\n port.postMessage(null);\r\n }\r\n}\r\n\r\nfunction requestCallbackSync(callback: Callback) {\r\n while (callback()) {\r\n //\r\n }\r\n executeTasks();\r\n currentTask = null;\r\n}\r\n\r\nlet channel: MessageChannel = null;\r\nlet port: MessagePort = null;\r\n\r\nfunction setup() {\r\n if (process.env.NODE_ENV === 'test') {\r\n return;\r\n }\r\n\r\n channel = new MessageChannel();\r\n port = channel.port2;\r\n\r\n channel.port1.onmessage = performWorkUntilDeadline;\r\n}\r\n\r\nsetup();\r\n\r\nexport { shouldYeildToHost, scheduleCallback };\r\n","export type Callback = () => boolean;\r\n\r\nexport type Task = {\r\n id: number;\r\n priority: TaskPriority;\r\n calllback: () => void;\r\n};\r\n\r\nexport enum TaskPriority {\r\n HIGH = 2,\r\n NORMAL = 1,\r\n}\r\n","import {\r\n type DarkElement,\r\n type VirtualNodeFactory,\r\n type ComponentFactory,\r\n ROOT,\r\n Fiber,\r\n EffectTag,\r\n platform,\r\n flatten,\r\n detectIsUndefined,\r\n TagVirtualNode,\r\n effectStoreHelper,\r\n wipRootHelper,\r\n currentRootHelper,\r\n nextUnitOfWorkHelper,\r\n fiberMountHelper,\r\n TaskPriority,\r\n createEmptyVirtualNode,\r\n} from '@dark-engine/core';\r\nimport { createNativeElement, applyCommit, finishCommitWork } from '../dom';\r\nimport { detectIsPortal, unmountPortal } from '../portal';\r\nimport { scheduleCallback, shouldYeildToHost } from '../scheduling';\r\n\r\nplatform.scheduleCallback = scheduleCallback;\r\nplatform.shouldYeildToHost = shouldYeildToHost;\r\nplatform.createNativeElement = createNativeElement as typeof platform.createNativeElement;\r\nplatform.applyCommit = applyCommit as typeof platform.applyCommit;\r\nplatform.finishCommitWork = finishCommitWork as typeof platform.finishCommitWork;\r\nplatform.detectIsPortal = detectIsPortal as typeof platform.detectIsPortal;\r\nplatform.unmountPortal = unmountPortal as typeof platform.unmountPortal;\r\n\r\nconst roots = new Map();\r\n\r\nfunction render(element: DarkElement, container: Element) {\r\n if (!(container instanceof Element)) {\r\n throw new Error(`[Dark]: render receives only Element as container!`);\r\n }\r\n\r\n const isMounted = !detectIsUndefined(roots.get(container));\r\n let rootId = null;\r\n\r\n if (!isMounted) {\r\n rootId = roots.size;\r\n\r\n roots.set(container, rootId);\r\n container.innerHTML = '';\r\n } else {\r\n rootId = roots.get(container);\r\n }\r\n\r\n const callback = () => {\r\n effectStoreHelper.set(rootId); // important order!\r\n const currentRootFiber = currentRootHelper.get();\r\n const fiber = new Fiber({\r\n nativeElement: container,\r\n instance: new TagVirtualNode({\r\n name: ROOT,\r\n children: flatten([element || createEmptyVirtualNode()]) as Array,\r\n }),\r\n alternate: currentRootFiber,\r\n effectTag: isMounted ? EffectTag.UPDATE : EffectTag.PLACEMENT,\r\n });\r\n\r\n currentRootFiber && (currentRootFiber.alternate = null);\r\n fiberMountHelper.reset();\r\n wipRootHelper.set(fiber);\r\n nextUnitOfWorkHelper.set(fiber);\r\n };\r\n\r\n platform.scheduleCallback(callback, { priority: TaskPriority.NORMAL });\r\n}\r\n\r\nexport { render, roots };\r\n","import { type DarkElement, unmountRoot } from '@dark-engine/core';\r\nimport { render, roots } from '../render';\r\n\r\nfunction createRoot(container: Element) {\r\n return {\r\n render: (element: DarkElement) => render(element, container),\r\n unmount: () => {\r\n const rootId = roots.get(container);\r\n\r\n unmountRoot(rootId, () => {\r\n roots.delete(container);\r\n container.innerHTML = '';\r\n });\r\n },\r\n };\r\n}\r\n\r\nexport { createRoot };\r\n","import { useMemo, detectIsUndefined } from '@dark-engine/core';\r\n\r\nfunction styled(strings: TemplateStringsArray, ...args: Array): string {\r\n const style = useMemo(() => {\r\n return strings\r\n .map((x, idx) => x + (!detectIsUndefined(args[idx]) ? args[idx] : ''))\r\n .join('')\r\n .replace(/;\\s*/gm, ';')\r\n .replace(/:\\s*/gm, ':')\r\n .trim();\r\n }, [strings, ...args]);\r\n\r\n return style;\r\n}\r\n\r\ntype Style = Record;\r\n\r\ntype Config = (x: typeof styled) => T;\r\n\r\nfunction useStyle(config: Config) {\r\n return config(styled);\r\n}\r\n\r\nexport { useStyle };\r\n"],"names":["root","factory","exports","module","require","define","amd","self","__WEBPACK_EXTERNAL_MODULE__317__","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","$$portal","createPortal","slot","container","Element","Error","Portal","createComponent","rest","useMemo","innerHTML","token","detectIsPortal","detectIsComponentFactory","getPortalContainer","props","options","type","sourceEvent","target","propagation","this","stopPropagation","preventDefault","getPropagation","delegateEvent","eventName","handler","eventsStore","eventsHelper","handlerMap","set","event","fireEvent","syntheticEvent","detectIsFunction","SyntheticEvent","parentElement","dispatchEvent","constructor","WeakMap","document","addEventListener","removeEventListener","detectIsEvent","attrName","startsWith","getEventName","slice","length","toLowerCase","attrBlackListMap","ATTR_KEY","ATTR_REF","fragmentsMap","Map","applyRef","ref","element","detectIsRef","current","upgradeInputAttributes","tagName","map","input","checked","option","selected","queueByPriority","hight","normal","low","scheduledCallback","deadline","isMessageLoopRunning","id","Task","nextTaskId","time","timeoutMs","priority","callback","pick","queue","shift","workLoop","port","postMessage","executeTasks","task","Boolean","wipRootHelper","getTime","requestIdleCallback","TaskPriority","channel","MessageChannel","port2","port1","onmessage","error","platform","push","fiber","detectIsVirtualNode","instance","vNode","NodeType","tagNode","name","svg","circle","ellipse","g","text","tspan","textPath","path","polygon","polyline","line","rect","use","image","symbol","defs","linearGradient","radialGradient","stop","clipPath","pattern","mask","marker","createElementNS","createElement","textNode","createTextNode","commentNode","createComment","nextInstance","parentFiber","nextFiber","parent","nativeElement","getParentFiberWithNativeElement","effectTag","EffectTag","fragment","parentNativeElement","childNodes","idx","getChildIndex","createDocumentFragment","appendChild","markMountedToHost","insertBefore","node","walkFiber","onLoop","resetIsDeepWalking","mountedToHost","getNodeOnTheRight","detectIsTagVirtualNode","attrNames","keys","attrs","attrValue","detectIsUndefined","setAttribute","addAttributes","commitPlacement","alternate","nextVNode","detectIsTextVirtualNode","textContent","Set","prevAttrValue","nextAttrValue","removeAttribute","updateAttributes","isReturn","nextSibling","removeChild","commitDeletion","values","roots","render","isMounted","rootId","size","effectStoreHelper","currentRootFiber","currentRootHelper","Fiber","TagVirtualNode","ROOT","children","flatten","createEmptyVirtualNode","fiberMountHelper","nextUnitOfWorkHelper","createRoot","unmount","unmountRoot","styled","strings","style","x","args","join","replace","trim","useStyle","config"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"dark-platform-browser.production.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,sBACR,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,sBAAuB,CAAC,qBAAsBJ,GAC3B,iBAAZC,QACdA,QAA6B,oBAAID,EAAQG,QAAQ,sBAEjDJ,EAA0B,oBAAIC,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AEzB,IAAAwM,aAAYf,GAAQ,WAClBH,EAAA,OAAatL,GACbA,EAAUO,UAAY,Q,geCT9B,SAASkM,EAAOC,G,IAA+B,wDAC7C,IAAMC,GAAQ,IAAArM,UAAQ,WACpB,OAAOoM,EACJ9I,KAAI,SAACgJ,EAAG1D,GAAQ,OAAA0D,IAAM,IAAAzC,mBAAkB0C,EAAK3D,IAAoB,GAAZ2D,EAAK3D,OAC1D4D,KAAK,IACLC,QAAQ,SAAU,KAClBA,QAAQ,SAAU,KAClBC,SACF,GAACN,GAAO,EAAKG,IAAI,IAEpB,OAAOF,EAOT,SAASM,EAA0BC,GACjC,OAAOA,EAAOT,K","sources":["webpack://DarkPlatformBrowser/webpack/universalModuleDefinition","webpack://DarkPlatformBrowser/external umd {\"root\":\"DarkCore\",\"commonjs2\":\"@dark-engine/core\",\"commonjs\":\"@dark-engine/core\",\"amd\":\"@dark-engine/core\"}","webpack://DarkPlatformBrowser/webpack/bootstrap","webpack://DarkPlatformBrowser/webpack/runtime/define property getters","webpack://DarkPlatformBrowser/webpack/runtime/hasOwnProperty shorthand","webpack://DarkPlatformBrowser/webpack/runtime/make namespace object","webpack://DarkPlatformBrowser/./src/portal/portal.tsx","webpack://DarkPlatformBrowser/./src/events/events.ts","webpack://DarkPlatformBrowser/./src/dom/dom.ts","webpack://DarkPlatformBrowser/./src/scheduling/scheduling.ts","webpack://DarkPlatformBrowser/./src/scheduling/types.ts","webpack://DarkPlatformBrowser/./src/render/render.ts","webpack://DarkPlatformBrowser/./src/create-root/create-root.tsx","webpack://DarkPlatformBrowser/./src/use-style/use-style.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@dark-engine/core\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"DarkPlatformBrowser\", [\"@dark-engine/core\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"DarkPlatformBrowser\"] = factory(require(\"@dark-engine/core\"));\n\telse\n\t\troot[\"DarkPlatformBrowser\"] = factory(root[\"DarkCore\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__317__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE__317__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import {\r\n type Fiber,\r\n type DarkElement,\r\n type ComponentFactory,\r\n createComponent,\r\n detectIsComponentFactory,\r\n useMemo,\r\n} from '@dark-engine/core';\r\n\r\nconst $$portal = Symbol('portal');\r\n\r\nfunction createPortal(slot: DarkElement, container: Element) {\r\n if (!(container instanceof Element)) {\r\n throw new Error(`[Dark]: createPortal receives only Element as container!`);\r\n }\r\n\r\n return Portal({ [$$portal]: container, slot });\r\n}\r\n\r\ntype PortalProps = {\r\n [$$portal]: Element;\r\n slot: DarkElement;\r\n};\r\n\r\nconst Portal = createComponent(\r\n ({ slot, ...rest }) => {\r\n useMemo(() => (rest[$$portal].innerHTML = ''), []);\r\n\r\n return slot;\r\n },\r\n { token: $$portal },\r\n);\r\n\r\nconst detectIsPortal = (factory: unknown): factory is ComponentFactory =>\r\n detectIsComponentFactory(factory) && factory.token === $$portal;\r\n\r\nconst getPortalContainer = (factory: unknown): Element | null =>\r\n detectIsPortal(factory) ? factory.props[$$portal] : null;\r\n\r\nfunction unmountPortal(fiber: Fiber) {\r\n const container = getPortalContainer(fiber.instance);\r\n\r\n if (container) {\r\n container.innerHTML = '';\r\n }\r\n}\r\n\r\nexport { createPortal, detectIsPortal, getPortalContainer, unmountPortal };\r\n","import { detectIsFunction, eventsHelper } from '@dark-engine/core';\r\n\r\ntype BrowserEventConstructor = (type: string, event: Event) => void;\r\n\r\nclass SyntheticEvent {\r\n public type = '';\r\n public sourceEvent: E = null;\r\n public target: T = null;\r\n private propagation = true;\r\n\r\n constructor(options: Pick, 'sourceEvent' | 'target'>) {\r\n this.type = options.sourceEvent.type;\r\n this.sourceEvent = options.sourceEvent;\r\n this.target = options.target;\r\n }\r\n\r\n public stopPropagation() {\r\n this.propagation = false;\r\n this.sourceEvent.stopPropagation();\r\n }\r\n\r\n public preventDefault() {\r\n this.sourceEvent.preventDefault();\r\n }\r\n\r\n public getPropagation() {\r\n return this.propagation;\r\n }\r\n}\r\n\r\ntype DelegateEventOptions = {\r\n target: Element;\r\n eventName: string;\r\n handler: (e: Event) => void;\r\n};\r\n\r\nfunction delegateEvent(options: DelegateEventOptions) {\r\n const { target, eventName, handler } = options;\r\n const eventsStore = eventsHelper.get();\r\n const handlerMap = eventsStore.get(eventName);\r\n\r\n if (!handlerMap) {\r\n const rootHandler = (event: Event) => {\r\n const fireEvent = eventsStore.get(eventName).get(event.target);\r\n const target = event.target as Element;\r\n let syntheticEvent: SyntheticEvent = null;\r\n\r\n if (detectIsFunction(fireEvent)) {\r\n syntheticEvent = new SyntheticEvent({\r\n sourceEvent: event,\r\n target,\r\n });\r\n fireEvent(syntheticEvent);\r\n }\r\n\r\n if (syntheticEvent ? syntheticEvent.getPropagation() : target.parentElement) {\r\n target.parentElement.dispatchEvent(new (event.constructor as BrowserEventConstructor)(event.type, event));\r\n }\r\n };\r\n\r\n eventsStore.set(eventName, new WeakMap([[target, handler]]));\r\n document.addEventListener(eventName, rootHandler, true);\r\n eventsHelper.addUnsubscriber(() => document.removeEventListener(eventName, rootHandler, true));\r\n } else {\r\n handlerMap.set(target, handler);\r\n }\r\n}\r\n\r\nconst detectIsEvent = (attrName: string) => attrName.startsWith('on');\r\n\r\nconst getEventName = (attrName: string) => attrName.slice(2, attrName.length).toLowerCase();\r\n\r\nexport { SyntheticEvent, delegateEvent, detectIsEvent, getEventName };\r\n","import {\r\n type Fiber,\r\n type VirtualNode,\r\n type TagVirtualNode,\r\n type TextVirtualNode,\r\n type CommentVirtualNode,\r\n type MutableRef,\r\n ATTR_KEY,\r\n ATTR_REF,\r\n EffectTag,\r\n detectIsFunction,\r\n detectIsUndefined,\r\n NodeType,\r\n detectIsVirtualNode,\r\n detectIsTagVirtualNode,\r\n detectIsTextVirtualNode,\r\n detectIsRef,\r\n walkFiber,\r\n} from '@dark-engine/core';\r\nimport { detectIsPortal, getPortalContainer } from '../portal';\r\nimport { delegateEvent, detectIsEvent, getEventName } from '../events';\r\nimport type { DOMElement, DOMFragment } from './types';\r\n\r\nconst attrBlackListMap = {\r\n [ATTR_KEY]: true,\r\n [ATTR_REF]: true,\r\n};\r\n\r\nlet fragmentsMap: Map = new Map();\r\n\r\nfunction createNativeElement(vNode: VirtualNode): DOMElement {\r\n const map = {\r\n [NodeType.TAG]: (vNode: VirtualNode) => {\r\n const tagNode = vNode as TagVirtualNode;\r\n const node = detectIsSvgElement(tagNode.name)\r\n ? document.createElementNS('http://www.w3.org/2000/svg', tagNode.name)\r\n : document.createElement(tagNode.name);\r\n\r\n return node;\r\n },\r\n [NodeType.TEXT]: (vNode: VirtualNode) => {\r\n const textNode = vNode as TextVirtualNode;\r\n const node = document.createTextNode(textNode.value);\r\n\r\n return node;\r\n },\r\n [NodeType.COMMENT]: (vNode: VirtualNode) => {\r\n const commentNode = vNode as CommentVirtualNode;\r\n const node = document.createComment(commentNode.value);\r\n\r\n return node;\r\n },\r\n };\r\n\r\n return map[vNode.type](vNode);\r\n}\r\n\r\nfunction detectIsSvgElement(tagName: string) {\r\n const tagMap = {\r\n svg: true,\r\n circle: true,\r\n ellipse: true,\r\n g: true,\r\n text: true,\r\n tspan: true,\r\n textPath: true,\r\n path: true,\r\n polygon: true,\r\n polyline: true,\r\n line: true,\r\n rect: true,\r\n use: true,\r\n image: true,\r\n symbol: true,\r\n defs: true,\r\n linearGradient: true,\r\n radialGradient: true,\r\n stop: true,\r\n clipPath: true,\r\n pattern: true,\r\n mask: true,\r\n marker: true,\r\n };\r\n\r\n return Boolean(tagMap[tagName]);\r\n}\r\n\r\nfunction applyRef(ref: MutableRef, element: Element) {\r\n if (detectIsRef(ref)) {\r\n ref.current = element;\r\n }\r\n}\r\n\r\nfunction addAttributes(element: Element, vNode: VirtualNode) {\r\n if (!detectIsTagVirtualNode(vNode)) return;\r\n const attrNames = Object.keys(vNode.attrs);\r\n\r\n for (const attrName of attrNames) {\r\n const attrValue = vNode.attrs[attrName];\r\n\r\n if (attrName === ATTR_REF) {\r\n applyRef(attrValue as MutableRef, element);\r\n continue;\r\n }\r\n\r\n if (detectIsFunction(attrValue)) {\r\n if (detectIsEvent(attrName)) {\r\n delegateEvent({\r\n target: element,\r\n handler: attrValue,\r\n eventName: getEventName(attrName),\r\n });\r\n }\r\n } else if (!detectIsUndefined(attrValue) && !attrBlackListMap[attrName]) {\r\n upgradeInputAttributes({\r\n tagName: vNode.name,\r\n value: attrValue,\r\n attrName,\r\n element,\r\n });\r\n\r\n element.setAttribute(attrName, attrValue);\r\n }\r\n }\r\n}\r\n\r\nfunction updateAttributes(element: Element, vNode: TagVirtualNode, nextVNode: TagVirtualNode) {\r\n const attrNames = new Set([...Object.keys(vNode.attrs), ...Object.keys(nextVNode.attrs)]);\r\n\r\n for (const attrName of attrNames) {\r\n const prevAttrValue = vNode.attrs[attrName];\r\n const nextAttrValue = nextVNode.attrs[attrName];\r\n\r\n if (attrName === ATTR_REF) {\r\n applyRef(prevAttrValue as MutableRef, element);\r\n continue;\r\n }\r\n\r\n if (!detectIsUndefined(nextAttrValue)) {\r\n if (detectIsFunction(prevAttrValue)) {\r\n if (detectIsEvent(attrName) && prevAttrValue !== nextAttrValue) {\r\n delegateEvent({\r\n target: element,\r\n handler: nextAttrValue,\r\n eventName: getEventName(attrName),\r\n });\r\n }\r\n } else if (!attrBlackListMap[attrName] && prevAttrValue !== nextAttrValue) {\r\n upgradeInputAttributes({\r\n tagName: nextVNode.name,\r\n value: nextAttrValue,\r\n attrName,\r\n element,\r\n });\r\n\r\n element.setAttribute(attrName, nextAttrValue);\r\n }\r\n } else {\r\n element.removeAttribute(attrName);\r\n }\r\n }\r\n}\r\n\r\ntype UpgradeInputAttributesOptions = {\r\n tagName: string;\r\n element: Element;\r\n attrName: string;\r\n value: string | boolean;\r\n};\r\n\r\nfunction upgradeInputAttributes(options: UpgradeInputAttributesOptions) {\r\n const { tagName, element, attrName, value } = options;\r\n const map = {\r\n input: () => {\r\n const attrsMap = {\r\n value: true,\r\n checked: true,\r\n };\r\n\r\n if (attrsMap[attrName]) {\r\n element[attrName] = value;\r\n }\r\n },\r\n option: () => {\r\n const attrsMap = {\r\n selected: true,\r\n };\r\n\r\n if (attrsMap[attrName]) {\r\n element[attrName] = value;\r\n }\r\n },\r\n };\r\n\r\n map[tagName] && map[tagName]();\r\n}\r\n\r\nfunction getParentFiberWithNativeElement(fiber: Fiber): Fiber {\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n nextFiber = nextFiber.parent;\r\n\r\n if (detectIsPortal(nextFiber.instance)) {\r\n nextFiber.nativeElement = getPortalContainer(nextFiber.instance);\r\n }\r\n\r\n if (nextFiber.nativeElement) return nextFiber;\r\n }\r\n\r\n return nextFiber;\r\n}\r\n\r\nfunction getNodeOnTheRight(fiber: Fiber, parentElement: Element) {\r\n let node: Element = null;\r\n\r\n walkFiber({\r\n fiber,\r\n onLoop: ({ nextFiber, stop, resetIsDeepWalking }) => {\r\n if (nextFiber.nativeElement && nextFiber.nativeElement.parentElement === parentElement) {\r\n node = nextFiber.nativeElement;\r\n\r\n return stop();\r\n }\r\n\r\n if (!nextFiber.mountedToHost) {\r\n return resetIsDeepWalking();\r\n }\r\n },\r\n });\r\n\r\n return node;\r\n}\r\n\r\nfunction getChildIndex(fiber: Fiber, parentNativeElement: Element) {\r\n let nextFiber = fiber;\r\n\r\n while (nextFiber) {\r\n if (nextFiber?.parent?.nativeElement === parentNativeElement) {\r\n return nextFiber.idx;\r\n }\r\n\r\n nextFiber = nextFiber.parent;\r\n }\r\n\r\n return -1;\r\n}\r\n\r\nfunction commitPlacement(fiber: Fiber, parentFiber: Fiber) {\r\n const parentNativeElement = parentFiber.nativeElement;\r\n const childNodes = parentNativeElement.childNodes;\r\n\r\n const append = () => {\r\n const { fragment } =\r\n fragmentsMap.get(parentNativeElement) ||\r\n ({\r\n fragment: document.createDocumentFragment(),\r\n callback: () => {},\r\n } as DOMFragment);\r\n\r\n fragmentsMap.set(parentNativeElement, {\r\n fragment,\r\n callback: () => {\r\n parentNativeElement.appendChild(fragment);\r\n },\r\n });\r\n fragment.appendChild(fiber.nativeElement);\r\n fiber.markMountedToHost();\r\n };\r\n\r\n const insert = () => {\r\n parentNativeElement.insertBefore(fiber.nativeElement, getNodeOnTheRight(fiber, parentNativeElement));\r\n fiber.markMountedToHost();\r\n };\r\n\r\n if (childNodes.length === 0 || getChildIndex(fiber, parentNativeElement) > childNodes.length - 1) {\r\n append();\r\n } else {\r\n insert();\r\n }\r\n\r\n addAttributes(fiber.nativeElement, fiber.instance as VirtualNode);\r\n}\r\n\r\nfunction commitUpdate(element: Element, instance: VirtualNode, nextInstance: VirtualNode) {\r\n if (\r\n detectIsTextVirtualNode(instance) &&\r\n detectIsTextVirtualNode(nextInstance) &&\r\n instance.value !== nextInstance.value\r\n ) {\r\n return (element.textContent = nextInstance.value);\r\n }\r\n\r\n if (detectIsTagVirtualNode(instance) && detectIsTagVirtualNode(nextInstance)) {\r\n return updateAttributes(element, instance, nextInstance);\r\n }\r\n}\r\n\r\nfunction commitDeletion(fiber: Fiber, parentFiber: Fiber) {\r\n walkFiber({\r\n fiber,\r\n onLoop: ({ nextFiber, isReturn, resetIsDeepWalking, stop }) => {\r\n if (nextFiber === fiber.nextSibling || nextFiber === fiber.parent) {\r\n return stop();\r\n }\r\n\r\n if (!isReturn && nextFiber.nativeElement) {\r\n !detectIsPortal(nextFiber.instance) && parentFiber.nativeElement.removeChild(nextFiber.nativeElement);\r\n\r\n return resetIsDeepWalking();\r\n }\r\n },\r\n });\r\n}\r\n\r\nfunction applyCommit(fiber: Fiber) {\r\n const parentFiber = getParentFiberWithNativeElement(fiber);\r\n\r\n if (fiber.nativeElement !== null && fiber.effectTag === EffectTag.PLACEMENT) {\r\n commitPlacement(fiber, parentFiber);\r\n } else if (fiber.nativeElement !== null && fiber.effectTag === EffectTag.UPDATE) {\r\n if (!detectIsVirtualNode(fiber.alternate.instance) || !detectIsVirtualNode(fiber.instance)) return;\r\n const vNode: VirtualNode = fiber.alternate.instance;\r\n const nextVNode: VirtualNode = fiber.instance;\r\n\r\n commitUpdate(fiber.nativeElement, vNode, nextVNode);\r\n } else if (fiber.effectTag === EffectTag.DELETION) {\r\n commitDeletion(fiber, parentFiber);\r\n }\r\n}\r\n\r\nfunction finishCommitWork() {\r\n for (const { callback } of fragmentsMap.values()) {\r\n callback();\r\n }\r\n\r\n fragmentsMap = new Map();\r\n}\r\n\r\nexport { createNativeElement, applyCommit, finishCommitWork };\r\n","import { type ScheduleCallbackOptions, getTime, workLoop, wipRootHelper, TaskPriority } from '@dark-engine/core';\r\nimport { type Callback } from './types';\r\n\r\ntype QueueByPriority = {\r\n hight: Array;\r\n normal: Array;\r\n low: Array;\r\n};\r\n\r\nconst queueByPriority: QueueByPriority = {\r\n hight: [],\r\n normal: [],\r\n low: [],\r\n};\r\nconst YEILD_INTERVAL = 10;\r\nlet scheduledCallback: Callback = null;\r\nlet deadline = 0;\r\nlet isMessageLoopRunning = false;\r\nlet currentTask: Task = null;\r\n\r\nclass Task {\r\n public static nextTaskId = 0;\r\n public id: number;\r\n public time: number;\r\n public timeoutMs: number;\r\n public priority: TaskPriority;\r\n public callback: () => void;\r\n\r\n constructor(options: Omit) {\r\n this.id = ++Task.nextTaskId;\r\n this.time = options.time;\r\n this.timeoutMs = options.timeoutMs;\r\n this.priority = options.priority;\r\n this.callback = options.callback;\r\n }\r\n}\r\n\r\nconst shouldYeildToHost = () => getTime() >= deadline;\r\n\r\nfunction scheduleCallback(callback: () => void, options?: ScheduleCallbackOptions) {\r\n const { priority = TaskPriority.NORMAL, timeoutMs } = options || {};\r\n const task = new Task({ time: getTime(), timeoutMs, priority, callback });\r\n const map: Record void> = {\r\n [TaskPriority.HIGH]: () => queueByPriority.hight.push(task),\r\n [TaskPriority.NORMAL]: () => queueByPriority.normal.push(task),\r\n [TaskPriority.LOW]: () => queueByPriority.low.push(task),\r\n };\r\n\r\n map[task.priority]();\r\n executeTasks();\r\n}\r\n\r\nfunction pick(queue: Array) {\r\n if (!queue.length) return false;\r\n currentTask = queue.shift();\r\n\r\n currentTask.callback();\r\n requestCallback(workLoop);\r\n\r\n return true;\r\n}\r\n\r\nfunction executeTasks() {\r\n const isBusy = Boolean(wipRootHelper.get());\r\n\r\n if (!isBusy) {\r\n checkOverdueTasks() ||\r\n pick(queueByPriority.hight) ||\r\n pick(queueByPriority.normal) ||\r\n requestIdleCallback(() => pick(queueByPriority.low));\r\n }\r\n}\r\n\r\nfunction checkOverdueTasks() {\r\n const [task] = queueByPriority.low;\r\n\r\n if (task && task.timeoutMs > 0 && getTime() - task.time > task.timeoutMs) {\r\n pick(queueByPriority.low);\r\n return true;\r\n }\r\n\r\n return false;\r\n}\r\n\r\nfunction performWorkUntilDeadline() {\r\n if (scheduledCallback) {\r\n deadline = getTime() + YEILD_INTERVAL;\r\n\r\n try {\r\n const hasMoreWork = scheduledCallback();\r\n\r\n if (!hasMoreWork) {\r\n currentTask = null;\r\n isMessageLoopRunning = false;\r\n scheduledCallback = null;\r\n executeTasks();\r\n } else {\r\n port.postMessage(null);\r\n }\r\n } catch (error) {\r\n port.postMessage(null);\r\n throw error;\r\n }\r\n } else {\r\n isMessageLoopRunning = false;\r\n }\r\n}\r\n\r\nfunction requestCallback(callback: Callback) {\r\n if (process.env.NODE_ENV === 'test') {\r\n return requestCallbackSync(callback);\r\n }\r\n\r\n scheduledCallback = callback;\r\n\r\n if (!isMessageLoopRunning) {\r\n isMessageLoopRunning = true;\r\n port.postMessage(null);\r\n }\r\n}\r\n\r\nfunction requestCallbackSync(callback: Callback) {\r\n while (callback()) {\r\n //\r\n }\r\n executeTasks();\r\n currentTask = null;\r\n}\r\n\r\nlet channel: MessageChannel = null;\r\nlet port: MessagePort = null;\r\n\r\nfunction setup() {\r\n if (process.env.NODE_ENV === 'test') {\r\n return;\r\n }\r\n\r\n channel = new MessageChannel();\r\n port = channel.port2;\r\n\r\n channel.port1.onmessage = performWorkUntilDeadline;\r\n}\r\n\r\nsetup();\r\n\r\nexport { shouldYeildToHost, scheduleCallback };\r\n","export type Callback = () => boolean;\r\n\r\nexport type Task = {\r\n id: number;\r\n priority: TaskPriority;\r\n calllback: () => void;\r\n};\r\n\r\nexport enum TaskPriority {\r\n HIGH = 2,\r\n NORMAL = 1,\r\n}\r\n","import {\r\n type DarkElement,\r\n type VirtualNodeFactory,\r\n type ComponentFactory,\r\n ROOT,\r\n Fiber,\r\n EffectTag,\r\n platform,\r\n flatten,\r\n detectIsUndefined,\r\n TagVirtualNode,\r\n effectStoreHelper,\r\n wipRootHelper,\r\n currentRootHelper,\r\n nextUnitOfWorkHelper,\r\n fiberMountHelper,\r\n TaskPriority,\r\n createEmptyVirtualNode,\r\n} from '@dark-engine/core';\r\nimport { createNativeElement, applyCommit, finishCommitWork } from '../dom';\r\nimport { detectIsPortal, unmountPortal } from '../portal';\r\nimport { scheduleCallback, shouldYeildToHost } from '../scheduling';\r\n\r\nplatform.scheduleCallback = scheduleCallback;\r\nplatform.shouldYeildToHost = shouldYeildToHost;\r\nplatform.createNativeElement = createNativeElement as typeof platform.createNativeElement;\r\nplatform.applyCommit = applyCommit as typeof platform.applyCommit;\r\nplatform.finishCommitWork = finishCommitWork as typeof platform.finishCommitWork;\r\nplatform.detectIsPortal = detectIsPortal as typeof platform.detectIsPortal;\r\nplatform.unmountPortal = unmountPortal as typeof platform.unmountPortal;\r\n\r\nconst roots = new Map();\r\n\r\nfunction render(element: DarkElement, container: Element) {\r\n if (!(container instanceof Element)) {\r\n throw new Error(`[Dark]: render receives only Element as container!`);\r\n }\r\n\r\n const isMounted = !detectIsUndefined(roots.get(container));\r\n let rootId = null;\r\n\r\n if (!isMounted) {\r\n rootId = roots.size;\r\n\r\n roots.set(container, rootId);\r\n container.innerHTML = '';\r\n } else {\r\n rootId = roots.get(container);\r\n }\r\n\r\n const callback = () => {\r\n effectStoreHelper.set(rootId); // important order!\r\n const currentRootFiber = currentRootHelper.get();\r\n const fiber = new Fiber({\r\n nativeElement: container,\r\n instance: new TagVirtualNode({\r\n name: ROOT,\r\n children: flatten([element || createEmptyVirtualNode()]) as Array,\r\n }),\r\n alternate: currentRootFiber,\r\n effectTag: isMounted ? EffectTag.UPDATE : EffectTag.PLACEMENT,\r\n });\r\n\r\n currentRootFiber && (currentRootFiber.alternate = null);\r\n fiberMountHelper.reset();\r\n wipRootHelper.set(fiber);\r\n nextUnitOfWorkHelper.set(fiber);\r\n };\r\n\r\n platform.scheduleCallback(callback, { priority: TaskPriority.NORMAL });\r\n}\r\n\r\nexport { render, roots };\r\n","import { type DarkElement, unmountRoot } from '@dark-engine/core';\r\nimport { render, roots } from '../render';\r\n\r\nfunction createRoot(container: Element) {\r\n return {\r\n render: (element: DarkElement) => render(element, container),\r\n unmount: () => {\r\n const rootId = roots.get(container);\r\n\r\n unmountRoot(rootId, () => {\r\n roots.delete(container);\r\n container.innerHTML = '';\r\n });\r\n },\r\n };\r\n}\r\n\r\nexport { createRoot };\r\n","import { useMemo, detectIsUndefined } from '@dark-engine/core';\r\n\r\nfunction styled(strings: TemplateStringsArray, ...args: Array): string {\r\n const style = useMemo(() => {\r\n return strings\r\n .map((x, idx) => x + (!detectIsUndefined(args[idx]) ? args[idx] : ''))\r\n .join('')\r\n .replace(/;\\s*/gm, ';')\r\n .replace(/:\\s*/gm, ':')\r\n .trim();\r\n }, [strings, ...args]);\r\n\r\n return style;\r\n}\r\n\r\ntype Style = Record;\r\n\r\ntype Config = (x: typeof styled) => T;\r\n\r\nfunction useStyle(config: Config) {\r\n return config(styled);\r\n}\r\n\r\nexport { useStyle };\r\n"],"names":["root","factory","exports","module","require","define","amd","self","__WEBPACK_EXTERNAL_MODULE__317__","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","$$portal","createPortal","slot","container","Element","Error","Portal","createComponent","rest","useMemo","innerHTML","token","detectIsPortal","detectIsComponentFactory","getPortalContainer","props","options","type","sourceEvent","target","propagation","this","stopPropagation","preventDefault","getPropagation","delegateEvent","eventName","handler","eventsStore","eventsHelper","handlerMap","set","event","fireEvent","syntheticEvent","detectIsFunction","SyntheticEvent","parentElement","dispatchEvent","constructor","WeakMap","document","addEventListener","removeEventListener","detectIsEvent","attrName","startsWith","getEventName","slice","length","toLowerCase","attrBlackListMap","ATTR_KEY","ATTR_REF","fragmentsMap","Map","applyRef","ref","element","detectIsRef","current","upgradeInputAttributes","tagName","map","input","checked","option","selected","queueByPriority","hight","normal","low","scheduledCallback","deadline","isMessageLoopRunning","id","Task","nextTaskId","time","timeoutMs","priority","callback","pick","queue","shift","workLoop","port","postMessage","executeTasks","task","Boolean","wipRootHelper","getTime","requestIdleCallback","TaskPriority","channel","MessageChannel","port2","port1","onmessage","error","platform","push","vNode","NodeType","tagNode","name","svg","circle","ellipse","g","text","tspan","textPath","path","polygon","polyline","line","rect","use","image","symbol","defs","linearGradient","radialGradient","stop","clipPath","pattern","mask","marker","createElementNS","createElement","textNode","createTextNode","commentNode","createComment","fiber","instance","nextInstance","parentFiber","nextFiber","parent","nativeElement","getParentFiberWithNativeElement","effectTag","EffectTag","fragment","parentNativeElement","childNodes","idx","getChildIndex","createDocumentFragment","appendChild","markMountedToHost","insertBefore","node","walkFiber","onLoop","resetIsDeepWalking","mountedToHost","getNodeOnTheRight","detectIsTagVirtualNode","attrNames","keys","attrs","attrValue","detectIsUndefined","setAttribute","addAttributes","commitPlacement","detectIsVirtualNode","alternate","nextVNode","detectIsTextVirtualNode","textContent","Set","prevAttrValue","nextAttrValue","removeAttribute","updateAttributes","isReturn","nextSibling","removeChild","commitDeletion","values","roots","render","isMounted","rootId","size","effectStoreHelper","currentRootFiber","currentRootHelper","Fiber","TagVirtualNode","ROOT","children","flatten","createEmptyVirtualNode","fiberMountHelper","nextUnitOfWorkHelper","createRoot","unmount","unmountRoot","styled","strings","style","x","args","join","replace","trim","useStyle","config"],"sourceRoot":""} \ No newline at end of file