@toife/vue 3.2.5 → 3.2.7
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 +20 -21
- package/src/components/action/action.composable.ts +32 -0
- package/src/components/action/action.html +25 -0
- package/src/components/action/action.vue +69 -0
- package/src/components/action/index.ts +2 -0
- package/src/components/app/app.html +24 -0
- package/src/components/app/app.vue +45 -0
- package/src/components/app/index.ts +1 -0
- package/src/components/avatar/avatar.html +3 -0
- package/src/components/avatar/avatar.vue +35 -0
- package/src/components/avatar/index.ts +1 -0
- package/src/components/button/button.html +6 -0
- package/src/components/button/button.vue +54 -0
- package/src/components/button/index.ts +1 -0
- package/src/components/cable/cable.html +3 -0
- package/src/components/cable/cable.vue +33 -0
- package/src/components/cable/index.ts +1 -0
- package/src/components/card/card/card.html +3 -0
- package/src/components/card/card/card.vue +52 -0
- package/src/components/card/card/index.ts +1 -0
- package/src/components/card/card-body/card-body.html +3 -0
- package/src/components/card/card-body/card-body.vue +6 -0
- package/src/components/card/card-body/index.ts +1 -0
- package/src/components/card/card-footer/card-footer.html +3 -0
- package/src/components/card/card-footer/card-footer.vue +18 -0
- package/src/components/card/card-footer/index.ts +1 -0
- package/src/components/card/card-header/card-header.html +3 -0
- package/src/components/card/card-header/card-header.vue +18 -0
- package/src/components/card/card-header/index.ts +1 -0
- package/src/components/card/index.ts +4 -0
- package/src/components/checkbox/checkbox.html +12 -0
- package/src/components/checkbox/checkbox.vue +74 -0
- package/src/components/checkbox/index.ts +1 -0
- package/src/components/collapse/collapse.html +16 -0
- package/src/components/collapse/collapse.vue +126 -0
- package/src/components/collapse/index.ts +1 -0
- package/src/components/container/container.html +1 -0
- package/src/components/container/container.vue +7 -0
- package/src/components/container/index.ts +1 -0
- package/src/components/decision-modal/decision-modal.composable.ts +33 -0
- package/src/components/decision-modal/decision-modal.html +29 -0
- package/src/components/decision-modal/decision-modal.vue +76 -0
- package/src/components/decision-modal/index.ts +2 -0
- package/src/components/divider/divider.html +1 -0
- package/src/components/divider/divider.vue +26 -0
- package/src/components/divider/index.ts +1 -0
- package/src/components/dropdown/dropdown.html +6 -0
- package/src/components/dropdown/dropdown.vue +101 -0
- package/src/components/dropdown/index.ts +1 -0
- package/src/components/field/field.html +30 -0
- package/src/components/field/field.vue +121 -0
- package/src/components/field/index.ts +1 -0
- package/src/components/form-group/form-group.html +3 -0
- package/src/components/form-group/form-group.vue +15 -0
- package/src/components/form-group/index.ts +1 -0
- package/src/components/gesture-indicator/gesture-indicator.html +1 -0
- package/src/components/gesture-indicator/gesture-indicator.vue +32 -0
- package/src/components/gesture-indicator/index.ts +1 -0
- package/src/components/image/image.html +1 -0
- package/src/components/image/image.vue +32 -0
- package/src/components/image/index.ts +1 -0
- package/src/components/index.ts +32 -0
- package/src/components/layout/flex/flex.html +1 -0
- package/src/components/layout/flex/flex.vue +15 -0
- package/src/components/layout/flex/index.ts +1 -0
- package/src/components/layout/flex-item/flex-item.html +1 -0
- package/src/components/layout/flex-item/flex-item.vue +11 -0
- package/src/components/layout/flex-item/index.ts +1 -0
- package/src/components/layout/grid/grid.html +1 -0
- package/src/components/layout/grid/grid.vue +15 -0
- package/src/components/layout/grid/index.ts +1 -0
- package/src/components/layout/grid-item/grid-item.html +1 -0
- package/src/components/layout/grid-item/grid-item.vue +11 -0
- package/src/components/layout/grid-item/index.ts +1 -0
- package/src/components/layout/index.ts +4 -0
- package/src/components/modal/index.ts +1 -0
- package/src/components/modal/modal.html +20 -0
- package/src/components/modal/modal.vue +248 -0
- package/src/components/page/index.ts +1 -0
- package/src/components/page/page.html +3 -0
- package/src/components/page/page.vue +7 -0
- package/src/components/present/index.ts +2 -0
- package/src/components/present/present.composable.ts +22 -0
- package/src/components/present/present.html +11 -0
- package/src/components/present/present.vue +234 -0
- package/src/components/radio/index.ts +2 -0
- package/src/components/radio/radio/index.ts +1 -0
- package/src/components/radio/radio/radio.html +11 -0
- package/src/components/radio/radio/radio.vue +84 -0
- package/src/components/radio/radio-group/index.ts +1 -0
- package/src/components/radio/radio-group/radio-group.html +3 -0
- package/src/components/radio/radio-group/radio-group.vue +59 -0
- package/src/components/refresher/index.ts +1 -0
- package/src/components/refresher/refresher.html +3 -0
- package/src/components/refresher/refresher.vue +100 -0
- package/src/components/route/index.ts +5 -0
- package/src/components/route/route-navigator/index.ts +1 -0
- package/src/components/route/route-navigator/route-navigator.html +19 -0
- package/src/components/route/route-navigator/route-navigator.vue +254 -0
- package/src/components/route/route-outlet/index.ts +1 -0
- package/src/components/route/route-outlet/route-outlet.html +1 -0
- package/src/components/route/route-outlet/route-outlet.vue +39 -0
- package/src/components/route/route-provider/index.ts +1 -0
- package/src/components/route/route-provider/route-provider.html +1 -0
- package/src/components/route/route-provider/route-provider.vue +24 -0
- package/src/components/route/route-wrapper/index.ts +2 -0
- package/src/components/route/route-wrapper/route-wrapper.composable.ts +49 -0
- package/src/components/route/route-wrapper/route-wrapper.html +3 -0
- package/src/components/route/route-wrapper/route-wrapper.vue +44 -0
- package/src/components/route/route.util.ts +9 -0
- package/src/components/segmented-field/index.ts +1 -0
- package/src/components/segmented-field/segmented-field.html +16 -0
- package/src/components/segmented-field/segmented-field.vue +243 -0
- package/src/components/select/index.ts +1 -0
- package/src/components/select/select.html +28 -0
- package/src/components/select/select.vue +101 -0
- package/src/components/skeleton/index.ts +1 -0
- package/src/components/skeleton/skeleton.html +1 -0
- package/src/components/skeleton/skeleton.vue +33 -0
- package/src/components/slide-range/index.ts +1 -0
- package/src/components/slide-range/slide-range.html +20 -0
- package/src/components/slide-range/slide-range.vue +269 -0
- package/src/components/switch/index.ts +1 -0
- package/src/components/switch/switch.html +14 -0
- package/src/components/switch/switch.vue +86 -0
- package/src/components/tabs/index.ts +2 -0
- package/src/components/tabs/tab/index.ts +1 -0
- package/src/components/tabs/tab/tab.html +5 -0
- package/src/components/tabs/tab/tab.vue +34 -0
- package/src/components/tabs/tabs/index.ts +1 -0
- package/src/components/tabs/tabs/tabs.html +3 -0
- package/src/components/tabs/tabs/tabs.vue +151 -0
- package/src/components/tag/index.ts +1 -0
- package/src/components/tag/tag.html +1 -0
- package/src/components/tag/tag.vue +33 -0
- package/src/components/toast/index.ts +3 -0
- package/src/components/toast/toast/index.ts +1 -0
- package/src/components/toast/toast/toast.html +9 -0
- package/src/components/toast/toast/toast.vue +28 -0
- package/src/components/toast/toast-content/index.ts +1 -0
- package/src/components/toast/toast-content/toast-content.html +1 -0
- package/src/components/toast/toast-content/toast-content.vue +51 -0
- package/src/components/toast/toast.composable.ts +22 -0
- package/src/components/toolbar/index.ts +1 -0
- package/src/components/toolbar/toolbar.html +3 -0
- package/src/components/toolbar/toolbar.vue +39 -0
- package/src/env.d.ts +7 -0
- package/src/factory.ts +162 -0
- package/src/index.ts +4 -0
- package/src/shared/provider-state.ts +8 -0
- package/src/types.ts +4 -0
- package/dist/components/action/action.composable.d.ts +0 -44
- package/dist/components/action/action.vue.d.ts +0 -16
- package/dist/components/action/index.d.ts +0 -2
- package/dist/components/app/app.vue.d.ts +0 -11
- package/dist/components/app/index.d.ts +0 -1
- package/dist/components/avatar/avatar.vue.d.ts +0 -8
- package/dist/components/avatar/index.d.ts +0 -1
- package/dist/components/button/button.vue.d.ts +0 -9
- package/dist/components/button/index.d.ts +0 -1
- package/dist/components/cable/cable.vue.d.ts +0 -6
- package/dist/components/cable/index.d.ts +0 -1
- package/dist/components/card/card/card.vue.d.ts +0 -7
- package/dist/components/card/card/index.d.ts +0 -1
- package/dist/components/card/card-body/card-body.vue.d.ts +0 -2
- package/dist/components/card/card-body/index.d.ts +0 -1
- package/dist/components/card/card-footer/card-footer.vue.d.ts +0 -2
- package/dist/components/card/card-footer/index.d.ts +0 -1
- package/dist/components/card/card-header/card-header.vue.d.ts +0 -2
- package/dist/components/card/card-header/index.d.ts +0 -1
- package/dist/components/card/index.d.ts +0 -4
- package/dist/components/checkbox/checkbox.vue.d.ts +0 -18
- package/dist/components/checkbox/index.d.ts +0 -1
- package/dist/components/collapse/collapse.vue.d.ts +0 -12
- package/dist/components/collapse/index.d.ts +0 -1
- package/dist/components/container/container.vue.d.ts +0 -2
- package/dist/components/container/index.d.ts +0 -1
- package/dist/components/decision-modal/decision-modal.composable.d.ts +0 -46
- package/dist/components/decision-modal/decision-modal.vue.d.ts +0 -16
- package/dist/components/decision-modal/index.d.ts +0 -2
- package/dist/components/divider/divider.vue.d.ts +0 -5
- package/dist/components/divider/index.d.ts +0 -1
- package/dist/components/dropdown/dropdown.vue.d.ts +0 -20
- package/dist/components/dropdown/index.d.ts +0 -1
- package/dist/components/field/field.vue.d.ts +0 -30
- package/dist/components/field/index.d.ts +0 -1
- package/dist/components/form-group/form-group.vue.d.ts +0 -5
- package/dist/components/form-group/index.d.ts +0 -1
- package/dist/components/gesture-indicator/gesture-indicator.vue.d.ts +0 -6
- package/dist/components/gesture-indicator/index.d.ts +0 -1
- package/dist/components/image/image.vue.d.ts +0 -3
- package/dist/components/image/index.d.ts +0 -1
- package/dist/components/index.d.ts +0 -32
- package/dist/components/layout/flex/flex.vue.d.ts +0 -5
- package/dist/components/layout/flex/index.d.ts +0 -1
- package/dist/components/layout/flex-item/flex-item.vue.d.ts +0 -5
- package/dist/components/layout/flex-item/index.d.ts +0 -1
- package/dist/components/layout/grid/grid.vue.d.ts +0 -5
- package/dist/components/layout/grid/index.d.ts +0 -1
- package/dist/components/layout/grid-item/grid-item.vue.d.ts +0 -5
- package/dist/components/layout/grid-item/index.d.ts +0 -1
- package/dist/components/layout/index.d.ts +0 -4
- package/dist/components/modal/index.d.ts +0 -1
- package/dist/components/modal/modal.vue.d.ts +0 -17
- package/dist/components/page/index.d.ts +0 -1
- package/dist/components/page/page.vue.d.ts +0 -2
- package/dist/components/present/index.d.ts +0 -2
- package/dist/components/present/present.composable.d.ts +0 -5
- package/dist/components/present/present.vue.d.ts +0 -18
- package/dist/components/radio/index.d.ts +0 -2
- package/dist/components/radio/radio/index.d.ts +0 -1
- package/dist/components/radio/radio/radio.vue.d.ts +0 -7
- package/dist/components/radio/radio-group/index.d.ts +0 -1
- package/dist/components/radio/radio-group/radio-group.vue.d.ts +0 -13
- package/dist/components/refresher/index.d.ts +0 -1
- package/dist/components/refresher/refresher.vue.d.ts +0 -12
- package/dist/components/route/index.d.ts +0 -5
- package/dist/components/route/route-navigator/index.d.ts +0 -1
- package/dist/components/route/route-navigator/route-navigator.vue.d.ts +0 -11
- package/dist/components/route/route-outlet/index.d.ts +0 -1
- package/dist/components/route/route-outlet/route-outlet.vue.d.ts +0 -5
- package/dist/components/route/route-provider/index.d.ts +0 -1
- package/dist/components/route/route-provider/route-provider.vue.d.ts +0 -3
- package/dist/components/route/route-wrapper/index.d.ts +0 -2
- package/dist/components/route/route-wrapper/route-wrapper.composable.d.ts +0 -6
- package/dist/components/route/route-wrapper/route-wrapper.vue.d.ts +0 -5
- package/dist/components/route/route.util.d.ts +0 -3
- package/dist/components/segmented-field/index.d.ts +0 -1
- package/dist/components/segmented-field/segmented-field.vue.d.ts +0 -28
- package/dist/components/select/index.d.ts +0 -1
- package/dist/components/select/select.vue.d.ts +0 -19
- package/dist/components/skeleton/index.d.ts +0 -1
- package/dist/components/skeleton/skeleton.vue.d.ts +0 -6
- package/dist/components/slide-range/index.d.ts +0 -1
- package/dist/components/slide-range/slide-range.vue.d.ts +0 -18
- package/dist/components/switch/index.d.ts +0 -1
- package/dist/components/switch/switch.vue.d.ts +0 -13
- package/dist/components/tabs/index.d.ts +0 -2
- package/dist/components/tabs/tab/index.d.ts +0 -1
- package/dist/components/tabs/tab/tab.vue.d.ts +0 -5
- package/dist/components/tabs/tabs/index.d.ts +0 -1
- package/dist/components/tabs/tabs/tabs.vue.d.ts +0 -14
- package/dist/components/tag/index.d.ts +0 -1
- package/dist/components/tag/tag.vue.d.ts +0 -6
- package/dist/components/toast/index.d.ts +0 -3
- package/dist/components/toast/toast/index.d.ts +0 -1
- package/dist/components/toast/toast/toast.vue.d.ts +0 -5
- package/dist/components/toast/toast-content/index.d.ts +0 -1
- package/dist/components/toast/toast-content/toast-content.vue.d.ts +0 -11
- package/dist/components/toast/toast.composable.d.ts +0 -22
- package/dist/components/toolbar/index.d.ts +0 -1
- package/dist/components/toolbar/toolbar.vue.d.ts +0 -7
- package/dist/factory.d.ts +0 -38
- package/dist/index.d.ts +0 -3
- package/dist/index.es.js +0 -3522
- package/dist/index.umd.js +0 -1
- package/dist/shared/provider-state.d.ts +0 -5
- package/dist/styles/action.css +0 -1
- package/dist/styles/app.css +0 -1
- package/dist/styles/avatar.css +0 -1
- package/dist/styles/button.css +0 -1
- package/dist/styles/cable.css +0 -1
- package/dist/styles/card-body.css +0 -1
- package/dist/styles/card-footer.css +0 -1
- package/dist/styles/card-header.css +0 -1
- package/dist/styles/card.css +0 -1
- package/dist/styles/checkbox.css +0 -1
- package/dist/styles/collapse.css +0 -1
- package/dist/styles/container.css +0 -1
- package/dist/styles/decision-modal.css +0 -1
- package/dist/styles/divider.css +0 -1
- package/dist/styles/dropdown.css +0 -1
- package/dist/styles/field.css +0 -1
- package/dist/styles/flex-item.css +0 -1
- package/dist/styles/flex.css +0 -1
- package/dist/styles/form-group.css +0 -1
- package/dist/styles/gesture-indicator.css +0 -1
- package/dist/styles/grid-item.css +0 -1
- package/dist/styles/grid.css +0 -1
- package/dist/styles/index.css +0 -40
- package/dist/styles/modal.css +0 -1
- package/dist/styles/page.css +0 -1
- package/dist/styles/present.css +0 -1
- package/dist/styles/radio-group.css +0 -1
- package/dist/styles/radio.css +0 -1
- package/dist/styles/refresher.css +0 -1
- package/dist/styles/route-navigator.css +0 -1
- package/dist/styles/segmented-field.css +0 -1
- package/dist/styles/select.css +0 -1
- package/dist/styles/skeleton.css +0 -1
- package/dist/styles/slide-range.css +0 -1
- package/dist/styles/switch.css +0 -1
- package/dist/styles/tab.css +0 -1
- package/dist/styles/tabs.css +0 -1
- package/dist/styles/tag.css +0 -1
- package/dist/styles/toast-content.css +0 -1
- package/dist/styles/toast.css +0 -1
- package/dist/styles/toolbar.css +0 -1
- package/dist/types.d.ts +0 -4
package/package.json
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toife/vue",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.7",
|
|
4
4
|
"description": "A Frontend framework for Vue",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
7
|
-
"
|
|
7
|
+
"**/*.vue",
|
|
8
|
+
"**/*.scss",
|
|
9
|
+
"**/*.css"
|
|
8
10
|
],
|
|
9
|
-
"main": "
|
|
10
|
-
"module": "
|
|
11
|
-
"types": "
|
|
11
|
+
"main": "./src/index.ts",
|
|
12
|
+
"module": "./src/index.ts",
|
|
13
|
+
"types": "./src/index.ts",
|
|
12
14
|
"exports": {
|
|
13
15
|
".": {
|
|
14
|
-
"types": "./
|
|
15
|
-
"import": "./
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
"./styles/index.css": "./dist/styles/index.css",
|
|
20
|
-
"./styles/*.css": "./dist/styles/*.css"
|
|
16
|
+
"types": "./src/index.ts",
|
|
17
|
+
"import": "./src/index.ts",
|
|
18
|
+
"default": "./src/index.ts"
|
|
19
|
+
}
|
|
21
20
|
},
|
|
22
21
|
"files": [
|
|
23
|
-
"
|
|
22
|
+
"src"
|
|
24
23
|
],
|
|
25
24
|
"keywords": [
|
|
26
25
|
"vue",
|
|
@@ -34,22 +33,19 @@
|
|
|
34
33
|
"access": "public",
|
|
35
34
|
"registry": "https://registry.npmjs.org/"
|
|
36
35
|
},
|
|
37
|
-
"dependencies": {
|
|
38
|
-
"@toife/core": "^1.0.5",
|
|
39
|
-
"@toife/gesture": "^1.1.8",
|
|
40
|
-
"@toife/sass-layer": "^1.3.0"
|
|
41
|
-
},
|
|
42
36
|
"peerDependencies": {
|
|
37
|
+
"@toife/core": "^1.0.6",
|
|
38
|
+
"@toife/gesture": "^1.1.8",
|
|
39
|
+
"@toife/sass-layer": "^1.3.0",
|
|
43
40
|
"vue": "^3.5.0",
|
|
44
41
|
"vue-router": "^4.0.0"
|
|
45
42
|
},
|
|
46
43
|
"scripts": {
|
|
47
44
|
"dev": "vite",
|
|
48
|
-
"typecheck": "tsc",
|
|
45
|
+
"typecheck": "tsc --noEmit",
|
|
49
46
|
"build": "vite build && vite build --config vite.styles.config.ts",
|
|
50
|
-
"prepublishOnly": "yarn build",
|
|
51
47
|
"format": "prettier . --write",
|
|
52
|
-
"prepare": "husky"
|
|
48
|
+
"prepare": "husky || true"
|
|
53
49
|
},
|
|
54
50
|
"lint-staged": {
|
|
55
51
|
"*.{js,ts,vue,json,css,scss,sass,md,html}": "prettier --write"
|
|
@@ -57,6 +53,9 @@
|
|
|
57
53
|
"devDependencies": {
|
|
58
54
|
"@commitlint/cli": "^20.4.4",
|
|
59
55
|
"@commitlint/config-conventional": "^20.4.4",
|
|
56
|
+
"@toife/core": "^1.0.6",
|
|
57
|
+
"@toife/gesture": "^1.1.8",
|
|
58
|
+
"@toife/sass-layer": "^1.3.0",
|
|
60
59
|
"@types/node": "^25.0.3",
|
|
61
60
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
62
61
|
"husky": "^9.1.7",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import { type ActionButton, type ActionComposableProps } from "@toife/core";
|
|
3
|
+
|
|
4
|
+
const data = ref<ActionComposableProps | null>(null);
|
|
5
|
+
const visible = ref(false);
|
|
6
|
+
|
|
7
|
+
export const useAction = () => {
|
|
8
|
+
const open = (props: ActionComposableProps) => {
|
|
9
|
+
data.value = props;
|
|
10
|
+
setTimeout(() => {
|
|
11
|
+
visible.value = true;
|
|
12
|
+
}, 50);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const close = (type?: string) => {
|
|
16
|
+
data.value?.onClose?.(type);
|
|
17
|
+
visible.value = false;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const choose = (btn: ActionButton) => {
|
|
21
|
+
data.value?.onChoose?.(btn);
|
|
22
|
+
visible.value = false;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
open,
|
|
27
|
+
close,
|
|
28
|
+
choose,
|
|
29
|
+
visible,
|
|
30
|
+
data,
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<Present
|
|
2
|
+
:placement="placement"
|
|
3
|
+
backdrop="display"
|
|
4
|
+
:keepalive="false"
|
|
5
|
+
:visible="visible"
|
|
6
|
+
@close="onClose"
|
|
7
|
+
>
|
|
8
|
+
<div v-bind="actionAttrs">
|
|
9
|
+
<slot name="body">
|
|
10
|
+
<FormGroup direction="vertical" v-for="(buttons, groupIndex) in actions" :key="groupIndex">
|
|
11
|
+
<CustomButton
|
|
12
|
+
v-for="(btn, btnIndex) in buttons"
|
|
13
|
+
:key="`${groupIndex}-${btnIndex}`"
|
|
14
|
+
:role="btn.role"
|
|
15
|
+
:variant="btn.variant"
|
|
16
|
+
@click="onChoose(btn)"
|
|
17
|
+
:shape="shape"
|
|
18
|
+
:shadow="btn.shadow !== undefined ? btn.shadow : shadow"
|
|
19
|
+
block
|
|
20
|
+
>{{ btn.text }}</CustomButton
|
|
21
|
+
>
|
|
22
|
+
</FormGroup>
|
|
23
|
+
</slot>
|
|
24
|
+
</div>
|
|
25
|
+
</Present>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<style lang="scss" src="@toife/core/features/action/action.scss" scoped></style>
|
|
2
|
+
<template src="./action.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { unref, computed, inject, ref } from "vue";
|
|
5
|
+
import { Present } from "../present";
|
|
6
|
+
import { Button as CustomButton } from "../button";
|
|
7
|
+
import { FormGroup } from "../form-group";
|
|
8
|
+
import {
|
|
9
|
+
ACTION_DEFAULT_PROPS,
|
|
10
|
+
APP_PROVIDER_STATE_KEY,
|
|
11
|
+
getActionAttrs,
|
|
12
|
+
type ActionButton,
|
|
13
|
+
type ActionEvent,
|
|
14
|
+
type ActionProps,
|
|
15
|
+
type AppProviderState,
|
|
16
|
+
} from "@toife/core";
|
|
17
|
+
import type { ProviderStateRefs } from "../../shared/provider-state";
|
|
18
|
+
|
|
19
|
+
// Component setup (props, emits, injects)
|
|
20
|
+
// ----------------------------------------------------------------------------
|
|
21
|
+
const props = withDefaults(defineProps<ActionProps>(), {
|
|
22
|
+
...ACTION_DEFAULT_PROPS,
|
|
23
|
+
});
|
|
24
|
+
const emit = defineEmits<ActionEvent>();
|
|
25
|
+
const appState = inject<ProviderStateRefs<AppProviderState>>(APP_PROVIDER_STATE_KEY);
|
|
26
|
+
|
|
27
|
+
// Reactive state
|
|
28
|
+
// ----------------------------------------------------------------------------
|
|
29
|
+
// Brief "pop" class toggle when backdrop is tapped but the sheet stays open (visual feedback)
|
|
30
|
+
const pop = ref(false);
|
|
31
|
+
|
|
32
|
+
// Computed properties
|
|
33
|
+
// ----------------------------------------------------------------------------
|
|
34
|
+
const actionAttrs = computed(() => {
|
|
35
|
+
const divider =
|
|
36
|
+
(props?.divider !== undefined ? props.divider : unref(appState?.divider)) ?? false;
|
|
37
|
+
const shadow = (props?.shadow !== undefined ? props.shadow : unref(appState?.shadow)) ?? false;
|
|
38
|
+
const shape = props.shape ?? unref(appState?.shape) ?? "";
|
|
39
|
+
const role = props.role ?? unref(appState?.role) ?? "";
|
|
40
|
+
return getActionAttrs({
|
|
41
|
+
role,
|
|
42
|
+
shape,
|
|
43
|
+
placement: props.placement,
|
|
44
|
+
divider,
|
|
45
|
+
shadow,
|
|
46
|
+
pop: pop.value,
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Methods
|
|
51
|
+
// ----------------------------------------------------------------------------
|
|
52
|
+
const onClose = (val: string) => {
|
|
53
|
+
// Named dismiss sources close the sheet; backdrop tap may only play feedback unless listed in dismiss
|
|
54
|
+
if (props.dismiss && props.dismiss.includes(val)) {
|
|
55
|
+
emit("close", val);
|
|
56
|
+
} else if (val === "backdrop") {
|
|
57
|
+
pop.value = true;
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
pop.value = false;
|
|
60
|
+
}, 300);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const onChoose = (btn: ActionButton) => {
|
|
65
|
+
emit("close");
|
|
66
|
+
btn.handler?.();
|
|
67
|
+
emit("choose", btn);
|
|
68
|
+
};
|
|
69
|
+
</script>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<div ref="rootEl" v-bind="appAttrs">
|
|
2
|
+
<slot />
|
|
3
|
+
<slot name="global"></slot>
|
|
4
|
+
<Toast placement="top-start" />
|
|
5
|
+
<Toast placement="bottom-start" />
|
|
6
|
+
<Toast placement="bottom-center" />
|
|
7
|
+
<Toast placement="bottom-end" />
|
|
8
|
+
<Toast placement="top-center" />
|
|
9
|
+
<Toast placement="top-end" />
|
|
10
|
+
<Action
|
|
11
|
+
v-if="action.data.value"
|
|
12
|
+
:visible="action.visible.value"
|
|
13
|
+
v-bind="action.data.value"
|
|
14
|
+
@close="action.close"
|
|
15
|
+
@choose="action.choose"
|
|
16
|
+
/>
|
|
17
|
+
<DecisionModal
|
|
18
|
+
v-if="decisionModal.data.value"
|
|
19
|
+
:visible="decisionModal.visible.value"
|
|
20
|
+
v-bind="decisionModal.data.value"
|
|
21
|
+
@close="decisionModal.close"
|
|
22
|
+
@choose="decisionModal.choose"
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<style lang="scss" src="@toife/core/features/app/app.scss" scoped></style>
|
|
2
|
+
<template src="./app.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { computed, provide, ref, toRefs, type Ref } from "vue";
|
|
5
|
+
import { Toast } from "../toast";
|
|
6
|
+
import { Action, useAction } from "../action";
|
|
7
|
+
import { DecisionModal, useDecisionModal } from "../decision-modal";
|
|
8
|
+
import {
|
|
9
|
+
APP_DEFAULT_PROPS,
|
|
10
|
+
APP_PROVIDER_STATE_KEY,
|
|
11
|
+
getAppAttrs,
|
|
12
|
+
type AppProps,
|
|
13
|
+
type AppProviderState,
|
|
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<AppProps>(), {
|
|
20
|
+
...APP_DEFAULT_PROPS,
|
|
21
|
+
});
|
|
22
|
+
const { shape, divider, role, shadow, triple, direction, data } = toRefs(props);
|
|
23
|
+
const decisionModal = useDecisionModal();
|
|
24
|
+
const action = useAction();
|
|
25
|
+
const rootEl = ref<HTMLElement>();
|
|
26
|
+
|
|
27
|
+
// Computed properties
|
|
28
|
+
// ----------------------------------------------------------------------------
|
|
29
|
+
// Root layout classes for the application shell (global theme layer)
|
|
30
|
+
const appAttrs = computed(() => getAppAttrs({ shape: shape.value }));
|
|
31
|
+
|
|
32
|
+
// Provide / expose (public API)
|
|
33
|
+
// ----------------------------------------------------------------------------
|
|
34
|
+
// Theme tokens for child components (shape, role, shadows, navigation direction)
|
|
35
|
+
provide<ProviderStateRefs<AppProviderState>>(APP_PROVIDER_STATE_KEY, {
|
|
36
|
+
shape,
|
|
37
|
+
divider,
|
|
38
|
+
role,
|
|
39
|
+
shadow,
|
|
40
|
+
triple,
|
|
41
|
+
direction,
|
|
42
|
+
rootEl: rootEl as Ref<HTMLElement | undefined>,
|
|
43
|
+
data,
|
|
44
|
+
});
|
|
45
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as App } from "./app.vue";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<style lang="scss" src="@toife/core/features/avatar/avatar.scss" scoped></style>
|
|
2
|
+
<template src="./avatar.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { unref, computed, inject } from "vue";
|
|
5
|
+
import {
|
|
6
|
+
AVATAR_DEFAULT_PROPS,
|
|
7
|
+
APP_PROVIDER_STATE_KEY,
|
|
8
|
+
getAvatarAttrs,
|
|
9
|
+
type AppProviderState,
|
|
10
|
+
type AvatarProps,
|
|
11
|
+
} from "@toife/core";
|
|
12
|
+
import type { ProviderStateRefs } from "../../shared/provider-state";
|
|
13
|
+
// Component setup (props, emits, injects)
|
|
14
|
+
// ----------------------------------------------------------------------------
|
|
15
|
+
const props = withDefaults(defineProps<AvatarProps>(), {
|
|
16
|
+
...AVATAR_DEFAULT_PROPS,
|
|
17
|
+
});
|
|
18
|
+
const appState = inject<ProviderStateRefs<AppProviderState>>(APP_PROVIDER_STATE_KEY);
|
|
19
|
+
|
|
20
|
+
// Computed properties
|
|
21
|
+
// ----------------------------------------------------------------------------
|
|
22
|
+
const avatarAttrs = computed(() => {
|
|
23
|
+
const shape = props?.shape || unref(appState?.shape) || "";
|
|
24
|
+
const role = props?.role || unref(appState?.role) || "";
|
|
25
|
+
const divider =
|
|
26
|
+
(props?.divider !== undefined ? props.divider : unref(appState?.divider)) ?? false;
|
|
27
|
+
return getAvatarAttrs({
|
|
28
|
+
role,
|
|
29
|
+
shape,
|
|
30
|
+
divider,
|
|
31
|
+
size: props.size,
|
|
32
|
+
src: props.src,
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Avatar } from "./avatar.vue";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<style lang="scss" src="@toife/core/features/button/button.scss" scoped></style>
|
|
2
|
+
<template src="./button.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { unref, computed, inject, ref } from "vue";
|
|
5
|
+
import {
|
|
6
|
+
BUTTON_DEFAULT_PROPS,
|
|
7
|
+
APP_PROVIDER_STATE_KEY,
|
|
8
|
+
getButtonAttrs,
|
|
9
|
+
getButtonLoaderAttrs,
|
|
10
|
+
type AppProviderState,
|
|
11
|
+
type ButtonProps,
|
|
12
|
+
} from "@toife/core";
|
|
13
|
+
import type { ProviderStateRefs } from "../../shared/provider-state";
|
|
14
|
+
// Component setup (props, emits, injects)
|
|
15
|
+
// ----------------------------------------------------------------------------
|
|
16
|
+
const props = withDefaults(defineProps<ButtonProps>(), {
|
|
17
|
+
...BUTTON_DEFAULT_PROPS,
|
|
18
|
+
});
|
|
19
|
+
const appState = inject<ProviderStateRefs<AppProviderState>>(APP_PROVIDER_STATE_KEY);
|
|
20
|
+
|
|
21
|
+
// Reactive state
|
|
22
|
+
// ----------------------------------------------------------------------------
|
|
23
|
+
const isFocused = ref(false);
|
|
24
|
+
|
|
25
|
+
// Computed properties
|
|
26
|
+
// ----------------------------------------------------------------------------
|
|
27
|
+
const buttonAttrs = computed(() => {
|
|
28
|
+
const shape = props.shape || unref(appState?.shape) || "";
|
|
29
|
+
const role = props.role || unref(appState?.role) || "";
|
|
30
|
+
const shadow = (props?.shadow !== undefined ? props.shadow : unref(appState?.shadow)) ?? false;
|
|
31
|
+
|
|
32
|
+
return getButtonAttrs({
|
|
33
|
+
role,
|
|
34
|
+
shape,
|
|
35
|
+
variant: props.variant,
|
|
36
|
+
size: props.size,
|
|
37
|
+
block: props.block,
|
|
38
|
+
shadow,
|
|
39
|
+
focus: isFocused.value,
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const loaderAttrs = getButtonLoaderAttrs();
|
|
44
|
+
|
|
45
|
+
// Methods
|
|
46
|
+
// ----------------------------------------------------------------------------
|
|
47
|
+
const onFocus = () => {
|
|
48
|
+
isFocused.value = true;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const onBlur = () => {
|
|
52
|
+
isFocused.value = false;
|
|
53
|
+
};
|
|
54
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Button } from "./button.vue";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<style lang="scss" src="@toife/core/features/cable/cable.scss" scoped></style>
|
|
2
|
+
<template src="./cable.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { computed, provide, toRefs } from "vue";
|
|
5
|
+
import {
|
|
6
|
+
CABLE_DEFAULT_PROPS,
|
|
7
|
+
CABLE_PROVIDER_STATE_KEY,
|
|
8
|
+
getCableAttrs,
|
|
9
|
+
type CableProps,
|
|
10
|
+
type CableProviderState,
|
|
11
|
+
} from "@toife/core";
|
|
12
|
+
import type { ProviderStateRefs } from "../../shared/provider-state";
|
|
13
|
+
|
|
14
|
+
// Component setup (props, emits, injects)
|
|
15
|
+
// ----------------------------------------------------------------------------
|
|
16
|
+
const props = withDefaults(defineProps<CableProps>(), {
|
|
17
|
+
...CABLE_DEFAULT_PROPS,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Reactive state
|
|
21
|
+
// ----------------------------------------------------------------------------
|
|
22
|
+
const { placement } = toRefs(props);
|
|
23
|
+
|
|
24
|
+
// Computed properties
|
|
25
|
+
// ----------------------------------------------------------------------------
|
|
26
|
+
const cableAttrs = computed(() => getCableAttrs({ placement: placement.value }));
|
|
27
|
+
|
|
28
|
+
// Provide / expose (public API)
|
|
29
|
+
// ----------------------------------------------------------------------------
|
|
30
|
+
provide<ProviderStateRefs<CableProviderState>>(CABLE_PROVIDER_STATE_KEY, {
|
|
31
|
+
placement,
|
|
32
|
+
});
|
|
33
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Cable } from "./cable.vue";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<style lang="scss" src="@toife/core/features/card/card.scss"></style>
|
|
2
|
+
<template src="./card.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { unref, computed, inject, provide } from "vue";
|
|
5
|
+
import {
|
|
6
|
+
CARD_DEFAULT_PROPS,
|
|
7
|
+
APP_PROVIDER_STATE_KEY,
|
|
8
|
+
CARD_PROVIDER_STATE_KEY,
|
|
9
|
+
getCardAttrs,
|
|
10
|
+
type AppProviderState,
|
|
11
|
+
type CardProps,
|
|
12
|
+
type CardProviderState,
|
|
13
|
+
} from "@toife/core";
|
|
14
|
+
import type { ProviderStateRefs } from "../../../shared/provider-state";
|
|
15
|
+
|
|
16
|
+
// Component setup (props, emits, injects)
|
|
17
|
+
// ----------------------------------------------------------------------------
|
|
18
|
+
const props = withDefaults(defineProps<CardProps>(), {
|
|
19
|
+
...CARD_DEFAULT_PROPS,
|
|
20
|
+
});
|
|
21
|
+
const appState = inject<ProviderStateRefs<AppProviderState>>(APP_PROVIDER_STATE_KEY);
|
|
22
|
+
|
|
23
|
+
// Computed properties
|
|
24
|
+
// ----------------------------------------------------------------------------
|
|
25
|
+
const divider = computed(() => {
|
|
26
|
+
return (props?.divider !== undefined ? props.divider : unref(appState?.divider)) ?? false;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const shape = computed(() => {
|
|
30
|
+
return props?.shape || unref(appState?.shape) || "";
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const role = computed(() => {
|
|
34
|
+
return props.role || unref(appState?.role) || "";
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const cardAttrs = computed(() =>
|
|
38
|
+
getCardAttrs({
|
|
39
|
+
role: role.value,
|
|
40
|
+
shape: shape.value,
|
|
41
|
+
divider: divider.value,
|
|
42
|
+
})
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
// Provide / expose (public API)
|
|
46
|
+
// ----------------------------------------------------------------------------
|
|
47
|
+
provide<ProviderStateRefs<CardProviderState>>(CARD_PROVIDER_STATE_KEY, {
|
|
48
|
+
role,
|
|
49
|
+
shape,
|
|
50
|
+
divider,
|
|
51
|
+
});
|
|
52
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Card } from "./card.vue";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CardBody } from "./card-body.vue";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<style lang="scss" src="@toife/core/features/card/card-footer.scss"></style>
|
|
2
|
+
<template src="./card-footer.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { computed, inject, unref } from "vue";
|
|
5
|
+
import { CARD_PROVIDER_STATE_KEY, getCardFooterAttrs, type CardProviderState } from "@toife/core";
|
|
6
|
+
import type { ProviderStateRefs } from "../../../shared/provider-state";
|
|
7
|
+
|
|
8
|
+
// Component setup (props, emits, injects)
|
|
9
|
+
// ----------------------------------------------------------------------------
|
|
10
|
+
const cardProviderState = inject<ProviderStateRefs<CardProviderState>>(CARD_PROVIDER_STATE_KEY);
|
|
11
|
+
|
|
12
|
+
// Computed properties
|
|
13
|
+
// ----------------------------------------------------------------------------
|
|
14
|
+
const cardFooterAttrs = computed(() => {
|
|
15
|
+
const divider = unref(cardProviderState?.divider) ?? false;
|
|
16
|
+
return getCardFooterAttrs({ divider });
|
|
17
|
+
});
|
|
18
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CardFooter } from "./card-footer.vue";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<style lang="scss" src="@toife/core/features/card/card-header.scss"></style>
|
|
2
|
+
<template src="./card-header.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { computed, inject, unref } from "vue";
|
|
5
|
+
import { CARD_PROVIDER_STATE_KEY, getCardHeaderAttrs, type CardProviderState } from "@toife/core";
|
|
6
|
+
import type { ProviderStateRefs } from "../../../shared/provider-state";
|
|
7
|
+
|
|
8
|
+
// Component setup (props, emits, injects)
|
|
9
|
+
// ----------------------------------------------------------------------------
|
|
10
|
+
const cardProviderState = inject<ProviderStateRefs<CardProviderState>>(CARD_PROVIDER_STATE_KEY);
|
|
11
|
+
|
|
12
|
+
// Computed properties
|
|
13
|
+
// ----------------------------------------------------------------------------
|
|
14
|
+
const cardHeaderAttrs = computed(() => {
|
|
15
|
+
const divider = unref(cardProviderState?.divider) ?? false;
|
|
16
|
+
return getCardHeaderAttrs({ divider });
|
|
17
|
+
});
|
|
18
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CardHeader } from "./card-header.vue";
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<style lang="scss" src="@toife/core/features/checkbox/checkbox.scss" scoped></style>
|
|
2
|
+
<template src="./checkbox.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { unref, computed, inject, ref } from "vue";
|
|
5
|
+
import {
|
|
6
|
+
CHECKBOX_DEFAULT_PROPS,
|
|
7
|
+
APP_PROVIDER_STATE_KEY,
|
|
8
|
+
getCheckboxAttrs,
|
|
9
|
+
getCheckboxIconAttrs,
|
|
10
|
+
type AppProviderState,
|
|
11
|
+
type CheckboxEvent,
|
|
12
|
+
type CheckboxProps,
|
|
13
|
+
} from "@toife/core";
|
|
14
|
+
import type { ProviderStateRefs } from "../../shared/provider-state";
|
|
15
|
+
|
|
16
|
+
// Component setup (props, emits, injects)
|
|
17
|
+
// ----------------------------------------------------------------------------
|
|
18
|
+
const props = withDefaults(defineProps<CheckboxProps>(), {
|
|
19
|
+
...CHECKBOX_DEFAULT_PROPS,
|
|
20
|
+
});
|
|
21
|
+
const emit = defineEmits<CheckboxEvent>();
|
|
22
|
+
const appState = inject<ProviderStateRefs<AppProviderState>>(APP_PROVIDER_STATE_KEY);
|
|
23
|
+
|
|
24
|
+
// Reactive state
|
|
25
|
+
// ----------------------------------------------------------------------------
|
|
26
|
+
const isFocused = ref(false);
|
|
27
|
+
|
|
28
|
+
// Computed properties
|
|
29
|
+
// ----------------------------------------------------------------------------
|
|
30
|
+
const checkboxAttrs = computed(() => {
|
|
31
|
+
const baseRole = unref(appState?.role) || "";
|
|
32
|
+
const role = props.role || baseRole;
|
|
33
|
+
const shape = props.shape || unref(appState?.shape) || "";
|
|
34
|
+
const shadow = (props?.shadow !== undefined ? props.shadow : unref(appState?.shadow)) ?? false;
|
|
35
|
+
return getCheckboxAttrs({
|
|
36
|
+
role,
|
|
37
|
+
shape,
|
|
38
|
+
size: props.size,
|
|
39
|
+
variant: props.variant,
|
|
40
|
+
modelValue: props.modelValue,
|
|
41
|
+
disabled: props.disabled,
|
|
42
|
+
readonly: props.readonly,
|
|
43
|
+
shadow: shadow && !props.disabled && isFocused.value,
|
|
44
|
+
focus: isFocused.value,
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const checkboxIconAttrs = getCheckboxIconAttrs();
|
|
49
|
+
|
|
50
|
+
// Methods
|
|
51
|
+
// ----------------------------------------------------------------------------
|
|
52
|
+
const onCheckbox = () => {
|
|
53
|
+
if (props.disabled || props.readonly) return;
|
|
54
|
+
emit("update:modelValue", !props.modelValue);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const onFocus = () => {
|
|
58
|
+
if (props.disabled || props.readonly) return;
|
|
59
|
+
isFocused.value = true;
|
|
60
|
+
emit("focus");
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const onBlur = () => {
|
|
64
|
+
if (props.disabled || props.readonly) return;
|
|
65
|
+
isFocused.value = false;
|
|
66
|
+
emit("blur");
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const onKeydown = (e: KeyboardEvent) => {
|
|
70
|
+
if (e.key !== " " && e.key !== "Enter") return;
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
onCheckbox();
|
|
73
|
+
};
|
|
74
|
+
</script>
|