-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(checkpoints): add useCheckpointIds composable
- Loading branch information
1 parent
ec0ce29
commit 1f11096
Showing
10 changed files
with
102 additions
and
16 deletions.
There are no files selected for viewing
21 changes: 17 additions & 4 deletions
21
packages/public/vue-tinybase/src/@types/custom-store/checkpoints/composables.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
import type { UseCheckpointFunction as UseCheckpointFunctionWithSchemas } from './with-schemas/composables.js' | ||
import type { UseCheckpointFunction as UseCheckpointFunctionWithoutSchemas } from './without-schemas/composables.js' | ||
import type { | ||
UseCheckpointFunction as UseCheckpointFunctionWithSchemas, | ||
UseCheckpointIdsFunction as UseCheckpointIdsFunctionWithSchemas, | ||
} from './with-schemas/composables.js' | ||
import type { | ||
UseCheckpointFunction as UseCheckpointFunctionWithoutSchemas, | ||
UseCheckpointIdsFunction as UseCheckpointIdsFunctionWithoutSchemas, | ||
} from './without-schemas/composables.js' | ||
|
||
export type UseCheckpointFunction = UseCheckpointFunctionWithSchemas & UseCheckpointFunctionWithoutSchemas | ||
export type UseCheckpointIdsFunction = UseCheckpointIdsFunctionWithSchemas & UseCheckpointIdsFunctionWithoutSchemas | ||
|
||
export type { UseCheckpointFunction as UseCheckpointFunctionWithSchemas } from './with-schemas/composables.js' | ||
export type { UseCheckpointFunction as UseCheckpointFunctionWithoutSchemas } from './without-schemas/composables.js' | ||
export type { | ||
UseCheckpointFunction as UseCheckpointFunctionWithSchemas, | ||
UseCheckpointIdsFunction as UseCheckpointIdsFunctionWithSchemas, | ||
} from './with-schemas/composables.js' | ||
export type { | ||
UseCheckpointFunction as UseCheckpointFunctionWithoutSchemas, | ||
UseCheckpointIdsFunction as UseCheckpointIdsFunctionWithoutSchemas, | ||
} from './without-schemas/composables.js' |
4 changes: 3 additions & 1 deletion
4
packages/public/vue-tinybase/src/@types/custom-store/checkpoints/with-schemas/composables.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import type { ComputedRef, MaybeRefOrGetter } from '@vue/reactivity' | ||
import type { Checkpoints, Id } from 'tinybase/with-schemas' | ||
import type { Checkpoints, Id, CheckpointIds } from 'tinybase/with-schemas' | ||
|
||
export type UseCheckpointFunction = ( | ||
checkpoints: Checkpoints<any>, | ||
checkpointId: MaybeRefOrGetter<Id>, | ||
) => ComputedRef<string | undefined> | ||
|
||
export type UseCheckpointIdsFunction = (checkpoints: Checkpoints<any>) => ComputedRef<CheckpointIds> |
4 changes: 3 additions & 1 deletion
4
...es/public/vue-tinybase/src/@types/custom-store/checkpoints/without-schemas/composables.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import type { ComputedRef, MaybeRefOrGetter } from '@vue/reactivity' | ||
import type { Checkpoints, Id } from 'tinybase' | ||
import type { CheckpointIds, Checkpoints, Id } from 'tinybase' | ||
|
||
export type UseCheckpointFunction = ( | ||
checkpoints: Checkpoints, | ||
checkpointId: MaybeRefOrGetter<Id>, | ||
) => ComputedRef<string | undefined> | ||
|
||
export type UseCheckpointIdsFunction = (checkpoints: Checkpoints) => ComputedRef<CheckpointIds> |
21 changes: 17 additions & 4 deletions
21
packages/public/vue-tinybase/src/@types/default-store/checkpoints/composables.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
import type { UseCheckpointFunction as UseCheckpointFunctionWithSchemas } from './with-schemas/composables.js' | ||
import type { UseCheckpointFunction as UseCheckpointFunctionWithoutSchemas } from './without-schemas/composables.js' | ||
import type { | ||
UseCheckpointFunction as UseCheckpointFunctionWithSchemas, | ||
UseCheckpointIdsFunction as UseCheckpointIdsFunctionWithSchemas, | ||
} from './with-schemas/composables.js' | ||
import type { | ||
UseCheckpointFunction as UseCheckpointFunctionWithoutSchemas, | ||
UseCheckpointIdsFunction as UseCheckpointIdsFunctionWithoutSchemas, | ||
} from './without-schemas/composables.js' | ||
|
||
export type UseCheckpointFunction = UseCheckpointFunctionWithSchemas & UseCheckpointFunctionWithoutSchemas | ||
export type UseCheckpointIdsFunction = UseCheckpointIdsFunctionWithSchemas & UseCheckpointIdsFunctionWithoutSchemas | ||
|
||
export type { UseCheckpointFunction as UseCheckpointFunctionWithSchemas } from './with-schemas/composables.js' | ||
export type { UseCheckpointFunction as UseCheckpointFunctionWithoutSchemas } from './without-schemas/composables.js' | ||
export type { | ||
UseCheckpointFunction as UseCheckpointFunctionWithSchemas, | ||
UseCheckpointIdsFunction as UseCheckpointIdsFunctionWithSchemas, | ||
} from './with-schemas/composables.js' | ||
export type { | ||
UseCheckpointFunction as UseCheckpointFunctionWithoutSchemas, | ||
UseCheckpointIdsFunction as UseCheckpointIdsFunctionWithoutSchemas, | ||
} from './without-schemas/composables.js' |
4 changes: 3 additions & 1 deletion
4
...ages/public/vue-tinybase/src/@types/default-store/checkpoints/with-schemas/composables.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
import type { ComputedRef, MaybeRefOrGetter } from '@vue/reactivity' | ||
import type { Id } from 'tinybase/with-schemas' | ||
import type { Id, CheckpointIds } from 'tinybase/with-schemas' | ||
|
||
export type UseCheckpointFunction = (checkpointId: MaybeRefOrGetter<Id>) => ComputedRef<string | undefined> | ||
|
||
export type UseCheckpointIdsFunction = () => ComputedRef<CheckpointIds> |
4 changes: 3 additions & 1 deletion
4
...s/public/vue-tinybase/src/@types/default-store/checkpoints/without-schemas/composables.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
import type { ComputedRef, MaybeRefOrGetter } from '@vue/reactivity' | ||
import type { Id } from 'tinybase' | ||
import type { Id, CheckpointIds } from 'tinybase' | ||
|
||
export type UseCheckpointFunction = (checkpointId: MaybeRefOrGetter<Id>) => ComputedRef<string | undefined> | ||
|
||
export type UseCheckpointIdsFunction = () => ComputedRef<CheckpointIds> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
packages/public/vue-tinybase/src/custom-store/checkpoints/composables.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import { ReturnType, useListenable } from '../../common/useListenable.js' | ||
|
||
import type { UseCheckpointFunction } from '../../@types/custom-store/index.js' | ||
import type { UseCheckpointFunction, UseCheckpointIdsFunction } from '../../@types/custom-store/index.js' | ||
import type { MaybeRefOrGetter } from '@vue/reactivity' | ||
import type { Checkpoints, Id } from 'tinybase' | ||
|
||
export const useCheckpoint = ((checkpoints: Checkpoints, checkpointId: MaybeRefOrGetter<Id>) => | ||
useListenable(checkpoints, 'Checkpoint', ReturnType.CellOrValue, [checkpointId])) as UseCheckpointFunction | ||
|
||
export const useCheckpointIds = ((checkpoints: Checkpoints) => | ||
useListenable(checkpoints, 'CheckpointIds', ReturnType.Checkpoints)) as UseCheckpointIdsFunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters