vivth 1.4.10 → 1.5.1
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 +28 -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 +78 -42
- 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} +56 -77
- package/src/class/WorkerMainThread.mjs +98 -94
- 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 -142
- 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
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {ArrayToKeys} from '../typehints/ArrayToKeys.mjs'
|
|
3
|
+
* @import {WC_TagName_type} from './common/WC_TagName_type.mjs'
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {typeof import('../function/IsTypeOf.mjs').TypeMap} TypeMap
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @description
|
|
10
|
+
* - Generates a base class for Web Component definitions.
|
|
11
|
+
* - Note: This generator does not support `connectedMoveCallback`.
|
|
12
|
+
* For the needs of opting in to [connectedMoveCallback](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements) functionality, use [WC_extendsB](#wc_extendsb) instead.
|
|
13
|
+
* - This class relies heavily on complex type inference which can cause issues, during declaration file generation. To avoid "circular type" errors or build failures, set the following in your `tsconfig.json`:
|
|
14
|
+
* ```json
|
|
15
|
+
* {
|
|
16
|
+
* "compilerOptions": {
|
|
17
|
+
* "declaration": false
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
* - By disabling `declaration`, you prevent the TypeScript compiler from attempting to resolve and export the complex recursive type definitions generated by this factory;
|
|
22
|
+
* @template {new (...args: any[]) => HTMLElement} BASE_CONSTRUCTOR
|
|
23
|
+
* @template {{
|
|
24
|
+
* class?:string;
|
|
25
|
+
* style?:string;
|
|
26
|
+
* observedAttributes?: readonly string[];
|
|
27
|
+
* namedSlots?: readonly string[];
|
|
28
|
+
* props?: Record<string, keyof TypeMap|(new (...args:any[])=>any)>;
|
|
29
|
+
* }} STANDARD
|
|
30
|
+
* @template {(BASE_CONSTRUCTOR) & {
|
|
31
|
+
* tagName: string;
|
|
32
|
+
* extendIs: string;
|
|
33
|
+
* observedAttributes?: STANDARD["observedAttributes"];
|
|
34
|
+
* namedSlots?: STANDARD["namedSlots"];
|
|
35
|
+
* props?: STANDARD["props"];
|
|
36
|
+
* }} CREATEARGS
|
|
37
|
+
* @template { (new (...args: any[]) => InstanceType<BASE_CONSTRUCTOR> & {
|
|
38
|
+
* setObservedAttributes(attributes:Partial<
|
|
39
|
+
* Record<ArrayToKeys<STANDARD["observedAttributes"]extends readonly string[]
|
|
40
|
+
* ? STANDARD["observedAttributes"]
|
|
41
|
+
* :never>,
|
|
42
|
+
* string>
|
|
43
|
+
* >):void;
|
|
44
|
+
* props: NonNullable<NonNullable<Parameters<ReturnType<typeof WC_createElement_bind<CREATEARGS>>>[0]>["props"]>;
|
|
45
|
+
* adoptedCallback():void;
|
|
46
|
+
* connectedCallback():void;
|
|
47
|
+
* disonnectedCallback():void;
|
|
48
|
+
* attributeChangedCallback(name:ArrayToKeys<STANDARD["observedAttributes"]extends readonly string[]?STANDARD["observedAttributes"]:never>, oldValue:string|null, newValue:string|null): void;
|
|
49
|
+
* ON:<OBJ extends Record<any, any> & {
|
|
50
|
+
* onConnected?: NonNullable<Parameters<InstanceType<RET>["ON"]>[1]>["connected"];
|
|
51
|
+
* onConnectedMove?: NonNullable<Parameters<InstanceType<RET>["ON"]>[1]>["connectedMove"];
|
|
52
|
+
* onDisconnected?: NonNullable<Parameters<InstanceType<RET>["ON"]>[1]>["disconnected"];
|
|
53
|
+
* onAdopted?: NonNullable<Parameters<InstanceType<RET>["ON"]>[1]>["adopted"];
|
|
54
|
+
* onAttributeChanged?: NonNullable<Parameters<InstanceType<RET>["ON"]>[1]>["attributeChanged"];
|
|
55
|
+
* }>
|
|
56
|
+
* (obj:OBJ, callbacks?:
|
|
57
|
+
* {
|
|
58
|
+
* connected?:(obj:OBJ)=>void;
|
|
59
|
+
* connectedMove?:(obj:OBJ)=>void;
|
|
60
|
+
* disconnected?:(obj:OBJ)=>void;
|
|
61
|
+
* adopted?:(obj:OBJ)=>void;
|
|
62
|
+
* attributeChanged?:(
|
|
63
|
+
* obj:OBJ,
|
|
64
|
+
* name:STANDARD["observedAttributes"]extends readonly string[]
|
|
65
|
+
* ? ArrayToKeys<STANDARD["observedAttributes"]>
|
|
66
|
+
* : never,
|
|
67
|
+
* oldValue:string|null,
|
|
68
|
+
* newValue:string|null
|
|
69
|
+
* )=>void;
|
|
70
|
+
* })=>OBJ;
|
|
71
|
+
* }) & {
|
|
72
|
+
* tagName:string;
|
|
73
|
+
* extendIs:string;
|
|
74
|
+
* namedSlots: STANDARD["namedSlots"];
|
|
75
|
+
* observedAttributes: STANDARD["observedAttributes"];
|
|
76
|
+
* createNamedSlot: typeof WC_createNamedSlot<STANDARD>;
|
|
77
|
+
* props?: STANDARD["props"];
|
|
78
|
+
* define:<TAG extends string, CLASSREF extends RET>
|
|
79
|
+
* (
|
|
80
|
+
* tagName:WC_TagName_type<TAG>,
|
|
81
|
+
* classRef:CLASSREF,
|
|
82
|
+
* elementDefinitionOptions?:ElementDefinitionOptions,
|
|
83
|
+
* )=>ReturnType<typeof WC_createElement_bind<CLASSREF>>;
|
|
84
|
+
* }
|
|
85
|
+
* } RET
|
|
86
|
+
* @param {BASE_CONSTRUCTOR} Base
|
|
87
|
+
* @param {STANDARD} [staticMember]
|
|
88
|
+
* @returns {RET}
|
|
89
|
+
*/
|
|
90
|
+
export function WC_extendsB<BASE_CONSTRUCTOR extends new (...args: any[]) => HTMLElement, STANDARD extends {
|
|
91
|
+
class?: string;
|
|
92
|
+
style?: string;
|
|
93
|
+
observedAttributes?: readonly string[];
|
|
94
|
+
namedSlots?: readonly string[];
|
|
95
|
+
props?: Record<string, keyof TypeMap | (new (...args: any[]) => any)>;
|
|
96
|
+
}, CREATEARGS extends (BASE_CONSTRUCTOR) & {
|
|
97
|
+
tagName: string;
|
|
98
|
+
extendIs: string;
|
|
99
|
+
observedAttributes?: STANDARD["observedAttributes"];
|
|
100
|
+
namedSlots?: STANDARD["namedSlots"];
|
|
101
|
+
props?: STANDARD["props"];
|
|
102
|
+
}, RET extends (new (...args: any[]) => InstanceType<BASE_CONSTRUCTOR> & {
|
|
103
|
+
setObservedAttributes(attributes: Partial<Record<ArrayToKeys<STANDARD["observedAttributes"] extends readonly string[] ? STANDARD["observedAttributes"] : never>, string>>): void;
|
|
104
|
+
props: NonNullable<NonNullable<Parameters<ReturnType<typeof WC_createElement_bind<CREATEARGS>>>[0]>["props"]>;
|
|
105
|
+
adoptedCallback(): void;
|
|
106
|
+
connectedCallback(): void;
|
|
107
|
+
disonnectedCallback(): void;
|
|
108
|
+
attributeChangedCallback(name: ArrayToKeys<STANDARD["observedAttributes"] extends readonly string[] ? STANDARD["observedAttributes"] : never>, oldValue: string | null, newValue: string | null): void;
|
|
109
|
+
ON: <OBJ extends Record<any, any> & {
|
|
110
|
+
onConnected?: NonNullable<Parameters<InstanceType<RET>["ON"]>[1]>["connected"];
|
|
111
|
+
onConnectedMove?: NonNullable<Parameters<InstanceType<RET>["ON"]>[1]>["connectedMove"];
|
|
112
|
+
onDisconnected?: NonNullable<Parameters<InstanceType<RET>["ON"]>[1]>["disconnected"];
|
|
113
|
+
onAdopted?: NonNullable<Parameters<InstanceType<RET>["ON"]>[1]>["adopted"];
|
|
114
|
+
onAttributeChanged?: NonNullable<Parameters<InstanceType<RET>["ON"]>[1]>["attributeChanged"];
|
|
115
|
+
}>(obj: OBJ, callbacks?: {
|
|
116
|
+
connected?: (obj: OBJ) => void;
|
|
117
|
+
connectedMove?: (obj: OBJ) => void;
|
|
118
|
+
disconnected?: (obj: OBJ) => void;
|
|
119
|
+
adopted?: (obj: OBJ) => void;
|
|
120
|
+
attributeChanged?: (obj: OBJ, name: STANDARD["observedAttributes"] extends readonly string[] ? ArrayToKeys<STANDARD["observedAttributes"]> : never, oldValue: string | null, newValue: string | null) => void;
|
|
121
|
+
}) => OBJ;
|
|
122
|
+
}) & {
|
|
123
|
+
tagName: string;
|
|
124
|
+
extendIs: string;
|
|
125
|
+
namedSlots: STANDARD["namedSlots"];
|
|
126
|
+
observedAttributes: STANDARD["observedAttributes"];
|
|
127
|
+
createNamedSlot: typeof WC_createNamedSlot<STANDARD>;
|
|
128
|
+
props?: STANDARD["props"];
|
|
129
|
+
define: <TAG extends string, CLASSREF extends RET>(tagName: WC_TagName_type<TAG>, classRef: CLASSREF, elementDefinitionOptions?: ElementDefinitionOptions) => ReturnType<typeof WC_createElement_bind<CLASSREF>>;
|
|
130
|
+
}>(Base: BASE_CONSTRUCTOR, staticMember?: STANDARD): RET;
|
|
131
|
+
export type TypeMap = typeof import("../function/IsTypeOf.mjs").TypeMap;
|
|
132
|
+
import type { ArrayToKeys } from '../typehints/ArrayToKeys.mjs';
|
|
133
|
+
import { WC_createElement_bind } from './bindings/WC_createElement_bind.mjs';
|
|
134
|
+
import { WC_createNamedSlot } from './bindings/WC_createNamedSlot.mjs';
|
|
135
|
+
import type { WC_TagName_type } from './common/WC_TagName_type.mjs';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - type helper to create ref custom style `property`;
|
|
4
|
+
*/
|
|
5
|
+
export class WC_StyleProp_bind {
|
|
6
|
+
/**
|
|
7
|
+
* @description
|
|
8
|
+
* @param {HTMLElement} element
|
|
9
|
+
* @param {string} name
|
|
10
|
+
* - automatically prefixed with `--`;
|
|
11
|
+
* @param {Object} options
|
|
12
|
+
* @param {boolean} options.isGlobal
|
|
13
|
+
* - `false`: target scoped `property` on that component, and that component instance alone;
|
|
14
|
+
* >- will not even bleed to other instance with same constructor;
|
|
15
|
+
* - `true`: target style variable defined in global scope(loaded on document `styles` | `link[rel="stylesheet"]`);
|
|
16
|
+
* @example
|
|
17
|
+
* @example
|
|
18
|
+
* // webcomponent context via `WC_extends`
|
|
19
|
+
* #myStyle = new WC_StyleProp_bind(this, 'my-theme', {isGlobal:false});
|
|
20
|
+
* //
|
|
21
|
+
*/
|
|
22
|
+
constructor(element: HTMLElement, name: string, { isGlobal }: {
|
|
23
|
+
isGlobal: boolean;
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* @type {string}
|
|
27
|
+
*/
|
|
28
|
+
name: string;
|
|
29
|
+
/**
|
|
30
|
+
* @param {import('../../typehints/ParametersFollowingN.mts').ParametersFollowingN<CSSStyleDeclaration["setProperty"], 1>} args
|
|
31
|
+
*/
|
|
32
|
+
set: (...args: import("../../typehints/ParametersFollowingN.mts").ParametersFollowingN<CSSStyleDeclaration["setProperty"], 1>) => void;
|
|
33
|
+
/**
|
|
34
|
+
* @returns {string|void}
|
|
35
|
+
*/
|
|
36
|
+
get value(): string | void;
|
|
37
|
+
/**
|
|
38
|
+
* @returns {string|void}
|
|
39
|
+
*/
|
|
40
|
+
get priority(): string | void;
|
|
41
|
+
#private;
|
|
42
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - typesafe factory generator for creating element of `WC_extendsA`/`WC_extendsB` class;
|
|
4
|
+
* - this function is returned by static method `.define`;
|
|
5
|
+
* >- bind it with static property;
|
|
6
|
+
* - uses `lit-html` under the hood;
|
|
7
|
+
* @template {(new (...args: any[]) => HTMLElement) & {
|
|
8
|
+
* tagName: string;
|
|
9
|
+
* extendIs: string;
|
|
10
|
+
* observedAttributes?: readonly string[];
|
|
11
|
+
* namedSlots?: readonly string[];
|
|
12
|
+
* props?: Record<string, keyof TypeMap|(new (...args:any[])=>any)>;
|
|
13
|
+
* }} BASE_CONSTRUCTOR
|
|
14
|
+
* @param {BASE_CONSTRUCTOR} arg0
|
|
15
|
+
* @returns {(
|
|
16
|
+
* param?:{
|
|
17
|
+
* attrs?:BASE_CONSTRUCTOR['observedAttributes'] extends readonly string[]
|
|
18
|
+
* ? Partial<
|
|
19
|
+
* Record<ArrayToKeys<BASE_CONSTRUCTOR['observedAttributes']>, string>
|
|
20
|
+
* >
|
|
21
|
+
* : undefined;
|
|
22
|
+
* props?: {[K in keyof NonNullable<BASE_CONSTRUCTOR["props"]>]:
|
|
23
|
+
* NonNullable<BASE_CONSTRUCTOR["props"]>[K] extends keyof TypeMap
|
|
24
|
+
* ? TypeMap[NonNullable<BASE_CONSTRUCTOR["props"]>[K]]
|
|
25
|
+
* : InstanceType<NonNullable<BASE_CONSTRUCTOR["props"]>[K]>
|
|
26
|
+
* };
|
|
27
|
+
* children?:(slotName:Record<ArrayToKeys<BASE_CONSTRUCTOR['namedSlots']>, string>)=>TemplateResult;
|
|
28
|
+
* renderOptions?:RenderOptions;
|
|
29
|
+
* },
|
|
30
|
+
* )=>InstanceType<BASE_CONSTRUCTOR>}
|
|
31
|
+
* @example
|
|
32
|
+
* // webcomponent context via `WC_extends`
|
|
33
|
+
* static createElement = this.define(...args);
|
|
34
|
+
* //
|
|
35
|
+
*/
|
|
36
|
+
export function WC_createElement_bind<BASE_CONSTRUCTOR extends (new (...args: any[]) => HTMLElement) & {
|
|
37
|
+
tagName: string;
|
|
38
|
+
extendIs: string;
|
|
39
|
+
observedAttributes?: readonly string[];
|
|
40
|
+
namedSlots?: readonly string[];
|
|
41
|
+
props?: Record<string, keyof TypeMap | (new (...args: any[]) => any)>;
|
|
42
|
+
}>({ tagName, extendIs, namedSlots }: BASE_CONSTRUCTOR): (param?: {
|
|
43
|
+
attrs?: BASE_CONSTRUCTOR["observedAttributes"] extends readonly string[] ? Partial<Record<ArrayToKeys<BASE_CONSTRUCTOR["observedAttributes"]>, string>> : undefined;
|
|
44
|
+
props?: { [K in keyof NonNullable<BASE_CONSTRUCTOR["props"]>]: NonNullable<BASE_CONSTRUCTOR["props"]>[K] extends keyof TypeMap ? TypeMap[NonNullable<BASE_CONSTRUCTOR["props"]>[K]] : InstanceType<NonNullable<BASE_CONSTRUCTOR["props"]>[K]>; };
|
|
45
|
+
children?: (slotName: Record<ArrayToKeys<BASE_CONSTRUCTOR["namedSlots"]>, string>) => TemplateResult;
|
|
46
|
+
renderOptions?: RenderOptions;
|
|
47
|
+
}) => InstanceType<BASE_CONSTRUCTOR>;
|
|
48
|
+
export type TypeMap = typeof import("../../function/IsTypeOf.mjs").TypeMap;
|
|
49
|
+
import type { ArrayToKeys } from '../../typehints/ArrayToKeys.mjs';
|
|
50
|
+
import type { TemplateResult } from 'lit-html';
|
|
51
|
+
import type { RenderOptions } from 'lit-html';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {TemplateResult} from 'lit-html'
|
|
3
|
+
* @import {ArrayToKeys} from '../../typehints/ArrayToKeys.mts'
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @description
|
|
7
|
+
* - typesafe factory generator for creating slot element of `WC_extendsA`/`WC_extendsB` class;
|
|
8
|
+
* @template {{
|
|
9
|
+
* namedSlots?: readonly string[]
|
|
10
|
+
* }} NAMEDSLOTS
|
|
11
|
+
* @param {ArrayToKeys<NAMEDSLOTS["namedSlots"] extends readonly string[]
|
|
12
|
+
* ? NAMEDSLOTS["namedSlots"]
|
|
13
|
+
* : never
|
|
14
|
+
* >} name
|
|
15
|
+
* @param {TemplateResult} [defaultNode]
|
|
16
|
+
* @returns {TemplateResult}
|
|
17
|
+
* @example
|
|
18
|
+
* // webcomponent context via `WC_extends`.callback props
|
|
19
|
+
* this.createNamedSlot(...args);
|
|
20
|
+
* //
|
|
21
|
+
*/
|
|
22
|
+
export function WC_createNamedSlot<NAMEDSLOTS extends {
|
|
23
|
+
namedSlots?: readonly string[];
|
|
24
|
+
}>(name: ArrayToKeys<NAMEDSLOTS["namedSlots"] extends readonly string[] ? NAMEDSLOTS["namedSlots"] : never>, defaultNode?: TemplateResult): TemplateResult;
|
|
25
|
+
import type { ArrayToKeys } from '../../typehints/ArrayToKeys.mts';
|
|
26
|
+
import type { TemplateResult } from 'lit-html';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - factory to create simplified render function by omiting args[1++];
|
|
4
|
+
* @param {import('../../typehints/ParametersFollowingN.mts').ParametersFollowingN<typeof render, 1>} args
|
|
5
|
+
* @returns {(template: import('lit-html').TemplateResult)=>import('lit-html').RootPart}
|
|
6
|
+
* @example
|
|
7
|
+
* // webcomponent context via `WC_extends`
|
|
8
|
+
* constructor(){
|
|
9
|
+
* super();
|
|
10
|
+
* this.#root = this.attachShadow({ mode: 'closed' });
|
|
11
|
+
* this.#render = WC_litRender_bind(this.#root, this);
|
|
12
|
+
* }
|
|
13
|
+
* #root;
|
|
14
|
+
* #render;
|
|
15
|
+
* #something(){
|
|
16
|
+
* this.#render(html`<div></div>`); // <- args[1++] are omitted
|
|
17
|
+
* }
|
|
18
|
+
* ///
|
|
19
|
+
*/
|
|
20
|
+
export function WC_litRender_bind(container: import("lit-html").RenderRootNode, options?: import("lit-html").RenderOptions | undefined): (template: import("lit-html").TemplateResult) => import("lit-html").RootPart;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - type helper for `import { styleMap } from 'lit-html/directives/style-map.js';`, by typehinting the properties;
|
|
4
|
+
* @param {Partial<CSSStyleProperties>} properties
|
|
5
|
+
* @returns {import('lit-html/directive.js').DirectiveResult}
|
|
6
|
+
*/
|
|
7
|
+
export function WC_litStyleMap(properties: Partial<CSSStyleProperties>): import("lit-html/directive.js").DirectiveResult;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - generate `CSSStyleSheet` with template literal;
|
|
4
|
+
* @param {TemplateStringsArray} strings
|
|
5
|
+
* @param {...string} values
|
|
6
|
+
* @returns {CSSStyleSheet}
|
|
7
|
+
* @example
|
|
8
|
+
* import { CSS as css } from 'vivth/neutral';
|
|
9
|
+
* // webcomponent context via `WC_extends`
|
|
10
|
+
* static CSS = css`
|
|
11
|
+
* :host{
|
|
12
|
+
* --my-theme: salmon;
|
|
13
|
+
* background-color: var(--my-theme);
|
|
14
|
+
* }
|
|
15
|
+
* `
|
|
16
|
+
* constructor(){
|
|
17
|
+
* super();
|
|
18
|
+
* const root = this.attachShadow({mode:'closed'});
|
|
19
|
+
* root.adoptedStyleSheets= [MyClass.CSS];
|
|
20
|
+
* }
|
|
21
|
+
* //
|
|
22
|
+
*/
|
|
23
|
+
export function CSS(strings: TemplateStringsArray, ...values: string[]): CSSStyleSheet;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - helper function to create element;
|
|
4
|
+
* @template {keyof HTMLElementTagNameMap} K
|
|
5
|
+
* @template {Partial<HTMLElementTagNameMap[K]> & Record<string, any>} RR
|
|
6
|
+
* @param {K} tagName
|
|
7
|
+
* @param {(
|
|
8
|
+
* & Omit<Record<string, string|Signal<string>>, 'style'|'class'>
|
|
9
|
+
* & { style?: string, class?: string }
|
|
10
|
+
* )} [attrs]
|
|
11
|
+
* @param {RR} [props]
|
|
12
|
+
* @param {ChildNode[]|Signal<ChildNode[]>} [childNodes]
|
|
13
|
+
* @returns {HTMLElementTagNameMap[K]
|
|
14
|
+
* & RR
|
|
15
|
+
* & {
|
|
16
|
+
* onDisconnected:()=>void;
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* @example
|
|
20
|
+
* const text = new Text('hello');
|
|
21
|
+
* const div = E('div',{
|
|
22
|
+
* class: 'p-1 m-1',
|
|
23
|
+
* id: 'my-div',
|
|
24
|
+
* },
|
|
25
|
+
* {
|
|
26
|
+
* onclick(e){
|
|
27
|
+
* console.log(e);
|
|
28
|
+
* },
|
|
29
|
+
* },
|
|
30
|
+
* [text],
|
|
31
|
+
* )
|
|
32
|
+
* // fine grain modify
|
|
33
|
+
* text.nodeValue = 'hello world';
|
|
34
|
+
*/
|
|
35
|
+
export function E<K extends keyof HTMLElementTagNameMap, RR extends Partial<HTMLElementTagNameMap[K]> & Record<string, any>>(tagName: K, attrs?: (Omit<Record<string, string | Signal<string>>, "style" | "class"> & {
|
|
36
|
+
style?: string;
|
|
37
|
+
class?: string;
|
|
38
|
+
}), props?: RR, childNodes?: ChildNode[] | Signal<ChildNode[]>): HTMLElementTagNameMap[K] & RR & {
|
|
39
|
+
onDisconnected: () => void;
|
|
40
|
+
};
|
|
41
|
+
import { Signal } from '../../class/Signal.mjs';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - function helper to asynchronously `CSSStyleSheet`;
|
|
4
|
+
* >- './main.css';
|
|
5
|
+
* ```css
|
|
6
|
+
* :host{
|
|
7
|
+
* background-color: red;
|
|
8
|
+
* }
|
|
9
|
+
* ```
|
|
10
|
+
* - internally used for `Dynamics`;
|
|
11
|
+
* @param {string} string
|
|
12
|
+
* @param {ConstructorParameters<typeof CSSStyleSheet>} arg1
|
|
13
|
+
* @returns {Promise<CSSStyleSheet>}
|
|
14
|
+
*/
|
|
15
|
+
export function NewStyleSheetAsync(string: string, options?: CSSStyleSheetInit | undefined): Promise<CSSStyleSheet>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - function helper to synchronously `CSSStyleSheet`;
|
|
4
|
+
* >- './main.css';
|
|
5
|
+
* ```css
|
|
6
|
+
* :host{
|
|
7
|
+
* background-color: red;
|
|
8
|
+
* }
|
|
9
|
+
* ```
|
|
10
|
+
* - internally used for `CSS`;
|
|
11
|
+
* @param {string} string
|
|
12
|
+
* @param {ConstructorParameters<typeof CSSStyleSheet>} arg1
|
|
13
|
+
* @returns {CSSStyleSheet}
|
|
14
|
+
*/
|
|
15
|
+
export function NewStyleSheetSync(string: string, options?: CSSStyleSheetInit | undefined): CSSStyleSheet;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a string segment contains invalid characters (Spaces, Uppercase, or Symbols)
|
|
3
|
+
*/
|
|
4
|
+
export type IsValidSegment<S extends string> = S extends `${infer Char}${infer Rest}` ? Char extends ' ' | '_' | '/' | '\\' | '.' | ',' | '?' | '!' ? false : Char extends Uppercase<Char> ? Char extends Lowercase<Char> ? true : false : IsValidSegment<Rest> : true;
|
|
5
|
+
/**
|
|
6
|
+
* @preserve
|
|
7
|
+
* @description
|
|
8
|
+
* Validates whether a string follows the strict custom-element layout:
|
|
9
|
+
* - Must contain a hyphen (-)
|
|
10
|
+
* - No spaces allowed anywhere
|
|
11
|
+
* - Must be strictly lowercase
|
|
12
|
+
* @template {string} TAG
|
|
13
|
+
* @[blank]typedef {import('./WC_TagName_type.mts').WC_TagName_type<TAG>} WC_TagName_type
|
|
14
|
+
*/
|
|
15
|
+
export type WC_TagName_type<T extends string> = T extends `${infer Prefix}-${infer Suffix}` ? Prefix extends '' ? 'ERROR: Custom element tag names cannot start with a hyphen.' : Suffix extends '' ? 'ERROR: Custom element tag names cannot end with a hyphen.' : IsValidSegment<Prefix> extends false ? 'ERROR: Tag contains spaces, uppercase letters, or invalid characters in the prefix.' : IsValidSegment<Suffix> extends false ? 'ERROR: Tag contains spaces, uppercase letters, or invalid characters in the suffix.' : T : 'ERROR: Web Component tag names MUST contain a hyphen (-) character.';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../../typehints/VivthCleanup.mjs').VivthCleanup} VivthCleanup
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @description
|
|
6
|
+
* - signal helper to check whether element is in viewport;
|
|
7
|
+
* @implements {VivthCleanup}
|
|
8
|
+
* @extends {Signal<boolean>}
|
|
9
|
+
*/
|
|
10
|
+
export class IsInViewPortSignal extends Signal<boolean> implements VivthCleanup {
|
|
11
|
+
/**
|
|
12
|
+
* @type {WeakMap<Element, Signal<boolean>>}
|
|
13
|
+
*/
|
|
14
|
+
static #mapped: WeakMap<Element, Signal<boolean>>;
|
|
15
|
+
/**
|
|
16
|
+
* @type {IntersectionObserver|undefined}
|
|
17
|
+
*/
|
|
18
|
+
static #intersectionObserver_: IntersectionObserver | undefined;
|
|
19
|
+
static #q: QChannel<import("../../typehints/AnyButUndefined.mjs").AnyButUndefined> & {
|
|
20
|
+
[x: symbol]: QChannel<import("../../typehints/AnyButUndefined.mjs").AnyButUndefined>;
|
|
21
|
+
};
|
|
22
|
+
static get #intersectionObserver(): IntersectionObserver;
|
|
23
|
+
/**
|
|
24
|
+
* @type {IntersectionObserverInit}
|
|
25
|
+
*/
|
|
26
|
+
static #intersectionObserverInit: IntersectionObserverInit;
|
|
27
|
+
/**
|
|
28
|
+
* @type {IntersectionObserverCallback}
|
|
29
|
+
*/
|
|
30
|
+
static #intersectionObserverCallback: IntersectionObserverCallback;
|
|
31
|
+
/**
|
|
32
|
+
* @param {()=>boolean} isLastOnQ
|
|
33
|
+
* @param {Element} target
|
|
34
|
+
* @param {IntersectionObserverEntry} entry
|
|
35
|
+
* @returns {Promise<void>}
|
|
36
|
+
*/
|
|
37
|
+
static #qCB: (isLastOnQ: () => boolean, target: Element, entry: IntersectionObserverEntry) => Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* @param {Element} element
|
|
40
|
+
* @returns {boolean}
|
|
41
|
+
*/
|
|
42
|
+
static #isInViewport(element: Element): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* @description
|
|
45
|
+
* @param {Element} element
|
|
46
|
+
*/
|
|
47
|
+
constructor(element: Element);
|
|
48
|
+
#private;
|
|
49
|
+
}
|
|
50
|
+
export type VivthCleanup = import("../../typehints/VivthCleanup.mjs").VivthCleanup;
|
|
51
|
+
import { Signal } from '../../class/Signal.mjs';
|
|
52
|
+
import { QChannel } from '../../class/QChannel.mjs';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {ParametersFollowingN} from '../../typehints/ParametersFollowingN.mts'
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {import('../../typehints/VivthCleanup.mjs').VivthCleanup} VivthCleanup
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @description
|
|
9
|
+
* - helper to create lazy `MutationObserver`;
|
|
10
|
+
* - use in tandem with `WC_extends`;
|
|
11
|
+
* @implements {VivthCleanup}
|
|
12
|
+
* @extends {Signal<MutationRecord[]|undefined>}
|
|
13
|
+
*/
|
|
14
|
+
export class ObserverSignal extends Signal<MutationRecord[] | undefined> implements VivthCleanup {
|
|
15
|
+
/**
|
|
16
|
+
* @description
|
|
17
|
+
* @param {Node} node
|
|
18
|
+
* @param {ParametersFollowingN<
|
|
19
|
+
* MutationObserver["observe"],1
|
|
20
|
+
* >} mutationObserverInitArgs
|
|
21
|
+
* - no default value;
|
|
22
|
+
*/
|
|
23
|
+
constructor(node: Node, options?: MutationObserverInit | undefined);
|
|
24
|
+
/**
|
|
25
|
+
* @description
|
|
26
|
+
* - unobserve element;
|
|
27
|
+
*/
|
|
28
|
+
unobserve: () => void;
|
|
29
|
+
#private;
|
|
30
|
+
}
|
|
31
|
+
export type VivthCleanup = import("../../typehints/VivthCleanup.mjs").VivthCleanup;
|
|
32
|
+
import { Signal } from '../../class/Signal.mjs';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {Ref, RefDirective,} from 'lit-html/directives/ref.js'
|
|
3
|
+
* @import {DirectiveResult} from 'lit-html/directive.js'
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @description
|
|
7
|
+
* - signal to get element reference on lit render;
|
|
8
|
+
* - warning, this class relies on creating macro task to trick lit-html render ref to get the `Element` reference, it might not be too accurate;
|
|
9
|
+
* @template {Element} EL
|
|
10
|
+
* @extends {Signal<EL|undefined>}
|
|
11
|
+
*/
|
|
12
|
+
export class WC_litRef<EL extends Element> extends Signal<EL | undefined> {
|
|
13
|
+
/**
|
|
14
|
+
* @description
|
|
15
|
+
*/
|
|
16
|
+
constructor();
|
|
17
|
+
/**
|
|
18
|
+
* @returns {DirectiveResult<typeof RefDirective>}
|
|
19
|
+
*/
|
|
20
|
+
get ref(): DirectiveResult<typeof RefDirective>;
|
|
21
|
+
onDisconnected: () => void;
|
|
22
|
+
#private;
|
|
23
|
+
}
|
|
24
|
+
import { Signal } from '../../class/Signal.mjs';
|
|
25
|
+
import type { RefDirective } from 'lit-html/directives/ref.js';
|
|
26
|
+
import type { DirectiveResult } from 'lit-html/directive.js';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - `Signal` to check siblingIndex of a looped component;
|
|
4
|
+
* - automatically trigger check upon connectedCallback, by wrapping it with `this.ON` even without second argument;
|
|
5
|
+
* - automatically trigger cleanup upon disconnectedCallback, by wrapping it with `this.ON` even without second argument;
|
|
6
|
+
* - assumption is all sibling element must be from same class `WebCompoent`;
|
|
7
|
+
* ```html
|
|
8
|
+
* <div>
|
|
9
|
+
* <!-- looped <my-component></my-component> -->
|
|
10
|
+
* <!-- looped <my-component></my-component> -->
|
|
11
|
+
* <!-- looped <my-component></my-component> -->
|
|
12
|
+
* <my-component></my-component>
|
|
13
|
+
* <!-- looped <my-component></my-component> -->
|
|
14
|
+
* <!-- looped <my-component></my-component> -->
|
|
15
|
+
* </div>
|
|
16
|
+
* ```
|
|
17
|
+
* @extends {Signal<number|undefined>}
|
|
18
|
+
*/
|
|
19
|
+
export class WC_loopedSiblingsRef extends Signal<number | undefined> {
|
|
20
|
+
/**
|
|
21
|
+
* @param {HTMLElement} instanceRef
|
|
22
|
+
*/
|
|
23
|
+
constructor(instanceRef: HTMLElement);
|
|
24
|
+
/**
|
|
25
|
+
* @description
|
|
26
|
+
* - self auto register and cleanup when assigned with `ON` jut by passing empty object as second argument;
|
|
27
|
+
* - the automatic part only works on `WC_extends${suffix}`;
|
|
28
|
+
* >- the cleanup logic are infered by `WC_extends${suffix}` class inner behaviour;
|
|
29
|
+
* - still need to be called manually if used outside `vivth/neutral` `WebComponent`;
|
|
30
|
+
* @type {()=>void}
|
|
31
|
+
*/
|
|
32
|
+
onConnected: () => void;
|
|
33
|
+
/**
|
|
34
|
+
* @description
|
|
35
|
+
* - self auto register and cleanup when assigned with `ON` jut by passing empty object as second argument;
|
|
36
|
+
* - the automatic part only works on `WC_extends${suffix}`;
|
|
37
|
+
* >- the cleanup logic are infered by `WC_extends${suffix}` class inner behaviour;
|
|
38
|
+
* - still need to be called manually if used outside `vivth/neutral` `WebComponent`;
|
|
39
|
+
* @type {()=>void}
|
|
40
|
+
*/
|
|
41
|
+
onDisconnected: () => void;
|
|
42
|
+
#private;
|
|
43
|
+
}
|
|
44
|
+
import { Signal } from '../../class/Signal.mjs';
|