Skip to content

Commit

Permalink
version upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
atellmer committed Dec 1, 2022
1 parent 53e03f5 commit 2e97ea9
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dark-engine/core",
"version": "0.11.2",
"version": "0.12.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",
Expand Down
5 changes: 4 additions & 1 deletion packages/core/types/context/context.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import type { Context } from './types';
declare function createContext<T>(defaultValue: T): Context<T>;
declare type CreateContextOptions = {
displayName?: string;
};
declare function createContext<T>(defaultValue: T, options?: CreateContextOptions): Context<T>;
export { createContext };
5 changes: 3 additions & 2 deletions packages/core/types/context/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Component, SlotProps } from '../component';
import type { DarkElement } from '../shared';
import type { DarkElement, Subscribe, SubscriberWithValue } from '../shared';
export declare type ContexProviderProps<T> = {
value: T;
} & SlotProps;
Expand All @@ -11,5 +11,6 @@ export declare type Context<T = unknown> = {
};
export declare type ContextProviderValue<T = unknown> = {
value: T;
subscribers: Array<(value: T) => void>;
subscribers: Set<(value: T) => void>;
subscribe: Subscribe<SubscriberWithValue<T>>;
};
4 changes: 3 additions & 1 deletion packages/core/types/helpers/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { NestedArray } from '../shared';
import type { NestedArray, DarkElementKey } from '../shared';
declare const detectIsFunction: (o: any) => o is Function;
declare const detectIsUndefined: (o: any) => o is undefined;
declare const detectIsNumber: (o: any) => o is number;
Expand All @@ -19,6 +19,7 @@ declare function keyBy<T = any>(
declare function fromEnd<T>(source: Array<T>, count: number): T[];
declare const dummyFn: () => void;
declare function detectIsDepsDifferent(deps: Array<unknown>, prevDeps: Array<unknown>): boolean;
declare function getDiffKeys(prevKeys: Array<DarkElementKey>, nextKeys: Array<DarkElementKey>): Array<DarkElementKey>;
export {
detectIsFunction,
detectIsUndefined,
Expand All @@ -36,4 +37,5 @@ export {
fromEnd,
dummyFn,
detectIsDepsDifferent,
getDiffKeys,
};
11 changes: 6 additions & 5 deletions packages/core/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
export * from './component';
export * from './context';
export { createContext } from './context';
export { h } from './element';
export * from './fiber';
export * from './fragment';
export { Fragment } from './fragment';
export * from './platform';
export * from './helpers';
export * from './lazy';
export * from './memo';
export { lazy } from './lazy';
export { memo } from './memo';
export * from './ref';
export * from './scope';
export * from './shared';
export * from './suspense';
export { Suspense } from './suspense';
export { useCallback } from './use-callback';
export { useContext } from './use-context';
export { useDeferredValue } from './use-deferred-value';
Expand All @@ -31,6 +31,7 @@ export { useSyncExternalStore } from './use-sync-external-store';
export { walkFiber } from './walk';
export { unmountRoot } from './unmount';
export { batch } from './batch';
export { SplitUpdate, useSplitUpdate } from './split-update';
export * from './view';
export * from './constants';
export declare const version: string;
Expand Down
4 changes: 4 additions & 0 deletions packages/core/types/shared/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ export declare type NestedArray<T> = T | Array<NestedArray<T>>;
export declare type RenderProps = (...args: Array<any>) => DarkElement;
export declare type DarkElementKey = string | number;
export declare type DarkElementInstance = VirtualNode | VirtualNodeFactory | ComponentFactory;
export declare type Subscriber = () => void;
export declare type SubscriberWithValue<T> = (value: T) => void;
export declare type Subscribe<S extends Function> = (subscriber: S) => Unsubscribe;
export declare type Unsubscribe = () => void;
1 change: 1 addition & 0 deletions packages/core/types/split-update/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './split-update';
16 changes: 16 additions & 0 deletions packages/core/types/split-update/split-update.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { DarkElementKey, DarkElement } from '../shared';
import { type ComponentFactory, type StandardComponentProps } from '../component';
import { type Ref } from '../ref';
declare type SplitUpdateProps<T = any> = {
list: Array<T>;
getKey: (x: T) => DarkElementKey;
slot: DarkElement;
};
declare const SplitUpdate: SplitUpdate;
declare function useSplitUpdate<T>(
selector: (map: Record<DarkElementKey, T>) => T,
detectChange: (x: T) => DarkElementKey,
): T;
declare type MergedProps<T> = SplitUpdateProps<T> & StandardComponentProps;
declare type SplitUpdate = <T>(props?: MergedProps<T>, ref?: Ref) => ComponentFactory<MergedProps<T>>;
export { SplitUpdate, useSplitUpdate };
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
declare type Subscribe = (cb: () => void) => Unsubscribe;
declare type Unsubscribe = () => void;
declare function useSyncExternalStore<T>(subscribe: Subscribe, getSnapshot: () => T): T;
import type { Subscribe, Subscriber } from '../shared';
declare function useSyncExternalStore<T>(subscribe: Subscribe<Subscriber>, getSnapshot: () => T): T;
export { useSyncExternalStore };
2 changes: 1 addition & 1 deletion packages/platform-browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dark-engine/platform-browser",
"version": "0.11.2",
"version": "0.12.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",
Expand Down

0 comments on commit 2e97ea9

Please sign in to comment.