@tarragon-ui/js 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ajax-form.d.ts +2 -0
- package/dist/components/ajax-form.d.ts.map +1 -0
- package/dist/components/ajax-html.d.ts +2 -0
- package/dist/components/ajax-html.d.ts.map +1 -0
- package/dist/components/dropdown.d.ts +2 -0
- package/dist/components/dropdown.d.ts.map +1 -0
- package/dist/components/exclusive-checkbox.d.ts +2 -0
- package/dist/components/exclusive-checkbox.d.ts.map +1 -0
- package/dist/components/select-all.d.ts +2 -0
- package/dist/components/select-all.d.ts.map +1 -0
- package/dist/components/until-selected.d.ts +2 -0
- package/dist/components/until-selected.d.ts.map +1 -0
- package/dist/components/validate-form.d.ts +2 -0
- package/dist/components/validate-form.d.ts.map +1 -0
- package/dist/constants.d.ts +95 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/emitEvent.d.ts +2 -0
- package/dist/emitEvent.d.ts.map +1 -0
- package/dist/fetch.d.ts +42 -0
- package/dist/fetch.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1176 -0
- package/dist/query-cache.d.ts +57 -0
- package/dist/query-cache.d.ts.map +1 -0
- package/package.json +46 -0
- package/readme.md +3 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { FetchSuccess } from './fetch';
|
|
2
|
+
type QueryData = FetchSuccess | undefined;
|
|
3
|
+
type QueryMeta = {
|
|
4
|
+
staleTime: number;
|
|
5
|
+
};
|
|
6
|
+
export type QueryResult = {
|
|
7
|
+
data: QueryData;
|
|
8
|
+
isFetching: boolean;
|
|
9
|
+
error: string | null;
|
|
10
|
+
meta: QueryMeta;
|
|
11
|
+
};
|
|
12
|
+
type SubscriberCallback = (result: QueryResult) => void;
|
|
13
|
+
declare class QueryCache {
|
|
14
|
+
private static instance;
|
|
15
|
+
private cache;
|
|
16
|
+
private subscriptions;
|
|
17
|
+
private refetchIntervals;
|
|
18
|
+
static getInstance(): QueryCache;
|
|
19
|
+
private updateQueryState;
|
|
20
|
+
private notifySubscribers;
|
|
21
|
+
private manageRefetchInterval;
|
|
22
|
+
/**
|
|
23
|
+
* Subscribes to a query key.
|
|
24
|
+
* @param key The query key.
|
|
25
|
+
* @param callback The function to call when the query's data or state updates.
|
|
26
|
+
* @param options Query options that might affect initial state or refetch behavior.
|
|
27
|
+
* @returns An unsubscribe function.
|
|
28
|
+
*/
|
|
29
|
+
subscribe(key: string, callback: SubscriberCallback, meta?: Partial<QueryMeta>): () => void;
|
|
30
|
+
/**
|
|
31
|
+
* Gets the current state of a query.
|
|
32
|
+
* @param key The query key.
|
|
33
|
+
* @returns The current QueryResult, or undefined if not initialized.
|
|
34
|
+
*/
|
|
35
|
+
get(key: string): QueryResult | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Sets the data for a query key and notifies subscribers.
|
|
38
|
+
* This is used for pushing data without fetching (e.g., from mutations/forms).
|
|
39
|
+
* @param key The query key.
|
|
40
|
+
* @param data The data to set.
|
|
41
|
+
* @param options Options for this query.
|
|
42
|
+
*/
|
|
43
|
+
setQueryData(key: string, data: QueryData, meta?: Partial<QueryMeta>): void;
|
|
44
|
+
/**
|
|
45
|
+
* Fetches data for a query key. This is an internal method called by subscribe/invalidate.
|
|
46
|
+
* It ensures only one fetch is active at a time for a given key.
|
|
47
|
+
*/
|
|
48
|
+
private fetchQuery;
|
|
49
|
+
/**
|
|
50
|
+
* Invalidates a query, triggering an immediate refetch
|
|
51
|
+
* @param key The query key.
|
|
52
|
+
*/
|
|
53
|
+
invalidateQuery(key: string): void;
|
|
54
|
+
}
|
|
55
|
+
export declare const queryCache: QueryCache;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=query-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-cache.d.ts","sourceRoot":"","sources":["../src/query-cache.ts"],"names":[],"mappings":"AAA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|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Lightweight and simple Web Components for Tarragon UI.",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"invokers-polyfill": "^0.5.7"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"typescript": "^5.9.3",
|
|
17
|
+
"vite": "^7.1.9",
|
|
18
|
+
"vite-plugin-dts": "^4.5.4"
|
|
19
|
+
},
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"require": "./dist/index.js",
|
|
25
|
+
"default": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./package.json": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"tarragon",
|
|
31
|
+
"ui",
|
|
32
|
+
"js",
|
|
33
|
+
"design-system"
|
|
34
|
+
],
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "vite build",
|
|
40
|
+
"clean": "rm -rf dist",
|
|
41
|
+
"prebuild": "pnpm clean",
|
|
42
|
+
"lint": "eslint . --max-warnings 0 --config ../../eslint.config.mts",
|
|
43
|
+
"lint:fix": "prettier . --write && eslint . --fix --config ../../eslint.config.mts",
|
|
44
|
+
"type-check": "tsc --noEmit --composite false --project tsconfig.json"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/readme.md
ADDED