From 12c0db2ca4e8b102cb354f880e049dacb16dcd76 Mon Sep 17 00:00:00 2001 From: atellmer Date: Mon, 14 Nov 2022 07:40:49 -0800 Subject: [PATCH] version upgrade --- packages/core/package.json | 2 +- packages/core/umd/dark-core.development.js | 36 ++++++++++++------- .../core/umd/dark-core.development.js.map | 2 +- packages/core/umd/dark-core.production.min.js | 2 +- .../core/umd/dark-core.production.min.js.map | 2 +- packages/platform-browser/package.json | 2 +- 6 files changed, 29 insertions(+), 17 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index eb088d94..e5ff5bfc 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@dark-engine/core", - "version": "0.4.3", + "version": "0.4.4", "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 355de421..e289aeea 100644 --- a/packages/core/umd/dark-core.development.js +++ b/packages/core/umd/dark-core.development.js @@ -451,6 +451,7 @@ var Fiber = /** @class */ (function () { this.hook = options.hook || createHook(); this.shadow = options.shadow || null; this.provider = options.provider || null; + this.transposition = !(0,_helpers__WEBPACK_IMPORTED_MODULE_0__.detectIsUndefined)(options.transposition) ? options.transposition : false; this.mountedToHost = !(0,_helpers__WEBPACK_IMPORTED_MODULE_0__.detectIsUndefined)(options.mountedToHost) || false; this.portalHost = !(0,_helpers__WEBPACK_IMPORTED_MODULE_0__.detectIsUndefined)(options.portalHost) ? options.portalHost : false; this.effectHost = !(0,_helpers__WEBPACK_IMPORTED_MODULE_0__.detectIsUndefined)(options.effectHost) ? options.effectHost : false; @@ -893,6 +894,7 @@ function getRootShadow(options) { if (shadow) { fiber.hook = shadow.hook; fiber.provider = shadow.provider; + alternate.transposition = true; } } return shadow; @@ -1067,21 +1069,26 @@ function commitChanges() { var hasEffects = Boolean((_b = wipFiber.alternate) === null || _b === void 0 ? void 0 : _b.effectHost); var hasPortals = Boolean((_c = wipFiber.alternate) === null || _c === void 0 ? void 0 : _c.portalHost); if (hasEffects || hasPortals) { + var _loop_1 = function (fiber) { + fiber.portalHost && _global__WEBPACK_IMPORTED_MODULE_1__.platform.unmountPortal(fiber); + if (fiber.effectHost) { + walkFiber({ + fiber: fiber, + onLoop: function (_a) { + var nextFiber = _a.nextFiber, isReturn = _a.isReturn, stop = _a.stop; + if (nextFiber === fiber.nextSibling || fiber.transposition) + return stop(); + if (!isReturn && (0,_component__WEBPACK_IMPORTED_MODULE_3__.detectIsComponentFactory)(nextFiber.instance)) { + (0,_use_effect__WEBPACK_IMPORTED_MODULE_8__.cleanupEffects)(nextFiber.hook); + } + }, + }); + } + }; try { for (var deletions_1 = __values(deletions), deletions_1_1 = deletions_1.next(); !deletions_1_1.done; deletions_1_1 = deletions_1.next()) { var fiber = deletions_1_1.value; - fiber.portalHost && _global__WEBPACK_IMPORTED_MODULE_1__.platform.unmountPortal(fiber); - if (fiber.effectHost) { - walkFiber({ - fiber: fiber, - onLoop: function (_a) { - var nextFiber = _a.nextFiber, isReturn = _a.isReturn; - if (!isReturn && (0,_component__WEBPACK_IMPORTED_MODULE_3__.detectIsComponentFactory)(nextFiber.instance)) { - (0,_use_effect__WEBPACK_IMPORTED_MODULE_8__.cleanupEffects)(nextFiber.hook); - } - }, - }); - } + _loop_1(fiber); } } catch (e_5_1) { e_5 = { error: e_5_1 }; } @@ -1159,6 +1166,7 @@ function walkFiber(options) { var nextFiber = fiber; var isDeepWalking = true; var isReturn = false; + var isStopped = false; var visitedMap = new Map(); var detectCanVisit = function (fiber) { return !visitedMap.get(fiber); }; while (nextFiber) { @@ -1166,7 +1174,11 @@ function walkFiber(options) { nextFiber: nextFiber, isReturn: isReturn, resetIsDeepWalking: function () { return (isDeepWalking = false); }, + stop: function () { return (isStopped = true); }, }); + if (isStopped) { + break; + } if (nextFiber.child && isDeepWalking && detectCanVisit(nextFiber.child)) { var newFiber = nextFiber.child; isReturn = false; diff --git a/packages/core/umd/dark-core.development.js.map b/packages/core/umd/dark-core.development.js.map index 2be19815..23666ca5 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,IAAI,EAAE,CAAC;QAC7C,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,IAAI,CAAC;IACnD,CAAC;IACH,uBAAC;AAAD,CAAC;AAED,SAAS,eAAe,CACtB,aAA8C,EAC9C,OAAiC;IAAjC,sCAAiC;IAGjC,IAAM,eAAe,yBAAQ,cAAc,GAAK,OAAO,CAAE,CAAC;IAClD,SAAK,GAA8C,eAAe,MAA7D,EAAE,YAAY,GAAgC,eAAe,aAA/C,EAAE,WAAW,GAAmB,eAAe,YAAlC,EAAE,YAAY,GAAK,eAAe,aAApB,CAAqB;IAE3E,OAAO,UAAC,KAAmB,EA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EAAE,QAAqC;SAChD,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;IAE9B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,IAAM,sBAAsB,GAAG,cAAM,WAAI,kBAAkB,CAAC,kDAAU,CAAC,EAAlC,CAAkC,CAAC;AAExE,IAAM,0BAA0B,GAAG,UAAC,OAAgB;IAClD,iEAAgB,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,aAAa,CAAC,KAAK,IAAI;AAA5D,CAA4D,CAAC;AAkB7D;;;;;;;UC5HF;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;AACF;AACC;AACH;AACA;AACD;AACE;AACC;AACE;AACI;AACD;AACO;AACR;AACD;AACY;AACb;AACG;AACJ;AACE;AACC;AACN;AACK","sources":["webpack://DarkCore/webpack/universalModuleDefinition","webpack://DarkCore/./src/component/component.ts","webpack://DarkCore/./src/component/index.ts","webpack://DarkCore/./src/component/model.ts","webpack://DarkCore/./src/constants.ts","webpack://DarkCore/./src/context/context.ts","webpack://DarkCore/./src/context/index.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/model.ts","webpack://DarkCore/./src/fragment/fragment.ts","webpack://DarkCore/./src/fragment/index.ts","webpack://DarkCore/./src/global/global.ts","webpack://DarkCore/./src/global/index.ts","webpack://DarkCore/./src/global/model.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/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/model.ts","webpack://DarkCore/./src/suspense/index.ts","webpack://DarkCore/./src/suspense/suspense.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-imperative-handle/index.ts","webpack://DarkCore/./src/use-imperative-handle/use-imperative-handle.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/model.ts","webpack://DarkCore/./src/view/view.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/model';\r\nimport type { MutableRef } from '../ref';\r\nimport type { CreateElement, ComponentOptions, StandardComponentProps, SlotProps } from './model';\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 './model';\r\n","import { ComponentFactory } from './component';\r\nimport { DarkElementKey, DarkElement } from '../shared/model';\r\nimport { MutableRef } from '../ref/model';\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 './model';\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\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 '../global';\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} 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/model';\r\nimport type { DarkElementKey, DarkElement, DarkElementInstance } from '../shared/model';\r\nimport { PARTIAL_UPDATE } from '../constants';\r\nimport { type NativeElement, type Hook, EffectTag, cloneTagMap } from './model';\r\nimport { hasEffects, cleanupEffects } from '../use-effect';\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 mountedToHost: boolean;\r\n public portalHost: boolean;\r\n public effectHost: boolean;\r\n public childrenCount: number;\r\n public marker: string;\r\n public isUsed: boolean;\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.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.childrenCount = options.childrenCount || 0;\r\n this.marker = options.marker || '';\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 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({ fiber, alternate, instance });\r\n mutateFiber({ fiber, alternate, instance });\r\n fiber = alternate ? performMemo({ fiber, alternate, instance }) : fiber;\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({ fiber, alternate, instance });\r\n mutateFiber({ fiber, alternate, instance });\r\n fiber = alternate ? performMemo({ fiber, alternate, instance }) : fiber;\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 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 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 = fiber.nativeElement ? isUpdate : false;\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 fiber: Fiber;\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction mutateAlternate(options: PerformAlternateOptions) {\r\n const { fiber, 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 isRemovingCase = nextElementsCount < prevElementsCount;\r\n const isInsertingCase = nextElementsCount > prevElementsCount;\r\n const children = hasChildrenProp(instance) ? instance.children : [];\r\n const { keys, nextKeys } = extractKeys(alternate.child, children);\r\n const hasKeys = keys.length > 0;\r\n const hasAnyKeys = hasKeys || nextKeys.length > 0;\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(keys, 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 childAlternate = fibersMap[key] || null;\r\n\r\n if (childAlternate) {\r\n childAlternate.effectTag = EffectTag.DELETION;\r\n deletionsHelper.get().push(childAlternate);\r\n\r\n if (childAlternate.effectHost) {\r\n fiber.markEffectHost();\r\n }\r\n\r\n if (childAlternate.portalHost) {\r\n fiber.markPortalHost();\r\n }\r\n }\r\n }\r\n } else if (!hasKeys) {\r\n const diffCount = prevElementsCount - nextElementsCount;\r\n const childAlternates: Array = takeListFromEnd(getSiblingFibers(alternate.child), diffCount);\r\n\r\n for (const childAlternate of childAlternates) {\r\n childAlternate.effectTag = EffectTag.DELETION;\r\n\r\n if (childAlternate.effectHost) {\r\n fiber.markEffectHost();\r\n }\r\n\r\n if (childAlternate.portalHost) {\r\n fiber.markPortalHost();\r\n }\r\n }\r\n\r\n deletionsHelper.get().push(...childAlternates);\r\n }\r\n };\r\n\r\n const performInsertingNodes = () => {\r\n const diffKeys = getDiffKeys(nextKeys, keys);\r\n\r\n if (diffKeys.length > 0) {\r\n const diffKeyMap = keyBy(diffKeys, x => x);\r\n const fibersByPositionsMap = createFibersByPositionMap(alternate.child);\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 !== keys[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 = fibersByPositionsMap[keyIdx] || null;\r\n\r\n if (fiber) {\r\n insertionFiber.nextSibling = fiber;\r\n }\r\n }\r\n }\r\n\r\n keyIdx++;\r\n }\r\n }\r\n };\r\n\r\n isRemovingCase && performRemovingNodes();\r\n isInsertingCase && 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 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 (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 }\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 createFibersByPositionMap(fiber: Fiber) {\r\n let nextFiber = fiber;\r\n let position = 0;\r\n const map: Record = {};\r\n\r\n while (nextFiber) {\r\n map[position] = nextFiber;\r\n\r\n position++;\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return map;\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 keys: 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 keys.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 keys,\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 const deletions = deletionsHelper.get();\r\n const hasEffects = Boolean(wipFiber.alternate?.effectHost);\r\n const hasPortals = Boolean(wipFiber.alternate?.portalHost);\r\n\r\n if (hasEffects || hasPortals) {\r\n for (const fiber of deletions) {\r\n fiber.portalHost && platform.unmountPortal(fiber);\r\n\r\n if (fiber.effectHost) {\r\n walkFiber({\r\n fiber,\r\n onLoop: ({ nextFiber, isReturn }) => {\r\n if (!isReturn && detectIsComponentFactory(nextFiber.instance)) {\r\n cleanupEffects(nextFiber.hook);\r\n }\r\n },\r\n });\r\n }\r\n }\r\n }\r\n\r\n commitWork(wipFiber.child, () => {\r\n const effects = effectsHelper.get();\r\n\r\n for (const fiber of deletions) {\r\n platform.applyCommits(fiber);\r\n }\r\n\r\n deletionsHelper.set([]);\r\n wipRootHelper.set(null);\r\n\r\n setTimeout(() => {\r\n for (const effect of effects) {\r\n effect();\r\n }\r\n });\r\n\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\nfunction commitWork(fiber: Fiber, onComplete: Function) {\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.applyCommits(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 onComplete();\r\n}\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};\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 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 });\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\nfunction createHook(): Hook {\r\n return {\r\n idx: 0,\r\n values: [],\r\n };\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 './model';\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 { Platform } from './model';\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 applyCommits: () => {\r\n throw new Error('applyCommits 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 * from './global';\r\nexport * from './model';\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 applyCommits: (fiber: Fiber) => 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","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('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 './ref';\r\nexport type { MutableRef } from './model';\r\n","import { detectIsObject, detectIsNull } from '../helpers';\r\nimport type { Component, RefProps, ComponentFactory } from '../component';\r\nimport type { MutableRef } from './model';\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 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}\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};\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: () => storeHelper.get()?.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};\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\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};\r\n","export * from './model';\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(`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 './use-callback';\r\n","import { detectIsUndefined, detectIsDepsDifferent } from '../helpers';\r\nimport { componentFiberHelper } from '../scope';\r\n\r\nfunction useCallback(callback: 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 values[idx] = {\r\n deps,\r\n value: callback,\r\n };\r\n\r\n hook.idx++;\r\n\r\n return callback;\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\r\n if (isDepsDifferent) {\r\n hookValue.deps = deps;\r\n hookValue.value = callback;\r\n }\r\n\r\n hook.idx++;\r\n\r\n return hookValue.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/model';\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, EffectCleanup } from './model';\r\n\r\nconst $$useEffect = Symbol('use-effect');\r\n\r\nfunction 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 value: undefined,\r\n token: $$useEffect,\r\n };\r\n\r\n effectsHelper.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\nfunction hasEffects(fiber: Fiber) {\r\n const { values } = fiber.hook as Hook;\r\n const hasEffect = values.some(x => x.token === $$useEffect);\r\n\r\n return hasEffect;\r\n}\r\n\r\nfunction cleanupEffects(hook: Hook>) {\r\n const { values } = hook;\r\n\r\n for (const value of values) {\r\n if (value.token === $$useEffect) {\r\n const cleanup = value.value;\r\n\r\n detectIsFunction(cleanup) && cleanup();\r\n }\r\n }\r\n}\r\n\r\nexport { useEffect, hasEffects, cleanupEffects };\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-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-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 './model';\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 './model';\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/model';\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 '../global';\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 '../global';\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 './model';\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/model';\r\nimport type { ComponentFactory, StandardComponentProps } from '../component';\r\nimport { NodeType, type ViewDef } from './model';\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","// 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 './global';\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 * from './use-effect';\r\nexport * from './use-error';\r\nexport * from './use-imperative-handle';\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\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,EAAE,CAAC;QAI/C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,IAAI,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AC;AACjB,CAAC;AAED,IAAM,sBAAsB,GAAG,cAAM,WAAI,kBAAkB,CAAC,kDAAU,CAAC,EAAlC,CAAkC,CAAC;AAExE,IAAM,0BAA0B,GAAG,UAAC,OAAgB;IAClD,iEAAgB,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,aAAa,CAAC,KAAK,IAAI;AAA5D,CAA4D,CAAC;AAkB7D;;;;;;;UC5HF;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;AACF;AACC;AACH;AACA;AACD;AACE;AACC;AACE;AACI;AACD;AACO;AACR;AACD;AACY;AACb;AACG;AACJ;AACE;AACC;AACN;AACK","sources":["webpack://DarkCore/webpack/universalModuleDefinition","webpack://DarkCore/./src/component/component.ts","webpack://DarkCore/./src/component/index.ts","webpack://DarkCore/./src/component/model.ts","webpack://DarkCore/./src/constants.ts","webpack://DarkCore/./src/context/context.ts","webpack://DarkCore/./src/context/index.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/model.ts","webpack://DarkCore/./src/fragment/fragment.ts","webpack://DarkCore/./src/fragment/index.ts","webpack://DarkCore/./src/global/global.ts","webpack://DarkCore/./src/global/index.ts","webpack://DarkCore/./src/global/model.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/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/model.ts","webpack://DarkCore/./src/suspense/index.ts","webpack://DarkCore/./src/suspense/suspense.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-imperative-handle/index.ts","webpack://DarkCore/./src/use-imperative-handle/use-imperative-handle.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/model.ts","webpack://DarkCore/./src/view/view.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/model';\r\nimport type { MutableRef } from '../ref';\r\nimport type { CreateElement, ComponentOptions, StandardComponentProps, SlotProps } from './model';\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 './model';\r\n","import { ComponentFactory } from './component';\r\nimport { DarkElementKey, DarkElement } from '../shared/model';\r\nimport { MutableRef } from '../ref/model';\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 './model';\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\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 '../global';\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} 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/model';\r\nimport type { DarkElementKey, DarkElement, DarkElementInstance } from '../shared/model';\r\nimport { PARTIAL_UPDATE } from '../constants';\r\nimport { type NativeElement, type Hook, EffectTag, cloneTagMap } from './model';\r\nimport { hasEffects, cleanupEffects } from '../use-effect';\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 childrenCount: number;\r\n public marker: string;\r\n public isUsed: boolean;\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.childrenCount = options.childrenCount || 0;\r\n this.marker = options.marker || '';\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 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({ fiber, alternate, instance });\r\n mutateFiber({ fiber, alternate, instance });\r\n fiber = alternate ? performMemo({ fiber, alternate, instance }) : fiber;\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({ fiber, alternate, instance });\r\n mutateFiber({ fiber, alternate, instance });\r\n fiber = alternate ? performMemo({ fiber, alternate, instance }) : fiber;\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 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 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 = fiber.nativeElement ? isUpdate : false;\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 fiber: Fiber;\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction mutateAlternate(options: PerformAlternateOptions) {\r\n const { fiber, 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 isRemovingCase = nextElementsCount < prevElementsCount;\r\n const isInsertingCase = nextElementsCount > prevElementsCount;\r\n const children = hasChildrenProp(instance) ? instance.children : [];\r\n const { keys, nextKeys } = extractKeys(alternate.child, children);\r\n const hasKeys = keys.length > 0;\r\n const hasAnyKeys = hasKeys || nextKeys.length > 0;\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(keys, 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 childAlternate = fibersMap[key] || null;\r\n\r\n if (childAlternate) {\r\n childAlternate.effectTag = EffectTag.DELETION;\r\n deletionsHelper.get().push(childAlternate);\r\n\r\n if (childAlternate.effectHost) {\r\n fiber.markEffectHost();\r\n }\r\n\r\n if (childAlternate.portalHost) {\r\n fiber.markPortalHost();\r\n }\r\n }\r\n }\r\n } else if (!hasKeys) {\r\n const diffCount = prevElementsCount - nextElementsCount;\r\n const childAlternates: Array = takeListFromEnd(getSiblingFibers(alternate.child), diffCount);\r\n\r\n for (const childAlternate of childAlternates) {\r\n childAlternate.effectTag = EffectTag.DELETION;\r\n\r\n if (childAlternate.effectHost) {\r\n fiber.markEffectHost();\r\n }\r\n\r\n if (childAlternate.portalHost) {\r\n fiber.markPortalHost();\r\n }\r\n }\r\n\r\n deletionsHelper.get().push(...childAlternates);\r\n }\r\n };\r\n\r\n const performInsertingNodes = () => {\r\n const diffKeys = getDiffKeys(nextKeys, keys);\r\n\r\n if (diffKeys.length > 0) {\r\n const diffKeyMap = keyBy(diffKeys, x => x);\r\n const fibersByPositionsMap = createFibersByPositionMap(alternate.child);\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 !== keys[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 = fibersByPositionsMap[keyIdx] || null;\r\n\r\n if (fiber) {\r\n insertionFiber.nextSibling = fiber;\r\n }\r\n }\r\n }\r\n\r\n keyIdx++;\r\n }\r\n }\r\n };\r\n\r\n isRemovingCase && performRemovingNodes();\r\n isInsertingCase && 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 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 (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 createFibersByPositionMap(fiber: Fiber) {\r\n let nextFiber = fiber;\r\n let position = 0;\r\n const map: Record = {};\r\n\r\n while (nextFiber) {\r\n map[position] = nextFiber;\r\n\r\n position++;\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return map;\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 keys: 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 keys.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 keys,\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 const deletions = deletionsHelper.get();\r\n const hasEffects = Boolean(wipFiber.alternate?.effectHost);\r\n const hasPortals = Boolean(wipFiber.alternate?.portalHost);\r\n\r\n if (hasEffects || hasPortals) {\r\n for (const fiber of deletions) {\r\n fiber.portalHost && platform.unmountPortal(fiber);\r\n\r\n if (fiber.effectHost) {\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 cleanupEffects(nextFiber.hook);\r\n }\r\n },\r\n });\r\n }\r\n }\r\n }\r\n\r\n commitWork(wipFiber.child, () => {\r\n const effects = effectsHelper.get();\r\n\r\n for (const fiber of deletions) {\r\n platform.applyCommits(fiber);\r\n }\r\n\r\n deletionsHelper.set([]);\r\n wipRootHelper.set(null);\r\n\r\n setTimeout(() => {\r\n for (const effect of effects) {\r\n effect();\r\n }\r\n });\r\n\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\nfunction commitWork(fiber: Fiber, onComplete: Function) {\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.applyCommits(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 onComplete();\r\n}\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\nfunction createHook(): Hook {\r\n return {\r\n idx: 0,\r\n values: [],\r\n };\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 './model';\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 { Platform } from './model';\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 applyCommits: () => {\r\n throw new Error('applyCommits 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 * from './global';\r\nexport * from './model';\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 applyCommits: (fiber: Fiber) => 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","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('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 './ref';\r\nexport type { MutableRef } from './model';\r\n","import { detectIsObject, detectIsNull } from '../helpers';\r\nimport type { Component, RefProps, ComponentFactory } from '../component';\r\nimport type { MutableRef } from './model';\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 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}\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};\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: () => storeHelper.get()?.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};\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\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};\r\n","export * from './model';\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(`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 './use-callback';\r\n","import { detectIsUndefined, detectIsDepsDifferent } from '../helpers';\r\nimport { componentFiberHelper } from '../scope';\r\n\r\nfunction useCallback(callback: 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 values[idx] = {\r\n deps,\r\n value: callback,\r\n };\r\n\r\n hook.idx++;\r\n\r\n return callback;\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\r\n if (isDepsDifferent) {\r\n hookValue.deps = deps;\r\n hookValue.value = callback;\r\n }\r\n\r\n hook.idx++;\r\n\r\n return hookValue.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/model';\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, EffectCleanup } from './model';\r\n\r\nconst $$useEffect = Symbol('use-effect');\r\n\r\nfunction 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 value: undefined,\r\n token: $$useEffect,\r\n };\r\n\r\n effectsHelper.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\nfunction hasEffects(fiber: Fiber) {\r\n const { values } = fiber.hook as Hook;\r\n const hasEffect = values.some(x => x.token === $$useEffect);\r\n\r\n return hasEffect;\r\n}\r\n\r\nfunction cleanupEffects(hook: Hook>) {\r\n const { values } = hook;\r\n\r\n for (const value of values) {\r\n if (value.token === $$useEffect) {\r\n const cleanup = value.value;\r\n\r\n detectIsFunction(cleanup) && cleanup();\r\n }\r\n }\r\n}\r\n\r\nexport { useEffect, hasEffects, cleanupEffects };\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-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-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 './model';\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 './model';\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/model';\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 '../global';\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 '../global';\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 './model';\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/model';\r\nimport type { ComponentFactory, StandardComponentProps } from '../component';\r\nimport { NodeType, type ViewDef } from './model';\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","// 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 './global';\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 * from './use-effect';\r\nexport * from './use-error';\r\nexport * from './use-imperative-handle';\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\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 1d81a72d..30987037 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:()=>we,ATTR_KEY:()=>i,ATTR_REF:()=>a,Comment:()=>de,CommentVirtualNode:()=>oe,ComponentFactory:()=>O,EMPTY_NODE:()=>o,EffectTag:()=>He,Fiber:()=>Ae,Fragment:()=>be,NodeType:()=>P,PARTIAL_UPDATE:()=>l,ROOT:()=>r,Suspense:()=>dt,SuspenseContext:()=>st,TagVirtualNode:()=>ne,TaskPriority:()=>n,Text:()=>se,TextVirtualNode:()=>re,View:()=>pe,VirtualNode:()=>te,cleanupEffects:()=>q,cloneTagMap:()=>je,componentFiberHelper:()=>W,createComponent:()=>I,createContext:()=>ot,createEmptyVirtualNode:()=>ve,createHook:()=>et,createUpdateCallback:()=>tt,currentRootHelper:()=>V,deletionsHelper:()=>B,detectIsArray:()=>v,detectIsBoolean:()=>p,detectIsCommentVirtualNode:()=>le,detectIsComponentFactory:()=>H,detectIsDepsDifferent:()=>E,detectIsEmpty:()=>y,detectIsEmptyVirtualNode:()=>fe,detectIsFragment:()=>me,detectIsFunction:()=>u,detectIsLazy:()=>ht,detectIsMemo:()=>Ee,detectIsNull:()=>h,detectIsNumber:()=>c,detectIsObject:()=>d,detectIsRef:()=>xe,detectIsString:()=>s,detectIsTagVirtualNode:()=>ae,detectIsTextVirtualNode:()=>ue,detectIsUndefined:()=>f,detectIsVirtualNode:()=>ie,detectIsVirtualNodeFactory:()=>he,dummyFn:()=>S,effectStoreHelper:()=>F,effectsHelper:()=>Y,error:()=>b,eventsHelper:()=>K,fiberMountHelper:()=>G,flatten:()=>m,forwardRef:()=>ge,fromHookUpdateHelper:()=>_,getComponentFactoryKey:()=>N,getRootId:()=>L,getTime:()=>g,getVirtualNodeKey:()=>ce,h:()=>ut,hasChildrenProp:()=>Qe,hasEffects:()=>$,keyBy:()=>x,lazy:()=>vt,memo:()=>Te,nextUnitOfWorkHelper:()=>R,platform:()=>Ne,takeListFromEnd:()=>w,useCallback:()=>ft,useContext:()=>rt,useDeferredValue:()=>yt,useEffect:()=>X,useError:()=>bt,useImperativeHandle:()=>mt,useMemo:()=>Ie,useReducer:()=>gt,useRef:()=>xt,useState:()=>ct,useUpdate:()=>nt,wipRootHelper:()=>U,workLoop:()=>De});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.")}(r),i=o.next();!i.done;i=o.next()){var a=i.value;if(a.token===z){var l=a.value;u(l)&&l()}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}}!function(e){e.TAG="TAG",e.TEXT="TEXT",e.COMMENT="COMMENT"}(P||(P={}));var J,Q=(J=function(e,t){return J=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])},J(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}J(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Z=function(){return Z=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},Ee=function(e){return H(e)&&e.token===we};function Te(e,t){return void 0===t&&(t=Se),ge(I((function(t,n){return n&&(t.ref=n),e(t)}),{token:we,shouldUpdate:t}))}var ke=I((function(e){return e.slot}),{token:we});function Oe(e,t){return void 0===t&&(t=!1),function(e,t){var n=function(e){return he(e)||H(e)};if(v(e)?n(e[0]):n(e)){var r=ke({slot:be({slot:e})});return r.shouldUpdate=function(){return t},r}return e}(e(),t)}function Ie(e,t){var n=W.get().hook,r=n.idx,o=n.values;if(f(o[r])){var i=Oe(e);return o[r]={deps:t,value:i},n.idx++,i}var a=o[r],l=E(t,a.deps),u=l?e:function(){return a.value};return a.deps=t,a.value=Oe(u,l),n.idx++,a.value}var Pe,He,Ne={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")},applyCommits:function(){throw new Error("applyCommits 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"}(He||(He={}));var je=((Pe={})[He.PLACEMENT]=!0,Pe[He.SKIP]=!0,Pe),Ce=function(){return Ce=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},Fe=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.")},Ae=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.mountedToHost=!f(e.mountedToHost)||!1,this.portalHost=!f(e.portalHost)&&e.portalHost,this.effectHost=!f(e.effectHost)&&e.effectHost,this.childrenCount=e.childrenCount||0,this.marker=e.marker||"",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.setError=function(e){"function"==typeof this.catchException?this.catchException(e):this.parent&&this.parent.setError(e)},e}();function De(){for(var e=U.get(),t=R.get(),n=!1,r=Boolean(t);t&&!n;)t=Ue(t),R.set(t),r=Boolean(t),n=Ne.shouldYeildToHost();return!t&&e&&function(){var e,t,n,r,o=U.get(),i=_.get(),a=B.get(),l=Boolean(null===(n=o.alternate)||void 0===n?void 0:n.effectHost),u=Boolean(null===(r=o.alternate)||void 0===r?void 0:r.portalHost);if(l||u)try{for(var f=Le(a),c=f.next();!c.done;c=f.next()){var s=c.value;s.portalHost&&Ne.unmountPortal(s),s.effectHost&&Ze({fiber:s,onLoop:function(e){var t=e.nextFiber;!e.isReturn&&H(t.instance)&&q(t.hook)}})}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=f.return)&&t.call(f)}finally{if(e)throw e.error}}!function(e,t){Ze({fiber:e,onLoop:function(e){var t=e.nextFiber,n=e.isReturn,r=e.resetIsDeepWalking;t.effectTag===He.SKIP?r():n||Ne.applyCommits(t),t&&t.shadow&&(t.shadow=null)}}),function(){var e,t,n=Y.get();try{for(var r=Le(a),l=r.next();!l.done;l=r.next()){var u=l.value;Ne.applyCommits(u)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}B.set([]),U.set(null),setTimeout((function(){var e,t;try{for(var r=Le(n),o=r.next();!o.done;o=r.next())(0,o.value)()}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}})),Y.reset(),i?_.set(!1):V.set(o)}()}(o.child)}(),r}function Ue(e){for(var t=!0,n=e,r=e.shadow,o=e.instance;;){if(t=G.deepWalking.get(),n.hook.idx=0,t)if(Qe(o)&&o.children.length>0){var i=Re({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=We({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=We({nextFiber:n,shadow:r,instance:o});if(a=u.performedFiber,n=u.performedNextFiber,r=u.performedShadow,o=u.performedInstance,a)return a}if(Ve(n),null===n.parent)return null}}function Ve(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=He.DELETION,a.push(i),i=i.nextSibling;(t=B.get()).push.apply(t,Fe([],Me(a),!1))}}}function Re(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!==He.DELETION?e.alternate.child:null;t&&t.effectTag===He.DELETION;)t=t.nextSibling;return t}(t),i=_e({shadow:n,alternate:o,instance:r}),a=n?n.provider:o?o.provider:null,l=new Ae({hook:i,provider:a});W.set(l),l.parent=t;var u=Ye({instance:r,idx:0,fiber:l,alternate:o});return r=u.performedInstance||r,n=u.performedShadow||n,o&&Be({fiber:l,alternate:o,instance:r}),Ke({fiber:l,alternate:o,instance:r}),l=o?Ge({fiber:l,alternate:o,instance:r}):l,t.child=l,l.parent=t,l.shadow=n,t=l,je[l.parent.effectTag]&&(l.effectTag=l.parent.effectTag),{performedFiber:t,performedNextFiber:t,performedShadow:n,performedInstance:r}}function We(e){G.jumpToSibling();var t=e.nextFiber,n=e.shadow,r=e.instance,o=t.parent.instance,i=G.getIndex();if(Qe(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===He.DELETION;)n=n.nextSibling;return n}(t),l=_e({shadow:n,alternate:a,instance:r}),u=n?n.provider:a?a.provider:null,f=new Ae({hook:l,provider:u});W.set(f),f.parent=t.parent;var c=Ye({instance:o,idx:i,fiber:f,alternate:a});return r=c.performedInstance||r,n=c.performedShadow||n,a&&Be({fiber:f,alternate:a,instance:r}),Ke({fiber:f,alternate:a,instance:r}),(f=a?Ge({fiber:f,alternate:a,instance:r}):f).parent=t.parent,t.nextSibling=f,f.shadow=n,t=f,je[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,Qe(t.instance)&&(t.instance.children=[]),{performedFiber:null,performedNextFiber:t,performedShadow:n,performedInstance:r}}function _e(e){var t=e.shadow,n=e.alternate,r=e.instance;return t?t.hook:n&&Xe(n.instance)===Xe(r)?n.hook:{idx:0,values:[]}}function Ke(e){var t=e.fiber,n=e.alternate,r=e.instance,o=(n?Xe(n.instance):null)!==(n?Xe(r):null),i=Boolean(n)&&Je(n.instance)===Je(r)&&!o;t.instance=r,t.alternate=n||null,t.nativeElement=i?n.nativeElement:null,t.effectTag=i?He.UPDATE:He.PLACEMENT,t.mountedToHost=!!t.nativeElement&&i,Qe(t.instance)&&(t.childrenCount=t.instance.children.length),t.alternate&&(t.alternate.shadow=null,t.alternate.alternate=null),!t.nativeElement&&ie(t.instance)&&(t.nativeElement=Ne.createNativeElement(t))}function Be(e){var t=e.fiber,n=e.alternate,r=e.instance,o=Je(n.instance),i=Je(r)===o,a=Xe(n.instance)===Xe(r);if(n.isUsed=!0,i&&a){if(Qe(n.instance)&&Qe(r)){var l=n.childrenCount,u=r.children.length;if(l!==u){var f=ul,s=Qe(r)?r.children:[],d=function(e,t){for(var n=e,r=0,o=[],i=[];n||r0;h||v.length,f&&function(){var e,r,o,i,a,f=$e(p,v);if(f.length>0){var c=function(e){for(var t=e,n={};t;){var r=Xe(t.instance);y(r)||(n[r]=t),t=t.nextSibling}return n}(n.child);try{for(var s=Le(f),d=s.next();!d.done;d=s.next())(S=c[d.value]||null)&&(S.effectTag=He.DELETION,B.get().push(S),S.effectHost&&t.markEffectHost(),S.portalHost&&t.markPortalHost())}catch(t){e={error:t}}finally{try{d&&!d.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}}else if(!h){var b=l-u,m=w(function(e){for(var t=[],n=e;n;)t.push(n),n=n.nextSibling;return t}(n.child),b);try{for(var g=Le(m),x=g.next();!x.done;x=g.next()){var S;(S=x.value).effectTag=He.DELETION,S.effectHost&&t.markEffectHost(),S.portalHost&&t.markPortalHost()}}catch(e){o={error:e}}finally{try{x&&!x.done&&(i=g.return)&&i.call(g)}finally{if(o)throw o.error}}(a=B.get()).push.apply(a,Fe([],Me(m),!1))}}(),c&&function(){var e,t,r=$e(v,p);if(r.length>0){var o=x(r,(function(e){return e})),i=function(e){for(var t=e,n=0,r={};t;)r[n]=t,n++,t=t.nextSibling;return r}(n.child),a={},l=0;try{for(var u=Le(v),f=u.next();!f.done;f=u.next()){var c=f.value;if(a[c]=!0,c!==p[l]&&o[c]){var s=new Ae({instance:ve(),parent:n,effectTag:He.PLACEMENT});if(0===l)s.nextSibling=n.child,n.child=s;else{var d=i[l]||null;d&&(s.nextSibling=d)}}l++}}catch(t){e={error:t}}finally{try{f&&!f.done&&(t=u.return)&&t.call(u)}finally{if(e)throw e.error}}}}()}}}else n.effectTag=He.DELETION,B.get().push(n)}function Ge(e){var t=e.fiber,n=e.alternate,r=e.instance;if(Ee(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 Ae(Ce(Ce({},n),{alternate:n,effectTag:He.SKIP,nextSibling:n.nextSibling?n.nextSibling.effectTag===He.DELETION?null:n.nextSibling:null})),n.alternate=null,f=o.child;f;)f.parent=o,f=f.nextSibling;return o}}return t}function Ye(e){var t,n=e.instance,r=e.idx,o=e.fiber,i=e.alternate,a=null,l=null;if(Qe(n)){var u=v(n.children[r])?m([n.children[r]]):[n.children[r]];(t=n.children).splice.apply(t,Fe([r,1],Me(u),!1)),a=n.children[r],l=i?function(e){var t=e.instance,n=e.fiber,r=e.alternate,o=Xe(r.instance),i=Xe(t),a=null;return o!==i&&(a=function(e,t){if(y(e))return null;for(var n=t;n;){if(e===Xe(n.instance))return n;n=n.nextSibling}return null}(i,r.parent.child),a&&(n.hook=a.hook,n.provider=a.provider)),a}({instance:a,fiber:o,alternate:i}):l,a=ze(o,a)}return H(a)&&($(o)&&o.markEffectHost(),Ne.detectIsPortal(a)&&o.markPortalHost()),{performedInstance:a,performedShadow:l}}function ze(e,t){var n=H(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 he(t)&&(t=t());if(Qe(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 I((function(t){var n=t.slot,r=rt(e);return u(n)?n(r):null}),{displayName:"".concat(t,".Consumer")})}(e,n)}var at=function(){return at=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 ut(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}(ct(!1),2),i=o[0],a=o[1],l=ft((function(){return a(!0)}),[]),u=Ie((function(){return{fallback:t,isLoaded:i,trigger:l}}),[t,i]);return st.Provider({value:u,slot:r?n:null})})),pt=Symbol("lazy");function vt(e){return ge(I((function(t,n){var r=rt(st),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}(ct({component:null}),2),l=a[0],u=a[1];return X((function(){(function(e){return new Promise((function(t){e().then((function(e){if(!e.default)throw new Error("lazy loaded component should be exported as default!");t(e.default)}))}))})(e).then((function(e){u({component:e})}))}),[]),X((function(){l.component&&i()}),[l.component]),l.component?l.component(t,n):o}),{token:pt}))}var ht=function(e){return H(e)&&e.token===pt};function yt(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}(ct(e,{priority:n.LOW,timeoutMs:r}),2),i=o[0],a=o[1];return X((function(){a(e)}),[e]),i}function bt(){var e=W.get(),t=nt(),n=Ie((function(){return{error:null}}),[]);return e.catchException=function(e){n.error=e,t()},X((function(){n.error=null}),[n.error]),n.error}function mt(e,t,n){var r=Ie((function(){return t()}),n);e.current=r}function gt(e,t,n){var r=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}(ct(Ie((function(){return u(n)?n(t):t}),[])),2),o=r[0],i=r[1],a=ft((function(t){return i((function(n){return e(n,t)}))}),[]);return[o,a]}function xt(e){return void 0===e&&(e=null),Ie((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:()=>we,ATTR_KEY:()=>i,ATTR_REF:()=>a,Comment:()=>de,CommentVirtualNode:()=>oe,ComponentFactory:()=>O,EMPTY_NODE:()=>o,EffectTag:()=>He,Fiber:()=>Ae,Fragment:()=>be,NodeType:()=>P,PARTIAL_UPDATE:()=>l,ROOT:()=>r,Suspense:()=>dt,SuspenseContext:()=>st,TagVirtualNode:()=>ne,TaskPriority:()=>n,Text:()=>se,TextVirtualNode:()=>re,View:()=>pe,VirtualNode:()=>te,cleanupEffects:()=>q,cloneTagMap:()=>je,componentFiberHelper:()=>W,createComponent:()=>I,createContext:()=>ot,createEmptyVirtualNode:()=>ve,createHook:()=>et,createUpdateCallback:()=>tt,currentRootHelper:()=>V,deletionsHelper:()=>B,detectIsArray:()=>v,detectIsBoolean:()=>p,detectIsCommentVirtualNode:()=>le,detectIsComponentFactory:()=>H,detectIsDepsDifferent:()=>E,detectIsEmpty:()=>y,detectIsEmptyVirtualNode:()=>fe,detectIsFragment:()=>me,detectIsFunction:()=>u,detectIsLazy:()=>ht,detectIsMemo:()=>Ee,detectIsNull:()=>h,detectIsNumber:()=>c,detectIsObject:()=>d,detectIsRef:()=>xe,detectIsString:()=>s,detectIsTagVirtualNode:()=>ae,detectIsTextVirtualNode:()=>ue,detectIsUndefined:()=>f,detectIsVirtualNode:()=>ie,detectIsVirtualNodeFactory:()=>he,dummyFn:()=>S,effectStoreHelper:()=>F,effectsHelper:()=>Y,error:()=>b,eventsHelper:()=>K,fiberMountHelper:()=>G,flatten:()=>m,forwardRef:()=>ge,fromHookUpdateHelper:()=>_,getComponentFactoryKey:()=>N,getRootId:()=>L,getTime:()=>g,getVirtualNodeKey:()=>ce,h:()=>ut,hasChildrenProp:()=>Qe,hasEffects:()=>$,keyBy:()=>x,lazy:()=>vt,memo:()=>Te,nextUnitOfWorkHelper:()=>R,platform:()=>Ne,takeListFromEnd:()=>w,useCallback:()=>ft,useContext:()=>rt,useDeferredValue:()=>yt,useEffect:()=>X,useError:()=>bt,useImperativeHandle:()=>mt,useMemo:()=>Ie,useReducer:()=>gt,useRef:()=>xt,useState:()=>ct,useUpdate:()=>nt,wipRootHelper:()=>U,workLoop:()=>De});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.")}(r),i=o.next();!i.done;i=o.next()){var a=i.value;if(a.token===z){var l=a.value;u(l)&&l()}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}}!function(e){e.TAG="TAG",e.TEXT="TEXT",e.COMMENT="COMMENT"}(P||(P={}));var J,Q=(J=function(e,t){return J=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])},J(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}J(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Z=function(){return Z=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},Ee=function(e){return H(e)&&e.token===we};function Te(e,t){return void 0===t&&(t=Se),ge(I((function(t,n){return n&&(t.ref=n),e(t)}),{token:we,shouldUpdate:t}))}var ke=I((function(e){return e.slot}),{token:we});function Oe(e,t){return void 0===t&&(t=!1),function(e,t){var n=function(e){return he(e)||H(e)};if(v(e)?n(e[0]):n(e)){var r=ke({slot:be({slot:e})});return r.shouldUpdate=function(){return t},r}return e}(e(),t)}function Ie(e,t){var n=W.get().hook,r=n.idx,o=n.values;if(f(o[r])){var i=Oe(e);return o[r]={deps:t,value:i},n.idx++,i}var a=o[r],l=E(t,a.deps),u=l?e:function(){return a.value};return a.deps=t,a.value=Oe(u,l),n.idx++,a.value}var Pe,He,Ne={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")},applyCommits:function(){throw new Error("applyCommits 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"}(He||(He={}));var je=((Pe={})[He.PLACEMENT]=!0,Pe[He.SKIP]=!0,Pe),Ce=function(){return Ce=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},Fe=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.")},Ae=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.childrenCount=e.childrenCount||0,this.marker=e.marker||"",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.setError=function(e){"function"==typeof this.catchException?this.catchException(e):this.parent&&this.parent.setError(e)},e}();function De(){for(var e=U.get(),t=R.get(),n=!1,r=Boolean(t);t&&!n;)t=Ue(t),R.set(t),r=Boolean(t),n=Ne.shouldYeildToHost();return!t&&e&&function(){var e,t,n,r,o=U.get(),i=_.get(),a=B.get(),l=Boolean(null===(n=o.alternate)||void 0===n?void 0:n.effectHost),u=Boolean(null===(r=o.alternate)||void 0===r?void 0:r.portalHost);if(l||u){var f=function(e){e.portalHost&&Ne.unmountPortal(e),e.effectHost&&Ze({fiber:e,onLoop:function(t){var n=t.nextFiber,r=t.isReturn,o=t.stop;if(n===e.nextSibling||e.transposition)return o();!r&&H(n.instance)&&q(n.hook)}})};try{for(var c=Le(a),s=c.next();!s.done;s=c.next())f(s.value)}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}}Ze({fiber:o.child,onLoop:function(e){var t=e.nextFiber,n=e.isReturn,r=e.resetIsDeepWalking;t.effectTag===He.SKIP?r():n||Ne.applyCommits(t),t&&t.shadow&&(t.shadow=null)}}),function(){var e,t,n=Y.get();try{for(var r=Le(a),l=r.next();!l.done;l=r.next()){var u=l.value;Ne.applyCommits(u)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}B.set([]),U.set(null),setTimeout((function(){var e,t;try{for(var r=Le(n),o=r.next();!o.done;o=r.next())(0,o.value)()}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}})),Y.reset(),i?_.set(!1):V.set(o)}()}(),r}function Ue(e){for(var t=!0,n=e,r=e.shadow,o=e.instance;;){if(t=G.deepWalking.get(),n.hook.idx=0,t)if(Qe(o)&&o.children.length>0){var i=Re({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=We({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=We({nextFiber:n,shadow:r,instance:o});if(a=u.performedFiber,n=u.performedNextFiber,r=u.performedShadow,o=u.performedInstance,a)return a}if(Ve(n),null===n.parent)return null}}function Ve(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=He.DELETION,a.push(i),i=i.nextSibling;(t=B.get()).push.apply(t,Fe([],Me(a),!1))}}}function Re(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!==He.DELETION?e.alternate.child:null;t&&t.effectTag===He.DELETION;)t=t.nextSibling;return t}(t),i=_e({shadow:n,alternate:o,instance:r}),a=n?n.provider:o?o.provider:null,l=new Ae({hook:i,provider:a});W.set(l),l.parent=t;var u=Ye({instance:r,idx:0,fiber:l,alternate:o});return r=u.performedInstance||r,n=u.performedShadow||n,o&&Be({fiber:l,alternate:o,instance:r}),Ke({fiber:l,alternate:o,instance:r}),l=o?Ge({fiber:l,alternate:o,instance:r}):l,t.child=l,l.parent=t,l.shadow=n,t=l,je[l.parent.effectTag]&&(l.effectTag=l.parent.effectTag),{performedFiber:t,performedNextFiber:t,performedShadow:n,performedInstance:r}}function We(e){G.jumpToSibling();var t=e.nextFiber,n=e.shadow,r=e.instance,o=t.parent.instance,i=G.getIndex();if(Qe(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===He.DELETION;)n=n.nextSibling;return n}(t),l=_e({shadow:n,alternate:a,instance:r}),u=n?n.provider:a?a.provider:null,f=new Ae({hook:l,provider:u});W.set(f),f.parent=t.parent;var c=Ye({instance:o,idx:i,fiber:f,alternate:a});return r=c.performedInstance||r,n=c.performedShadow||n,a&&Be({fiber:f,alternate:a,instance:r}),Ke({fiber:f,alternate:a,instance:r}),(f=a?Ge({fiber:f,alternate:a,instance:r}):f).parent=t.parent,t.nextSibling=f,f.shadow=n,t=f,je[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,Qe(t.instance)&&(t.instance.children=[]),{performedFiber:null,performedNextFiber:t,performedShadow:n,performedInstance:r}}function _e(e){var t=e.shadow,n=e.alternate,r=e.instance;return t?t.hook:n&&Xe(n.instance)===Xe(r)?n.hook:{idx:0,values:[]}}function Ke(e){var t=e.fiber,n=e.alternate,r=e.instance,o=(n?Xe(n.instance):null)!==(n?Xe(r):null),i=Boolean(n)&&Je(n.instance)===Je(r)&&!o;t.instance=r,t.alternate=n||null,t.nativeElement=i?n.nativeElement:null,t.effectTag=i?He.UPDATE:He.PLACEMENT,t.mountedToHost=!!t.nativeElement&&i,Qe(t.instance)&&(t.childrenCount=t.instance.children.length),t.alternate&&(t.alternate.shadow=null,t.alternate.alternate=null),!t.nativeElement&&ie(t.instance)&&(t.nativeElement=Ne.createNativeElement(t))}function Be(e){var t=e.fiber,n=e.alternate,r=e.instance,o=Je(n.instance),i=Je(r)===o,a=Xe(n.instance)===Xe(r);if(n.isUsed=!0,i&&a){if(Qe(n.instance)&&Qe(r)){var l=n.childrenCount,u=r.children.length;if(l!==u){var f=ul,s=Qe(r)?r.children:[],d=function(e,t){for(var n=e,r=0,o=[],i=[];n||r0;h||v.length,f&&function(){var e,r,o,i,a,f=$e(p,v);if(f.length>0){var c=function(e){for(var t=e,n={};t;){var r=Xe(t.instance);y(r)||(n[r]=t),t=t.nextSibling}return n}(n.child);try{for(var s=Le(f),d=s.next();!d.done;d=s.next())(S=c[d.value]||null)&&(S.effectTag=He.DELETION,B.get().push(S),S.effectHost&&t.markEffectHost(),S.portalHost&&t.markPortalHost())}catch(t){e={error:t}}finally{try{d&&!d.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}}else if(!h){var b=l-u,m=w(function(e){for(var t=[],n=e;n;)t.push(n),n=n.nextSibling;return t}(n.child),b);try{for(var g=Le(m),x=g.next();!x.done;x=g.next()){var S;(S=x.value).effectTag=He.DELETION,S.effectHost&&t.markEffectHost(),S.portalHost&&t.markPortalHost()}}catch(e){o={error:e}}finally{try{x&&!x.done&&(i=g.return)&&i.call(g)}finally{if(o)throw o.error}}(a=B.get()).push.apply(a,Fe([],Me(m),!1))}}(),c&&function(){var e,t,r=$e(v,p);if(r.length>0){var o=x(r,(function(e){return e})),i=function(e){for(var t=e,n=0,r={};t;)r[n]=t,n++,t=t.nextSibling;return r}(n.child),a={},l=0;try{for(var u=Le(v),f=u.next();!f.done;f=u.next()){var c=f.value;if(a[c]=!0,c!==p[l]&&o[c]){var s=new Ae({instance:ve(),parent:n,effectTag:He.PLACEMENT});if(0===l)s.nextSibling=n.child,n.child=s;else{var d=i[l]||null;d&&(s.nextSibling=d)}}l++}}catch(t){e={error:t}}finally{try{f&&!f.done&&(t=u.return)&&t.call(u)}finally{if(e)throw e.error}}}}()}}}else n.effectTag=He.DELETION,B.get().push(n)}function Ge(e){var t=e.fiber,n=e.alternate,r=e.instance;if(Ee(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 Ae(Ce(Ce({},n),{alternate:n,effectTag:He.SKIP,nextSibling:n.nextSibling?n.nextSibling.effectTag===He.DELETION?null:n.nextSibling:null})),n.alternate=null,f=o.child;f;)f.parent=o,f=f.nextSibling;return o}}return t}function Ye(e){var t,n=e.instance,r=e.idx,o=e.fiber,i=e.alternate,a=null,l=null;if(Qe(n)){var u=v(n.children[r])?m([n.children[r]]):[n.children[r]];(t=n.children).splice.apply(t,Fe([r,1],Me(u),!1)),a=n.children[r],l=i?function(e){var t=e.instance,n=e.fiber,r=e.alternate,o=Xe(r.instance),i=Xe(t),a=null;return o!==i&&(a=function(e,t){if(y(e))return null;for(var n=t;n;){if(e===Xe(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=ze(o,a)}return H(a)&&($(o)&&o.markEffectHost(),Ne.detectIsPortal(a)&&o.markPortalHost()),{performedInstance:a,performedShadow:l}}function ze(e,t){var n=H(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 he(t)&&(t=t());if(Qe(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 I((function(t){var n=t.slot,r=rt(e);return u(n)?n(r):null}),{displayName:"".concat(t,".Consumer")})}(e,n)}var at=function(){return at=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 ut(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}(ct(!1),2),i=o[0],a=o[1],l=ft((function(){return a(!0)}),[]),u=Ie((function(){return{fallback:t,isLoaded:i,trigger:l}}),[t,i]);return st.Provider({value:u,slot:r?n:null})})),pt=Symbol("lazy");function vt(e){return ge(I((function(t,n){var r=rt(st),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}(ct({component:null}),2),l=a[0],u=a[1];return X((function(){(function(e){return new Promise((function(t){e().then((function(e){if(!e.default)throw new Error("lazy loaded component should be exported as default!");t(e.default)}))}))})(e).then((function(e){u({component:e})}))}),[]),X((function(){l.component&&i()}),[l.component]),l.component?l.component(t,n):o}),{token:pt}))}var ht=function(e){return H(e)&&e.token===pt};function yt(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}(ct(e,{priority:n.LOW,timeoutMs:r}),2),i=o[0],a=o[1];return X((function(){a(e)}),[e]),i}function bt(){var e=W.get(),t=nt(),n=Ie((function(){return{error:null}}),[]);return e.catchException=function(e){n.error=e,t()},X((function(){n.error=null}),[n.error]),n.error}function mt(e,t,n){var r=Ie((function(){return t()}),n);e.current=r}function gt(e,t,n){var r=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}(ct(Ie((function(){return u(n)?n(t):t}),[])),2),o=r[0],i=r[1],a=ft((function(t){return i((function(n){return e(n,t)}))}),[]);return[o,a]}function xt(e){return void 0===e&&(e=null),Ie((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 d54b6b2b..a76ba93c 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,mvDCLhD,IAMKC,EANCC,EAAO,OACPC,EAAa,cACbC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AASU,GAAoB5U,EAAUkD,GAC7B,IAAA4O,GAAc5O,GAAW,IAAE,UAC7B,E,uRAAA,CAAoCmQ,GAASrT,EAAO,CACxDyT,SAAUxT,EAAayT,IACvB5B,UAAS,IACT,GAHK+C,EAAa,KAAEC,EAAgB,KAStC,OAJApO,GAAU,WACRoO,EAAiB9U,KAChB,CAACA,IAEG6U,ECVT,SAASE,KACP,IAAMxP,EAAQG,EAAqBlG,MAC7B2S,EAASR,KACTC,EAAoB1H,IAAQ,WAAM,OAAGhJ,MAAO,QAAS,IAW3D,OATAqE,EAAM4G,eAAiB,SAACjL,GACtB0Q,EAAM1Q,MAAQA,EACdiR,KAGFzL,GAAU,WACRkL,EAAM1Q,MAAQ,OACb,CAAC0Q,EAAM1Q,QAEH0Q,EAAM1Q,MCpBf,SAAS8T,GAAuBzR,EAAoB0R,EAAuBtS,GACzE,IAAMuS,EAAUhL,IAAQ,WAAM,OAAA+K,MAAgBtS,GAE9CY,EAAI2R,QAAUA,ECAhB,SAASC,GACPC,EACAC,EACAC,GAEA,IAGM,E,uRAAA,CAAoBjC,GAHLnJ,IAAQ,WAC3B,OAAO3J,EAAiB+U,GAAeA,EAAYD,GAAgBA,IAClE,KAC8D,GAA1DE,EAAK,KAAEhC,EAAQ,KAChBiC,EAAWpC,IAAY,SAACqC,GAA6B,OAAAlC,GAAS,SAAAgC,GAAS,OAAAH,EAAQG,EAAOE,QAAU,IAItG,MAAO,CAACF,EAAOC,GChBjB,SAASE,GAAUpC,GAGjB,YAHiB,IAAAA,IAAAA,EAAA,MACLpJ,IAAQ,WAAM,OAAGgL,QAAS5B,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/model.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/global/global.ts","webpack://DarkCore/./src/fiber/model.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-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/model';\r\nimport type { MutableRef } from '../ref';\r\nimport type { CreateElement, ComponentOptions, StandardComponentProps, SlotProps } from './model';\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 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}\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};\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: () => storeHelper.get()?.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};\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\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};\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, EffectCleanup } from './model';\r\n\r\nconst $$useEffect = Symbol('use-effect');\r\n\r\nfunction 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 value: undefined,\r\n token: $$useEffect,\r\n };\r\n\r\n effectsHelper.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\nfunction hasEffects(fiber: Fiber) {\r\n const { values } = fiber.hook as Hook;\r\n const hasEffect = values.some(x => x.token === $$useEffect);\r\n\r\n return hasEffect;\r\n}\r\n\r\nfunction cleanupEffects(hook: Hook>) {\r\n const { values } = hook;\r\n\r\n for (const value of values) {\r\n if (value.token === $$useEffect) {\r\n const cleanup = value.value;\r\n\r\n detectIsFunction(cleanup) && cleanup();\r\n }\r\n }\r\n}\r\n\r\nexport { useEffect, hasEffects, cleanupEffects };\r\n","import { EMPTY_NODE, ATTR_KEY } from '../constants';\r\nimport { detectIsArray, detectIsEmpty, detectIsFunction } from '../helpers';\r\nimport type { DarkElementKey } from '../shared/model';\r\nimport type { ComponentFactory, StandardComponentProps } from '../component';\r\nimport { NodeType, type ViewDef } from './model';\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 './model';\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 './model';\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 applyCommits: () => {\r\n throw new Error('applyCommits 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 { flatten, detectIsEmpty, error, keyBy, takeListFromEnd, detectIsUndefined, detectIsArray } from '../helpers';\r\nimport { platform } from '../global';\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} 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/model';\r\nimport type { DarkElementKey, DarkElement, DarkElementInstance } from '../shared/model';\r\nimport { PARTIAL_UPDATE } from '../constants';\r\nimport { type NativeElement, type Hook, EffectTag, cloneTagMap } from './model';\r\nimport { hasEffects, cleanupEffects } from '../use-effect';\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 mountedToHost: boolean;\r\n public portalHost: boolean;\r\n public effectHost: boolean;\r\n public childrenCount: number;\r\n public marker: string;\r\n public isUsed: boolean;\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.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.childrenCount = options.childrenCount || 0;\r\n this.marker = options.marker || '';\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 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({ fiber, alternate, instance });\r\n mutateFiber({ fiber, alternate, instance });\r\n fiber = alternate ? performMemo({ fiber, alternate, instance }) : fiber;\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({ fiber, alternate, instance });\r\n mutateFiber({ fiber, alternate, instance });\r\n fiber = alternate ? performMemo({ fiber, alternate, instance }) : fiber;\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 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 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 = fiber.nativeElement ? isUpdate : false;\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 fiber: Fiber;\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction mutateAlternate(options: PerformAlternateOptions) {\r\n const { fiber, 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 isRemovingCase = nextElementsCount < prevElementsCount;\r\n const isInsertingCase = nextElementsCount > prevElementsCount;\r\n const children = hasChildrenProp(instance) ? instance.children : [];\r\n const { keys, nextKeys } = extractKeys(alternate.child, children);\r\n const hasKeys = keys.length > 0;\r\n const hasAnyKeys = hasKeys || nextKeys.length > 0;\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(keys, 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 childAlternate = fibersMap[key] || null;\r\n\r\n if (childAlternate) {\r\n childAlternate.effectTag = EffectTag.DELETION;\r\n deletionsHelper.get().push(childAlternate);\r\n\r\n if (childAlternate.effectHost) {\r\n fiber.markEffectHost();\r\n }\r\n\r\n if (childAlternate.portalHost) {\r\n fiber.markPortalHost();\r\n }\r\n }\r\n }\r\n } else if (!hasKeys) {\r\n const diffCount = prevElementsCount - nextElementsCount;\r\n const childAlternates: Array = takeListFromEnd(getSiblingFibers(alternate.child), diffCount);\r\n\r\n for (const childAlternate of childAlternates) {\r\n childAlternate.effectTag = EffectTag.DELETION;\r\n\r\n if (childAlternate.effectHost) {\r\n fiber.markEffectHost();\r\n }\r\n\r\n if (childAlternate.portalHost) {\r\n fiber.markPortalHost();\r\n }\r\n }\r\n\r\n deletionsHelper.get().push(...childAlternates);\r\n }\r\n };\r\n\r\n const performInsertingNodes = () => {\r\n const diffKeys = getDiffKeys(nextKeys, keys);\r\n\r\n if (diffKeys.length > 0) {\r\n const diffKeyMap = keyBy(diffKeys, x => x);\r\n const fibersByPositionsMap = createFibersByPositionMap(alternate.child);\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 !== keys[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 = fibersByPositionsMap[keyIdx] || null;\r\n\r\n if (fiber) {\r\n insertionFiber.nextSibling = fiber;\r\n }\r\n }\r\n }\r\n\r\n keyIdx++;\r\n }\r\n }\r\n };\r\n\r\n isRemovingCase && performRemovingNodes();\r\n isInsertingCase && 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 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 (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 }\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 createFibersByPositionMap(fiber: Fiber) {\r\n let nextFiber = fiber;\r\n let position = 0;\r\n const map: Record = {};\r\n\r\n while (nextFiber) {\r\n map[position] = nextFiber;\r\n\r\n position++;\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return map;\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 keys: 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 keys.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 keys,\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 const deletions = deletionsHelper.get();\r\n const hasEffects = Boolean(wipFiber.alternate?.effectHost);\r\n const hasPortals = Boolean(wipFiber.alternate?.portalHost);\r\n\r\n if (hasEffects || hasPortals) {\r\n for (const fiber of deletions) {\r\n fiber.portalHost && platform.unmountPortal(fiber);\r\n\r\n if (fiber.effectHost) {\r\n walkFiber({\r\n fiber,\r\n onLoop: ({ nextFiber, isReturn }) => {\r\n if (!isReturn && detectIsComponentFactory(nextFiber.instance)) {\r\n cleanupEffects(nextFiber.hook);\r\n }\r\n },\r\n });\r\n }\r\n }\r\n }\r\n\r\n commitWork(wipFiber.child, () => {\r\n const effects = effectsHelper.get();\r\n\r\n for (const fiber of deletions) {\r\n platform.applyCommits(fiber);\r\n }\r\n\r\n deletionsHelper.set([]);\r\n wipRootHelper.set(null);\r\n\r\n setTimeout(() => {\r\n for (const effect of effects) {\r\n effect();\r\n }\r\n });\r\n\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\nfunction commitWork(fiber: Fiber, onComplete: Function) {\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.applyCommits(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 onComplete();\r\n}\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};\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 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 });\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\nfunction createHook(): Hook {\r\n return {\r\n idx: 0,\r\n values: [],\r\n };\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 '../global';\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/model';\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 './model';\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 { detectIsUndefined, detectIsDepsDifferent } from '../helpers';\r\nimport { componentFiberHelper } from '../scope';\r\n\r\nfunction useCallback(callback: 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 values[idx] = {\r\n deps,\r\n value: callback,\r\n };\r\n\r\n hook.idx++;\r\n\r\n return callback;\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\r\n if (isDepsDifferent) {\r\n hookValue.deps = deps;\r\n hookValue.value = callback;\r\n }\r\n\r\n hook.idx++;\r\n\r\n return hookValue.value;\r\n}\r\n\r\nexport { useCallback };\r\n","import { type ScheduleCallbackOptions } from '../global';\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(`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('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 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 './model';\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/model';\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","deletions","fiberMount","navigation","isDeepWalking","componentFiber","effects","rootId","stores","effectStoreHelper","set","id","effectStore","getRootId","Store","storeHelper","wipRootHelper","fiber","currentRootHelper","nextUnitOfWorkHelper","componentFiberHelper","fromHookUpdateHelper","eventsHelper","deletionsHelper","fiberMountHelper","reset","getIndex","jumpToChild","nextLevel","jumpToParent","jumpToSibling","deepWalking","effectsHelper","add","effect","$$useEffect","useEffect","hook","values","runEffect","undefined","cleanup","hasEffects","some","cleanupEffects","$$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","applyCommits","detectIsPortal","unmountPortal","cloneTagMap","PLACEMENT","SKIP","nativeElement","parent","child","nextSibling","alternate","effectTag","instance","shadow","provider","mountedToHost","portalHost","effectHost","childrenCount","marker","isUsed","markPortalHost","markEffectHost","setError","catchException","workLoop","wipFiber","shouldYield","hasMoreWork","Boolean","performUnitOfWork","fromHook","hasPortals","walkFiber","onLoop","nextFiber","onComplete","isReturn","resetIsDeepWalking","setTimeout","commitWork","commitChanges","hasChildrenProp","performChild","performedFiber","performSibling","performPartialUpdateEffects","DELETION","getChildAlternate","getHook","Fiber","pertformInstance","mutateAlternate","mutateFiber","performMemo","performedNextFiber","performedShadow","performedInstance","childrenIdx","getNextSiblingAlternate","getElementKey","isDifferentKeys","isUpdate","getInstanceType","UPDATE","alternateType","isSameType","isSameKeys","isRemovingCase","isInsertingCase","nextKeys","nextKey","extractKeys","diffKeys","getDiffKeys","fibersMap","map","createFibersByKeyMap","childAlternate","diffCount","childAlternates","getSiblingFibers","performRemovingNodes","diffKeyMap","fibersByPositionsMap","position","createFibersByPositionMap","usedKeyMap","keyIdx","insertionFiber","performInsertingNodes","memoFiber","alternateFactory","elements","splice","getAlternateByKey","getRootShadow","mountInstance","isComponentFactory","result","err","transformElementInstance","nextKeysMap","diff","element","visitedMap","detectCanVisit","newFiber","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","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,mvDCLhD,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,GACpCsB,EAAiB,SAACtB,GAAW,MAAa,iBAANA,GACpCuB,EAAiB,SAACvB,GAAW,MAAa,i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Q,GAASvT,EAAO,CACxD2T,SAAU1T,EAAa2T,IACvB5B,UAAS,IACT,GAHK+C,EAAa,KAAEC,EAAgB,KAStC,OAJAtO,GAAU,WACRsO,EAAiBhV,KAChB,CAACA,IAEG+U,ECVT,SAASE,KACP,IAAM1P,EAAQG,EAAqBlG,MAC7B6S,EAASR,KACTC,EAAoB5H,IAAQ,WAAM,OAAGhJ,MAAO,QAAS,IAW3D,OATAqE,EAAM6G,eAAiB,SAAClL,GACtB4Q,EAAM5Q,MAAQA,EACdmR,KAGF3L,GAAU,WACRoL,EAAM5Q,MAAQ,OACb,CAAC4Q,EAAM5Q,QAEH4Q,EAAM5Q,MCpBf,SAASgU,GAAuB3R,EAAoB4R,EAAuBxS,GACzE,IAAMyS,EAAUlL,IAAQ,WAAM,OAAAiL,MAAgBxS,GAE9CY,EAAI6R,QAAUA,ECAhB,SAASC,GACPC,EACAC,EACAC,GAEA,IAGM,E,uRAAA,CAAoBjC,GAHLrJ,IAAQ,WAC3B,OAAO3J,EAAiBiV,GAAeA,EAAYD,GAAgBA,IAClE,KAC8D,GAA1DE,EAAK,KAAEhC,EAAQ,KAChBiC,EAAWpC,IAAY,SAACqC,GAA6B,OAAAlC,GAAS,SAAAgC,GAAS,OAAAH,EAAQG,EAAOE,QAAU,IAItG,MAAO,CAACF,EAAOC,GChBjB,SAASE,GAAUpC,GAGjB,YAHiB,IAAAA,IAAAA,EAAA,MACLtJ,IAAQ,WAAM,OAAGkL,QAAS5B,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/model.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/global/global.ts","webpack://DarkCore/./src/fiber/model.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-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/model';\r\nimport type { MutableRef } from '../ref';\r\nimport type { CreateElement, ComponentOptions, StandardComponentProps, SlotProps } from './model';\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 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}\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};\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: () => storeHelper.get()?.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};\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\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};\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, EffectCleanup } from './model';\r\n\r\nconst $$useEffect = Symbol('use-effect');\r\n\r\nfunction 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 value: undefined,\r\n token: $$useEffect,\r\n };\r\n\r\n effectsHelper.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\nfunction hasEffects(fiber: Fiber) {\r\n const { values } = fiber.hook as Hook;\r\n const hasEffect = values.some(x => x.token === $$useEffect);\r\n\r\n return hasEffect;\r\n}\r\n\r\nfunction cleanupEffects(hook: Hook>) {\r\n const { values } = hook;\r\n\r\n for (const value of values) {\r\n if (value.token === $$useEffect) {\r\n const cleanup = value.value;\r\n\r\n detectIsFunction(cleanup) && cleanup();\r\n }\r\n }\r\n}\r\n\r\nexport { useEffect, hasEffects, cleanupEffects };\r\n","import { EMPTY_NODE, ATTR_KEY } from '../constants';\r\nimport { detectIsArray, detectIsEmpty, detectIsFunction } from '../helpers';\r\nimport type { DarkElementKey } from '../shared/model';\r\nimport type { ComponentFactory, StandardComponentProps } from '../component';\r\nimport { NodeType, type ViewDef } from './model';\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 './model';\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 './model';\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 applyCommits: () => {\r\n throw new Error('applyCommits 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 { flatten, detectIsEmpty, error, keyBy, takeListFromEnd, detectIsUndefined, detectIsArray } from '../helpers';\r\nimport { platform } from '../global';\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} 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/model';\r\nimport type { DarkElementKey, DarkElement, DarkElementInstance } from '../shared/model';\r\nimport { PARTIAL_UPDATE } from '../constants';\r\nimport { type NativeElement, type Hook, EffectTag, cloneTagMap } from './model';\r\nimport { hasEffects, cleanupEffects } from '../use-effect';\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 childrenCount: number;\r\n public marker: string;\r\n public isUsed: boolean;\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.childrenCount = options.childrenCount || 0;\r\n this.marker = options.marker || '';\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 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({ fiber, alternate, instance });\r\n mutateFiber({ fiber, alternate, instance });\r\n fiber = alternate ? performMemo({ fiber, alternate, instance }) : fiber;\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({ fiber, alternate, instance });\r\n mutateFiber({ fiber, alternate, instance });\r\n fiber = alternate ? performMemo({ fiber, alternate, instance }) : fiber;\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 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 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 = fiber.nativeElement ? isUpdate : false;\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 fiber: Fiber;\r\n alternate: Fiber;\r\n instance: DarkElementInstance;\r\n};\r\n\r\nfunction mutateAlternate(options: PerformAlternateOptions) {\r\n const { fiber, 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 isRemovingCase = nextElementsCount < prevElementsCount;\r\n const isInsertingCase = nextElementsCount > prevElementsCount;\r\n const children = hasChildrenProp(instance) ? instance.children : [];\r\n const { keys, nextKeys } = extractKeys(alternate.child, children);\r\n const hasKeys = keys.length > 0;\r\n const hasAnyKeys = hasKeys || nextKeys.length > 0;\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(keys, 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 childAlternate = fibersMap[key] || null;\r\n\r\n if (childAlternate) {\r\n childAlternate.effectTag = EffectTag.DELETION;\r\n deletionsHelper.get().push(childAlternate);\r\n\r\n if (childAlternate.effectHost) {\r\n fiber.markEffectHost();\r\n }\r\n\r\n if (childAlternate.portalHost) {\r\n fiber.markPortalHost();\r\n }\r\n }\r\n }\r\n } else if (!hasKeys) {\r\n const diffCount = prevElementsCount - nextElementsCount;\r\n const childAlternates: Array = takeListFromEnd(getSiblingFibers(alternate.child), diffCount);\r\n\r\n for (const childAlternate of childAlternates) {\r\n childAlternate.effectTag = EffectTag.DELETION;\r\n\r\n if (childAlternate.effectHost) {\r\n fiber.markEffectHost();\r\n }\r\n\r\n if (childAlternate.portalHost) {\r\n fiber.markPortalHost();\r\n }\r\n }\r\n\r\n deletionsHelper.get().push(...childAlternates);\r\n }\r\n };\r\n\r\n const performInsertingNodes = () => {\r\n const diffKeys = getDiffKeys(nextKeys, keys);\r\n\r\n if (diffKeys.length > 0) {\r\n const diffKeyMap = keyBy(diffKeys, x => x);\r\n const fibersByPositionsMap = createFibersByPositionMap(alternate.child);\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 !== keys[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 = fibersByPositionsMap[keyIdx] || null;\r\n\r\n if (fiber) {\r\n insertionFiber.nextSibling = fiber;\r\n }\r\n }\r\n }\r\n\r\n keyIdx++;\r\n }\r\n }\r\n };\r\n\r\n isRemovingCase && performRemovingNodes();\r\n isInsertingCase && 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 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 (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 createFibersByPositionMap(fiber: Fiber) {\r\n let nextFiber = fiber;\r\n let position = 0;\r\n const map: Record = {};\r\n\r\n while (nextFiber) {\r\n map[position] = nextFiber;\r\n\r\n position++;\r\n nextFiber = nextFiber.nextSibling;\r\n }\r\n\r\n return map;\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 keys: 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 keys.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 keys,\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 const deletions = deletionsHelper.get();\r\n const hasEffects = Boolean(wipFiber.alternate?.effectHost);\r\n const hasPortals = Boolean(wipFiber.alternate?.portalHost);\r\n\r\n if (hasEffects || hasPortals) {\r\n for (const fiber of deletions) {\r\n fiber.portalHost && platform.unmountPortal(fiber);\r\n\r\n if (fiber.effectHost) {\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 cleanupEffects(nextFiber.hook);\r\n }\r\n },\r\n });\r\n }\r\n }\r\n }\r\n\r\n commitWork(wipFiber.child, () => {\r\n const effects = effectsHelper.get();\r\n\r\n for (const fiber of deletions) {\r\n platform.applyCommits(fiber);\r\n }\r\n\r\n deletionsHelper.set([]);\r\n wipRootHelper.set(null);\r\n\r\n setTimeout(() => {\r\n for (const effect of effects) {\r\n effect();\r\n }\r\n });\r\n\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\nfunction commitWork(fiber: Fiber, onComplete: Function) {\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.applyCommits(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 onComplete();\r\n}\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\nfunction createHook(): Hook {\r\n return {\r\n idx: 0,\r\n values: [],\r\n };\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 '../global';\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/model';\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 './model';\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 { detectIsUndefined, detectIsDepsDifferent } from '../helpers';\r\nimport { componentFiberHelper } from '../scope';\r\n\r\nfunction useCallback(callback: 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 values[idx] = {\r\n deps,\r\n value: callback,\r\n };\r\n\r\n hook.idx++;\r\n\r\n return callback;\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\r\n if (isDepsDifferent) {\r\n hookValue.deps = deps;\r\n hookValue.value = callback;\r\n }\r\n\r\n hook.idx++;\r\n\r\n return hookValue.value;\r\n}\r\n\r\nexport { useCallback };\r\n","import { type ScheduleCallbackOptions } from '../global';\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(`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('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 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 './model';\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/model';\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","deletions","fiberMount","navigation","isDeepWalking","componentFiber","effects","rootId","stores","effectStoreHelper","set","id","effectStore","getRootId","Store","storeHelper","wipRootHelper","fiber","currentRootHelper","nextUnitOfWorkHelper","componentFiberHelper","fromHookUpdateHelper","eventsHelper","deletionsHelper","fiberMountHelper","reset","getIndex","jumpToChild","nextLevel","jumpToParent","jumpToSibling","deepWalking","effectsHelper","add","effect","$$useEffect","useEffect","hook","values","runEffect","undefined","cleanup","hasEffects","some","cleanupEffects","$$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","applyCommits","detectIsPortal","unmountPortal","cloneTagMap","PLACEMENT","SKIP","nativeElement","parent","child","nextSibling","alternate","effectTag","instance","shadow","provider","transposition","mountedToHost","portalHost","effectHost","childrenCount","marker","isUsed","markPortalHost","markEffectHost","setError","catchException","workLoop","wipFiber","shouldYield","hasMoreWork","Boolean","performUnitOfWork","fromHook","hasPortals","walkFiber","onLoop","nextFiber","isReturn","stop","resetIsDeepWalking","setTimeout","onComplete","commitChanges","hasChildrenProp","performChild","performedFiber","performSibling","performPartialUpdateEffects","DELETION","getChildAlternate","getHook","Fiber","pertformInstance","mutateAlternate","mutateFiber","performMemo","performedNextFiber","performedShadow","performedInstance","childrenIdx","getNextSiblingAlternate","getElementKey","isDifferentKeys","isUpdate","getInstanceType","UPDATE","alternateType","isSameType","isSameKeys","isRemovingCase","isInsertingCase","nextKeys","nextKey","extractKeys","diffKeys","getDiffKeys","fibersMap","map","createFibersByKeyMap","childAlternate","diffCount","childAlternates","getSiblingFibers","performRemovingNodes","diffKeyMap","fibersByPositionsMap","position","createFibersByPositionMap","usedKeyMap","keyIdx","insertionFiber","performInsertingNodes","memoFiber","alternateFactory","elements","splice","getAlternateByKey","getRootShadow","mountInstance","isComponentFactory","result","err","transformElementInstance","nextKeysMap","diff","element","isStopped","visitedMap","detectCanVisit","newFiber","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","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 f4c53a4f..8d5f997b 100644 --- a/packages/platform-browser/package.json +++ b/packages/platform-browser/package.json @@ -1,6 +1,6 @@ { "name": "@dark-engine/platform-browser", - "version": "0.4.3", + "version": "0.4.4", "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",