@hashrytech/quick-components-kit 0.13.0 → 0.13.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @hashrytech/quick-components-kit
|
|
2
2
|
|
|
3
|
+
## 0.13.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- patch: Adding an object level fetch to the ApiClient class
|
|
8
|
+
|
|
9
|
+
## 0.13.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- fix for export tab navigation
|
|
14
|
+
|
|
3
15
|
## 0.13.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -20,24 +20,6 @@
|
|
|
20
20
|
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
|
-
<!--
|
|
24
|
-
<button class={twMerge("p-2 rounded focus:outline-none focus:ring-2 focus:ring-focus-primary cursor-pointer w-fit", props.class)} aria-label={ariaLabel} {onclick}>
|
|
25
|
-
<div class="space-y-2">
|
|
26
|
-
{#each Array(numberOfLines) as _}
|
|
27
|
-
<span class={twMerge("block w-7 h-0.5 bg-button-primary", linesClasses)}></span>
|
|
28
|
-
{/each}
|
|
29
|
-
</div>
|
|
30
|
-
</button>
|
|
31
|
-
|
|
32
|
-
<button class={twMerge("p-2 rounded focus:outline-none focus:ring-2 focus:ring-focus-primary cursor-pointer w-fit", props.class)} aria-label={ariaLabel} {onclick}>
|
|
33
|
-
<div class="relative w-7 h-7">
|
|
34
|
-
<span class={twMerge("absolute left-0 top-1.5 w-full h-0.5 bg-button-primary transition-all duration-300", open ? "rotate-45 top-3.5" : "")}></span>
|
|
35
|
-
<span class={twMerge("absolute left-0 top-3.5 w-full h-0.5 bg-button-primary transition-all duration-300", open ? "opacity-0" : "opacity-100")}></span>
|
|
36
|
-
<span class={twMerge("absolute left-0 bottom-1 w-full h-0.5 bg-button-primary transition-all duration-300", open ? "-rotate-45 top-3.5" : "")}></span>
|
|
37
|
-
</div>
|
|
38
|
-
</button>
|
|
39
|
-
-->
|
|
40
|
-
|
|
41
23
|
<button aria-label={ariaLabel} class={twMerge("px-1 py-0.5 rounded focus:outline-none focus:ring-2 focus:ring-focus-primary cursor-pointer w-fit", props.class)} {onclick}>
|
|
42
24
|
<div class={twMerge("flex flex-col items-center justify-center size-7 transition-all gap-2", linesParentClasses)}>
|
|
43
25
|
<!-- Top bar -->
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './components/modal/index.js';
|
|
|
7
7
|
export * from './components/overlay/index.js';
|
|
8
8
|
export * from './components/radio/index.js';
|
|
9
9
|
export * from './components/checkbox/index.js';
|
|
10
|
+
export * from './components/tab-navigation/index.js';
|
|
10
11
|
export * from './actions/disable-scroll.js';
|
|
11
12
|
export * from './actions/on-keydown.js';
|
|
12
13
|
export * from './actions/lock-scroll.js';
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export * from './components/modal/index.js';
|
|
|
9
9
|
export * from './components/overlay/index.js';
|
|
10
10
|
export * from './components/radio/index.js';
|
|
11
11
|
export * from './components/checkbox/index.js';
|
|
12
|
+
export * from './components/tab-navigation/index.js';
|
|
12
13
|
export * from './actions/disable-scroll.js';
|
|
13
14
|
export * from './actions/on-keydown.js';
|
|
14
15
|
export * from './actions/lock-scroll.js';
|
|
@@ -81,6 +81,7 @@ export declare class ApiClient {
|
|
|
81
81
|
private defaultHeaders;
|
|
82
82
|
private clientAuthToken;
|
|
83
83
|
private getAccessTokenFromStore;
|
|
84
|
+
private fetchInstance?;
|
|
84
85
|
private requestInterceptors;
|
|
85
86
|
private responseInterceptors;
|
|
86
87
|
private errorHandlers;
|
|
@@ -98,6 +99,12 @@ export declare class ApiClient {
|
|
|
98
99
|
* @param token - The access token string, or undefined to clear it.
|
|
99
100
|
*/
|
|
100
101
|
setAuthToken(token: string | undefined): void;
|
|
102
|
+
/**
|
|
103
|
+
* Sets a custom fetch implementation globally for all requests made by this client.
|
|
104
|
+
* Useful for passing enhanced `fetch` from SvelteKit's load functions.
|
|
105
|
+
* @param fetchFn - The fetch function to use.
|
|
106
|
+
*/
|
|
107
|
+
setFetchInstance(fetchFn: typeof fetch): void;
|
|
101
108
|
/**
|
|
102
109
|
* Adds a request interceptor. Interceptors can modify the `Request` object before it's sent.
|
|
103
110
|
* @param interceptor - A function that takes a `Request` object and returns a `Request` or a Promise resolving to a `Request`.
|
|
@@ -34,6 +34,7 @@ export class ApiClient {
|
|
|
34
34
|
// otherwise relies on getAccessTokenFromStore or SvelteKit's `handleFetch`.
|
|
35
35
|
clientAuthToken;
|
|
36
36
|
getAccessTokenFromStore;
|
|
37
|
+
fetchInstance;
|
|
37
38
|
requestInterceptors = [];
|
|
38
39
|
responseInterceptors = [];
|
|
39
40
|
errorHandlers = [];
|
|
@@ -55,6 +56,14 @@ export class ApiClient {
|
|
|
55
56
|
setAuthToken(token) {
|
|
56
57
|
this.clientAuthToken = token;
|
|
57
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Sets a custom fetch implementation globally for all requests made by this client.
|
|
61
|
+
* Useful for passing enhanced `fetch` from SvelteKit's load functions.
|
|
62
|
+
* @param fetchFn - The fetch function to use.
|
|
63
|
+
*/
|
|
64
|
+
setFetchInstance(fetchFn) {
|
|
65
|
+
this.fetchInstance = fetchFn;
|
|
66
|
+
}
|
|
58
67
|
/**
|
|
59
68
|
* Adds a request interceptor. Interceptors can modify the `Request` object before it's sent.
|
|
60
69
|
* @param interceptor - A function that takes a `Request` object and returns a `Request` or a Promise resolving to a `Request`.
|
|
@@ -220,7 +229,7 @@ export class ApiClient {
|
|
|
220
229
|
* @template T - Expected type of the response data.
|
|
221
230
|
*/
|
|
222
231
|
async request(endpoint, method, body, options = {}) {
|
|
223
|
-
const currentFetch = options.fetchInstance || fetch;
|
|
232
|
+
const currentFetch = options.fetchInstance || this.fetchInstance || fetch; // Use provided fetch first then the class instance fetch or the global fetch if not specified.
|
|
224
233
|
try {
|
|
225
234
|
const request = await this.processRequest(endpoint, method, body, options);
|
|
226
235
|
const response = await currentFetch(request);
|