seitu 0.10.1 → 0.10.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/README.md +3 -2
- package/dist/react/components.d.ts +6 -4
- package/dist/react/hooks.d.ts +11 -8
- package/dist/vue/composables.d.ts +8 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,10 +15,11 @@ To quick start you only need to write the following code:
|
|
|
15
15
|
|
|
16
16
|
```tsx
|
|
17
17
|
import { useSubscription } from 'seitu/react'
|
|
18
|
-
import {
|
|
18
|
+
import { createWebStorageValue } from 'seitu/web'
|
|
19
19
|
import * as z from 'zod'
|
|
20
20
|
|
|
21
|
-
const value =
|
|
21
|
+
const value = createWebStorageValue({
|
|
22
|
+
type: 'sessionStorage',
|
|
22
23
|
key: 'test',
|
|
23
24
|
defaultValue: 0,
|
|
24
25
|
schema: z.number(),
|
|
@@ -13,11 +13,12 @@ export interface SubscriptionProps<S extends Subscribable<any> & Readable<any>,
|
|
|
13
13
|
* ```tsx twoslash title="/app/page.tsx"
|
|
14
14
|
* 'use client'
|
|
15
15
|
*
|
|
16
|
-
* import {
|
|
16
|
+
* import { createWebStorage } from 'seitu/web'
|
|
17
17
|
* import { Subscription } from 'seitu/react'
|
|
18
18
|
* import * as z from 'zod'
|
|
19
19
|
*
|
|
20
|
-
* const sessionStorage =
|
|
20
|
+
* const sessionStorage = createWebStorage({
|
|
21
|
+
* type: 'sessionStorage',
|
|
21
22
|
* schemas: { count: z.number(), name: z.string() },
|
|
22
23
|
* defaultValues: { count: 0, name: '' },
|
|
23
24
|
* })
|
|
@@ -35,11 +36,12 @@ export interface SubscriptionProps<S extends Subscribable<any> & Readable<any>,
|
|
|
35
36
|
* ```tsx twoslash title="/app/page.tsx"
|
|
36
37
|
* 'use client'
|
|
37
38
|
*
|
|
38
|
-
* import {
|
|
39
|
+
* import { createWebStorage } from 'seitu/web'
|
|
39
40
|
* import { Subscription } from 'seitu/react'
|
|
40
41
|
* import * as z from 'zod'
|
|
41
42
|
*
|
|
42
|
-
* const sessionStorage =
|
|
43
|
+
* const sessionStorage = createWebStorage({
|
|
44
|
+
* type: 'sessionStorage',
|
|
43
45
|
* schemas: { count: z.number(), name: z.string() },
|
|
44
46
|
* defaultValues: { count: 0, name: '' },
|
|
45
47
|
* })
|
package/dist/react/hooks.d.ts
CHANGED
|
@@ -13,12 +13,13 @@ export interface UseSubscriptionOptions<S extends Subscribable<any> & Readable<a
|
|
|
13
13
|
* ```tsx twoslash title="/app/page.tsx"
|
|
14
14
|
* 'use client'
|
|
15
15
|
*
|
|
16
|
-
* import {
|
|
16
|
+
* import { createWebStorageValue } from 'seitu/web'
|
|
17
17
|
* import { useSubscription } from 'seitu/react'
|
|
18
18
|
* import * as z from 'zod'
|
|
19
19
|
*
|
|
20
20
|
* export default function Page() {
|
|
21
|
-
* const value = useSubscription(() =>
|
|
21
|
+
* const value = useSubscription(() => createWebStorageValue({
|
|
22
|
+
* type: 'sessionStorage',
|
|
22
23
|
* key: 'test',
|
|
23
24
|
* defaultValue: 0,
|
|
24
25
|
* schema: z.number(),
|
|
@@ -32,11 +33,12 @@ export interface UseSubscriptionOptions<S extends Subscribable<any> & Readable<a
|
|
|
32
33
|
* ```tsx twoslash title="/app/page.tsx"
|
|
33
34
|
* 'use client'
|
|
34
35
|
*
|
|
35
|
-
* import {
|
|
36
|
+
* import { createWebStorage } from 'seitu/web'
|
|
36
37
|
* import { useSubscription } from 'seitu/react'
|
|
37
38
|
* import * as z from 'zod'
|
|
38
39
|
*
|
|
39
|
-
* const sessionStorage =
|
|
40
|
+
* const sessionStorage = createWebStorage({
|
|
41
|
+
* type: 'sessionStorage',
|
|
40
42
|
* schemas: { count: z.number(), name: z.string() },
|
|
41
43
|
* defaultValues: { count: 0, name: '' },
|
|
42
44
|
* })
|
|
@@ -51,11 +53,12 @@ export interface UseSubscriptionOptions<S extends Subscribable<any> & Readable<a
|
|
|
51
53
|
* ```tsx twoslash title="/app/page.tsx"
|
|
52
54
|
* 'use client'
|
|
53
55
|
*
|
|
54
|
-
* import {
|
|
56
|
+
* import { createWebStorage } from 'seitu/web'
|
|
55
57
|
* import { useSubscription } from 'seitu/react'
|
|
56
58
|
* import * as z from 'zod'
|
|
57
59
|
*
|
|
58
|
-
* const sessionStorage =
|
|
60
|
+
* const sessionStorage = createWebStorage({
|
|
61
|
+
* type: 'sessionStorage',
|
|
59
62
|
* schemas: {
|
|
60
63
|
* count: z.number(),
|
|
61
64
|
* name: z.string(),
|
|
@@ -76,12 +79,12 @@ export interface UseSubscriptionOptions<S extends Subscribable<any> & Readable<a
|
|
|
76
79
|
* 'use client'
|
|
77
80
|
*
|
|
78
81
|
* import * as React from 'react'
|
|
79
|
-
* import {
|
|
82
|
+
* import { createWebStorage } from 'seitu/web'
|
|
80
83
|
* import { useSubscription } from 'seitu/react'
|
|
81
84
|
*
|
|
82
85
|
* export default function Page() {
|
|
83
86
|
* const ref = React.useRef<HTMLDivElement>(null)
|
|
84
|
-
* const state = useSubscription(() =>
|
|
87
|
+
* const state = useSubscription(() => createWebStorage({ type: 'scrollState', element: () => ref.current, direction: 'vertical' }))
|
|
85
88
|
*
|
|
86
89
|
* return (
|
|
87
90
|
* <div ref={ref}>
|
|
@@ -10,12 +10,12 @@ export interface UseSubscriptionOptions<S extends Subscribable<any> & Readable<a
|
|
|
10
10
|
* @example Inline subscription
|
|
11
11
|
* ```vue
|
|
12
12
|
* <script setup lang="ts">
|
|
13
|
-
* import {
|
|
13
|
+
* import { createWebStorageValue } from 'seitu/web'
|
|
14
14
|
* import { useSubscription } from 'seitu/vue'
|
|
15
15
|
* import * as z from 'zod'
|
|
16
16
|
*
|
|
17
17
|
* const value = useSubscription(
|
|
18
|
-
*
|
|
18
|
+
* createWebStorageValue({ type: 'sessionStorage', key: 'test', defaultValue: 0, schema: z.number() }),
|
|
19
19
|
* )
|
|
20
20
|
* </script>
|
|
21
21
|
*
|
|
@@ -27,11 +27,12 @@ export interface UseSubscriptionOptions<S extends Subscribable<any> & Readable<a
|
|
|
27
27
|
* @example Instance outside of the subscription
|
|
28
28
|
* ```vue
|
|
29
29
|
* <script setup lang="ts">
|
|
30
|
-
* import {
|
|
30
|
+
* import { createWebStorage } from 'seitu/web'
|
|
31
31
|
* import { useSubscription } from 'seitu/vue'
|
|
32
32
|
* import * as z from 'zod'
|
|
33
33
|
*
|
|
34
|
-
* const sessionStorage =
|
|
34
|
+
* const sessionStorage = createWebStorage({
|
|
35
|
+
* type: 'sessionStorage',
|
|
35
36
|
* schemas: { count: z.number(), name: z.string() },
|
|
36
37
|
* defaultValues: { count: 0, name: '' },
|
|
37
38
|
* })
|
|
@@ -47,11 +48,12 @@ export interface UseSubscriptionOptions<S extends Subscribable<any> & Readable<a
|
|
|
47
48
|
* @example With selector
|
|
48
49
|
* ```vue
|
|
49
50
|
* <script setup lang="ts">
|
|
50
|
-
* import {
|
|
51
|
+
* import { createWebStorage } from 'seitu/web'
|
|
51
52
|
* import { useSubscription } from 'seitu/vue'
|
|
52
53
|
* import * as z from 'zod'
|
|
53
54
|
*
|
|
54
|
-
* const sessionStorage =
|
|
55
|
+
* const sessionStorage = createWebStorage({
|
|
56
|
+
* type: 'sessionStorage',
|
|
55
57
|
* schemas: { count: z.number(), name: z.string() },
|
|
56
58
|
* defaultValues: { count: 0, name: '' },
|
|
57
59
|
* })
|