From d799cab0201fa738d438790d221f8e9d6a8fafa0 Mon Sep 17 00:00:00 2001 From: atellmer Date: Tue, 29 Nov 2022 04:18:08 -0700 Subject: [PATCH] version upgrade --- packages/core/package.json | 2 +- packages/core/types/fiber/fiber.d.ts | 8 +++-- packages/core/types/index.d.ts | 32 ++++++++++--------- packages/core/types/scope/scope.d.ts | 11 +++++++ .../types/use-insertion-effect/index.d.ts | 1 + .../use-insertion-effect.d.ts | 6 ++++ .../types/use-sync-external-store/index.d.ts | 1 + .../use-sync-external-store.d.ts | 4 +++ packages/platform-browser/package.json | 2 +- 9 files changed, 47 insertions(+), 20 deletions(-) create mode 100644 packages/core/types/use-insertion-effect/index.d.ts create mode 100644 packages/core/types/use-insertion-effect/use-insertion-effect.d.ts create mode 100644 packages/core/types/use-sync-external-store/index.d.ts create mode 100644 packages/core/types/use-sync-external-store/use-sync-external-store.d.ts diff --git a/packages/core/package.json b/packages/core/package.json index f8bdc3db..529a23e8 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@dark-engine/core", - "version": "0.10.1", + "version": "0.11.0", "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/types/fiber/fiber.d.ts b/packages/core/types/fiber/fiber.d.ts index 9125baee..c8075b06 100644 --- a/packages/core/types/fiber/fiber.d.ts +++ b/packages/core/types/fiber/fiber.d.ts @@ -16,9 +16,10 @@ declare class Fiber { provider: Map; transposition: boolean; mountedToHost: boolean; - portalHost: boolean; effectHost: boolean; layoutEffectHost: boolean; + insertionEffectHost: boolean; + portalHost: boolean; childrenCount: number; marker: string; isUsed: boolean; @@ -26,10 +27,11 @@ declare class Fiber { batched: () => void | null; catchException: (error: Error) => void; constructor(options: Partial>); - markPortalHost(): void; + markMountedToHost(): void; markEffectHost(): void; markLayoutEffectHost(): void; - markMountedToHost(): void; + markInsertionEffectHost(): void; + markPortalHost(): void; setError(error: Error): void; } declare function workLoop(): boolean; diff --git a/packages/core/types/index.d.ts b/packages/core/types/index.d.ts index 5f8869c4..148ffe32 100644 --- a/packages/core/types/index.d.ts +++ b/packages/core/types/index.d.ts @@ -11,26 +11,28 @@ export * from './ref'; export * from './scope'; export * from './shared'; export * from './suspense'; -export * from './use-callback'; -export * from './use-context'; -export * from './use-deferred-value'; +export { useCallback } from './use-callback'; +export { useContext } from './use-context'; +export { useDeferredValue } from './use-deferred-value'; export { useEffect } from './use-effect'; -export * from './use-error'; -export * from './use-event'; -export * from './use-imperative-handle'; export { useLayoutEffect } from './use-layout-effect'; -export * from './use-memo'; -export * from './use-reducer'; -export * from './use-ref'; -export * from './use-update'; -export * from './use-state'; -export * from './use-reactive-state'; -export * from './use-id'; -export * from './view'; -export * from './constants'; +export { useInsertionEffect } from './use-insertion-effect'; +export { useError } from './use-error'; +export { useEvent } from './use-event'; +export { useImperativeHandle } from './use-imperative-handle'; +export { useMemo } from './use-memo'; +export { useReducer } from './use-reducer'; +export { useRef } from './use-ref'; +export { useUpdate } from './use-update'; +export { useState } from './use-state'; +export { useReactiveState } from './use-reactive-state'; +export { useId } from './use-id'; +export { useSyncExternalStore } from './use-sync-external-store'; export { walkFiber } from './walk'; export { unmountRoot } from './unmount'; export { batch } from './batch'; +export * from './view'; +export * from './constants'; export declare const version: string; declare global { namespace JSX { diff --git a/packages/core/types/scope/scope.d.ts b/packages/core/types/scope/scope.d.ts index f621955d..dc814de4 100644 --- a/packages/core/types/scope/scope.d.ts +++ b/packages/core/types/scope/scope.d.ts @@ -50,10 +50,19 @@ declare const layoutEffectsStore: { reset: () => any[]; add: (effect: () => void) => number; }; +declare const insertionEffectsStore: { + get: () => (() => void)[]; + reset: () => any[]; + add: (effect: () => void) => number; +}; declare const isLayoutEffectsZone: { get: () => boolean; set: (value: boolean) => boolean; }; +declare const isInsertionEffectsZone: { + get: (id?: number) => boolean; + set: (value: boolean) => boolean; +}; declare const isUpdateHookZone: { get: () => boolean; set: (value: boolean) => boolean; @@ -74,7 +83,9 @@ export { fiberMountStore, effectsStore, layoutEffectsStore, + insertionEffectsStore, isLayoutEffectsZone, + isInsertionEffectsZone, isUpdateHookZone, isBatchZone, }; diff --git a/packages/core/types/use-insertion-effect/index.d.ts b/packages/core/types/use-insertion-effect/index.d.ts new file mode 100644 index 00000000..026926b7 --- /dev/null +++ b/packages/core/types/use-insertion-effect/index.d.ts @@ -0,0 +1 @@ +export * from './use-insertion-effect'; diff --git a/packages/core/types/use-insertion-effect/use-insertion-effect.d.ts b/packages/core/types/use-insertion-effect/use-insertion-effect.d.ts new file mode 100644 index 00000000..ac99acc4 --- /dev/null +++ b/packages/core/types/use-insertion-effect/use-insertion-effect.d.ts @@ -0,0 +1,6 @@ +declare const useInsertionEffect: (effect: import('../use-effect/types').Effect, deps?: any[]) => void, + hasInsertionEffects: (fiber: import('../fiber/fiber').Fiber) => boolean, + dropInsertionEffects: ( + hook: import('..').Hook>, + ) => void; +export { useInsertionEffect, hasInsertionEffects, dropInsertionEffects }; diff --git a/packages/core/types/use-sync-external-store/index.d.ts b/packages/core/types/use-sync-external-store/index.d.ts new file mode 100644 index 00000000..c928c939 --- /dev/null +++ b/packages/core/types/use-sync-external-store/index.d.ts @@ -0,0 +1 @@ +export * from './use-sync-external-store'; diff --git a/packages/core/types/use-sync-external-store/use-sync-external-store.d.ts b/packages/core/types/use-sync-external-store/use-sync-external-store.d.ts new file mode 100644 index 00000000..841fd31f --- /dev/null +++ b/packages/core/types/use-sync-external-store/use-sync-external-store.d.ts @@ -0,0 +1,4 @@ +declare type Sunscribe = (cb: () => void) => Unsubscribe; +declare type Unsubscribe = () => void; +declare function useSyncExternalStore(subscribe: Sunscribe, getSnapshot: () => T): T; +export { useSyncExternalStore }; diff --git a/packages/platform-browser/package.json b/packages/platform-browser/package.json index 13a600e8..2c876fc3 100644 --- a/packages/platform-browser/package.json +++ b/packages/platform-browser/package.json @@ -1,6 +1,6 @@ { "name": "@dark-engine/platform-browser", - "version": "0.10.1", + "version": "0.11.0", "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",