mates-devtools 0.1.0-beta.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/dist/mates-devtools.es.js +3464 -0
- package/dist/mates-devtools.umd.js +650 -0
- package/dist/types/Mates-DevTools/src/MatesDevTools.d.ts +5 -0
- package/dist/types/Mates-DevTools/src/MatesDevTools.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/MatesDevToolsComponent.d.ts +24 -0
- package/dist/types/Mates-DevTools/src/MatesDevToolsComponent.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/components/AtomsViewer.d.ts +2 -0
- package/dist/types/Mates-DevTools/src/components/AtomsViewer.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/components/ComponentInspector.d.ts +27 -0
- package/dist/types/Mates-DevTools/src/components/ComponentInspector.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/components/ComponentList.d.ts +11 -0
- package/dist/types/Mates-DevTools/src/components/ComponentList.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/components/ComponentTree.d.ts +9 -0
- package/dist/types/Mates-DevTools/src/components/ComponentTree.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/components/Header.d.ts +10 -0
- package/dist/types/Mates-DevTools/src/components/Header.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/components/Highlight.d.ts +6 -0
- package/dist/types/Mates-DevTools/src/components/Highlight.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/components/HooksViewer.d.ts +7 -0
- package/dist/types/Mates-DevTools/src/components/HooksViewer.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/components/LogsViewer.d.ts +6 -0
- package/dist/types/Mates-DevTools/src/components/LogsViewer.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/components/PerfViewer.d.ts +7 -0
- package/dist/types/Mates-DevTools/src/components/PerfViewer.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/components/PropsViewer.d.ts +2 -0
- package/dist/types/Mates-DevTools/src/components/PropsViewer.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/components/ScopesViewer.d.ts +2 -0
- package/dist/types/Mates-DevTools/src/components/ScopesViewer.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/components/TimerLogger.d.ts +5 -0
- package/dist/types/Mates-DevTools/src/components/TimerLogger.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/components/UseStateViewer.d.ts +12 -0
- package/dist/types/Mates-DevTools/src/components/UseStateViewer.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/components/ValueTree.d.ts +19 -0
- package/dist/types/Mates-DevTools/src/components/ValueTree.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/index.d.ts +23 -0
- package/dist/types/Mates-DevTools/src/index.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/interceptTimers.d.ts +11 -0
- package/dist/types/Mates-DevTools/src/interceptTimers.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/logStore.d.ts +38 -0
- package/dist/types/Mates-DevTools/src/logStore.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/perfStore.d.ts +36 -0
- package/dist/types/Mates-DevTools/src/perfStore.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/registry.d.ts +68 -0
- package/dist/types/Mates-DevTools/src/registry.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/styles.d.ts +833 -0
- package/dist/types/Mates-DevTools/src/styles.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/types.d.ts +19 -0
- package/dist/types/Mates-DevTools/src/types.d.ts.map +1 -0
- package/dist/types/lib/Directives/$.d.ts +371 -0
- package/dist/types/lib/Directives/$.d.ts.map +1 -0
- package/dist/types/lib/Directives/animatedConditional.d.ts +67 -0
- package/dist/types/lib/Directives/animatedConditional.d.ts.map +1 -0
- package/dist/types/lib/Directives/animationClasses.d.ts +50 -0
- package/dist/types/lib/Directives/animationClasses.d.ts.map +1 -0
- package/dist/types/lib/Directives/attrDirective.d.ts +69 -0
- package/dist/types/lib/Directives/attrDirective.d.ts.map +1 -0
- package/dist/types/lib/Directives/classesDirective.d.ts +79 -0
- package/dist/types/lib/Directives/classesDirective.d.ts.map +1 -0
- package/dist/types/lib/Directives/eleHook.d.ts +84 -0
- package/dist/types/lib/Directives/eleHook.d.ts.map +1 -0
- package/dist/types/lib/Directives/eventBinding.d.ts +29 -0
- package/dist/types/lib/Directives/eventBinding.d.ts.map +1 -0
- package/dist/types/lib/Directives/htmlHook.d.ts +101 -0
- package/dist/types/lib/Directives/htmlHook.d.ts.map +1 -0
- package/dist/types/lib/Directives/index.d.ts +18 -0
- package/dist/types/lib/Directives/index.d.ts.map +1 -0
- package/dist/types/lib/Directives/intersectDirective.d.ts +67 -0
- package/dist/types/lib/Directives/intersectDirective.d.ts.map +1 -0
- package/dist/types/lib/Directives/lazyLoadDirective.d.ts +66 -0
- package/dist/types/lib/Directives/lazyLoadDirective.d.ts.map +1 -0
- package/dist/types/lib/Directives/lifecycleDirectives.d.ts +56 -0
- package/dist/types/lib/Directives/lifecycleDirectives.d.ts.map +1 -0
- package/dist/types/lib/Directives/masonryGrid.d.ts +114 -0
- package/dist/types/lib/Directives/masonryGrid.d.ts.map +1 -0
- package/dist/types/lib/Directives/memoTemplate.d.ts +94 -0
- package/dist/types/lib/Directives/memoTemplate.d.ts.map +1 -0
- package/dist/types/lib/Directives/onDirective.d.ts +71 -0
- package/dist/types/lib/Directives/onDirective.d.ts.map +1 -0
- package/dist/types/lib/Directives/onParentDirective.d.ts +34 -0
- package/dist/types/lib/Directives/onParentDirective.d.ts.map +1 -0
- package/dist/types/lib/Directives/renderSwitch.d.ts +55 -0
- package/dist/types/lib/Directives/renderSwitch.d.ts.map +1 -0
- package/dist/types/lib/Directives/resolveAttrValue.d.ts +35 -0
- package/dist/types/lib/Directives/resolveAttrValue.d.ts.map +1 -0
- package/dist/types/lib/Directives/styleDirective.d.ts +81 -0
- package/dist/types/lib/Directives/styleDirective.d.ts.map +1 -0
- package/dist/types/lib/Directives/timerDirective.d.ts +52 -0
- package/dist/types/lib/Directives/timerDirective.d.ts.map +1 -0
- package/dist/types/lib/Directives/virtualHelpers.d.ts +10 -0
- package/dist/types/lib/Directives/virtualHelpers.d.ts.map +1 -0
- package/dist/types/lib/Fetch/ErrorTypes.d.ts +74 -0
- package/dist/types/lib/Fetch/ErrorTypes.d.ts.map +1 -0
- package/dist/types/lib/Fetch/Fetch.d.ts +168 -0
- package/dist/types/lib/Fetch/Fetch.d.ts.map +1 -0
- package/dist/types/lib/Fetch/index.d.ts +3 -0
- package/dist/types/lib/Fetch/index.d.ts.map +1 -0
- package/dist/types/lib/Mutables/Extended Atoms/cacheAtom.d.ts +156 -0
- package/dist/types/lib/Mutables/Extended Atoms/cacheAtom.d.ts.map +1 -0
- package/dist/types/lib/Mutables/Extended Atoms/index.d.ts +4 -0
- package/dist/types/lib/Mutables/Extended Atoms/index.d.ts.map +1 -0
- package/dist/types/lib/Mutables/Extended Atoms/paginationAtom.d.ts +32 -0
- package/dist/types/lib/Mutables/Extended Atoms/paginationAtom.d.ts.map +1 -0
- package/dist/types/lib/Mutables/Extended Atoms/themeAtom.d.ts +59 -0
- package/dist/types/lib/Mutables/Extended Atoms/themeAtom.d.ts.map +1 -0
- package/dist/types/lib/Mutables/atom/atom.d.ts +148 -0
- package/dist/types/lib/Mutables/atom/atom.d.ts.map +1 -0
- package/dist/types/lib/Mutables/atom/createTimedAtom.d.ts +43 -0
- package/dist/types/lib/Mutables/atom/createTimedAtom.d.ts.map +1 -0
- package/dist/types/lib/Mutables/atom/debouncedAtom.d.ts +37 -0
- package/dist/types/lib/Mutables/atom/debouncedAtom.d.ts.map +1 -0
- package/dist/types/lib/Mutables/atom/index.d.ts +10 -0
- package/dist/types/lib/Mutables/atom/index.d.ts.map +1 -0
- package/dist/types/lib/Mutables/atom/mapAtom.d.ts +105 -0
- package/dist/types/lib/Mutables/atom/mapAtom.d.ts.map +1 -0
- package/dist/types/lib/Mutables/atom/setAtom.d.ts +107 -0
- package/dist/types/lib/Mutables/atom/setAtom.d.ts.map +1 -0
- package/dist/types/lib/Mutables/atom/storageAtom.d.ts +44 -0
- package/dist/types/lib/Mutables/atom/storageAtom.d.ts.map +1 -0
- package/dist/types/lib/Mutables/atom/throttledAtom.d.ts +37 -0
- package/dist/types/lib/Mutables/atom/throttledAtom.d.ts.map +1 -0
- package/dist/types/lib/Mutables/atom/titleAtom.d.ts +20 -0
- package/dist/types/lib/Mutables/atom/titleAtom.d.ts.map +1 -0
- package/dist/types/lib/Mutables/effect/effect.d.ts +31 -0
- package/dist/types/lib/Mutables/effect/effect.d.ts.map +1 -0
- package/dist/types/lib/Mutables/effect/index.d.ts +2 -0
- package/dist/types/lib/Mutables/effect/index.d.ts.map +1 -0
- package/dist/types/lib/Mutables/events/events.d.ts +123 -0
- package/dist/types/lib/Mutables/events/events.d.ts.map +1 -0
- package/dist/types/lib/Mutables/events/index.d.ts +2 -0
- package/dist/types/lib/Mutables/events/index.d.ts.map +1 -0
- package/dist/types/lib/Mutables/events/xTabEvent.d.ts +61 -0
- package/dist/types/lib/Mutables/events/xTabEvent.d.ts.map +1 -0
- package/dist/types/lib/Mutables/form/formAtom.d.ts +56 -0
- package/dist/types/lib/Mutables/form/formAtom.d.ts.map +1 -0
- package/dist/types/lib/Mutables/form/index.d.ts +5 -0
- package/dist/types/lib/Mutables/form/index.d.ts.map +1 -0
- package/dist/types/lib/Mutables/form/transformers.d.ts +4 -0
- package/dist/types/lib/Mutables/form/transformers.d.ts.map +1 -0
- package/dist/types/lib/Mutables/form/validateAll.d.ts +40 -0
- package/dist/types/lib/Mutables/form/validateAll.d.ts.map +1 -0
- package/dist/types/lib/Mutables/form/validators.d.ts +61 -0
- package/dist/types/lib/Mutables/form/validators.d.ts.map +1 -0
- package/dist/types/lib/Mutables/index.d.ts +13 -0
- package/dist/types/lib/Mutables/index.d.ts.map +1 -0
- package/dist/types/lib/Mutables/memo/index.d.ts +2 -0
- package/dist/types/lib/Mutables/memo/index.d.ts.map +1 -0
- package/dist/types/lib/Mutables/memo/memo.d.ts +47 -0
- package/dist/types/lib/Mutables/memo/memo.d.ts.map +1 -0
- package/dist/types/lib/Mutables/reactiveRunner/index.d.ts +4 -0
- package/dist/types/lib/Mutables/reactiveRunner/index.d.ts.map +1 -0
- package/dist/types/lib/Mutables/reactiveRunner/reactiveRunner.d.ts +56 -0
- package/dist/types/lib/Mutables/reactiveRunner/reactiveRunner.d.ts.map +1 -0
- package/dist/types/lib/Mutables/reactiveRunner/trackAndSubscribe.d.ts +6 -0
- package/dist/types/lib/Mutables/reactiveRunner/trackAndSubscribe.d.ts.map +1 -0
- package/dist/types/lib/Mutables/reactiveRunner/validateReactiveFunction.d.ts +6 -0
- package/dist/types/lib/Mutables/reactiveRunner/validateReactiveFunction.d.ts.map +1 -0
- package/dist/types/lib/Mutables/ref/index.d.ts +2 -0
- package/dist/types/lib/Mutables/ref/index.d.ts.map +1 -0
- package/dist/types/lib/Mutables/ref/ref.d.ts +74 -0
- package/dist/types/lib/Mutables/ref/ref.d.ts.map +1 -0
- package/dist/types/lib/Mutables/scope/index.d.ts +2 -0
- package/dist/types/lib/Mutables/scope/index.d.ts.map +1 -0
- package/dist/types/lib/Mutables/scope/scope.d.ts +60 -0
- package/dist/types/lib/Mutables/scope/scope.d.ts.map +1 -0
- package/dist/types/lib/Mutables/store/index.d.ts +2 -0
- package/dist/types/lib/Mutables/store/index.d.ts.map +1 -0
- package/dist/types/lib/Mutables/store/store.d.ts +73 -0
- package/dist/types/lib/Mutables/store/store.d.ts.map +1 -0
- package/dist/types/lib/Mutables/useState/index.d.ts +2 -0
- package/dist/types/lib/Mutables/useState/index.d.ts.map +1 -0
- package/dist/types/lib/Mutables/useState/useState.d.ts +54 -0
- package/dist/types/lib/Mutables/useState/useState.d.ts.map +1 -0
- package/dist/types/lib/Mutables/useStore/hostContext.d.ts +13 -0
- package/dist/types/lib/Mutables/useStore/hostContext.d.ts.map +1 -0
- package/dist/types/lib/Mutables/useStore/index.d.ts +9 -0
- package/dist/types/lib/Mutables/useStore/index.d.ts.map +1 -0
- package/dist/types/lib/Mutables/useStore/lifecycle.d.ts +94 -0
- package/dist/types/lib/Mutables/useStore/lifecycle.d.ts.map +1 -0
- package/dist/types/lib/Mutables/useStore/onError.d.ts +21 -0
- package/dist/types/lib/Mutables/useStore/onError.d.ts.map +1 -0
- package/dist/types/lib/Mutables/useStore/onReferenceChange.d.ts +2 -0
- package/dist/types/lib/Mutables/useStore/onReferenceChange.d.ts.map +1 -0
- package/dist/types/lib/Mutables/useStore/safetyCheck.d.ts +2 -0
- package/dist/types/lib/Mutables/useStore/safetyCheck.d.ts.map +1 -0
- package/dist/types/lib/Mutables/useStore/setter.d.ts +52 -0
- package/dist/types/lib/Mutables/useStore/setter.d.ts.map +1 -0
- package/dist/types/lib/Mutables/useStore/subscription.d.ts +50 -0
- package/dist/types/lib/Mutables/useStore/subscription.d.ts.map +1 -0
- package/dist/types/lib/Mutables/useStore/useContext.d.ts +3 -0
- package/dist/types/lib/Mutables/useStore/useContext.d.ts.map +1 -0
- package/dist/types/lib/Mutables/useStore/useStore.d.ts +7 -0
- package/dist/types/lib/Mutables/useStore/useStore.d.ts.map +1 -0
- package/dist/types/lib/Router/Router.d.ts +54 -0
- package/dist/types/lib/Router/Router.d.ts.map +1 -0
- package/dist/types/lib/Router/animatedRouter.d.ts +48 -0
- package/dist/types/lib/Router/animatedRouter.d.ts.map +1 -0
- package/dist/types/lib/Router/buildPath.d.ts +20 -0
- package/dist/types/lib/Router/buildPath.d.ts.map +1 -0
- package/dist/types/lib/Router/hashAtom.d.ts +12 -0
- package/dist/types/lib/Router/hashAtom.d.ts.map +1 -0
- package/dist/types/lib/Router/index.d.ts +11 -0
- package/dist/types/lib/Router/index.d.ts.map +1 -0
- package/dist/types/lib/Router/isPathMatching.d.ts +12 -0
- package/dist/types/lib/Router/isPathMatching.d.ts.map +1 -0
- package/dist/types/lib/Router/location.d.ts +74 -0
- package/dist/types/lib/Router/location.d.ts.map +1 -0
- package/dist/types/lib/Router/navigateTo.d.ts +31 -0
- package/dist/types/lib/Router/navigateTo.d.ts.map +1 -0
- package/dist/types/lib/Router/navigationLock.d.ts +50 -0
- package/dist/types/lib/Router/navigationLock.d.ts.map +1 -0
- package/dist/types/lib/Router/pathAtom.d.ts +42 -0
- package/dist/types/lib/Router/pathAtom.d.ts.map +1 -0
- package/dist/types/lib/Router/pathResolver.d.ts +9 -0
- package/dist/types/lib/Router/pathResolver.d.ts.map +1 -0
- package/dist/types/lib/Router/qsAtom.d.ts +12 -0
- package/dist/types/lib/Router/qsAtom.d.ts.map +1 -0
- package/dist/types/lib/Template/index.d.ts +6 -0
- package/dist/types/lib/Template/index.d.ts.map +1 -0
- package/dist/types/lib/Template/scheduler.d.ts +59 -0
- package/dist/types/lib/Template/scheduler.d.ts.map +1 -0
- package/dist/types/lib/Template/x-x.d.ts +60 -0
- package/dist/types/lib/Template/x-x.d.ts.map +1 -0
- package/dist/types/lib/Template/x-x.types.d.ts +91 -0
- package/dist/types/lib/Template/x-x.types.d.ts.map +1 -0
- package/dist/types/lib/Template/x-x.utils.d.ts +15 -0
- package/dist/types/lib/Template/x-x.utils.d.ts.map +1 -0
- package/dist/types/lib/Template/x.d.ts +5 -0
- package/dist/types/lib/Template/x.d.ts.map +1 -0
- package/dist/types/lib/Template/xProvider.d.ts +2 -0
- package/dist/types/lib/Template/xProvider.d.ts.map +1 -0
- package/dist/types/lib/Timers/createManagedTimer.d.ts +12 -0
- package/dist/types/lib/Timers/createManagedTimer.d.ts.map +1 -0
- package/dist/types/lib/Timers/index.d.ts +4 -0
- package/dist/types/lib/Timers/index.d.ts.map +1 -0
- package/dist/types/lib/Timers/interval.d.ts +2 -0
- package/dist/types/lib/Timers/interval.d.ts.map +1 -0
- package/dist/types/lib/Timers/timeout.d.ts +2 -0
- package/dist/types/lib/Timers/timeout.d.ts.map +1 -0
- package/dist/types/lib/TrackState/componentStatus.d.ts +105 -0
- package/dist/types/lib/TrackState/componentStatus.d.ts.map +1 -0
- package/dist/types/lib/TrackState/readTracking.d.ts +20 -0
- package/dist/types/lib/TrackState/readTracking.d.ts.map +1 -0
- package/dist/types/lib/Utils/Context.d.ts +6 -0
- package/dist/types/lib/Utils/Context.d.ts.map +1 -0
- package/dist/types/lib/Utils/Date/calendar.d.ts +30 -0
- package/dist/types/lib/Utils/Date/calendar.d.ts.map +1 -0
- package/dist/types/lib/Utils/Date/core.d.ts +29 -0
- package/dist/types/lib/Utils/Date/core.d.ts.map +1 -0
- package/dist/types/lib/Utils/Date/date.d.ts +60 -0
- package/dist/types/lib/Utils/Date/date.d.ts.map +1 -0
- package/dist/types/lib/Utils/Date/index.d.ts +3 -0
- package/dist/types/lib/Utils/Date/index.d.ts.map +1 -0
- package/dist/types/lib/Utils/deepClone.d.ts +7 -0
- package/dist/types/lib/Utils/deepClone.d.ts.map +1 -0
- package/dist/types/lib/Utils/deepFreeze.d.ts +2 -0
- package/dist/types/lib/Utils/deepFreeze.d.ts.map +1 -0
- package/dist/types/lib/Utils/getAllProps.d.ts +2 -0
- package/dist/types/lib/Utils/getAllProps.d.ts.map +1 -0
- package/dist/types/lib/Utils/helpers.d.ts +13 -0
- package/dist/types/lib/Utils/helpers.d.ts.map +1 -0
- package/dist/types/lib/Utils/index.d.ts +13 -0
- package/dist/types/lib/Utils/index.d.ts.map +1 -0
- package/dist/types/lib/Utils/is.d.ts +12 -0
- package/dist/types/lib/Utils/is.d.ts.map +1 -0
- package/dist/types/lib/Utils/isDefinedAsGetter.d.ts +2 -0
- package/dist/types/lib/Utils/isDefinedAsGetter.d.ts.map +1 -0
- package/dist/types/lib/Utils/logger.d.ts +22 -0
- package/dist/types/lib/Utils/logger.d.ts.map +1 -0
- package/dist/types/lib/Utils/notificationManager.d.ts +67 -0
- package/dist/types/lib/Utils/notificationManager.d.ts.map +1 -0
- package/dist/types/lib/Utils/registerCleanup.d.ts +7 -0
- package/dist/types/lib/Utils/registerCleanup.d.ts.map +1 -0
- package/dist/types/lib/Utils/svgIcon.d.ts +95 -0
- package/dist/types/lib/Utils/svgIcon.d.ts.map +1 -0
- package/dist/types/lib/Utils/uuid.d.ts +7 -0
- package/dist/types/lib/Utils/uuid.d.ts.map +1 -0
- package/dist/types/lib/ZeroPromise/index.d.ts +2 -0
- package/dist/types/lib/ZeroPromise/index.d.ts.map +1 -0
- package/dist/types/lib/ZeroPromise/zero.d.ts +23 -0
- package/dist/types/lib/ZeroPromise/zero.d.ts.map +1 -0
- package/dist/types/lib/actions/action.d.ts +14 -0
- package/dist/types/lib/actions/action.d.ts.map +1 -0
- package/dist/types/lib/actions/animatePresets.d.ts +38 -0
- package/dist/types/lib/actions/animatePresets.d.ts.map +1 -0
- package/dist/types/lib/actions/animateSwap.d.ts +79 -0
- package/dist/types/lib/actions/animateSwap.d.ts.map +1 -0
- package/dist/types/lib/actions/animateTypes.d.ts +103 -0
- package/dist/types/lib/actions/animateTypes.d.ts.map +1 -0
- package/dist/types/lib/actions/asyncAction.d.ts +4 -0
- package/dist/types/lib/actions/asyncAction.d.ts.map +1 -0
- package/dist/types/lib/actions/asyncActionCache.d.ts +16 -0
- package/dist/types/lib/actions/asyncActionCache.d.ts.map +1 -0
- package/dist/types/lib/actions/asyncActionPolling.d.ts +14 -0
- package/dist/types/lib/actions/asyncActionPolling.d.ts.map +1 -0
- package/dist/types/lib/actions/asyncActionTypes.d.ts +74 -0
- package/dist/types/lib/actions/asyncActionTypes.d.ts.map +1 -0
- package/dist/types/lib/actions/createTimingFunction.d.ts +23 -0
- package/dist/types/lib/actions/createTimingFunction.d.ts.map +1 -0
- package/dist/types/lib/actions/debounce.d.ts +10 -0
- package/dist/types/lib/actions/debounce.d.ts.map +1 -0
- package/dist/types/lib/actions/index.d.ts +12 -0
- package/dist/types/lib/actions/index.d.ts.map +1 -0
- package/dist/types/lib/actions/paginatedAsyncAction.d.ts +121 -0
- package/dist/types/lib/actions/paginatedAsyncAction.d.ts.map +1 -0
- package/dist/types/lib/actions/taskAction.d.ts +105 -0
- package/dist/types/lib/actions/taskAction.d.ts.map +1 -0
- package/dist/types/lib/actions/throttle.d.ts +9 -0
- package/dist/types/lib/actions/throttle.d.ts.map +1 -0
- package/dist/types/lib/css-in-js/cl.d.ts +37 -0
- package/dist/types/lib/css-in-js/cl.d.ts.map +1 -0
- package/dist/types/lib/css-in-js/index.d.ts +7 -0
- package/dist/types/lib/css-in-js/index.d.ts.map +1 -0
- package/dist/types/lib/css-in-js/sanitize.d.ts +31 -0
- package/dist/types/lib/css-in-js/sanitize.d.ts.map +1 -0
- package/dist/types/lib/css-in-js/serialize.d.ts +98 -0
- package/dist/types/lib/css-in-js/serialize.d.ts.map +1 -0
- package/dist/types/lib/css-in-js/stylesheet.d.ts +188 -0
- package/dist/types/lib/css-in-js/stylesheet.d.ts.map +1 -0
- package/dist/types/lib/css-in-js/theme.d.ts +110 -0
- package/dist/types/lib/css-in-js/theme.d.ts.map +1 -0
- package/dist/types/lib/devtools/devtoolsHooks.d.ts +101 -0
- package/dist/types/lib/devtools/devtoolsHooks.d.ts.map +1 -0
- package/dist/types/lib/devtools/index.d.ts +2 -0
- package/dist/types/lib/devtools/index.d.ts.map +1 -0
- package/dist/types/lib/index.d.ts +46 -0
- package/dist/types/lib/index.d.ts.map +1 -0
- package/dist/types/lib/on/hooks.d.ts +319 -0
- package/dist/types/lib/on/hooks.d.ts.map +1 -0
- package/dist/types/lib/on/index.d.ts +3 -0
- package/dist/types/lib/on/index.d.ts.map +1 -0
- package/dist/types/lib/on/on.d.ts +16 -0
- package/dist/types/lib/on/on.d.ts.map +1 -0
- package/dist/types/lib/portals/dialog.d.ts +56 -0
- package/dist/types/lib/portals/dialog.d.ts.map +1 -0
- package/dist/types/lib/portals/index.d.ts +9 -0
- package/dist/types/lib/portals/index.d.ts.map +1 -0
- package/dist/types/lib/portals/popup.d.ts +37 -0
- package/dist/types/lib/portals/popup.d.ts.map +1 -0
- package/dist/types/lib/portals/portal.d.ts +57 -0
- package/dist/types/lib/portals/portal.d.ts.map +1 -0
- package/dist/types/lib/portals/tip.d.ts +38 -0
- package/dist/types/lib/portals/tip.d.ts.map +1 -0
- package/dist/types/lib/socket/index.d.ts +2 -0
- package/dist/types/lib/socket/index.d.ts.map +1 -0
- package/dist/types/lib/socket/ws.d.ts +83 -0
- package/dist/types/lib/socket/ws.d.ts.map +1 -0
- package/dist/types/lib/ssr/index.d.ts +3 -0
- package/dist/types/lib/ssr/index.d.ts.map +1 -0
- package/dist/types/lib/ssr/ssr-bridge.d.ts +89 -0
- package/dist/types/lib/ssr/ssr-bridge.d.ts.map +1 -0
- package/dist/types/lib/ssr/ssrFlag.d.ts +38 -0
- package/dist/types/lib/ssr/ssrFlag.d.ts.map +1 -0
- package/dist/types/lib/virtualizer/ScrollerController.d.ts +54 -0
- package/dist/types/lib/virtualizer/ScrollerController.d.ts.map +1 -0
- package/dist/types/lib/virtualizer/Virtualizer.d.ts +214 -0
- package/dist/types/lib/virtualizer/Virtualizer.d.ts.map +1 -0
- package/dist/types/lib/virtualizer/events.d.ts +27 -0
- package/dist/types/lib/virtualizer/events.d.ts.map +1 -0
- package/dist/types/lib/virtualizer/layouts/flow.d.ts +123 -0
- package/dist/types/lib/virtualizer/layouts/flow.d.ts.map +1 -0
- package/dist/types/lib/virtualizer/layouts/grid.d.ts +25 -0
- package/dist/types/lib/virtualizer/layouts/grid.d.ts.map +1 -0
- package/dist/types/lib/virtualizer/layouts/masonry.d.ts +37 -0
- package/dist/types/lib/virtualizer/layouts/masonry.d.ts.map +1 -0
- package/dist/types/lib/virtualizer/layouts/shared/BaseLayout.d.ts +204 -0
- package/dist/types/lib/virtualizer/layouts/shared/BaseLayout.d.ts.map +1 -0
- package/dist/types/lib/virtualizer/layouts/shared/GridBaseLayout.d.ts +41 -0
- package/dist/types/lib/virtualizer/layouts/shared/GridBaseLayout.d.ts.map +1 -0
- package/dist/types/lib/virtualizer/layouts/shared/Layout.d.ts +138 -0
- package/dist/types/lib/virtualizer/layouts/shared/Layout.d.ts.map +1 -0
- package/dist/types/lib/virtualizer/layouts/shared/SizeCache.d.ts +19 -0
- package/dist/types/lib/virtualizer/layouts/shared/SizeCache.d.ts.map +1 -0
- package/dist/types/lib/virtualizer/layouts/shared/SizeGapPaddingBaseLayout.d.ts +57 -0
- package/dist/types/lib/virtualizer/layouts/shared/SizeGapPaddingBaseLayout.d.ts.map +1 -0
- package/dist/types/lib/virtualizer/mates-adapter.d.ts +201 -0
- package/dist/types/lib/virtualizer/mates-adapter.d.ts.map +1 -0
- package/dist/types/lib/virtualizer/virtualize.d.ts +52 -0
- package/dist/types/lib/virtualizer/virtualize.d.ts.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import type { AsyncActionReturnType, AsyncFetchOptions } from "../actions/asyncActionTypes";
|
|
2
|
+
import { ZeroPromise } from "../ZeroPromise/zero";
|
|
3
|
+
export { setSSRApiLookup, setSSRRequest } from "../ssr/ssr-bridge";
|
|
4
|
+
export type FetchRequest = Omit<RequestInit, "body"> & {
|
|
5
|
+
/**
|
|
6
|
+
* URL for this request.
|
|
7
|
+
*
|
|
8
|
+
* - If it starts with `http:` or `https:` it is used as-is (absolute URL),
|
|
9
|
+
* ignoring any `host` set on the client/base request.
|
|
10
|
+
* - Otherwise it is treated as a path and appended to `host`
|
|
11
|
+
* (e.g. `host = "https://api.example.com"` + `url = "/users"` →
|
|
12
|
+
* `"https://api.example.com/users"`).
|
|
13
|
+
* - Dynamic segments (`:id`) are substituted from `params`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* { url: "/users/:id/posts", params: { id: 7, page: 2 } }
|
|
17
|
+
* // → /users/7/posts?page=2
|
|
18
|
+
*/
|
|
19
|
+
url?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Alias for `url`. When `url` is not provided, `path` is used as the URL
|
|
22
|
+
* template. Useful for configs that use `{ host, path }` instead of
|
|
23
|
+
* `{ host, url }`.
|
|
24
|
+
*/
|
|
25
|
+
path?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Origin / base host, e.g. `"https://api.example.com"`.
|
|
28
|
+
* Used as a prefix when `url` is a relative path.
|
|
29
|
+
* Defaults to `""` (no host prefix).
|
|
30
|
+
*/
|
|
31
|
+
host?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Route + query-string params — a plain object.
|
|
34
|
+
* Keys matching a `:token` in `url` are used as path params (via buildPath).
|
|
35
|
+
* All remaining keys are appended as query-string parameters.
|
|
36
|
+
*/
|
|
37
|
+
params?: Record<string, any>;
|
|
38
|
+
/** Request body — plain objects are JSON-serialised automatically. */
|
|
39
|
+
body?: BodyInit | Record<string, any> | null;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Convenience type — most call sites just need a URL string; the full
|
|
43
|
+
* `FetchRequest` object is available for advanced configuration.
|
|
44
|
+
*/
|
|
45
|
+
export type FetchInput = string | FetchRequest;
|
|
46
|
+
export type BeforeInterceptor = (url: string, options: RequestInit) => {
|
|
47
|
+
url: string;
|
|
48
|
+
options: RequestInit;
|
|
49
|
+
};
|
|
50
|
+
export type AfterInterceptor = (response: Response) => Response;
|
|
51
|
+
export type ErrorInterceptor = (error: Error) => void;
|
|
52
|
+
/** Build the final URL from a FetchRequest. */
|
|
53
|
+
export declare function buildRequestUrl(request: FetchRequest): string;
|
|
54
|
+
export type FetchBody = BodyInit | Record<string, any> | null;
|
|
55
|
+
export type FetchActionConfig = FetchRequest & AsyncFetchOptions;
|
|
56
|
+
export declare const interceptBefore: (fn: BeforeInterceptor) => () => void;
|
|
57
|
+
export declare const interceptAfter: (fn: AfterInterceptor) => () => void;
|
|
58
|
+
export declare const interceptError: (fn: ErrorInterceptor) => () => void;
|
|
59
|
+
export declare const clearInterceptors: () => void;
|
|
60
|
+
/**
|
|
61
|
+
* A self-contained HTTP client.
|
|
62
|
+
*
|
|
63
|
+
* - Constructor accepts a base `FetchRequest` (host, default headers, etc.)
|
|
64
|
+
* that is merged under every call-site request.
|
|
65
|
+
* - Each instance maintains its own interceptor chain, which runs **before**
|
|
66
|
+
* the global interceptors.
|
|
67
|
+
* - All requests are logged to Mates DevTools when devtools is connected.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* const api = new FetchClient({ host: "https://api.example.com" });
|
|
71
|
+
* api.interceptBefore((url, opts) => ({
|
|
72
|
+
* url,
|
|
73
|
+
* options: { ...opts, headers: { ...opts.headers, Authorization: `Bearer ${token}` } },
|
|
74
|
+
* }));
|
|
75
|
+
*
|
|
76
|
+
* const users = await api.Get({ url: "/users", params: { page: 1 } });
|
|
77
|
+
*/
|
|
78
|
+
export declare class FetchClient {
|
|
79
|
+
private readonly baseRequest;
|
|
80
|
+
private readonly instanceBeforeFns;
|
|
81
|
+
private readonly instanceAfterFns;
|
|
82
|
+
private readonly instanceErrorFns;
|
|
83
|
+
constructor(baseRequest?: FetchRequest);
|
|
84
|
+
/** Add a before-interceptor scoped to this instance. Returns an unsubscribe fn. */
|
|
85
|
+
interceptBefore(fn: BeforeInterceptor): () => void;
|
|
86
|
+
/** Add an after-interceptor scoped to this instance. Returns an unsubscribe fn. */
|
|
87
|
+
interceptAfter(fn: AfterInterceptor): () => void;
|
|
88
|
+
/** Add an error-interceptor scoped to this instance. Returns an unsubscribe fn. */
|
|
89
|
+
interceptError(fn: ErrorInterceptor): () => void;
|
|
90
|
+
/** Remove all interceptors scoped to this instance. */
|
|
91
|
+
clearInterceptors(): void;
|
|
92
|
+
fetch<T = any>(request: FetchRequest): ZeroPromise<T>;
|
|
93
|
+
/** Public alias for `fetch` — matches the exported global `Fetch` name. */
|
|
94
|
+
Fetch<T = any>(request: FetchRequest): ZeroPromise<T>;
|
|
95
|
+
Get<T = any>(request: FetchRequest): ZeroPromise<T>;
|
|
96
|
+
Post<T = any>(request: FetchRequest): ZeroPromise<T>;
|
|
97
|
+
Put<T = any>(request: FetchRequest): ZeroPromise<T>;
|
|
98
|
+
Patch<T = any>(request: FetchRequest): ZeroPromise<T>;
|
|
99
|
+
Delete<T = any>(request: FetchRequest): ZeroPromise<T>;
|
|
100
|
+
/**
|
|
101
|
+
* Creates an asyncAction that calls this client's Fetch().
|
|
102
|
+
*
|
|
103
|
+
* The base config (host, path, method, headers, …) is fixed at creation time.
|
|
104
|
+
* The returned action accepts a plain `params` object whose keys are used to
|
|
105
|
+
* fill dynamic path segments (`:id`) and/or appended as query-string params —
|
|
106
|
+
* exactly as `buildRequestUrl` handles them.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* const loadUser = api.fetchAction({ host: "https://api.example.com", url: "/users/:id" });
|
|
110
|
+
* loadUser({ id: 7, expand: "posts" });
|
|
111
|
+
* // → GET https://api.example.com/users/7?expand=posts
|
|
112
|
+
*/
|
|
113
|
+
fetchAction<T = unknown>(config?: FetchActionConfig): AsyncActionReturnType<(params?: Record<string, any>) => Promise<T>>;
|
|
114
|
+
/**
|
|
115
|
+
* Creates an asyncAction that always issues a GET request via this client.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* const loadUsers = api.getAction({ host: "https://api.example.com", url: "/users" });
|
|
119
|
+
* loadUsers({ page: 2, limit: 20 });
|
|
120
|
+
*/
|
|
121
|
+
getAction<T = unknown>(config?: FetchActionConfig): AsyncActionReturnType<(params?: Record<string, any>) => Promise<T>>;
|
|
122
|
+
/**
|
|
123
|
+
* Creates an asyncAction that always issues a POST request via this client.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* const createUser = api.postAction({ host: "https://api.example.com", url: "/users" });
|
|
127
|
+
* createUser({ name: "Alice" });
|
|
128
|
+
*/
|
|
129
|
+
postAction<T = unknown>(config?: FetchActionConfig): AsyncActionReturnType<(params?: Record<string, any>) => Promise<T>>;
|
|
130
|
+
/**
|
|
131
|
+
* Creates an asyncAction that always issues a PUT request via this client.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* const replaceUser = api.putAction({ host: "https://api.example.com", url: "/users/:id" });
|
|
135
|
+
* replaceUser({ id: 7, name: "Bob" });
|
|
136
|
+
*/
|
|
137
|
+
putAction<T = unknown>(config?: FetchActionConfig): AsyncActionReturnType<(params?: Record<string, any>) => Promise<T>>;
|
|
138
|
+
/**
|
|
139
|
+
* Creates an asyncAction that always issues a PATCH request via this client.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* const patchUser = api.patchAction({ host: "https://api.example.com", url: "/users/:id" });
|
|
143
|
+
* patchUser({ id: 7, status: "inactive" });
|
|
144
|
+
*/
|
|
145
|
+
patchAction<T = unknown>(config?: FetchActionConfig): AsyncActionReturnType<(params?: Record<string, any>) => Promise<T>>;
|
|
146
|
+
/**
|
|
147
|
+
* Creates an asyncAction that always issues a DELETE request via this client.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* const removeUser = api.deleteAction({ host: "https://api.example.com", url: "/users/:id" });
|
|
151
|
+
* removeUser({ id: 7 });
|
|
152
|
+
*/
|
|
153
|
+
deleteAction<T = unknown>(config?: FetchActionConfig): AsyncActionReturnType<(params?: Record<string, any>) => Promise<T>>;
|
|
154
|
+
}
|
|
155
|
+
export declare const fetchClient: FetchClient;
|
|
156
|
+
export declare const Fetch: <T = any>(request: FetchInput) => ZeroPromise<T>;
|
|
157
|
+
export declare const Get: <T = any>(request: FetchInput) => ZeroPromise<T>;
|
|
158
|
+
export declare const Post: <T = any>(request: FetchInput) => ZeroPromise<T>;
|
|
159
|
+
export declare const Put: <T = any>(request: FetchInput) => ZeroPromise<T>;
|
|
160
|
+
export declare const Patch: <T = any>(request: FetchInput) => ZeroPromise<T>;
|
|
161
|
+
export declare const Delete: <T = any>(request: FetchInput) => ZeroPromise<T>;
|
|
162
|
+
export declare const fetchAction: <T = unknown>(config?: FetchActionConfig) => AsyncActionReturnType<(params?: Record<string, any>) => Promise<T>>;
|
|
163
|
+
export declare const getAction: <T = unknown>(config?: FetchActionConfig) => AsyncActionReturnType<(params?: Record<string, any>) => Promise<T>>;
|
|
164
|
+
export declare const postAction: <T = unknown>(config?: FetchActionConfig) => AsyncActionReturnType<(params?: Record<string, any>) => Promise<T>>;
|
|
165
|
+
export declare const putAction: <T = unknown>(config?: FetchActionConfig) => AsyncActionReturnType<(params?: Record<string, any>) => Promise<T>>;
|
|
166
|
+
export declare const patchAction: <T = unknown>(config?: FetchActionConfig) => AsyncActionReturnType<(params?: Record<string, any>) => Promise<T>>;
|
|
167
|
+
export declare const deleteAction: <T = unknown>(config?: FetchActionConfig) => AsyncActionReturnType<(params?: Record<string, any>) => Promise<T>>;
|
|
168
|
+
//# sourceMappingURL=Fetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Fetch.d.ts","sourceRoot":"","sources":["../../../../../lib/Fetch/Fetch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAKlD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAInE,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG;IACrD;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,sEAAsE;IACtE,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;CAC9C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,YAAY,CAAC;AAO/C,MAAM,MAAM,iBAAiB,GAAG,CAC9B,GAAG,EA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GAAI,CAAC,GAAG,OAAO,EAAE,SAAS,iBAAiB,qCA1G9B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,gBA2GpB,CAAC;AAErC,eAAO,MAAM,SAAS,GAAI,CAAC,GAAG,OAAO,EAAE,SAAS,iBAAiB,qCAxF5B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,gBAyFtB,CAAC;AAEnC,eAAO,MAAM,UAAU,GAAI,CAAC,GAAG,OAAO,EAAE,SAAS,iBAAiB,qCA9E7B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,gBA+ErB,CAAC;AAEpC,eAAO,MAAM,SAAS,GAAI,CAAC,GAAG,OAAO,EAAE,SAAS,iBAAiB,qCApE5B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,gBAqEtB,CAAC;AAEnC,eAAO,MAAM,WAAW,GAAI,CAAC,GAAG,OAAO,EAAE,SAAS,iBAAiB,qCA1D9B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,gBA2DpB,CAAC;AAErC,eAAO,MAAM,YAAY,GAAI,CAAC,GAAG,OAAO,EAAE,SAAS,iBAAiB,qCAhD/B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,gBAiDnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../lib/Fetch/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { type AtomConfig, type AtomType } from "../atom/atom";
|
|
2
|
+
/**
|
|
3
|
+
* A reactive `Map<string, T>` with optional per-entry TTL auto-expiry.
|
|
4
|
+
*
|
|
5
|
+
* Extends the base `AtomType` interface (minus `set` and `update`, which are
|
|
6
|
+
* replaced by the higher-level mutation methods below). Calling the atom as
|
|
7
|
+
* a function — `cache()` — returns the underlying `Map<string, T>` and
|
|
8
|
+
* registers the caller as a reactive subscriber, exactly as a plain atom would.
|
|
9
|
+
*
|
|
10
|
+
* @template T The type of values stored in the cache.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* interface User { name: string }
|
|
15
|
+
*
|
|
16
|
+
* const userCache = cacheAtom<User>();
|
|
17
|
+
*
|
|
18
|
+
* // Permanent entry
|
|
19
|
+
* userCache.add("u2", { name: "Bob" });
|
|
20
|
+
*
|
|
21
|
+
* // Entry that expires after 30 s
|
|
22
|
+
* userCache.add("u1", { name: "Alice" }, 30_000);
|
|
23
|
+
*
|
|
24
|
+
* console.log(userCache.get("u1")); // { name: "Alice" }
|
|
25
|
+
* console.log(userCache.size); // 2
|
|
26
|
+
* console.log(userCache.getAll()); // [{ name: "Alice" }, { name: "Bob" }]
|
|
27
|
+
*
|
|
28
|
+
* // Manual eviction
|
|
29
|
+
* userCache.remove("u2"); // true
|
|
30
|
+
*
|
|
31
|
+
* // Replace an entry — existing timer is cancelled automatically
|
|
32
|
+
* userCache.add("u1", { name: "Alice Updated" }, 60_000);
|
|
33
|
+
*
|
|
34
|
+
* // Wipe everything
|
|
35
|
+
* userCache.clearAll();
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export type CacheAtomType<T> = Omit<AtomType<Map<string, T>>, "set" | "update"> & {
|
|
39
|
+
/**
|
|
40
|
+
* Inserts or replaces an entry in the cache.
|
|
41
|
+
*
|
|
42
|
+
* - If `id` already exists any pending expiry timer is cancelled first.
|
|
43
|
+
* - If `ttl` is a positive number the entry is automatically removed after
|
|
44
|
+
* `ttl` milliseconds.
|
|
45
|
+
* - If `ttl` is `-1` or omitted the entry is permanent until manually
|
|
46
|
+
* removed or `clearAll()` is called.
|
|
47
|
+
*
|
|
48
|
+
* Notifies all subscribers after the mutation.
|
|
49
|
+
*
|
|
50
|
+
* @param id Unique string key for the entry.
|
|
51
|
+
* @param value Value to store.
|
|
52
|
+
* @param ttl Time-to-live in milliseconds (`> 0`), or `-1` / omitted for
|
|
53
|
+
* a permanent entry.
|
|
54
|
+
*/
|
|
55
|
+
add(id: string, value: T, ttl?: number): void;
|
|
56
|
+
/**
|
|
57
|
+
* Returns the cached value for `id`, or `undefined` when absent.
|
|
58
|
+
*
|
|
59
|
+
* Registers the calling reactive context as a subscriber.
|
|
60
|
+
*
|
|
61
|
+
* @param id Key to look up.
|
|
62
|
+
*/
|
|
63
|
+
get(id: string): T | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Removes a single entry from the cache.
|
|
66
|
+
*
|
|
67
|
+
* Cancels any pending expiry timer and notifies subscribers.
|
|
68
|
+
* Returns `false` — without emitting a notification — when `id` is not
|
|
69
|
+
* present, keeping the behaviour consistent with `Map.prototype.delete`.
|
|
70
|
+
*
|
|
71
|
+
* @param id Key to remove.
|
|
72
|
+
* @returns `true` if the entry existed and was removed; `false` otherwise.
|
|
73
|
+
*/
|
|
74
|
+
remove(id: string): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Returns whether `id` currently exists in the cache.
|
|
77
|
+
*
|
|
78
|
+
* Registers the calling reactive context as a subscriber.
|
|
79
|
+
*
|
|
80
|
+
* @param id Key to test.
|
|
81
|
+
*/
|
|
82
|
+
has(id: string): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Returns a snapshot of all cached values as an ordered array.
|
|
85
|
+
*
|
|
86
|
+
* The order reflects the insertion order of the underlying `Map`.
|
|
87
|
+
* Registers the calling reactive context as a subscriber.
|
|
88
|
+
*/
|
|
89
|
+
getAll(): T[];
|
|
90
|
+
/**
|
|
91
|
+
* Clears the entire cache, cancels every pending expiry timer, and notifies
|
|
92
|
+
* all subscribers.
|
|
93
|
+
*
|
|
94
|
+
* Called automatically when the component that created this atom unmounts.
|
|
95
|
+
* At module level it must be called manually.
|
|
96
|
+
*/
|
|
97
|
+
clearAll(): void;
|
|
98
|
+
/** Reactive number of entries currently held in the cache. */
|
|
99
|
+
readonly size: number;
|
|
100
|
+
/** Discriminator tag — always `"cacheAtom"`. */
|
|
101
|
+
readonly name: "cacheAtom";
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Creates a reactive `Map<string, T>` cache atom with optional per-entry TTL
|
|
105
|
+
* auto-expiry.
|
|
106
|
+
*
|
|
107
|
+
* The returned object is callable (`cache()`) — invoking it returns the
|
|
108
|
+
* underlying `Map<string, T>` and registers the caller as a reactive subscriber
|
|
109
|
+
* in exactly the same way a plain `atom` would.
|
|
110
|
+
*
|
|
111
|
+
* **Automatic cleanup** — when `cacheAtom` is created inside a component's
|
|
112
|
+
* outer function, `clearAll()` is registered as a teardown handler via
|
|
113
|
+
* `registerCleanup`. On component unmount every pending TTL timer is cancelled
|
|
114
|
+
* and all entries are removed automatically. When created at module level no
|
|
115
|
+
* automatic cleanup occurs and `clearAll()` must be called manually if needed.
|
|
116
|
+
*
|
|
117
|
+
* Internally the factory:
|
|
118
|
+
* 1. Creates a real `Map<string, T>` (`_map`) as the atom's initial value so
|
|
119
|
+
* that `cache()` always returns the same Map reference.
|
|
120
|
+
* 2. Wraps it in a base `atom` whose identity drives all reactivity.
|
|
121
|
+
* 3. Captures the original `base.get` **before** overriding `.get` on the
|
|
122
|
+
* result object, preventing infinite recursion in subscription-tracking
|
|
123
|
+
* calls.
|
|
124
|
+
* 4. Attaches all extended methods via `(result as any).method = ...`
|
|
125
|
+
* following the `paginationAtom` pattern.
|
|
126
|
+
* 5. Exposes `name`, `size`, `__isAtom___`, and `__version__` as
|
|
127
|
+
* `Object.defineProperty` getters following the `mapAtom` pattern.
|
|
128
|
+
* 6. Calls `registerCleanup(base, clearAll)` — a no-op at module level,
|
|
129
|
+
* but hooks into the component host's teardown when called inside a
|
|
130
|
+
* component.
|
|
131
|
+
*
|
|
132
|
+
* @template T The type of values stored in the cache.
|
|
133
|
+
* @param config Optional atom configuration forwarded to the base `atom`.
|
|
134
|
+
* @returns A fully-reactive {@link CacheAtomType} instance.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```ts
|
|
138
|
+
* // Module level — manual clearAll required
|
|
139
|
+
* const tokenCache = cacheAtom<string>();
|
|
140
|
+
* tokenCache.add("jwt", "eyJ...", 15 * 60 * 1000); // expires in 15 min
|
|
141
|
+
* tokenCache.add("refresh", "abc123"); // permanent
|
|
142
|
+
*
|
|
143
|
+
* effect(() => {
|
|
144
|
+
* console.log("cache size:", tokenCache.size); // reactive
|
|
145
|
+
* });
|
|
146
|
+
*
|
|
147
|
+
* // Inside a component — clearAll is called automatically on unmount
|
|
148
|
+
* const MyComponent = view(() => {
|
|
149
|
+
* const recent = cacheAtom<Post>();
|
|
150
|
+
* recent.add("p1", post, 60_000);
|
|
151
|
+
* // …no manual cleanup needed
|
|
152
|
+
* });
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
export declare function cacheAtom<T>(config?: AtomConfig): CacheAtomType<T>;
|
|
156
|
+
//# sourceMappingURL=cacheAtom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cacheAtom.d.ts","sourceRoot":"","sources":["../../../../../../lib/Mutables/Extended Atoms/cacheAtom.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAQ,MAAM,cAAc,CAAC;AAIpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,IAAI,CACjC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EACxB,KAAK,GAAG,QAAQ,CACjB,GAAG;IACF;;;;;;;;;;;;;;;OAeG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9C;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IAE/B;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IAE5B;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IAEzB;;;;;OAKG;IACH,MAAM,IAAI,CAAC,EAAE,CAAC;IAEd;;;;;;OAMG;IACH,QAAQ,IAAI,IAAI,CAAC;IAEjB,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC,CA6KlE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../lib/Mutables/Extended Atoms/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type AtomConfig, type AtomType } from "../atom/atom";
|
|
2
|
+
export type PaginationAtomType = AtomType<number> & {
|
|
3
|
+
readonly currentPage: number;
|
|
4
|
+
next(): void;
|
|
5
|
+
prev(): void;
|
|
6
|
+
reset(): void;
|
|
7
|
+
readonly name: "paginationAtom";
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Creates a reactive pagination atom.
|
|
11
|
+
*
|
|
12
|
+
* Inherits the full `AtomType<number>` interface — callable, `.get()`,
|
|
13
|
+
* `.set()`, `.update()`, `.val`, `.__subscribe()`, `.__version__`,
|
|
14
|
+
* `.lock()` / `.unlock()`, `.toJSON()` — plus pagination-specific helpers:
|
|
15
|
+
*
|
|
16
|
+
* - `currentPage` — alias for the current value.
|
|
17
|
+
* - `next()` — increment by 1.
|
|
18
|
+
* - `prev()` — decrement by 1 (floors at 1).
|
|
19
|
+
* - `reset()` — set back to 1.
|
|
20
|
+
*
|
|
21
|
+
* @param initial - Starting page number (default: 1).
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const page = paginationAtom(1);
|
|
25
|
+
* page.next(); // 2
|
|
26
|
+
* page.prev(); // 1
|
|
27
|
+
* page.reset(); // 1
|
|
28
|
+
* page(); // 1 — callable read
|
|
29
|
+
* page.currentPage; // 1
|
|
30
|
+
*/
|
|
31
|
+
export declare const paginationAtom: (initial?: number, config?: AtomConfig) => PaginationAtomType;
|
|
32
|
+
//# sourceMappingURL=paginationAtom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paginationAtom.d.ts","sourceRoot":"","sources":["../../../../../../lib/Mutables/Extended Atoms/paginationAtom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAQ,MAAM,cAAc,CAAC;AAIpE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG;IAClD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,IAAI,IAAI,IAAI,CAAC;IACb,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,IAAI,IAAI,CAAC;IACd,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;CACjC,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc,GACzB,UAAS,MAAU,EACnB,SAAS,UAAU,KAClB,kBAiCF,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type AtomType } from "../atom/atom";
|
|
2
|
+
/** The three possible theme values a user can choose. */
|
|
3
|
+
export type ThemeValue = "light" | "dark" | "auto";
|
|
4
|
+
/**
|
|
5
|
+
* A reactive theme atom extended with convenience mutators and a pre-resolved
|
|
6
|
+
* `resolved` getter.
|
|
7
|
+
*
|
|
8
|
+
* Inherits the full `AtomType<ThemeValue>` interface — callable, `.get()`,
|
|
9
|
+
* `.set()`, `.val`, `.__subscribe()`, `.__version__`, etc. — plus
|
|
10
|
+
* theme-specific helpers:
|
|
11
|
+
*
|
|
12
|
+
* - `setToLight()` — force light mode and persist choice.
|
|
13
|
+
* - `setToDark()` — force dark mode and persist choice.
|
|
14
|
+
* - `setToAuto()` — follow OS preference, removes stored key.
|
|
15
|
+
* - `toggle()` — flip between "light" and "dark"; resolves OS preference
|
|
16
|
+
* first if currently "auto"; result is always explicit.
|
|
17
|
+
* - `resolved` — the effective theme, always "light" or "dark".
|
|
18
|
+
*/
|
|
19
|
+
export type ThemeAtomType = AtomType<ThemeValue> & {
|
|
20
|
+
/** Explicitly set theme to "light" and persist to localStorage. */
|
|
21
|
+
setToLight(): void;
|
|
22
|
+
/** Explicitly set theme to "dark" and persist to localStorage. */
|
|
23
|
+
setToDark(): void;
|
|
24
|
+
/** Follow the OS color-scheme preference. Removes localStorage key. */
|
|
25
|
+
setToAuto(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Toggle between "light" and "dark".
|
|
28
|
+
* If currently "auto", resolves OS preference first, then flips.
|
|
29
|
+
* After toggle the theme is always explicit (never "auto").
|
|
30
|
+
*/
|
|
31
|
+
toggle(): void;
|
|
32
|
+
/** The resolved theme — always "light" or "dark", never "auto". */
|
|
33
|
+
readonly resolved: "light" | "dark";
|
|
34
|
+
readonly name: "themeAtom";
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The singleton reactive theme atom.
|
|
38
|
+
*
|
|
39
|
+
* Use directly — it is the atom, not a factory.
|
|
40
|
+
*
|
|
41
|
+
* - Reads the initial theme from `localStorage["mates-theme"]`.
|
|
42
|
+
* - Falls back to the OS color-scheme preference when no value is stored.
|
|
43
|
+
* - Keeps `<html data-theme="…">` in sync automatically via an internal effect.
|
|
44
|
+
* - Persists changes to localStorage (removes key for "auto").
|
|
45
|
+
* - Re-applies the resolved theme when the OS preference changes while in
|
|
46
|
+
* "auto" mode, re-notifying all subscribers so derived UIs update.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* import { themeAtom } from "mates";
|
|
50
|
+
*
|
|
51
|
+
* themeAtom.setToDark();
|
|
52
|
+
* themeAtom.toggle(); // → "light"
|
|
53
|
+
* themeAtom.setToAuto(); // follows OS
|
|
54
|
+
* themeAtom.resolved; // "light" | "dark" — never "auto"
|
|
55
|
+
* themeAtom(); // read current value: "light" | "dark" | "auto"
|
|
56
|
+
* themeAtom.val; // same
|
|
57
|
+
*/
|
|
58
|
+
export declare const themeAtom: ThemeAtomType;
|
|
59
|
+
//# sourceMappingURL=themeAtom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeAtom.d.ts","sourceRoot":"","sources":["../../../../../../lib/Mutables/Extended Atoms/themeAtom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAQ,MAAM,cAAc,CAAC;AAUnD,yDAAyD;AACzD,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnD;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG;IACjD,mEAAmE;IACnE,UAAU,IAAI,IAAI,CAAC;IACnB,kEAAkE;IAClE,SAAS,IAAI,IAAI,CAAC;IAClB,uEAAuE;IACvE,SAAS,IAAI,IAAI,CAAC;IAClB;;;;OAIG;IACH,MAAM,IAAI,IAAI,CAAC;IACf,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B,CAAC;AA6JF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,SAAS,EAAE,aAAgC,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
type Subscriber = () => void;
|
|
2
|
+
type Updater<T> = (prev: T) => T;
|
|
3
|
+
type UpdateFn<T> = (draft: T) => void;
|
|
4
|
+
export type AtomConfig = {
|
|
5
|
+
/** Skip the restricted-context guard so the atom can be created inside templates, effects, etc. */
|
|
6
|
+
skipRestrictedContextCheck?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type AtomType<T> = {
|
|
9
|
+
(): T;
|
|
10
|
+
get(): T;
|
|
11
|
+
set(value: T | Updater<T>, silently?: boolean): void;
|
|
12
|
+
update(fn: UpdateFn<T>, silently?: boolean): void;
|
|
13
|
+
__subscribe(fn: Subscriber): () => void;
|
|
14
|
+
toJSON(): string;
|
|
15
|
+
/** Writable so extended atoms can stamp their own name (e.g. "iAtom"). */
|
|
16
|
+
name: string;
|
|
17
|
+
readonly val: T;
|
|
18
|
+
readonly __version__: number;
|
|
19
|
+
readonly __isAtom___: true;
|
|
20
|
+
readonly __id__: number;
|
|
21
|
+
/** Set to true to suppress devtools logging for this atom's set/update calls. */
|
|
22
|
+
skipDevToolsLog?: boolean;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Create a reactive atom.
|
|
26
|
+
*
|
|
27
|
+
* The core reactive primitive in mates — a single callable function object
|
|
28
|
+
* with `get`, `set`, `update`, `val`, `__subscribe`, `__version__`,
|
|
29
|
+
* `__id__`, `toJSON`, and `name`.
|
|
30
|
+
*
|
|
31
|
+
* Callable as `count()` as shorthand for `count.get()`.
|
|
32
|
+
* Both `get()` and the `val` getter participate in view subscription and
|
|
33
|
+
* read-tracking so components re-render automatically.
|
|
34
|
+
*
|
|
35
|
+
* For lock/unlock use `superAtom()`.
|
|
36
|
+
*
|
|
37
|
+
* When a **function** is passed as `initial`, the atom is treated as a
|
|
38
|
+
* derived/memoised atom. The function is called via `memo()` and the
|
|
39
|
+
* resulting reactive atom is returned. In this mode `config` is ignored.
|
|
40
|
+
*
|
|
41
|
+
* @param initial - The initial value for the atom, **or** a derive function
|
|
42
|
+
* `() => T` to create a memoised/derived atom.
|
|
43
|
+
* @param config - Optional configuration object (ignored for derived atoms).
|
|
44
|
+
* @param config.skipRestrictedContextCheck - When `true`, bypasses the guard
|
|
45
|
+
* that normally prevents atom creation inside templates, effects, or memos.
|
|
46
|
+
* Useful for directives and other advanced patterns that intentionally
|
|
47
|
+
* create atoms from within a template function. Defaults to `false`.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* const count = atom(0);
|
|
51
|
+
* count.set(1);
|
|
52
|
+
* count.set(n => n + 1);
|
|
53
|
+
* count(); // 2
|
|
54
|
+
* count.val; // 2
|
|
55
|
+
* count.update(d => { d.x = 1 }); // for objects
|
|
56
|
+
* count.toJSON(); // "2"
|
|
57
|
+
* count.name; // "atom"
|
|
58
|
+
* count.__id__; // unique incrementing integer
|
|
59
|
+
*
|
|
60
|
+
* // Derived / memoised atom — re-computes whenever its dependencies change:
|
|
61
|
+
* const double = atom(() => count() * 2);
|
|
62
|
+
* double(); // 4
|
|
63
|
+
*
|
|
64
|
+
* // Inside a directive or other restricted context:
|
|
65
|
+
* const flag = atom(false, { skipRestrictedContextCheck: true });
|
|
66
|
+
*/
|
|
67
|
+
export declare function atom<T>(initial: (() => T) | T, config?: AtomConfig): AtomType<T>;
|
|
68
|
+
export type IAtomType<T> = {
|
|
69
|
+
(): T;
|
|
70
|
+
get(): T;
|
|
71
|
+
set(value: T | ((prev: T) => T), silently?: boolean): void;
|
|
72
|
+
__subscribe(fn: () => void): () => void;
|
|
73
|
+
toJSON(): string;
|
|
74
|
+
name: string;
|
|
75
|
+
readonly val: T;
|
|
76
|
+
readonly __version__: number;
|
|
77
|
+
readonly __isAtom___: true;
|
|
78
|
+
readonly __id__: number;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Create a deep-frozen reactive atom.
|
|
82
|
+
*
|
|
83
|
+
* Every value written via `set()` is automatically deep-frozen, preventing
|
|
84
|
+
* accidental mutation. `update()` is removed — use `set()` with a new object.
|
|
85
|
+
*
|
|
86
|
+
* All other `atom()` capabilities are preserved: callable, `get`, `val`,
|
|
87
|
+
* `__subscribe`, `__version__`, `__id__`, `toJSON`.
|
|
88
|
+
*
|
|
89
|
+
* For lock/unlock use `superAtom({ freeze: true })`.
|
|
90
|
+
*
|
|
91
|
+
* @param initial - The initial value (will be deep-frozen).
|
|
92
|
+
* @param config - Optional configuration object.
|
|
93
|
+
* @param config.skipRestrictedContextCheck - When `true`, bypasses the guard
|
|
94
|
+
* that normally prevents atom creation inside templates, effects, or memos.
|
|
95
|
+
* Defaults to `false`.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* const cfg = iAtom({ api: "https://..." });
|
|
99
|
+
* cfg.set({ api: "https://v2..." });
|
|
100
|
+
* cfg.set(prev => ({ ...prev, api: "https://v3..." }));
|
|
101
|
+
* Object.isFrozen(cfg()); // true
|
|
102
|
+
*/
|
|
103
|
+
export declare function iAtom<T>(initial: T, config?: AtomConfig): IAtomType<T>;
|
|
104
|
+
export type SuperAtomOptions = {
|
|
105
|
+
/** deepFreeze every value written to this atom. */
|
|
106
|
+
freeze?: boolean;
|
|
107
|
+
/** Skip the restricted-context guard so the atom can be created inside templates, effects, etc. */
|
|
108
|
+
skipRestrictedContextCheck?: boolean;
|
|
109
|
+
};
|
|
110
|
+
export type SuperAtomType<T> = AtomType<T> & {
|
|
111
|
+
lock(passcode?: string): void;
|
|
112
|
+
unlock(passcode?: string): void;
|
|
113
|
+
reset(): void;
|
|
114
|
+
freeze(): void;
|
|
115
|
+
readonly name: string;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Create a full-featured reactive atom.
|
|
119
|
+
*
|
|
120
|
+
* Extends `atom()` with:
|
|
121
|
+
* - `lock(passcode?)` / `unlock(passcode?)` — prevent/allow mutations.
|
|
122
|
+
* - `reset()` — restore the initial value and notify subscribers.
|
|
123
|
+
* - `freeze()` — deepFreeze the current value in place.
|
|
124
|
+
* - `{ freeze: true }` — deepFreeze every value on set (like `iAtom` but
|
|
125
|
+
* with lock/unlock and update throws a helpful error).
|
|
126
|
+
*
|
|
127
|
+
* @param initial - The initial value.
|
|
128
|
+
* @param options - Optional configuration object.
|
|
129
|
+
* @param options.freeze - When `true`, deep-freezes every value on set.
|
|
130
|
+
* @param options.skipRestrictedContextCheck - When `true`, bypasses the guard
|
|
131
|
+
* that normally prevents atom creation inside templates, effects, or memos.
|
|
132
|
+
* Defaults to `false`.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* const config = superAtom({ theme: "light" });
|
|
136
|
+
* config.lock();
|
|
137
|
+
* config.set({ theme: "dark" }); // silently ignored
|
|
138
|
+
* config.unlock();
|
|
139
|
+
* config.set({ theme: "dark" }); // works
|
|
140
|
+
* config.reset(); // back to { theme: "light" }
|
|
141
|
+
*
|
|
142
|
+
* // Immutable variant with lock:
|
|
143
|
+
* const cfg = superAtom({ api: "https://..." }, { freeze: true });
|
|
144
|
+
* cfg.lock("secret");
|
|
145
|
+
*/
|
|
146
|
+
export declare function superAtom<T>(initial: T, options?: SuperAtomOptions): SuperAtomType<T>;
|
|
147
|
+
export { deepFreeze as df } from "../../Utils/deepFreeze";
|
|
148
|
+
//# sourceMappingURL=atom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atom.d.ts","sourceRoot":"","sources":["../../../../../../lib/Mutables/atom/atom.ts"],"names":[],"mappings":"AAoBA,KAAK,UAAU,GAAG,MAAM,IAAI,CAAC;AAC7B,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC;AACjC,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;AAEtC,MAAM,MAAM,UAAU,GAAG;IACvB,mGAAmG;IACnG,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,CAAC;AAcF,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;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AQ,CAAC,GAAG,EAAE,CAAC,CAAC;IAChB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,CA8BtE;AAaD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,mDAAmD;IACnD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mGAAmG;IACnG,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG;IAC3C,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,KAAK,IAAI,IAAI,CAAC;IACd,MAAM,IAAI,IAAI,CAAC;IACf,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,SAAS,CAAC,CAAC,EACzB,OAAO,EAAE,CAAC,EACV,OAAO,GAAE,gBAAqB,GAC7B,aAAa,CAAC,CAAC,CAAC,CAkFlB;AA4BD,OAAO,EAAE,UAAU,IAAI,EAAE,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type AtomConfig, type AtomType } from "./atom";
|
|
2
|
+
type TimingFunction = <T extends (...args: any[]) => any>(fn: T, delay: number) => T & {
|
|
3
|
+
cancel: () => void;
|
|
4
|
+
flush?: () => void;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Internal factory used by `debouncedAtom` and `throttledAtom` to create a
|
|
8
|
+
* timing-controlled reactive atom.
|
|
9
|
+
*
|
|
10
|
+
* **When `initialAtomOrState` is a plain value:**
|
|
11
|
+
* A new atom is created with that value. Its `set` and `update` methods are
|
|
12
|
+
* replaced with timing-wrapped versions so every write is gated by `timingFn`.
|
|
13
|
+
*
|
|
14
|
+
* **When `initialAtomOrState` is already an atom (source atom):**
|
|
15
|
+
* A new atom is created that mirrors the source atom's current value. The new
|
|
16
|
+
* atom's `set` and `update` are timing-wrapped, and a subscription to the
|
|
17
|
+
* source atom is established so the derived atom stays in sync whenever the
|
|
18
|
+
* source changes.
|
|
19
|
+
*
|
|
20
|
+
* In both cases, `registerCleanup` is called on the new atom so any pending
|
|
21
|
+
* timer is cancelled automatically when the atom is disposed.
|
|
22
|
+
*
|
|
23
|
+
* @param initialAtomOrState - Either a plain initial value or a source `AtomType<T>` to mirror.
|
|
24
|
+
* @param delay - The timing window in milliseconds passed to `timingFn`.
|
|
25
|
+
* @param timingFn - A timing higher-order function (`debounce` or `throttle`) that
|
|
26
|
+
* wraps a function and returns it decorated with a `.cancel()` method.
|
|
27
|
+
* @param config - Optional atom configuration forwarded to the underlying `atom()` call.
|
|
28
|
+
* @returns A new `AtomType<T>` whose writes are gated by `timingFn`.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // Plain value — writes are debounced/throttled directly:
|
|
32
|
+
* const a = createTimedAtom("", 300, debounce);
|
|
33
|
+
* a.set("hello"); // fires after 300 ms of inactivity
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // Source atom — the new atom mirrors the source with timing applied:
|
|
37
|
+
* const source = atom(0);
|
|
38
|
+
* const timed = createTimedAtom(source, 100, throttle);
|
|
39
|
+
* source.set(42); // timed will reflect 42, but at most once per 100 ms
|
|
40
|
+
*/
|
|
41
|
+
export declare const createTimedAtom: <T>(initialAtomOrState: T | AtomType<T>, delay: number, timingFn: TimingFunction, config?: AtomConfig) => AtomType<T>;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=createTimedAtom.d.ts.map
|