effect-start 0.27.0 → 0.28.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/dist/ChildProcess.d.ts +60 -0
- package/dist/ChildProcess.d.ts.map +1 -0
- package/dist/ChildProcess.js +30 -0
- package/dist/ChildProcess.js.map +1 -0
- package/dist/Commander.d.ts +101 -0
- package/dist/Commander.d.ts.map +1 -0
- package/dist/Commander.js +327 -0
- package/dist/Commander.js.map +1 -0
- package/dist/ContentNegotiation.d.ts +13 -0
- package/dist/ContentNegotiation.d.ts.map +1 -0
- package/dist/ContentNegotiation.js +360 -0
- package/dist/ContentNegotiation.js.map +1 -0
- package/dist/Cookies.d.ts +78 -0
- package/dist/Cookies.d.ts.map +1 -0
- package/dist/Cookies.js +303 -0
- package/dist/Cookies.js.map +1 -0
- package/dist/Development.d.ts +42 -0
- package/dist/Development.d.ts.map +1 -0
- package/dist/Development.js +60 -0
- package/dist/Development.js.map +1 -0
- package/dist/Docker.d.ts +51 -0
- package/dist/Docker.d.ts.map +1 -0
- package/dist/Docker.js +88 -0
- package/dist/Docker.js.map +1 -0
- package/dist/Effectify.d.ts +210 -0
- package/dist/Effectify.d.ts.map +1 -0
- package/dist/Effectify.js +20 -0
- package/dist/Effectify.js.map +1 -0
- package/dist/Entity.d.ts +48 -0
- package/dist/Entity.d.ts.map +1 -0
- package/dist/Entity.js +235 -0
- package/dist/Entity.js.map +1 -0
- package/dist/Fetch.d.ts +50 -0
- package/dist/Fetch.d.ts.map +1 -0
- package/dist/Fetch.js +136 -0
- package/dist/Fetch.js.map +1 -0
- package/dist/FilePathPattern.d.ts +30 -0
- package/dist/FilePathPattern.d.ts.map +1 -0
- package/dist/FilePathPattern.js +87 -0
- package/dist/FilePathPattern.js.map +1 -0
- package/dist/FileRouter.d.ts +57 -0
- package/dist/FileRouter.d.ts.map +1 -0
- package/dist/FileRouter.js +149 -0
- package/dist/FileRouter.js.map +1 -0
- package/dist/FileRouterCodegen.d.ts +19 -0
- package/dist/FileRouterCodegen.d.ts.map +1 -0
- package/dist/FileRouterCodegen.js +228 -0
- package/dist/FileRouterCodegen.js.map +1 -0
- package/dist/FileSystem.d.ts +159 -0
- package/dist/FileSystem.d.ts.map +1 -0
- package/dist/FileSystem.js +71 -0
- package/dist/FileSystem.js.map +1 -0
- package/dist/GlobalLayer.d.ts +4 -0
- package/dist/GlobalLayer.d.ts.map +1 -0
- package/dist/GlobalLayer.js +51 -0
- package/dist/GlobalLayer.js.map +1 -0
- package/dist/Http.d.ts +38 -0
- package/dist/Http.d.ts.map +1 -0
- package/dist/Http.js +89 -0
- package/dist/Http.js.map +1 -0
- package/dist/PathPattern.d.ts +135 -0
- package/dist/PathPattern.d.ts.map +1 -0
- package/dist/PathPattern.js +414 -0
- package/dist/PathPattern.js.map +1 -0
- package/dist/PlatformError.d.ts +39 -0
- package/dist/PlatformError.d.ts.map +1 -0
- package/dist/PlatformError.js +26 -0
- package/dist/PlatformError.js.map +1 -0
- package/dist/PlatformRuntime.d.ts +30 -0
- package/dist/PlatformRuntime.d.ts.map +1 -0
- package/dist/PlatformRuntime.js +50 -0
- package/dist/PlatformRuntime.js.map +1 -0
- package/dist/Route.d.ts +98 -0
- package/dist/Route.d.ts.map +1 -0
- package/dist/Route.js +101 -0
- package/dist/Route.js.map +1 -0
- package/dist/RouteBody.d.ts +48 -0
- package/dist/RouteBody.d.ts.map +1 -0
- package/dist/RouteBody.js +68 -0
- package/dist/RouteBody.js.map +1 -0
- package/dist/RouteError.d.ts +99 -0
- package/dist/RouteError.d.ts.map +1 -0
- package/dist/RouteError.js +56 -0
- package/dist/RouteError.js.map +1 -0
- package/dist/RouteHook.d.ts +13 -0
- package/dist/RouteHook.d.ts.map +1 -0
- package/dist/RouteHook.js +40 -0
- package/dist/RouteHook.js.map +1 -0
- package/dist/RouteHttp.d.ts +22 -0
- package/dist/RouteHttp.d.ts.map +1 -0
- package/dist/RouteHttp.js +259 -0
- package/dist/RouteHttp.js.map +1 -0
- package/dist/RouteHttpTracer.d.ts +11 -0
- package/dist/RouteHttpTracer.d.ts.map +1 -0
- package/dist/RouteHttpTracer.js +63 -0
- package/dist/RouteHttpTracer.js.map +1 -0
- package/dist/RouteMount.d.ts +87 -0
- package/dist/RouteMount.d.ts.map +1 -0
- package/dist/RouteMount.js +64 -0
- package/dist/RouteMount.js.map +1 -0
- package/dist/RouteSchema.d.ts +87 -0
- package/dist/RouteSchema.d.ts.map +1 -0
- package/dist/RouteSchema.js +189 -0
- package/dist/RouteSchema.js.map +1 -0
- package/dist/RouteSse.d.ts +22 -0
- package/dist/RouteSse.d.ts.map +1 -0
- package/dist/RouteSse.js +80 -0
- package/dist/RouteSse.js.map +1 -0
- package/dist/RouteTree.d.ts +58 -0
- package/dist/RouteTree.d.ts.map +1 -0
- package/dist/RouteTree.js +94 -0
- package/dist/RouteTree.js.map +1 -0
- package/dist/RouteTrie.d.ts +21 -0
- package/dist/RouteTrie.d.ts.map +1 -0
- package/dist/RouteTrie.js +153 -0
- package/dist/RouteTrie.js.map +1 -0
- package/dist/SchemaExtra.d.ts +8 -0
- package/dist/SchemaExtra.d.ts.map +1 -0
- package/dist/SchemaExtra.js +75 -0
- package/dist/SchemaExtra.js.map +1 -0
- package/dist/Socket.d.ts +28 -0
- package/dist/Socket.d.ts.map +1 -0
- package/dist/Socket.js +30 -0
- package/dist/Socket.js.map +1 -0
- package/dist/SqlIntrospect.d.ts +92 -0
- package/dist/SqlIntrospect.d.ts.map +1 -0
- package/dist/SqlIntrospect.js +478 -0
- package/dist/SqlIntrospect.js.map +1 -0
- package/dist/Start.d.ts +90 -0
- package/dist/Start.d.ts.map +1 -0
- package/dist/Start.js +91 -0
- package/dist/Start.js.map +1 -0
- package/dist/StartApp.d.ts +13 -0
- package/dist/StartApp.d.ts.map +1 -0
- package/dist/StartApp.js +4 -0
- package/dist/StartApp.js.map +1 -0
- package/dist/StreamExtra.d.ts +29 -0
- package/dist/StreamExtra.d.ts.map +1 -0
- package/dist/StreamExtra.js +101 -0
- package/dist/StreamExtra.js.map +1 -0
- package/dist/System.d.ts +9 -0
- package/dist/System.d.ts.map +1 -0
- package/dist/System.js +61 -0
- package/dist/System.js.map +1 -0
- package/dist/TuplePathPattern.d.ts +10 -0
- package/dist/TuplePathPattern.d.ts.map +1 -0
- package/dist/TuplePathPattern.js +69 -0
- package/dist/TuplePathPattern.js.map +1 -0
- package/dist/Unique.d.ts +68 -0
- package/dist/Unique.d.ts.map +1 -0
- package/dist/Unique.js +225 -0
- package/dist/Unique.js.map +1 -0
- package/dist/Values.d.ts +30 -0
- package/dist/Values.d.ts.map +1 -0
- package/dist/Values.js +46 -0
- package/dist/Values.js.map +1 -0
- package/dist/bun/BunBundle.d.ts +12 -0
- package/dist/bun/BunBundle.d.ts.map +1 -0
- package/dist/bun/BunBundle.js +138 -0
- package/dist/bun/BunBundle.js.map +1 -0
- package/dist/bun/BunChildProcessSpawner.d.ts +4 -0
- package/dist/bun/BunChildProcessSpawner.d.ts.map +1 -0
- package/dist/bun/BunChildProcessSpawner.js +99 -0
- package/dist/bun/BunChildProcessSpawner.js.map +1 -0
- package/dist/bun/BunImportTrackerPlugin.d.ts +14 -0
- package/dist/bun/BunImportTrackerPlugin.d.ts.map +1 -0
- package/dist/bun/BunImportTrackerPlugin.js +70 -0
- package/dist/bun/BunImportTrackerPlugin.js.map +1 -0
- package/dist/bun/BunRoute.d.ts +49 -0
- package/dist/bun/BunRoute.d.ts.map +1 -0
- package/dist/bun/BunRoute.js +122 -0
- package/dist/bun/BunRoute.js.map +1 -0
- package/dist/bun/BunRuntime.d.ts +3 -0
- package/dist/bun/BunRuntime.d.ts.map +1 -0
- package/dist/bun/BunRuntime.js +30 -0
- package/dist/bun/BunRuntime.js.map +1 -0
- package/dist/bun/BunServer.d.ts +52 -0
- package/dist/bun/BunServer.d.ts.map +1 -0
- package/dist/bun/BunServer.js +262 -0
- package/dist/bun/BunServer.js.map +1 -0
- package/dist/bun/BunVirtualFilesPlugin.d.ts +5 -0
- package/dist/bun/BunVirtualFilesPlugin.d.ts.map +1 -0
- package/dist/bun/BunVirtualFilesPlugin.js +41 -0
- package/dist/bun/BunVirtualFilesPlugin.js.map +1 -0
- package/dist/bun/_BunEnhancedResolve.d.ts +46 -0
- package/dist/bun/_BunEnhancedResolve.d.ts.map +1 -0
- package/dist/bun/_BunEnhancedResolve.js +103 -0
- package/dist/bun/_BunEnhancedResolve.js.map +1 -0
- package/dist/bun/index.d.ts +6 -0
- package/dist/bun/index.d.ts.map +1 -0
- package/dist/bun/index.js +6 -0
- package/dist/bun/index.js.map +1 -0
- package/dist/bundler/Bundle.d.ts +62 -0
- package/dist/bundler/Bundle.d.ts.map +1 -0
- package/dist/bundler/Bundle.js +49 -0
- package/dist/bundler/Bundle.js.map +1 -0
- package/dist/bundler/BundleFiles.d.ts +14 -0
- package/dist/bundler/BundleFiles.d.ts.map +1 -0
- package/dist/bundler/BundleFiles.js +97 -0
- package/dist/bundler/BundleFiles.js.map +1 -0
- package/dist/bundler/BundleRoute.d.ts +27 -0
- package/dist/bundler/BundleRoute.d.ts.map +1 -0
- package/dist/bundler/BundleRoute.js +52 -0
- package/dist/bundler/BundleRoute.js.map +1 -0
- package/dist/client/Overlay.d.ts +3 -0
- package/dist/client/Overlay.d.ts.map +1 -0
- package/dist/client/Overlay.js +33 -0
- package/dist/client/Overlay.js.map +1 -0
- package/dist/client/ScrollState.d.ts +7 -0
- package/dist/client/ScrollState.d.ts.map +1 -0
- package/dist/client/ScrollState.js +95 -0
- package/dist/client/ScrollState.js.map +1 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +80 -0
- package/dist/client/index.js.map +1 -0
- package/dist/datastar/actions/fetch.d.ts +31 -0
- package/dist/datastar/actions/fetch.d.ts.map +1 -0
- package/dist/datastar/actions/fetch.js +404 -0
- package/dist/datastar/actions/fetch.js.map +1 -0
- package/dist/datastar/actions/peek.d.ts +2 -0
- package/dist/datastar/actions/peek.d.ts.map +1 -0
- package/dist/datastar/actions/peek.js +14 -0
- package/dist/datastar/actions/peek.js.map +1 -0
- package/dist/datastar/actions/setAll.d.ts +2 -0
- package/dist/datastar/actions/setAll.d.ts.map +1 -0
- package/dist/datastar/actions/setAll.js +13 -0
- package/dist/datastar/actions/setAll.js.map +1 -0
- package/dist/datastar/actions/toggleAll.d.ts +2 -0
- package/dist/datastar/actions/toggleAll.d.ts.map +1 -0
- package/dist/datastar/actions/toggleAll.js +13 -0
- package/dist/datastar/actions/toggleAll.js.map +1 -0
- package/dist/datastar/attributes/attr.d.ts +2 -0
- package/dist/datastar/attributes/attr.d.ts.map +1 -0
- package/dist/datastar/attributes/attr.js +49 -0
- package/dist/datastar/attributes/attr.js.map +1 -0
- package/dist/datastar/attributes/bind.d.ts +2 -0
- package/dist/datastar/attributes/bind.d.ts.map +1 -0
- package/dist/datastar/attributes/bind.js +176 -0
- package/dist/datastar/attributes/bind.js.map +1 -0
- package/dist/datastar/attributes/class.d.ts +2 -0
- package/dist/datastar/attributes/class.d.ts.map +1 -0
- package/dist/datastar/attributes/class.js +48 -0
- package/dist/datastar/attributes/class.js.map +1 -0
- package/dist/datastar/attributes/computed.d.ts +2 -0
- package/dist/datastar/attributes/computed.d.ts.map +1 -0
- package/dist/datastar/attributes/computed.js +27 -0
- package/dist/datastar/attributes/computed.js.map +1 -0
- package/dist/datastar/attributes/effect.d.ts +2 -0
- package/dist/datastar/attributes/effect.d.ts.map +1 -0
- package/dist/datastar/attributes/effect.js +10 -0
- package/dist/datastar/attributes/effect.js.map +1 -0
- package/dist/datastar/attributes/indicator.d.ts +2 -0
- package/dist/datastar/attributes/indicator.d.ts.map +1 -0
- package/dist/datastar/attributes/indicator.js +31 -0
- package/dist/datastar/attributes/indicator.js.map +1 -0
- package/dist/datastar/attributes/init.d.ts +2 -0
- package/dist/datastar/attributes/init.d.ts.map +1 -0
- package/dist/datastar/attributes/init.js +27 -0
- package/dist/datastar/attributes/init.js.map +1 -0
- package/dist/datastar/attributes/jsonSignals.d.ts +2 -0
- package/dist/datastar/attributes/jsonSignals.d.ts.map +1 -0
- package/dist/datastar/attributes/jsonSignals.js +31 -0
- package/dist/datastar/attributes/jsonSignals.js.map +1 -0
- package/dist/datastar/attributes/on.d.ts +2 -0
- package/dist/datastar/attributes/on.d.ts.map +1 -0
- package/dist/datastar/attributes/on.js +79 -0
- package/dist/datastar/attributes/on.js.map +1 -0
- package/dist/datastar/attributes/onIntersect.d.ts +2 -0
- package/dist/datastar/attributes/onIntersect.d.ts.map +1 -0
- package/dist/datastar/attributes/onIntersect.js +54 -0
- package/dist/datastar/attributes/onIntersect.js.map +1 -0
- package/dist/datastar/attributes/onInterval.d.ts +2 -0
- package/dist/datastar/attributes/onInterval.d.ts.map +1 -0
- package/dist/datastar/attributes/onInterval.js +31 -0
- package/dist/datastar/attributes/onInterval.js.map +1 -0
- package/dist/datastar/attributes/onSignalPatch.d.ts +2 -0
- package/dist/datastar/attributes/onSignalPatch.d.ts.map +1 -0
- package/dist/datastar/attributes/onSignalPatch.js +43 -0
- package/dist/datastar/attributes/onSignalPatch.js.map +1 -0
- package/dist/datastar/attributes/ref.d.ts +2 -0
- package/dist/datastar/attributes/ref.d.ts.map +1 -0
- package/dist/datastar/attributes/ref.js +11 -0
- package/dist/datastar/attributes/ref.js.map +1 -0
- package/dist/datastar/attributes/show.d.ts +2 -0
- package/dist/datastar/attributes/show.d.ts.map +1 -0
- package/dist/datastar/attributes/show.js +32 -0
- package/dist/datastar/attributes/show.js.map +1 -0
- package/dist/datastar/attributes/signals.d.ts +2 -0
- package/dist/datastar/attributes/signals.d.ts.map +1 -0
- package/dist/datastar/attributes/signals.js +18 -0
- package/dist/datastar/attributes/signals.js.map +1 -0
- package/dist/datastar/attributes/style.d.ts +2 -0
- package/dist/datastar/attributes/style.d.ts.map +1 -0
- package/dist/datastar/attributes/style.js +51 -0
- package/dist/datastar/attributes/style.js.map +1 -0
- package/dist/datastar/attributes/text.d.ts +2 -0
- package/dist/datastar/attributes/text.d.ts.map +1 -0
- package/dist/datastar/attributes/text.js +27 -0
- package/dist/datastar/attributes/text.js.map +1 -0
- package/dist/datastar/engine.d.ts +163 -0
- package/dist/datastar/engine.d.ts.map +1 -0
- package/dist/datastar/engine.js +1000 -0
- package/dist/datastar/engine.js.map +1 -0
- package/dist/datastar/index.d.ts +25 -0
- package/dist/datastar/index.d.ts.map +1 -0
- package/dist/datastar/index.js +25 -0
- package/dist/datastar/index.js.map +1 -0
- package/dist/datastar/utils.d.ts +52 -0
- package/dist/datastar/utils.d.ts.map +1 -0
- package/dist/datastar/utils.js +203 -0
- package/dist/datastar/utils.js.map +1 -0
- package/dist/datastar/watchers/patchElements.d.ts +2 -0
- package/dist/datastar/watchers/patchElements.d.ts.map +1 -0
- package/dist/datastar/watchers/patchElements.js +398 -0
- package/dist/datastar/watchers/patchElements.js.map +1 -0
- package/dist/datastar/watchers/patchSignals.d.ts +2 -0
- package/dist/datastar/watchers/patchSignals.d.ts.map +1 -0
- package/dist/datastar/watchers/patchSignals.js +15 -0
- package/dist/datastar/watchers/patchSignals.js.map +1 -0
- package/dist/experimental/EncryptedCookies.d.ts +49 -0
- package/dist/experimental/EncryptedCookies.d.ts.map +1 -0
- package/dist/experimental/EncryptedCookies.js +213 -0
- package/dist/experimental/EncryptedCookies.js.map +1 -0
- package/dist/experimental/index.d.ts +2 -0
- package/dist/experimental/index.d.ts.map +1 -0
- package/dist/experimental/index.js +2 -0
- package/dist/experimental/index.js.map +1 -0
- package/dist/hyper/Hyper.d.ts +26 -0
- package/dist/hyper/Hyper.d.ts.map +1 -0
- package/dist/hyper/Hyper.js +24 -0
- package/dist/hyper/Hyper.js.map +1 -0
- package/dist/hyper/HyperHtml.d.ts +24 -0
- package/dist/hyper/HyperHtml.d.ts.map +1 -0
- package/dist/hyper/HyperHtml.js +153 -0
- package/dist/hyper/HyperHtml.js.map +1 -0
- package/dist/hyper/HyperHtml.test.d.ts +2 -0
- package/dist/hyper/HyperHtml.test.d.ts.map +1 -0
- package/dist/hyper/HyperHtml.test.js +283 -0
- package/dist/hyper/HyperHtml.test.js.map +1 -0
- package/dist/hyper/HyperNode.d.ts +15 -0
- package/dist/hyper/HyperNode.d.ts.map +1 -0
- package/dist/hyper/HyperNode.js +12 -0
- package/dist/hyper/HyperNode.js.map +1 -0
- package/dist/hyper/HyperRoute.d.ts +9 -0
- package/dist/hyper/HyperRoute.d.ts.map +1 -0
- package/dist/hyper/HyperRoute.js +33 -0
- package/dist/hyper/HyperRoute.js.map +1 -0
- package/dist/hyper/HyperRoute.test.d.ts +2 -0
- package/dist/hyper/HyperRoute.test.d.ts.map +1 -0
- package/dist/hyper/HyperRoute.test.js +86 -0
- package/dist/hyper/HyperRoute.test.js.map +1 -0
- package/dist/hyper/html.d.ts +11 -0
- package/dist/hyper/html.d.ts.map +1 -0
- package/dist/hyper/html.js +31 -0
- package/dist/hyper/html.js.map +1 -0
- package/dist/hyper/index.d.ts +7 -0
- package/dist/hyper/index.d.ts.map +1 -0
- package/dist/hyper/index.js +6 -0
- package/dist/hyper/index.js.map +1 -0
- package/dist/hyper/jsx-runtime.d.ts +8 -0
- package/dist/hyper/jsx-runtime.d.ts.map +1 -0
- package/dist/hyper/jsx-runtime.js +9 -0
- package/dist/hyper/jsx-runtime.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/lint/plugin.d.ts +121 -0
- package/dist/lint/plugin.d.ts.map +1 -0
- package/dist/lint/plugin.js +537 -0
- package/dist/lint/plugin.js.map +1 -0
- package/dist/node/NodeFileSystem.d.ts +8 -0
- package/dist/node/NodeFileSystem.d.ts.map +1 -0
- package/dist/node/NodeFileSystem.js +411 -0
- package/dist/node/NodeFileSystem.js.map +1 -0
- package/dist/node/NodeUtils.d.ts +3 -0
- package/dist/node/NodeUtils.d.ts.map +1 -0
- package/dist/node/NodeUtils.js +21 -0
- package/dist/node/NodeUtils.js.map +1 -0
- package/dist/sql/SqlCache.d.ts +18 -0
- package/dist/sql/SqlCache.d.ts.map +1 -0
- package/dist/sql/SqlCache.js +31 -0
- package/dist/sql/SqlCache.js.map +1 -0
- package/dist/sql/SqlClient.d.ts +88 -0
- package/dist/sql/SqlClient.d.ts.map +1 -0
- package/dist/sql/SqlClient.js +171 -0
- package/dist/sql/SqlClient.js.map +1 -0
- package/dist/sql/bun/index.d.ts +6 -0
- package/dist/sql/bun/index.d.ts.map +1 -0
- package/dist/sql/bun/index.js +132 -0
- package/dist/sql/bun/index.js.map +1 -0
- package/dist/sql/index.d.ts +3 -0
- package/dist/sql/index.d.ts.map +1 -0
- package/dist/sql/index.js +3 -0
- package/dist/sql/index.js.map +1 -0
- package/dist/sql/libsql/index.d.ts +15 -0
- package/dist/sql/libsql/index.d.ts.map +1 -0
- package/dist/sql/libsql/index.js +132 -0
- package/dist/sql/libsql/index.js.map +1 -0
- package/dist/sql/mssql/index.d.ts +8 -0
- package/dist/sql/mssql/index.d.ts.map +1 -0
- package/dist/sql/mssql/index.js +145 -0
- package/dist/sql/mssql/index.js.map +1 -0
- package/dist/sql/postgres/index.d.ts +7 -0
- package/dist/sql/postgres/index.d.ts.map +1 -0
- package/dist/sql/postgres/index.js +136 -0
- package/dist/sql/postgres/index.js.map +1 -0
- package/dist/testing/TestLogger.d.ts +14 -0
- package/dist/testing/TestLogger.d.ts.map +1 -0
- package/dist/testing/TestLogger.js +33 -0
- package/dist/testing/TestLogger.js.map +1 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +3 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/utils.d.ts +10 -0
- package/dist/testing/utils.d.ts.map +1 -0
- package/dist/testing/utils.js +40 -0
- package/dist/testing/utils.js.map +1 -0
- package/dist/tower/Simulation.d.ts +3 -0
- package/dist/tower/Simulation.d.ts.map +1 -0
- package/dist/tower/Simulation.js +606 -0
- package/dist/tower/Simulation.js.map +1 -0
- package/dist/tower/Tower.d.ts +11 -0
- package/dist/tower/Tower.d.ts.map +1 -0
- package/dist/tower/Tower.js +30 -0
- package/dist/tower/Tower.js.map +1 -0
- package/dist/tower/TowerErrors.d.ts +4 -0
- package/dist/tower/TowerErrors.d.ts.map +1 -0
- package/dist/tower/TowerErrors.js +200 -0
- package/dist/tower/TowerErrors.js.map +1 -0
- package/dist/tower/TowerLogger.d.ts +2 -0
- package/dist/tower/TowerLogger.d.ts.map +1 -0
- package/dist/tower/TowerLogger.js +46 -0
- package/dist/tower/TowerLogger.js.map +1 -0
- package/dist/tower/TowerMetrics.d.ts +4 -0
- package/dist/tower/TowerMetrics.d.ts.map +1 -0
- package/dist/tower/TowerMetrics.js +62 -0
- package/dist/tower/TowerMetrics.js.map +1 -0
- package/dist/tower/TowerProcess.d.ts +4 -0
- package/dist/tower/TowerProcess.d.ts.map +1 -0
- package/dist/tower/TowerProcess.js +50 -0
- package/dist/tower/TowerProcess.js.map +1 -0
- package/dist/tower/TowerStore.d.ts +199 -0
- package/dist/tower/TowerStore.d.ts.map +1 -0
- package/dist/tower/TowerStore.js +307 -0
- package/dist/tower/TowerStore.js.map +1 -0
- package/dist/tower/TowerTracer.d.ts +4 -0
- package/dist/tower/TowerTracer.d.ts.map +1 -0
- package/dist/tower/TowerTracer.js +111 -0
- package/dist/tower/TowerTracer.js.map +1 -0
- package/dist/tower/index.d.ts +4 -0
- package/dist/tower/index.d.ts.map +1 -0
- package/dist/tower/index.js +4 -0
- package/dist/tower/index.js.map +1 -0
- package/dist/tower/routes/errors/route.d.ts +11 -0
- package/dist/tower/routes/errors/route.d.ts.map +1 -0
- package/dist/tower/routes/errors/route.js +47 -0
- package/dist/tower/routes/errors/route.js.map +1 -0
- package/dist/tower/routes/fiberDetail.d.ts +17 -0
- package/dist/tower/routes/fiberDetail.d.ts.map +1 -0
- package/dist/tower/routes/fiberDetail.js +35 -0
- package/dist/tower/routes/fiberDetail.js.map +1 -0
- package/dist/tower/routes/fibers/route.d.ts +11 -0
- package/dist/tower/routes/fibers/route.d.ts.map +1 -0
- package/dist/tower/routes/fibers/route.js +27 -0
- package/dist/tower/routes/fibers/route.js.map +1 -0
- package/dist/tower/routes/layout.d.ts +10 -0
- package/dist/tower/routes/layout.d.ts.map +1 -0
- package/dist/tower/routes/layout.js +4 -0
- package/dist/tower/routes/layout.js.map +1 -0
- package/dist/tower/routes/logs/route.d.ts +11 -0
- package/dist/tower/routes/logs/route.d.ts.map +1 -0
- package/dist/tower/routes/logs/route.js +36 -0
- package/dist/tower/routes/logs/route.js.map +1 -0
- package/dist/tower/routes/metrics/route.d.ts +11 -0
- package/dist/tower/routes/metrics/route.d.ts.map +1 -0
- package/dist/tower/routes/metrics/route.js +20 -0
- package/dist/tower/routes/metrics/route.js.map +1 -0
- package/dist/tower/routes/route.d.ts +7 -0
- package/dist/tower/routes/route.d.ts.map +1 -0
- package/dist/tower/routes/route.js +6 -0
- package/dist/tower/routes/route.js.map +1 -0
- package/dist/tower/routes/routes/route.d.ts +7 -0
- package/dist/tower/routes/routes/route.d.ts.map +1 -0
- package/dist/tower/routes/routes/route.js +23 -0
- package/dist/tower/routes/routes/route.js.map +1 -0
- package/dist/tower/routes/services/route.d.ts +7 -0
- package/dist/tower/routes/services/route.d.ts.map +1 -0
- package/dist/tower/routes/services/route.js +15 -0
- package/dist/tower/routes/services/route.js.map +1 -0
- package/dist/tower/routes/system/route.d.ts +11 -0
- package/dist/tower/routes/system/route.d.ts.map +1 -0
- package/dist/tower/routes/system/route.js +21 -0
- package/dist/tower/routes/system/route.js.map +1 -0
- package/dist/tower/routes/traceDetail.d.ts +17 -0
- package/dist/tower/routes/traceDetail.d.ts.map +1 -0
- package/dist/tower/routes/traceDetail.js +20 -0
- package/dist/tower/routes/traceDetail.js.map +1 -0
- package/dist/tower/routes/traces/route.d.ts +11 -0
- package/dist/tower/routes/traces/route.d.ts.map +1 -0
- package/dist/tower/routes/traces/route.js +36 -0
- package/dist/tower/routes/traces/route.js.map +1 -0
- package/dist/tower/routes/tree.d.ts +142 -0
- package/dist/tower/routes/tree.d.ts.map +1 -0
- package/dist/tower/routes/tree.js +28 -0
- package/dist/tower/routes/tree.js.map +1 -0
- package/dist/tower/ui/Errors.d.ts +5 -0
- package/dist/tower/ui/Errors.d.ts.map +1 -0
- package/dist/tower/ui/Errors.js +30 -0
- package/dist/tower/ui/Errors.js.map +1 -0
- package/dist/tower/ui/Fibers.d.ts +25 -0
- package/dist/tower/ui/Fibers.d.ts.map +1 -0
- package/dist/tower/ui/Fibers.js +157 -0
- package/dist/tower/ui/Fibers.js.map +1 -0
- package/dist/tower/ui/Logs.d.ts +5 -0
- package/dist/tower/ui/Logs.d.ts.map +1 -0
- package/dist/tower/ui/Logs.js +28 -0
- package/dist/tower/ui/Logs.js.map +1 -0
- package/dist/tower/ui/Metrics.d.ts +5 -0
- package/dist/tower/ui/Metrics.d.ts.map +1 -0
- package/dist/tower/ui/Metrics.js +34 -0
- package/dist/tower/ui/Metrics.js.map +1 -0
- package/dist/tower/ui/Routes.d.ts +9 -0
- package/dist/tower/ui/Routes.d.ts.map +1 -0
- package/dist/tower/ui/Routes.js +79 -0
- package/dist/tower/ui/Routes.js.map +1 -0
- package/dist/tower/ui/Services.d.ts +11 -0
- package/dist/tower/ui/Services.d.ts.map +1 -0
- package/dist/tower/ui/Services.js +254 -0
- package/dist/tower/ui/Services.js.map +1 -0
- package/dist/tower/ui/Shell.d.ts +11 -0
- package/dist/tower/ui/Shell.d.ts.map +1 -0
- package/dist/tower/ui/Shell.js +12 -0
- package/dist/tower/ui/Shell.js.map +1 -0
- package/dist/tower/ui/System.d.ts +5 -0
- package/dist/tower/ui/System.d.ts.map +1 -0
- package/dist/tower/ui/System.js +65 -0
- package/dist/tower/ui/System.js.map +1 -0
- package/dist/tower/ui/Traces.d.ts +13 -0
- package/dist/tower/ui/Traces.d.ts.map +1 -0
- package/dist/tower/ui/Traces.js +219 -0
- package/dist/tower/ui/Traces.js.map +1 -0
- package/dist/x/cloudflare/CloudflareTunnel.d.ts +11 -0
- package/dist/x/cloudflare/CloudflareTunnel.d.ts.map +1 -0
- package/dist/x/cloudflare/CloudflareTunnel.js +31 -0
- package/dist/x/cloudflare/CloudflareTunnel.js.map +1 -0
- package/dist/x/cloudflare/index.d.ts +2 -0
- package/dist/x/cloudflare/index.d.ts.map +1 -0
- package/dist/x/cloudflare/index.js +2 -0
- package/dist/x/cloudflare/index.js.map +1 -0
- package/dist/x/tailscale/TailscaleTunnel.d.ts +16 -0
- package/dist/x/tailscale/TailscaleTunnel.d.ts.map +1 -0
- package/dist/x/tailscale/TailscaleTunnel.js +66 -0
- package/dist/x/tailscale/TailscaleTunnel.js.map +1 -0
- package/dist/x/tailscale/index.d.ts +2 -0
- package/dist/x/tailscale/index.d.ts.map +1 -0
- package/dist/x/tailscale/index.js +2 -0
- package/dist/x/tailscale/index.js.map +1 -0
- package/dist/x/tailwind/TailwindPlugin.d.ts +24 -0
- package/dist/x/tailwind/TailwindPlugin.d.ts.map +1 -0
- package/dist/x/tailwind/TailwindPlugin.js +220 -0
- package/dist/x/tailwind/TailwindPlugin.js.map +1 -0
- package/dist/x/tailwind/compile.d.ts +20 -0
- package/dist/x/tailwind/compile.d.ts.map +1 -0
- package/dist/x/tailwind/compile.js +155 -0
- package/dist/x/tailwind/compile.js.map +1 -0
- package/dist/x/tailwind/plugin.d.ts +3 -0
- package/dist/x/tailwind/plugin.d.ts.map +1 -0
- package/dist/x/tailwind/plugin.js +16 -0
- package/dist/x/tailwind/plugin.js.map +1 -0
- package/package.json +104 -23
- package/src/ChildProcess.ts +3 -6
- package/src/Docker.ts +190 -0
- package/src/Effectify.ts +7 -10
- package/src/FileSystem.ts +1 -4
- package/src/GlobalLayer.ts +85 -0
- package/src/PlatformRuntime.ts +8 -1
- package/src/RouteHook.ts +1 -1
- package/src/SqlIntrospect.ts +13 -11
- package/src/Start.ts +40 -29
- package/src/System.ts +60 -3
- package/src/Unique.ts +59 -0
- package/src/bun/BunChildProcessSpawner.ts +1 -8
- package/src/bun/BunRoute.ts +1 -0
- package/src/bun/BunRuntime.ts +2 -8
- package/src/bun/BunServer.ts +54 -2
- package/src/datastar/watchers/patchElements.ts +0 -1
- package/src/lint/plugin.js +146 -81
- package/src/sql/SqlCache.ts +50 -0
- package/src/sql/SqlClient.ts +59 -14
- package/src/sql/bun/index.ts +28 -26
- package/src/sql/index.ts +1 -0
- package/src/sql/libsql/index.ts +62 -28
- package/src/sql/mssql/index.ts +53 -57
- package/src/sql/postgres/index.ts +254 -0
- package/src/tower/Simulation.ts +776 -0
- package/src/tower/Tower.ts +47 -0
- package/src/tower/TowerErrors.ts +224 -0
- package/src/tower/TowerLogger.ts +52 -0
- package/src/tower/TowerMetrics.ts +72 -0
- package/src/tower/TowerProcess.ts +59 -0
- package/src/tower/TowerStore.ts +505 -0
- package/src/tower/TowerTracer.ts +128 -0
- package/src/tower/index.ts +3 -0
- package/src/tower/routes/errors/route.tsx +90 -0
- package/src/tower/routes/fiberDetail.tsx +51 -0
- package/src/tower/routes/fibers/route.tsx +46 -0
- package/src/tower/routes/layout.html +340 -0
- package/src/tower/routes/layout.tsx +4 -0
- package/src/tower/routes/logs/route.tsx +73 -0
- package/src/tower/routes/metrics/route.tsx +36 -0
- package/src/tower/routes/route.tsx +8 -0
- package/src/tower/routes/routes/route.tsx +30 -0
- package/src/tower/routes/services/route.tsx +21 -0
- package/src/tower/routes/system/route.tsx +43 -0
- package/src/tower/routes/traceDetail.tsx +30 -0
- package/src/tower/routes/traces/route.tsx +72 -0
- package/src/tower/routes/tree.ts +28 -0
- package/src/tower/ui/Errors.tsx +80 -0
- package/src/tower/ui/Fibers.tsx +336 -0
- package/src/tower/ui/Logs.tsx +50 -0
- package/src/tower/ui/Metrics.tsx +78 -0
- package/src/tower/ui/Routes.tsx +125 -0
- package/src/tower/ui/Services.tsx +273 -0
- package/src/tower/ui/Shell.tsx +74 -0
- package/src/tower/ui/System.tsx +141 -0
- package/src/tower/ui/Traces.tsx +419 -0
- package/src/x/cloudflare/CloudflareTunnel.ts +1 -1
- package/src/x/tailscale/TailscaleTunnel.ts +3 -3
- package/src/x/tailwind/compile.ts +6 -1
- package/src/sql/mssql/docker.ts +0 -117
|
@@ -0,0 +1,1000 @@
|
|
|
1
|
+
import { aliasify, hasOwn, isHTMLOrSVG, isPojo, pathToObj, snake } from "./utils.js";
|
|
2
|
+
/*********
|
|
3
|
+
* consts.ts
|
|
4
|
+
*********/
|
|
5
|
+
const lol = /🖕JS_DS🚀/.source;
|
|
6
|
+
export const DSP = lol.slice(0, 5);
|
|
7
|
+
export const DSS = lol.slice(4);
|
|
8
|
+
export const DATASTAR_FETCH_EVENT = "datastar-fetch";
|
|
9
|
+
export const DATASTAR_SIGNAL_PATCH_EVENT = "datastar-signal-patch";
|
|
10
|
+
const ReactiveFlags = {
|
|
11
|
+
None: 0,
|
|
12
|
+
Mutable: 1 << 0,
|
|
13
|
+
Watching: 1 << 1,
|
|
14
|
+
RecursedCheck: 1 << 2,
|
|
15
|
+
Recursed: 1 << 3,
|
|
16
|
+
Dirty: 1 << 4,
|
|
17
|
+
Pending: 1 << 5,
|
|
18
|
+
};
|
|
19
|
+
const EffectFlags = {
|
|
20
|
+
Queued: 1 << 6,
|
|
21
|
+
};
|
|
22
|
+
const currentPatch = [];
|
|
23
|
+
const queuedEffects = [];
|
|
24
|
+
let batchDepth = 0;
|
|
25
|
+
let notifyIndex = 0;
|
|
26
|
+
let queuedEffectsLength = 0;
|
|
27
|
+
let prevSub;
|
|
28
|
+
let activeSub;
|
|
29
|
+
let version = 0;
|
|
30
|
+
export const beginBatch = () => {
|
|
31
|
+
batchDepth++;
|
|
32
|
+
};
|
|
33
|
+
export const endBatch = () => {
|
|
34
|
+
if (!--batchDepth) {
|
|
35
|
+
flush();
|
|
36
|
+
dispatch();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export const startPeeking = (sub) => {
|
|
40
|
+
prevSub = activeSub;
|
|
41
|
+
activeSub = sub;
|
|
42
|
+
};
|
|
43
|
+
export const stopPeeking = () => {
|
|
44
|
+
activeSub = prevSub;
|
|
45
|
+
prevSub = undefined;
|
|
46
|
+
};
|
|
47
|
+
export const signal = (initialValue) => {
|
|
48
|
+
return signalOper.bind(0, {
|
|
49
|
+
previousValue: initialValue,
|
|
50
|
+
value_: initialValue,
|
|
51
|
+
flags_: 1,
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
const computedSymbol = Symbol("computed");
|
|
55
|
+
export const computed = (getter) => {
|
|
56
|
+
const c = computedOper.bind(0, {
|
|
57
|
+
flags_: 17,
|
|
58
|
+
getter,
|
|
59
|
+
});
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
c[computedSymbol] = 1;
|
|
62
|
+
return c;
|
|
63
|
+
};
|
|
64
|
+
export const effect = (fn) => {
|
|
65
|
+
const e = {
|
|
66
|
+
fn_: fn,
|
|
67
|
+
flags_: 2,
|
|
68
|
+
};
|
|
69
|
+
if (activeSub) {
|
|
70
|
+
link(e, activeSub);
|
|
71
|
+
}
|
|
72
|
+
startPeeking(e);
|
|
73
|
+
beginBatch();
|
|
74
|
+
try {
|
|
75
|
+
e.fn_();
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
endBatch();
|
|
79
|
+
stopPeeking();
|
|
80
|
+
}
|
|
81
|
+
return effectOper.bind(0, e);
|
|
82
|
+
};
|
|
83
|
+
const flush = () => {
|
|
84
|
+
while (notifyIndex < queuedEffectsLength) {
|
|
85
|
+
const effect = queuedEffects[notifyIndex];
|
|
86
|
+
queuedEffects[notifyIndex++] = undefined;
|
|
87
|
+
run(effect, (effect.flags_ &= ~EffectFlags.Queued));
|
|
88
|
+
}
|
|
89
|
+
notifyIndex = 0;
|
|
90
|
+
queuedEffectsLength = 0;
|
|
91
|
+
};
|
|
92
|
+
const update = (signal) => {
|
|
93
|
+
if ("getter" in signal) {
|
|
94
|
+
return updateComputed(signal);
|
|
95
|
+
}
|
|
96
|
+
return updateSignal(signal, signal.value_);
|
|
97
|
+
};
|
|
98
|
+
const updateComputed = (c) => {
|
|
99
|
+
startPeeking(c);
|
|
100
|
+
startTracking(c);
|
|
101
|
+
try {
|
|
102
|
+
const oldValue = c.value_;
|
|
103
|
+
return oldValue !== (c.value_ = c.getter(oldValue));
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
stopPeeking();
|
|
107
|
+
endTracking(c);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const updateSignal = (s, value) => {
|
|
111
|
+
s.flags_ = 1;
|
|
112
|
+
return s.previousValue !== (s.previousValue = value);
|
|
113
|
+
};
|
|
114
|
+
const notify = (e) => {
|
|
115
|
+
const flags = e.flags_;
|
|
116
|
+
if (!(flags & EffectFlags.Queued)) {
|
|
117
|
+
e.flags_ = flags | EffectFlags.Queued;
|
|
118
|
+
const subs = e.subs_;
|
|
119
|
+
if (subs) {
|
|
120
|
+
notify(subs.sub_);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
queuedEffects[queuedEffectsLength++] = e;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const run = (e, flags) => {
|
|
128
|
+
if (flags & 16 ||
|
|
129
|
+
(flags & 32 && checkDirty(e.deps_, e))) {
|
|
130
|
+
startPeeking(e);
|
|
131
|
+
startTracking(e);
|
|
132
|
+
beginBatch();
|
|
133
|
+
try {
|
|
134
|
+
e.fn_();
|
|
135
|
+
}
|
|
136
|
+
finally {
|
|
137
|
+
endBatch();
|
|
138
|
+
stopPeeking();
|
|
139
|
+
endTracking(e);
|
|
140
|
+
}
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (flags & 32) {
|
|
144
|
+
e.flags_ = flags & ~32;
|
|
145
|
+
}
|
|
146
|
+
let link = e.deps_;
|
|
147
|
+
while (link) {
|
|
148
|
+
const dep = link.dep_;
|
|
149
|
+
const depFlags = dep.flags_;
|
|
150
|
+
if (depFlags & EffectFlags.Queued) {
|
|
151
|
+
run(dep, (dep.flags_ = depFlags & ~EffectFlags.Queued));
|
|
152
|
+
}
|
|
153
|
+
link = link.nextDep_;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const signalOper = (s, ...value) => {
|
|
157
|
+
if (value.length) {
|
|
158
|
+
if (s.value_ !== (s.value_ = value[0])) {
|
|
159
|
+
s.flags_ = 17;
|
|
160
|
+
const subs = s.subs_;
|
|
161
|
+
if (subs) {
|
|
162
|
+
propagate(subs);
|
|
163
|
+
if (!batchDepth) {
|
|
164
|
+
flush();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
const currentValue = s.value_;
|
|
172
|
+
if (s.flags_ & 16) {
|
|
173
|
+
if (updateSignal(s, currentValue)) {
|
|
174
|
+
const subs_ = s.subs_;
|
|
175
|
+
if (subs_) {
|
|
176
|
+
shallowPropagate(subs_);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (activeSub) {
|
|
181
|
+
link(s, activeSub);
|
|
182
|
+
}
|
|
183
|
+
return currentValue;
|
|
184
|
+
};
|
|
185
|
+
const computedOper = (c) => {
|
|
186
|
+
const flags = c.flags_;
|
|
187
|
+
if (flags & 16 ||
|
|
188
|
+
(flags & 32 && checkDirty(c.deps_, c))) {
|
|
189
|
+
if (updateComputed(c)) {
|
|
190
|
+
const subs = c.subs_;
|
|
191
|
+
if (subs) {
|
|
192
|
+
shallowPropagate(subs);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else if (flags & 32) {
|
|
197
|
+
c.flags_ = flags & ~32;
|
|
198
|
+
}
|
|
199
|
+
if (activeSub) {
|
|
200
|
+
link(c, activeSub);
|
|
201
|
+
}
|
|
202
|
+
return c.value_;
|
|
203
|
+
};
|
|
204
|
+
const effectOper = (e) => {
|
|
205
|
+
let dep = e.deps_;
|
|
206
|
+
while (dep) {
|
|
207
|
+
dep = unlink(dep, e);
|
|
208
|
+
}
|
|
209
|
+
const sub = e.subs_;
|
|
210
|
+
if (sub) {
|
|
211
|
+
unlink(sub);
|
|
212
|
+
}
|
|
213
|
+
e.flags_ = 0;
|
|
214
|
+
};
|
|
215
|
+
const link = (dep, sub) => {
|
|
216
|
+
const prevDep = sub.depsTail_;
|
|
217
|
+
if (prevDep && prevDep.dep_ === dep) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const nextDep = prevDep ? prevDep.nextDep_ : sub.deps_;
|
|
221
|
+
if (nextDep && nextDep.dep_ === dep) {
|
|
222
|
+
nextDep.version_ = version;
|
|
223
|
+
sub.depsTail_ = nextDep;
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const prevSub = dep.subsTail_;
|
|
227
|
+
if (prevSub && prevSub.version_ === version && prevSub.sub_ === sub) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const newLink = (sub.depsTail_ =
|
|
231
|
+
dep.subsTail_ =
|
|
232
|
+
{
|
|
233
|
+
version_: version,
|
|
234
|
+
dep_: dep,
|
|
235
|
+
sub_: sub,
|
|
236
|
+
prevDep_: prevDep,
|
|
237
|
+
nextDep_: nextDep,
|
|
238
|
+
prevSub_: prevSub,
|
|
239
|
+
});
|
|
240
|
+
if (nextDep) {
|
|
241
|
+
nextDep.prevDep_ = newLink;
|
|
242
|
+
}
|
|
243
|
+
if (prevDep) {
|
|
244
|
+
prevDep.nextDep_ = newLink;
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
sub.deps_ = newLink;
|
|
248
|
+
}
|
|
249
|
+
if (prevSub) {
|
|
250
|
+
prevSub.nextSub_ = newLink;
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
dep.subs_ = newLink;
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
const unlink = (link, sub = link.sub_) => {
|
|
257
|
+
const dep_ = link.dep_;
|
|
258
|
+
const prevDep_ = link.prevDep_;
|
|
259
|
+
const nextDep_ = link.nextDep_;
|
|
260
|
+
const nextSub_ = link.nextSub_;
|
|
261
|
+
const prevSub_ = link.prevSub_;
|
|
262
|
+
if (nextDep_) {
|
|
263
|
+
nextDep_.prevDep_ = prevDep_;
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
sub.depsTail_ = prevDep_;
|
|
267
|
+
}
|
|
268
|
+
if (prevDep_) {
|
|
269
|
+
prevDep_.nextDep_ = nextDep_;
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
sub.deps_ = nextDep_;
|
|
273
|
+
}
|
|
274
|
+
if (nextSub_) {
|
|
275
|
+
nextSub_.prevSub_ = prevSub_;
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
dep_.subsTail_ = prevSub_;
|
|
279
|
+
}
|
|
280
|
+
if (prevSub_) {
|
|
281
|
+
prevSub_.nextSub_ = nextSub_;
|
|
282
|
+
}
|
|
283
|
+
else if (!(dep_.subs_ = nextSub_)) {
|
|
284
|
+
if ("getter" in dep_) {
|
|
285
|
+
let toRemove = dep_.deps_;
|
|
286
|
+
if (toRemove) {
|
|
287
|
+
dep_.flags_ = 17;
|
|
288
|
+
do {
|
|
289
|
+
toRemove = unlink(toRemove, dep_);
|
|
290
|
+
} while (toRemove);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
else if (!("previousValue" in dep_)) {
|
|
294
|
+
effectOper(dep_);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return nextDep_;
|
|
298
|
+
};
|
|
299
|
+
const propagate = (link) => {
|
|
300
|
+
let next = link.nextSub_;
|
|
301
|
+
let stack;
|
|
302
|
+
top: while (true) {
|
|
303
|
+
const sub = link.sub_;
|
|
304
|
+
let flags = sub.flags_;
|
|
305
|
+
if (!(flags &
|
|
306
|
+
60)) {
|
|
307
|
+
sub.flags_ = flags | 32;
|
|
308
|
+
}
|
|
309
|
+
else if (!(flags & 12)) {
|
|
310
|
+
flags = 0;
|
|
311
|
+
}
|
|
312
|
+
else if (!(flags & 4)) {
|
|
313
|
+
sub.flags_ =
|
|
314
|
+
(flags & ~8) | 32;
|
|
315
|
+
}
|
|
316
|
+
else if (!(flags & 48) &&
|
|
317
|
+
isValidLink(link, sub)) {
|
|
318
|
+
sub.flags_ = flags | 40;
|
|
319
|
+
flags &= 1;
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
flags = 0;
|
|
323
|
+
}
|
|
324
|
+
if (flags & 2) {
|
|
325
|
+
notify(sub);
|
|
326
|
+
}
|
|
327
|
+
if (flags & 1) {
|
|
328
|
+
const subSubs = sub.subs_;
|
|
329
|
+
if (subSubs) {
|
|
330
|
+
const nextSub = (link = subSubs).nextSub_;
|
|
331
|
+
if (nextSub) {
|
|
332
|
+
stack = { value_: next, prev_: stack };
|
|
333
|
+
next = nextSub;
|
|
334
|
+
}
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
if ((link = next)) {
|
|
339
|
+
next = link.nextSub_;
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
342
|
+
while (stack) {
|
|
343
|
+
link = stack.value_;
|
|
344
|
+
stack = stack.prev_;
|
|
345
|
+
if (link) {
|
|
346
|
+
next = link.nextSub_;
|
|
347
|
+
continue top;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
const startTracking = (sub) => {
|
|
354
|
+
version++;
|
|
355
|
+
sub.depsTail_ = undefined;
|
|
356
|
+
sub.flags_ =
|
|
357
|
+
(sub.flags_ & ~56) |
|
|
358
|
+
4;
|
|
359
|
+
};
|
|
360
|
+
const endTracking = (sub) => {
|
|
361
|
+
const depsTail_ = sub.depsTail_;
|
|
362
|
+
let toRemove = depsTail_ ? depsTail_.nextDep_ : sub.deps_;
|
|
363
|
+
while (toRemove) {
|
|
364
|
+
toRemove = unlink(toRemove, sub);
|
|
365
|
+
}
|
|
366
|
+
sub.flags_ &= ~4;
|
|
367
|
+
};
|
|
368
|
+
const checkDirty = (link, sub) => {
|
|
369
|
+
let stack;
|
|
370
|
+
let checkDepth = 0;
|
|
371
|
+
let dirty = false;
|
|
372
|
+
top: while (true) {
|
|
373
|
+
const dep = link.dep_;
|
|
374
|
+
const flags = dep.flags_;
|
|
375
|
+
if (sub.flags_ & 16) {
|
|
376
|
+
dirty = true;
|
|
377
|
+
}
|
|
378
|
+
else if ((flags & 17) ===
|
|
379
|
+
17) {
|
|
380
|
+
if (update(dep)) {
|
|
381
|
+
const subs = dep.subs_;
|
|
382
|
+
if (subs.nextSub_) {
|
|
383
|
+
shallowPropagate(subs);
|
|
384
|
+
}
|
|
385
|
+
dirty = true;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
else if ((flags & 33) ===
|
|
389
|
+
33) {
|
|
390
|
+
if (link.nextSub_ || link.prevSub_) {
|
|
391
|
+
stack = { value_: link, prev_: stack };
|
|
392
|
+
}
|
|
393
|
+
link = dep.deps_;
|
|
394
|
+
sub = dep;
|
|
395
|
+
++checkDepth;
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
if (!dirty) {
|
|
399
|
+
const nextDep = link.nextDep_;
|
|
400
|
+
if (nextDep) {
|
|
401
|
+
link = nextDep;
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
while (checkDepth--) {
|
|
406
|
+
const firstSub = sub.subs_;
|
|
407
|
+
const hasMultipleSubs = firstSub.nextSub_;
|
|
408
|
+
if (hasMultipleSubs) {
|
|
409
|
+
link = stack.value_;
|
|
410
|
+
stack = stack.prev_;
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
link = firstSub;
|
|
414
|
+
}
|
|
415
|
+
if (dirty) {
|
|
416
|
+
if (update(sub)) {
|
|
417
|
+
if (hasMultipleSubs) {
|
|
418
|
+
shallowPropagate(firstSub);
|
|
419
|
+
}
|
|
420
|
+
sub = link.sub_;
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
dirty = false;
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
sub.flags_ &= ~32;
|
|
427
|
+
}
|
|
428
|
+
sub = link.sub_;
|
|
429
|
+
if (link.nextDep_) {
|
|
430
|
+
link = link.nextDep_;
|
|
431
|
+
continue top;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
return dirty;
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
const shallowPropagate = (link) => {
|
|
438
|
+
do {
|
|
439
|
+
const sub = link.sub_;
|
|
440
|
+
const flags = sub.flags_;
|
|
441
|
+
if ((flags & 48) ===
|
|
442
|
+
32) {
|
|
443
|
+
sub.flags_ = flags | 16;
|
|
444
|
+
if (flags & 2) {
|
|
445
|
+
notify(sub);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
} while ((link = link.nextSub_));
|
|
449
|
+
};
|
|
450
|
+
const isValidLink = (checkLink, sub) => {
|
|
451
|
+
let link = sub.depsTail_;
|
|
452
|
+
while (link) {
|
|
453
|
+
if (link === checkLink) {
|
|
454
|
+
return true;
|
|
455
|
+
}
|
|
456
|
+
link = link.prevDep_;
|
|
457
|
+
}
|
|
458
|
+
return false;
|
|
459
|
+
};
|
|
460
|
+
export const getPath = (path) => {
|
|
461
|
+
let result = root;
|
|
462
|
+
const split = path.split(".");
|
|
463
|
+
for (const path of split) {
|
|
464
|
+
if (result == null || !hasOwn(result, path)) {
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
result = result[path];
|
|
468
|
+
}
|
|
469
|
+
return result;
|
|
470
|
+
};
|
|
471
|
+
const deep = (value, prefix = "") => {
|
|
472
|
+
const isArr = Array.isArray(value);
|
|
473
|
+
if (isArr || isPojo(value)) {
|
|
474
|
+
const deepObj = (isArr ? [] : {});
|
|
475
|
+
for (const key in value) {
|
|
476
|
+
deepObj[key] = signal(deep(value[key], `${prefix + key}.`));
|
|
477
|
+
}
|
|
478
|
+
const keys = signal(0);
|
|
479
|
+
return new Proxy(deepObj, {
|
|
480
|
+
get(_, prop) {
|
|
481
|
+
if (!(prop === "toJSON" && !hasOwn(deepObj, prop))) {
|
|
482
|
+
if (isArr && prop in Array.prototype) {
|
|
483
|
+
keys();
|
|
484
|
+
return deepObj[prop];
|
|
485
|
+
}
|
|
486
|
+
if (typeof prop === "symbol") {
|
|
487
|
+
return deepObj[prop];
|
|
488
|
+
}
|
|
489
|
+
if (!hasOwn(deepObj, prop) || deepObj[prop]() == null) {
|
|
490
|
+
deepObj[prop] = signal("");
|
|
491
|
+
dispatch(prefix + prop, "");
|
|
492
|
+
keys(keys() + 1);
|
|
493
|
+
}
|
|
494
|
+
return deepObj[prop]();
|
|
495
|
+
}
|
|
496
|
+
},
|
|
497
|
+
set(_, prop, newValue) {
|
|
498
|
+
const path = prefix + prop;
|
|
499
|
+
if (isArr && prop === "length") {
|
|
500
|
+
const diff = deepObj[prop] - newValue;
|
|
501
|
+
deepObj[prop] = newValue;
|
|
502
|
+
if (diff > 0) {
|
|
503
|
+
const patch = {};
|
|
504
|
+
for (let i = newValue; i < deepObj[prop]; i++) {
|
|
505
|
+
patch[i] = null;
|
|
506
|
+
}
|
|
507
|
+
dispatch(prefix.slice(0, -1), patch);
|
|
508
|
+
keys(keys() + 1);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
else if (hasOwn(deepObj, prop)) {
|
|
512
|
+
if (newValue == null) {
|
|
513
|
+
delete deepObj[prop];
|
|
514
|
+
}
|
|
515
|
+
else if (hasOwn(newValue, computedSymbol)) {
|
|
516
|
+
deepObj[prop] = newValue;
|
|
517
|
+
dispatch(path, "");
|
|
518
|
+
}
|
|
519
|
+
else {
|
|
520
|
+
const currentValue = deepObj[prop]();
|
|
521
|
+
const pathStr = `${path}.`;
|
|
522
|
+
if (isPojo(currentValue) && isPojo(newValue)) {
|
|
523
|
+
for (const key in currentValue) {
|
|
524
|
+
if (!hasOwn(newValue, key)) {
|
|
525
|
+
delete currentValue[key];
|
|
526
|
+
dispatch(pathStr + key, null);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
for (const key in newValue) {
|
|
530
|
+
const nextVal = newValue[key];
|
|
531
|
+
if (currentValue[key] !== nextVal) {
|
|
532
|
+
currentValue[key] = nextVal;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
else if (deepObj[prop](deep(newValue, pathStr))) {
|
|
537
|
+
dispatch(path, newValue);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
else if (newValue != null) {
|
|
542
|
+
if (hasOwn(newValue, computedSymbol)) {
|
|
543
|
+
deepObj[prop] = newValue;
|
|
544
|
+
dispatch(path, "");
|
|
545
|
+
}
|
|
546
|
+
else {
|
|
547
|
+
deepObj[prop] = signal(deep(newValue, `${path}.`));
|
|
548
|
+
dispatch(path, newValue);
|
|
549
|
+
}
|
|
550
|
+
keys(keys() + 1);
|
|
551
|
+
}
|
|
552
|
+
return true;
|
|
553
|
+
},
|
|
554
|
+
deleteProperty(_, prop) {
|
|
555
|
+
delete deepObj[prop];
|
|
556
|
+
keys(keys() + 1);
|
|
557
|
+
return true;
|
|
558
|
+
},
|
|
559
|
+
ownKeys() {
|
|
560
|
+
keys();
|
|
561
|
+
return Reflect.ownKeys(deepObj);
|
|
562
|
+
},
|
|
563
|
+
has(_, prop) {
|
|
564
|
+
keys();
|
|
565
|
+
return prop in deepObj;
|
|
566
|
+
},
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
return value;
|
|
570
|
+
};
|
|
571
|
+
const dispatch = (path, value) => {
|
|
572
|
+
if (path !== undefined && value !== undefined) {
|
|
573
|
+
currentPatch.push([path, value]);
|
|
574
|
+
}
|
|
575
|
+
if (!batchDepth && currentPatch.length) {
|
|
576
|
+
const detail = pathToObj(currentPatch);
|
|
577
|
+
currentPatch.length = 0;
|
|
578
|
+
document.dispatchEvent(new CustomEvent(DATASTAR_SIGNAL_PATCH_EVENT, {
|
|
579
|
+
detail,
|
|
580
|
+
}));
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
export const mergePatch = (patch, { ifMissing } = {}) => {
|
|
584
|
+
beginBatch();
|
|
585
|
+
for (const key in patch) {
|
|
586
|
+
if (patch[key] == null) {
|
|
587
|
+
if (!ifMissing) {
|
|
588
|
+
delete root[key];
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
else {
|
|
592
|
+
mergeInner(patch[key], key, root, "", ifMissing);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
endBatch();
|
|
596
|
+
};
|
|
597
|
+
export const mergePaths = (paths, options) => mergePatch(pathToObj(paths), options);
|
|
598
|
+
const mergeInner = (patch, target, targetParent, prefix, ifMissing) => {
|
|
599
|
+
if (isPojo(patch)) {
|
|
600
|
+
if (!(hasOwn(targetParent, target) &&
|
|
601
|
+
(isPojo(targetParent[target]) || Array.isArray(targetParent[target])))) {
|
|
602
|
+
targetParent[target] = {};
|
|
603
|
+
}
|
|
604
|
+
for (const key in patch) {
|
|
605
|
+
if (patch[key] == null) {
|
|
606
|
+
if (!ifMissing) {
|
|
607
|
+
delete targetParent[target][key];
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
else {
|
|
611
|
+
mergeInner(patch[key], key, targetParent[target], `${prefix + target}.`, ifMissing);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
else if (!(ifMissing && hasOwn(targetParent, target))) {
|
|
616
|
+
targetParent[target] = patch;
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
const toRegExp = (val) => typeof val === "string" ? RegExp(val.replace(/^\/|\/$/g, "")) : val;
|
|
620
|
+
export const filtered = ({ include = /.*/, exclude = /(?!)/ } = {}, obj = root) => {
|
|
621
|
+
const includeRe = toRegExp(include);
|
|
622
|
+
const excludeRe = toRegExp(exclude);
|
|
623
|
+
const paths = [];
|
|
624
|
+
const stack = [[obj, ""]];
|
|
625
|
+
while (stack.length) {
|
|
626
|
+
const [node, prefix] = stack.pop();
|
|
627
|
+
for (const key in node) {
|
|
628
|
+
const path = prefix + key;
|
|
629
|
+
if (isPojo(node[key])) {
|
|
630
|
+
stack.push([node[key], `${path}.`]);
|
|
631
|
+
}
|
|
632
|
+
else if (includeRe.test(path) && !excludeRe.test(path)) {
|
|
633
|
+
paths.push([path, getPath(path)]);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
return pathToObj(paths);
|
|
638
|
+
};
|
|
639
|
+
export const root = deep({});
|
|
640
|
+
/*********
|
|
641
|
+
* engine.ts (plugin system)
|
|
642
|
+
*********/
|
|
643
|
+
const url = "https://data-star.dev/errors";
|
|
644
|
+
const error = (ctx, reason, metadata = {}) => {
|
|
645
|
+
Object.assign(metadata, ctx);
|
|
646
|
+
const e = new Error();
|
|
647
|
+
const r = snake(reason);
|
|
648
|
+
const q = new URLSearchParams({
|
|
649
|
+
metadata: JSON.stringify(metadata),
|
|
650
|
+
}).toString();
|
|
651
|
+
const c = JSON.stringify(metadata, null, 2);
|
|
652
|
+
e.message = `${reason}\nMore info: ${url}/${r}?${q}\nContext: ${c}`;
|
|
653
|
+
return e;
|
|
654
|
+
};
|
|
655
|
+
const actionPlugins = new Map();
|
|
656
|
+
const attributePlugins = new Map();
|
|
657
|
+
const watcherPlugins = new Map();
|
|
658
|
+
export const actions = new Proxy({}, {
|
|
659
|
+
get: (_, prop) => actionPlugins.get(prop)?.apply,
|
|
660
|
+
has: (_, prop) => actionPlugins.has(prop),
|
|
661
|
+
ownKeys: () => Reflect.ownKeys(actionPlugins),
|
|
662
|
+
set: () => false,
|
|
663
|
+
deleteProperty: () => false,
|
|
664
|
+
});
|
|
665
|
+
const removals = new Map();
|
|
666
|
+
const queuedAttributes = [];
|
|
667
|
+
const queuedAttributeNames = new Set();
|
|
668
|
+
const observedRoots = new WeakSet();
|
|
669
|
+
export const attribute = (plugin) => {
|
|
670
|
+
queuedAttributes.push(plugin);
|
|
671
|
+
if (queuedAttributes.length === 1) {
|
|
672
|
+
setTimeout(() => {
|
|
673
|
+
for (const attribute of queuedAttributes) {
|
|
674
|
+
queuedAttributeNames.add(attribute.name);
|
|
675
|
+
attributePlugins.set(attribute.name, attribute);
|
|
676
|
+
}
|
|
677
|
+
queuedAttributes.length = 0;
|
|
678
|
+
apply();
|
|
679
|
+
queuedAttributeNames.clear();
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
export const action = (plugin) => {
|
|
684
|
+
actionPlugins.set(plugin.name, plugin);
|
|
685
|
+
};
|
|
686
|
+
document.addEventListener(DATASTAR_FETCH_EVENT, ((evt) => {
|
|
687
|
+
const plugin = watcherPlugins.get(evt.detail.type);
|
|
688
|
+
if (plugin) {
|
|
689
|
+
plugin.apply({
|
|
690
|
+
error: error.bind(0, {
|
|
691
|
+
plugin: { type: "watcher", name: plugin.name },
|
|
692
|
+
element: {
|
|
693
|
+
id: evt.target.id,
|
|
694
|
+
tag: evt.target.tagName,
|
|
695
|
+
},
|
|
696
|
+
}),
|
|
697
|
+
}, evt.detail.argsRaw);
|
|
698
|
+
}
|
|
699
|
+
}));
|
|
700
|
+
export const watcher = (plugin) => {
|
|
701
|
+
watcherPlugins.set(plugin.name, plugin);
|
|
702
|
+
};
|
|
703
|
+
const cleanupEls = (els) => {
|
|
704
|
+
for (const el of els) {
|
|
705
|
+
const elCleanups = removals.get(el);
|
|
706
|
+
if (elCleanups && removals.delete(el)) {
|
|
707
|
+
for (const attrCleanups of elCleanups.values()) {
|
|
708
|
+
for (const cleanup of attrCleanups.values()) {
|
|
709
|
+
cleanup();
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
const aliasedIgnore = aliasify("ignore");
|
|
716
|
+
const aliasedIgnoreAttr = `[${aliasedIgnore}]`;
|
|
717
|
+
const shouldIgnore = (el) => el.hasAttribute(`${aliasedIgnore}__self`) || !!el.closest(aliasedIgnoreAttr);
|
|
718
|
+
const applyEls = (els, onlyNew) => {
|
|
719
|
+
for (const el of els) {
|
|
720
|
+
if (!shouldIgnore(el)) {
|
|
721
|
+
for (const key in el.dataset) {
|
|
722
|
+
applyAttributePlugin(el, key.replace(/[A-Z]/g, "-$&").toLowerCase(), el.dataset[key], onlyNew);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
const observe = (mutations) => {
|
|
728
|
+
for (const { target, type, attributeName, addedNodes, removedNodes } of mutations) {
|
|
729
|
+
if (type === "childList") {
|
|
730
|
+
for (const node of removedNodes) {
|
|
731
|
+
if (isHTMLOrSVG(node)) {
|
|
732
|
+
cleanupEls([node]);
|
|
733
|
+
cleanupEls(node.querySelectorAll("*"));
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
for (const node of addedNodes) {
|
|
737
|
+
if (isHTMLOrSVG(node)) {
|
|
738
|
+
applyEls([node]);
|
|
739
|
+
applyEls(node.querySelectorAll("*"));
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
else if (type === "attributes" &&
|
|
744
|
+
attributeName.startsWith("data-") &&
|
|
745
|
+
isHTMLOrSVG(target) &&
|
|
746
|
+
!shouldIgnore(target)) {
|
|
747
|
+
const key = attributeName.slice(5);
|
|
748
|
+
const value = target.getAttribute(attributeName);
|
|
749
|
+
if (value === null) {
|
|
750
|
+
const elCleanups = removals.get(target);
|
|
751
|
+
if (elCleanups) {
|
|
752
|
+
const attrCleanups = elCleanups.get(key);
|
|
753
|
+
if (attrCleanups) {
|
|
754
|
+
for (const cleanup of attrCleanups.values()) {
|
|
755
|
+
cleanup();
|
|
756
|
+
}
|
|
757
|
+
elCleanups.delete(key);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
else {
|
|
762
|
+
applyAttributePlugin(target, key, value);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
const mutationObserver = new MutationObserver(observe);
|
|
768
|
+
export const parseAttributeKey = (rawKey) => {
|
|
769
|
+
const [namePart, ...rawModifiers] = rawKey.split("__");
|
|
770
|
+
const [pluginName, key] = namePart.split(/:(.+)/);
|
|
771
|
+
const mods = new Map();
|
|
772
|
+
for (const rawMod of rawModifiers) {
|
|
773
|
+
const [label, ...mod] = rawMod.split(".");
|
|
774
|
+
mods.set(label, new Set(mod));
|
|
775
|
+
}
|
|
776
|
+
return { pluginName, key, mods };
|
|
777
|
+
};
|
|
778
|
+
export const isDocumentObserverActive = () => observedRoots.has(document.documentElement);
|
|
779
|
+
export const apply = (root = document.documentElement, observeRoot = true) => {
|
|
780
|
+
if (isHTMLOrSVG(root)) {
|
|
781
|
+
applyEls([root], true);
|
|
782
|
+
}
|
|
783
|
+
applyEls(root.querySelectorAll("*"), true);
|
|
784
|
+
if (observeRoot) {
|
|
785
|
+
mutationObserver.observe(root, {
|
|
786
|
+
subtree: true,
|
|
787
|
+
childList: true,
|
|
788
|
+
attributes: true,
|
|
789
|
+
});
|
|
790
|
+
observedRoots.add(root);
|
|
791
|
+
}
|
|
792
|
+
};
|
|
793
|
+
const applyAttributePlugin = (el, attrKey, value, onlyNew) => {
|
|
794
|
+
const rawKey = attrKey;
|
|
795
|
+
const { pluginName, key, mods } = parseAttributeKey(rawKey);
|
|
796
|
+
const plugin = attributePlugins.get(pluginName);
|
|
797
|
+
if ((!onlyNew || queuedAttributeNames.has(pluginName)) && plugin) {
|
|
798
|
+
const ctx = {
|
|
799
|
+
el,
|
|
800
|
+
rawKey,
|
|
801
|
+
mods,
|
|
802
|
+
error: error.bind(0, {
|
|
803
|
+
plugin: { type: "attribute", name: plugin.name },
|
|
804
|
+
element: { id: el.id, tag: el.tagName },
|
|
805
|
+
expression: { rawKey, key, value },
|
|
806
|
+
}),
|
|
807
|
+
key,
|
|
808
|
+
value,
|
|
809
|
+
loadedPluginNames: {
|
|
810
|
+
actions: new Set(actionPlugins.keys()),
|
|
811
|
+
attributes: new Set(attributePlugins.keys()),
|
|
812
|
+
},
|
|
813
|
+
rx: undefined,
|
|
814
|
+
};
|
|
815
|
+
const keyReq = (plugin.requirement &&
|
|
816
|
+
(typeof plugin.requirement === "string" ? plugin.requirement : plugin.requirement.key)) ||
|
|
817
|
+
"allowed";
|
|
818
|
+
const valueReq = (plugin.requirement &&
|
|
819
|
+
(typeof plugin.requirement === "string" ? plugin.requirement : plugin.requirement.value)) ||
|
|
820
|
+
"allowed";
|
|
821
|
+
const keyProvided = key !== undefined && key !== null && key !== "";
|
|
822
|
+
const valueProvided = value !== undefined && value !== null && value !== "";
|
|
823
|
+
if (keyProvided) {
|
|
824
|
+
if (keyReq === "denied") {
|
|
825
|
+
throw ctx.error("KeyNotAllowed");
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
else if (keyReq === "must") {
|
|
829
|
+
throw ctx.error("KeyRequired");
|
|
830
|
+
}
|
|
831
|
+
if (valueProvided) {
|
|
832
|
+
if (valueReq === "denied") {
|
|
833
|
+
throw ctx.error("ValueNotAllowed");
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
else if (valueReq === "must") {
|
|
837
|
+
throw ctx.error("ValueRequired");
|
|
838
|
+
}
|
|
839
|
+
if (keyReq === "exclusive" || valueReq === "exclusive") {
|
|
840
|
+
if (keyProvided && valueProvided) {
|
|
841
|
+
throw ctx.error("KeyAndValueProvided");
|
|
842
|
+
}
|
|
843
|
+
if (!keyProvided && !valueProvided) {
|
|
844
|
+
throw ctx.error("KeyOrValueRequired");
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
const cleanups = new Map();
|
|
848
|
+
if (valueProvided) {
|
|
849
|
+
let cachedRx;
|
|
850
|
+
ctx.rx = (...args) => {
|
|
851
|
+
if (!cachedRx) {
|
|
852
|
+
cachedRx = genRx(value, {
|
|
853
|
+
returnsValue: plugin.returnsValue,
|
|
854
|
+
argNames: plugin.argNames,
|
|
855
|
+
cleanups,
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
return cachedRx(el, ...args);
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
const cleanup = plugin.apply(ctx);
|
|
862
|
+
if (cleanup) {
|
|
863
|
+
cleanups.set("attribute", cleanup);
|
|
864
|
+
}
|
|
865
|
+
let elCleanups = removals.get(el);
|
|
866
|
+
if (elCleanups) {
|
|
867
|
+
const attrCleanups = elCleanups.get(rawKey);
|
|
868
|
+
if (attrCleanups) {
|
|
869
|
+
for (const oldCleanup of attrCleanups.values()) {
|
|
870
|
+
oldCleanup();
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
else {
|
|
875
|
+
elCleanups = new Map();
|
|
876
|
+
removals.set(el, elCleanups);
|
|
877
|
+
}
|
|
878
|
+
elCleanups.set(rawKey, cleanups);
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
const genRx = (value, { returnsValue = false, argNames = [], cleanups = new Map() } = {}) => {
|
|
882
|
+
if (/^\s*(?:async\s+)?(?:\(.*?\)\s*=>|[\w$]+\s*=>|function\s*[\w$]*\s*\()/.test(value)) {
|
|
883
|
+
const userFn = Function(`return (${value.trim()})`)();
|
|
884
|
+
return (el, ...args) => {
|
|
885
|
+
const actionsProxy = new Proxy({}, {
|
|
886
|
+
get: (_, name) => (...actionArgs) => {
|
|
887
|
+
const err = error.bind(0, {
|
|
888
|
+
plugin: { type: "action", name },
|
|
889
|
+
element: { id: el.id, tag: el.tagName },
|
|
890
|
+
expression: { fnContent: value, value },
|
|
891
|
+
});
|
|
892
|
+
const fn = actions[name];
|
|
893
|
+
if (fn)
|
|
894
|
+
return fn({ el, evt: undefined, error: err, cleanups }, ...actionArgs);
|
|
895
|
+
throw err("UndefinedAction");
|
|
896
|
+
},
|
|
897
|
+
});
|
|
898
|
+
const dataEvt = args[0] instanceof Event ? args[0] : new Event("datastar:expression");
|
|
899
|
+
Object.defineProperties(dataEvt, {
|
|
900
|
+
target: { value: el },
|
|
901
|
+
signals: { value: root },
|
|
902
|
+
actions: { value: actionsProxy },
|
|
903
|
+
window: { value: window },
|
|
904
|
+
});
|
|
905
|
+
try {
|
|
906
|
+
return userFn(dataEvt);
|
|
907
|
+
}
|
|
908
|
+
catch (e) {
|
|
909
|
+
console.error(e);
|
|
910
|
+
throw error({
|
|
911
|
+
element: { id: el.id, tag: el.tagName },
|
|
912
|
+
expression: { fnContent: value, value },
|
|
913
|
+
error: e.message,
|
|
914
|
+
}, "ExecuteExpression");
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
let expr = "";
|
|
919
|
+
if (returnsValue) {
|
|
920
|
+
const statementRe = /(\/(\\\/|[^/])*\/|"(\\"|[^"])*"|'(\\'|[^'])*'|`(\\`|[^`])*`|\(\s*((function)\s*\(\s*\)|(\(\s*\))\s*=>)\s*(?:\{[\s\S]*?\}|[^;){]*)\s*\)\s*\(\s*\)|[^;])+/gm;
|
|
921
|
+
const statements = value.trim().match(statementRe);
|
|
922
|
+
if (statements) {
|
|
923
|
+
const lastIdx = statements.length - 1;
|
|
924
|
+
const last = statements[lastIdx].trim();
|
|
925
|
+
if (!last.startsWith("return")) {
|
|
926
|
+
statements[lastIdx] = `return (${last});`;
|
|
927
|
+
}
|
|
928
|
+
expr = statements.join(";\n");
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
else {
|
|
932
|
+
expr = value.trim();
|
|
933
|
+
}
|
|
934
|
+
const escaped = new Map();
|
|
935
|
+
const escapeRe = RegExp(`(?:${DSP})(.*?)(?:${DSS})`, "gm");
|
|
936
|
+
let counter = 0;
|
|
937
|
+
for (const match of expr.matchAll(escapeRe)) {
|
|
938
|
+
const k = match[1];
|
|
939
|
+
const v = `__escaped${counter++}`;
|
|
940
|
+
escaped.set(v, k);
|
|
941
|
+
expr = expr.replace(DSP + k + DSS, v);
|
|
942
|
+
}
|
|
943
|
+
expr = expr
|
|
944
|
+
.replace(/\$\['([a-zA-Z_$\d][\w$]*)'\]/g, "$$$1")
|
|
945
|
+
.replace(/\$([a-zA-Z_\d]\w*(?:[.-]\w+)*)/g, (_, signalName) => signalName.split(".").reduce((acc, part) => `${acc}['${part}']`, "$"));
|
|
946
|
+
expr = expr.replaceAll(/@([A-Za-z_$][\w$]*)\(/g, '__action("$1",evt,');
|
|
947
|
+
for (const [k, v] of escaped) {
|
|
948
|
+
expr = expr.replace(k, v);
|
|
949
|
+
}
|
|
950
|
+
try {
|
|
951
|
+
const fn = Function("el", "$", "__action", "evt", ...argNames, expr);
|
|
952
|
+
return (el, ...args) => {
|
|
953
|
+
const action = (name, evt, ...args) => {
|
|
954
|
+
const err = error.bind(0, {
|
|
955
|
+
plugin: { type: "action", name },
|
|
956
|
+
element: { id: el.id, tag: el.tagName },
|
|
957
|
+
expression: {
|
|
958
|
+
fnContent: expr,
|
|
959
|
+
value,
|
|
960
|
+
},
|
|
961
|
+
});
|
|
962
|
+
const fn = actions[name];
|
|
963
|
+
if (fn) {
|
|
964
|
+
return fn({
|
|
965
|
+
el,
|
|
966
|
+
evt,
|
|
967
|
+
error: err,
|
|
968
|
+
cleanups,
|
|
969
|
+
}, ...args);
|
|
970
|
+
}
|
|
971
|
+
throw err("UndefinedAction");
|
|
972
|
+
};
|
|
973
|
+
try {
|
|
974
|
+
return fn(el, root, action, undefined, ...args);
|
|
975
|
+
}
|
|
976
|
+
catch (e) {
|
|
977
|
+
console.error(e);
|
|
978
|
+
throw error({
|
|
979
|
+
element: { id: el.id, tag: el.tagName },
|
|
980
|
+
expression: {
|
|
981
|
+
fnContent: expr,
|
|
982
|
+
value,
|
|
983
|
+
},
|
|
984
|
+
error: e.message,
|
|
985
|
+
}, "ExecuteExpression");
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
catch (e) {
|
|
990
|
+
console.error(e);
|
|
991
|
+
throw error({
|
|
992
|
+
expression: {
|
|
993
|
+
fnContent: expr,
|
|
994
|
+
value,
|
|
995
|
+
},
|
|
996
|
+
error: e.message,
|
|
997
|
+
}, "GenerateExpression");
|
|
998
|
+
}
|
|
999
|
+
};
|
|
1000
|
+
//# sourceMappingURL=engine.js.map
|