@luanlu/mk-motion 1.0.0 → 1.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luanlu/mk-motion",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "A lightweight, modern frontend animation library",
5
5
  "type": "module",
6
6
  "main": "./dist/mk-motion.umd.cjs",
@@ -17,10 +17,17 @@
17
17
  "default": "./dist/mk-motion.umd.cjs"
18
18
  }
19
19
  },
20
- "./css": "./dist/style.css"
20
+ "./css": "./dist/style.css",
21
+ "./vue": {
22
+ "import": {
23
+ "types": "./src/vue/index.ts",
24
+ "default": "./src/vue/index.ts"
25
+ }
26
+ }
21
27
  },
22
28
  "files": [
23
- "dist"
29
+ "dist",
30
+ "src/vue"
24
31
  ],
25
32
  "publishConfig": {
26
33
  "access": "public"
@@ -49,9 +56,13 @@
49
56
  "url": "https://github.com/luanluuu/mk-motion/issues"
50
57
  },
51
58
  "homepage": "https://github.com/luanluuu/mk-motion#readme",
59
+ "peerDependencies": {
60
+ "vue": "^3.0.0"
61
+ },
52
62
  "devDependencies": {
53
63
  "typescript": "^5.4.0",
54
64
  "vite": "^5.2.0",
55
- "vite-plugin-dts": "^3.8.0"
65
+ "vite-plugin-dts": "^3.8.0",
66
+ "vue": "^3.5.0"
56
67
  }
57
68
  }
@@ -0,0 +1,32 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createAlert } from '../components/alert/alert.js'
3
+ import type { AlertOptions } from '../components/alert/alert.js'
4
+
5
+ export const MkAlert = defineComponent({
6
+ name: 'MkAlert',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createAlert> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createAlert(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ onUnmounted(() => instance?.destroy())
29
+
30
+ return () => h('div', { ref: container })
31
+ },
32
+ })
@@ -0,0 +1,34 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createAvatar } from '../components/avatar/avatar.js'
3
+ import type { AvatarOptions } from '../components/avatar/avatar.js'
4
+
5
+ export const MkAvatar = defineComponent({
6
+ name: 'MkAvatar',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createAvatar> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createAvatar(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ watch(() => props.src, (v) => instance?.setSrc(v))
29
+ watch(() => props.text, (v) => instance?.setText(v))
30
+ onUnmounted(() => instance?.destroy())
31
+
32
+ return () => h('div', { ref: container })
33
+ },
34
+ })
@@ -0,0 +1,32 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createBreadcrumb } from '../components/breadcrumb/breadcrumb.js'
3
+ import type { BreadcrumbOptions } from '../components/breadcrumb/breadcrumb.js'
4
+
5
+ export const MkBreadcrumb = defineComponent({
6
+ name: 'MkBreadcrumb',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createBreadcrumb> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createBreadcrumb(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ onUnmounted(() => instance?.destroy())
29
+
30
+ return () => h('div', { ref: container })
31
+ },
32
+ })
@@ -0,0 +1,35 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createButton } from '../components/button/button.js'
3
+ import type { ButtonOptions } from '../components/button/button.js'
4
+
5
+ export const MkButton = defineComponent({
6
+ name: 'MkButton',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createButton> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createButton(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ watch(() => props.timeout, (v) => instance?.setTimeout(v))
29
+ watch(() => props.loading, (v) => instance?.setLoading(v))
30
+ watch(() => props.disabled, (v) => instance?.setDisabled(v))
31
+ onUnmounted(() => instance?.destroy())
32
+
33
+ return () => h('div', { ref: container })
34
+ },
35
+ })
@@ -0,0 +1,33 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createCard } from '../components/card/card.js'
3
+ import type { CardOptions } from '../components/card/card.js'
4
+
5
+ export const MkCard = defineComponent({
6
+ name: 'MkCard',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createCard> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createCard(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ watch(() => props.loading, (v) => instance?.setLoading(v))
29
+ onUnmounted(() => instance?.destroy())
30
+
31
+ return () => h('div', { ref: container })
32
+ },
33
+ })
@@ -0,0 +1,32 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createCheckbox } from '../components/form/checkbox.js'
3
+ import type { CheckboxOptions } from '../components/form/checkbox.js'
4
+
5
+ export const MkCheckbox = defineComponent({
6
+ name: 'MkCheckbox',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createCheckbox> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createCheckbox(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ onUnmounted(() => instance?.destroy())
29
+
30
+ return () => h('div', { ref: container })
31
+ },
32
+ })
@@ -0,0 +1,33 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createCollapse } from '../components/collapse/collapse.js'
3
+ import type { CollapsePanelOptions } from '../components/collapse/collapse.js'
4
+
5
+ export const MkCollapse = defineComponent({
6
+ name: 'MkCollapse',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createCollapse> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createCollapse(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ watch(() => props.activeKeys, (v) => instance?.setActiveKeys(v))
29
+ onUnmounted(() => instance?.destroy())
30
+
31
+ return () => h('div', { ref: container })
32
+ },
33
+ })
@@ -0,0 +1,33 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createDialog } from '../components/dialog/dialog.js'
3
+ import type { DialogOptions } from '../components/dialog/dialog.js'
4
+
5
+ export const MkDialog = defineComponent({
6
+ name: 'MkDialog',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createDialog> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createDialog(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ watch(() => props.timeout, (v) => instance?.setTimeout(v))
29
+ onUnmounted(() => instance?.destroy())
30
+
31
+ return () => h('div', { ref: container })
32
+ },
33
+ })
@@ -0,0 +1,32 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createDivider } from '../components/layout/divider.js'
3
+ import type { DividerOptions } from '../components/layout/divider.js'
4
+
5
+ export const MkDivider = defineComponent({
6
+ name: 'MkDivider',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createDivider> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createDivider(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ onUnmounted(() => instance?.destroy())
29
+
30
+ return () => h('div', { ref: container })
31
+ },
32
+ })
@@ -0,0 +1,33 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createDrawer } from '../components/drawer/drawer.js'
3
+ import type { DrawerOptions } from '../components/drawer/drawer.js'
4
+
5
+ export const MkDrawer = defineComponent({
6
+ name: 'MkDrawer',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createDrawer> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createDrawer(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ watch(() => props.timeout, (v) => instance?.setTimeout(v))
29
+ onUnmounted(() => instance?.destroy())
30
+
31
+ return () => h('div', { ref: container })
32
+ },
33
+ })
@@ -0,0 +1,33 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createEmpty } from '../components/empty/empty.js'
3
+ import type { EmptyOptions } from '../components/empty/empty.js'
4
+
5
+ export const MkEmpty = defineComponent({
6
+ name: 'MkEmpty',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createEmpty> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createEmpty(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ watch(() => props.description, (v) => instance?.setDescription(v))
29
+ onUnmounted(() => instance?.destroy())
30
+
31
+ return () => h('div', { ref: container })
32
+ },
33
+ })
@@ -0,0 +1,28 @@
1
+ export { MkAlert } from './alert.js'
2
+ export { MkAvatar } from './avatar.js'
3
+ export { MkBreadcrumb } from './breadcrumb.js'
4
+ export { MkButton } from './button.js'
5
+ export { MkCard } from './card.js'
6
+ export { MkCheckbox } from './checkbox.js'
7
+ export { MkCollapse } from './collapse.js'
8
+ export { MkDialog } from './dialog.js'
9
+ export { MkDivider } from './divider.js'
10
+ export { MkDrawer } from './drawer.js'
11
+ export { MkEmpty } from './empty.js'
12
+ export { MkInput } from './input.js'
13
+ export { useMkLoading } from './loading.js'
14
+ export { MkMenu } from './menu.js'
15
+ export { useMkMessage } from './message.js'
16
+ export { MkPopover } from './popover.js'
17
+ export { MkProgress } from './progress.js'
18
+ export { MkRadio } from './radio.js'
19
+ export { MkRow } from './row.js'
20
+ export { MkSelect } from './select.js'
21
+ export { MkSlider } from './slider.js'
22
+ export { MkSpace } from './space.js'
23
+ export { MkSteps } from './steps.js'
24
+ export { MkSwitch } from './switch.js'
25
+ export { MkTable } from './table.js'
26
+ export { MkTabs } from './tabs.js'
27
+ export { MkTag } from './tag.js'
28
+ export { MkTooltip } from './tooltip.js'
@@ -0,0 +1,32 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createInput } from '../components/input/input.js'
3
+ import type { InputOptions } from '../components/input/input.js'
4
+
5
+ export const MkInput = defineComponent({
6
+ name: 'MkInput',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createInput> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createInput(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ onUnmounted(() => instance?.destroy())
29
+
30
+ return () => h('div', { ref: container })
31
+ },
32
+ })
@@ -0,0 +1,23 @@
1
+ import { showLoading, showFullscreenLoading } from '../components/loading/loading.js'
2
+ import type { LoadingOptions } from '../components/loading/loading.js'
3
+
4
+ export function useMkLoading() {
5
+ let cleanup: (() => void) | null = null
6
+
7
+ const start = (options: LoadingOptions = {}) => {
8
+ cleanup?.()
9
+ cleanup = showLoading(options)
10
+ }
11
+
12
+ const startFullscreen = (text?: string) => {
13
+ cleanup?.()
14
+ cleanup = showFullscreenLoading(text)
15
+ }
16
+
17
+ const stop = () => {
18
+ cleanup?.()
19
+ cleanup = null
20
+ }
21
+
22
+ return { start, startFullscreen, stop }
23
+ }
@@ -0,0 +1,33 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createMenu } from '../components/menu/menu.js'
3
+ import type { MenuOptions } from '../components/menu/menu.js'
4
+
5
+ export const MkMenu = defineComponent({
6
+ name: 'MkMenu',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createMenu> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createMenu(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ watch(() => props.upKeyboard, (v) => instance?.setupKeyboard(v))
29
+ onUnmounted(() => instance?.destroy())
30
+
31
+ return () => h('div', { ref: container })
32
+ },
33
+ })
@@ -0,0 +1,11 @@
1
+ import { message, messageSuccess, messageError, messageWarning } from '../components/message/message.js'
2
+ import type { MessageOptions } from '../components/message/message.js'
3
+
4
+ export function useMkMessage() {
5
+ return {
6
+ show: message,
7
+ success: messageSuccess,
8
+ error: messageError,
9
+ warning: messageWarning,
10
+ }
11
+ }
@@ -0,0 +1,34 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createPopover } from '../components/popover/popover.js'
3
+ import type { PopoverOptions } from '../components/popover/popover.js'
4
+
5
+ export const MkPopover = defineComponent({
6
+ name: 'MkPopover',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createPopover> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createPopover(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ watch(() => props.timeout, (v) => instance?.setTimeout(v))
29
+ watch(() => props.content, (v) => instance?.setContent(v))
30
+ onUnmounted(() => instance?.destroy())
31
+
32
+ return () => h('div', { ref: container })
33
+ },
34
+ })
@@ -0,0 +1,33 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createProgress } from '../components/progress/progress.js'
3
+ import type { ProgressOptions } from '../components/progress/progress.js'
4
+
5
+ export const MkProgress = defineComponent({
6
+ name: 'MkProgress',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createProgress> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createProgress(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ watch(() => props.percent, (v) => instance?.setPercent(v))
29
+ onUnmounted(() => instance?.destroy())
30
+
31
+ return () => h('div', { ref: container })
32
+ },
33
+ })
@@ -0,0 +1,37 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { MkRadio as MkRadioClass } from '../components/form/radio.js'
3
+ import type { RadioOptions } from '../components/form/radio.js'
4
+
5
+ export const MkRadio = defineComponent({
6
+ name: 'MkRadio',
7
+ props: {
8
+ label: { type: String, default: '' },
9
+ value: { type: [String, Number], required: true },
10
+ checked: { type: Boolean, default: false },
11
+ disabled: { type: Boolean, default: false },
12
+ },
13
+ emits: ['change'],
14
+ setup(props, { emit }) {
15
+ const container = ref<HTMLDivElement>()
16
+ let instance: InstanceType<typeof MkRadioClass> | null = null
17
+
18
+ const create = () => {
19
+ if (!container.value) return
20
+ instance?.destroy()
21
+ instance = new MkRadioClass(container.value, {
22
+ label: props.label,
23
+ value: props.value,
24
+ checked: props.checked,
25
+ disabled: props.disabled,
26
+ onChange: (v) => emit('change', v),
27
+ })
28
+ }
29
+
30
+ onMounted(create)
31
+ watch(() => props.checked, (v) => instance?.setChecked(v))
32
+ watch(() => [props.label, props.value, props.disabled], create, { deep: true })
33
+ onUnmounted(() => instance?.destroy())
34
+
35
+ return () => h('div', { ref: container })
36
+ },
37
+ })
package/src/vue/row.ts ADDED
@@ -0,0 +1,32 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createRow } from '../components/layout/row.js'
3
+ import type { RowOptions } from '../components/layout/row.js'
4
+
5
+ export const MkRow = defineComponent({
6
+ name: 'MkRow',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createRow> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createRow(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ onUnmounted(() => instance?.destroy())
29
+
30
+ return () => h('div', { ref: container })
31
+ },
32
+ })
@@ -0,0 +1,33 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createSelect } from '../components/form/select.js'
3
+ import type { SelectOptions } from '../components/form/select.js'
4
+
5
+ export const MkSelect = defineComponent({
6
+ name: 'MkSelect',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createSelect> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createSelect(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ watch(() => props.value, (v) => instance?.setValue(v))
29
+ onUnmounted(() => instance?.destroy())
30
+
31
+ return () => h('div', { ref: container })
32
+ },
33
+ })
@@ -0,0 +1,42 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { MkSlider as MkSliderClass } from '../components/form/slider.js'
3
+ import type { SliderOptions } from '../components/form/slider.js'
4
+
5
+ export const MkSlider = defineComponent({
6
+ name: 'MkSlider',
7
+ props: {
8
+ min: { type: Number, default: 0 },
9
+ max: { type: Number, default: 100 },
10
+ step: { type: Number, default: 1 },
11
+ modelValue: { type: Number, default: 0 },
12
+ showValue: { type: Boolean, default: true },
13
+ },
14
+ emits: ['change', 'update:modelValue'],
15
+ setup(props, { emit }) {
16
+ const container = ref<HTMLDivElement>()
17
+ let instance: InstanceType<typeof MkSliderClass> | null = null
18
+
19
+ onMounted(() => {
20
+ if (!container.value) return
21
+ instance = new MkSliderClass(container.value, {
22
+ min: props.min,
23
+ max: props.max,
24
+ step: props.step,
25
+ value: props.modelValue,
26
+ showValue: props.showValue,
27
+ onChange: (v) => {
28
+ emit('change', v)
29
+ emit('update:modelValue', v)
30
+ },
31
+ })
32
+ })
33
+
34
+ watch(() => props.modelValue, (v) => {
35
+ if (instance) instance.value = v
36
+ })
37
+
38
+ onUnmounted(() => instance?.destroy())
39
+
40
+ return () => h('div', { ref: container })
41
+ },
42
+ })
@@ -0,0 +1,32 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createSpace } from '../components/layout/space.js'
3
+ import type { SpaceOptions } from '../components/layout/space.js'
4
+
5
+ export const MkSpace = defineComponent({
6
+ name: 'MkSpace',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createSpace> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createSpace(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ onUnmounted(() => instance?.destroy())
29
+
30
+ return () => h('div', { ref: container })
31
+ },
32
+ })
@@ -0,0 +1,33 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createSteps } from '../components/steps/steps.js'
3
+ import type { StepsOptions } from '../components/steps/steps.js'
4
+
5
+ export const MkSteps = defineComponent({
6
+ name: 'MkSteps',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createSteps> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createSteps(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ watch(() => props.current, (v) => instance?.setCurrent(v))
29
+ onUnmounted(() => instance?.destroy())
30
+
31
+ return () => h('div', { ref: container })
32
+ },
33
+ })
@@ -0,0 +1,32 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createSwitch } from '../components/switch/switch.js'
3
+ import type { SwitchOptions } from '../components/switch/switch.js'
4
+
5
+ export const MkSwitch = defineComponent({
6
+ name: 'MkSwitch',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createSwitch> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createSwitch(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ onUnmounted(() => instance?.destroy())
29
+
30
+ return () => h('div', { ref: container })
31
+ },
32
+ })
@@ -0,0 +1,33 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createTable } from '../components/table/table.js'
3
+ import type { TableOptions } from '../components/table/table.js'
4
+
5
+ export const MkTable = defineComponent({
6
+ name: 'MkTable',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createTable> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createTable(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ watch(() => props.data, (v) => instance?.setData(v))
29
+ onUnmounted(() => instance?.destroy())
30
+
31
+ return () => h('div', { ref: container })
32
+ },
33
+ })
@@ -0,0 +1,33 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createTabs } from '../components/tabs/tabs.js'
3
+ import type { TabsOptions } from '../components/tabs/tabs.js'
4
+
5
+ export const MkTabs = defineComponent({
6
+ name: 'MkTabs',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createTabs> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createTabs(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ watch(() => props.active, (v) => instance?.setActive(v))
29
+ onUnmounted(() => instance?.destroy())
30
+
31
+ return () => h('div', { ref: container })
32
+ },
33
+ })
package/src/vue/tag.ts ADDED
@@ -0,0 +1,33 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createTag } from '../components/tag/tag.js'
3
+ import type { TagOptions } from '../components/tag/tag.js'
4
+
5
+ export const MkTag = defineComponent({
6
+ name: 'MkTag',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createTag> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createTag(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ watch(() => props.text, (v) => instance?.setText(v))
29
+ onUnmounted(() => instance?.destroy())
30
+
31
+ return () => h('div', { ref: container })
32
+ },
33
+ })
@@ -0,0 +1,34 @@
1
+ import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
2
+ import { createTooltip } from '../components/tooltip/tooltip.js'
3
+ import type { TooltipOptions } from '../components/tooltip/tooltip.js'
4
+
5
+ export const MkTooltip = defineComponent({
6
+ name: 'MkTooltip',
7
+ props: {
8
+
9
+
10
+ },
11
+
12
+ setup(props, { emit, slots }) {
13
+ const container = ref<HTMLDivElement>()
14
+ let instance: ReturnType<typeof createTooltip> | null = null
15
+
16
+ const create = () => {
17
+ if (!container.value) return
18
+ instance?.destroy()
19
+ instance = createTooltip(container.value, {
20
+
21
+
22
+
23
+ })
24
+ }
25
+
26
+ onMounted(create)
27
+
28
+ watch(() => props.tooltipContent, (v) => instance?.setTooltipContent(v))
29
+ watch(() => props.timeout, (v) => instance?.setTimeout(v))
30
+ onUnmounted(() => instance?.destroy())
31
+
32
+ return () => h('div', { ref: container })
33
+ },
34
+ })