From 540508f0fa675a5f18cc48c2c9eb0fe5aa8f4dc2 Mon Sep 17 00:00:00 2001 From: atellmer Date: Fri, 25 Nov 2022 05:47:47 -0800 Subject: [PATCH] types --- .eslintrc.json | 5 +- packages/core/.gitignore | 2 +- packages/core/before-build.js | 3 + packages/core/index.d.ts | 5 -- packages/core/package.json | 8 +- packages/core/tsconfig.json | 2 +- packages/core/yarn.lock | 81 ++++++++++++++++++- packages/platform-browser/.prettierignore | 1 + packages/platform-browser/after-build.js | 5 ++ packages/platform-browser/before-build.js | 3 + packages/platform-browser/index.d.ts | 5 -- packages/platform-browser/package.json | 13 ++- packages/platform-browser/src/index.ts | 4 +- packages/platform-browser/tsconfig.json | 9 +++ .../types/create-root/create-root.d.ts | 6 ++ .../types/create-root/index.d.ts | 1 + packages/platform-browser/types/dom/dom.d.ts | 8 ++ .../platform-browser/types/dom/index.d.ts | 2 + .../platform-browser/types/dom/types.d.ts | 5 ++ .../platform-browser/types/events/events.d.ts | 19 +++++ .../platform-browser/types/events/index.d.ts | 1 + packages/platform-browser/types/index.d.ts | 12 +++ .../platform-browser/types/portal/index.d.ts | 1 + .../platform-browser/types/portal/portal.d.ts | 22 +++++ .../platform-browser/types/render/index.d.ts | 1 + .../platform-browser/types/render/render.d.ts | 4 + .../types/scheduler/index.d.ts | 1 + .../types/scheduler/scheduler.d.ts | 4 + .../types/use-style/index.d.ts | 1 + .../types/use-style/use-style.d.ts | 5 ++ packages/platform-browser/yarn.lock | 81 ++++++++++++++++++- 31 files changed, 295 insertions(+), 25 deletions(-) create mode 100644 packages/core/before-build.js delete mode 100644 packages/core/index.d.ts create mode 100644 packages/platform-browser/.prettierignore create mode 100644 packages/platform-browser/after-build.js create mode 100644 packages/platform-browser/before-build.js delete mode 100644 packages/platform-browser/index.d.ts create mode 100644 packages/platform-browser/tsconfig.json create mode 100644 packages/platform-browser/types/create-root/create-root.d.ts create mode 100644 packages/platform-browser/types/create-root/index.d.ts create mode 100644 packages/platform-browser/types/dom/dom.d.ts create mode 100644 packages/platform-browser/types/dom/index.d.ts create mode 100644 packages/platform-browser/types/dom/types.d.ts create mode 100644 packages/platform-browser/types/events/events.d.ts create mode 100644 packages/platform-browser/types/events/index.d.ts create mode 100644 packages/platform-browser/types/index.d.ts create mode 100644 packages/platform-browser/types/portal/index.d.ts create mode 100644 packages/platform-browser/types/portal/portal.d.ts create mode 100644 packages/platform-browser/types/render/index.d.ts create mode 100644 packages/platform-browser/types/render/render.d.ts create mode 100644 packages/platform-browser/types/scheduler/index.d.ts create mode 100644 packages/platform-browser/types/scheduler/scheduler.d.ts create mode 100644 packages/platform-browser/types/use-style/index.d.ts create mode 100644 packages/platform-browser/types/use-style/use-style.d.ts diff --git a/.eslintrc.json b/.eslintrc.json index 70076c83..52cf2c77 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -93,6 +93,9 @@ ], "@typescript-eslint/no-var-requires": [ "off" + ], + "@typescript-eslint/no-empty-interface": [ + "off" ] } -} \ No newline at end of file +} diff --git a/packages/core/.gitignore b/packages/core/.gitignore index 1beeb3ed..c726a91a 100644 --- a/packages/core/.gitignore +++ b/packages/core/.gitignore @@ -5,4 +5,4 @@ npm-debug.log .DS_Store Thumbs.db yarn-error.log -/umd + diff --git a/packages/core/before-build.js b/packages/core/before-build.js new file mode 100644 index 00000000..d9665f29 --- /dev/null +++ b/packages/core/before-build.js @@ -0,0 +1,3 @@ +const shell = require('shelljs'); + +shell.rm('-rf', 'types/*'); diff --git a/packages/core/index.d.ts b/packages/core/index.d.ts deleted file mode 100644 index 9b1510dc..00000000 --- a/packages/core/index.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import * as core from './src'; - -declare module '@dark-engine/core' {} - -export = core; diff --git a/packages/core/package.json b/packages/core/package.json index 289a918d..76dda3d3 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,17 +1,18 @@ { "name": "@dark-engine/core", - "version": "0.9.7", + "version": "0.9.7-beta.1", "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", "main": "./index.js", "typings": "./types/index.d.ts", "scripts": { - "build": "npm run build:types && npm run build:dev && npm run build:prod && npm run format", + "build": "npm run before-build && npm run build:types && npm run build:dev && npm run build:prod && npm run format", "build:dev": "webpack --config webpack.config --env development", "build:prod": "webpack --config webpack.config --env production", "build:types": "npx tsc -d --emitDeclarationOnly --skipLibCheck --declarationDir types", - "format": "npx prettier --write ./**/*.{js,ts}" + "format": "npx prettier --write ./**/*.{js,ts}", + "before-build": "node ./before-build.js" }, "repository": { "type": "git", @@ -27,6 +28,7 @@ ], "devDependencies": { "@types/requestidlecallback": "^0.3.1", + "shelljs": "^0.8.5", "ts-loader": "9.3.1", "typescript": "4.7.4", "webpack": "5.73.0", diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index 5c4cba79..407a5f7d 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -7,6 +7,6 @@ "./**/*.ts" ], "exclude": [ - "src/**/*.spec.ts" + "./**/*.spec.ts" ] } \ No newline at end of file diff --git a/packages/core/yarn.lock b/packages/core/yarn.lock index 7a4fd7df..78b52d81 100644 --- a/packages/core/yarn.lock +++ b/packages/core/yarn.lock @@ -229,6 +229,17 @@ ansi-styles@^4.1.0: dependencies: color-convert "^2.0.1" +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + braces@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" @@ -293,6 +304,10 @@ commander@^7.0.0: version "7.2.0" resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7" +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -374,6 +389,10 @@ find-up@^4.0.0: locate-path "^5.0.0" path-exists "^4.0.0" +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" @@ -382,6 +401,17 @@ glob-to-regexp@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" +glob@^7.0.0: + version "7.2.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.1.1" + once "^1.3.0" + path-is-absolute "^1.0.0" + graceful-fs@^4.1.2, graceful-fs@^4.2.4, graceful-fs@^4.2.9: version "4.2.10" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" @@ -403,6 +433,21 @@ import-local@^3.0.2: pkg-dir "^4.2.0" resolve-cwd "^3.0.0" +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + +interpret@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" + interpret@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-2.2.0.tgz#1a78a0b5965c40a5416d007ad6f50ad27c417df9" @@ -488,6 +533,12 @@ mime-types@^2.1.27: dependencies: mime-db "1.52.0" +minimatch@^3.1.1: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + dependencies: + brace-expansion "^1.1.7" + neo-async@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" @@ -496,6 +547,12 @@ node-releases@^2.0.5: version "2.0.6" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.6.tgz#8a7088c63a55e493845683ebf3c828d8c51c5503" +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + dependencies: + wrappy "1" + p-limit@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -516,6 +573,10 @@ path-exists@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" @@ -548,6 +609,12 @@ randombytes@^2.1.0: dependencies: safe-buffer "^5.1.0" +rechoir@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + dependencies: + resolve "^1.1.6" + rechoir@^0.7.0: version "0.7.1" resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.7.1.tgz#9478a96a1ca135b5e88fc027f03ee92d6c645686" @@ -564,7 +631,7 @@ resolve-from@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" -resolve@^1.9.0: +resolve@^1.1.6, resolve@^1.9.0: version "1.22.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" dependencies: @@ -612,6 +679,14 @@ shebang-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" +shelljs@^0.8.5: + version "0.8.5" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c" + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" + source-map-support@~0.5.20: version "0.5.21" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" @@ -768,6 +843,10 @@ wildcard@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec" +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + yallist@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" diff --git a/packages/platform-browser/.prettierignore b/packages/platform-browser/.prettierignore new file mode 100644 index 00000000..e890a457 --- /dev/null +++ b/packages/platform-browser/.prettierignore @@ -0,0 +1 @@ +/umd \ No newline at end of file diff --git a/packages/platform-browser/after-build.js b/packages/platform-browser/after-build.js new file mode 100644 index 00000000..8d397d2a --- /dev/null +++ b/packages/platform-browser/after-build.js @@ -0,0 +1,5 @@ +const shell = require('shelljs'); + +shell.rm('-rf', 'types/core'); +shell.cp('-R', ' types/platform-browser/src/*', 'types'); +shell.rm('-rf', ' types/platform-browser'); diff --git a/packages/platform-browser/before-build.js b/packages/platform-browser/before-build.js new file mode 100644 index 00000000..d9665f29 --- /dev/null +++ b/packages/platform-browser/before-build.js @@ -0,0 +1,3 @@ +const shell = require('shelljs'); + +shell.rm('-rf', 'types/*'); diff --git a/packages/platform-browser/index.d.ts b/packages/platform-browser/index.d.ts deleted file mode 100644 index c57f9c04..00000000 --- a/packages/platform-browser/index.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import * as platformBrowser from './src'; - -declare module '@dark-engine/platform-browser' {} - -export = platformBrowser; diff --git a/packages/platform-browser/package.json b/packages/platform-browser/package.json index 619eef10..aa58a829 100644 --- a/packages/platform-browser/package.json +++ b/packages/platform-browser/package.json @@ -1,15 +1,19 @@ { "name": "@dark-engine/platform-browser", - "version": "0.9.7", + "version": "0.9.7-beta.1", "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", "main": "./index.js", - "typings": "./index.d.ts", + "typings": "./types/index.d.ts", "scripts": { - "build": "npm run build:dev && npm run build:prod", + "build": "npm run before-build && npm run build:types && npm run build:dev && npm run build:prod && npm run format && npm run after-build", "build:dev": "webpack --config webpack.config --env development", - "build:prod": "webpack --config webpack.config --env production" + "build:prod": "webpack --config webpack.config --env production", + "build:types": "npx tsc -d --emitDeclarationOnly --skipLibCheck --declarationDir types", + "format": "npx prettier --write ./**/*.{js,ts}", + "after-build": "node ./after-build.js", + "before-build": "node ./before-build.js" }, "repository": { "type": "git", @@ -25,6 +29,7 @@ ], "devDependencies": { "@types/requestidlecallback": "^0.3.1", + "shelljs": "^0.8.5", "ts-loader": "9.3.1", "typescript": "4.7.4", "webpack": "5.73.0", diff --git a/packages/platform-browser/src/index.ts b/packages/platform-browser/src/index.ts index 35198565..ec650407 100644 --- a/packages/platform-browser/src/index.ts +++ b/packages/platform-browser/src/index.ts @@ -10,8 +10,6 @@ export const version = process.env.VERSION; declare global { namespace JSX { - interface IntrinsicElements { - [elemName: string]: Record; - } + interface IntrinsicElements {} } } diff --git a/packages/platform-browser/tsconfig.json b/packages/platform-browser/tsconfig.json new file mode 100644 index 00000000..47432b87 --- /dev/null +++ b/packages/platform-browser/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig", + "include": [ + "./**/*.ts" + ], + "exclude": [ + "./**/*.spec.ts" + ] +} \ No newline at end of file diff --git a/packages/platform-browser/types/create-root/create-root.d.ts b/packages/platform-browser/types/create-root/create-root.d.ts new file mode 100644 index 00000000..1cee185a --- /dev/null +++ b/packages/platform-browser/types/create-root/create-root.d.ts @@ -0,0 +1,6 @@ +import { type DarkElement } from '@dark-engine/core'; +declare function createRoot(container: Element): { + render: (element: DarkElement) => void; + unmount: () => void; +}; +export { createRoot }; diff --git a/packages/platform-browser/types/create-root/index.d.ts b/packages/platform-browser/types/create-root/index.d.ts new file mode 100644 index 00000000..d6d60476 --- /dev/null +++ b/packages/platform-browser/types/create-root/index.d.ts @@ -0,0 +1 @@ +export * from './create-root'; diff --git a/packages/platform-browser/types/dom/dom.d.ts b/packages/platform-browser/types/dom/dom.d.ts new file mode 100644 index 00000000..66980d5f --- /dev/null +++ b/packages/platform-browser/types/dom/dom.d.ts @@ -0,0 +1,8 @@ +import { type Fiber, type VirtualNode } from '@dark-engine/core'; +import type { DOMElement } from './types'; +declare let trackUpdate: (nativeElement: Element) => void; +declare function createNativeElement(vNode: VirtualNode): DOMElement; +declare function applyCommit(fiber: Fiber): void; +declare function finishCommitWork(): void; +declare function setTrackUpdate(fn: typeof trackUpdate): void; +export { createNativeElement, applyCommit, finishCommitWork, setTrackUpdate }; diff --git a/packages/platform-browser/types/dom/index.d.ts b/packages/platform-browser/types/dom/index.d.ts new file mode 100644 index 00000000..49129d75 --- /dev/null +++ b/packages/platform-browser/types/dom/index.d.ts @@ -0,0 +1,2 @@ +export * from './dom'; +export * from './types'; diff --git a/packages/platform-browser/types/dom/types.d.ts b/packages/platform-browser/types/dom/types.d.ts new file mode 100644 index 00000000..79c71539 --- /dev/null +++ b/packages/platform-browser/types/dom/types.d.ts @@ -0,0 +1,5 @@ +export declare type DOMElement = HTMLElement | SVGElement | Text | Comment; +export declare type DOMFragment = { + fragment: DocumentFragment; + callback: () => void; +}; diff --git a/packages/platform-browser/types/events/events.d.ts b/packages/platform-browser/types/events/events.d.ts new file mode 100644 index 00000000..92feb09a --- /dev/null +++ b/packages/platform-browser/types/events/events.d.ts @@ -0,0 +1,19 @@ +declare class SyntheticEvent { + type: string; + sourceEvent: E; + target: T; + private propagation; + constructor(options: Pick, 'sourceEvent' | 'target'>); + stopPropagation(): void; + preventDefault(): void; + getPropagation(): boolean; +} +declare type DelegateEventOptions = { + target: Element; + eventName: string; + handler: (e: Event) => void; +}; +declare function delegateEvent(options: DelegateEventOptions): void; +declare const detectIsEvent: (attrName: string) => boolean; +declare const getEventName: (attrName: string) => string; +export { SyntheticEvent, delegateEvent, detectIsEvent, getEventName }; diff --git a/packages/platform-browser/types/events/index.d.ts b/packages/platform-browser/types/events/index.d.ts new file mode 100644 index 00000000..7981d6b6 --- /dev/null +++ b/packages/platform-browser/types/events/index.d.ts @@ -0,0 +1 @@ +export * from './events'; diff --git a/packages/platform-browser/types/index.d.ts b/packages/platform-browser/types/index.d.ts new file mode 100644 index 00000000..ee2a754c --- /dev/null +++ b/packages/platform-browser/types/index.d.ts @@ -0,0 +1,12 @@ +export { render } from './render'; +export { createRoot } from './create-root'; +export { createPortal } from './portal'; +export { useStyle } from './use-style'; +export { setTrackUpdate } from './dom'; +export type { SyntheticEvent } from './events'; +export declare const version: string; +declare global { + namespace JSX { + interface IntrinsicElements {} + } +} diff --git a/packages/platform-browser/types/portal/index.d.ts b/packages/platform-browser/types/portal/index.d.ts new file mode 100644 index 00000000..de221ac5 --- /dev/null +++ b/packages/platform-browser/types/portal/index.d.ts @@ -0,0 +1 @@ +export * from './portal'; diff --git a/packages/platform-browser/types/portal/portal.d.ts b/packages/platform-browser/types/portal/portal.d.ts new file mode 100644 index 00000000..e9401bb5 --- /dev/null +++ b/packages/platform-browser/types/portal/portal.d.ts @@ -0,0 +1,22 @@ +import { type Fiber, type DarkElement, type ComponentFactory } from '@dark-engine/core'; +declare const $$portal: unique symbol; +declare function createPortal( + slot: DarkElement, + container: Element, +): ComponentFactory< + PortalProps & + import('@dark-engine/core').KeyProps & + Readonly<{ + slot?: DarkElement; + }> & + import('@dark-engine/core').RefProps, + any +>; +declare type PortalProps = { + [$$portal]: Element; + slot: DarkElement; +}; +declare const detectIsPortal: (factory: unknown) => factory is ComponentFactory; +declare const getPortalContainer: (factory: unknown) => Element | null; +declare function unmountPortal(fiber: Fiber): void; +export { createPortal, detectIsPortal, getPortalContainer, unmountPortal }; diff --git a/packages/platform-browser/types/render/index.d.ts b/packages/platform-browser/types/render/index.d.ts new file mode 100644 index 00000000..dc70a4da --- /dev/null +++ b/packages/platform-browser/types/render/index.d.ts @@ -0,0 +1 @@ +export * from './render'; diff --git a/packages/platform-browser/types/render/render.d.ts b/packages/platform-browser/types/render/render.d.ts new file mode 100644 index 00000000..a077c99a --- /dev/null +++ b/packages/platform-browser/types/render/render.d.ts @@ -0,0 +1,4 @@ +import { type DarkElement } from '@dark-engine/core'; +declare const roots: Map; +declare function render(element: DarkElement, container: Element): void; +export { render, roots }; diff --git a/packages/platform-browser/types/scheduler/index.d.ts b/packages/platform-browser/types/scheduler/index.d.ts new file mode 100644 index 00000000..3521c5c0 --- /dev/null +++ b/packages/platform-browser/types/scheduler/index.d.ts @@ -0,0 +1 @@ +export * from './scheduler'; diff --git a/packages/platform-browser/types/scheduler/scheduler.d.ts b/packages/platform-browser/types/scheduler/scheduler.d.ts new file mode 100644 index 00000000..7f3c7394 --- /dev/null +++ b/packages/platform-browser/types/scheduler/scheduler.d.ts @@ -0,0 +1,4 @@ +import { type ScheduleCallbackOptions } from '@dark-engine/core'; +declare const shouldYeildToHost: () => boolean; +declare function scheduleCallback(callback: () => void, options?: ScheduleCallbackOptions): void; +export { shouldYeildToHost, scheduleCallback }; diff --git a/packages/platform-browser/types/use-style/index.d.ts b/packages/platform-browser/types/use-style/index.d.ts new file mode 100644 index 00000000..bd29dbee --- /dev/null +++ b/packages/platform-browser/types/use-style/index.d.ts @@ -0,0 +1 @@ +export * from './use-style'; diff --git a/packages/platform-browser/types/use-style/use-style.d.ts b/packages/platform-browser/types/use-style/use-style.d.ts new file mode 100644 index 00000000..8663d1a7 --- /dev/null +++ b/packages/platform-browser/types/use-style/use-style.d.ts @@ -0,0 +1,5 @@ +declare function styled(strings: TemplateStringsArray, ...args: Array): string; +declare type Style = Record; +declare type Config = (x: typeof styled) => T; +declare function useStyle(config: Config): T; +export { useStyle }; diff --git a/packages/platform-browser/yarn.lock b/packages/platform-browser/yarn.lock index 7a4fd7df..78b52d81 100644 --- a/packages/platform-browser/yarn.lock +++ b/packages/platform-browser/yarn.lock @@ -229,6 +229,17 @@ ansi-styles@^4.1.0: dependencies: color-convert "^2.0.1" +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + braces@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" @@ -293,6 +304,10 @@ commander@^7.0.0: version "7.2.0" resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7" +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -374,6 +389,10 @@ find-up@^4.0.0: locate-path "^5.0.0" path-exists "^4.0.0" +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" @@ -382,6 +401,17 @@ glob-to-regexp@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" +glob@^7.0.0: + version "7.2.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.1.1" + once "^1.3.0" + path-is-absolute "^1.0.0" + graceful-fs@^4.1.2, graceful-fs@^4.2.4, graceful-fs@^4.2.9: version "4.2.10" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" @@ -403,6 +433,21 @@ import-local@^3.0.2: pkg-dir "^4.2.0" resolve-cwd "^3.0.0" +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + +interpret@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" + interpret@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-2.2.0.tgz#1a78a0b5965c40a5416d007ad6f50ad27c417df9" @@ -488,6 +533,12 @@ mime-types@^2.1.27: dependencies: mime-db "1.52.0" +minimatch@^3.1.1: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + dependencies: + brace-expansion "^1.1.7" + neo-async@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" @@ -496,6 +547,12 @@ node-releases@^2.0.5: version "2.0.6" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.6.tgz#8a7088c63a55e493845683ebf3c828d8c51c5503" +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + dependencies: + wrappy "1" + p-limit@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -516,6 +573,10 @@ path-exists@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" @@ -548,6 +609,12 @@ randombytes@^2.1.0: dependencies: safe-buffer "^5.1.0" +rechoir@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + dependencies: + resolve "^1.1.6" + rechoir@^0.7.0: version "0.7.1" resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.7.1.tgz#9478a96a1ca135b5e88fc027f03ee92d6c645686" @@ -564,7 +631,7 @@ resolve-from@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" -resolve@^1.9.0: +resolve@^1.1.6, resolve@^1.9.0: version "1.22.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" dependencies: @@ -612,6 +679,14 @@ shebang-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" +shelljs@^0.8.5: + version "0.8.5" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c" + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" + source-map-support@~0.5.20: version "0.5.21" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" @@ -768,6 +843,10 @@ wildcard@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec" +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + yallist@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"