@globalbrain/sefirot 3.19.0 → 3.20.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.
@@ -6,12 +6,12 @@ export interface D<T extends Record<string, any>> {
6
6
  }
7
7
 
8
8
  export function useD<T extends Record<string, any>>(data: T): D<T> {
9
- const initialData = JSON.parse(JSON.stringify(data))
9
+ const initialData = JSON.stringify(data)
10
10
 
11
11
  const refData = ref(data) as Ref<T>
12
12
 
13
13
  function init(): void {
14
- refData.value = initialData
14
+ refData.value = JSON.parse(initialData)
15
15
  }
16
16
 
17
17
  return {
@@ -1,6 +1,6 @@
1
1
  import isEqual from 'lodash-es/isEqual'
2
2
  import isPlainObject from 'lodash-es/isPlainObject'
3
- import { watch } from 'vue'
3
+ import { type MaybeRef, unref, watch } from 'vue'
4
4
  import { useRoute, useRouter } from 'vue-router'
5
5
 
6
6
  export interface UseUrlQuerySyncOptions {
@@ -9,20 +9,25 @@ export interface UseUrlQuerySyncOptions {
9
9
  }
10
10
 
11
11
  export function useUrlQuerySync(
12
- state: Record<string, any>,
12
+ state: MaybeRef<Record<string, any>>,
13
13
  { casts = {}, exclude }: UseUrlQuerySyncOptions = {}
14
14
  ): void {
15
15
  const router = useRouter()
16
16
  const route = useRoute()
17
17
 
18
- const flattenInitialState = flattenObject(JSON.parse(JSON.stringify(state)))
18
+ const flattenInitialState = flattenObject(
19
+ JSON.parse(JSON.stringify(unref(state)))
20
+ )
19
21
 
20
22
  setStateFromQuery()
21
23
 
22
- watch(() => state, setQueryFromState, { deep: true, immediate: true })
24
+ watch(() => unref(state), setQueryFromState, {
25
+ deep: true,
26
+ immediate: true
27
+ })
23
28
 
24
29
  function setStateFromQuery() {
25
- const flattenState = flattenObject(state)
30
+ const flattenState = flattenObject(unref(state))
26
31
  const flattenQuery = flattenObject(route.query)
27
32
 
28
33
  Object.keys(flattenQuery).forEach((key) => {
@@ -39,11 +44,11 @@ export function useUrlQuerySync(
39
44
  flattenState[key] = cast ? cast(value) : value
40
45
  })
41
46
 
42
- deepAssign(state, unflattenObject(flattenState))
47
+ deepAssign(unref(state), unflattenObject(flattenState))
43
48
  }
44
49
 
45
50
  async function setQueryFromState() {
46
- const flattenState = flattenObject(state)
51
+ const flattenState = flattenObject(unref(state))
47
52
  const flattenQuery = flattenObject(route.query)
48
53
 
49
54
  Object.keys(flattenState).forEach((key) => {
@@ -110,7 +115,11 @@ function deepAssign(target: Record<string, any>, source: Record<string, any>) {
110
115
  }
111
116
  }
112
117
 
113
- function deepAssignBase(dest: Record<string, any>, src: Record<string, any>, key: string | number) {
118
+ function deepAssignBase(
119
+ dest: Record<string, any>,
120
+ src: Record<string, any>,
121
+ key: string | number
122
+ ) {
114
123
  if (typeof src[key] === 'object' && src[key] !== null) {
115
124
  deepAssign(dest[key], src[key])
116
125
  } else {
@@ -67,9 +67,9 @@
67
67
  * Spacing
68
68
  * -------------------------------------------------------------------------- */
69
69
 
70
- .m-auto { margin: auto; }
71
- .my-auto { margin-top: auto; margin-bottom: auto; }
72
- .mx-auto { margin-right: auto; margin-left: auto; }
70
+ .s-m-auto { margin: auto; }
71
+ .s-my-auto { margin-top: auto; margin-bottom: auto; }
72
+ .s-mx-auto { margin-right: auto; margin-left: auto; }
73
73
 
74
74
  .s-p-8 { padding: 8px; }
75
75
  .s-p-12 { padding: 12px; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@globalbrain/sefirot",
3
- "version": "3.19.0",
3
+ "version": "3.20.0",
4
4
  "packageManager": "pnpm@8.12.1",
5
5
  "description": "Vue Components for Global Brain Design System.",
6
6
  "author": "Kia Ishii <ka.ishii@globalbrains.com>",