├── .gitignore ├── .import ├── .gdignore ├── icon.png-487276ed1e3a0c39cad0279d744ee560.md5 └── icon.png-487276ed1e3a0c39cad0279d744ee560.stex ├── .vscode └── settings.json ├── LICENSE ├── Main.tscn ├── README.md ├── default_env.tres ├── docs └── play.gif ├── export_presets.cfg ├── icon.png ├── icon.png.import ├── project.godot ├── scenes └── .gitkeep ├── shared └── .gitkeep └── source ├── .gdignore ├── build.config.json ├── build.js ├── package.json ├── pnpm-lock.yaml ├── src ├── declares │ ├── godot.d.ts │ ├── webapi.d.ts │ ├── webapi.event.d.ts │ ├── webapi.misc.d.ts │ ├── webapi.performance.d.ts │ ├── webapi.storage.d.ts │ ├── webapi.timer.d.ts │ └── webapi.xhr.d.ts ├── decorators.ts ├── main.tsx ├── thirdpart.ts └── webapi │ ├── animationframe.ts │ ├── event.ts │ ├── index.common.ts │ ├── index.godot.tsx │ ├── misc.godot.ts │ ├── performance.ts │ ├── storage.godot.ts │ ├── storage.ts │ ├── timer.ts │ ├── websocket.ts │ └── xhr │ ├── thirdpart │ ├── mimetype │ │ ├── mime-type.js │ │ ├── parser.js │ │ ├── serializer.js │ │ └── utils.js │ ├── querystring │ │ └── querystring.js │ └── url-parser │ │ ├── querystringify.js │ │ ├── requires-port.js │ │ └── url-parser.js │ ├── url.ts │ ├── xhr.common.ts │ └── xhr.godot.ts └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | *.jsx 2 | *.meta 3 | node_modules 4 | release 5 | scripts -------------------------------------------------------------------------------- /.import/.gdignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5: -------------------------------------------------------------------------------- 1 | source_md5="47313fa4c47a9963fddd764e1ec6e4a8" 2 | dest_md5="26ea799ea0a3da9e753b3ebe822e0570" 3 | 4 | -------------------------------------------------------------------------------- /.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/citizenll/godot-typescript-starter/974d5ef3e83c3eb1edb6154fdfc57a5d80cb1907/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": [ 3 | "filesize", 4 | "gdclass", 5 | "MASTERSYNC", 6 | "onready", 7 | "outfile", 8 | "picocolors", 9 | "puppetsync", 10 | "remotesync", 11 | "runable", 12 | "thirdpart" 13 | ] 14 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 citizenl 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Main.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=2] 2 | 3 | [ext_resource path="res://icon.png" type="Texture" id=1] 4 | [ext_resource path="res://scripts/main.jsx" type="Script" id=2] 5 | 6 | [node name="Node2D" type="Node2D"] 7 | script = ExtResource( 2 ) 8 | "label " = NodePath("Label") 9 | "icon " = NodePath("Icon") 10 | 11 | [node name="Icon" type="Sprite" parent="."] 12 | position = Vector2( 512, 288 ) 13 | texture = ExtResource( 1 ) 14 | 15 | [node name="Label" type="Label" parent="."] 16 | margin_right = 512.0 17 | margin_bottom = 48.0 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Godot typescript start template 2 | 3 |

4 | 5 |

6 | 7 | ## Features 8 | 9 | * 🦾 TypeScript, of course [`JsBinding` for godot](https://github.com/Geequlim/ECMAScript) 10 | * 🔥 Use the [new `3.5.stable` version](https://godotengine.org/download) 11 | * ⚡️ [ESBuild](https://github.com/evanw/esbuild) fastify to build,support use npm packages 12 | * 🌍 [Web API support for godot](https://github.com/Geequlim/WebAPI) 13 | + WindowOrWorkerGlobalScope 14 | - websocket 15 | - setTimeout 16 | - clearTimeout 17 | - setInterval 18 | - clearInterval 19 | - btoa 20 | - atob 21 | - performance 22 | - localStorage 23 | - sessionStorage 24 | 25 | + Performance API 26 | + Storage API 27 | + Event 28 | + EventTarget 29 | + XMLHttpRequest 30 | 31 | ## Usage 32 | 33 | + `cd source` && `pnpm i` *npm or yarn* 34 | + `npm run dev` Happy coding with typescript! 35 | 36 | * When I created this template, I used the 16+ version, maybe more than 13+ (type:module) 37 | 38 | ## Download 39 | 40 | - Go to the actions to download compiled editor and template 41 | + [windows](https://github.com/citizenll/ECMAScript/actions/runs/3030483096) 42 | + [macos](https://github.com/citizenll/ECMAScript/actions/runs/3030483092) 43 | -------------------------------------------------------------------------------- /default_env.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Environment" load_steps=2 format=2] 2 | 3 | [sub_resource type="ProceduralSky" id=1] 4 | 5 | [resource] 6 | background_mode = 2 7 | background_sky = SubResource( 1 ) 8 | -------------------------------------------------------------------------------- /docs/play.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/citizenll/godot-typescript-starter/974d5ef3e83c3eb1edb6154fdfc57a5d80cb1907/docs/play.gif -------------------------------------------------------------------------------- /export_presets.cfg: -------------------------------------------------------------------------------- 1 | [preset.0] 2 | 3 | name="Windows Desktop" 4 | platform="Windows Desktop" 5 | runnable=true 6 | custom_features="" 7 | export_filter="all_resources" 8 | include_filter="" 9 | exclude_filter="source/*" 10 | export_path="release/godot-typescript-starter.exe" 11 | script_export_mode=1 12 | script_encryption_key="" 13 | 14 | [preset.0.options] 15 | 16 | custom_template/debug="" 17 | custom_template/release="D:/Godot/release/godot.windows.opt.64.exe" 18 | binary_format/64_bits=true 19 | binary_format/embed_pck=false 20 | texture_format/bptc=false 21 | texture_format/s3tc=true 22 | texture_format/etc=false 23 | texture_format/etc2=false 24 | texture_format/no_bptc_fallbacks=true 25 | codesign/enable=false 26 | codesign/identity_type=0 27 | codesign/identity="" 28 | codesign/password="" 29 | codesign/timestamp=true 30 | codesign/timestamp_server_url="" 31 | codesign/digest_algorithm=1 32 | codesign/description="" 33 | codesign/custom_options=PoolStringArray( ) 34 | application/modify_resources=true 35 | application/icon="" 36 | application/file_version="" 37 | application/product_version="" 38 | application/company_name="" 39 | application/product_name="" 40 | application/file_description="" 41 | application/copyright="" 42 | application/trademarks="" 43 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/citizenll/godot-typescript-starter/974d5ef3e83c3eb1edb6154fdfc57a5d80cb1907/icon.png -------------------------------------------------------------------------------- /icon.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://icon.png" 13 | dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | process/normal_map_invert_y=false 32 | stream=false 33 | size_limit=0 34 | detect_3d=true 35 | svg/scale=1.0 36 | -------------------------------------------------------------------------------- /project.godot: -------------------------------------------------------------------------------- 1 | ; Engine configuration file. 2 | ; It's best edited using the editor UI and not directly, 3 | ; since the parameters that go here are not all obvious. 4 | ; 5 | ; Format: 6 | ; [section] ; section goes between [] 7 | ; param=value ; assign values to parameters 8 | 9 | config_version=4 10 | 11 | [application] 12 | 13 | config/name="godot-typescript-starter" 14 | run/main_scene="res://Main.tscn" 15 | config/icon="res://icon.png" 16 | 17 | [autoload] 18 | 19 | WebAPI="*res://scripts/webapi/index.godot.jsx" 20 | 21 | [gui] 22 | 23 | common/drop_mouse_on_gui_input_disabled=true 24 | 25 | [physics] 26 | 27 | common/enable_pause_aware_picking=true 28 | 29 | [rendering] 30 | 31 | environment/default_environment="res://default_env.tres" 32 | -------------------------------------------------------------------------------- /scenes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/citizenll/godot-typescript-starter/974d5ef3e83c3eb1edb6154fdfc57a5d80cb1907/scenes/.gitkeep -------------------------------------------------------------------------------- /shared/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/citizenll/godot-typescript-starter/974d5ef3e83c3eb1edb6154fdfc57a5d80cb1907/shared/.gitkeep -------------------------------------------------------------------------------- /source/.gdignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/citizenll/godot-typescript-starter/974d5ef3e83c3eb1edb6154fdfc57a5d80cb1907/source/.gdignore -------------------------------------------------------------------------------- /source/build.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "output":"../scripts", 3 | "cacheDir":"node_modules/.godot", 4 | "bundles": [ 5 | "src/thirdpart.ts" 6 | ], 7 | "compile_pattern": [ 8 | "src/decorators.ts", 9 | "src/**/*.tsx", 10 | "src/**/*.ts", 11 | "src/**/*.js", 12 | "src/**/*.jsx" 13 | ] 14 | } -------------------------------------------------------------------------------- /source/build.js: -------------------------------------------------------------------------------- 1 | import chokidar from 'chokidar'; 2 | import path from 'path'; 3 | import fs from 'fs'; 4 | import { fileURLToPath } from 'url'; 5 | import esbuild from 'esbuild'; 6 | import colors from 'colors'; 7 | import filesize from 'filesize'; 8 | import glob from 'fast-glob'; 9 | import readline from 'readline' 10 | import { createHash } from 'node:crypto' 11 | 12 | const scripts = JSON.parse(fs.readFileSync('./build.config.json', 'utf-8')) 13 | const __filename = fileURLToPath(import.meta.url); 14 | const __dirname = path.dirname(__filename); 15 | const production = process.argv.length == 3 && process.argv[2] == '--release'; 16 | 17 | const options = { 18 | sourceRoot: 'src', 19 | outRoot: path.resolve(__dirname, scripts.output), 20 | tsconfig: 'tsconfig.json', 21 | } 22 | let cachedDepOptimizationMetadata 23 | 24 | function normalize_path(path) { 25 | return path.replace(/\\/g, '/'); 26 | } 27 | 28 | function update_entries() { 29 | let patterns = scripts.bundles || []; 30 | scripts.bundles = []; 31 | for (const p of patterns) { 32 | const inputs = glob.sync(p); 33 | scripts.bundles = scripts.bundles.concat(inputs); 34 | } 35 | patterns = scripts.compile_pattern || []; 36 | scripts.compile_only = []; 37 | for (const p of patterns) { 38 | const inputs = glob.sync(p).filter(file => !file.endsWith('.d.ts')); 39 | scripts.compile_only = scripts.compile_only.concat(inputs); 40 | } 41 | scripts.compile_only = Array.from(new Set(scripts.compile_only)); 42 | } 43 | 44 | function clean() { 45 | fs.rmSync(options.outRoot, { recursive: true }); 46 | } 47 | 48 | function watch() { 49 | update_entries(); 50 | let compileCount = 0, startTime = Date.now(); 51 | let compiled = false, totalCount = scripts.compile_only.length; 52 | 53 | const compileCheck = () => { 54 | compileCount++; 55 | if (!compiled && compileCount >= totalCount) { 56 | clearScreen(); 57 | compiled = true; 58 | console.log(colors.green(`Compiled finished `), colors.grey(`[${Date.now() - startTime}ms]`)); 59 | } 60 | } 61 | chokidar.watch(options.sourceRoot).on('all', (event, input) => { 62 | let unlink = event == 'unlink' || event == 'unlinkDir'; 63 | if (unlink) { 64 | 65 | let isDir = event == 'unlinkDir' 66 | let target = isDir ? normalize_path(path.join(options.outRoot, input)) : get_build_target(input); 67 | if (!target) return 68 | target = target.replace('src/', '') 69 | if (!isDir) { 70 | let parse = path.parse(target); 71 | let prefix = target.replace(parse.base, ''); 72 | let isJs = parse.ext == '.js'; 73 | [`.js${isJs ? '' : ''}`, `.js${isJs ? '' : ''}.map`].map(s => `${prefix}${parse.name}${s}`).forEach((file) => { 74 | fs.rmSync(file, { recursive: true, force: true }); 75 | console.log(colors.grey("unlink"), colors.grey(`${file}`)); 76 | }) 77 | } else { 78 | if (!fs.existsSync(target)) return 79 | fs.rmSync(target, { recursive: true, force: true }); 80 | console.log(colors.grey("unlink"), colors.grey(`${target}`)); 81 | } 82 | update_entries(); 83 | return 84 | } 85 | if (!fs.existsSync(input) || !fs.statSync(input).isFile()) return; 86 | input = normalize_path(input); 87 | let output = null; 88 | switch (event) { 89 | case 'add': 90 | update_entries(); 91 | output = get_build_target(input); 92 | break 93 | case 'change': 94 | output = get_build_target(input); 95 | break; 96 | } 97 | let text = fs.readFileSync(input, 'utf-8'); 98 | let hash = getHash(text), dstHash; 99 | if (cachedDepOptimizationMetadata.depInfoMap.get(input)) { 100 | dstHash = cachedDepOptimizationMetadata.depInfoMap.get(input); 101 | if (hash == dstHash) { 102 | return compileCheck() 103 | } 104 | } 105 | dstHash = hash 106 | if (output) { 107 | build_entry(input, output, compiled); 108 | addOptimizedDepInfo(cachedDepOptimizationMetadata, 'optimized', { file: input, fileHash: dstHash }) 109 | compileCheck() 110 | } 111 | debounceWriteCatch() 112 | }); 113 | } 114 | 115 | function get_build_target(input) { 116 | const matches = input.match(/(\.d)?(\.[t|j]sx?)/); 117 | if (!matches) return; 118 | 119 | if (matches[0] === '.d.ts') return; 120 | let normalized = normalize_path(input) 121 | if (scripts.bundles.indexOf(normalized) == -1 && scripts.compile_only.indexOf(normalized) == -1) return; 122 | 123 | const target = path.join(options.outRoot, input).replace('.ts', '.js'); 124 | return normalize_path(target); 125 | } 126 | 127 | function entry_is_bundle(input) { 128 | return scripts.bundles.indexOf(input) != -1; 129 | } 130 | async function build_entry(input, output, update = false) { 131 | const start = Date.now(); 132 | const outfile = output.replace('src/', '') 133 | try { 134 | esbuild.buildSync({ 135 | minify: production, 136 | entryPoints: [input], 137 | outfile,//remove src dir 138 | target: 'esnext', 139 | format: 'esm', 140 | tsconfig: options.tsconfig, 141 | sourcemap: true, 142 | bundle: entry_is_bundle(input) 143 | }); 144 | 145 | let time = new Date().toLocaleTimeString(); 146 | console.log(colors.grey(time), colors.green(`[${Date.now() - start}ms]`), colors.grey(`${update ? 'Update' : 'Build'} ${input}`), colors.grey(filesize(fs.statSync(outfile).size))); 147 | } catch (error) { 148 | } 149 | } 150 | 151 | function clearScreen() { 152 | readline.cursorTo(process.stdout, 0, 0) 153 | readline.clearScreenDown(process.stdout) 154 | } 155 | 156 | export function getHash(text) { 157 | return createHash('sha256').update(text).digest('hex').substring(0, 8) 158 | } 159 | 160 | function addOptimizedDepInfo(metadata, type, depInfo) { 161 | metadata[type].push(depInfo); 162 | metadata.depInfoMap.set(depInfo.file, depInfo.fileHash) 163 | return depInfo 164 | } 165 | 166 | function initDepsOptimizerMetadata() { 167 | return { 168 | optimized: [],//{file:str,fileHash:str} 169 | depInfoMap: new Map, 170 | chunks: {}, 171 | } 172 | } 173 | 174 | function loadCachedDepOptimizationMetadata() { 175 | let cachedMetadata = initDepsOptimizerMetadata() 176 | const cachedMetadataPath = path.join(scripts.cacheDir, '_metadata.json') 177 | if (fs.existsSync(cachedMetadataPath)) { 178 | cachedMetadata = JSON.parse(fs.readFileSync(cachedMetadataPath, 'utf-8')); 179 | cachedMetadata.depInfoMap = new Map; 180 | cachedMetadata.optimized.forEach(item => { 181 | cachedMetadata.depInfoMap.set(item.file, item.fileHash) 182 | }) 183 | } 184 | return cachedMetadata 185 | } 186 | function check_output_dir() { 187 | if (!fs.existsSync(options.outRoot)) { 188 | fs.mkdirSync(options.outRoot); 189 | //remove cached when scripts dir not exist 190 | let processingCacheDir = path.normalize(scripts.cacheDir); 191 | emptyDir(processingCacheDir) 192 | } 193 | } 194 | export function emptyDir(dir, skip) { 195 | for (const file of fs.readdirSync(dir)) { 196 | if (skip && skip?.includes(file)) { 197 | continue 198 | } 199 | fs.rmSync(path.resolve(dir, file), { recursive: true, force: true }) 200 | } 201 | } 202 | 203 | function runOptimizer() { 204 | let processingCacheDir = path.normalize(scripts.cacheDir); 205 | if (!fs.existsSync(processingCacheDir)) { 206 | clean() 207 | fs.mkdirSync(processingCacheDir, { recursive: true }) 208 | } 209 | cachedDepOptimizationMetadata = loadCachedDepOptimizationMetadata(); 210 | } 211 | export function writeFile( 212 | filename, 213 | content 214 | ) { 215 | const dir = path.dirname(filename) 216 | if (!fs.existsSync(dir)) { 217 | fs.mkdirSync(dir, { recursive: true }) 218 | } 219 | fs.writeFileSync(filename, content) 220 | } 221 | function debounce(fn, timeout = 1000) { 222 | let timer; 223 | return () => { 224 | if (timer) clearTimeout(timer) 225 | setTimeout(() => { 226 | fn(); timer = void 0; 227 | }, timeout) 228 | } 229 | } 230 | const debounceWriteCatch = debounce(() => { 231 | let deps = []; 232 | cachedDepOptimizationMetadata.depInfoMap.forEach((fileHash, file) => { 233 | deps.push({ file, fileHash }) 234 | }); 235 | const cachedMetadataPath = path.join(scripts.cacheDir, '_metadata.json') 236 | let content = JSON.stringify({ optimized: deps }); 237 | writeFile(cachedMetadataPath, content) 238 | }) 239 | 240 | check_output_dir() 241 | runOptimizer() 242 | watch(); -------------------------------------------------------------------------------- /source/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "dev": "node build.js", 4 | "build": "node build.js --release" 5 | }, 6 | "type": "module", 7 | "devDependencies": { 8 | "chokidar": "^3.5.3", 9 | "colors": "^1.4.0", 10 | "esbuild": "^0.15.7", 11 | "fast-glob": "^3.2.12", 12 | "filesize": "^9.0.11", 13 | "typescript": "^4.8.3" 14 | }, 15 | "dependencies": { 16 | "dayjs": "^1.11.5" 17 | } 18 | } -------------------------------------------------------------------------------- /source/pnpm-lock.yaml: -------------------------------------------------------------------------------- 1 | lockfileVersion: 5.4 2 | 3 | specifiers: 4 | chokidar: ^3.5.3 5 | colors: ^1.4.0 6 | dayjs: ^1.11.5 7 | esbuild: ^0.15.7 8 | fast-glob: ^3.2.12 9 | filesize: ^9.0.11 10 | typescript: ^4.8.3 11 | 12 | dependencies: 13 | dayjs: 1.11.5 14 | 15 | devDependencies: 16 | chokidar: 3.5.3 17 | colors: 1.4.0 18 | esbuild: 0.15.7 19 | fast-glob: 3.2.12 20 | filesize: 9.0.11 21 | typescript: 4.8.3 22 | 23 | packages: 24 | 25 | /@esbuild/linux-loong64/0.15.7: 26 | resolution: {integrity: sha512-IKznSJOsVUuyt7cDzzSZyqBEcZe+7WlBqTVXiF1OXP/4Nm387ToaXZ0fyLwI1iBlI/bzpxVq411QE2/Bt2XWWw==} 27 | engines: {node: '>=12'} 28 | cpu: [loong64] 29 | os: [linux] 30 | requiresBuild: true 31 | dev: true 32 | optional: true 33 | 34 | /@nodelib/fs.scandir/2.1.5: 35 | resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} 36 | engines: {node: '>= 8'} 37 | dependencies: 38 | '@nodelib/fs.stat': 2.0.5 39 | run-parallel: 1.2.0 40 | dev: true 41 | 42 | /@nodelib/fs.stat/2.0.5: 43 | resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} 44 | engines: {node: '>= 8'} 45 | dev: true 46 | 47 | /@nodelib/fs.walk/1.2.8: 48 | resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} 49 | engines: {node: '>= 8'} 50 | dependencies: 51 | '@nodelib/fs.scandir': 2.1.5 52 | fastq: 1.13.0 53 | dev: true 54 | 55 | /anymatch/3.1.2: 56 | resolution: {integrity: sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==} 57 | engines: {node: '>= 8'} 58 | dependencies: 59 | normalize-path: 3.0.0 60 | picomatch: 2.3.1 61 | dev: true 62 | 63 | /binary-extensions/2.2.0: 64 | resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} 65 | engines: {node: '>=8'} 66 | dev: true 67 | 68 | /braces/3.0.2: 69 | resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} 70 | engines: {node: '>=8'} 71 | dependencies: 72 | fill-range: 7.0.1 73 | dev: true 74 | 75 | /chokidar/3.5.3: 76 | resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} 77 | engines: {node: '>= 8.10.0'} 78 | dependencies: 79 | anymatch: 3.1.2 80 | braces: 3.0.2 81 | glob-parent: 5.1.2 82 | is-binary-path: 2.1.0 83 | is-glob: 4.0.3 84 | normalize-path: 3.0.0 85 | readdirp: 3.6.0 86 | optionalDependencies: 87 | fsevents: 2.3.2 88 | dev: true 89 | 90 | /colors/1.4.0: 91 | resolution: {integrity: sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==} 92 | engines: {node: '>=0.1.90'} 93 | dev: true 94 | 95 | /dayjs/1.11.5: 96 | resolution: {integrity: sha512-CAdX5Q3YW3Gclyo5Vpqkgpj8fSdLQcRuzfX6mC6Phy0nfJ0eGYOeS7m4mt2plDWLAtA4TqTakvbboHvUxfe4iA==} 97 | dev: false 98 | 99 | /esbuild-android-64/0.15.7: 100 | resolution: {integrity: sha512-p7rCvdsldhxQr3YHxptf1Jcd86dlhvc3EQmQJaZzzuAxefO9PvcI0GLOa5nCWem1AJ8iMRu9w0r5TG8pHmbi9w==} 101 | engines: {node: '>=12'} 102 | cpu: [x64] 103 | os: [android] 104 | requiresBuild: true 105 | dev: true 106 | optional: true 107 | 108 | /esbuild-android-arm64/0.15.7: 109 | resolution: {integrity: sha512-L775l9ynJT7rVqRM5vo+9w5g2ysbOCfsdLV4CWanTZ1k/9Jb3IYlQ06VCI1edhcosTYJRECQFJa3eAvkx72eyQ==} 110 | engines: {node: '>=12'} 111 | cpu: [arm64] 112 | os: [android] 113 | requiresBuild: true 114 | dev: true 115 | optional: true 116 | 117 | /esbuild-darwin-64/0.15.7: 118 | resolution: {integrity: sha512-KGPt3r1c9ww009t2xLB6Vk0YyNOXh7hbjZ3EecHoVDxgtbUlYstMPDaReimKe6eOEfyY4hBEEeTvKwPsiH5WZg==} 119 | engines: {node: '>=12'} 120 | cpu: [x64] 121 | os: [darwin] 122 | requiresBuild: true 123 | dev: true 124 | optional: true 125 | 126 | /esbuild-darwin-arm64/0.15.7: 127 | resolution: {integrity: sha512-kBIHvtVqbSGajN88lYMnR3aIleH3ABZLLFLxwL2stiuIGAjGlQW741NxVTpUHQXUmPzxi6POqc9npkXa8AcSZQ==} 128 | engines: {node: '>=12'} 129 | cpu: [arm64] 130 | os: [darwin] 131 | requiresBuild: true 132 | dev: true 133 | optional: true 134 | 135 | /esbuild-freebsd-64/0.15.7: 136 | resolution: {integrity: sha512-hESZB91qDLV5MEwNxzMxPfbjAhOmtfsr9Wnuci7pY6TtEh4UDuevmGmkUIjX/b+e/k4tcNBMf7SRQ2mdNuK/HQ==} 137 | engines: {node: '>=12'} 138 | cpu: [x64] 139 | os: [freebsd] 140 | requiresBuild: true 141 | dev: true 142 | optional: true 143 | 144 | /esbuild-freebsd-arm64/0.15.7: 145 | resolution: {integrity: sha512-dLFR0ChH5t+b3J8w0fVKGvtwSLWCv7GYT2Y2jFGulF1L5HftQLzVGN+6pi1SivuiVSmTh28FwUhi9PwQicXI6Q==} 146 | engines: {node: '>=12'} 147 | cpu: [arm64] 148 | os: [freebsd] 149 | requiresBuild: true 150 | dev: true 151 | optional: true 152 | 153 | /esbuild-linux-32/0.15.7: 154 | resolution: {integrity: sha512-v3gT/LsONGUZcjbt2swrMjwxo32NJzk+7sAgtxhGx1+ZmOFaTRXBAi1PPfgpeo/J//Un2jIKm/I+qqeo4caJvg==} 155 | engines: {node: '>=12'} 156 | cpu: [ia32] 157 | os: [linux] 158 | requiresBuild: true 159 | dev: true 160 | optional: true 161 | 162 | /esbuild-linux-64/0.15.7: 163 | resolution: {integrity: sha512-LxXEfLAKwOVmm1yecpMmWERBshl+Kv5YJ/1KnyAr6HRHFW8cxOEsEfisD3sVl/RvHyW//lhYUVSuy9jGEfIRAQ==} 164 | engines: {node: '>=12'} 165 | cpu: [x64] 166 | os: [linux] 167 | requiresBuild: true 168 | dev: true 169 | optional: true 170 | 171 | /esbuild-linux-arm/0.15.7: 172 | resolution: {integrity: sha512-JKgAHtMR5f75wJTeuNQbyznZZa+pjiUHV7sRZp42UNdyXC6TiUYMW/8z8yIBAr2Fpad8hM1royZKQisqPABPvQ==} 173 | engines: {node: '>=12'} 174 | cpu: [arm] 175 | os: [linux] 176 | requiresBuild: true 177 | dev: true 178 | optional: true 179 | 180 | /esbuild-linux-arm64/0.15.7: 181 | resolution: {integrity: sha512-P3cfhudpzWDkglutWgXcT2S7Ft7o2e3YDMrP1n0z2dlbUZghUkKCyaWw0zhp4KxEEzt/E7lmrtRu/pGWnwb9vw==} 182 | engines: {node: '>=12'} 183 | cpu: [arm64] 184 | os: [linux] 185 | requiresBuild: true 186 | dev: true 187 | optional: true 188 | 189 | /esbuild-linux-mips64le/0.15.7: 190 | resolution: {integrity: sha512-T7XKuxl0VpeFLCJXub6U+iybiqh0kM/bWOTb4qcPyDDwNVhLUiPcGdG2/0S7F93czUZOKP57YiLV8YQewgLHKw==} 191 | engines: {node: '>=12'} 192 | cpu: [mips64el] 193 | os: [linux] 194 | requiresBuild: true 195 | dev: true 196 | optional: true 197 | 198 | /esbuild-linux-ppc64le/0.15.7: 199 | resolution: {integrity: sha512-6mGuC19WpFN7NYbecMIJjeQgvDb5aMuvyk0PDYBJrqAEMkTwg3Z98kEKuCm6THHRnrgsdr7bp4SruSAxEM4eJw==} 200 | engines: {node: '>=12'} 201 | cpu: [ppc64] 202 | os: [linux] 203 | requiresBuild: true 204 | dev: true 205 | optional: true 206 | 207 | /esbuild-linux-riscv64/0.15.7: 208 | resolution: {integrity: sha512-uUJsezbswAYo/X7OU/P+PuL/EI9WzxsEQXDekfwpQ23uGiooxqoLFAPmXPcRAt941vjlY9jtITEEikWMBr+F/g==} 209 | engines: {node: '>=12'} 210 | cpu: [riscv64] 211 | os: [linux] 212 | requiresBuild: true 213 | dev: true 214 | optional: true 215 | 216 | /esbuild-linux-s390x/0.15.7: 217 | resolution: {integrity: sha512-+tO+xOyTNMc34rXlSxK7aCwJgvQyffqEM5MMdNDEeMU3ss0S6wKvbBOQfgd5jRPblfwJ6b+bKiz0g5nABpY0QQ==} 218 | engines: {node: '>=12'} 219 | cpu: [s390x] 220 | os: [linux] 221 | requiresBuild: true 222 | dev: true 223 | optional: true 224 | 225 | /esbuild-netbsd-64/0.15.7: 226 | resolution: {integrity: sha512-yVc4Wz+Pu3cP5hzm5kIygNPrjar/v5WCSoRmIjCPWfBVJkZNb5brEGKUlf+0Y759D48BCWa0WHrWXaNy0DULTQ==} 227 | engines: {node: '>=12'} 228 | cpu: [x64] 229 | os: [netbsd] 230 | requiresBuild: true 231 | dev: true 232 | optional: true 233 | 234 | /esbuild-openbsd-64/0.15.7: 235 | resolution: {integrity: sha512-GsimbwC4FSR4lN3wf8XmTQ+r8/0YSQo21rWDL0XFFhLHKlzEA4SsT1Tl8bPYu00IU6UWSJ+b3fG/8SB69rcuEQ==} 236 | engines: {node: '>=12'} 237 | cpu: [x64] 238 | os: [openbsd] 239 | requiresBuild: true 240 | dev: true 241 | optional: true 242 | 243 | /esbuild-sunos-64/0.15.7: 244 | resolution: {integrity: sha512-8CDI1aL/ts0mDGbWzjEOGKXnU7p3rDzggHSBtVryQzkSOsjCHRVe0iFYUuhczlxU1R3LN/E7HgUO4NXzGGP/Ag==} 245 | engines: {node: '>=12'} 246 | cpu: [x64] 247 | os: [sunos] 248 | requiresBuild: true 249 | dev: true 250 | optional: true 251 | 252 | /esbuild-windows-32/0.15.7: 253 | resolution: {integrity: sha512-cOnKXUEPS8EGCzRSFa1x6NQjGhGsFlVgjhqGEbLTPsA7x4RRYiy2RKoArNUU4iR2vHmzqS5Gr84MEumO/wxYKA==} 254 | engines: {node: '>=12'} 255 | cpu: [ia32] 256 | os: [win32] 257 | requiresBuild: true 258 | dev: true 259 | optional: true 260 | 261 | /esbuild-windows-64/0.15.7: 262 | resolution: {integrity: sha512-7MI08Ec2sTIDv+zH6StNBKO+2hGUYIT42GmFyW6MBBWWtJhTcQLinKS6ldIN1d52MXIbiJ6nXyCJ+LpL4jBm3Q==} 263 | engines: {node: '>=12'} 264 | cpu: [x64] 265 | os: [win32] 266 | requiresBuild: true 267 | dev: true 268 | optional: true 269 | 270 | /esbuild-windows-arm64/0.15.7: 271 | resolution: {integrity: sha512-R06nmqBlWjKHddhRJYlqDd3Fabx9LFdKcjoOy08YLimwmsswlFBJV4rXzZCxz/b7ZJXvrZgj8DDv1ewE9+StMw==} 272 | engines: {node: '>=12'} 273 | cpu: [arm64] 274 | os: [win32] 275 | requiresBuild: true 276 | dev: true 277 | optional: true 278 | 279 | /esbuild/0.15.7: 280 | resolution: {integrity: sha512-7V8tzllIbAQV1M4QoE52ImKu8hT/NLGlGXkiDsbEU5PS6K8Mn09ZnYoS+dcmHxOS9CRsV4IRAMdT3I67IyUNXw==} 281 | engines: {node: '>=12'} 282 | hasBin: true 283 | requiresBuild: true 284 | optionalDependencies: 285 | '@esbuild/linux-loong64': 0.15.7 286 | esbuild-android-64: 0.15.7 287 | esbuild-android-arm64: 0.15.7 288 | esbuild-darwin-64: 0.15.7 289 | esbuild-darwin-arm64: 0.15.7 290 | esbuild-freebsd-64: 0.15.7 291 | esbuild-freebsd-arm64: 0.15.7 292 | esbuild-linux-32: 0.15.7 293 | esbuild-linux-64: 0.15.7 294 | esbuild-linux-arm: 0.15.7 295 | esbuild-linux-arm64: 0.15.7 296 | esbuild-linux-mips64le: 0.15.7 297 | esbuild-linux-ppc64le: 0.15.7 298 | esbuild-linux-riscv64: 0.15.7 299 | esbuild-linux-s390x: 0.15.7 300 | esbuild-netbsd-64: 0.15.7 301 | esbuild-openbsd-64: 0.15.7 302 | esbuild-sunos-64: 0.15.7 303 | esbuild-windows-32: 0.15.7 304 | esbuild-windows-64: 0.15.7 305 | esbuild-windows-arm64: 0.15.7 306 | dev: true 307 | 308 | /fast-glob/3.2.12: 309 | resolution: {integrity: sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==} 310 | engines: {node: '>=8.6.0'} 311 | dependencies: 312 | '@nodelib/fs.stat': 2.0.5 313 | '@nodelib/fs.walk': 1.2.8 314 | glob-parent: 5.1.2 315 | merge2: 1.4.1 316 | micromatch: 4.0.5 317 | dev: true 318 | 319 | /fastq/1.13.0: 320 | resolution: {integrity: sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==} 321 | dependencies: 322 | reusify: 1.0.4 323 | dev: true 324 | 325 | /filesize/9.0.11: 326 | resolution: {integrity: sha512-gTAiTtI0STpKa5xesyTA9hA3LX4ga8sm2nWRcffEa1L/5vQwb4mj2MdzMkoHoGv4QzfDshQZuYscQSf8c4TKOA==} 327 | engines: {node: '>= 0.4.0'} 328 | dev: true 329 | 330 | /fill-range/7.0.1: 331 | resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} 332 | engines: {node: '>=8'} 333 | dependencies: 334 | to-regex-range: 5.0.1 335 | dev: true 336 | 337 | /fsevents/2.3.2: 338 | resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} 339 | engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} 340 | os: [darwin] 341 | requiresBuild: true 342 | dev: true 343 | optional: true 344 | 345 | /glob-parent/5.1.2: 346 | resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} 347 | engines: {node: '>= 6'} 348 | dependencies: 349 | is-glob: 4.0.3 350 | dev: true 351 | 352 | /is-binary-path/2.1.0: 353 | resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} 354 | engines: {node: '>=8'} 355 | dependencies: 356 | binary-extensions: 2.2.0 357 | dev: true 358 | 359 | /is-extglob/2.1.1: 360 | resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} 361 | engines: {node: '>=0.10.0'} 362 | dev: true 363 | 364 | /is-glob/4.0.3: 365 | resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} 366 | engines: {node: '>=0.10.0'} 367 | dependencies: 368 | is-extglob: 2.1.1 369 | dev: true 370 | 371 | /is-number/7.0.0: 372 | resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} 373 | engines: {node: '>=0.12.0'} 374 | dev: true 375 | 376 | /merge2/1.4.1: 377 | resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} 378 | engines: {node: '>= 8'} 379 | dev: true 380 | 381 | /micromatch/4.0.5: 382 | resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} 383 | engines: {node: '>=8.6'} 384 | dependencies: 385 | braces: 3.0.2 386 | picomatch: 2.3.1 387 | dev: true 388 | 389 | /normalize-path/3.0.0: 390 | resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} 391 | engines: {node: '>=0.10.0'} 392 | dev: true 393 | 394 | /picomatch/2.3.1: 395 | resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} 396 | engines: {node: '>=8.6'} 397 | dev: true 398 | 399 | /queue-microtask/1.2.3: 400 | resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} 401 | dev: true 402 | 403 | /readdirp/3.6.0: 404 | resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} 405 | engines: {node: '>=8.10.0'} 406 | dependencies: 407 | picomatch: 2.3.1 408 | dev: true 409 | 410 | /reusify/1.0.4: 411 | resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} 412 | engines: {iojs: '>=1.0.0', node: '>=0.10.0'} 413 | dev: true 414 | 415 | /run-parallel/1.2.0: 416 | resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} 417 | dependencies: 418 | queue-microtask: 1.2.3 419 | dev: true 420 | 421 | /to-regex-range/5.0.1: 422 | resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} 423 | engines: {node: '>=8.0'} 424 | dependencies: 425 | is-number: 7.0.0 426 | dev: true 427 | 428 | /typescript/4.8.3: 429 | resolution: {integrity: sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==} 430 | engines: {node: '>=4.2.0'} 431 | hasBin: true 432 | dev: true 433 | -------------------------------------------------------------------------------- /source/src/declares/webapi.d.ts: -------------------------------------------------------------------------------- 1 | //@ts-ignore 2 | declare module globalThis { 3 | const window: typeof globalThis; 4 | const WebSocket: any 5 | const self: typeof undefined 6 | function cancelAnimationFrame(handle: number): void; 7 | function requestAnimationFrame(callback: (now: number)=>void): number; 8 | } 9 | 10 | declare module WebAPI { 11 | function tick(); 12 | function finalize(); 13 | function getHighResTimeStamp(): number; 14 | } -------------------------------------------------------------------------------- /source/src/declares/webapi.event.d.ts: -------------------------------------------------------------------------------- 1 | //@ts-ignore 2 | declare module globalThis { 3 | 4 | /** Evaluation phase of the event flow */ 5 | enum Phase { 6 | /** No event is being processed at this time. */ 7 | NONE = 0, 8 | /** The event is being propagated through the target's ancestor objects. */ 9 | CAPTURING_PHASE = 1, 10 | /** The event has arrived at the event's target. Event listeners registered for this phase are called at this time. If Event.bubbles is false, processing the event is finished after this phase is complete. */ 11 | AT_TARGET = 2, 12 | /** The event is propagating back up through the target's ancestors in reverse order, starting with the parent, and eventually reaching the containing Window. This is known as bubbling, and occurs only if Event.bubbles is true. Event listeners registered for this phase are triggered during this process. */ 13 | BUBBLING_PHASE = 3 14 | } 15 | 16 | interface EventInit { 17 | bubbles?: boolean; 18 | cancelable?: boolean; 19 | composed?: boolean; 20 | } 21 | 22 | /** 23 | * The Event interface represents an event which takes place in the DOM. 24 | * 25 | * An event can be triggered by the user action e.g. clicking the mouse button or tapping keyboard, or generated by APIs to represent the progress of an asynchronous task. It can also be triggered programmatically, such as by calling the HTMLElement.click() method of an element, or by defining the event, then sending it to a specified target using EventTarget.dispatchEvent(). 26 | * 27 | * There are many types of events, some of which use other interfaces based on the main Event interface. Event itself contains the properties and methods which are common to all events. 28 | * 29 | * Many DOM elements can be set up to accept (or "listen" for) these events, and execute code in response to process (or "handle") them. Event-handlers are usually connected (or "attached") to various HTML elements (such as