@toife/vue 3.3.3 → 3.3.5
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/dist/components/action/action.composable.d.ts +44 -0
- package/dist/components/action/action.vue.d.ts +16 -0
- package/dist/components/action/index.d.ts +2 -0
- package/dist/components/app/app.vue.d.ts +11 -0
- package/dist/components/app/index.d.ts +1 -0
- package/dist/components/avatar/avatar.vue.d.ts +8 -0
- package/dist/components/avatar/index.d.ts +1 -0
- package/dist/components/button/button.vue.d.ts +9 -0
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/cable/cable.vue.d.ts +6 -0
- package/dist/components/cable/index.d.ts +1 -0
- package/dist/components/card/card/card.vue.d.ts +7 -0
- package/dist/components/card/card/index.d.ts +1 -0
- package/dist/components/card/card-body/card-body.vue.d.ts +2 -0
- package/dist/components/card/card-body/index.d.ts +1 -0
- package/dist/components/card/card-footer/card-footer.vue.d.ts +2 -0
- package/dist/components/card/card-footer/index.d.ts +1 -0
- package/dist/components/card/card-header/card-header.vue.d.ts +2 -0
- package/dist/components/card/card-header/index.d.ts +1 -0
- package/dist/components/card/index.d.ts +4 -0
- package/dist/components/checkbox/checkbox.vue.d.ts +18 -0
- package/dist/components/checkbox/index.d.ts +1 -0
- package/dist/components/collapse/collapse.vue.d.ts +12 -0
- package/dist/components/collapse/index.d.ts +1 -0
- package/dist/components/container/container.vue.d.ts +2 -0
- package/dist/components/container/index.d.ts +1 -0
- package/dist/components/decision-modal/decision-modal.composable.d.ts +46 -0
- package/dist/components/decision-modal/decision-modal.vue.d.ts +16 -0
- package/dist/components/decision-modal/index.d.ts +2 -0
- package/dist/components/divider/divider.vue.d.ts +5 -0
- package/dist/components/divider/index.d.ts +1 -0
- package/dist/components/dropdown/dropdown.vue.d.ts +20 -0
- package/dist/components/dropdown/index.d.ts +1 -0
- package/dist/components/field/field.vue.d.ts +30 -0
- package/dist/components/field/index.d.ts +1 -0
- package/dist/components/form-group/form-group.vue.d.ts +5 -0
- package/dist/components/form-group/index.d.ts +1 -0
- package/dist/components/gesture-indicator/gesture-indicator.vue.d.ts +6 -0
- package/dist/components/gesture-indicator/index.d.ts +1 -0
- package/dist/components/image/image.vue.d.ts +3 -0
- package/dist/components/image/index.d.ts +1 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/components/layout/flex/flex.vue.d.ts +5 -0
- package/dist/components/layout/flex/index.d.ts +1 -0
- package/dist/components/layout/flex-item/flex-item.vue.d.ts +5 -0
- package/dist/components/layout/flex-item/index.d.ts +1 -0
- package/dist/components/layout/grid/grid.vue.d.ts +5 -0
- package/dist/components/layout/grid/index.d.ts +1 -0
- package/dist/components/layout/grid-item/grid-item.vue.d.ts +5 -0
- package/dist/components/layout/grid-item/index.d.ts +1 -0
- package/dist/components/layout/index.d.ts +4 -0
- package/dist/components/modal/index.d.ts +1 -0
- package/dist/components/modal/modal.vue.d.ts +17 -0
- package/dist/components/page/index.d.ts +1 -0
- package/dist/components/page/page.vue.d.ts +2 -0
- package/dist/components/present/index.d.ts +2 -0
- package/dist/components/present/present.composable.d.ts +5 -0
- package/dist/components/present/present.vue.d.ts +18 -0
- package/dist/components/radio/index.d.ts +2 -0
- package/dist/components/radio/radio/index.d.ts +1 -0
- package/dist/components/radio/radio/radio.vue.d.ts +7 -0
- package/dist/components/radio/radio-group/index.d.ts +1 -0
- package/dist/components/radio/radio-group/radio-group.vue.d.ts +13 -0
- package/dist/components/refresher/index.d.ts +1 -0
- package/dist/components/refresher/refresher.vue.d.ts +12 -0
- package/dist/components/route/index.d.ts +5 -0
- package/dist/components/route/route-navigator/index.d.ts +1 -0
- package/dist/components/route/route-navigator/route-navigator.vue.d.ts +12 -0
- package/dist/components/route/route-outlet/index.d.ts +1 -0
- package/dist/components/route/route-outlet/route-outlet.vue.d.ts +5 -0
- package/dist/components/route/route-provider/index.d.ts +1 -0
- package/dist/components/route/route-provider/route-provider.vue.d.ts +3 -0
- package/dist/components/route/route-wrapper/index.d.ts +2 -0
- package/dist/components/route/route-wrapper/route-wrapper.composable.d.ts +6 -0
- package/dist/components/route/route-wrapper/route-wrapper.vue.d.ts +5 -0
- package/dist/components/route/route.util.d.ts +3 -0
- package/dist/components/segmented-field/index.d.ts +1 -0
- package/dist/components/segmented-field/segmented-field.vue.d.ts +28 -0
- package/dist/components/select/index.d.ts +1 -0
- package/dist/components/select/select.vue.d.ts +19 -0
- package/dist/components/skeleton/index.d.ts +1 -0
- package/dist/components/skeleton/skeleton.vue.d.ts +6 -0
- package/dist/components/slide-range/index.d.ts +1 -0
- package/dist/components/slide-range/slide-range.vue.d.ts +18 -0
- package/dist/components/switch/index.d.ts +1 -0
- package/dist/components/switch/switch.vue.d.ts +13 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/tab/index.d.ts +1 -0
- package/dist/components/tabs/tab/tab.vue.d.ts +5 -0
- package/dist/components/tabs/tabs/index.d.ts +1 -0
- package/dist/components/tabs/tabs/tabs.vue.d.ts +14 -0
- package/dist/components/tag/index.d.ts +1 -0
- package/dist/components/tag/tag.vue.d.ts +6 -0
- package/dist/components/toast/index.d.ts +3 -0
- package/dist/components/toast/toast/index.d.ts +1 -0
- package/dist/components/toast/toast/toast.vue.d.ts +5 -0
- package/dist/components/toast/toast-content/index.d.ts +1 -0
- package/dist/components/toast/toast-content/toast-content.vue.d.ts +11 -0
- package/dist/components/toast/toast.composable.d.ts +22 -0
- package/dist/components/toolbar/index.d.ts +1 -0
- package/dist/components/toolbar/toolbar.vue.d.ts +7 -0
- package/dist/components/tooltip/index.d.ts +1 -0
- package/dist/components/tooltip/tooltip.vue.d.ts +7 -0
- package/dist/factory.d.ts +38 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +2862 -0
- package/dist/index.umd.js +1 -0
- package/dist/shared/provider-state.d.ts +5 -0
- package/dist/styles/action.css +1 -0
- package/dist/styles/app.css +1 -0
- package/dist/styles/avatar.css +1 -0
- package/dist/styles/button.css +1 -0
- package/dist/styles/cable.css +1 -0
- package/dist/styles/card-body.css +1 -0
- package/dist/styles/card-footer.css +1 -0
- package/dist/styles/card-header.css +1 -0
- package/dist/styles/card.css +1 -0
- package/dist/styles/checkbox.css +1 -0
- package/dist/styles/collapse.css +1 -0
- package/dist/styles/container.css +1 -0
- package/dist/styles/decision-modal.css +1 -0
- package/dist/styles/divider.css +1 -0
- package/dist/styles/dropdown.css +1 -0
- package/dist/styles/field.css +1 -0
- package/dist/styles/flex-item.css +1 -0
- package/dist/styles/flex.css +1 -0
- package/dist/styles/form-group.css +1 -0
- package/dist/styles/gesture-indicator.css +1 -0
- package/dist/styles/grid-item.css +1 -0
- package/dist/styles/grid.css +1 -0
- package/dist/styles/index.css +41 -0
- package/dist/styles/modal.css +1 -0
- package/dist/styles/page.css +1 -0
- package/dist/styles/present.css +1 -0
- package/dist/styles/radio-group.css +1 -0
- package/dist/styles/radio.css +1 -0
- package/dist/styles/refresher.css +1 -0
- package/dist/styles/route-navigator.css +1 -0
- package/dist/styles/segmented-field.css +1 -0
- package/dist/styles/select.css +1 -0
- package/dist/styles/skeleton.css +1 -0
- package/dist/styles/slide-range.css +1 -0
- package/dist/styles/switch.css +1 -0
- package/dist/styles/tab.css +1 -0
- package/dist/styles/tabs.css +1 -0
- package/dist/styles/tag.css +1 -0
- package/dist/styles/toast-content.css +1 -0
- package/dist/styles/toast.css +1 -0
- package/dist/styles/toolbar.css +1 -0
- package/dist/styles/tooltip.css +1 -0
- package/dist/types.d.ts +4 -0
- package/package.json +18 -17
- package/src/components/action/action.composable.ts +0 -32
- package/src/components/action/action.html +0 -25
- package/src/components/action/action.vue +0 -69
- package/src/components/action/index.ts +0 -2
- package/src/components/app/app.html +0 -24
- package/src/components/app/app.vue +0 -45
- package/src/components/app/index.ts +0 -1
- package/src/components/avatar/avatar.html +0 -3
- package/src/components/avatar/avatar.vue +0 -35
- package/src/components/avatar/index.ts +0 -1
- package/src/components/button/button.html +0 -6
- package/src/components/button/button.vue +0 -54
- package/src/components/button/index.ts +0 -1
- package/src/components/cable/cable.html +0 -3
- package/src/components/cable/cable.vue +0 -33
- package/src/components/cable/index.ts +0 -1
- package/src/components/card/card/card.html +0 -3
- package/src/components/card/card/card.vue +0 -52
- package/src/components/card/card/index.ts +0 -1
- package/src/components/card/card-body/card-body.html +0 -3
- package/src/components/card/card-body/card-body.vue +0 -6
- package/src/components/card/card-body/index.ts +0 -1
- package/src/components/card/card-footer/card-footer.html +0 -3
- package/src/components/card/card-footer/card-footer.vue +0 -18
- package/src/components/card/card-footer/index.ts +0 -1
- package/src/components/card/card-header/card-header.html +0 -3
- package/src/components/card/card-header/card-header.vue +0 -18
- package/src/components/card/card-header/index.ts +0 -1
- package/src/components/card/index.ts +0 -4
- package/src/components/checkbox/checkbox.html +0 -12
- package/src/components/checkbox/checkbox.vue +0 -74
- package/src/components/checkbox/index.ts +0 -1
- package/src/components/collapse/collapse.html +0 -16
- package/src/components/collapse/collapse.vue +0 -126
- package/src/components/collapse/index.ts +0 -1
- package/src/components/container/container.html +0 -1
- package/src/components/container/container.vue +0 -7
- package/src/components/container/index.ts +0 -1
- package/src/components/decision-modal/decision-modal.composable.ts +0 -33
- package/src/components/decision-modal/decision-modal.html +0 -29
- package/src/components/decision-modal/decision-modal.vue +0 -76
- package/src/components/decision-modal/index.ts +0 -2
- package/src/components/divider/divider.html +0 -1
- package/src/components/divider/divider.vue +0 -26
- package/src/components/divider/index.ts +0 -1
- package/src/components/dropdown/dropdown.html +0 -6
- package/src/components/dropdown/dropdown.vue +0 -101
- package/src/components/dropdown/index.ts +0 -1
- package/src/components/field/field.html +0 -30
- package/src/components/field/field.vue +0 -121
- package/src/components/field/index.ts +0 -1
- package/src/components/form-group/form-group.html +0 -3
- package/src/components/form-group/form-group.vue +0 -15
- package/src/components/form-group/index.ts +0 -1
- package/src/components/gesture-indicator/gesture-indicator.html +0 -1
- package/src/components/gesture-indicator/gesture-indicator.vue +0 -32
- package/src/components/gesture-indicator/index.ts +0 -1
- package/src/components/image/image.html +0 -1
- package/src/components/image/image.vue +0 -32
- package/src/components/image/index.ts +0 -1
- package/src/components/index.ts +0 -33
- package/src/components/layout/flex/flex.html +0 -1
- package/src/components/layout/flex/flex.vue +0 -15
- package/src/components/layout/flex/index.ts +0 -1
- package/src/components/layout/flex-item/flex-item.html +0 -1
- package/src/components/layout/flex-item/flex-item.vue +0 -11
- package/src/components/layout/flex-item/index.ts +0 -1
- package/src/components/layout/grid/grid.html +0 -1
- package/src/components/layout/grid/grid.vue +0 -15
- package/src/components/layout/grid/index.ts +0 -1
- package/src/components/layout/grid-item/grid-item.html +0 -1
- package/src/components/layout/grid-item/grid-item.vue +0 -11
- package/src/components/layout/grid-item/index.ts +0 -1
- package/src/components/layout/index.ts +0 -4
- package/src/components/modal/index.ts +0 -1
- package/src/components/modal/modal.html +0 -21
- package/src/components/modal/modal.vue +0 -248
- package/src/components/page/index.ts +0 -1
- package/src/components/page/page.html +0 -3
- package/src/components/page/page.vue +0 -7
- package/src/components/present/index.ts +0 -2
- package/src/components/present/present.composable.ts +0 -22
- package/src/components/present/present.html +0 -11
- package/src/components/present/present.vue +0 -234
- package/src/components/radio/index.ts +0 -2
- package/src/components/radio/radio/index.ts +0 -1
- package/src/components/radio/radio/radio.html +0 -11
- package/src/components/radio/radio/radio.vue +0 -86
- package/src/components/radio/radio-group/index.ts +0 -1
- package/src/components/radio/radio-group/radio-group.html +0 -3
- package/src/components/radio/radio-group/radio-group.vue +0 -64
- package/src/components/refresher/index.ts +0 -1
- package/src/components/refresher/refresher.html +0 -3
- package/src/components/refresher/refresher.vue +0 -100
- package/src/components/route/index.ts +0 -5
- package/src/components/route/route-navigator/index.ts +0 -1
- package/src/components/route/route-navigator/route-navigator.html +0 -19
- package/src/components/route/route-navigator/route-navigator.vue +0 -254
- package/src/components/route/route-outlet/index.ts +0 -1
- package/src/components/route/route-outlet/route-outlet.html +0 -1
- package/src/components/route/route-outlet/route-outlet.vue +0 -39
- package/src/components/route/route-provider/index.ts +0 -1
- package/src/components/route/route-provider/route-provider.html +0 -1
- package/src/components/route/route-provider/route-provider.vue +0 -24
- package/src/components/route/route-wrapper/index.ts +0 -2
- package/src/components/route/route-wrapper/route-wrapper.composable.ts +0 -49
- package/src/components/route/route-wrapper/route-wrapper.html +0 -3
- package/src/components/route/route-wrapper/route-wrapper.vue +0 -44
- package/src/components/route/route.util.ts +0 -9
- package/src/components/segmented-field/index.ts +0 -1
- package/src/components/segmented-field/segmented-field.html +0 -16
- package/src/components/segmented-field/segmented-field.vue +0 -243
- package/src/components/select/index.ts +0 -1
- package/src/components/select/select.html +0 -28
- package/src/components/select/select.vue +0 -101
- package/src/components/skeleton/index.ts +0 -1
- package/src/components/skeleton/skeleton.html +0 -1
- package/src/components/skeleton/skeleton.vue +0 -33
- package/src/components/slide-range/index.ts +0 -1
- package/src/components/slide-range/slide-range.html +0 -20
- package/src/components/slide-range/slide-range.vue +0 -269
- package/src/components/switch/index.ts +0 -1
- package/src/components/switch/switch.html +0 -14
- package/src/components/switch/switch.vue +0 -86
- package/src/components/tabs/index.ts +0 -2
- package/src/components/tabs/tab/index.ts +0 -1
- package/src/components/tabs/tab/tab.html +0 -5
- package/src/components/tabs/tab/tab.vue +0 -34
- package/src/components/tabs/tabs/index.ts +0 -1
- package/src/components/tabs/tabs/tabs.html +0 -3
- package/src/components/tabs/tabs/tabs.vue +0 -151
- package/src/components/tag/index.ts +0 -1
- package/src/components/tag/tag.html +0 -1
- package/src/components/tag/tag.vue +0 -33
- package/src/components/toast/index.ts +0 -3
- package/src/components/toast/toast/index.ts +0 -1
- package/src/components/toast/toast/toast.html +0 -9
- package/src/components/toast/toast/toast.vue +0 -28
- package/src/components/toast/toast-content/index.ts +0 -1
- package/src/components/toast/toast-content/toast-content.html +0 -1
- package/src/components/toast/toast-content/toast-content.vue +0 -51
- package/src/components/toast/toast.composable.ts +0 -22
- package/src/components/toolbar/index.ts +0 -1
- package/src/components/toolbar/toolbar.html +0 -3
- package/src/components/toolbar/toolbar.vue +0 -39
- package/src/components/tooltip/index.ts +0 -1
- package/src/components/tooltip/tooltip.html +0 -15
- package/src/components/tooltip/tooltip.vue +0 -63
- package/src/env.d.ts +0 -7
- package/src/factory.ts +0 -164
- package/src/index.ts +0 -4
- package/src/shared/provider-state.ts +0 -8
- package/src/types.ts +0 -4
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
<style lang="scss" src="@toife/core/features/present/present.scss" scoped></style>
|
|
2
|
-
<template src="./present.html"></template>
|
|
3
|
-
<script lang="ts" setup>
|
|
4
|
-
import { unref, computed, inject, nextTick, onMounted, reactive, ref, watch } from "vue";
|
|
5
|
-
import { usePresent } from "./present.composable";
|
|
6
|
-
import {
|
|
7
|
-
PRESENT_DEFAULT_PROPS,
|
|
8
|
-
PRESENT_DEFAULT_STYLES,
|
|
9
|
-
APP_PROVIDER_STATE_KEY,
|
|
10
|
-
getAppClassSelector,
|
|
11
|
-
getPresentAttrs,
|
|
12
|
-
getPresentBackdropAttrs,
|
|
13
|
-
type AppProviderState,
|
|
14
|
-
type PresentEvent,
|
|
15
|
-
type PresentProps,
|
|
16
|
-
type RenderOptions,
|
|
17
|
-
type PresentStyles,
|
|
18
|
-
} from "@toife/core";
|
|
19
|
-
import type { ProviderStateRefs } from "../../shared/provider-state";
|
|
20
|
-
|
|
21
|
-
// Component setup (props, emits, injects)
|
|
22
|
-
// ----------------------------------------------------------------------------
|
|
23
|
-
defineOptions({ inheritAttrs: false });
|
|
24
|
-
|
|
25
|
-
const props = withDefaults(defineProps<PresentProps>(), {
|
|
26
|
-
...PRESENT_DEFAULT_PROPS,
|
|
27
|
-
});
|
|
28
|
-
const emit = defineEmits(["close"]) as unknown as PresentEvent;
|
|
29
|
-
const presentIndex = usePresent();
|
|
30
|
-
const appState = inject<ProviderStateRefs<AppProviderState> | null>(APP_PROVIDER_STATE_KEY, null);
|
|
31
|
-
|
|
32
|
-
// Reactive state
|
|
33
|
-
// ----------------------------------------------------------------------------
|
|
34
|
-
const isBounced = ref(false);
|
|
35
|
-
const zIndex = ref(0);
|
|
36
|
-
const isShow = ref(false);
|
|
37
|
-
const isReadyBackdrop = ref(false);
|
|
38
|
-
const isTeleportReady = ref(false);
|
|
39
|
-
const styles = reactive<PresentStyles>({ ...PRESENT_DEFAULT_STYLES });
|
|
40
|
-
|
|
41
|
-
// Computed properties
|
|
42
|
-
// ----------------------------------------------------------------------------
|
|
43
|
-
const teleportTo = computed(() => {
|
|
44
|
-
if (props.teleport) return props.teleport;
|
|
45
|
-
if (unref(appState?.rootEl)) return unref(appState?.rootEl);
|
|
46
|
-
return getAppClassSelector();
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
const syncTeleportReady = () => {
|
|
50
|
-
if (props.teleport) {
|
|
51
|
-
isTeleportReady.value = !!document.querySelector(props.teleport);
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (unref(appState?.rootEl)) {
|
|
56
|
-
isTeleportReady.value = true;
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
isTeleportReady.value = !!document.querySelector(getAppClassSelector());
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const backdropAttrs = computed(() =>
|
|
64
|
-
getPresentBackdropAttrs({
|
|
65
|
-
zIndex: zIndex.value - 1,
|
|
66
|
-
backdropTransitionDuration: styles.backdropTransitionDuration,
|
|
67
|
-
backdropOpacity: props.backdrop === "transparent" ? 0 : styles.backdropOpacity,
|
|
68
|
-
})
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
// Present attributes
|
|
72
|
-
const presentAttrs = computed(() =>
|
|
73
|
-
getPresentAttrs({
|
|
74
|
-
zIndex: zIndex.value,
|
|
75
|
-
presentTransitionDuration: styles.presentTransitionDuration,
|
|
76
|
-
presentTranslate: styles.presentTranslate,
|
|
77
|
-
presentOpacity: styles.presentOpacity,
|
|
78
|
-
className: props.class,
|
|
79
|
-
placement: props.placement,
|
|
80
|
-
style: props.style,
|
|
81
|
-
})
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
const isRender = computed(() => {
|
|
85
|
-
return isShow.value || props.keepalive;
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
const time = computed(() => {
|
|
89
|
-
return props.duration / 1000 + "s";
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// Methods
|
|
93
|
-
// ----------------------------------------------------------------------------
|
|
94
|
-
const createIndex = () => {
|
|
95
|
-
if (zIndex.value === 0 || !props.keepalive) {
|
|
96
|
-
zIndex.value = presentIndex.newIndex();
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const render = (data: RenderOptions) => {
|
|
101
|
-
if (data.backdropTransitionDuration !== undefined) {
|
|
102
|
-
styles.backdropTransitionDuration = data.backdropTransitionDuration;
|
|
103
|
-
}
|
|
104
|
-
if (data.presentTransitionDuration !== undefined) {
|
|
105
|
-
styles.presentTransitionDuration = data.presentTransitionDuration;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
styles.backdropOpacity = data.backdropOpacity;
|
|
109
|
-
|
|
110
|
-
if (data.presentTranslate !== undefined) {
|
|
111
|
-
styles.presentTranslate = data.presentTranslate;
|
|
112
|
-
}
|
|
113
|
-
if (data.presentOpacity !== undefined) {
|
|
114
|
-
styles.presentOpacity = data.presentOpacity;
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
// On click backdrop
|
|
119
|
-
const onClickBackdrop = (e: unknown) => {
|
|
120
|
-
(e as Event).preventDefault();
|
|
121
|
-
if (isReadyBackdrop.value) emit("close", "backdrop");
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const open = () => {
|
|
125
|
-
setTimeout(() => {
|
|
126
|
-
isReadyBackdrop.value = true;
|
|
127
|
-
}, 300);
|
|
128
|
-
|
|
129
|
-
if (props.bounce && !isBounced.value) {
|
|
130
|
-
isBounced.value = true;
|
|
131
|
-
let presentTranslate = props.bounce;
|
|
132
|
-
|
|
133
|
-
if (props.placement == "bottom" || props.placement == "right") {
|
|
134
|
-
presentTranslate = `calc(${props.bounce} * -1)`;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
render({
|
|
138
|
-
backdropTransitionDuration: time.value,
|
|
139
|
-
backdropOpacity: undefined,
|
|
140
|
-
presentTranslate: String(presentTranslate),
|
|
141
|
-
presentTransitionDuration: time.value,
|
|
142
|
-
presentOpacity: 1,
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
setTimeout(() => {
|
|
146
|
-
render({
|
|
147
|
-
presentTranslate: "0px",
|
|
148
|
-
});
|
|
149
|
-
}, props.duration);
|
|
150
|
-
} else {
|
|
151
|
-
render({
|
|
152
|
-
backdropOpacity: undefined,
|
|
153
|
-
backdropTransitionDuration: time.value,
|
|
154
|
-
presentTranslate: "0px",
|
|
155
|
-
presentTransitionDuration: time.value,
|
|
156
|
-
presentOpacity: 1,
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
const close = () => {
|
|
162
|
-
isReadyBackdrop.value = false;
|
|
163
|
-
isBounced.value = false;
|
|
164
|
-
let presentTranslate = "0px";
|
|
165
|
-
let presentOpacity = 1;
|
|
166
|
-
|
|
167
|
-
if (props.placement == "bottom" || props.placement == "right") {
|
|
168
|
-
presentTranslate = "100%";
|
|
169
|
-
} else if (props.placement == "top" || props.placement == "left") {
|
|
170
|
-
presentTranslate = "-100%";
|
|
171
|
-
} else if (props.placement == "center") {
|
|
172
|
-
presentTranslate = "0px";
|
|
173
|
-
presentOpacity = 0;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
render({
|
|
177
|
-
backdropOpacity: 0,
|
|
178
|
-
backdropTransitionDuration: time.value,
|
|
179
|
-
presentTranslate,
|
|
180
|
-
presentTransitionDuration: time.value,
|
|
181
|
-
presentOpacity,
|
|
182
|
-
});
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
// Lifecycle
|
|
186
|
-
// ----------------------------------------------------------------------------
|
|
187
|
-
onMounted(() => {
|
|
188
|
-
syncTeleportReady();
|
|
189
|
-
if (!isTeleportReady.value) {
|
|
190
|
-
nextTick(() => {
|
|
191
|
-
syncTeleportReady();
|
|
192
|
-
if (!isTeleportReady.value) requestAnimationFrame(syncTeleportReady);
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
if (props.visible) open();
|
|
197
|
-
else close();
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
watch(
|
|
201
|
-
() => [props.teleport, unref(appState?.rootEl)] as const,
|
|
202
|
-
() => syncTeleportReady(),
|
|
203
|
-
{ immediate: true }
|
|
204
|
-
);
|
|
205
|
-
|
|
206
|
-
// Trigger visible
|
|
207
|
-
watch(
|
|
208
|
-
() => props.visible,
|
|
209
|
-
() => {
|
|
210
|
-
if (props.visible) {
|
|
211
|
-
createIndex();
|
|
212
|
-
isShow.value = true;
|
|
213
|
-
|
|
214
|
-
setTimeout(() => {
|
|
215
|
-
open();
|
|
216
|
-
}, 100);
|
|
217
|
-
} else {
|
|
218
|
-
close();
|
|
219
|
-
|
|
220
|
-
setTimeout(() => {
|
|
221
|
-
isShow.value = false;
|
|
222
|
-
}, props.duration);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
);
|
|
226
|
-
|
|
227
|
-
// Provide / expose (public API)
|
|
228
|
-
// ----------------------------------------------------------------------------
|
|
229
|
-
defineExpose({
|
|
230
|
-
render,
|
|
231
|
-
open,
|
|
232
|
-
close,
|
|
233
|
-
});
|
|
234
|
-
</script>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Radio } from "./radio.vue";
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
<style lang="scss" src="@toife/core/features/radio/radio.scss" scoped></style>
|
|
2
|
-
<template src="./radio.html"></template>
|
|
3
|
-
<script lang="ts" setup>
|
|
4
|
-
import { unref, computed, inject, ref } from "vue";
|
|
5
|
-
import {
|
|
6
|
-
RADIO_DEFAULT_PROPS,
|
|
7
|
-
APP_PROVIDER_STATE_KEY,
|
|
8
|
-
RADIO_GROUP_PROVIDER_STATE_KEY,
|
|
9
|
-
getRadioAttrs,
|
|
10
|
-
getRadioIconAttrs,
|
|
11
|
-
type AppProviderState,
|
|
12
|
-
type RadioGroupProviderState,
|
|
13
|
-
type RadioProps,
|
|
14
|
-
} from "@toife/core";
|
|
15
|
-
import type { ProviderStateRefs } from "../../../shared/provider-state";
|
|
16
|
-
|
|
17
|
-
// Component setup (props, emits, injects)
|
|
18
|
-
// ----------------------------------------------------------------------------
|
|
19
|
-
const props = withDefaults(defineProps<RadioProps>(), {
|
|
20
|
-
...RADIO_DEFAULT_PROPS,
|
|
21
|
-
});
|
|
22
|
-
const appState = inject<ProviderStateRefs<AppProviderState>>(APP_PROVIDER_STATE_KEY);
|
|
23
|
-
const radioGroupState = inject<ProviderStateRefs<RadioGroupProviderState> | null>(
|
|
24
|
-
RADIO_GROUP_PROVIDER_STATE_KEY,
|
|
25
|
-
null
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
// Reactive state
|
|
29
|
-
// ----------------------------------------------------------------------------
|
|
30
|
-
const isFocused = ref(false);
|
|
31
|
-
|
|
32
|
-
// Computed properties
|
|
33
|
-
// ----------------------------------------------------------------------------
|
|
34
|
-
const disabled = computed(() => {
|
|
35
|
-
return props.disabled || (unref(radioGroupState?.disabled) ?? false);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const readonly = computed(() => {
|
|
39
|
-
return props.readonly || (unref(radioGroupState?.readonly) ?? false);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const radioAttrs = computed(() => {
|
|
43
|
-
const shadow = (props?.shadow !== undefined ? props.shadow : unref(appState?.shadow)) ?? false;
|
|
44
|
-
const role = props.role || unref(radioGroupState?.role) || unref(appState?.role) || "";
|
|
45
|
-
const shape = props.shape || unref(radioGroupState?.shape) || unref(appState?.shape) || "";
|
|
46
|
-
const variant = props.variant || unref(radioGroupState?.variant) || "";
|
|
47
|
-
const isChecked = unref(radioGroupState?.modelValue) === props.value;
|
|
48
|
-
|
|
49
|
-
return getRadioAttrs({
|
|
50
|
-
role,
|
|
51
|
-
shape,
|
|
52
|
-
size: props.size,
|
|
53
|
-
variant,
|
|
54
|
-
checked: isChecked,
|
|
55
|
-
disabled: disabled.value,
|
|
56
|
-
readonly: readonly.value,
|
|
57
|
-
shadow: shadow && !props.disabled && isFocused.value,
|
|
58
|
-
focus: isFocused.value,
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
const radioIconAttrs = getRadioIconAttrs();
|
|
63
|
-
|
|
64
|
-
// Methods
|
|
65
|
-
// ----------------------------------------------------------------------------
|
|
66
|
-
const onRadio = () => {
|
|
67
|
-
if (disabled.value || readonly.value || !radioGroupState) return;
|
|
68
|
-
radioGroupState.setValue(props.value);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const onFocus = () => {
|
|
72
|
-
if (disabled.value || readonly.value) return;
|
|
73
|
-
isFocused.value = true;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const onBlur = () => {
|
|
77
|
-
if (disabled.value || readonly.value) return;
|
|
78
|
-
isFocused.value = false;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const onKeydown = (e: KeyboardEvent) => {
|
|
82
|
-
if (e.key !== " " && e.key !== "Enter") return;
|
|
83
|
-
e.preventDefault();
|
|
84
|
-
onRadio();
|
|
85
|
-
};
|
|
86
|
-
</script>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as RadioGroup } from "./radio-group.vue";
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
<style lang="scss" src="@toife/core/features/radio/radio-group.scss" scoped></style>
|
|
2
|
-
<template src="./radio-group.html"></template>
|
|
3
|
-
<script lang="ts" setup>
|
|
4
|
-
import { unref, computed, inject, provide } from "vue";
|
|
5
|
-
import {
|
|
6
|
-
RADIO_GROUP_DEFAULT_PROPS,
|
|
7
|
-
APP_PROVIDER_STATE_KEY,
|
|
8
|
-
RADIO_GROUP_PROVIDER_STATE_KEY,
|
|
9
|
-
getRadioGroupAttrs,
|
|
10
|
-
type AppProviderState,
|
|
11
|
-
type RadioGroupEvent,
|
|
12
|
-
type RadioGroupProps,
|
|
13
|
-
type RadioGroupProviderState,
|
|
14
|
-
} from "@toife/core";
|
|
15
|
-
import type { ProviderStateRefs } from "../../../shared/provider-state";
|
|
16
|
-
|
|
17
|
-
// Component setup (props, emits, injects)
|
|
18
|
-
// ----------------------------------------------------------------------------
|
|
19
|
-
const props = withDefaults(defineProps<RadioGroupProps>(), {
|
|
20
|
-
...RADIO_GROUP_DEFAULT_PROPS,
|
|
21
|
-
});
|
|
22
|
-
const emit = defineEmits<RadioGroupEvent>();
|
|
23
|
-
const appState = inject<ProviderStateRefs<AppProviderState>>(APP_PROVIDER_STATE_KEY);
|
|
24
|
-
|
|
25
|
-
// Computed properties
|
|
26
|
-
// ----------------------------------------------------------------------------
|
|
27
|
-
const modelValue = computed(() => props.modelValue);
|
|
28
|
-
|
|
29
|
-
const role = computed(() => {
|
|
30
|
-
return props.role || unref(appState?.role) || "";
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const shape = computed(() => {
|
|
34
|
-
return props.shape || unref(appState?.shape) || "";
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const variant = computed(() => {
|
|
38
|
-
return props.variant;
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const shadow = computed(() => {
|
|
42
|
-
return (props?.shadow !== undefined ? props.shadow : unref(appState?.shadow)) ?? false;
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const disabled = computed(() => props.disabled);
|
|
46
|
-
const readonly = computed(() => props.readonly);
|
|
47
|
-
|
|
48
|
-
const radioGroupAttrs = computed(() => getRadioGroupAttrs({ direction: props.direction }));
|
|
49
|
-
|
|
50
|
-
// Provide / expose (public API)
|
|
51
|
-
// ----------------------------------------------------------------------------
|
|
52
|
-
provide<ProviderStateRefs<RadioGroupProviderState>>(RADIO_GROUP_PROVIDER_STATE_KEY, {
|
|
53
|
-
modelValue,
|
|
54
|
-
role,
|
|
55
|
-
shape,
|
|
56
|
-
variant,
|
|
57
|
-
disabled,
|
|
58
|
-
readonly,
|
|
59
|
-
shadow,
|
|
60
|
-
setValue: (val: string | number) => {
|
|
61
|
-
emit("update:modelValue", val);
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
</script>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Refresher } from "./refresher.vue";
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
<style lang="scss" src="@toife/core/features/refresher/refresher.scss" scoped></style>
|
|
2
|
-
<template src="./refresher.html"></template>
|
|
3
|
-
<script lang="ts" setup>
|
|
4
|
-
import { ref, onUnmounted, watch, computed } from "vue";
|
|
5
|
-
import { gesture, type GestureMovePayload, type GestureUpPayload } from "@toife/gesture";
|
|
6
|
-
import { getRefresherAttrs, type RefresherEvent } from "@toife/core";
|
|
7
|
-
|
|
8
|
-
// Component setup (props, emits, injects)
|
|
9
|
-
// ----------------------------------------------------------------------------
|
|
10
|
-
const emit = defineEmits<RefresherEvent>();
|
|
11
|
-
|
|
12
|
-
// Reactive state
|
|
13
|
-
// ----------------------------------------------------------------------------
|
|
14
|
-
const refreshing = ref(false);
|
|
15
|
-
const container = ref();
|
|
16
|
-
let cleanup: unknown;
|
|
17
|
-
let isPulling = false;
|
|
18
|
-
|
|
19
|
-
// Computed properties
|
|
20
|
-
// ----------------------------------------------------------------------------
|
|
21
|
-
const containerAttrs = computed(() => getRefresherAttrs());
|
|
22
|
-
|
|
23
|
-
// Methods
|
|
24
|
-
// ----------------------------------------------------------------------------
|
|
25
|
-
const close = () => {
|
|
26
|
-
refreshing.value = false;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const refresh = () => {
|
|
30
|
-
refreshing.value = true;
|
|
31
|
-
return close;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const up = () => {
|
|
35
|
-
emit("end", { refresh });
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const cancel = () => {
|
|
39
|
-
isPulling = false;
|
|
40
|
-
refreshing.value = false;
|
|
41
|
-
emit("cancel");
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// Lifecycle
|
|
45
|
-
// ----------------------------------------------------------------------------
|
|
46
|
-
watch(
|
|
47
|
-
() => container.value,
|
|
48
|
-
() => {
|
|
49
|
-
cleanup && (cleanup as { destroy: () => void }).destroy();
|
|
50
|
-
if (!container.value) return;
|
|
51
|
-
cleanup = gesture(
|
|
52
|
-
container.value,
|
|
53
|
-
{
|
|
54
|
-
options: {
|
|
55
|
-
minMove: 20,
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
beforeEvent() {
|
|
59
|
-
if (isPulling) return true;
|
|
60
|
-
if ((container.value?.scrollTop || 0) > 0) return false;
|
|
61
|
-
return true;
|
|
62
|
-
},
|
|
63
|
-
down() {
|
|
64
|
-
if (refreshing.value) return;
|
|
65
|
-
isPulling = (container.value?.scrollTop || 0) <= 0;
|
|
66
|
-
if (!isPulling) return;
|
|
67
|
-
emit("start");
|
|
68
|
-
},
|
|
69
|
-
move({ deltaY, initialDirection }: GestureMovePayload) {
|
|
70
|
-
if (refreshing.value || !isPulling || initialDirection != "down") return;
|
|
71
|
-
const v = deltaY < 0 ? 0 : deltaY;
|
|
72
|
-
emit("move", { refresh, offset: v });
|
|
73
|
-
},
|
|
74
|
-
up({ initialDirection }: GestureUpPayload) {
|
|
75
|
-
const wasPulling = isPulling;
|
|
76
|
-
isPulling = false;
|
|
77
|
-
if (refreshing.value || !wasPulling) return;
|
|
78
|
-
if (initialDirection != "down") {
|
|
79
|
-
cancel();
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
up();
|
|
83
|
-
},
|
|
84
|
-
cancel() {
|
|
85
|
-
isPulling = false;
|
|
86
|
-
if (refreshing.value) return;
|
|
87
|
-
cancel();
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
passive: false,
|
|
92
|
-
}
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
onUnmounted(() => {
|
|
98
|
-
cleanup && (cleanup as { destroy: () => void }).destroy();
|
|
99
|
-
});
|
|
100
|
-
</script>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as RouteNavigator } from "./route-navigator.vue";
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<div v-bind="navigatorAttrs" ref="navigatorRef">
|
|
2
|
-
<div
|
|
3
|
-
v-for="(item, index) in stack"
|
|
4
|
-
:key="item.name"
|
|
5
|
-
v-bind="componentAttrs"
|
|
6
|
-
:style="{zIndex: index * 2 + 100}"
|
|
7
|
-
:name="item.name"
|
|
8
|
-
:class="{
|
|
9
|
-
active: index === activeIndex,
|
|
10
|
-
prepare: index === activeIndex + 1,
|
|
11
|
-
back: index === activeIndex - 1,
|
|
12
|
-
}"
|
|
13
|
-
>
|
|
14
|
-
<RouteProvider :stack="item.stack">
|
|
15
|
-
<RouteOutlet :component="item.component" />
|
|
16
|
-
</RouteProvider>
|
|
17
|
-
</div>
|
|
18
|
-
<div v-bind="backdropAttrs"></div>
|
|
19
|
-
</div>
|