@tanstack/preact-pacer 0.19.0 → 0.19.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PacerProvider.cjs","names":[
|
|
1
|
+
{"version":3,"file":"PacerProvider.cjs","names":[],"sources":["../../src/provider/PacerProvider.tsx"],"sourcesContent":["import { useContext, useMemo } from 'preact/hooks'\nimport { createContext } from 'preact'\nimport type { ComponentChildren } from 'preact'\nimport type {\n AnyAsyncFunction,\n AnyFunction,\n AsyncBatcherOptions,\n AsyncDebouncerOptions,\n AsyncQueuerOptions,\n AsyncRateLimiterOptions,\n AsyncThrottlerOptions,\n BatcherOptions,\n DebouncerOptions,\n QueuerOptions,\n RateLimiterOptions,\n ThrottlerOptions,\n} from '@tanstack/pacer'\n\nexport interface PacerProviderOptions {\n asyncBatcher?: Partial<AsyncBatcherOptions<any>>\n asyncDebouncer?: Partial<AsyncDebouncerOptions<AnyAsyncFunction>>\n asyncQueuer?: Partial<AsyncQueuerOptions<any>>\n asyncRateLimiter?: Partial<AsyncRateLimiterOptions<AnyAsyncFunction>>\n asyncThrottler?: Partial<AsyncThrottlerOptions<AnyAsyncFunction>>\n batcher?: Partial<BatcherOptions<any>>\n debouncer?: Partial<DebouncerOptions<AnyFunction>>\n queuer?: Partial<QueuerOptions<any>>\n rateLimiter?: Partial<RateLimiterOptions<AnyFunction>>\n throttler?: Partial<ThrottlerOptions<AnyFunction>>\n}\n\ninterface PacerContextValue {\n defaultOptions: PacerProviderOptions\n}\n\nconst PacerContext = createContext<PacerContextValue | null>(null)\n\nexport interface PacerProviderProps {\n children: ComponentChildren\n defaultOptions?: PacerProviderOptions\n}\n\nconst DEFAULT_OPTIONS: PacerProviderOptions = {}\n\nexport function PacerProvider({\n children,\n defaultOptions = DEFAULT_OPTIONS,\n}: PacerProviderProps) {\n const contextValue: PacerContextValue = useMemo(\n () => ({\n defaultOptions,\n }),\n [defaultOptions],\n )\n\n return (\n <PacerContext.Provider value={contextValue}>\n {children}\n </PacerContext.Provider>\n )\n}\n\nexport function usePacerContext() {\n return useContext(PacerContext)\n}\n\nexport function useDefaultPacerOptions() {\n const context = useContext(PacerContext)\n return context?.defaultOptions ?? {}\n}\n"],"mappings":";;;;;AAmCA,MAAM,yCAAuD,KAAK;AAOlE,MAAM,kBAAwC,EAAE;AAEhD,SAAgB,cAAc,EAC5B,UACA,iBAAiB,mBACI;CACrB,MAAM,gDACG,EACL,gBACD,GACD,CAAC,eAAe,CACjB;AAED,QACE,4CAAC,aAAa;EAAS,OAAO;EAC3B;GACqB;;AAI5B,SAAgB,kBAAkB;AAChC,qCAAkB,aAAa;;AAGjC,SAAgB,yBAAyB;AAEvC,qCAD2B,aAAa,EACxB,kBAAkB,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PacerProvider.js","names":[
|
|
1
|
+
{"version":3,"file":"PacerProvider.js","names":[],"sources":["../../src/provider/PacerProvider.tsx"],"sourcesContent":["import { useContext, useMemo } from 'preact/hooks'\nimport { createContext } from 'preact'\nimport type { ComponentChildren } from 'preact'\nimport type {\n AnyAsyncFunction,\n AnyFunction,\n AsyncBatcherOptions,\n AsyncDebouncerOptions,\n AsyncQueuerOptions,\n AsyncRateLimiterOptions,\n AsyncThrottlerOptions,\n BatcherOptions,\n DebouncerOptions,\n QueuerOptions,\n RateLimiterOptions,\n ThrottlerOptions,\n} from '@tanstack/pacer'\n\nexport interface PacerProviderOptions {\n asyncBatcher?: Partial<AsyncBatcherOptions<any>>\n asyncDebouncer?: Partial<AsyncDebouncerOptions<AnyAsyncFunction>>\n asyncQueuer?: Partial<AsyncQueuerOptions<any>>\n asyncRateLimiter?: Partial<AsyncRateLimiterOptions<AnyAsyncFunction>>\n asyncThrottler?: Partial<AsyncThrottlerOptions<AnyAsyncFunction>>\n batcher?: Partial<BatcherOptions<any>>\n debouncer?: Partial<DebouncerOptions<AnyFunction>>\n queuer?: Partial<QueuerOptions<any>>\n rateLimiter?: Partial<RateLimiterOptions<AnyFunction>>\n throttler?: Partial<ThrottlerOptions<AnyFunction>>\n}\n\ninterface PacerContextValue {\n defaultOptions: PacerProviderOptions\n}\n\nconst PacerContext = createContext<PacerContextValue | null>(null)\n\nexport interface PacerProviderProps {\n children: ComponentChildren\n defaultOptions?: PacerProviderOptions\n}\n\nconst DEFAULT_OPTIONS: PacerProviderOptions = {}\n\nexport function PacerProvider({\n children,\n defaultOptions = DEFAULT_OPTIONS,\n}: PacerProviderProps) {\n const contextValue: PacerContextValue = useMemo(\n () => ({\n defaultOptions,\n }),\n [defaultOptions],\n )\n\n return (\n <PacerContext.Provider value={contextValue}>\n {children}\n </PacerContext.Provider>\n )\n}\n\nexport function usePacerContext() {\n return useContext(PacerContext)\n}\n\nexport function useDefaultPacerOptions() {\n const context = useContext(PacerContext)\n return context?.defaultOptions ?? {}\n}\n"],"mappings":";;;;;AAmCA,MAAM,eAAe,cAAwC,KAAK;AAOlE,MAAM,kBAAwC,EAAE;AAEhD,SAAgB,cAAc,EAC5B,UACA,iBAAiB,mBACI;CACrB,MAAM,eAAkC,eAC/B,EACL,gBACD,GACD,CAAC,eAAe,CACjB;AAED,QACE,oBAAC,aAAa;EAAS,OAAO;EAC3B;GACqB;;AAI5B,SAAgB,kBAAkB;AAChC,QAAO,WAAW,aAAa;;AAGjC,SAAgB,yBAAyB;AAEvC,QADgB,WAAW,aAAa,EACxB,kBAAkB,EAAE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/preact-pacer",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.2",
|
|
4
4
|
"description": "Utilities for debouncing and throttling functions in Preact.",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -99,12 +99,12 @@
|
|
|
99
99
|
],
|
|
100
100
|
"dependencies": {
|
|
101
101
|
"@tanstack/preact-store": "^0.10.1",
|
|
102
|
-
"@tanstack/pacer": "0.17.
|
|
102
|
+
"@tanstack/pacer": "0.17.2"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@preact/preset-vite": "^2.10.2",
|
|
106
106
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
107
|
-
"preact": "^10.28.
|
|
107
|
+
"preact": "^10.28.2"
|
|
108
108
|
},
|
|
109
109
|
"peerDependencies": {
|
|
110
110
|
"preact": ">=10.0.0"
|