From 9165be5e1c117f67f5d8866bd76c72bbdca30fdd Mon Sep 17 00:00:00 2001 From: productdevbook Date: Fri, 12 May 2023 08:45:07 +0300 Subject: [PATCH 1/3] core: one package use-composable --- packages/components/avatar/package.json | 2 +- packages/components/avatar/src/avatar.ts | 2 +- packages/components/checkbox/package.json | 5 +- packages/components/checkbox/src/checkbox.ts | 14 ++-- .../checkbox/src/stories/CheckboxDemo.vue | 3 +- .../label/src/stories/LabelDemo.vue | 2 +- packages/core/compose-refs/README.md | 10 --- packages/core/compose-refs/src/index.ts | 1 - packages/core/use-callback-ref/README.md | 11 --- packages/core/use-callback-ref/package.json | 40 ---------- packages/core/use-callback-ref/src/index.ts | 1 - packages/core/use-callback-ref/tsconfig.json | 9 --- .../README.md | 0 .../package.json | 12 +-- packages/core/use-composable/src/index.ts | 5 ++ .../src/useCallbackRef.ts | 0 .../src/useComposedRefs.ts} | 0 .../src/useControllableRef.ts} | 4 +- .../src/usePrevious.ts} | 0 .../src/useSize.ts} | 0 .../tsconfig.json | 0 packages/core/use-composable/tsup.config.ts | 18 +++++ .../core/use-controllable-ref/package.json | 43 ----------- .../core/use-controllable-ref/src/index.ts | 1 - .../core/use-controllable-ref/tsconfig.json | 9 --- packages/core/use-previous/README.md | 10 --- packages/core/use-previous/package.json | 40 ---------- packages/core/use-previous/src/index.ts | 1 - packages/core/use-previous/tsconfig.json | 9 --- packages/core/use-size/README.md | 10 --- packages/core/use-size/package.json | 41 ---------- packages/core/use-size/src/index.ts | 1 - packages/core/use-size/tsconfig.json | 9 --- pnpm-lock.yaml | 76 ++----------------- 34 files changed, 52 insertions(+), 337 deletions(-) delete mode 100644 packages/core/compose-refs/README.md delete mode 100644 packages/core/compose-refs/src/index.ts delete mode 100644 packages/core/use-callback-ref/README.md delete mode 100644 packages/core/use-callback-ref/package.json delete mode 100644 packages/core/use-callback-ref/src/index.ts delete mode 100644 packages/core/use-callback-ref/tsconfig.json rename packages/core/{use-controllable-ref => use-composable}/README.md (100%) rename packages/core/{compose-refs => use-composable}/package.json (77%) create mode 100644 packages/core/use-composable/src/index.ts rename packages/core/{use-callback-ref => use-composable}/src/useCallbackRef.ts (100%) rename packages/core/{compose-refs/src/compose-refs.ts => use-composable/src/useComposedRefs.ts} (100%) rename packages/core/{use-controllable-ref/src/use-controllable-ref.ts => use-composable/src/useControllableRef.ts} (95%) rename packages/core/{use-previous/src/use-previous.ts => use-composable/src/usePrevious.ts} (100%) rename packages/core/{use-size/src/use-size.ts => use-composable/src/useSize.ts} (100%) rename packages/core/{compose-refs => use-composable}/tsconfig.json (100%) create mode 100644 packages/core/use-composable/tsup.config.ts delete mode 100644 packages/core/use-controllable-ref/package.json delete mode 100644 packages/core/use-controllable-ref/src/index.ts delete mode 100644 packages/core/use-controllable-ref/tsconfig.json delete mode 100644 packages/core/use-previous/README.md delete mode 100644 packages/core/use-previous/package.json delete mode 100644 packages/core/use-previous/src/index.ts delete mode 100644 packages/core/use-previous/tsconfig.json delete mode 100644 packages/core/use-size/README.md delete mode 100644 packages/core/use-size/package.json delete mode 100644 packages/core/use-size/src/index.ts delete mode 100644 packages/core/use-size/tsconfig.json diff --git a/packages/components/avatar/package.json b/packages/components/avatar/package.json index ed7915019..420a6ffe6 100644 --- a/packages/components/avatar/package.json +++ b/packages/components/avatar/package.json @@ -35,7 +35,7 @@ "dependencies": { "@oku-ui/primitive": "workspace:^", "@oku-ui/provide": "workspace:^", - "@oku-ui/use-callback-ref": "workspace:^", + "@oku-ui/use-composable": "workspace:^", "@oku-ui/utils": "workspace:^" }, "devDependencies": { diff --git a/packages/components/avatar/src/avatar.ts b/packages/components/avatar/src/avatar.ts index 7a06bb472..d059e81bf 100644 --- a/packages/components/avatar/src/avatar.ts +++ b/packages/components/avatar/src/avatar.ts @@ -4,7 +4,7 @@ import type { ElementType, MergeProps, PrimitiveProps, RefElement } from '@oku-u import { Primitive } from '@oku-ui/primitive' import type { Scope } from '@oku-ui/provide' import { createProvideScope } from '@oku-ui/provide' -import { useCallbackRef } from '@oku-ui/use-callback-ref' +import { useCallbackRef } from '@oku-ui/use-composable' function useImageLoadingStatus(src?: string) { const loadingStatus = ref('idle') diff --git a/packages/components/checkbox/package.json b/packages/components/checkbox/package.json index 51b4f48bd..c090d7089 100644 --- a/packages/components/checkbox/package.json +++ b/packages/components/checkbox/package.json @@ -33,12 +33,9 @@ "vue": "^3.3.1" }, "dependencies": { - "@oku-ui/compose-refs": "workspace:^", "@oku-ui/primitive": "workspace:^", "@oku-ui/provide": "workspace:^", - "@oku-ui/use-controllable-ref": "workspace:^", - "@oku-ui/use-previous": "workspace:^", - "@oku-ui/use-size": "workspace:^", + "@oku-ui/use-composable": "workspace:^", "@oku-ui/utils": "workspace:^" }, "devDependencies": { diff --git a/packages/components/checkbox/src/checkbox.ts b/packages/components/checkbox/src/checkbox.ts index d9900aa2c..094b1e834 100644 --- a/packages/components/checkbox/src/checkbox.ts +++ b/packages/components/checkbox/src/checkbox.ts @@ -2,10 +2,8 @@ import { createProvideScope } from '@oku-ui/provide' import type { PropType, Ref } from 'vue' import { Transition, computed, defineComponent, h, onMounted, ref, watchEffect } from 'vue' -import { useControllableRef } from '@oku-ui/use-controllable-ref' import { composeEventHandlers } from '@oku-ui/utils' -import { usePrevious } from '@oku-ui/use-previous' -import { useSize } from '@oku-ui/use-size' +import { useControllableRef, usePrevious, useSize } from '@oku-ui/use-composable' import { Primitive } from '@oku-ui/primitive' // import { useComposedRefs } from '@oku-ui/compose-refs' @@ -216,8 +214,10 @@ const Checkbox = defineComponent({ } }), }, - slots.default?.(), - ), isFormControl && h( + { + default: () => slots.default?.(), + }), + isFormControl && h( BubbleInput, { control: _button.value, @@ -277,7 +277,9 @@ const CheckboxIndicator = defineComponent({ ...indicatorProps, 'style': { pointerEvents: 'none', ...attrs.style as any }, }, - slots.default?.(), + { + default: () => slots.default?.(), + }, ) : null, ]) diff --git a/packages/components/checkbox/src/stories/CheckboxDemo.vue b/packages/components/checkbox/src/stories/CheckboxDemo.vue index 0c4bd195b..efd960e52 100644 --- a/packages/components/checkbox/src/stories/CheckboxDemo.vue +++ b/packages/components/checkbox/src/stories/CheckboxDemo.vue @@ -2,6 +2,7 @@