create-jen-app 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +89 -0
- package/dist/index.js +72 -0
- package/package.json +50 -0
- package/templates/static/.esbuild/jen.config.js +1 -0
- package/templates/static/README.md +67 -0
- package/templates/static/build.js +106 -0
- package/templates/static/jen.config.ts +128 -0
- package/templates/static/jenjs.d.ts +33 -0
- package/templates/static/lib/api/(hello).d.ts +7 -0
- package/templates/static/lib/api/(hello).js +26 -0
- package/templates/static/lib/auth/cookie-utils.d.ts +24 -0
- package/templates/static/lib/auth/cookie-utils.js +99 -0
- package/templates/static/lib/auth/index.d.ts +2 -0
- package/templates/static/lib/auth/index.js +19 -0
- package/templates/static/lib/auth/jwt.d.ts +2 -0
- package/templates/static/lib/auth/jwt.js +30 -0
- package/templates/static/lib/auth/session.d.ts +44 -0
- package/templates/static/lib/auth/session.js +111 -0
- package/templates/static/lib/build/asset-hashing.d.ts +10 -0
- package/templates/static/lib/build/asset-hashing.js +42 -0
- package/templates/static/lib/build/asset-manifest.d.ts +11 -0
- package/templates/static/lib/build/asset-manifest.js +38 -0
- package/templates/static/lib/build/build.d.ts +4 -0
- package/templates/static/lib/build/build.js +113 -0
- package/templates/static/lib/build/island-hydration.d.ts +25 -0
- package/templates/static/lib/build/island-hydration.js +62 -0
- package/templates/static/lib/build/minifier.d.ts +20 -0
- package/templates/static/lib/build/minifier.js +65 -0
- package/templates/static/lib/build/page-renderer.d.ts +17 -0
- package/templates/static/lib/build/page-renderer.js +45 -0
- package/templates/static/lib/build/production-build.d.ts +10 -0
- package/templates/static/lib/build/production-build.js +30 -0
- package/templates/static/lib/build/ssg-pipeline.d.ts +15 -0
- package/templates/static/lib/build/ssg-pipeline.js +119 -0
- package/templates/static/lib/build-tools/build-site.d.ts +6 -0
- package/templates/static/lib/build-tools/build-site.js +56 -0
- package/templates/static/lib/cache/index.d.ts +2 -0
- package/templates/static/lib/cache/index.js +19 -0
- package/templates/static/lib/cache/memory.d.ts +6 -0
- package/templates/static/lib/cache/memory.js +31 -0
- package/templates/static/lib/cache/redis.d.ts +6 -0
- package/templates/static/lib/cache/redis.js +33 -0
- package/templates/static/lib/cli/banner.d.ts +1 -0
- package/templates/static/lib/cli/banner.js +41 -0
- package/templates/static/lib/cli/templates/ssg/jen.config.d.ts +3 -0
- package/templates/static/lib/cli/templates/ssg/jen.config.js +49 -0
- package/templates/static/lib/cli/templates/ssg/site/index.d.ts +2 -0
- package/templates/static/lib/cli/templates/ssg/site/index.js +4 -0
- package/templates/static/lib/cli/templates/ssr/jen.config.d.ts +3 -0
- package/templates/static/lib/cli/templates/ssr/jen.config.js +49 -0
- package/templates/static/lib/cli/templates/ssr/site/index.d.ts +2 -0
- package/templates/static/lib/cli/templates/ssr/site/index.js +4 -0
- package/templates/static/lib/compilers/esbuild-plugins.d.ts +6 -0
- package/templates/static/lib/compilers/esbuild-plugins.js +130 -0
- package/templates/static/lib/compilers/svelte.d.ts +18 -0
- package/templates/static/lib/compilers/svelte.js +61 -0
- package/templates/static/lib/compilers/vue.d.ts +15 -0
- package/templates/static/lib/compilers/vue.js +99 -0
- package/templates/static/lib/core/config.d.ts +53 -0
- package/templates/static/lib/core/config.js +18 -0
- package/templates/static/lib/core/http.d.ts +3 -0
- package/templates/static/lib/core/http.js +42 -0
- package/templates/static/lib/core/middleware-hooks.d.ts +46 -0
- package/templates/static/lib/core/middleware-hooks.js +69 -0
- package/templates/static/lib/core/paths.d.ts +6 -0
- package/templates/static/lib/core/paths.js +24 -0
- package/templates/static/lib/core/routes/match.d.ts +6 -0
- package/templates/static/lib/core/routes/match.js +31 -0
- package/templates/static/lib/core/routes/scan.d.ts +9 -0
- package/templates/static/lib/core/routes/scan.js +148 -0
- package/templates/static/lib/core/types.d.ts +18 -0
- package/templates/static/lib/core/types.js +18 -0
- package/templates/static/lib/css/compiler.d.ts +20 -0
- package/templates/static/lib/css/compiler.js +87 -0
- package/templates/static/lib/db/connector.d.ts +4 -0
- package/templates/static/lib/db/connector.js +33 -0
- package/templates/static/lib/db/drivers/jdb.d.ts +13 -0
- package/templates/static/lib/db/drivers/jdb.js +59 -0
- package/templates/static/lib/db/drivers/sql.d.ts +18 -0
- package/templates/static/lib/db/drivers/sql.js +182 -0
- package/templates/static/lib/db/index.d.ts +19 -0
- package/templates/static/lib/db/index.js +65 -0
- package/templates/static/lib/db/types.d.ts +29 -0
- package/templates/static/lib/db/types.js +18 -0
- package/templates/static/lib/graphql/index.d.ts +1 -0
- package/templates/static/lib/graphql/index.js +22 -0
- package/templates/static/lib/graphql/resolvers.d.ts +17 -0
- package/templates/static/lib/graphql/resolvers.js +26 -0
- package/templates/static/lib/graphql/schema.d.ts +1 -0
- package/templates/static/lib/graphql/schema.js +20 -0
- package/templates/static/lib/i18n/en.json +4 -0
- package/templates/static/lib/i18n/es.json +4 -0
- package/templates/static/lib/i18n/index.d.ts +8 -0
- package/templates/static/lib/i18n/index.js +32 -0
- package/templates/static/lib/import/jen-import.d.ts +27 -0
- package/templates/static/lib/import/jen-import.js +128 -0
- package/templates/static/lib/index.d.ts +81 -0
- package/templates/static/lib/index.js +120 -0
- package/templates/static/lib/jdb/engine.d.ts +9 -0
- package/templates/static/lib/jdb/engine.js +176 -0
- package/templates/static/lib/jdb/index.d.ts +2 -0
- package/templates/static/lib/jdb/index.js +19 -0
- package/templates/static/lib/jdb/types.d.ts +46 -0
- package/templates/static/lib/jdb/types.js +18 -0
- package/templates/static/lib/jdb/utils.d.ts +6 -0
- package/templates/static/lib/jdb/utils.js +141 -0
- package/templates/static/lib/middleware/builtins/body-parser.d.ts +1 -0
- package/templates/static/lib/middleware/builtins/body-parser.js +55 -0
- package/templates/static/lib/middleware/builtins/cors.d.ts +13 -0
- package/templates/static/lib/middleware/builtins/cors.js +67 -0
- package/templates/static/lib/middleware/builtins/logger.d.ts +1 -0
- package/templates/static/lib/middleware/builtins/logger.js +33 -0
- package/templates/static/lib/middleware/builtins/rate-limit.d.ts +5 -0
- package/templates/static/lib/middleware/builtins/rate-limit.js +76 -0
- package/templates/static/lib/middleware/builtins/request-id.d.ts +1 -0
- package/templates/static/lib/middleware/builtins/request-id.js +25 -0
- package/templates/static/lib/middleware/builtins/security-headers.d.ts +1 -0
- package/templates/static/lib/middleware/builtins/security-headers.js +39 -0
- package/templates/static/lib/middleware/context.d.ts +18 -0
- package/templates/static/lib/middleware/context.js +50 -0
- package/templates/static/lib/middleware/decorators.d.ts +2 -0
- package/templates/static/lib/middleware/decorators.js +61 -0
- package/templates/static/lib/middleware/errors/handler.d.ts +1 -0
- package/templates/static/lib/middleware/errors/handler.js +65 -0
- package/templates/static/lib/middleware/errors/http-error.d.ts +5 -0
- package/templates/static/lib/middleware/errors/http-error.js +27 -0
- package/templates/static/lib/middleware/kernel.d.ts +6 -0
- package/templates/static/lib/middleware/kernel.js +39 -0
- package/templates/static/lib/middleware/pipeline.d.ts +4 -0
- package/templates/static/lib/middleware/pipeline.js +67 -0
- package/templates/static/lib/middleware/registry.d.ts +10 -0
- package/templates/static/lib/middleware/registry.js +41 -0
- package/templates/static/lib/middleware/response.d.ts +13 -0
- package/templates/static/lib/middleware/response.js +60 -0
- package/templates/static/lib/middleware/types.d.ts +1 -0
- package/templates/static/lib/middleware/types.js +18 -0
- package/templates/static/lib/middleware/utils/matcher.d.ts +1 -0
- package/templates/static/lib/middleware/utils/matcher.js +31 -0
- package/templates/static/lib/native/bundle.d.ts +19 -0
- package/templates/static/lib/native/bundle.js +39 -0
- package/templates/static/lib/native/dev-server.d.ts +6 -0
- package/templates/static/lib/native/dev-server.js +38 -0
- package/templates/static/lib/native/index.d.ts +30 -0
- package/templates/static/lib/native/index.js +48 -0
- package/templates/static/lib/native/optimizer.d.ts +17 -0
- package/templates/static/lib/native/optimizer.js +37 -0
- package/templates/static/lib/native/style-compiler.d.ts +10 -0
- package/templates/static/lib/native/style-compiler.js +36 -0
- package/templates/static/lib/plugin/loader.d.ts +8 -0
- package/templates/static/lib/plugin/loader.js +59 -0
- package/templates/static/lib/runtime/client-runtime.d.ts +1 -0
- package/templates/static/lib/runtime/client-runtime.js +28 -0
- package/templates/static/lib/runtime/hmr.d.ts +1 -0
- package/templates/static/lib/runtime/hmr.js +54 -0
- package/templates/static/lib/runtime/hydrate.d.ts +1 -0
- package/templates/static/lib/runtime/hydrate.js +45 -0
- package/templates/static/lib/runtime/island-hydration-client.d.ts +5 -0
- package/templates/static/lib/runtime/island-hydration-client.js +132 -0
- package/templates/static/lib/runtime/islands.d.ts +46 -0
- package/templates/static/lib/runtime/islands.js +89 -0
- package/templates/static/lib/runtime/render.d.ts +13 -0
- package/templates/static/lib/runtime/render.js +183 -0
- package/templates/static/lib/server/api-routes.d.ts +44 -0
- package/templates/static/lib/server/api-routes.js +196 -0
- package/templates/static/lib/server/api.d.ts +6 -0
- package/templates/static/lib/server/api.js +124 -0
- package/templates/static/lib/server/app.d.ts +10 -0
- package/templates/static/lib/server/app.js +381 -0
- package/templates/static/lib/server/runtimeServe.d.ts +4 -0
- package/templates/static/lib/server/runtimeServe.js +125 -0
- package/templates/static/lib/shared/log.d.ts +5 -0
- package/templates/static/lib/shared/log.js +31 -0
- package/templates/static/node_modules/.bin/esbuild +16 -0
- package/templates/static/node_modules/.bin/esbuild.cmd +17 -0
- package/templates/static/node_modules/.bin/esbuild.ps1 +28 -0
- package/templates/static/node_modules/.bin/tsc +16 -0
- package/templates/static/node_modules/.bin/tsc.cmd +17 -0
- package/templates/static/node_modules/.bin/tsc.ps1 +28 -0
- package/templates/static/node_modules/.bin/tsserver +16 -0
- package/templates/static/node_modules/.bin/tsserver.cmd +17 -0
- package/templates/static/node_modules/.bin/tsserver.ps1 +28 -0
- package/templates/static/node_modules/.jen/cache/B__Jen.js_packages_create-jen-app_templates_static_site_(home).tsx.mjs +14 -0
- package/templates/static/node_modules/.jen/cache/B__Jen.js_packages_create-jen-app_yo_site_(home).tsx.mjs +11 -0
- package/templates/static/node_modules/.package-lock.json +585 -0
- package/templates/static/node_modules/@esbuild/win32-x64/README.md +3 -0
- package/templates/static/node_modules/@esbuild/win32-x64/esbuild.exe +0 -0
- package/templates/static/node_modules/@esbuild/win32-x64/package.json +20 -0
- package/templates/static/node_modules/@jenjs/master/README.md +24 -0
- package/templates/static/node_modules/@jenjs/master/index.js +3655 -0
- package/templates/static/node_modules/@jenjs/master/package.json +36 -0
- package/templates/static/node_modules/@polka/url/build.js +49 -0
- package/templates/static/node_modules/@polka/url/build.mjs +47 -0
- package/templates/static/node_modules/@polka/url/index.d.ts +11 -0
- package/templates/static/node_modules/@polka/url/package.json +30 -0
- package/templates/static/node_modules/@polka/url/readme.md +68 -0
- package/templates/static/node_modules/@types/node/LICENSE +21 -0
- package/templates/static/node_modules/@types/node/README.md +15 -0
- package/templates/static/node_modules/@types/node/assert/strict.d.ts +111 -0
- package/templates/static/node_modules/@types/node/assert.d.ts +1078 -0
- package/templates/static/node_modules/@types/node/async_hooks.d.ts +603 -0
- package/templates/static/node_modules/@types/node/buffer.buffer.d.ts +472 -0
- package/templates/static/node_modules/@types/node/buffer.d.ts +1934 -0
- package/templates/static/node_modules/@types/node/child_process.d.ts +1476 -0
- package/templates/static/node_modules/@types/node/cluster.d.ts +578 -0
- package/templates/static/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
- package/templates/static/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/templates/static/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/templates/static/node_modules/@types/node/compatibility/iterators.d.ts +20 -0
- package/templates/static/node_modules/@types/node/console.d.ts +452 -0
- package/templates/static/node_modules/@types/node/constants.d.ts +21 -0
- package/templates/static/node_modules/@types/node/crypto.d.ts +4545 -0
- package/templates/static/node_modules/@types/node/dgram.d.ts +600 -0
- package/templates/static/node_modules/@types/node/diagnostics_channel.d.ts +578 -0
- package/templates/static/node_modules/@types/node/dns/promises.d.ts +503 -0
- package/templates/static/node_modules/@types/node/dns.d.ts +923 -0
- package/templates/static/node_modules/@types/node/domain.d.ts +170 -0
- package/templates/static/node_modules/@types/node/events.d.ts +976 -0
- package/templates/static/node_modules/@types/node/fs/promises.d.ts +1295 -0
- package/templates/static/node_modules/@types/node/fs.d.ts +4461 -0
- package/templates/static/node_modules/@types/node/globals.d.ts +172 -0
- package/templates/static/node_modules/@types/node/globals.typedarray.d.ts +38 -0
- package/templates/static/node_modules/@types/node/http.d.ts +2089 -0
- package/templates/static/node_modules/@types/node/http2.d.ts +2644 -0
- package/templates/static/node_modules/@types/node/https.d.ts +579 -0
- package/templates/static/node_modules/@types/node/index.d.ts +97 -0
- package/templates/static/node_modules/@types/node/inspector.d.ts +253 -0
- package/templates/static/node_modules/@types/node/inspector.generated.d.ts +4052 -0
- package/templates/static/node_modules/@types/node/module.d.ts +891 -0
- package/templates/static/node_modules/@types/node/net.d.ts +1057 -0
- package/templates/static/node_modules/@types/node/os.d.ts +506 -0
- package/templates/static/node_modules/@types/node/package.json +145 -0
- package/templates/static/node_modules/@types/node/path.d.ts +200 -0
- package/templates/static/node_modules/@types/node/perf_hooks.d.ts +968 -0
- package/templates/static/node_modules/@types/node/process.d.ts +2089 -0
- package/templates/static/node_modules/@types/node/punycode.d.ts +117 -0
- package/templates/static/node_modules/@types/node/querystring.d.ts +152 -0
- package/templates/static/node_modules/@types/node/readline/promises.d.ts +161 -0
- package/templates/static/node_modules/@types/node/readline.d.ts +594 -0
- package/templates/static/node_modules/@types/node/repl.d.ts +428 -0
- package/templates/static/node_modules/@types/node/sea.d.ts +153 -0
- package/templates/static/node_modules/@types/node/sqlite.d.ts +721 -0
- package/templates/static/node_modules/@types/node/stream/consumers.d.ts +38 -0
- package/templates/static/node_modules/@types/node/stream/promises.d.ts +90 -0
- package/templates/static/node_modules/@types/node/stream/web.d.ts +622 -0
- package/templates/static/node_modules/@types/node/stream.d.ts +1664 -0
- package/templates/static/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/templates/static/node_modules/@types/node/test.d.ts +2163 -0
- package/templates/static/node_modules/@types/node/timers/promises.d.ts +108 -0
- package/templates/static/node_modules/@types/node/timers.d.ts +287 -0
- package/templates/static/node_modules/@types/node/tls.d.ts +1319 -0
- package/templates/static/node_modules/@types/node/trace_events.d.ts +197 -0
- package/templates/static/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
- package/templates/static/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +34 -0
- package/templates/static/node_modules/@types/node/ts5.6/index.d.ts +97 -0
- package/templates/static/node_modules/@types/node/tty.d.ts +208 -0
- package/templates/static/node_modules/@types/node/url.d.ts +984 -0
- package/templates/static/node_modules/@types/node/util.d.ts +2606 -0
- package/templates/static/node_modules/@types/node/v8.d.ts +920 -0
- package/templates/static/node_modules/@types/node/vm.d.ts +1000 -0
- package/templates/static/node_modules/@types/node/wasi.d.ts +181 -0
- package/templates/static/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
- package/templates/static/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/templates/static/node_modules/@types/node/web-globals/events.d.ts +97 -0
- package/templates/static/node_modules/@types/node/web-globals/fetch.d.ts +55 -0
- package/templates/static/node_modules/@types/node/web-globals/navigator.d.ts +22 -0
- package/templates/static/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/templates/static/node_modules/@types/node/worker_threads.d.ts +784 -0
- package/templates/static/node_modules/@types/node/zlib.d.ts +683 -0
- package/templates/static/node_modules/esbuild/LICENSE.md +21 -0
- package/templates/static/node_modules/esbuild/README.md +3 -0
- package/templates/static/node_modules/esbuild/bin/esbuild +223 -0
- package/templates/static/node_modules/esbuild/install.js +289 -0
- package/templates/static/node_modules/esbuild/lib/main.d.ts +716 -0
- package/templates/static/node_modules/esbuild/lib/main.js +2242 -0
- package/templates/static/node_modules/esbuild/package.json +49 -0
- package/templates/static/node_modules/mrmime/index.d.ts +2 -0
- package/templates/static/node_modules/mrmime/index.js +449 -0
- package/templates/static/node_modules/mrmime/index.mjs +448 -0
- package/templates/static/node_modules/mrmime/license +21 -0
- package/templates/static/node_modules/mrmime/package.json +44 -0
- package/templates/static/node_modules/mrmime/readme.md +130 -0
- package/templates/static/node_modules/preact/LICENSE +21 -0
- package/templates/static/node_modules/preact/README.md +185 -0
- package/templates/static/node_modules/preact/compat/client.d.ts +13 -0
- package/templates/static/node_modules/preact/compat/client.js +21 -0
- package/templates/static/node_modules/preact/compat/client.mjs +24 -0
- package/templates/static/node_modules/preact/compat/dist/compat.js +2 -0
- package/templates/static/node_modules/preact/compat/dist/compat.js.map +1 -0
- package/templates/static/node_modules/preact/compat/dist/compat.mjs +2 -0
- package/templates/static/node_modules/preact/compat/dist/compat.module.js +2 -0
- package/templates/static/node_modules/preact/compat/dist/compat.module.js.map +1 -0
- package/templates/static/node_modules/preact/compat/dist/compat.umd.js +2 -0
- package/templates/static/node_modules/preact/compat/dist/compat.umd.js.map +1 -0
- package/templates/static/node_modules/preact/compat/jsx-dev-runtime.js +3 -0
- package/templates/static/node_modules/preact/compat/jsx-dev-runtime.mjs +3 -0
- package/templates/static/node_modules/preact/compat/jsx-runtime.js +3 -0
- package/templates/static/node_modules/preact/compat/jsx-runtime.mjs +3 -0
- package/templates/static/node_modules/preact/compat/package.json +55 -0
- package/templates/static/node_modules/preact/compat/scheduler.js +15 -0
- package/templates/static/node_modules/preact/compat/scheduler.mjs +23 -0
- package/templates/static/node_modules/preact/compat/server.browser.js +11 -0
- package/templates/static/node_modules/preact/compat/server.js +36 -0
- package/templates/static/node_modules/preact/compat/server.mjs +17 -0
- package/templates/static/node_modules/preact/compat/src/Children.js +21 -0
- package/templates/static/node_modules/preact/compat/src/PureComponent.js +16 -0
- package/templates/static/node_modules/preact/compat/src/forwardRef.js +44 -0
- package/templates/static/node_modules/preact/compat/src/hooks.js +70 -0
- package/templates/static/node_modules/preact/compat/src/index.d.ts +351 -0
- package/templates/static/node_modules/preact/compat/src/index.js +238 -0
- package/templates/static/node_modules/preact/compat/src/internal.d.ts +48 -0
- package/templates/static/node_modules/preact/compat/src/memo.js +35 -0
- package/templates/static/node_modules/preact/compat/src/portals.js +78 -0
- package/templates/static/node_modules/preact/compat/src/render.js +313 -0
- package/templates/static/node_modules/preact/compat/src/suspense-list.d.ts +16 -0
- package/templates/static/node_modules/preact/compat/src/suspense-list.js +127 -0
- package/templates/static/node_modules/preact/compat/src/suspense.d.ts +19 -0
- package/templates/static/node_modules/preact/compat/src/suspense.js +291 -0
- package/templates/static/node_modules/preact/compat/src/util.js +33 -0
- package/templates/static/node_modules/preact/compat/test-utils.js +1 -0
- package/templates/static/node_modules/preact/compat/test-utils.mjs +1 -0
- package/templates/static/node_modules/preact/debug/dist/debug.js +2 -0
- package/templates/static/node_modules/preact/debug/dist/debug.js.map +1 -0
- package/templates/static/node_modules/preact/debug/dist/debug.mjs +2 -0
- package/templates/static/node_modules/preact/debug/dist/debug.module.js +2 -0
- package/templates/static/node_modules/preact/debug/dist/debug.module.js.map +1 -0
- package/templates/static/node_modules/preact/debug/dist/debug.umd.js +2 -0
- package/templates/static/node_modules/preact/debug/dist/debug.umd.js.map +1 -0
- package/templates/static/node_modules/preact/debug/package.json +27 -0
- package/templates/static/node_modules/preact/debug/src/check-props.js +54 -0
- package/templates/static/node_modules/preact/debug/src/component-stack.js +146 -0
- package/templates/static/node_modules/preact/debug/src/constants.js +3 -0
- package/templates/static/node_modules/preact/debug/src/debug.js +593 -0
- package/templates/static/node_modules/preact/debug/src/index.d.ts +23 -0
- package/templates/static/node_modules/preact/debug/src/index.js +12 -0
- package/templates/static/node_modules/preact/debug/src/internal.d.ts +82 -0
- package/templates/static/node_modules/preact/debug/src/util.js +15 -0
- package/templates/static/node_modules/preact/devtools/dist/devtools.js +2 -0
- package/templates/static/node_modules/preact/devtools/dist/devtools.js.map +1 -0
- package/templates/static/node_modules/preact/devtools/dist/devtools.mjs +2 -0
- package/templates/static/node_modules/preact/devtools/dist/devtools.module.js +2 -0
- package/templates/static/node_modules/preact/devtools/dist/devtools.module.js.map +1 -0
- package/templates/static/node_modules/preact/devtools/dist/devtools.umd.js +2 -0
- package/templates/static/node_modules/preact/devtools/dist/devtools.umd.js.map +1 -0
- package/templates/static/node_modules/preact/devtools/package.json +25 -0
- package/templates/static/node_modules/preact/devtools/src/devtools.js +21 -0
- package/templates/static/node_modules/preact/devtools/src/index.d.ts +8 -0
- package/templates/static/node_modules/preact/devtools/src/index.js +15 -0
- package/templates/static/node_modules/preact/dist/preact.js +2 -0
- package/templates/static/node_modules/preact/dist/preact.js.map +1 -0
- package/templates/static/node_modules/preact/dist/preact.min.js +2 -0
- package/templates/static/node_modules/preact/dist/preact.min.js.map +1 -0
- package/templates/static/node_modules/preact/dist/preact.min.module.js +2 -0
- package/templates/static/node_modules/preact/dist/preact.min.module.js.map +1 -0
- package/templates/static/node_modules/preact/dist/preact.min.umd.js +2 -0
- package/templates/static/node_modules/preact/dist/preact.min.umd.js.map +1 -0
- package/templates/static/node_modules/preact/dist/preact.mjs +2 -0
- package/templates/static/node_modules/preact/dist/preact.module.js +2 -0
- package/templates/static/node_modules/preact/dist/preact.module.js.map +1 -0
- package/templates/static/node_modules/preact/dist/preact.umd.js +2 -0
- package/templates/static/node_modules/preact/dist/preact.umd.js.map +1 -0
- package/templates/static/node_modules/preact/hooks/dist/hooks.js +2 -0
- package/templates/static/node_modules/preact/hooks/dist/hooks.js.map +1 -0
- package/templates/static/node_modules/preact/hooks/dist/hooks.mjs +2 -0
- package/templates/static/node_modules/preact/hooks/dist/hooks.module.js +2 -0
- package/templates/static/node_modules/preact/hooks/dist/hooks.module.js.map +1 -0
- package/templates/static/node_modules/preact/hooks/dist/hooks.umd.js +2 -0
- package/templates/static/node_modules/preact/hooks/dist/hooks.umd.js.map +1 -0
- package/templates/static/node_modules/preact/hooks/package.json +35 -0
- package/templates/static/node_modules/preact/hooks/src/index.d.ts +145 -0
- package/templates/static/node_modules/preact/hooks/src/index.js +555 -0
- package/templates/static/node_modules/preact/hooks/src/internal.d.ts +103 -0
- package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.js +2 -0
- package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.js.map +1 -0
- package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs +2 -0
- package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js +2 -0
- package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js.map +1 -0
- package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.umd.js +2 -0
- package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -0
- package/templates/static/node_modules/preact/jsx-runtime/package.json +28 -0
- package/templates/static/node_modules/preact/jsx-runtime/src/index.d.ts +62 -0
- package/templates/static/node_modules/preact/jsx-runtime/src/index.js +206 -0
- package/templates/static/node_modules/preact/jsx-runtime/src/utils.js +36 -0
- package/templates/static/node_modules/preact/package.json +258 -0
- package/templates/static/node_modules/preact/src/cjs.js +3 -0
- package/templates/static/node_modules/preact/src/clone-element.js +48 -0
- package/templates/static/node_modules/preact/src/component.js +249 -0
- package/templates/static/node_modules/preact/src/constants.js +22 -0
- package/templates/static/node_modules/preact/src/create-context.js +60 -0
- package/templates/static/node_modules/preact/src/create-element.js +97 -0
- package/templates/static/node_modules/preact/src/diff/catch-error.js +46 -0
- package/templates/static/node_modules/preact/src/diff/children.js +451 -0
- package/templates/static/node_modules/preact/src/diff/index.js +684 -0
- package/templates/static/node_modules/preact/src/diff/props.js +173 -0
- package/templates/static/node_modules/preact/src/dom.d.ts +2476 -0
- package/templates/static/node_modules/preact/src/index-5.d.ts +399 -0
- package/templates/static/node_modules/preact/src/index.d.ts +402 -0
- package/templates/static/node_modules/preact/src/index.js +13 -0
- package/templates/static/node_modules/preact/src/internal.d.ts +190 -0
- package/templates/static/node_modules/preact/src/jsx.d.ts +2878 -0
- package/templates/static/node_modules/preact/src/options.js +16 -0
- package/templates/static/node_modules/preact/src/render.js +78 -0
- package/templates/static/node_modules/preact/src/util.js +28 -0
- package/templates/static/node_modules/preact/test-utils/dist/testUtils.js +2 -0
- package/templates/static/node_modules/preact/test-utils/dist/testUtils.js.map +1 -0
- package/templates/static/node_modules/preact/test-utils/dist/testUtils.mjs +2 -0
- package/templates/static/node_modules/preact/test-utils/dist/testUtils.module.js +2 -0
- package/templates/static/node_modules/preact/test-utils/dist/testUtils.module.js.map +1 -0
- package/templates/static/node_modules/preact/test-utils/dist/testUtils.umd.js +2 -0
- package/templates/static/node_modules/preact/test-utils/dist/testUtils.umd.js.map +1 -0
- package/templates/static/node_modules/preact/test-utils/package.json +28 -0
- package/templates/static/node_modules/preact/test-utils/src/index.d.ts +3 -0
- package/templates/static/node_modules/preact/test-utils/src/index.js +129 -0
- package/templates/static/node_modules/preact-render-to-string/LICENSE +21 -0
- package/templates/static/node_modules/preact-render-to-string/README.md +149 -0
- package/templates/static/node_modules/preact-render-to-string/dist/commonjs.js +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/index.d.ts +17 -0
- package/templates/static/node_modules/preact-render-to-string/dist/index.js +6 -0
- package/templates/static/node_modules/preact-render-to-string/dist/index.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/index.mjs +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/index.module.js +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/index.module.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/index.umd.js +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/index.umd.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/internal.d.ts +35 -0
- package/templates/static/node_modules/preact-render-to-string/dist/jsx/commonjs.js +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.js +4 -0
- package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.mjs +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.module.js +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.module.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.umd.js +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.umd.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/jsx.d.ts +24 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/index.js +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/index.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/index.mjs +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/index.module.js +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/index.module.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/index.umd.js +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/index.umd.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.js +884 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.mjs +884 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.module.js +884 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.module.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.umd.js +888 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.umd.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream-node.d.ts +19 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream.d.ts +10 -0
- package/templates/static/node_modules/preact-render-to-string/jsx.d.ts +24 -0
- package/templates/static/node_modules/preact-render-to-string/jsx.js +1 -0
- package/templates/static/node_modules/preact-render-to-string/package.json +152 -0
- package/templates/static/node_modules/preact-render-to-string/src/index.d.ts +17 -0
- package/templates/static/node_modules/preact-render-to-string/src/index.js +764 -0
- package/templates/static/node_modules/preact-render-to-string/src/internal.d.ts +35 -0
- package/templates/static/node_modules/preact-render-to-string/src/jsx.d.ts +24 -0
- package/templates/static/node_modules/preact-render-to-string/src/jsx.js +102 -0
- package/templates/static/node_modules/preact-render-to-string/src/lib/chunked.js +97 -0
- package/templates/static/node_modules/preact-render-to-string/src/lib/client.js +62 -0
- package/templates/static/node_modules/preact-render-to-string/src/lib/constants.js +20 -0
- package/templates/static/node_modules/preact-render-to-string/src/lib/polyfills.js +8 -0
- package/templates/static/node_modules/preact-render-to-string/src/lib/util.js +208 -0
- package/templates/static/node_modules/preact-render-to-string/src/pretty.js +491 -0
- package/templates/static/node_modules/preact-render-to-string/src/stream-node.d.ts +19 -0
- package/templates/static/node_modules/preact-render-to-string/src/stream-node.js +84 -0
- package/templates/static/node_modules/preact-render-to-string/src/stream.d.ts +10 -0
- package/templates/static/node_modules/preact-render-to-string/src/stream.js +43 -0
- package/templates/static/node_modules/preact-render-to-string/typings.json +5 -0
- package/templates/static/node_modules/sirv/build.js +197 -0
- package/templates/static/node_modules/sirv/build.mjs +197 -0
- package/templates/static/node_modules/sirv/index.d.mts +29 -0
- package/templates/static/node_modules/sirv/index.d.ts +33 -0
- package/templates/static/node_modules/sirv/package.json +40 -0
- package/templates/static/node_modules/sirv/readme.md +238 -0
- package/templates/static/node_modules/totalist/dist/index.js +24 -0
- package/templates/static/node_modules/totalist/dist/index.mjs +22 -0
- package/templates/static/node_modules/totalist/index.d.ts +3 -0
- package/templates/static/node_modules/totalist/license +21 -0
- package/templates/static/node_modules/totalist/package.json +55 -0
- package/templates/static/node_modules/totalist/readme.md +109 -0
- package/templates/static/node_modules/totalist/sync/index.d.ts +3 -0
- package/templates/static/node_modules/totalist/sync/index.js +17 -0
- package/templates/static/node_modules/totalist/sync/index.mjs +15 -0
- package/templates/static/node_modules/typescript/bin/tsc +2 -0
- package/templates/static/node_modules/typescript/bin/tsserver +2 -0
- package/templates/static/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/lib.d.ts +22 -0
- package/templates/static/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
- package/templates/static/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
- package/templates/static/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
- package/templates/static/node_modules/typescript/lib/lib.dom.d.ts +39429 -0
- package/templates/static/node_modules/typescript/lib/lib.dom.iterable.d.ts +571 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
- package/templates/static/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
- package/templates/static/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
- package/templates/static/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
- package/templates/static/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
- package/templates/static/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
- package/templates/static/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
- package/templates/static/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
- package/templates/static/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
- package/templates/static/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
- package/templates/static/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
- package/templates/static/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
- package/templates/static/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
- package/templates/static/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
- package/templates/static/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
- package/templates/static/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
- package/templates/static/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
- package/templates/static/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
- package/templates/static/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
- package/templates/static/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
- package/templates/static/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
- package/templates/static/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
- package/templates/static/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
- package/templates/static/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
- package/templates/static/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
- package/templates/static/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
- package/templates/static/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
- package/templates/static/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
- package/templates/static/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
- package/templates/static/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
- package/templates/static/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
- package/templates/static/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
- package/templates/static/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2022.intl.d.ts +145 -0
- package/templates/static/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
- package/templates/static/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
- package/templates/static/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
- package/templates/static/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
- package/templates/static/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
- package/templates/static/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
- package/templates/static/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
- package/templates/static/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
- package/templates/static/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
- package/templates/static/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
- package/templates/static/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
- package/templates/static/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
- package/templates/static/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
- package/templates/static/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
- package/templates/static/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
- package/templates/static/node_modules/typescript/lib/lib.es5.d.ts +4601 -0
- package/templates/static/node_modules/typescript/lib/lib.es6.d.ts +23 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.error.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.float16.d.ts +445 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +25 -0
- package/templates/static/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
- package/templates/static/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
- package/templates/static/node_modules/typescript/lib/lib.webworker.d.ts +13150 -0
- package/templates/static/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
- package/templates/static/node_modules/typescript/lib/lib.webworker.iterable.d.ts +340 -0
- package/templates/static/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/tsc.js +8 -0
- package/templates/static/node_modules/typescript/lib/tsserver.js +8 -0
- package/templates/static/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
- package/templates/static/node_modules/typescript/lib/tsserverlibrary.js +21 -0
- package/templates/static/node_modules/typescript/lib/typescript.d.ts +11437 -0
- package/templates/static/package.json +20 -0
- package/templates/static/server.js +130 -0
- package/templates/static/site/(home).tsx +12 -0
- package/templates/static/site/styles/global.scss +78 -0
- package/templates/static/tsconfig.json +39 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Options as PreactOptions,
|
|
3
|
+
Component as PreactComponent,
|
|
4
|
+
VNode as PreactVNode,
|
|
5
|
+
PreactContext,
|
|
6
|
+
HookType,
|
|
7
|
+
ErrorInfo,
|
|
8
|
+
} from '../../src/internal';
|
|
9
|
+
import { Reducer, StateUpdater } from '.';
|
|
10
|
+
|
|
11
|
+
export { PreactContext };
|
|
12
|
+
|
|
13
|
+
export interface Options extends PreactOptions {
|
|
14
|
+
/** Attach a hook that is invoked before a vnode is diffed. */
|
|
15
|
+
_diff?(vnode: VNode): void;
|
|
16
|
+
diffed?(vnode: VNode): void;
|
|
17
|
+
/** Attach a hook that is invoked before a vnode has rendered. */
|
|
18
|
+
_render?(vnode: VNode): void;
|
|
19
|
+
/** Attach a hook that is invoked after a tree was mounted or was updated. */
|
|
20
|
+
_commit?(vnode: VNode, commitQueue: Component[]): void;
|
|
21
|
+
_unmount?(vnode: VNode): void;
|
|
22
|
+
/** Attach a hook that is invoked before a hook's state is queried. */
|
|
23
|
+
_hook?(component: Component, index: number, type: HookType): void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Hook tracking
|
|
27
|
+
|
|
28
|
+
export interface ComponentHooks {
|
|
29
|
+
/** The list of hooks a component uses */
|
|
30
|
+
_list: HookState[];
|
|
31
|
+
/** List of Effects to be invoked after the next frame is rendered */
|
|
32
|
+
_pendingEffects: EffectHookState[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface Component extends Omit<PreactComponent<any, any>, '_renderCallbacks'> {
|
|
36
|
+
__hooks?: ComponentHooks;
|
|
37
|
+
// Extend to include HookStates
|
|
38
|
+
_renderCallbacks?: Array<HookState | (() => void)>;
|
|
39
|
+
_hasScuFromHooks?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface VNode extends Omit<PreactVNode, '_component'> {
|
|
43
|
+
_mask?: [number, number];
|
|
44
|
+
_component?: Component; // Override with our specific Component type
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type HookState =
|
|
48
|
+
| EffectHookState
|
|
49
|
+
| MemoHookState
|
|
50
|
+
| ReducerHookState
|
|
51
|
+
| ContextHookState
|
|
52
|
+
| ErrorBoundaryHookState
|
|
53
|
+
| IdHookState;
|
|
54
|
+
|
|
55
|
+
interface BaseHookState {
|
|
56
|
+
_value?: unknown;
|
|
57
|
+
_nextValue?: unknown;
|
|
58
|
+
_pendingValue?: unknown;
|
|
59
|
+
_args?: unknown;
|
|
60
|
+
_pendingArgs?: unknown;
|
|
61
|
+
_component?: unknown;
|
|
62
|
+
_cleanup?: unknown;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type Effect = () => void | Cleanup;
|
|
66
|
+
export type Cleanup = () => void;
|
|
67
|
+
|
|
68
|
+
export interface EffectHookState extends BaseHookState {
|
|
69
|
+
_value?: Effect;
|
|
70
|
+
_args?: unknown[];
|
|
71
|
+
_pendingArgs?: unknown[];
|
|
72
|
+
_cleanup?: Cleanup | void;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface MemoHookState<T = unknown> extends BaseHookState {
|
|
76
|
+
_value?: T;
|
|
77
|
+
_pendingValue?: T;
|
|
78
|
+
_args?: unknown[];
|
|
79
|
+
_pendingArgs?: unknown[];
|
|
80
|
+
_factory?: () => T;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface ReducerHookState<S = unknown, A = unknown>
|
|
84
|
+
extends BaseHookState {
|
|
85
|
+
_nextValue?: [S, StateUpdater<S>];
|
|
86
|
+
_value?: [S, StateUpdater<S>];
|
|
87
|
+
_component?: Component;
|
|
88
|
+
_reducer?: Reducer<S, A>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface ContextHookState extends BaseHookState {
|
|
92
|
+
/** Whether this hooks as subscribed to updates yet */
|
|
93
|
+
_value?: boolean;
|
|
94
|
+
_context?: PreactContext;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface ErrorBoundaryHookState extends BaseHookState {
|
|
98
|
+
_value?: (error: unknown, errorInfo: ErrorInfo) => void;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface IdHookState extends BaseHookState {
|
|
102
|
+
_value?: string;
|
|
103
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var r=require("preact"),e=/["&<]/;function t(r){if(0===r.length||!1===e.test(r))return r;for(var t=0,n=0,o="",f="";n<r.length;n++){switch(r.charCodeAt(n)){case 34:f=""";break;case 38:f="&";break;case 60:f="<";break;default:continue}n!==t&&(o+=r.slice(t,n)),o+=f,t=n+1}return n!==t&&(o+=r.slice(t,n)),o}var n=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,o=0,f=Array.isArray;function u(e,t,n,f,u,i){t||(t={});var c,a,p=t;if("ref"in p)for(a in p={},t)"ref"==a?c=t[a]:p[a]=t[a];var l={type:e,props:p,key:n,ref:c,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--o,__i:-1,__u:0,__source:u,__self:i};if("function"==typeof e&&(c=e.defaultProps))for(a in c)void 0===p[a]&&(p[a]=c[a]);return r.options.vnode&&r.options.vnode(l),l}var i={},c=/[A-Z]/g;Object.defineProperty(exports,"Fragment",{enumerable:!0,get:function(){return r.Fragment}}),exports.jsx=u,exports.jsxAttr=function(e,o){if(r.options.attr){var f=r.options.attr(e,o);if("string"==typeof f)return f}if(o=function(r){return null!==r&&"object"==typeof r&&"function"==typeof r.valueOf?r.valueOf():r}(o),"ref"===e||"key"===e)return"";if("style"===e&&"object"==typeof o){var u="";for(var a in o){var p=o[a];if(null!=p&&""!==p){var l="-"==a[0]?a:i[a]||(i[a]=a.replace(c,"-$&").toLowerCase()),s=";";"number"!=typeof p||l.startsWith("--")||n.test(l)||(s="px;"),u=u+l+":"+p+s}}return e+'="'+t(u)+'"'}return null==o||!1===o||"function"==typeof o||"object"==typeof o?"":!0===o?e:e+'="'+t(""+o)+'"'},exports.jsxDEV=u,exports.jsxEscape=function r(e){if(null==e||"boolean"==typeof e||"function"==typeof e)return null;if("object"==typeof e){if(void 0===e.constructor)return e;if(f(e)){for(var n=0;n<e.length;n++)e[n]=r(e[n]);return e}}return t(""+e)},exports.jsxTemplate=function(e){var t=u(r.Fragment,{tpl:e,exprs:[].slice.call(arguments,1)});return t.key=t.__v,t},exports.jsxs=u;
|
|
2
|
+
//# sourceMappingURL=jsxRuntime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsxRuntime.js","sources":["../src/utils.js","../../src/constants.js","../src/index.js"],"sourcesContent":["const ENCODED_ENTITIES = /[\"&<]/;\n\n/** @param {string} str */\nexport function encodeEntities(str) {\n\t// Skip all work for strings with no entities needing encoding:\n\tif (str.length === 0 || ENCODED_ENTITIES.test(str) === false) return str;\n\n\tlet last = 0,\n\t\ti = 0,\n\t\tout = '',\n\t\tch = '';\n\n\t// Seek forward in str until the next entity char:\n\tfor (; i < str.length; i++) {\n\t\tswitch (str.charCodeAt(i)) {\n\t\t\tcase 34:\n\t\t\t\tch = '"';\n\t\t\t\tbreak;\n\t\t\tcase 38:\n\t\t\t\tch = '&';\n\t\t\t\tbreak;\n\t\t\tcase 60:\n\t\t\t\tch = '<';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tcontinue;\n\t\t}\n\t\t// Append skipped/buffered characters and the encoded entity:\n\t\tif (i !== last) out += str.slice(last, i);\n\t\tout += ch;\n\t\t// Start the next seek/buffer after the entity's offset:\n\t\tlast = i + 1;\n\t}\n\tif (i !== last) out += str.slice(last, i);\n\treturn out;\n}\n","/** Normal hydration that attaches to a DOM tree but does not diff it. */\nexport const MODE_HYDRATE = 1 << 5;\n/** Signifies this VNode suspended on the previous render */\nexport const MODE_SUSPENDED = 1 << 7;\n/** Indicates that this node needs to be inserted while patching children */\nexport const INSERT_VNODE = 1 << 2;\n/** Indicates a VNode has been matched with another VNode in the diff */\nexport const MATCHED = 1 << 1;\n\n/** Reset all mode flags */\nexport const RESET_MODE = ~(MODE_HYDRATE | MODE_SUSPENDED);\n\nexport const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\nexport const XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\nexport const MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n\nexport const NULL = null;\nexport const UNDEFINED = undefined;\nexport const EMPTY_OBJ = /** @type {any} */ ({});\nexport const EMPTY_ARR = [];\nexport const IS_NON_DIMENSIONAL =\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n","import { options, Fragment } from 'preact';\nimport { encodeEntities } from './utils';\nimport { IS_NON_DIMENSIONAL } from '../../src/constants';\n\nlet vnodeId = 0;\n\nconst isArray = Array.isArray;\n\n/**\n * @fileoverview\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\n * - jsx(type, props, key)\n * - jsxs(type, props, key)\n * - jsxDEV(type, props, key, __source, __self)\n *\n * The implementation of createVNode here is optimized for performance.\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\n */\n\n/**\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\n * @param {VNode['type']} type\n * @param {VNode['props']} props\n * @param {VNode['key']} [key]\n * @param {unknown} [isStaticChildren]\n * @param {unknown} [__source]\n * @param {unknown} [__self]\n */\nfunction createVNode(type, props, key, isStaticChildren, __source, __self) {\n\tif (!props) props = {};\n\t// We'll want to preserve `ref` in props to get rid of the need for\n\t// forwardRef components in the future, but that should happen via\n\t// a separate PR.\n\tlet normalizedProps = props,\n\t\tref,\n\t\ti;\n\n\tif ('ref' in normalizedProps) {\n\t\tnormalizedProps = {};\n\t\tfor (i in props) {\n\t\t\tif (i == 'ref') {\n\t\t\t\tref = props[i];\n\t\t\t} else {\n\t\t\t\tnormalizedProps[i] = props[i];\n\t\t\t}\n\t\t}\n\t}\n\n\t/** @type {VNode & { __source: any; __self: any }} */\n\tconst vnode = {\n\t\ttype,\n\t\tprops: normalizedProps,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t_component: null,\n\t\tconstructor: undefined,\n\t\t_original: --vnodeId,\n\t\t_index: -1,\n\t\t_flags: 0,\n\t\t__source,\n\t\t__self\n\t};\n\n\t// If a Component VNode, check for and apply defaultProps.\n\t// Note: `type` is often a String, and can be `undefined` in development.\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\n\t\tfor (i in ref)\n\t\t\tif (normalizedProps[i] === undefined) {\n\t\t\t\tnormalizedProps[i] = ref[i];\n\t\t\t}\n\t}\n\n\tif (options.vnode) options.vnode(vnode);\n\treturn vnode;\n}\n\n/**\n * Create a template vnode. This function is not expected to be\n * used directly, but rather through a precompile JSX transform\n * @param {string[]} templates\n * @param {Array<string | null | VNode>} exprs\n * @returns {VNode}\n */\nfunction jsxTemplate(templates, ...exprs) {\n\tconst vnode = createVNode(Fragment, { tpl: templates, exprs });\n\t// Bypass render to string top level Fragment optimization\n\tvnode.key = vnode._vnode;\n\treturn vnode;\n}\n\nconst JS_TO_CSS = {};\nconst CSS_REGEX = /[A-Z]/g;\n\n/**\n * Unwrap potential signals.\n * @param {*} value\n * @returns {*}\n */\nfunction normalizeAttrValue(value) {\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.valueOf === 'function'\n\t\t? value.valueOf()\n\t\t: value;\n}\n\n/**\n * Serialize an HTML attribute to a string. This function is not\n * expected to be used directly, but rather through a precompile\n * JSX transform\n * @param {string} name The attribute name\n * @param {*} value The attribute value\n * @returns {string}\n */\nfunction jsxAttr(name, value) {\n\tif (options.attr) {\n\t\tconst result = options.attr(name, value);\n\t\tif (typeof result === 'string') return result;\n\t}\n\n\tvalue = normalizeAttrValue(value);\n\n\tif (name === 'ref' || name === 'key') return '';\n\tif (name === 'style' && typeof value === 'object') {\n\t\tlet str = '';\n\t\tfor (let prop in value) {\n\t\t\tlet val = value[prop];\n\t\t\tif (val != null && val !== '') {\n\t\t\t\tconst name =\n\t\t\t\t\tprop[0] == '-'\n\t\t\t\t\t\t? prop\n\t\t\t\t\t\t: JS_TO_CSS[prop] ||\n\t\t\t\t\t\t\t(JS_TO_CSS[prop] = prop.replace(CSS_REGEX, '-$&').toLowerCase());\n\n\t\t\t\tlet suffix = ';';\n\t\t\t\tif (\n\t\t\t\t\ttypeof val === 'number' &&\n\t\t\t\t\t// Exclude custom-attributes\n\t\t\t\t\t!name.startsWith('--') &&\n\t\t\t\t\t!IS_NON_DIMENSIONAL.test(name)\n\t\t\t\t) {\n\t\t\t\t\tsuffix = 'px;';\n\t\t\t\t}\n\t\t\t\tstr = str + name + ':' + val + suffix;\n\t\t\t}\n\t\t}\n\t\treturn name + '=\"' + encodeEntities(str) + '\"';\n\t}\n\n\tif (\n\t\tvalue == null ||\n\t\tvalue === false ||\n\t\ttypeof value === 'function' ||\n\t\ttypeof value === 'object'\n\t) {\n\t\treturn '';\n\t} else if (value === true) return name;\n\n\treturn name + '=\"' + encodeEntities('' + value) + '\"';\n}\n\n/**\n * Escape a dynamic child passed to `jsxTemplate`. This function\n * is not expected to be used directly, but rather through a\n * precompile JSX transform\n * @param {*} value\n * @returns {string | null | VNode | Array<string | null | VNode>}\n */\nfunction jsxEscape(value) {\n\tif (\n\t\tvalue == null ||\n\t\ttypeof value === 'boolean' ||\n\t\ttypeof value === 'function'\n\t) {\n\t\treturn null;\n\t}\n\n\tif (typeof value === 'object') {\n\t\t// Check for VNode\n\t\tif (value.constructor === undefined) return value;\n\n\t\tif (isArray(value)) {\n\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\tvalue[i] = jsxEscape(value[i]);\n\t\t\t}\n\t\t\treturn value;\n\t\t}\n\t}\n\n\treturn encodeEntities('' + value);\n}\n\nexport {\n\tcreateVNode as jsx,\n\tcreateVNode as jsxs,\n\tcreateVNode as jsxDEV,\n\tFragment,\n\t// precompiled JSX transform\n\tjsxTemplate,\n\tjsxAttr,\n\tjsxEscape\n};\n"],"names":["ENCODED_ENTITIES","encodeEntities","str","length","test","last","i","out","ch","charCodeAt","slice","IS_NON_DIMENSIONAL","vnodeId","isArray","Array","createVNode","type","props","key","isStaticChildren","__source","__self","ref","normalizedProps","vnode","__k","__","__b","__e","__c","constructor","undefined","__v","__i","__u","defaultProps","options","JS_TO_CSS","CSS_REGEX","name","value","attr","result","valueOf","normalizeAttrValue","prop","val","replace","toLowerCase","suffix","startsWith","jsxEscape","templates","Fragment","tpl","exprs","call","arguments"],"mappings":"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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{options as r,Fragment as e}from"preact";export{Fragment}from"preact";var t=/["&<]/;function n(r){if(0===r.length||!1===t.test(r))return r;for(var e=0,n=0,o="",f="";n<r.length;n++){switch(r.charCodeAt(n)){case 34:f=""";break;case 38:f="&";break;case 60:f="<";break;default:continue}n!==e&&(o+=r.slice(e,n)),o+=f,e=n+1}return n!==e&&(o+=r.slice(e,n)),o}var o=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,f=0,i=Array.isArray;function u(e,t,n,o,i,u){t||(t={});var a,c,p=t;if("ref"in p)for(c in p={},t)"ref"==c?a=t[c]:p[c]=t[c];var l={type:e,props:p,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--f,__i:-1,__u:0,__source:i,__self:u};if("function"==typeof e&&(a=e.defaultProps))for(c in a)void 0===p[c]&&(p[c]=a[c]);return r.vnode&&r.vnode(l),l}function a(r){var t=u(e,{tpl:r,exprs:[].slice.call(arguments,1)});return t.key=t.__v,t}var c={},p=/[A-Z]/g;function l(e,t){if(r.attr){var f=r.attr(e,t);if("string"==typeof f)return f}if(t=function(r){return null!==r&&"object"==typeof r&&"function"==typeof r.valueOf?r.valueOf():r}(t),"ref"===e||"key"===e)return"";if("style"===e&&"object"==typeof t){var i="";for(var u in t){var a=t[u];if(null!=a&&""!==a){var l="-"==u[0]?u:c[u]||(c[u]=u.replace(p,"-$&").toLowerCase()),s=";";"number"!=typeof a||l.startsWith("--")||o.test(l)||(s="px;"),i=i+l+":"+a+s}}return e+'="'+n(i)+'"'}return null==t||!1===t||"function"==typeof t||"object"==typeof t?"":!0===t?e:e+'="'+n(""+t)+'"'}function s(r){if(null==r||"boolean"==typeof r||"function"==typeof r)return null;if("object"==typeof r){if(void 0===r.constructor)return r;if(i(r)){for(var e=0;e<r.length;e++)r[e]=s(r[e]);return r}}return n(""+r)}export{u as jsx,l as jsxAttr,u as jsxDEV,s as jsxEscape,a as jsxTemplate,u as jsxs};
|
|
2
|
+
//# sourceMappingURL=jsxRuntime.module.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{options as r,Fragment as e}from"preact";export{Fragment}from"preact";var t=/["&<]/;function n(r){if(0===r.length||!1===t.test(r))return r;for(var e=0,n=0,o="",f="";n<r.length;n++){switch(r.charCodeAt(n)){case 34:f=""";break;case 38:f="&";break;case 60:f="<";break;default:continue}n!==e&&(o+=r.slice(e,n)),o+=f,e=n+1}return n!==e&&(o+=r.slice(e,n)),o}var o=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,f=0,i=Array.isArray;function u(e,t,n,o,i,u){t||(t={});var a,c,p=t;if("ref"in p)for(c in p={},t)"ref"==c?a=t[c]:p[c]=t[c];var l={type:e,props:p,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--f,__i:-1,__u:0,__source:i,__self:u};if("function"==typeof e&&(a=e.defaultProps))for(c in a)void 0===p[c]&&(p[c]=a[c]);return r.vnode&&r.vnode(l),l}function a(r){var t=u(e,{tpl:r,exprs:[].slice.call(arguments,1)});return t.key=t.__v,t}var c={},p=/[A-Z]/g;function l(e,t){if(r.attr){var f=r.attr(e,t);if("string"==typeof f)return f}if(t=function(r){return null!==r&&"object"==typeof r&&"function"==typeof r.valueOf?r.valueOf():r}(t),"ref"===e||"key"===e)return"";if("style"===e&&"object"==typeof t){var i="";for(var u in t){var a=t[u];if(null!=a&&""!==a){var l="-"==u[0]?u:c[u]||(c[u]=u.replace(p,"-$&").toLowerCase()),s=";";"number"!=typeof a||l.startsWith("--")||o.test(l)||(s="px;"),i=i+l+":"+a+s}}return e+'="'+n(i)+'"'}return null==t||!1===t||"function"==typeof t||"object"==typeof t?"":!0===t?e:e+'="'+n(""+t)+'"'}function s(r){if(null==r||"boolean"==typeof r||"function"==typeof r)return null;if("object"==typeof r){if(void 0===r.constructor)return r;if(i(r)){for(var e=0;e<r.length;e++)r[e]=s(r[e]);return r}}return n(""+r)}export{u as jsx,l as jsxAttr,u as jsxDEV,s as jsxEscape,a as jsxTemplate,u as jsxs};
|
|
2
|
+
//# sourceMappingURL=jsxRuntime.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsxRuntime.module.js","sources":["../src/utils.js","../../src/constants.js","../src/index.js"],"sourcesContent":["const ENCODED_ENTITIES = /[\"&<]/;\n\n/** @param {string} str */\nexport function encodeEntities(str) {\n\t// Skip all work for strings with no entities needing encoding:\n\tif (str.length === 0 || ENCODED_ENTITIES.test(str) === false) return str;\n\n\tlet last = 0,\n\t\ti = 0,\n\t\tout = '',\n\t\tch = '';\n\n\t// Seek forward in str until the next entity char:\n\tfor (; i < str.length; i++) {\n\t\tswitch (str.charCodeAt(i)) {\n\t\t\tcase 34:\n\t\t\t\tch = '"';\n\t\t\t\tbreak;\n\t\t\tcase 38:\n\t\t\t\tch = '&';\n\t\t\t\tbreak;\n\t\t\tcase 60:\n\t\t\t\tch = '<';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tcontinue;\n\t\t}\n\t\t// Append skipped/buffered characters and the encoded entity:\n\t\tif (i !== last) out += str.slice(last, i);\n\t\tout += ch;\n\t\t// Start the next seek/buffer after the entity's offset:\n\t\tlast = i + 1;\n\t}\n\tif (i !== last) out += str.slice(last, i);\n\treturn out;\n}\n","/** Normal hydration that attaches to a DOM tree but does not diff it. */\nexport const MODE_HYDRATE = 1 << 5;\n/** Signifies this VNode suspended on the previous render */\nexport const MODE_SUSPENDED = 1 << 7;\n/** Indicates that this node needs to be inserted while patching children */\nexport const INSERT_VNODE = 1 << 2;\n/** Indicates a VNode has been matched with another VNode in the diff */\nexport const MATCHED = 1 << 1;\n\n/** Reset all mode flags */\nexport const RESET_MODE = ~(MODE_HYDRATE | MODE_SUSPENDED);\n\nexport const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\nexport const XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\nexport const MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n\nexport const NULL = null;\nexport const UNDEFINED = undefined;\nexport const EMPTY_OBJ = /** @type {any} */ ({});\nexport const EMPTY_ARR = [];\nexport const IS_NON_DIMENSIONAL =\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n","import { options, Fragment } from 'preact';\nimport { encodeEntities } from './utils';\nimport { IS_NON_DIMENSIONAL } from '../../src/constants';\n\nlet vnodeId = 0;\n\nconst isArray = Array.isArray;\n\n/**\n * @fileoverview\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\n * - jsx(type, props, key)\n * - jsxs(type, props, key)\n * - jsxDEV(type, props, key, __source, __self)\n *\n * The implementation of createVNode here is optimized for performance.\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\n */\n\n/**\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\n * @param {VNode['type']} type\n * @param {VNode['props']} props\n * @param {VNode['key']} [key]\n * @param {unknown} [isStaticChildren]\n * @param {unknown} [__source]\n * @param {unknown} [__self]\n */\nfunction createVNode(type, props, key, isStaticChildren, __source, __self) {\n\tif (!props) props = {};\n\t// We'll want to preserve `ref` in props to get rid of the need for\n\t// forwardRef components in the future, but that should happen via\n\t// a separate PR.\n\tlet normalizedProps = props,\n\t\tref,\n\t\ti;\n\n\tif ('ref' in normalizedProps) {\n\t\tnormalizedProps = {};\n\t\tfor (i in props) {\n\t\t\tif (i == 'ref') {\n\t\t\t\tref = props[i];\n\t\t\t} else {\n\t\t\t\tnormalizedProps[i] = props[i];\n\t\t\t}\n\t\t}\n\t}\n\n\t/** @type {VNode & { __source: any; __self: any }} */\n\tconst vnode = {\n\t\ttype,\n\t\tprops: normalizedProps,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t_component: null,\n\t\tconstructor: undefined,\n\t\t_original: --vnodeId,\n\t\t_index: -1,\n\t\t_flags: 0,\n\t\t__source,\n\t\t__self\n\t};\n\n\t// If a Component VNode, check for and apply defaultProps.\n\t// Note: `type` is often a String, and can be `undefined` in development.\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\n\t\tfor (i in ref)\n\t\t\tif (normalizedProps[i] === undefined) {\n\t\t\t\tnormalizedProps[i] = ref[i];\n\t\t\t}\n\t}\n\n\tif (options.vnode) options.vnode(vnode);\n\treturn vnode;\n}\n\n/**\n * Create a template vnode. This function is not expected to be\n * used directly, but rather through a precompile JSX transform\n * @param {string[]} templates\n * @param {Array<string | null | VNode>} exprs\n * @returns {VNode}\n */\nfunction jsxTemplate(templates, ...exprs) {\n\tconst vnode = createVNode(Fragment, { tpl: templates, exprs });\n\t// Bypass render to string top level Fragment optimization\n\tvnode.key = vnode._vnode;\n\treturn vnode;\n}\n\nconst JS_TO_CSS = {};\nconst CSS_REGEX = /[A-Z]/g;\n\n/**\n * Unwrap potential signals.\n * @param {*} value\n * @returns {*}\n */\nfunction normalizeAttrValue(value) {\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.valueOf === 'function'\n\t\t? value.valueOf()\n\t\t: value;\n}\n\n/**\n * Serialize an HTML attribute to a string. This function is not\n * expected to be used directly, but rather through a precompile\n * JSX transform\n * @param {string} name The attribute name\n * @param {*} value The attribute value\n * @returns {string}\n */\nfunction jsxAttr(name, value) {\n\tif (options.attr) {\n\t\tconst result = options.attr(name, value);\n\t\tif (typeof result === 'string') return result;\n\t}\n\n\tvalue = normalizeAttrValue(value);\n\n\tif (name === 'ref' || name === 'key') return '';\n\tif (name === 'style' && typeof value === 'object') {\n\t\tlet str = '';\n\t\tfor (let prop in value) {\n\t\t\tlet val = value[prop];\n\t\t\tif (val != null && val !== '') {\n\t\t\t\tconst name =\n\t\t\t\t\tprop[0] == '-'\n\t\t\t\t\t\t? prop\n\t\t\t\t\t\t: JS_TO_CSS[prop] ||\n\t\t\t\t\t\t\t(JS_TO_CSS[prop] = prop.replace(CSS_REGEX, '-$&').toLowerCase());\n\n\t\t\t\tlet suffix = ';';\n\t\t\t\tif (\n\t\t\t\t\ttypeof val === 'number' &&\n\t\t\t\t\t// Exclude custom-attributes\n\t\t\t\t\t!name.startsWith('--') &&\n\t\t\t\t\t!IS_NON_DIMENSIONAL.test(name)\n\t\t\t\t) {\n\t\t\t\t\tsuffix = 'px;';\n\t\t\t\t}\n\t\t\t\tstr = str + name + ':' + val + suffix;\n\t\t\t}\n\t\t}\n\t\treturn name + '=\"' + encodeEntities(str) + '\"';\n\t}\n\n\tif (\n\t\tvalue == null ||\n\t\tvalue === false ||\n\t\ttypeof value === 'function' ||\n\t\ttypeof value === 'object'\n\t) {\n\t\treturn '';\n\t} else if (value === true) return name;\n\n\treturn name + '=\"' + encodeEntities('' + value) + '\"';\n}\n\n/**\n * Escape a dynamic child passed to `jsxTemplate`. This function\n * is not expected to be used directly, but rather through a\n * precompile JSX transform\n * @param {*} value\n * @returns {string | null | VNode | Array<string | null | VNode>}\n */\nfunction jsxEscape(value) {\n\tif (\n\t\tvalue == null ||\n\t\ttypeof value === 'boolean' ||\n\t\ttypeof value === 'function'\n\t) {\n\t\treturn null;\n\t}\n\n\tif (typeof value === 'object') {\n\t\t// Check for VNode\n\t\tif (value.constructor === undefined) return value;\n\n\t\tif (isArray(value)) {\n\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\tvalue[i] = jsxEscape(value[i]);\n\t\t\t}\n\t\t\treturn value;\n\t\t}\n\t}\n\n\treturn encodeEntities('' + value);\n}\n\nexport {\n\tcreateVNode as jsx,\n\tcreateVNode as jsxs,\n\tcreateVNode as jsxDEV,\n\tFragment,\n\t// precompiled JSX transform\n\tjsxTemplate,\n\tjsxAttr,\n\tjsxEscape\n};\n"],"names":["ENCODED_ENTITIES","encodeEntities","str","length","test","last","i","out","ch","charCodeAt","slice","IS_NON_DIMENSIONAL","vnodeId","isArray","Array","createVNode","type","props","key","isStaticChildren","__source","__self","ref","normalizedProps","vnode","__k","__","__b","__e","__c","constructor","undefined","__v","__i","__u","defaultProps","options","jsxTemplate","templates","Fragment","tpl","exprs","call","arguments","JS_TO_CSS","CSS_REGEX","jsxAttr","name","value","attr","result","valueOf","normalizeAttrValue","prop","val","replace","toLowerCase","suffix","startsWith","jsxEscape"],"mappings":"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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],r):r((e||self).jsxRuntime={},e.preact)}(this,function(e,r){var n=/["&<]/;function t(e){if(0===e.length||!1===n.test(e))return e;for(var r=0,t=0,o="",f="";t<e.length;t++){switch(e.charCodeAt(t)){case 34:f=""";break;case 38:f="&";break;case 60:f="<";break;default:continue}t!==r&&(o+=e.slice(r,t)),o+=f,r=t+1}return t!==r&&(o+=e.slice(r,t)),o}var o=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,f=0,i=Array.isArray;function u(e,n,t,o,i,u){n||(n={});var c,a,l=n;if("ref"in l)for(a in l={},n)"ref"==a?c=n[a]:l[a]=n[a];var p={type:e,props:l,key:t,ref:c,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--f,__i:-1,__u:0,__source:i,__self:u};if("function"==typeof e&&(c=e.defaultProps))for(a in c)void 0===l[a]&&(l[a]=c[a]);return r.options.vnode&&r.options.vnode(p),p}var c={},a=/[A-Z]/g;Object.defineProperty(e,"Fragment",{enumerable:!0,get:function(){return r.Fragment}}),e.jsx=u,e.jsxAttr=function(e,n){if(r.options.attr){var f=r.options.attr(e,n);if("string"==typeof f)return f}if(n=function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.valueOf?e.valueOf():e}(n),"ref"===e||"key"===e)return"";if("style"===e&&"object"==typeof n){var i="";for(var u in n){var l=n[u];if(null!=l&&""!==l){var p="-"==u[0]?u:c[u]||(c[u]=u.replace(a,"-$&").toLowerCase()),s=";";"number"!=typeof l||p.startsWith("--")||o.test(p)||(s="px;"),i=i+p+":"+l+s}}return e+'="'+t(i)+'"'}return null==n||!1===n||"function"==typeof n||"object"==typeof n?"":!0===n?e:e+'="'+t(""+n)+'"'},e.jsxDEV=u,e.jsxEscape=function e(r){if(null==r||"boolean"==typeof r||"function"==typeof r)return null;if("object"==typeof r){if(void 0===r.constructor)return r;if(i(r)){for(var n=0;n<r.length;n++)r[n]=e(r[n]);return r}}return t(""+r)},e.jsxTemplate=function(e){var n=u(r.Fragment,{tpl:e,exprs:[].slice.call(arguments,1)});return n.key=n.__v,n},e.jsxs=u});
|
|
2
|
+
//# sourceMappingURL=jsxRuntime.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsxRuntime.umd.js","sources":["../src/utils.js","../../src/constants.js","../src/index.js"],"sourcesContent":["const ENCODED_ENTITIES = /[\"&<]/;\n\n/** @param {string} str */\nexport function encodeEntities(str) {\n\t// Skip all work for strings with no entities needing encoding:\n\tif (str.length === 0 || ENCODED_ENTITIES.test(str) === false) return str;\n\n\tlet last = 0,\n\t\ti = 0,\n\t\tout = '',\n\t\tch = '';\n\n\t// Seek forward in str until the next entity char:\n\tfor (; i < str.length; i++) {\n\t\tswitch (str.charCodeAt(i)) {\n\t\t\tcase 34:\n\t\t\t\tch = '"';\n\t\t\t\tbreak;\n\t\t\tcase 38:\n\t\t\t\tch = '&';\n\t\t\t\tbreak;\n\t\t\tcase 60:\n\t\t\t\tch = '<';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tcontinue;\n\t\t}\n\t\t// Append skipped/buffered characters and the encoded entity:\n\t\tif (i !== last) out += str.slice(last, i);\n\t\tout += ch;\n\t\t// Start the next seek/buffer after the entity's offset:\n\t\tlast = i + 1;\n\t}\n\tif (i !== last) out += str.slice(last, i);\n\treturn out;\n}\n","/** Normal hydration that attaches to a DOM tree but does not diff it. */\nexport const MODE_HYDRATE = 1 << 5;\n/** Signifies this VNode suspended on the previous render */\nexport const MODE_SUSPENDED = 1 << 7;\n/** Indicates that this node needs to be inserted while patching children */\nexport const INSERT_VNODE = 1 << 2;\n/** Indicates a VNode has been matched with another VNode in the diff */\nexport const MATCHED = 1 << 1;\n\n/** Reset all mode flags */\nexport const RESET_MODE = ~(MODE_HYDRATE | MODE_SUSPENDED);\n\nexport const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\nexport const XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\nexport const MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n\nexport const NULL = null;\nexport const UNDEFINED = undefined;\nexport const EMPTY_OBJ = /** @type {any} */ ({});\nexport const EMPTY_ARR = [];\nexport const IS_NON_DIMENSIONAL =\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n","import { options, Fragment } from 'preact';\nimport { encodeEntities } from './utils';\nimport { IS_NON_DIMENSIONAL } from '../../src/constants';\n\nlet vnodeId = 0;\n\nconst isArray = Array.isArray;\n\n/**\n * @fileoverview\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\n * - jsx(type, props, key)\n * - jsxs(type, props, key)\n * - jsxDEV(type, props, key, __source, __self)\n *\n * The implementation of createVNode here is optimized for performance.\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\n */\n\n/**\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\n * @param {VNode['type']} type\n * @param {VNode['props']} props\n * @param {VNode['key']} [key]\n * @param {unknown} [isStaticChildren]\n * @param {unknown} [__source]\n * @param {unknown} [__self]\n */\nfunction createVNode(type, props, key, isStaticChildren, __source, __self) {\n\tif (!props) props = {};\n\t// We'll want to preserve `ref` in props to get rid of the need for\n\t// forwardRef components in the future, but that should happen via\n\t// a separate PR.\n\tlet normalizedProps = props,\n\t\tref,\n\t\ti;\n\n\tif ('ref' in normalizedProps) {\n\t\tnormalizedProps = {};\n\t\tfor (i in props) {\n\t\t\tif (i == 'ref') {\n\t\t\t\tref = props[i];\n\t\t\t} else {\n\t\t\t\tnormalizedProps[i] = props[i];\n\t\t\t}\n\t\t}\n\t}\n\n\t/** @type {VNode & { __source: any; __self: any }} */\n\tconst vnode = {\n\t\ttype,\n\t\tprops: normalizedProps,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t_component: null,\n\t\tconstructor: undefined,\n\t\t_original: --vnodeId,\n\t\t_index: -1,\n\t\t_flags: 0,\n\t\t__source,\n\t\t__self\n\t};\n\n\t// If a Component VNode, check for and apply defaultProps.\n\t// Note: `type` is often a String, and can be `undefined` in development.\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\n\t\tfor (i in ref)\n\t\t\tif (normalizedProps[i] === undefined) {\n\t\t\t\tnormalizedProps[i] = ref[i];\n\t\t\t}\n\t}\n\n\tif (options.vnode) options.vnode(vnode);\n\treturn vnode;\n}\n\n/**\n * Create a template vnode. This function is not expected to be\n * used directly, but rather through a precompile JSX transform\n * @param {string[]} templates\n * @param {Array<string | null | VNode>} exprs\n * @returns {VNode}\n */\nfunction jsxTemplate(templates, ...exprs) {\n\tconst vnode = createVNode(Fragment, { tpl: templates, exprs });\n\t// Bypass render to string top level Fragment optimization\n\tvnode.key = vnode._vnode;\n\treturn vnode;\n}\n\nconst JS_TO_CSS = {};\nconst CSS_REGEX = /[A-Z]/g;\n\n/**\n * Unwrap potential signals.\n * @param {*} value\n * @returns {*}\n */\nfunction normalizeAttrValue(value) {\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.valueOf === 'function'\n\t\t? value.valueOf()\n\t\t: value;\n}\n\n/**\n * Serialize an HTML attribute to a string. This function is not\n * expected to be used directly, but rather through a precompile\n * JSX transform\n * @param {string} name The attribute name\n * @param {*} value The attribute value\n * @returns {string}\n */\nfunction jsxAttr(name, value) {\n\tif (options.attr) {\n\t\tconst result = options.attr(name, value);\n\t\tif (typeof result === 'string') return result;\n\t}\n\n\tvalue = normalizeAttrValue(value);\n\n\tif (name === 'ref' || name === 'key') return '';\n\tif (name === 'style' && typeof value === 'object') {\n\t\tlet str = '';\n\t\tfor (let prop in value) {\n\t\t\tlet val = value[prop];\n\t\t\tif (val != null && val !== '') {\n\t\t\t\tconst name =\n\t\t\t\t\tprop[0] == '-'\n\t\t\t\t\t\t? prop\n\t\t\t\t\t\t: JS_TO_CSS[prop] ||\n\t\t\t\t\t\t\t(JS_TO_CSS[prop] = prop.replace(CSS_REGEX, '-$&').toLowerCase());\n\n\t\t\t\tlet suffix = ';';\n\t\t\t\tif (\n\t\t\t\t\ttypeof val === 'number' &&\n\t\t\t\t\t// Exclude custom-attributes\n\t\t\t\t\t!name.startsWith('--') &&\n\t\t\t\t\t!IS_NON_DIMENSIONAL.test(name)\n\t\t\t\t) {\n\t\t\t\t\tsuffix = 'px;';\n\t\t\t\t}\n\t\t\t\tstr = str + name + ':' + val + suffix;\n\t\t\t}\n\t\t}\n\t\treturn name + '=\"' + encodeEntities(str) + '\"';\n\t}\n\n\tif (\n\t\tvalue == null ||\n\t\tvalue === false ||\n\t\ttypeof value === 'function' ||\n\t\ttypeof value === 'object'\n\t) {\n\t\treturn '';\n\t} else if (value === true) return name;\n\n\treturn name + '=\"' + encodeEntities('' + value) + '\"';\n}\n\n/**\n * Escape a dynamic child passed to `jsxTemplate`. This function\n * is not expected to be used directly, but rather through a\n * precompile JSX transform\n * @param {*} value\n * @returns {string | null | VNode | Array<string | null | VNode>}\n */\nfunction jsxEscape(value) {\n\tif (\n\t\tvalue == null ||\n\t\ttypeof value === 'boolean' ||\n\t\ttypeof value === 'function'\n\t) {\n\t\treturn null;\n\t}\n\n\tif (typeof value === 'object') {\n\t\t// Check for VNode\n\t\tif (value.constructor === undefined) return value;\n\n\t\tif (isArray(value)) {\n\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\tvalue[i] = jsxEscape(value[i]);\n\t\t\t}\n\t\t\treturn value;\n\t\t}\n\t}\n\n\treturn encodeEntities('' + value);\n}\n\nexport {\n\tcreateVNode as jsx,\n\tcreateVNode as jsxs,\n\tcreateVNode as jsxDEV,\n\tFragment,\n\t// precompiled JSX transform\n\tjsxTemplate,\n\tjsxAttr,\n\tjsxEscape\n};\n"],"names":["ENCODED_ENTITIES","encodeEntities","str","length","test","last","i","out","ch","charCodeAt","slice","IS_NON_DIMENSIONAL","vnodeId","isArray","Array","createVNode","type","props","key","isStaticChildren","__source","__self","ref","normalizedProps","vnode","__k","__","__b","__e","__c","constructor","undefined","__v","__i","__u","defaultProps","options","JS_TO_CSS","CSS_REGEX","name","value","attr","result","valueOf","normalizeAttrValue","prop","val","replace","toLowerCase","suffix","startsWith","jsxEscape","templates","Fragment","tpl","exprs","call","arguments"],"mappings":"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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jsx-runtime",
|
|
3
|
+
"amdName": "jsxRuntime",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"private": true,
|
|
6
|
+
"description": "Preact JSX runtime",
|
|
7
|
+
"main": "dist/jsxRuntime.js",
|
|
8
|
+
"module": "dist/jsxRuntime.module.js",
|
|
9
|
+
"umd:main": "dist/jsxRuntime.umd.js",
|
|
10
|
+
"source": "src/index.js",
|
|
11
|
+
"types": "src/index.d.ts",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"preact": "^10.0.0"
|
|
15
|
+
},
|
|
16
|
+
"mangle": {
|
|
17
|
+
"regex": "^_"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./src/index.d.ts",
|
|
22
|
+
"browser": "./dist/jsxRuntime.module.js",
|
|
23
|
+
"umd": "./dist/jsxRuntime.umd.js",
|
|
24
|
+
"import": "./dist/jsxRuntime.mjs",
|
|
25
|
+
"require": "./dist/jsxRuntime.js"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Intentionally not using a relative path to take advantage of
|
|
2
|
+
// the TS version resolution mechanism
|
|
3
|
+
export { Fragment } from 'preact';
|
|
4
|
+
import {
|
|
5
|
+
ComponentType,
|
|
6
|
+
ComponentChild,
|
|
7
|
+
ComponentChildren,
|
|
8
|
+
VNode,
|
|
9
|
+
Attributes
|
|
10
|
+
} from 'preact';
|
|
11
|
+
import { JSXInternal } from '../../src/jsx';
|
|
12
|
+
|
|
13
|
+
export function jsx(
|
|
14
|
+
type: string,
|
|
15
|
+
props: JSXInternal.HTMLAttributes &
|
|
16
|
+
JSXInternal.SVGAttributes &
|
|
17
|
+
Record<string, any> & { children?: ComponentChild },
|
|
18
|
+
key?: string
|
|
19
|
+
): VNode<any>;
|
|
20
|
+
export function jsx<P>(
|
|
21
|
+
type: ComponentType<P>,
|
|
22
|
+
props: Attributes & P & { children?: ComponentChild },
|
|
23
|
+
key?: string
|
|
24
|
+
): VNode<any>;
|
|
25
|
+
|
|
26
|
+
export function jsxs(
|
|
27
|
+
type: string,
|
|
28
|
+
props: JSXInternal.HTMLAttributes &
|
|
29
|
+
JSXInternal.SVGAttributes &
|
|
30
|
+
Record<string, any> & { children?: ComponentChild[] },
|
|
31
|
+
key?: string
|
|
32
|
+
): VNode<any>;
|
|
33
|
+
export function jsxs<P>(
|
|
34
|
+
type: ComponentType<P>,
|
|
35
|
+
props: Attributes & P & { children?: ComponentChild[] },
|
|
36
|
+
key?: string
|
|
37
|
+
): VNode<any>;
|
|
38
|
+
|
|
39
|
+
export function jsxDEV(
|
|
40
|
+
type: string,
|
|
41
|
+
props: JSXInternal.HTMLAttributes &
|
|
42
|
+
JSXInternal.SVGAttributes &
|
|
43
|
+
Record<string, any> & { children?: ComponentChildren },
|
|
44
|
+
key?: string
|
|
45
|
+
): VNode<any>;
|
|
46
|
+
export function jsxDEV<P>(
|
|
47
|
+
type: ComponentType<P>,
|
|
48
|
+
props: Attributes & P & { children?: ComponentChildren },
|
|
49
|
+
key?: string
|
|
50
|
+
): VNode<any>;
|
|
51
|
+
|
|
52
|
+
// These are not expected to be used manually, but by a JSX transform
|
|
53
|
+
export function jsxTemplate(
|
|
54
|
+
template: string[],
|
|
55
|
+
...expressions: any[]
|
|
56
|
+
): VNode<any>;
|
|
57
|
+
export function jsxAttr(name: string, value: any): string | null;
|
|
58
|
+
export function jsxEscape<T>(
|
|
59
|
+
value: T
|
|
60
|
+
): string | null | VNode<any> | Array<string | null | VNode>;
|
|
61
|
+
|
|
62
|
+
export { JSXInternal as JSX };
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { options, Fragment } from 'preact';
|
|
2
|
+
import { encodeEntities } from './utils';
|
|
3
|
+
import { IS_NON_DIMENSIONAL } from '../../src/constants';
|
|
4
|
+
|
|
5
|
+
let vnodeId = 0;
|
|
6
|
+
|
|
7
|
+
const isArray = Array.isArray;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @fileoverview
|
|
11
|
+
* This file exports various methods that implement Babel's "automatic" JSX runtime API:
|
|
12
|
+
* - jsx(type, props, key)
|
|
13
|
+
* - jsxs(type, props, key)
|
|
14
|
+
* - jsxDEV(type, props, key, __source, __self)
|
|
15
|
+
*
|
|
16
|
+
* The implementation of createVNode here is optimized for performance.
|
|
17
|
+
* Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* JSX.Element factory used by Babel's {runtime:"automatic"} JSX transform
|
|
22
|
+
* @param {VNode['type']} type
|
|
23
|
+
* @param {VNode['props']} props
|
|
24
|
+
* @param {VNode['key']} [key]
|
|
25
|
+
* @param {unknown} [isStaticChildren]
|
|
26
|
+
* @param {unknown} [__source]
|
|
27
|
+
* @param {unknown} [__self]
|
|
28
|
+
*/
|
|
29
|
+
function createVNode(type, props, key, isStaticChildren, __source, __self) {
|
|
30
|
+
if (!props) props = {};
|
|
31
|
+
// We'll want to preserve `ref` in props to get rid of the need for
|
|
32
|
+
// forwardRef components in the future, but that should happen via
|
|
33
|
+
// a separate PR.
|
|
34
|
+
let normalizedProps = props,
|
|
35
|
+
ref,
|
|
36
|
+
i;
|
|
37
|
+
|
|
38
|
+
if ('ref' in normalizedProps) {
|
|
39
|
+
normalizedProps = {};
|
|
40
|
+
for (i in props) {
|
|
41
|
+
if (i == 'ref') {
|
|
42
|
+
ref = props[i];
|
|
43
|
+
} else {
|
|
44
|
+
normalizedProps[i] = props[i];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** @type {VNode & { __source: any; __self: any }} */
|
|
50
|
+
const vnode = {
|
|
51
|
+
type,
|
|
52
|
+
props: normalizedProps,
|
|
53
|
+
key,
|
|
54
|
+
ref,
|
|
55
|
+
_children: null,
|
|
56
|
+
_parent: null,
|
|
57
|
+
_depth: 0,
|
|
58
|
+
_dom: null,
|
|
59
|
+
_component: null,
|
|
60
|
+
constructor: undefined,
|
|
61
|
+
_original: --vnodeId,
|
|
62
|
+
_index: -1,
|
|
63
|
+
_flags: 0,
|
|
64
|
+
__source,
|
|
65
|
+
__self
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// If a Component VNode, check for and apply defaultProps.
|
|
69
|
+
// Note: `type` is often a String, and can be `undefined` in development.
|
|
70
|
+
if (typeof type === 'function' && (ref = type.defaultProps)) {
|
|
71
|
+
for (i in ref)
|
|
72
|
+
if (normalizedProps[i] === undefined) {
|
|
73
|
+
normalizedProps[i] = ref[i];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (options.vnode) options.vnode(vnode);
|
|
78
|
+
return vnode;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Create a template vnode. This function is not expected to be
|
|
83
|
+
* used directly, but rather through a precompile JSX transform
|
|
84
|
+
* @param {string[]} templates
|
|
85
|
+
* @param {Array<string | null | VNode>} exprs
|
|
86
|
+
* @returns {VNode}
|
|
87
|
+
*/
|
|
88
|
+
function jsxTemplate(templates, ...exprs) {
|
|
89
|
+
const vnode = createVNode(Fragment, { tpl: templates, exprs });
|
|
90
|
+
// Bypass render to string top level Fragment optimization
|
|
91
|
+
vnode.key = vnode._vnode;
|
|
92
|
+
return vnode;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const JS_TO_CSS = {};
|
|
96
|
+
const CSS_REGEX = /[A-Z]/g;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Unwrap potential signals.
|
|
100
|
+
* @param {*} value
|
|
101
|
+
* @returns {*}
|
|
102
|
+
*/
|
|
103
|
+
function normalizeAttrValue(value) {
|
|
104
|
+
return value !== null &&
|
|
105
|
+
typeof value === 'object' &&
|
|
106
|
+
typeof value.valueOf === 'function'
|
|
107
|
+
? value.valueOf()
|
|
108
|
+
: value;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Serialize an HTML attribute to a string. This function is not
|
|
113
|
+
* expected to be used directly, but rather through a precompile
|
|
114
|
+
* JSX transform
|
|
115
|
+
* @param {string} name The attribute name
|
|
116
|
+
* @param {*} value The attribute value
|
|
117
|
+
* @returns {string}
|
|
118
|
+
*/
|
|
119
|
+
function jsxAttr(name, value) {
|
|
120
|
+
if (options.attr) {
|
|
121
|
+
const result = options.attr(name, value);
|
|
122
|
+
if (typeof result === 'string') return result;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
value = normalizeAttrValue(value);
|
|
126
|
+
|
|
127
|
+
if (name === 'ref' || name === 'key') return '';
|
|
128
|
+
if (name === 'style' && typeof value === 'object') {
|
|
129
|
+
let str = '';
|
|
130
|
+
for (let prop in value) {
|
|
131
|
+
let val = value[prop];
|
|
132
|
+
if (val != null && val !== '') {
|
|
133
|
+
const name =
|
|
134
|
+
prop[0] == '-'
|
|
135
|
+
? prop
|
|
136
|
+
: JS_TO_CSS[prop] ||
|
|
137
|
+
(JS_TO_CSS[prop] = prop.replace(CSS_REGEX, '-$&').toLowerCase());
|
|
138
|
+
|
|
139
|
+
let suffix = ';';
|
|
140
|
+
if (
|
|
141
|
+
typeof val === 'number' &&
|
|
142
|
+
// Exclude custom-attributes
|
|
143
|
+
!name.startsWith('--') &&
|
|
144
|
+
!IS_NON_DIMENSIONAL.test(name)
|
|
145
|
+
) {
|
|
146
|
+
suffix = 'px;';
|
|
147
|
+
}
|
|
148
|
+
str = str + name + ':' + val + suffix;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return name + '="' + encodeEntities(str) + '"';
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (
|
|
155
|
+
value == null ||
|
|
156
|
+
value === false ||
|
|
157
|
+
typeof value === 'function' ||
|
|
158
|
+
typeof value === 'object'
|
|
159
|
+
) {
|
|
160
|
+
return '';
|
|
161
|
+
} else if (value === true) return name;
|
|
162
|
+
|
|
163
|
+
return name + '="' + encodeEntities('' + value) + '"';
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Escape a dynamic child passed to `jsxTemplate`. This function
|
|
168
|
+
* is not expected to be used directly, but rather through a
|
|
169
|
+
* precompile JSX transform
|
|
170
|
+
* @param {*} value
|
|
171
|
+
* @returns {string | null | VNode | Array<string | null | VNode>}
|
|
172
|
+
*/
|
|
173
|
+
function jsxEscape(value) {
|
|
174
|
+
if (
|
|
175
|
+
value == null ||
|
|
176
|
+
typeof value === 'boolean' ||
|
|
177
|
+
typeof value === 'function'
|
|
178
|
+
) {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (typeof value === 'object') {
|
|
183
|
+
// Check for VNode
|
|
184
|
+
if (value.constructor === undefined) return value;
|
|
185
|
+
|
|
186
|
+
if (isArray(value)) {
|
|
187
|
+
for (let i = 0; i < value.length; i++) {
|
|
188
|
+
value[i] = jsxEscape(value[i]);
|
|
189
|
+
}
|
|
190
|
+
return value;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return encodeEntities('' + value);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export {
|
|
198
|
+
createVNode as jsx,
|
|
199
|
+
createVNode as jsxs,
|
|
200
|
+
createVNode as jsxDEV,
|
|
201
|
+
Fragment,
|
|
202
|
+
// precompiled JSX transform
|
|
203
|
+
jsxTemplate,
|
|
204
|
+
jsxAttr,
|
|
205
|
+
jsxEscape
|
|
206
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const ENCODED_ENTITIES = /["&<]/;
|
|
2
|
+
|
|
3
|
+
/** @param {string} str */
|
|
4
|
+
export function encodeEntities(str) {
|
|
5
|
+
// Skip all work for strings with no entities needing encoding:
|
|
6
|
+
if (str.length === 0 || ENCODED_ENTITIES.test(str) === false) return str;
|
|
7
|
+
|
|
8
|
+
let last = 0,
|
|
9
|
+
i = 0,
|
|
10
|
+
out = '',
|
|
11
|
+
ch = '';
|
|
12
|
+
|
|
13
|
+
// Seek forward in str until the next entity char:
|
|
14
|
+
for (; i < str.length; i++) {
|
|
15
|
+
switch (str.charCodeAt(i)) {
|
|
16
|
+
case 34:
|
|
17
|
+
ch = '"';
|
|
18
|
+
break;
|
|
19
|
+
case 38:
|
|
20
|
+
ch = '&';
|
|
21
|
+
break;
|
|
22
|
+
case 60:
|
|
23
|
+
ch = '<';
|
|
24
|
+
break;
|
|
25
|
+
default:
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
// Append skipped/buffered characters and the encoded entity:
|
|
29
|
+
if (i !== last) out += str.slice(last, i);
|
|
30
|
+
out += ch;
|
|
31
|
+
// Start the next seek/buffer after the entity's offset:
|
|
32
|
+
last = i + 1;
|
|
33
|
+
}
|
|
34
|
+
if (i !== last) out += str.slice(last, i);
|
|
35
|
+
return out;
|
|
36
|
+
}
|