vivth 1.4.9 → 1.5.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/README.md +6060 -2037
- package/README.src.md +22 -14
- package/bun.lock +154 -194
- package/dev/auto/.src.ignore +25 -0
- package/dev/auto-doc.mjs +137 -0
- package/generated/types/generated/vivth/exports/all.d.mts +145 -0
- package/generated/types/generated/vivth/exports/neutral.d.mts +105 -0
- package/generated/types/generated/vivth/exports/node.d.mts +40 -0
- package/generated/types/src/bundler/CompileAS.d.mts +30 -0
- package/generated/types/src/bundler/CompileJS.d.mts +109 -0
- package/{types → generated/types}/src/bundler/CreateESPlugin.d.mts +1 -1
- package/{types → generated/types}/src/bundler/EsBundler.d.mts +9 -7
- package/generated/types/src/bundler/FSAnalyzer.d.mts +58 -0
- package/generated/types/src/bundler/FSasar.bundled.d.mts +28 -0
- package/generated/types/src/bundler/FSasar.d.mts +51 -0
- package/generated/types/src/bundler/FileSelfMapper.d.mts +137 -0
- package/generated/types/src/bundler/JSDirMapper.d.mts +128 -0
- package/generated/types/src/bundler/RunWatchThenCompileJSOnSafeExit.d.mts +63 -0
- package/generated/types/src/bundler/adds/BrowserExternals.d.mts +21 -0
- package/generated/types/src/bundler/adds/CreateTransform.d.mts +26 -0
- package/generated/types/src/bundler/adds/LastEditedUnix.d.mts +5 -0
- package/generated/types/src/bundler/adds/NodeModuleList.d.mts +15 -0
- package/generated/types/src/bundler/adds/PathFSBundles.bundled.d.mts +25 -0
- package/generated/types/src/bundler/adds/PathFSBundles.d.mts +48 -0
- package/generated/types/src/bundler/adds/PathFSDir.bundled.d.mts +30 -0
- package/generated/types/src/bundler/adds/PathFSDir.d.mts +48 -0
- package/generated/types/src/bundler/adds/PathFSFile.bundled.d.mts +25 -0
- package/generated/types/src/bundler/adds/PathFSFile.d.mts +40 -0
- package/{types → generated/types}/src/bundler/adds/ToBundledJSPlugin.d.mts +6 -6
- package/generated/types/src/bundler/adds/autoExternalize.d.mts +2 -0
- package/generated/types/src/bundler/adds/emptyBufferValue.d.mts +1 -0
- package/generated/types/src/bundler/adds/isModuleTheBundledVersion.d.mts +1 -0
- package/generated/types/src/bundler/adds/onEndEsBuildErrorLogger.d.mts +1 -0
- package/generated/types/src/bundler/adds/resolveJSDependencyPath.d.mts +1 -0
- package/generated/types/src/class/AwaitSignal.d.mts +48 -0
- package/generated/types/src/class/Console.d.mts +82 -0
- package/generated/types/src/class/DataLog.d.mts +25 -0
- package/generated/types/src/class/Derived.d.mts +74 -0
- package/generated/types/src/class/Effect.d.mts +213 -0
- package/{types → generated/types}/src/class/EnvSignal.d.mts +6 -2
- package/generated/types/src/class/EsWatcher.d.mts +36 -0
- package/{types → generated/types}/src/class/EventSignal.d.mts +39 -39
- package/generated/types/src/class/FSDirArchWatcher.d.mts +110 -0
- package/{types → generated/types}/src/class/FileSafe.d.mts +32 -16
- package/generated/types/src/class/ForEach.d.mts +57 -0
- package/generated/types/src/class/ForSignal.d.mts +63 -0
- package/generated/types/src/class/GetterSetter.d.mts +38 -0
- package/generated/types/src/class/JSONFileHandler.d.mts +50 -0
- package/{types → generated/types}/src/class/ListSignal.d.mts +49 -15
- package/{types → generated/types}/src/class/LitExp.d.mts +18 -18
- package/generated/types/src/class/ObjectSignal.d.mts +267 -0
- package/generated/types/src/class/Paths.d.mts +95 -0
- package/generated/types/src/class/Prettivy.d.mts +26 -0
- package/{types → generated/types}/src/class/QChannel.d.mts +24 -16
- package/generated/types/src/class/SafeExit.d.mts +69 -0
- package/{types → generated/types}/src/class/Setup.d.mts +29 -16
- package/{types → generated/types}/src/class/Signal.d.mts +29 -15
- package/generated/types/src/class/SignalCollection.d.mts +96 -0
- package/{types → generated/types}/src/class/WalkThrough.d.mts +4 -19
- package/generated/types/src/class/WorkerMainThread.bundled.d.mts +83 -0
- package/{types → generated/types}/src/class/WorkerMainThread.d.mts +33 -39
- package/{types → generated/types}/src/class/WorkerThread.d.mts +11 -5
- package/{types → generated/types}/src/common/Base64URL.d.mts +2 -1
- package/generated/types/src/common/Base64URLFromFile.d.mts +20 -0
- package/generated/types/src/common/BundledV.bundled.d.mts +3 -0
- package/generated/types/src/common/BundledV.d.mts +36 -0
- package/{types → generated/types}/src/common/CreateStringID.d.mts +5 -4
- package/generated/types/src/common/EnvMode.d.mts +79 -0
- package/generated/types/src/common/FactoryKey.d.mts +9 -0
- package/generated/types/src/common/Preferrence.d.mts +25 -0
- package/{types → generated/types}/src/common/Trace.d.mts +1 -1
- package/{types → generated/types}/src/common/TracePath.d.mts +1 -1
- package/generated/types/src/common/VivthUnBundledCodeBlock.d.mts +6 -0
- package/generated/types/src/doc/JSautoDOC.d.mts +172 -0
- package/generated/types/src/doc/cleanPreserveTypedef.d.mts +1 -0
- package/{types/src/doc/parsedFile.d.mts → generated/types/src/doc/parsedFileForDOC.d.mts} +56 -27
- package/generated/types/src/function/ClearRequireCache.d.mts +1 -0
- package/{types → generated/types}/src/function/CreateImmutable.d.mts +5 -4
- package/{types → generated/types}/src/function/EventCheck.d.mts +3 -1
- package/{types → generated/types}/src/function/EventObject.d.mts +2 -6
- package/generated/types/src/function/ForInAsync.d.mts +36 -0
- package/generated/types/src/function/ForInSync.d.mts +36 -0
- package/generated/types/src/function/ForOfAsync.d.mts +25 -0
- package/generated/types/src/function/ForOfSync.d.mts +36 -0
- package/generated/types/src/function/GetBufferFromRelativePath.d.mts +15 -0
- package/generated/types/src/function/GetFilesFromDir.d.mts +14 -0
- package/generated/types/src/function/GetMaxFilenameLength.d.mts +9 -0
- package/generated/types/src/function/GetModuleEsbuildPlatform.d.mts +13 -0
- package/{types → generated/types}/src/function/GetNamedImportAlias.d.mts +1 -1
- package/generated/types/src/function/GetRuntime.d.mts +2 -0
- package/generated/types/src/function/InstantiateAssemblyScript.d.mts +15 -0
- package/{types → generated/types}/src/function/IsAsync.d.mts +1 -1
- package/generated/types/src/function/IsInstanceOf.d.mts +25 -0
- package/generated/types/src/function/IsSameFile.d.mts +16 -0
- package/generated/types/src/function/IsStringLooksLikeAPath.d.mts +16 -0
- package/generated/types/src/function/IsTypeOf.d.mts +25 -0
- package/{types → generated/types}/src/function/LazyFactory.d.mts +9 -10
- package/generated/types/src/function/MonkeyPatch.d.mts +33 -0
- package/generated/types/src/function/NewAnimationTimeline.d.mts +24 -0
- package/generated/types/src/function/NewChainable.d.mts +35 -0
- package/generated/types/src/function/NewDynamicsExport.d.mts +49 -0
- package/generated/types/src/function/NewObjectWrapper.d.mts +10 -0
- package/generated/types/src/function/ObjectRegistrar.d.mts +17 -0
- package/generated/types/src/function/ParseSQLFile.d.mts +25 -0
- package/generated/types/src/function/PipeAsync.d.mts +19 -0
- package/generated/types/src/function/PipeSync.d.mts +17 -0
- package/generated/types/src/function/SafeImport.d.mts +21 -0
- package/generated/types/src/function/TemplateLiteral.d.mts +23 -0
- package/{types → generated/types}/src/function/Timeout.d.mts +1 -1
- package/{types → generated/types}/src/function/Tries.d.mts +4 -4
- package/{types → generated/types}/src/function/TryAsync.d.mts +2 -2
- package/{types → generated/types}/src/function/TryNew.d.mts +1 -1
- package/generated/types/src/function/TsToMjs.d.mts +27 -0
- package/generated/types/src/function/UniqueFSTempName.d.mts +9 -0
- package/generated/types/src/function/errorToMessage.d.mts +5 -0
- package/generated/types/src/neinth/VivthyNeinth.d.mts +202 -0
- package/generated/types/src/typehints/ArrayToKeys.d.mts +23 -0
- package/generated/types/src/typehints/AssemblyScriptExportsType.d.mts +4 -0
- package/generated/types/src/typehints/AssemblyScriptLoaderInstantiate.d.mts +4 -0
- package/generated/types/src/typehints/AutoDocASOptions.d.mts +15 -0
- package/generated/types/src/typehints/ChainableType.d.mts +3 -0
- package/generated/types/src/typehints/ComponentDecorator_Constructor.d.mts +3 -0
- package/generated/types/src/typehints/ConsoleAdditionalSettingType.d.mts +3 -0
- package/generated/types/src/typehints/Decorator.d.mts +11 -0
- package/generated/types/src/typehints/DecoratorMonkeyPatch.d.mts +15 -0
- package/{types/src/types → generated/types/src/typehints}/DevTestCB.d.mts +2 -2
- package/generated/types/src/typehints/EnvModeType.d.mts +4 -0
- package/generated/types/src/typehints/ListArg.d.mts +4 -0
- package/generated/types/src/typehints/MonkeyPatchedType.d.mts +1 -0
- package/generated/types/src/typehints/ParametersFollowingN.d.mts +13 -0
- package/generated/types/src/typehints/PrefixedKeysOf.d.mts +1 -0
- package/generated/types/src/typehints/Runtime.d.mts +4 -0
- package/generated/types/src/typehints/SafeImportReturnType.d.mts +1 -0
- package/generated/types/src/typehints/StylePropRefType.d.mts +2 -0
- package/generated/types/src/typehints/TemplateLiteralValueHandler.d.mts +10 -0
- package/generated/types/src/typehints/VLifecycleCallbacks.d.mts +6 -0
- package/generated/types/src/typehints/VivthCleanup.d.mts +12 -0
- package/generated/types/src/web/BrowserDirMapper.d.mts +70 -0
- package/generated/types/src/web/EnsureValidTag.d.mts +7 -0
- package/generated/types/src/web/ViteAddDynamics.d.mts +28 -0
- package/generated/types/src/web/ViteGetAllHTMLFile.d.mts +9 -0
- package/generated/types/src/web/WC_extendsA.d.mts +135 -0
- package/generated/types/src/web/WC_extendsB.d.mts +135 -0
- package/generated/types/src/web/bindings/WC_StyleProp_bind.d.mts +42 -0
- package/generated/types/src/web/bindings/WC_createElement_bind.d.mts +51 -0
- package/generated/types/src/web/bindings/WC_createNamedSlot.d.mts +26 -0
- package/generated/types/src/web/bindings/WC_litRender_bind.d.mts +20 -0
- package/generated/types/src/web/bindings/WC_litStyleMap.d.mts +7 -0
- package/generated/types/src/web/common/CSS.d.mts +23 -0
- package/generated/types/src/web/common/E.d.mts +41 -0
- package/generated/types/src/web/common/NewStyleSheetAsync.d.mts +15 -0
- package/generated/types/src/web/common/NewStyleSheetSync.d.mts +15 -0
- package/generated/types/src/web/common/WC_TagName_type.d.mts +15 -0
- package/generated/types/src/web/signals/IsInViewPortSignal.d.mts +52 -0
- package/generated/types/src/web/signals/ObserverSignal.d.mts +32 -0
- package/generated/types/src/web/signals/WC_litRef.d.mts +26 -0
- package/generated/types/src/web/signals/WC_loopedSiblingsRef.d.mts +44 -0
- package/generated/vivth/exports/all.mjs +233 -0
- package/generated/vivth/exports/neutral.mjs +193 -0
- package/generated/vivth/exports/node.mjs +46 -0
- package/package.json +50 -14
- package/src/bundler/CompileAS.mjs +36 -0
- package/src/bundler/CompileJS.mjs +98 -171
- package/src/bundler/CreateESPlugin.mjs +1 -1
- package/src/bundler/EsBundler.mjs +38 -13
- package/src/bundler/FSAnalyzer.mjs +253 -0
- package/src/bundler/FSasar.bundled.mjs +128 -0
- package/src/bundler/FSasar.mjs +96 -0
- package/src/bundler/FileSelfMapper.mjs +491 -0
- package/src/bundler/JSDirMapper.mjs +528 -0
- package/src/bundler/RunWatchThenCompileJSOnSafeExit.mjs +129 -0
- package/src/bundler/adds/BrowserExternals.mjs +37 -0
- package/src/bundler/adds/CreateTransform.mjs +36 -0
- package/src/bundler/adds/LastEditedUnix.mjs +12 -0
- package/src/bundler/adds/NodeModuleList.mjs +33 -0
- package/src/bundler/adds/PathFSBundles.bundled.mjs +41 -0
- package/src/bundler/adds/PathFSBundles.mjs +91 -0
- package/src/bundler/adds/PathFSDir.bundled.mjs +53 -0
- package/src/bundler/adds/PathFSDir.mjs +100 -0
- package/src/bundler/adds/PathFSFile.bundled.mjs +40 -0
- package/src/bundler/adds/PathFSFile.mjs +85 -0
- package/src/bundler/adds/ToBundledJSPlugin.mjs +116 -55
- package/src/bundler/adds/autoExternalize.mjs +81 -0
- package/src/bundler/adds/emptyBufferValue.mjs +5 -0
- package/src/bundler/adds/isModuleTheBundledVersion.mjs +10 -0
- package/src/bundler/adds/onEndEsBuildErrorLogger.mjs +34 -0
- package/src/bundler/adds/resolveJSDependencyPath.mjs +17 -0
- package/src/class/AwaitSignal.mjs +119 -0
- package/src/class/Console.mjs +36 -14
- package/src/class/DataLog.mjs +29 -0
- package/src/class/Derived.mjs +67 -55
- package/src/class/Effect.mjs +270 -84
- package/src/class/EnvSignal.mjs +11 -8
- package/src/class/EsWatcher.mjs +60 -0
- package/src/class/EventSignal.mjs +46 -58
- package/src/class/FSDirArchWatcher.mjs +246 -0
- package/src/class/FileSafe.mjs +72 -24
- package/src/class/ForEach.mjs +78 -0
- package/src/class/ForSignal.mjs +115 -0
- package/src/class/GetterSetter.mjs +40 -0
- package/src/class/JSONFileHandler.mjs +90 -0
- package/src/class/ListSignal.mjs +68 -26
- package/src/class/LitExp.mjs +59 -36
- package/src/class/ObjectSignal.mjs +225 -0
- package/src/class/Paths.mjs +56 -20
- package/src/class/Prettivy.mjs +51 -0
- package/src/class/QChannel.mjs +48 -26
- package/src/class/SafeExit.mjs +156 -99
- package/src/class/Setup.mjs +28 -16
- package/src/class/Signal.mjs +50 -27
- package/src/class/SignalCollection.mjs +130 -0
- package/src/class/WalkThrough.mjs +6 -23
- package/src/class/{WorkerMainThreadBundled.mjs → WorkerMainThread.bundled.mjs} +61 -84
- package/src/class/WorkerMainThread.mjs +103 -102
- package/src/class/WorkerThread.mjs +24 -17
- package/src/common/Base64URL.mjs +6 -3
- package/src/common/Base64URLFromFile.mjs +17 -4
- package/src/common/BundledV.bundled.mjs +7 -0
- package/src/common/BundledV.mjs +45 -0
- package/src/common/CreateStringID.mjs +8 -7
- package/src/common/EnvMode.mjs +172 -0
- package/src/common/FactoryKey.mjs +11 -0
- package/src/common/Preferrence.mjs +27 -0
- package/src/common/Trace.mjs +1 -1
- package/src/common/TracePath.mjs +53 -3
- package/src/common/VivthUnBundledCodeBlock.mjs +8 -0
- package/src/doc/JSautoDOC.mjs +673 -284
- package/src/doc/cleanPreserveTypedef.mjs +27 -0
- package/src/doc/correctBeforeParse.mjs +57 -48
- package/src/doc/{parsedFile.mjs → parsedFileForDOC.mjs} +133 -120
- package/src/function/ClearRequireCache.mjs +33 -0
- package/src/function/CreateImmutable.mjs +40 -37
- package/src/function/EventCheck.mjs +5 -2
- package/src/function/EventObject.mjs +2 -6
- package/src/function/ForInAsync.mjs +76 -0
- package/src/function/ForInSync.mjs +87 -0
- package/src/function/ForOfAsync.mjs +61 -0
- package/src/function/ForOfSync.mjs +70 -0
- package/src/function/GetBufferFromRelativePath.mjs +25 -0
- package/src/function/GetFilesFromDir.mjs +49 -0
- package/src/function/GetMaxFilenameLength.mjs +32 -0
- package/src/function/GetModuleEsbuildPlatform.mjs +118 -0
- package/src/function/GetNamedImportAlias.mjs +2 -2
- package/src/function/GetRuntime.mjs +10 -14
- package/src/function/InstantiateAssemblyScript.mjs +22 -0
- package/src/function/IsAsync.mjs +1 -1
- package/src/function/IsInstanceOf.mjs +29 -0
- package/src/function/IsSameFile.mjs +41 -0
- package/src/function/IsStringLooksLikeAPath.mjs +20 -0
- package/src/function/IsTypeOf.mjs +27 -0
- package/src/function/IsTypeOf.mts +31 -0
- package/src/function/LazyFactory.mjs +25 -23
- package/src/function/MonkeyPatch.mjs +38 -0
- package/src/function/NewAnimationTimeline.mjs +55 -0
- package/src/function/NewChainable.mjs +69 -0
- package/src/function/NewDynamicsExport.mjs +312 -0
- package/src/function/NewObjectWrapper.mjs +14 -0
- package/src/function/ObjectRegistrar.mjs +23 -0
- package/src/function/ParseSQLFile.mjs +129 -0
- package/src/function/PipeAsync.mjs +30 -0
- package/src/function/PipeSync.mjs +28 -0
- package/src/function/SafeImport.mjs +77 -0
- package/src/function/TemplateLiteral.mjs +42 -23
- package/src/function/Timeout.mjs +4 -4
- package/src/function/Tries.mjs +22 -16
- package/src/function/TryAsync.mjs +3 -2
- package/src/function/TryNew.mjs +1 -1
- package/src/function/TsToMjs.mjs +184 -21
- package/src/function/UniqueFSTempName.mjs +33 -0
- package/src/function/errorToMessage.mjs +21 -0
- package/src/function/resolveErrorArray.mjs +15 -1
- package/src/neinth/VivthyNeinth.mjs +487 -0
- package/src/typehints/ArrayToKeys.mjs +17 -0
- package/src/typehints/ArrayToKeys.mts +31 -0
- package/src/typehints/AssemblyScriptExportsType.mjs +7 -0
- package/src/typehints/AssemblyScriptLoaderInstantiate.mjs +7 -0
- package/src/typehints/AutoDocASOptions.mjs +14 -0
- package/src/typehints/ChainableType.mjs +11 -0
- package/src/typehints/ComponentDecorator_Constructor.mjs +10 -0
- package/src/typehints/ConsoleAdditionalSettingType.mjs +6 -0
- package/src/typehints/Decorator.mjs +9 -0
- package/src/typehints/Decorator.mts +31 -0
- package/src/typehints/DecoratorMonkeyPatch.mjs +10 -0
- package/src/typehints/DecoratorMonkeyPatch.mts +43 -0
- package/src/{types → typehints}/DevTestCB.mjs +2 -2
- package/src/typehints/EnvModeType.mjs +6 -0
- package/src/{types → typehints}/ListArg.mjs +1 -1
- package/src/{types → typehints}/LitExpResultType.mjs +1 -1
- package/src/typehints/MonkeyPatchedType.mjs +13 -0
- package/src/typehints/ParametersFollowingN.mjs +8 -0
- package/src/typehints/ParametersFollowingN.mts +17 -0
- package/src/typehints/PrefixedKeysOf.mjs +9 -0
- package/src/typehints/Runtime.mjs +6 -0
- package/src/typehints/SafeImportReturnType.mjs +6 -0
- package/src/typehints/StylePropRefType.mjs +12 -0
- package/src/typehints/TemplateLiteralValueHandler.mjs +14 -0
- package/src/typehints/VLifecycleCallbacks.mjs +10 -0
- package/src/typehints/VivthCleanup.mjs +14 -0
- package/src/web/BrowserDirMapper.mjs +255 -0
- package/src/web/EnsureValidTag.mjs +5 -0
- package/src/web/EnsureValidTag.mts +10 -0
- package/src/web/ViteAddDynamics.mjs +34 -0
- package/src/web/ViteGetAllHTMLFile.mjs +97 -0
- package/src/web/WC_extendsA.mjs +330 -0
- package/src/web/WC_extendsB.mjs +332 -0
- package/src/web/bindings/WC_StyleProp_bind.mjs +70 -0
- package/src/web/bindings/WC_createElement_bind.mjs +95 -0
- package/src/web/bindings/WC_createNamedSlot.mjs +29 -0
- package/src/web/bindings/WC_litRender_bind.mjs +26 -0
- package/src/web/bindings/WC_litStyleMap.mjs +14 -0
- package/src/web/common/CSS.mjs +35 -0
- package/src/web/common/E.mjs +126 -0
- package/src/web/common/NewStyleSheetAsync.mjs +21 -0
- package/src/web/common/NewStyleSheetSync.mjs +21 -0
- package/src/web/common/WC_TagName_type.mjs +10 -0
- package/src/web/common/WC_TagName_type.mts +36 -0
- package/src/web/signals/IsInViewPortSignal.mjs +140 -0
- package/src/web/signals/ObserverSignal.mjs +93 -0
- package/src/web/signals/WC_litRef.mjs +61 -0
- package/src/web/signals/WC_loopedSiblingsRef.mjs +100 -0
- package/tsconfig.json +44 -41
- package/index.mjs +0 -91
- package/src/bundler/FSInline.mjs +0 -67
- package/src/bundler/FSInlineAnalyzer.mjs +0 -228
- package/src/bundler/FSInlineBundled.mjs +0 -38
- package/src/bundler/adds/externals.mjs +0 -8
- package/src/class/ListDerived.mjs +0 -42
- package/src/common/Dev.mjs +0 -134
- package/src/common/DevBundled.mjs +0 -5
- package/src/common/lazie.mjs +0 -3
- package/src/types/IsListSignal.mjs +0 -6
- package/src/types/Runtime.mjs +0 -6
- package/src/types/VivthDevCodeBlockStringType.mjs +0 -6
- package/types/index.d.mts +0 -58
- package/types/src/bundler/CompileJS.d.mts +0 -119
- package/types/src/bundler/FSInline.d.mts +0 -50
- package/types/src/bundler/FSInlineAnalyzer.d.mts +0 -37
- package/types/src/bundler/FSInlineBundled.d.mts +0 -22
- package/types/src/bundler/adds/externals.d.mts +0 -1
- package/types/src/class/Console.d.mts +0 -71
- package/types/src/class/Derived.d.mts +0 -98
- package/types/src/class/Effect.d.mts +0 -216
- package/types/src/class/ListDerived.d.mts +0 -38
- package/types/src/class/Paths.d.mts +0 -69
- package/types/src/class/SafeExit.d.mts +0 -103
- package/types/src/class/WorkerMainThreadBundled.d.mts +0 -83
- package/types/src/common/Base64URLFromFile.d.mts +0 -16
- package/types/src/common/Dev.d.mts +0 -68
- package/types/src/common/DevBundled.d.mts +0 -3
- package/types/src/common/lazie.d.mts +0 -1
- package/types/src/doc/JSautoDOC.d.mts +0 -83
- package/types/src/function/GetRuntime.d.mts +0 -2
- package/types/src/function/TemplateLiteral.d.mts +0 -22
- package/types/src/function/TsToMjs.d.mts +0 -23
- package/types/src/types/IsListSignal.d.mts +0 -4
- package/types/src/types/ListArg.d.mts +0 -4
- package/types/src/types/Runtime.d.mts +0 -4
- package/types/src/types/VivthDevCodeBlockStringType.d.mts +0 -4
- /package/{types → generated/types}/src/bundler/adds/pluginVivthBundle.d.mts +0 -0
- /package/{types → generated/types}/src/class/WorkerResult.d.mts +0 -0
- /package/{types → generated/types}/src/common/EventNameSpace.d.mts +0 -0
- /package/{types → generated/types}/src/common/eventObjects.d.mts +0 -0
- /package/{types → generated/types}/src/common/keys.d.mts +0 -0
- /package/{types → generated/types}/src/doc/correctBeforeParse.d.mts +0 -0
- /package/{types → generated/types}/src/function/TrySync.d.mts +0 -0
- /package/{types → generated/types}/src/function/resolveErrorArray.d.mts +0 -0
- /package/{types/src/types → generated/types/src/typehints}/AnyButUndefined.d.mts +0 -0
- /package/{types/src/types → generated/types/src/typehints}/ExtnameType.d.mts +0 -0
- /package/{types/src/types → generated/types/src/typehints}/LitExpKeyType.d.mts +0 -0
- /package/{types/src/types → generated/types/src/typehints}/LitExpResultType.d.mts +0 -0
- /package/{types/src/types → generated/types/src/typehints}/MutationType.d.mts +0 -0
- /package/{types/src/types → generated/types/src/typehints}/QCBFIFOReturn.d.mts +0 -0
- /package/{types/src/types → generated/types/src/typehints}/QCBReturn.d.mts +0 -0
- /package/src/{types → typehints}/AnyButUndefined.mjs +0 -0
- /package/src/{types → typehints}/ExtnameType.mjs +0 -0
- /package/src/{types → typehints}/LitExpKeyType.mjs +0 -0
- /package/src/{types → typehints}/MutationType.mjs +0 -0
- /package/src/{types → typehints}/QCBFIFOReturn.mjs +0 -0
- /package/src/{types → typehints}/QCBReturn.mjs +0 -0
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* - class helper to inline files;
|
|
4
|
-
* >- as `type: "buffer"`;
|
|
5
|
-
* - use only if you are planning to use [CompileJS](#compilejs);
|
|
6
|
-
* >- the class static methods don't obfuscate target file;
|
|
7
|
-
* >- don't embed any sensitive content using this methods of this class;
|
|
8
|
-
*/
|
|
9
|
-
export class FSInline {
|
|
10
|
-
/**
|
|
11
|
-
* @description
|
|
12
|
-
* - declare entrypoint of file inlining;
|
|
13
|
-
* >- on the dev time, it's just regullar `readFile` from `node:fs/promises`;
|
|
14
|
-
* >- on the compiled, it will read file from `FSInline.vivthFSInlinelists`
|
|
15
|
-
* @param {string} filePathFromProject
|
|
16
|
-
* - doesn't require prefix;
|
|
17
|
-
* @returns {Promise<Buffer<ArrayBuffer>>}
|
|
18
|
-
* - dev: returns `ArrayBuffer`;
|
|
19
|
-
* - bundled: embed the `ArrayBuffer` of file, which then returned;
|
|
20
|
-
* >- `Dev` will be cleaned up;
|
|
21
|
-
* @example
|
|
22
|
-
* import { FSInline } from 'vivth';
|
|
23
|
-
*
|
|
24
|
-
* (await FSInline.vivthFSInlineFile('/assets/text.txt')).toString('utf-8');
|
|
25
|
-
*/
|
|
26
|
-
static vivthFSInlineFile: (filePathFromProject: string) => Promise<Buffer<ArrayBuffer>>;
|
|
27
|
-
/**
|
|
28
|
-
* @description
|
|
29
|
-
* - declare entrypoint of file inlining, include all files on `dir` and `subdir` that match the `fileRule`;
|
|
30
|
-
* - consider this as inline assets embed/bundler;
|
|
31
|
-
* @param {string} dirPathFromProject
|
|
32
|
-
* - doesn't require prefix;
|
|
33
|
-
* @param {RegExp} fileRule
|
|
34
|
-
* @returns {Promise<typeof FSInline["vivthFSInlineFile"]>}
|
|
35
|
-
* @example
|
|
36
|
-
* import { FSInline } from 'vivth';
|
|
37
|
-
*
|
|
38
|
-
* export const pngAssets = await FSInline.vivthFSInlineDir('/assets', /.png$/g);
|
|
39
|
-
*/
|
|
40
|
-
static vivthFSInlineDir: (dirPathFromProject: string, fileRule: RegExp) => Promise<(typeof FSInline)["vivthFSInlineFile"]>;
|
|
41
|
-
/**
|
|
42
|
-
* @description
|
|
43
|
-
* - placeholder for FSInline;
|
|
44
|
-
* - it's remain publicly accessible so it doesn't mess with regex analyze on bundle;
|
|
45
|
-
* - shouldn't be manually accessed;
|
|
46
|
-
* >- access via `FSInline.vivthFSInlineFile` or `FSInline.vivthFSInlineDir`;
|
|
47
|
-
* @type {Record<string, Buffer<ArrayBuffer>>}
|
|
48
|
-
*/
|
|
49
|
-
static vivthFSInlinelists: Record<string, Buffer<ArrayBuffer>>;
|
|
50
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* - collections of static method to analyze content for `FSInline`;
|
|
4
|
-
* - mostly used internally;
|
|
5
|
-
*/
|
|
6
|
-
export class FSInlineAnalyzer {
|
|
7
|
-
/**
|
|
8
|
-
* @description
|
|
9
|
-
* - to be used on bundled content;
|
|
10
|
-
* @param {string} content
|
|
11
|
-
* @param {'cjs'|'esm'} format
|
|
12
|
-
* @returns {ReturnType<typeof TryAsync<string>>}
|
|
13
|
-
* @example
|
|
14
|
-
* import { readFile } from 'node:fs/promises';
|
|
15
|
-
*
|
|
16
|
-
* import { FSInlineAnalyzer } from 'vivth';
|
|
17
|
-
*
|
|
18
|
-
* const [resultFinalContent, errorFinalContent] = await FSInlineAnalyzer.finalContent(
|
|
19
|
-
* await readFile('./resultESBunlded.mjs', {encoding: 'utf-8'}),
|
|
20
|
-
* 'esm'
|
|
21
|
-
* );
|
|
22
|
-
*/
|
|
23
|
-
static finalContent: (content: string, format: "cjs" | "esm") => ReturnType<typeof TryAsync<string>>;
|
|
24
|
-
/**
|
|
25
|
-
* @typedef {{path:string, buffer:Buffer<ArrayBuffer>}[]} _dirReturn
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* @param {string} dirName
|
|
29
|
-
* @param {RegExp} ruleForFileFullPath
|
|
30
|
-
* @returns {Promise<_dirReturn>}
|
|
31
|
-
*/
|
|
32
|
-
static "__#private@#dir": (dirName: string, ruleForFileFullPath: RegExp) => Promise<{
|
|
33
|
-
path: string;
|
|
34
|
-
buffer: Buffer<ArrayBuffer>;
|
|
35
|
-
}[]>;
|
|
36
|
-
}
|
|
37
|
-
import { TryAsync } from '../function/TryAsync.mjs';
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export class FSInline {
|
|
2
|
-
static prefix: string;
|
|
3
|
-
/**
|
|
4
|
-
* @param {string} filePathFromProject
|
|
5
|
-
* @returns {Promise<Buffer<ArrayBuffer>>}
|
|
6
|
-
*/
|
|
7
|
-
static vivthFSInlineFile: (filePathFromProject: string) => Promise<Buffer<ArrayBuffer>>;
|
|
8
|
-
/**
|
|
9
|
-
* @param {string} dirPathFromProject
|
|
10
|
-
* @param {Object} regexRule
|
|
11
|
-
* @param {RegExp} regexRule.dir
|
|
12
|
-
* @param {RegExp} regexRule.file
|
|
13
|
-
* @returns {Promise<typeof FSInline["vivthFSInlineFile"]>}
|
|
14
|
-
* - relative to the `dirPathFromProject`
|
|
15
|
-
*/
|
|
16
|
-
static vivthFSInlineDir: (dirPathFromProject: string) => Promise<(typeof FSInline)["vivthFSInlineFile"]>;
|
|
17
|
-
/**
|
|
18
|
-
* - to be used as embed placeholder on `bundled` and `compiled`;
|
|
19
|
-
* @type {Record<string, Buffer<ArrayBufferLike>>}
|
|
20
|
-
*/
|
|
21
|
-
static vivthFSInlinelists: Record<string, Buffer<ArrayBufferLike>>;
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const externals: string[];
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* - class with static methods to print to standard console with bare minimum ANSI styles;
|
|
4
|
-
*/
|
|
5
|
-
export class Console {
|
|
6
|
-
static "__#private@#ansi": {
|
|
7
|
-
reset: string;
|
|
8
|
-
bold: string;
|
|
9
|
-
colors: {
|
|
10
|
-
log: string;
|
|
11
|
-
info: string;
|
|
12
|
-
warn: string;
|
|
13
|
-
error: string;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* @param {string} prefix
|
|
18
|
-
* @param {'log'|'info'|'error'|'warn'} mode
|
|
19
|
-
* @param {any} data
|
|
20
|
-
* @returns {void}
|
|
21
|
-
*/
|
|
22
|
-
static "__#private@#call": (prefix: string, mode: "log" | "info" | "error" | "warn", data: any) => void;
|
|
23
|
-
/**
|
|
24
|
-
* @description
|
|
25
|
-
* @param {any} data
|
|
26
|
-
* @returns {void}
|
|
27
|
-
* @example
|
|
28
|
-
* import { Console } from 'vivth';
|
|
29
|
-
*
|
|
30
|
-
* Console.log({
|
|
31
|
-
* hello: 'world!!',
|
|
32
|
-
* });
|
|
33
|
-
*/
|
|
34
|
-
static log: (data: any) => void;
|
|
35
|
-
/**
|
|
36
|
-
* @description
|
|
37
|
-
* @param {any} data
|
|
38
|
-
* @returns {void}
|
|
39
|
-
* @example
|
|
40
|
-
* import { Console } from 'vivth';
|
|
41
|
-
*
|
|
42
|
-
* Console.info({
|
|
43
|
-
* hello: 'world!!',
|
|
44
|
-
* });
|
|
45
|
-
*/
|
|
46
|
-
static info: (data: any) => void;
|
|
47
|
-
/**
|
|
48
|
-
* @description
|
|
49
|
-
* @param {any} data
|
|
50
|
-
* @returns {void}
|
|
51
|
-
* @example
|
|
52
|
-
* import { Console } from 'vivth';
|
|
53
|
-
*
|
|
54
|
-
* Console.warn({
|
|
55
|
-
* hello: 'world!!',
|
|
56
|
-
* });
|
|
57
|
-
*/
|
|
58
|
-
static warn: (data: any) => void;
|
|
59
|
-
/**
|
|
60
|
-
* @description
|
|
61
|
-
* @param {any} data
|
|
62
|
-
* @returns {void}
|
|
63
|
-
* @example
|
|
64
|
-
* import { Console } from 'vivth';
|
|
65
|
-
*
|
|
66
|
-
* Console.error({
|
|
67
|
-
* hello: 'world!!',
|
|
68
|
-
* });
|
|
69
|
-
*/
|
|
70
|
-
static error: (data: any) => void;
|
|
71
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* - a class for creating derived version of [Signal](#signal);
|
|
4
|
-
* @template VALUE
|
|
5
|
-
* @extends Signal<VALUE>
|
|
6
|
-
*/
|
|
7
|
-
export class Derived<VALUE> extends Signal<VALUE> {
|
|
8
|
-
/**
|
|
9
|
-
* @description
|
|
10
|
-
* - Derived used [Signal](#signal) and [Effect](#effect) under the hood;
|
|
11
|
-
* @param {(effectInstanceOptions:Omit<Effect["options"] &
|
|
12
|
-
* Derived<VALUE>["options"], unwrapLazy>) =>
|
|
13
|
-
* Promise<VALUE>} derivedFunction
|
|
14
|
-
* @example
|
|
15
|
-
* import { Signal, Derived } from 'vivth';
|
|
16
|
-
*
|
|
17
|
-
* const count = new Signal(0);
|
|
18
|
-
* const double = new Derived(async({
|
|
19
|
-
* subscribe,
|
|
20
|
-
* // : registrar callback for this derived instance, immediately return the signal instance
|
|
21
|
-
* }) => {
|
|
22
|
-
* return subscribe(count).value + count.value;
|
|
23
|
-
* // double listen to count changes, by returning the value, double.value also changes
|
|
24
|
-
* // notice the count.value are accessed double, but it's all safe,
|
|
25
|
-
* // since the wrapped one is the only one that are recorded as notifier.
|
|
26
|
-
* });
|
|
27
|
-
*
|
|
28
|
-
* count.value++;
|
|
29
|
-
*/
|
|
30
|
-
constructor(derivedFunction: (effectInstanceOptions: Omit<Effect["options"] & Derived<VALUE>["options"], "vivth:unwrapLazy;">) => Promise<VALUE>);
|
|
31
|
-
/**
|
|
32
|
-
* @description
|
|
33
|
-
* - additional helper to be accessed on effect;
|
|
34
|
-
*/
|
|
35
|
-
options: {
|
|
36
|
-
/**
|
|
37
|
-
* @instance options
|
|
38
|
-
* @description
|
|
39
|
-
* - return this value tandem with `isLastCalled`, to not to update the value of this instance, even when returning early;
|
|
40
|
-
* @type {Object}
|
|
41
|
-
* @example
|
|
42
|
-
* import { Signal, Derived } from 'vivth';
|
|
43
|
-
*
|
|
44
|
-
* const count = new Signal(0);
|
|
45
|
-
* const double = new Derived(async({
|
|
46
|
-
* subscribe,
|
|
47
|
-
* dontUpdate,
|
|
48
|
-
* isLastCalled,
|
|
49
|
-
* }) => {
|
|
50
|
-
* const currentValue = subscribe(count).value;
|
|
51
|
-
* if (!(await isLastCalled(10))) {
|
|
52
|
-
* return dontUpdate;
|
|
53
|
-
* }
|
|
54
|
-
* const res = await fetch(`some/path/${curentValue.toString()}`);
|
|
55
|
-
* if (!(await isLastCalled())) {
|
|
56
|
-
* return dontUpdate; // this will prevent race condition, even if the earlier fetch return late;
|
|
57
|
-
* }
|
|
58
|
-
* return res;
|
|
59
|
-
* });
|
|
60
|
-
*
|
|
61
|
-
* count.value++;
|
|
62
|
-
*/
|
|
63
|
-
dontUpdate: Object;
|
|
64
|
-
} & {
|
|
65
|
-
"vivth:unwrapLazy;": () => {
|
|
66
|
-
/**
|
|
67
|
-
* @instance options
|
|
68
|
-
* @description
|
|
69
|
-
* - return this value tandem with `isLastCalled`, to not to update the value of this instance, even when returning early;
|
|
70
|
-
* @type {Object}
|
|
71
|
-
* @example
|
|
72
|
-
* import { Signal, Derived } from 'vivth';
|
|
73
|
-
*
|
|
74
|
-
* const count = new Signal(0);
|
|
75
|
-
* const double = new Derived(async({
|
|
76
|
-
* subscribe,
|
|
77
|
-
* dontUpdate,
|
|
78
|
-
* isLastCalled,
|
|
79
|
-
* }) => {
|
|
80
|
-
* const currentValue = subscribe(count).value;
|
|
81
|
-
* if (!(await isLastCalled(10))) {
|
|
82
|
-
* return dontUpdate;
|
|
83
|
-
* }
|
|
84
|
-
* const res = await fetch(`some/path/${curentValue.toString()}`);
|
|
85
|
-
* if (!(await isLastCalled())) {
|
|
86
|
-
* return dontUpdate; // this will prevent race condition, even if the earlier fetch return late;
|
|
87
|
-
* }
|
|
88
|
-
* return res;
|
|
89
|
-
* });
|
|
90
|
-
*
|
|
91
|
-
* count.value++;
|
|
92
|
-
*/
|
|
93
|
-
dontUpdate: Object;
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
import { Signal } from './Signal.mjs';
|
|
98
|
-
import { Effect } from './Effect.mjs';
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @type {Map<Effect, Set<Signal<any>>>}
|
|
3
|
-
*/
|
|
4
|
-
export const mapOfEffects: Map<Effect, Set<Signal<any>>>;
|
|
5
|
-
/**
|
|
6
|
-
* @description
|
|
7
|
-
* - a class for creating effect;
|
|
8
|
-
* - compared to previous class <b>$</b> reactivity model, `Effect`:
|
|
9
|
-
* >- doesn't autosubscribe at first run;
|
|
10
|
-
* >- it is using passed <b>$</b> named `arg0` options as subscriber;
|
|
11
|
-
* >- doesn't block other queues during first run(previously blocks other queues to safely register signal autoscubscriber);
|
|
12
|
-
* >- now can dynamically subscribes to signal, even on conditionals, that are not run during first run;
|
|
13
|
-
*/
|
|
14
|
-
export class Effect {
|
|
15
|
-
/**
|
|
16
|
-
* @description
|
|
17
|
-
* @param {( arg0:
|
|
18
|
-
* Omit<Effect["options"], typeof unwrapLazy>
|
|
19
|
-
* ) =>
|
|
20
|
-
* Promise<void>} effect
|
|
21
|
-
* @example
|
|
22
|
-
* import { Signal, Derived, Effect, Console } from 'vivth';
|
|
23
|
-
*
|
|
24
|
-
* const count = new Signal(0);
|
|
25
|
-
* const double = new Derived( async({$}) => $(count).value \* 2); // double listen to count changes
|
|
26
|
-
* new Effect(async ({
|
|
27
|
-
* subscribe, // : registrar callback for this effect instance, immediately return the signal instance
|
|
28
|
-
* removeEffect, // : disable this effect instance from reacting to dependency changes;
|
|
29
|
-
* isLastCalled, // : check whether this callback run is this instant last called effect;
|
|
30
|
-
* }) => {
|
|
31
|
-
* Console.log(subscribe(double).value); // effect listen to double changes
|
|
32
|
-
* const a = double.value; // no need to wrap double twice with $
|
|
33
|
-
* })
|
|
34
|
-
*
|
|
35
|
-
* count.value++;
|
|
36
|
-
*/
|
|
37
|
-
constructor(effect: (arg0: Omit<Effect["options"], typeof unwrapLazy>) => Promise<void>);
|
|
38
|
-
/**
|
|
39
|
-
* @typedef {import('../common/lazie.mjs').unwrapLazy} unwrapLazy
|
|
40
|
-
*/
|
|
41
|
-
/**
|
|
42
|
-
* @description
|
|
43
|
-
* - collections of lazy methods to handle effect calls of this instance;
|
|
44
|
-
*/
|
|
45
|
-
options: {
|
|
46
|
-
/**
|
|
47
|
-
* @instance options
|
|
48
|
-
* @description
|
|
49
|
-
* @returns {(timeoutMS?:number)=>Promise<boolean>}
|
|
50
|
-
* - timeoutMS only necessary if the operation doesn't naturally await;
|
|
51
|
-
* - if it's operation such as `fetch`, you can just leave it blank;
|
|
52
|
-
* @example
|
|
53
|
-
*
|
|
54
|
-
* import { Effect } from 'vivth';
|
|
55
|
-
*
|
|
56
|
-
* const effect = new Effect(async ({ isLastCalled }) => {
|
|
57
|
-
* if (!(await isLastCalled(100))) {
|
|
58
|
-
* return;
|
|
59
|
-
* }
|
|
60
|
-
* // OR
|
|
61
|
-
* const res = await fetch('some/path');
|
|
62
|
-
* if (!(await isLastCalled(
|
|
63
|
-
* // no need to add timeoutMS argument, as fetch are naturally add delay;
|
|
64
|
-
* ))) {
|
|
65
|
-
* return;
|
|
66
|
-
* }
|
|
67
|
-
* })
|
|
68
|
-
*/
|
|
69
|
-
readonly isLastCalled: (timeoutMS?: number) => Promise<boolean>;
|
|
70
|
-
/**
|
|
71
|
-
* @instance options
|
|
72
|
-
* @description
|
|
73
|
-
* - subscribe to `Signal_instance`;
|
|
74
|
-
* - normally it's passed as argument to constructor, however it is also accessible from `options` property;
|
|
75
|
-
* @template V
|
|
76
|
-
* @param {Signal<V>} signalInstance
|
|
77
|
-
* @returns {Signal<V>}
|
|
78
|
-
* @example
|
|
79
|
-
* import { Effect } from 'vivth';
|
|
80
|
-
*
|
|
81
|
-
* const effect = new Effect(async () => {
|
|
82
|
-
* // code
|
|
83
|
-
* })
|
|
84
|
-
* effect.options.subscribe(signalInstance);
|
|
85
|
-
*/
|
|
86
|
-
subscribe: <V>(signalInstance: Signal<V>) => Signal<V>;
|
|
87
|
-
/**
|
|
88
|
-
* @instance options
|
|
89
|
-
* @description
|
|
90
|
-
* - normally it's passed as argument to constructor, however it is also accessible from `options` property;
|
|
91
|
-
* @type {()=>void}
|
|
92
|
-
* @example
|
|
93
|
-
* import { Effect } from 'vivth';
|
|
94
|
-
*
|
|
95
|
-
* const effect = new Effect(async () => {
|
|
96
|
-
* // code
|
|
97
|
-
* })
|
|
98
|
-
* effect.options.removeEffect();
|
|
99
|
-
*/
|
|
100
|
-
removeEffect: () => void;
|
|
101
|
-
/**
|
|
102
|
-
* @description
|
|
103
|
-
* - remove inputed signal from this `Effect_instance`;
|
|
104
|
-
* - if effect signal has no other `Signal_instance` to listen to, it will then completely rendered non reactive;
|
|
105
|
-
* - normally it's passed as argument to constructor, however it is also accessible from `options` property;
|
|
106
|
-
* @param {Signal<any>} signalInstance
|
|
107
|
-
* @returns {void}
|
|
108
|
-
* @example
|
|
109
|
-
* import { Effect, Signal } from 'vivth';
|
|
110
|
-
*
|
|
111
|
-
* const count = new Signal(0);
|
|
112
|
-
* const effect = new Effect(async ({ subscribe }) => {
|
|
113
|
-
* console.log(subscribe(count).value); // will subscribe count changes;
|
|
114
|
-
* })
|
|
115
|
-
* count.value++; // will increase the count and trigger effect;
|
|
116
|
-
* effect.options.removeSignal(count);
|
|
117
|
-
* count.value++; // will increase the count but will no longer trigger effect;
|
|
118
|
-
*/
|
|
119
|
-
removeSignal: (signalInstance: Signal<any>) => void;
|
|
120
|
-
} & {
|
|
121
|
-
"vivth:unwrapLazy;": () => {
|
|
122
|
-
/**
|
|
123
|
-
* @instance options
|
|
124
|
-
* @description
|
|
125
|
-
* @returns {(timeoutMS?:number)=>Promise<boolean>}
|
|
126
|
-
* - timeoutMS only necessary if the operation doesn't naturally await;
|
|
127
|
-
* - if it's operation such as `fetch`, you can just leave it blank;
|
|
128
|
-
* @example
|
|
129
|
-
*
|
|
130
|
-
* import { Effect } from 'vivth';
|
|
131
|
-
*
|
|
132
|
-
* const effect = new Effect(async ({ isLastCalled }) => {
|
|
133
|
-
* if (!(await isLastCalled(100))) {
|
|
134
|
-
* return;
|
|
135
|
-
* }
|
|
136
|
-
* // OR
|
|
137
|
-
* const res = await fetch('some/path');
|
|
138
|
-
* if (!(await isLastCalled(
|
|
139
|
-
* // no need to add timeoutMS argument, as fetch are naturally add delay;
|
|
140
|
-
* ))) {
|
|
141
|
-
* return;
|
|
142
|
-
* }
|
|
143
|
-
* })
|
|
144
|
-
*/
|
|
145
|
-
readonly isLastCalled: (timeoutMS?: number) => Promise<boolean>;
|
|
146
|
-
/**
|
|
147
|
-
* @instance options
|
|
148
|
-
* @description
|
|
149
|
-
* - subscribe to `Signal_instance`;
|
|
150
|
-
* - normally it's passed as argument to constructor, however it is also accessible from `options` property;
|
|
151
|
-
* @template V
|
|
152
|
-
* @param {Signal<V>} signalInstance
|
|
153
|
-
* @returns {Signal<V>}
|
|
154
|
-
* @example
|
|
155
|
-
* import { Effect } from 'vivth';
|
|
156
|
-
*
|
|
157
|
-
* const effect = new Effect(async () => {
|
|
158
|
-
* // code
|
|
159
|
-
* })
|
|
160
|
-
* effect.options.subscribe(signalInstance);
|
|
161
|
-
*/
|
|
162
|
-
subscribe: <V>(signalInstance: Signal<V>) => Signal<V>;
|
|
163
|
-
/**
|
|
164
|
-
* @instance options
|
|
165
|
-
* @description
|
|
166
|
-
* - normally it's passed as argument to constructor, however it is also accessible from `options` property;
|
|
167
|
-
* @type {()=>void}
|
|
168
|
-
* @example
|
|
169
|
-
* import { Effect } from 'vivth';
|
|
170
|
-
*
|
|
171
|
-
* const effect = new Effect(async () => {
|
|
172
|
-
* // code
|
|
173
|
-
* })
|
|
174
|
-
* effect.options.removeEffect();
|
|
175
|
-
*/
|
|
176
|
-
removeEffect: () => void;
|
|
177
|
-
/**
|
|
178
|
-
* @description
|
|
179
|
-
* - remove inputed signal from this `Effect_instance`;
|
|
180
|
-
* - if effect signal has no other `Signal_instance` to listen to, it will then completely rendered non reactive;
|
|
181
|
-
* - normally it's passed as argument to constructor, however it is also accessible from `options` property;
|
|
182
|
-
* @param {Signal<any>} signalInstance
|
|
183
|
-
* @returns {void}
|
|
184
|
-
* @example
|
|
185
|
-
* import { Effect, Signal } from 'vivth';
|
|
186
|
-
*
|
|
187
|
-
* const count = new Signal(0);
|
|
188
|
-
* const effect = new Effect(async ({ subscribe }) => {
|
|
189
|
-
* console.log(subscribe(count).value); // will subscribe count changes;
|
|
190
|
-
* })
|
|
191
|
-
* count.value++; // will increase the count and trigger effect;
|
|
192
|
-
* effect.options.removeSignal(count);
|
|
193
|
-
* count.value++; // will increase the count but will no longer trigger effect;
|
|
194
|
-
*/
|
|
195
|
-
removeSignal: (signalInstance: Signal<any>) => void;
|
|
196
|
-
};
|
|
197
|
-
};
|
|
198
|
-
/**
|
|
199
|
-
* @description
|
|
200
|
-
* - normally is to let to be automatically run when dependency signals changes, however it's also accessible as instance method;
|
|
201
|
-
* @returns {void}
|
|
202
|
-
* @example
|
|
203
|
-
* import { Effect } from 'vivth';
|
|
204
|
-
*
|
|
205
|
-
* const effect = new Effect(async ()=>{
|
|
206
|
-
* // code
|
|
207
|
-
* })
|
|
208
|
-
* effect.run();
|
|
209
|
-
*/
|
|
210
|
-
run: () => void;
|
|
211
|
-
#private;
|
|
212
|
-
}
|
|
213
|
-
import { Signal } from './Signal.mjs';
|
|
214
|
-
type unwrapLazy = "vivth:unwrapLazy;";
|
|
215
|
-
import { unwrapLazy } from '../common/lazie.mjs';
|
|
216
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* - class to create `dervivedList` that satisfy `Array<Record<string, string>>`;
|
|
4
|
-
* - usefull for `derivedLoops`, e.g. temporary search values;
|
|
5
|
-
* - is a `Derived` instance;
|
|
6
|
-
* @template {ListArg} LISTARG
|
|
7
|
-
* @extends {Derived<LISTARG[]>}
|
|
8
|
-
*/
|
|
9
|
-
export class ListDerived<LISTARG extends import("../types/ListArg.mjs").ListArg> extends Derived<LISTARG[]> {
|
|
10
|
-
/**
|
|
11
|
-
* @typedef {import('../types/ListArg.mjs').ListArg} ListArg
|
|
12
|
-
* @typedef {import('../common/lazie.mjs').unwrapLazy} unwrapLazy
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* @description
|
|
16
|
-
* @param {(effectInstanceOptions:Omit<Effect["options"],
|
|
17
|
-
* unwrapLazy>)=>
|
|
18
|
-
* Promise<LISTARG[]>} derivedFunction
|
|
19
|
-
* @example
|
|
20
|
-
* import { ListSignal, ListDerived } from 'vivth';
|
|
21
|
-
*
|
|
22
|
-
* const listExample = new ListSignal([
|
|
23
|
-
* {key1: "test1"},
|
|
24
|
-
* {key1: "test2"},
|
|
25
|
-
* ]);
|
|
26
|
-
*
|
|
27
|
-
* export const listDerivedExample = new ListDerived(async({ subscribe }) => {
|
|
28
|
-
* // becarefull to not mutate the reference value
|
|
29
|
-
* return subscribe(listExample).value.filter((val) => {
|
|
30
|
-
* // subscribe(listExample).structuredClone can be used as alternative
|
|
31
|
-
* // filter logic
|
|
32
|
-
* })
|
|
33
|
-
* });
|
|
34
|
-
*/
|
|
35
|
-
constructor(derivedFunction: (effectInstanceOptions: Omit<Effect["options"], "vivth:unwrapLazy;">) => Promise<LISTARG[]>);
|
|
36
|
-
}
|
|
37
|
-
import { Derived } from './Derived.mjs';
|
|
38
|
-
import { Effect } from './Effect.mjs';
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* - class helpers to define pathReference;
|
|
4
|
-
* - is a singleton;
|
|
5
|
-
* - most of functionality need to access `Paths.root`, if you get warning, you can instantiate `Paths` before running anything;
|
|
6
|
-
*/
|
|
7
|
-
export class Paths {
|
|
8
|
-
/**
|
|
9
|
-
* @type {Paths|undefined}
|
|
10
|
-
*/
|
|
11
|
-
static "__#private@#instance": Paths | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* @description
|
|
14
|
-
* - reference for rootPath
|
|
15
|
-
* - `Paths` needed to be instantiated via:
|
|
16
|
-
* >- `Paths` constructor;
|
|
17
|
-
* >- `Setup.paths` constructor;
|
|
18
|
-
* @type {string|undefined}
|
|
19
|
-
*/
|
|
20
|
-
static get root(): string | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* @description
|
|
23
|
-
* - normalize path separator to forward slash `/`;
|
|
24
|
-
* @param {string} path_
|
|
25
|
-
* @returns {string}
|
|
26
|
-
* @example
|
|
27
|
-
* import { Paths } from 'vivth';
|
|
28
|
-
*
|
|
29
|
-
* Paths.normalize('file:\\D:\\myFile.mjs'); // "file://D://myFile.mjs"
|
|
30
|
-
*/
|
|
31
|
-
static normalize: (path_: string) => string;
|
|
32
|
-
/**
|
|
33
|
-
* @description
|
|
34
|
-
* - normalize path separator to forward slash `/`;
|
|
35
|
-
* - then starts with forward slash `/`;
|
|
36
|
-
* @param {string} path_
|
|
37
|
-
* @returns {`/${string}`}
|
|
38
|
-
* @example
|
|
39
|
-
* import { Paths } from 'vivth';
|
|
40
|
-
*
|
|
41
|
-
* Paths.normalizesForRoot('path\\myFile.mjs'); // "/path/myFile.mjs"
|
|
42
|
-
*/
|
|
43
|
-
static normalizesForRoot: (path_: string) => `/${string}`;
|
|
44
|
-
/**
|
|
45
|
-
* @description
|
|
46
|
-
* @param {Object} options
|
|
47
|
-
* @param {string} options.root
|
|
48
|
-
* - browser:
|
|
49
|
-
* ```js
|
|
50
|
-
* location.origin
|
|
51
|
-
* ```
|
|
52
|
-
* - node/bun compatible:
|
|
53
|
-
* ```js
|
|
54
|
-
* import process from 'node:process';
|
|
55
|
-
* process.env.INIT_CWD ?? process.cwd()
|
|
56
|
-
* ```
|
|
57
|
-
* - other: you need to check your JSRuntime for the rootPath reference;
|
|
58
|
-
* @example
|
|
59
|
-
* import { Paths } from 'vivth';
|
|
60
|
-
*
|
|
61
|
-
* new Paths({
|
|
62
|
-
* root: location.origin,
|
|
63
|
-
* })
|
|
64
|
-
*/
|
|
65
|
-
constructor({ root }: {
|
|
66
|
-
root: string;
|
|
67
|
-
});
|
|
68
|
-
#private;
|
|
69
|
-
}
|