@toife/vue 3.1.6 → 3.2.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/README.md +1 -52
- 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 +32 -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 +11 -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 +17 -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/factory.d.ts +38 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +3491 -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 +40 -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/types.d.ts +4 -0
- package/package.json +23 -13
- package/src/components/action/action.composable.ts +0 -32
- package/src/components/action/action.html +0 -25
- package/src/components/action/action.scss +0 -106
- package/src/components/action/action.type.ts +0 -44
- package/src/components/action/action.vue +0 -72
- package/src/components/action/index.ts +0 -9
- package/src/components/app/app.constants.ts +0 -1
- package/src/components/app/app.html +0 -24
- package/src/components/app/app.scss +0 -27
- package/src/components/app/app.type.ts +0 -30
- package/src/components/app/app.vue +0 -46
- package/src/components/app/index.ts +0 -3
- package/src/components/avatar/avatar.html +0 -3
- package/src/components/avatar/avatar.scss +0 -45
- package/src/components/avatar/avatar.type.ts +0 -8
- package/src/components/avatar/avatar.vue +0 -44
- package/src/components/avatar/index.ts +0 -2
- package/src/components/button/button.html +0 -6
- package/src/components/button/button.scss +0 -124
- package/src/components/button/button.type.ts +0 -14
- package/src/components/button/button.vue +0 -61
- package/src/components/button/index.ts +0 -2
- package/src/components/cable/cable.constants.ts +0 -1
- package/src/components/cable/cable.html +0 -3
- package/src/components/cable/cable.scss +0 -37
- package/src/components/cable/cable.type.ts +0 -11
- package/src/components/cable/cable.vue +0 -33
- package/src/components/cable/index.ts +0 -3
- package/src/components/card/card/card.constants.ts +0 -1
- package/src/components/card/card/card.html +0 -3
- package/src/components/card/card/card.scss +0 -37
- package/src/components/card/card/card.type.ts +0 -14
- package/src/components/card/card/card.vue +0 -62
- package/src/components/card/card/index.ts +0 -3
- package/src/components/card/card-body/card-body.html +0 -3
- package/src/components/card/card-body/card-body.scss +0 -23
- package/src/components/card/card-body/card-body.vue +0 -9
- 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.scss +0 -32
- package/src/components/card/card-footer/card-footer.vue +0 -25
- 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.scss +0 -32
- package/src/components/card/card-header/card-header.vue +0 -25
- 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.scss +0 -150
- package/src/components/checkbox/checkbox.type.ts +0 -19
- package/src/components/checkbox/checkbox.vue +0 -80
- package/src/components/checkbox/index.ts +0 -2
- package/src/components/collapse/collapse.html +0 -16
- package/src/components/collapse/collapse.scss +0 -56
- package/src/components/collapse/collapse.type.ts +0 -11
- package/src/components/collapse/collapse.vue +0 -127
- package/src/components/collapse/index.ts +0 -2
- package/src/components/container/container.html +0 -1
- package/src/components/container/container.scss +0 -10
- package/src/components/container/container.vue +0 -10
- 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.scss +0 -144
- package/src/components/decision-modal/decision-modal.type.ts +0 -35
- package/src/components/decision-modal/decision-modal.vue +0 -96
- package/src/components/decision-modal/index.ts +0 -9
- package/src/components/divider/divider.html +0 -1
- package/src/components/divider/divider.scss +0 -29
- package/src/components/divider/divider.type.ts +0 -6
- package/src/components/divider/divider.vue +0 -31
- package/src/components/divider/index.ts +0 -2
- package/src/components/dropdown/dropdown.html +0 -6
- package/src/components/dropdown/dropdown.scss +0 -71
- package/src/components/dropdown/dropdown.type.ts +0 -22
- package/src/components/dropdown/dropdown.vue +0 -111
- package/src/components/dropdown/index.ts +0 -2
- package/src/components/field/field.html +0 -31
- package/src/components/field/field.scss +0 -184
- package/src/components/field/field.type.ts +0 -43
- package/src/components/field/field.vue +0 -123
- package/src/components/field/index.ts +0 -2
- package/src/components/form-group/form-group.html +0 -3
- package/src/components/form-group/form-group.scss +0 -91
- package/src/components/form-group/form-group.type.ts +0 -5
- package/src/components/form-group/form-group.vue +0 -21
- package/src/components/form-group/index.ts +0 -2
- package/src/components/gesture-indicator/gesture-indicator.html +0 -1
- package/src/components/gesture-indicator/gesture-indicator.scss +0 -47
- package/src/components/gesture-indicator/gesture-indicator.type.ts +0 -5
- package/src/components/gesture-indicator/gesture-indicator.vue +0 -31
- package/src/components/gesture-indicator/index.ts +0 -1
- package/src/components/image/image.html +0 -1
- package/src/components/image/image.type.ts +0 -5
- package/src/components/image/image.vue +0 -29
- package/src/components/image/index.ts +0 -2
- package/src/components/index.ts +0 -31
- package/src/components/layout/flex/flex.html +0 -1
- package/src/components/layout/flex/flex.scss +0 -57
- package/src/components/layout/flex/flex.type.ts +0 -15
- package/src/components/layout/flex/flex.vue +0 -34
- package/src/components/layout/flex/index.ts +0 -2
- package/src/components/layout/flex-item/flex-item.html +0 -1
- package/src/components/layout/flex-item/flex-item.scss +0 -48
- package/src/components/layout/flex-item/flex-item.type.ts +0 -11
- package/src/components/layout/flex-item/flex-item.vue +0 -27
- package/src/components/layout/flex-item/index.ts +0 -2
- package/src/components/layout/grid/grid.html +0 -1
- package/src/components/layout/grid/grid.scss +0 -51
- package/src/components/layout/grid/grid.type.ts +0 -12
- package/src/components/layout/grid/grid.vue +0 -32
- package/src/components/layout/grid/index.ts +0 -2
- package/src/components/layout/grid-item/grid-item.html +0 -1
- package/src/components/layout/grid-item/grid-item.scss +0 -49
- package/src/components/layout/grid-item/grid-item.type.ts +0 -14
- package/src/components/layout/grid-item/grid-item.vue +0 -27
- package/src/components/layout/grid-item/index.ts +0 -2
- package/src/components/layout/index.ts +0 -4
- package/src/components/modal/index.ts +0 -2
- package/src/components/modal/modal.html +0 -20
- package/src/components/modal/modal.scss +0 -80
- package/src/components/modal/modal.type.ts +0 -21
- package/src/components/modal/modal.vue +0 -251
- package/src/components/page/index.ts +0 -1
- package/src/components/page/page.html +0 -3
- package/src/components/page/page.scss +0 -17
- package/src/components/page/page.vue +0 -10
- package/src/components/present/index.ts +0 -3
- package/src/components/present/present.composable.ts +0 -22
- package/src/components/present/present.html +0 -9
- package/src/components/present/present.scss +0 -81
- package/src/components/present/present.type.ts +0 -26
- package/src/components/present/present.vue +0 -198
- package/src/components/radio/index.ts +0 -2
- package/src/components/radio/radio/index.ts +0 -2
- package/src/components/radio/radio/radio.html +0 -11
- package/src/components/radio/radio/radio.scss +0 -142
- package/src/components/radio/radio/radio.type.ts +0 -13
- package/src/components/radio/radio/radio.vue +0 -87
- package/src/components/radio/radio-group/index.ts +0 -7
- package/src/components/radio/radio-group/radio-group.constants.ts +0 -1
- package/src/components/radio/radio-group/radio-group.html +0 -3
- package/src/components/radio/radio-group/radio-group.scss +0 -16
- package/src/components/radio/radio-group/radio-group.type.ts +0 -28
- package/src/components/radio/radio-group/radio-group.vue +0 -57
- package/src/components/refresher/index.ts +0 -2
- package/src/components/refresher/refresher.html +0 -3
- package/src/components/refresher/refresher.scss +0 -18
- package/src/components/refresher/refresher.type.ts +0 -16
- package/src/components/refresher/refresher.vue +0 -123
- package/src/components/route/index.ts +0 -5
- package/src/components/route/route-navigator/index.ts +0 -2
- package/src/components/route/route-navigator/route-navigator.html +0 -19
- package/src/components/route/route-navigator/route-navigator.scss +0 -127
- package/src/components/route/route-navigator/route-navigator.type.ts +0 -36
- package/src/components/route/route-navigator/route-navigator.vue +0 -275
- 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 -3
- package/src/components/route/route-provider/route-provider.constant.ts +0 -1
- package/src/components/route/route-provider/route-provider.html +0 -1
- package/src/components/route/route-provider/route-provider.type.ts +0 -10
- package/src/components/route/route-provider/route-provider.vue +0 -20
- package/src/components/route/route-wrapper/index.ts +0 -3
- 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.type.ts +0 -3
- package/src/components/route/route-wrapper/route-wrapper.vue +0 -45
- package/src/components/route/route.type.ts +0 -7
- package/src/components/route/route.util.ts +0 -9
- package/src/components/segmented-field/index.ts +0 -7
- package/src/components/segmented-field/segmented-field.html +0 -17
- package/src/components/segmented-field/segmented-field.scss +0 -53
- package/src/components/segmented-field/segmented-field.type.ts +0 -29
- package/src/components/segmented-field/segmented-field.vue +0 -145
- package/src/components/select/index.ts +0 -2
- package/src/components/select/select.html +0 -29
- package/src/components/select/select.scss +0 -129
- package/src/components/select/select.type.ts +0 -45
- package/src/components/select/select.vue +0 -119
- package/src/components/skeleton/index.ts +0 -2
- package/src/components/skeleton/skeleton.html +0 -1
- package/src/components/skeleton/skeleton.scss +0 -52
- package/src/components/skeleton/skeleton.type.ts +0 -7
- package/src/components/skeleton/skeleton.vue +0 -38
- package/src/components/slide-range/index.ts +0 -2
- package/src/components/slide-range/slide-range.html +0 -19
- package/src/components/slide-range/slide-range.scss +0 -164
- package/src/components/slide-range/slide-range.type.ts +0 -16
- package/src/components/slide-range/slide-range.vue +0 -230
- package/src/components/switch/index.ts +0 -2
- package/src/components/switch/switch.html +0 -14
- package/src/components/switch/switch.scss +0 -128
- package/src/components/switch/switch.type.ts +0 -17
- package/src/components/switch/switch.vue +0 -97
- package/src/components/tabs/index.ts +0 -2
- package/src/components/tabs/tab/index.ts +0 -2
- package/src/components/tabs/tab/tab.html +0 -5
- package/src/components/tabs/tab/tab.scss +0 -13
- package/src/components/tabs/tab/tab.type.ts +0 -5
- package/src/components/tabs/tab/tab.vue +0 -40
- package/src/components/tabs/tabs/index.ts +0 -10
- package/src/components/tabs/tabs/tabs.constants.ts +0 -1
- package/src/components/tabs/tabs/tabs.html +0 -3
- package/src/components/tabs/tabs/tabs.scss +0 -337
- package/src/components/tabs/tabs/tabs.type.ts +0 -38
- package/src/components/tabs/tabs/tabs.vue +0 -177
- package/src/components/toast/index.ts +0 -4
- package/src/components/toast/toast/index.ts +0 -1
- package/src/components/toast/toast/toast.html +0 -9
- package/src/components/toast/toast/toast.scss +0 -61
- package/src/components/toast/toast/toast.vue +0 -34
- 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.scss +0 -42
- package/src/components/toast/toast-content/toast-content.vue +0 -53
- package/src/components/toast/toast.composable.ts +0 -22
- package/src/components/toast/toast.type.ts +0 -25
- package/src/components/toolbar/index.ts +0 -2
- package/src/components/toolbar/toolbar.html +0 -3
- package/src/components/toolbar/toolbar.scss +0 -64
- package/src/components/toolbar/toolbar.type.ts +0 -7
- package/src/components/toolbar/toolbar.vue +0 -41
- package/src/env.d.ts +0 -7
- package/src/factory.ts +0 -152
- package/src/index.ts +0 -4
- package/src/type.ts +0 -4
- package/src/utils/element.md +0 -33
- package/src/utils/element.ts +0 -22
- package/src/utils/events.md +0 -29
- package/src/utils/events.ts +0 -18
- package/src/utils/index.ts +0 -3
- package/src/utils/style/index.ts +0 -57
- package/src/utils/style.md +0 -49
package/package.json
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toife/vue",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "A Frontend framework for Vue",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"sideEffects":
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"dist/**/*.css"
|
|
8
|
+
],
|
|
9
|
+
"main": "dist/index.umd.js",
|
|
10
|
+
"module": "dist/index.es.js",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
10
12
|
"exports": {
|
|
11
13
|
".": {
|
|
12
|
-
"types": "./
|
|
13
|
-
"import": "./
|
|
14
|
-
"
|
|
15
|
-
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.es.js",
|
|
16
|
+
"require": "./dist/index.umd.js",
|
|
17
|
+
"default": "./dist/index.es.js"
|
|
18
|
+
},
|
|
19
|
+
"./styles/index.css": "./dist/styles/index.css",
|
|
20
|
+
"./styles/*.css": "./dist/styles/*.css"
|
|
16
21
|
},
|
|
17
22
|
"files": [
|
|
18
|
-
"
|
|
23
|
+
"dist"
|
|
19
24
|
],
|
|
20
25
|
"keywords": [
|
|
21
26
|
"vue",
|
|
@@ -29,6 +34,11 @@
|
|
|
29
34
|
"access": "public",
|
|
30
35
|
"registry": "https://registry.npmjs.org/"
|
|
31
36
|
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@toife/core": "^1.0.0",
|
|
39
|
+
"@toife/gesture": "^1.1.8",
|
|
40
|
+
"@toife/sass-layer": "^1.2.2"
|
|
41
|
+
},
|
|
32
42
|
"peerDependencies": {
|
|
33
43
|
"vue": "^3.5.0",
|
|
34
44
|
"vue-router": "^4.0.0"
|
|
@@ -36,7 +46,8 @@
|
|
|
36
46
|
"scripts": {
|
|
37
47
|
"dev": "vite",
|
|
38
48
|
"typecheck": "tsc",
|
|
39
|
-
"build": "vite build",
|
|
49
|
+
"build": "vite build && vite build --config vite.styles.config.ts",
|
|
50
|
+
"prepublishOnly": "yarn build",
|
|
40
51
|
"format": "prettier . --write",
|
|
41
52
|
"prepare": "husky"
|
|
42
53
|
},
|
|
@@ -46,8 +57,6 @@
|
|
|
46
57
|
"devDependencies": {
|
|
47
58
|
"@commitlint/cli": "^20.4.4",
|
|
48
59
|
"@commitlint/config-conventional": "^20.4.4",
|
|
49
|
-
"@toife/gesture": "^1.1.6",
|
|
50
|
-
"@toife/sass-layer": "^1.1.2",
|
|
51
60
|
"@types/node": "^25.0.3",
|
|
52
61
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
53
62
|
"husky": "^9.1.7",
|
|
@@ -56,6 +65,7 @@
|
|
|
56
65
|
"sass": "^1.90.0",
|
|
57
66
|
"typescript": "^5.9.2",
|
|
58
67
|
"vite": "^7.0.6",
|
|
68
|
+
"vite-plugin-dts": "^4.5.4",
|
|
59
69
|
"vue": "^3.5.0",
|
|
60
70
|
"vue-router": "^4.0.0"
|
|
61
71
|
},
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
2
|
-
import type { ActionButton, ActionComposableProps } from "./action.type";
|
|
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
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
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>
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
@use "@toife/sass-layer" as sass;
|
|
2
|
-
|
|
3
|
-
// Class name
|
|
4
|
-
$action: sass.fn-naming-prefix("action");
|
|
5
|
-
$button: sass.fn-naming-prefix("button");
|
|
6
|
-
|
|
7
|
-
// Property name - layer: action
|
|
8
|
-
$action-border-color: sass.fn-naming-var("action", "border-color");
|
|
9
|
-
|
|
10
|
-
$margin-y: sass.fn-naming-var("spacing", "y");
|
|
11
|
-
$margin-x: sass.fn-naming-var("spacing", "x");
|
|
12
|
-
$width: sass.fn-naming-var("viewport", "width");
|
|
13
|
-
$max-width: sass.fn-naming-var("overlay", "max-width");
|
|
14
|
-
$height: sass.fn-naming-var("viewport", "height");
|
|
15
|
-
$max-height: sass.fn-naming-var("overlay", "max-height");
|
|
16
|
-
$transition-duration: sass.fn-naming-var("duration");
|
|
17
|
-
$safe-area-bottom: sass.fn-naming-var("safe-area", "bottom");
|
|
18
|
-
$safe-area-top: sass.fn-naming-var("safe-area", "top");
|
|
19
|
-
$safe-area-left: sass.fn-naming-var("safe-area", "left");
|
|
20
|
-
$safe-area-right: sass.fn-naming-var("safe-area", "right");
|
|
21
|
-
$border-width: sass.fn-naming-var("stroke", "width");
|
|
22
|
-
|
|
23
|
-
.#{$action} {
|
|
24
|
-
// Styles
|
|
25
|
-
display: flex;
|
|
26
|
-
flex-direction: column;
|
|
27
|
-
justify-content: center;
|
|
28
|
-
align-items: center;
|
|
29
|
-
column-gap: calc(#{$margin-y} * 2);
|
|
30
|
-
row-gap: calc(#{$margin-x} * 2);
|
|
31
|
-
border-width: #{$border-width};
|
|
32
|
-
|
|
33
|
-
&.top,
|
|
34
|
-
&.bottom {
|
|
35
|
-
width: #{$width};
|
|
36
|
-
|
|
37
|
-
> div {
|
|
38
|
-
width: 100%;
|
|
39
|
-
max-width: #{$max-width};
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
&.bottom {
|
|
44
|
-
margin-bottom: calc(#{$margin-y} * 4 + #{$safe-area-bottom});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&.top {
|
|
48
|
-
margin-top: calc(#{$margin-y} * 4 + #{$safe-area-top});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
&.left,
|
|
52
|
-
&.right {
|
|
53
|
-
> div {
|
|
54
|
-
width: 100%;
|
|
55
|
-
max-width: #{$max-width};
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&.left {
|
|
60
|
-
margin-left: calc(#{$margin-x} * 4 + #{$safe-area-left});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
&.right {
|
|
64
|
-
margin-right: calc(#{$margin-x} * 4 + #{$safe-area-right});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
&.pop {
|
|
68
|
-
animation: pop #{$transition-duration} ease-in-out;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
&.divider {
|
|
72
|
-
:deep(.#{$button}) {
|
|
73
|
-
border-color: transparent;
|
|
74
|
-
border-bottom-color: rgba(#{$action-border-color});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
&:not(.divider) {
|
|
79
|
-
:deep(.#{$button}) {
|
|
80
|
-
border-color: transparent;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Effect when click outside action modal
|
|
86
|
-
@keyframes pop {
|
|
87
|
-
0% {
|
|
88
|
-
transform: scale(1);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
50% {
|
|
92
|
-
transform: scale(1.1);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
70% {
|
|
96
|
-
transform: scale(1);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
80% {
|
|
100
|
-
transform: scale(1.1);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
100% {
|
|
104
|
-
transform: scale(1);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { ButtonVariant } from "../button/button.type";
|
|
2
|
-
import { PresentPlacement } from "../present";
|
|
3
|
-
|
|
4
|
-
export type ActionPlacement = PresentPlacement;
|
|
5
|
-
|
|
6
|
-
// Type definitions
|
|
7
|
-
export type ActionButton = {
|
|
8
|
-
text?: string;
|
|
9
|
-
role?: string;
|
|
10
|
-
variant?: ButtonVariant;
|
|
11
|
-
shadow?: boolean;
|
|
12
|
-
handler?: () => void;
|
|
13
|
-
data?: unknown;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Action Props Type
|
|
18
|
-
*/
|
|
19
|
-
export type ActionProps = {
|
|
20
|
-
visible?: boolean;
|
|
21
|
-
dismiss?: string[];
|
|
22
|
-
actions: Array<ActionButton[]>;
|
|
23
|
-
role?: string;
|
|
24
|
-
shape?: string;
|
|
25
|
-
divider?: boolean;
|
|
26
|
-
shadow?: boolean;
|
|
27
|
-
placement?: ActionPlacement;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Action Composable Props Type
|
|
32
|
-
*/
|
|
33
|
-
export type ActionComposableProps = ActionProps & {
|
|
34
|
-
onClose?: (type?: string) => void;
|
|
35
|
-
onChoose?: (btn?: ActionButton) => void;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Action Emit Type
|
|
40
|
-
*/
|
|
41
|
-
export type ActionEmit = {
|
|
42
|
-
(e: "close", type?: string): void;
|
|
43
|
-
(e: "choose", btn: ActionButton): void;
|
|
44
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
<style lang="scss" src="./action.scss" scoped></style>
|
|
2
|
-
<template src="./action.html"></template>
|
|
3
|
-
<script lang="ts" setup>
|
|
4
|
-
import { 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 { type ActionEmit, type ActionButton, type ActionProps } from "./action.type";
|
|
9
|
-
import { cssPrefix } from "../../utils";
|
|
10
|
-
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
|
|
11
|
-
|
|
12
|
-
// Component setup (props, emits, injects)
|
|
13
|
-
// ----------------------------------------------------------------------------
|
|
14
|
-
const props = withDefaults(defineProps<ActionProps>(), {
|
|
15
|
-
visible: false,
|
|
16
|
-
shape: undefined,
|
|
17
|
-
role: undefined,
|
|
18
|
-
placement: "bottom",
|
|
19
|
-
divider: undefined,
|
|
20
|
-
shadow: undefined,
|
|
21
|
-
});
|
|
22
|
-
const emit = defineEmits<ActionEmit>();
|
|
23
|
-
const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
|
|
24
|
-
|
|
25
|
-
// Reactive state
|
|
26
|
-
// ----------------------------------------------------------------------------
|
|
27
|
-
// Brief "pop" class toggle when backdrop is tapped but the sheet stays open (visual feedback)
|
|
28
|
-
const pop = ref(false);
|
|
29
|
-
|
|
30
|
-
// Computed properties
|
|
31
|
-
// ----------------------------------------------------------------------------
|
|
32
|
-
const actionAttrs = computed(() => {
|
|
33
|
-
const divider = (props?.divider !== undefined ? props.divider : appState?.divider.value) ?? false;
|
|
34
|
-
const shadow = (props?.shadow !== undefined ? props.shadow : appState?.shadow.value) ?? false;
|
|
35
|
-
const shape = props.shape ?? appState?.shape.value ?? "";
|
|
36
|
-
const role = props.role ?? appState?.role.value ?? "";
|
|
37
|
-
return {
|
|
38
|
-
class: [
|
|
39
|
-
cssPrefix("action"),
|
|
40
|
-
cssPrefix(["layer", "action"]),
|
|
41
|
-
cssPrefix(["role", role]),
|
|
42
|
-
cssPrefix(["shape", shape]),
|
|
43
|
-
props.placement,
|
|
44
|
-
{
|
|
45
|
-
pop: pop.value,
|
|
46
|
-
divider,
|
|
47
|
-
shadow,
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// Methods
|
|
54
|
-
// ----------------------------------------------------------------------------
|
|
55
|
-
const onClose = (val: string) => {
|
|
56
|
-
// Named dismiss sources close the sheet; backdrop tap may only play feedback unless listed in dismiss
|
|
57
|
-
if (props.dismiss && props.dismiss.includes(val)) {
|
|
58
|
-
emit("close", val);
|
|
59
|
-
} else if (val === "backdrop") {
|
|
60
|
-
pop.value = true;
|
|
61
|
-
setTimeout(() => {
|
|
62
|
-
pop.value = false;
|
|
63
|
-
}, 300);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const onChoose = (btn: ActionButton) => {
|
|
68
|
-
emit("close");
|
|
69
|
-
btn.handler?.();
|
|
70
|
-
emit("choose", btn);
|
|
71
|
-
};
|
|
72
|
-
</script>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const APP_PROVIDER_STATE_KEY = "app-state";
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<div 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>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
@use "@toife/sass-layer" as sass;
|
|
2
|
-
|
|
3
|
-
// Class name
|
|
4
|
-
$app: sass.fn-naming-prefix("app");
|
|
5
|
-
|
|
6
|
-
// Property name - layer: app
|
|
7
|
-
$app-background-color: sass.fn-naming-var("app", "background-color");
|
|
8
|
-
$app-color: sass.fn-naming-var("app", "color");
|
|
9
|
-
$transition-duration: sass.fn-naming-var("duration");
|
|
10
|
-
|
|
11
|
-
.#{$app} {
|
|
12
|
-
width: #{sass.fn-naming-var("viewport", "width")};
|
|
13
|
-
max-width: #{sass.fn-naming-var("viewport", "max-width")};
|
|
14
|
-
height: #{sass.fn-naming-var("viewport", "height")};
|
|
15
|
-
max-height: #{sass.fn-naming-var("viewport", "max-height")};
|
|
16
|
-
background-color: rgba(#{$app-background-color});
|
|
17
|
-
color: rgba(#{$app-color});
|
|
18
|
-
transition:
|
|
19
|
-
background-color #{$transition-duration} ease,
|
|
20
|
-
color #{$transition-duration} ease,
|
|
21
|
-
border-color #{$transition-duration} ease;
|
|
22
|
-
position: absolute;
|
|
23
|
-
top: 0;
|
|
24
|
-
left: 0;
|
|
25
|
-
right: 0;
|
|
26
|
-
bottom: 0;
|
|
27
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Ref } from "vue";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* App Direction Type
|
|
5
|
-
*/
|
|
6
|
-
export type AppDirection = "left" | "right";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* App Props Type
|
|
10
|
-
*/
|
|
11
|
-
export type AppProps = {
|
|
12
|
-
shape?: string;
|
|
13
|
-
divider?: boolean;
|
|
14
|
-
role?: string;
|
|
15
|
-
shadow?: boolean;
|
|
16
|
-
triple?: boolean;
|
|
17
|
-
direction?: AppDirection;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* App Provider State Type
|
|
22
|
-
*/
|
|
23
|
-
export type AppProviderState = {
|
|
24
|
-
shape: Ref<string>;
|
|
25
|
-
divider: Ref<boolean>;
|
|
26
|
-
role: Ref<string>;
|
|
27
|
-
shadow: Ref<boolean>;
|
|
28
|
-
triple: Ref<boolean>;
|
|
29
|
-
direction: Ref<AppDirection>;
|
|
30
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<style lang="scss" src="./app.scss" scoped></style>
|
|
2
|
-
<template src="./app.html"></template>
|
|
3
|
-
<script lang="ts" setup>
|
|
4
|
-
import { cssPrefix } from "../../utils";
|
|
5
|
-
import { computed, provide, toRefs } from "vue";
|
|
6
|
-
import { Toast } from "../toast";
|
|
7
|
-
import { Action, useAction } from "../action";
|
|
8
|
-
import { DecisionModal, useDecisionModal } from "../decision-modal";
|
|
9
|
-
import { type AppProviderState, type AppProps } from "./app.type";
|
|
10
|
-
import { APP_PROVIDER_STATE_KEY } from "./app.constants";
|
|
11
|
-
|
|
12
|
-
// Component setup (props, emits, injects)
|
|
13
|
-
// ----------------------------------------------------------------------------
|
|
14
|
-
const props = withDefaults(defineProps<AppProps>(), {
|
|
15
|
-
shape: "pill",
|
|
16
|
-
divider: false,
|
|
17
|
-
role: "mode",
|
|
18
|
-
shadow: false,
|
|
19
|
-
triple: false,
|
|
20
|
-
direction: "left",
|
|
21
|
-
});
|
|
22
|
-
const { shape, divider, role, shadow, triple, direction } = toRefs(props);
|
|
23
|
-
const decisionModal = useDecisionModal();
|
|
24
|
-
const action = useAction();
|
|
25
|
-
|
|
26
|
-
// Computed properties
|
|
27
|
-
// ----------------------------------------------------------------------------
|
|
28
|
-
// Root layout classes for the application shell (global theme layer)
|
|
29
|
-
const appAttrs = computed(() => {
|
|
30
|
-
return {
|
|
31
|
-
class: [cssPrefix("app"), cssPrefix(["layer", "app"]), cssPrefix(["shape", shape.value])],
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// Provide / expose (public API)
|
|
36
|
-
// ----------------------------------------------------------------------------
|
|
37
|
-
// Theme tokens for child components (shape, role, shadows, navigation direction)
|
|
38
|
-
provide<AppProviderState>(APP_PROVIDER_STATE_KEY, {
|
|
39
|
-
shape,
|
|
40
|
-
divider,
|
|
41
|
-
role,
|
|
42
|
-
shadow,
|
|
43
|
-
triple,
|
|
44
|
-
direction,
|
|
45
|
-
});
|
|
46
|
-
</script>
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
@use "@toife/sass-layer" as sass;
|
|
2
|
-
|
|
3
|
-
// Class
|
|
4
|
-
$avatar: sass.fn-naming-prefix("avatar");
|
|
5
|
-
$shape-pill: sass.fn-naming-prefix("shape-pill");
|
|
6
|
-
|
|
7
|
-
// Property - layer: avatar
|
|
8
|
-
$radius-ratio: sass.fn-naming-var("radius-ratio");
|
|
9
|
-
$radius-size: sass.fn-naming-var("radius-size");
|
|
10
|
-
$border-width: sass.fn-naming-var("stroke", "width");
|
|
11
|
-
$width: sass.fn-naming-var("width");
|
|
12
|
-
$transition-duration: sass.fn-naming-var("duration");
|
|
13
|
-
|
|
14
|
-
$avatar-background-color: sass.fn-naming-var("avatar", "background-color");
|
|
15
|
-
$avatar-border-color: sass.fn-naming-var("avatar", "border-color");
|
|
16
|
-
|
|
17
|
-
// Avatar default is circle
|
|
18
|
-
// With props square then is square
|
|
19
|
-
.#{$avatar} {
|
|
20
|
-
position: relative;
|
|
21
|
-
overflow: hidden;
|
|
22
|
-
background-color: rgba(#{$avatar-background-color});
|
|
23
|
-
width: #{$width};
|
|
24
|
-
aspect-ratio: 1/1;
|
|
25
|
-
border-radius: calc(min(#{$width}, #{$radius-size}) * #{$radius-ratio});
|
|
26
|
-
background-repeat: no-repeat;
|
|
27
|
-
background-size: cover;
|
|
28
|
-
background-position: center;
|
|
29
|
-
transition:
|
|
30
|
-
background-color #{$transition-duration} ease,
|
|
31
|
-
color #{$transition-duration} ease,
|
|
32
|
-
border-color #{$transition-duration} ease,
|
|
33
|
-
box-shadow #{$transition-duration} ease,
|
|
34
|
-
border-radius #{$transition-duration} ease;
|
|
35
|
-
display: inline-block;
|
|
36
|
-
border: #{$border-width} solid transparent;
|
|
37
|
-
|
|
38
|
-
&.#{$shape-pill} {
|
|
39
|
-
border-radius: 50%;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
&.divider {
|
|
43
|
-
border: #{$border-width} solid rgba(#{$avatar-border-color});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<style lang="scss" src="./avatar.scss" scoped></style>
|
|
2
|
-
<template src="./avatar.html"></template>
|
|
3
|
-
<script lang="ts" setup>
|
|
4
|
-
import { computed, inject } from "vue";
|
|
5
|
-
import { type AvatarProps } from "./avatar.type";
|
|
6
|
-
import { cssProperty, cssPrefix } from "../../utils";
|
|
7
|
-
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
|
|
8
|
-
|
|
9
|
-
// Component setup (props, emits, injects)
|
|
10
|
-
// ----------------------------------------------------------------------------
|
|
11
|
-
const props = withDefaults(defineProps<AvatarProps>(), {
|
|
12
|
-
size: "22px",
|
|
13
|
-
src: "",
|
|
14
|
-
role: undefined,
|
|
15
|
-
divider: undefined,
|
|
16
|
-
});
|
|
17
|
-
const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
|
|
18
|
-
|
|
19
|
-
// Computed properties
|
|
20
|
-
// ----------------------------------------------------------------------------
|
|
21
|
-
const avatarAttrs = computed(() => {
|
|
22
|
-
const shape = props?.shape || appState?.shape.value || "";
|
|
23
|
-
const role = props?.role || appState?.role.value || "";
|
|
24
|
-
const divider = (props?.divider !== undefined ? props.divider : appState?.divider.value) ?? false;
|
|
25
|
-
const size = props.size + (typeof props.size === "number" ? "px" : "");
|
|
26
|
-
const backgroundImage = `url(${props.src})`;
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
class: [
|
|
30
|
-
cssPrefix(["layer", "avatar"]),
|
|
31
|
-
cssPrefix(["role", role]),
|
|
32
|
-
cssPrefix(["shape", shape]),
|
|
33
|
-
cssPrefix("avatar"),
|
|
34
|
-
{
|
|
35
|
-
divider: divider,
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
style: {
|
|
39
|
-
[cssProperty("width")]: size,
|
|
40
|
-
backgroundImage: backgroundImage,
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
</script>
|