@toife/vue 2.1.7 → 3.0.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 +171 -0
- package/package.json +41 -9
- package/src/components/action/action.composable.ts +32 -0
- package/src/components/action/action.html +25 -0
- package/src/components/action/action.scss +106 -0
- package/src/components/action/action.type.ts +35 -0
- package/src/components/action/action.vue +82 -0
- package/src/components/action/index.ts +9 -0
- package/src/components/app/app.constants.ts +1 -0
- package/src/components/app/app.html +24 -0
- package/src/components/app/app.scss +27 -0
- package/src/components/app/app.type.ts +21 -0
- package/src/components/app/app.vue +45 -0
- package/src/components/app/index.ts +3 -0
- package/src/components/avatar/avatar.html +3 -0
- package/src/components/avatar/avatar.scss +35 -0
- package/src/components/avatar/avatar.type.ts +6 -0
- package/src/components/avatar/avatar.vue +45 -0
- package/src/components/avatar/index.ts +2 -0
- package/src/components/button/button.html +6 -0
- package/src/components/button/button.scss +113 -0
- package/src/components/button/button.type.ts +14 -0
- package/src/components/button/button.vue +66 -0
- package/src/components/button/index.ts +2 -0
- package/src/components/cable/cable.constants.ts +1 -0
- package/src/components/cable/cable.html +3 -0
- package/src/components/cable/cable.scss +37 -0
- package/src/components/cable/cable.type.ts +11 -0
- package/src/components/cable/cable.vue +33 -0
- package/src/components/cable/index.ts +3 -0
- package/src/components/card/card/card.constants.ts +1 -0
- package/src/components/card/card/card.html +3 -0
- package/src/components/card/card/card.scss +34 -0
- package/src/components/card/card/card.type.ts +14 -0
- package/src/components/card/card/card.vue +62 -0
- package/src/components/card/card/index.ts +3 -0
- package/src/components/card/card-body/card-body.html +3 -0
- package/src/components/card/card-body/card-body.scss +23 -0
- package/src/components/card/card-body/card-body.vue +14 -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.scss +31 -0
- package/src/components/card/card-footer/card-footer.vue +28 -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.scss +31 -0
- package/src/components/card/card-header/card-header.vue +28 -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 +13 -0
- package/src/components/checkbox/checkbox.scss +138 -0
- package/src/components/checkbox/checkbox.type.ts +17 -0
- package/src/components/checkbox/checkbox.vue +91 -0
- package/src/components/checkbox/index.ts +2 -0
- package/src/components/collapse/collapse.html +16 -0
- package/src/components/collapse/collapse.scss +59 -0
- package/src/components/collapse/collapse.type.ts +11 -0
- package/src/components/collapse/collapse.vue +131 -0
- package/src/components/collapse/index.ts +2 -0
- package/src/components/container/container.html +1 -0
- package/src/components/container/container.scss +10 -0
- package/src/components/container/container.vue +14 -0
- package/src/components/container/index.ts +1 -0
- package/src/components/decision-modal/decision-modal.composable.ts +32 -0
- package/src/components/decision-modal/decision-modal.html +29 -0
- package/src/components/decision-modal/decision-modal.scss +136 -0
- package/src/components/decision-modal/decision-modal.type.ts +35 -0
- package/src/components/decision-modal/decision-modal.vue +98 -0
- package/src/components/decision-modal/index.ts +9 -0
- package/src/components/divider/divider.html +1 -0
- package/src/components/divider/divider.scss +29 -0
- package/src/components/divider/divider.type.ts +6 -0
- package/src/components/divider/divider.vue +34 -0
- package/src/components/divider/index.ts +2 -0
- package/src/components/field/field.html +1 -0
- package/src/components/field/field.type.ts +43 -0
- package/src/components/field/field.vue +85 -0
- package/src/components/field/index.ts +2 -0
- package/src/components/field/outline/index.ts +1 -0
- package/src/components/field/outline/outline.html +32 -0
- package/src/components/field/outline/outline.scss +224 -0
- package/src/components/field/outline/outline.vue +243 -0
- package/src/components/form-group/form-group.html +3 -0
- package/src/components/form-group/form-group.scss +91 -0
- package/src/components/form-group/form-group.type.ts +5 -0
- package/src/components/form-group/form-group.vue +21 -0
- package/src/components/form-group/index.ts +2 -0
- package/src/components/gesture-indicator/gesture-indicator.html +1 -0
- package/src/components/gesture-indicator/gesture-indicator.scss +45 -0
- package/src/components/gesture-indicator/gesture-indicator.type.ts +4 -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.scss +1 -0
- package/src/components/image/image.type.ts +5 -0
- package/src/components/image/image.vue +25 -0
- package/src/components/image/index.ts +2 -0
- package/src/components/index.ts +27 -0
- package/src/components/modal/index.ts +2 -0
- package/src/components/modal/modal.html +20 -0
- package/src/components/modal/modal.scss +78 -0
- package/src/components/modal/modal.type.ts +21 -0
- package/src/components/modal/modal.vue +186 -0
- package/src/components/page/index.ts +1 -0
- package/src/components/page/page.html +3 -0
- package/src/components/page/page.scss +17 -0
- package/src/components/page/page.vue +14 -0
- package/src/components/present/index.ts +3 -0
- package/src/components/present/present.composable.ts +21 -0
- package/src/components/present/present.html +9 -0
- package/src/components/present/present.scss +81 -0
- package/src/components/present/present.type.ts +26 -0
- package/src/components/present/present.vue +198 -0
- package/src/components/radio/index.ts +2 -0
- package/src/components/radio/radio/index.ts +2 -0
- package/src/components/radio/radio/radio.html +11 -0
- package/src/components/radio/radio/radio.scss +125 -0
- package/src/components/radio/radio/radio.type.ts +11 -0
- package/src/components/radio/radio/radio.vue +103 -0
- package/src/components/radio/radio-group/index.ts +7 -0
- package/src/components/radio/radio-group/radio-group.constants.ts +1 -0
- package/src/components/radio/radio-group/radio-group.html +3 -0
- package/src/components/radio/radio-group/radio-group.scss +16 -0
- package/src/components/radio/radio-group/radio-group.type.ts +28 -0
- package/src/components/radio/radio-group/radio-group.vue +62 -0
- package/src/components/refresher/index.ts +2 -0
- package/src/components/refresher/refresher.html +6 -0
- package/src/components/refresher/refresher.scss +36 -0
- package/src/components/refresher/refresher.type.ts +16 -0
- package/src/components/refresher/refresher.vue +137 -0
- package/src/components/route/index.ts +5 -0
- package/src/components/route/route-navigator/index.ts +2 -0
- package/src/components/route/route-navigator/route-navigator.html +19 -0
- package/src/components/route/route-navigator/route-navigator.scss +127 -0
- package/src/components/route/route-navigator/route-navigator.type.ts +12 -0
- package/src/components/route/route-navigator/route-navigator.vue +250 -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 +30 -0
- package/src/components/route/route-provider/index.ts +3 -0
- package/src/components/route/route-provider/route-provider.constant.ts +1 -0
- package/src/components/route/route-provider/route-provider.html +1 -0
- package/src/components/route/route-provider/route-provider.type.ts +10 -0
- package/src/components/route/route-provider/route-provider.vue +20 -0
- package/src/components/route/route-wrapper/index.ts +3 -0
- package/src/components/route/route-wrapper/route-wrapper.composable.ts +43 -0
- package/src/components/route/route-wrapper/route-wrapper.html +3 -0
- package/src/components/route/route-wrapper/route-wrapper.type.ts +3 -0
- package/src/components/route/route-wrapper/route-wrapper.vue +43 -0
- package/src/components/route/route.type.ts +7 -0
- package/src/components/route/route.util.ts +8 -0
- package/src/components/segmented-field/index.ts +7 -0
- package/src/components/segmented-field/segmented-field.html +17 -0
- package/src/components/segmented-field/segmented-field.scss +52 -0
- package/src/components/segmented-field/segmented-field.type.ts +29 -0
- package/src/components/segmented-field/segmented-field.vue +151 -0
- package/src/components/skeleton/index.ts +2 -0
- package/src/components/skeleton/skeleton.html +1 -0
- package/src/components/skeleton/skeleton.scss +45 -0
- package/src/components/skeleton/skeleton.type.ts +7 -0
- package/src/components/skeleton/skeleton.vue +38 -0
- package/src/components/switch/index.ts +2 -0
- package/src/components/switch/switch.html +15 -0
- package/src/components/switch/switch.scss +134 -0
- package/src/components/switch/switch.type.ts +13 -0
- package/src/components/switch/switch.vue +92 -0
- package/src/components/tabs/index.ts +2 -0
- package/src/components/tabs/tab/index.ts +2 -0
- package/src/components/tabs/tab/tab.html +5 -0
- package/src/components/tabs/tab/tab.type.ts +5 -0
- package/src/components/tabs/tab/tab.vue +38 -0
- package/src/components/tabs/tabs/index.ts +9 -0
- package/src/components/tabs/tabs/tabs.constants.ts +1 -0
- package/src/components/tabs/tabs/tabs.html +3 -0
- package/src/components/tabs/tabs/tabs.scss +272 -0
- package/src/components/tabs/tabs/tabs.type.ts +36 -0
- package/src/components/tabs/tabs/tabs.vue +159 -0
- package/src/components/toast/index.ts +4 -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.scss +61 -0
- package/src/components/toast/toast/toast.vue +34 -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.scss +41 -0
- package/src/components/toast/toast-content/toast-content.vue +59 -0
- package/src/components/toast/toast.composable.ts +22 -0
- package/src/components/toast/toast.type.ts +25 -0
- package/src/components/toolbar/index.ts +2 -0
- package/src/components/toolbar/toolbar.html +5 -0
- package/src/components/toolbar/toolbar.scss +79 -0
- package/src/components/toolbar/toolbar.type.ts +7 -0
- package/src/components/toolbar/toolbar.vue +47 -0
- package/src/env.d.ts +7 -0
- package/src/factory.ts +81 -0
- package/src/index.ts +4 -0
- package/src/type.ts +3 -0
- package/src/utils/element.ts +16 -0
- package/src/utils/events.ts +12 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/style/index.ts +42 -0
- package/dist/components/t-action.vue.d.ts +0 -29
- package/dist/components/t-alert.vue.d.ts +0 -35
- package/dist/components/t-app.vue.d.ts +0 -17
- package/dist/components/t-avatar.vue.d.ts +0 -24
- package/dist/components/t-back-button.vue.d.ts +0 -21
- package/dist/components/t-button.vue.d.ts +0 -36
- package/dist/components/t-cable.vue.d.ts +0 -24
- package/dist/components/t-card.vue.d.ts +0 -22
- package/dist/components/t-checkbox.vue.d.ts +0 -38
- package/dist/components/t-collapse.vue.d.ts +0 -32
- package/dist/components/t-content.vue.d.ts +0 -17
- package/dist/components/t-divider.vue.d.ts +0 -7
- package/dist/components/t-flex.vue.d.ts +0 -24
- package/dist/components/t-gesture-indicator.vue.d.ts +0 -7
- package/dist/components/t-grid.vue.d.ts +0 -24
- package/dist/components/t-icon-spinner.vue.d.ts +0 -23
- package/dist/components/t-image.vue.d.ts +0 -6
- package/dist/components/t-input.vue.d.ts +0 -47
- package/dist/components/t-keyboard-space.vue.d.ts +0 -2
- package/dist/components/t-loading.vue.d.ts +0 -29
- package/dist/components/t-present.vue.d.ts +0 -47
- package/dist/components/t-refresher.vue.d.ts +0 -43
- package/dist/components/t-rich-text.vue.d.ts +0 -2
- package/dist/components/t-ripple.vue.d.ts +0 -7
- package/dist/components/t-screen-router.vue.d.ts +0 -15
- package/dist/components/t-screen.vue.d.ts +0 -17
- package/dist/components/t-sheet.vue.d.ts +0 -251
- package/dist/components/t-skeleton.vue.d.ts +0 -13
- package/dist/components/t-switch.vue.d.ts +0 -12
- package/dist/components/t-tab.vue.d.ts +0 -23
- package/dist/components/t-tabs.vue.d.ts +0 -43
- package/dist/components/t-text.vue.d.ts +0 -24
- package/dist/components/t-textarea.vue.d.ts +0 -2
- package/dist/components/t-toast.vue.d.ts +0 -38
- package/dist/components/t-toggle-password.vue.d.ts +0 -31
- package/dist/components/t-toolbar.vue.d.ts +0 -26
- package/dist/controllers/action.d.ts +0 -4
- package/dist/controllers/alert.d.ts +0 -4
- package/dist/controllers/index.d.ts +0 -8
- package/dist/controllers/keyboard.d.ts +0 -3
- package/dist/controllers/loading.d.ts +0 -5
- package/dist/controllers/present.d.ts +0 -4
- package/dist/controllers/screen.d.ts +0 -20
- package/dist/controllers/toast.d.ts +0 -4
- package/dist/index.css +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.es.js +0 -1501
- package/dist/index.umd.js +0 -1
- package/dist/utils/defaultEvent.d.ts +0 -2
- package/dist/utils/element.d.ts +0 -2
- package/dist/utils/index.d.ts +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# @toife/vue
|
|
2
|
+
|
|
3
|
+
Vue 3 component library for Toife. The package ships **source** (`src/`): your app bundles it and compiles Sass with your own configuration.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
| Package | Notes |
|
|
8
|
+
|---------|--------|
|
|
9
|
+
| `vue` ^3.5 | Required |
|
|
10
|
+
| `vue-router` ^4 | Required when using route-related components |
|
|
11
|
+
| `@toife/gesture` | Gestures |
|
|
12
|
+
| `@toife/sass-layer-generator` | Component SCSS uses `@use`; install in the app and configure Sass (e.g. Vite `css.preprocessorOptions`) |
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @toife/vue
|
|
18
|
+
# or
|
|
19
|
+
yarn add @toife/vue
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Install any missing peer dependencies if npm/yarn reports them.
|
|
23
|
+
|
|
24
|
+
## Global registration (plugin)
|
|
25
|
+
|
|
26
|
+
`createToife()` registers most components as **kebab-case** tags with the default prefix `t-`.
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
// main.ts
|
|
30
|
+
import { createApp } from "vue";
|
|
31
|
+
import { createToife } from "@toife/vue";
|
|
32
|
+
import App from "./App.vue";
|
|
33
|
+
|
|
34
|
+
const app = createApp(App);
|
|
35
|
+
app.use(createToife());
|
|
36
|
+
// or change the prefix:
|
|
37
|
+
// app.use(createToife({ prefix: "toife-" })); // → <toife-app>, <toife-button>, ...
|
|
38
|
+
app.mount("#app");
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```vue
|
|
42
|
+
<!-- Example: default prefix "t-" -->
|
|
43
|
+
<template>
|
|
44
|
+
<t-app>
|
|
45
|
+
<t-page>
|
|
46
|
+
<t-toolbar />
|
|
47
|
+
<t-container>
|
|
48
|
+
<t-button>OK</t-button>
|
|
49
|
+
</t-container>
|
|
50
|
+
</t-page>
|
|
51
|
+
</t-app>
|
|
52
|
+
</template>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### `createToife` options
|
|
56
|
+
|
|
57
|
+
| Property | Type | Default | Description |
|
|
58
|
+
|----------|------|---------|-------------|
|
|
59
|
+
| `prefix` | `string` | `"t-"` | Tag name prefix (e.g. `my-` → `<my-button>`) |
|
|
60
|
+
|
|
61
|
+
## Tags after `app.use(createToife())`
|
|
62
|
+
|
|
63
|
+
The default prefix is `t-`. The **Tag** column is `prefix` + name (e.g. `t-button`).
|
|
64
|
+
|
|
65
|
+
| Tag (prefix `t-`) | Component |
|
|
66
|
+
|-------------------|-----------|
|
|
67
|
+
| `t-app` | App |
|
|
68
|
+
| `t-action` | Action |
|
|
69
|
+
| `t-avatar` | Avatar |
|
|
70
|
+
| `t-button` | Button |
|
|
71
|
+
| `t-cable` | Cable |
|
|
72
|
+
| `t-card` | Card |
|
|
73
|
+
| `t-card-body` | CardBody |
|
|
74
|
+
| `t-card-header` | CardHeader |
|
|
75
|
+
| `t-card-footer` | CardFooter |
|
|
76
|
+
| `t-checkbox` | Checkbox |
|
|
77
|
+
| `t-radio` | Radio |
|
|
78
|
+
| `t-radio-group` | RadioGroup |
|
|
79
|
+
| `t-collapse` | Collapse |
|
|
80
|
+
| `t-container` | Container |
|
|
81
|
+
| `t-decision-modal` | DecisionModal |
|
|
82
|
+
| `t-divider` | Divider |
|
|
83
|
+
| `t-field` | Field |
|
|
84
|
+
| `t-form-group` | FormGroup |
|
|
85
|
+
| `t-gesture-indicator` | GestureIndicator |
|
|
86
|
+
| `t-image` | Image |
|
|
87
|
+
| `t-modal` | Modal |
|
|
88
|
+
| `t-page` | Page |
|
|
89
|
+
| `t-present` | Present |
|
|
90
|
+
| `t-refresher` | Refresher |
|
|
91
|
+
| `t-route-navigator` | RouteNavigator |
|
|
92
|
+
| `t-route-wrapper` | RouteWrapper |
|
|
93
|
+
| `t-route-provider` | RouteProvider |
|
|
94
|
+
| `t-route-outlet` | RouteOutlet |
|
|
95
|
+
| `t-segmented-field` | SegmentedField |
|
|
96
|
+
| `t-skeleton` | Skeleton |
|
|
97
|
+
| `t-switch` | Switch |
|
|
98
|
+
| `t-tabs` | Tabs |
|
|
99
|
+
| `t-toast` | Toast |
|
|
100
|
+
| `t-toast-content` | ToastContent |
|
|
101
|
+
| `t-toolbar` | Toolbar |
|
|
102
|
+
|
|
103
|
+
### Components not registered by the plugin
|
|
104
|
+
|
|
105
|
+
These are **still exported** from `@toife/vue` but are **not** included in `createToife().install` — import them directly and call `app.component(...)` yourself if you need globals:
|
|
106
|
+
|
|
107
|
+
- `Tab` — used inside `Tabs`; `import { Tab, Tabs } from "@toife/vue"`.
|
|
108
|
+
- `OutlineField` — `import { OutlineField } from "@toife/vue"`.
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import { Tab, OutlineField } from "@toife/vue";
|
|
112
|
+
|
|
113
|
+
app.component("t-tab", Tab);
|
|
114
|
+
app.component("t-outline-field", OutlineField);
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Or use them only in SFCs: `import { Tab } from "@toife/vue"` and register locally / use in a parent template.
|
|
118
|
+
|
|
119
|
+
## Named imports (without the plugin)
|
|
120
|
+
|
|
121
|
+
You can always import components and register them manually or use them locally:
|
|
122
|
+
|
|
123
|
+
```vue
|
|
124
|
+
<script setup lang="ts">
|
|
125
|
+
import { Button, App, RouteNavigator, RouteWrapper } from "@toife/vue";
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<template>
|
|
129
|
+
<App>
|
|
130
|
+
<RouteWrapper>
|
|
131
|
+
<RouteNavigator variant="swipe" />
|
|
132
|
+
</RouteWrapper>
|
|
133
|
+
</App>
|
|
134
|
+
</template>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Public exports are defined in `src/index.ts` (factory, re-exported `./components`, and `utils`).
|
|
138
|
+
|
|
139
|
+
## Vue Router
|
|
140
|
+
|
|
141
|
+
`RouteNavigator`, `RouteWrapper`, `RouteProvider`, and `RouteOutlet` expect `vue-router` to be installed and configured in your app.
|
|
142
|
+
|
|
143
|
+
## TypeScript
|
|
144
|
+
|
|
145
|
+
The package includes `*.vue` declarations via the entry; if your IDE still complains about `.vue` modules, add this to your project (Vite):
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
// env.d.ts
|
|
149
|
+
declare module "*.vue" {
|
|
150
|
+
import type { DefineComponent } from "vue";
|
|
151
|
+
const component: DefineComponent<{}, {}, any>;
|
|
152
|
+
export default component;
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Utilities
|
|
157
|
+
|
|
158
|
+
```ts
|
|
159
|
+
import { utils } from "@toife/vue";
|
|
160
|
+
// utils.* — see exports under src/utils
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
See `src/utils` in the repo for concrete APIs.
|
|
164
|
+
|
|
165
|
+
## Sass / theming
|
|
166
|
+
|
|
167
|
+
Component styles use `@use "@toife/sass-layer-generator"` and SCSS under `src`. Configure **sass-embedded** / **sass** and any aliases in **your** app so tokens, layers, and variables resolve when you build.
|
|
168
|
+
|
|
169
|
+
## License
|
|
170
|
+
|
|
171
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toife/vue",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "A Frontend framework for Vue",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./src/index.ts",
|
|
10
|
+
"import": "./src/index.ts",
|
|
11
|
+
"default": "./src/index.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
9
14
|
"files": [
|
|
10
|
-
"
|
|
15
|
+
"src"
|
|
11
16
|
],
|
|
12
17
|
"keywords": [
|
|
13
18
|
"vue",
|
|
@@ -17,19 +22,46 @@
|
|
|
17
22
|
],
|
|
18
23
|
"author": "Toikit",
|
|
19
24
|
"license": "MIT",
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public",
|
|
27
|
+
"registry": "https://registry.npmjs.org/"
|
|
28
|
+
},
|
|
20
29
|
"peerDependencies": {
|
|
21
30
|
"@toife/gesture": "^1.1.4",
|
|
22
|
-
"
|
|
23
|
-
"vue
|
|
31
|
+
"@toife/sass-layer-generator": "^1.0.9",
|
|
32
|
+
"vue": "^3.5.0",
|
|
33
|
+
"vue-router": "^4.0.0"
|
|
24
34
|
},
|
|
25
35
|
"scripts": {
|
|
26
|
-
"
|
|
36
|
+
"dev": "vite",
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"build": "vite build",
|
|
39
|
+
"format": "prettier . --write",
|
|
40
|
+
"prepare": "husky",
|
|
41
|
+
"test:dev": "vite --config test/vite.config.ts",
|
|
42
|
+
"test:build": "vite build --config test/vite.config.ts"
|
|
43
|
+
},
|
|
44
|
+
"lint-staged": {
|
|
45
|
+
"*.{js,ts,vue,json,css,scss,sass,md,html}": "prettier --write"
|
|
27
46
|
},
|
|
28
47
|
"devDependencies": {
|
|
48
|
+
"@commitlint/cli": "^20.4.4",
|
|
49
|
+
"@commitlint/config-conventional": "^20.4.4",
|
|
50
|
+
"@toife/sass-layer-generator": "^1.0.9",
|
|
51
|
+
"@types/node": "^25.0.3",
|
|
29
52
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
53
|
+
"husky": "^9.1.7",
|
|
54
|
+
"lint-staged": "^16.4.0",
|
|
55
|
+
"prettier": "3.7.4",
|
|
30
56
|
"sass": "^1.90.0",
|
|
31
57
|
"typescript": "^5.9.2",
|
|
32
58
|
"vite": "^7.0.6",
|
|
33
|
-
"vite-plugin-dts": "^4.5.4"
|
|
59
|
+
"vite-plugin-dts": "^4.5.4",
|
|
60
|
+
"vue": "^3.5.0",
|
|
61
|
+
"vue-router": "^4.0.0"
|
|
62
|
+
},
|
|
63
|
+
"packageManager": "yarn@4.12.0",
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"@toife/gesture": "^1.1.4"
|
|
34
66
|
}
|
|
35
67
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
};
|
|
@@ -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 orientation="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,106 @@
|
|
|
1
|
+
@use "@toife/sass-layer-generator" as sass;
|
|
2
|
+
|
|
3
|
+
// Class name
|
|
4
|
+
$action: sass.fn-naming-prefix("action");
|
|
5
|
+
$button: sass.fn-naming-prefix("button");
|
|
6
|
+
|
|
7
|
+
// Property name
|
|
8
|
+
$margin-y: sass.fn-naming-var("spacing", "y");
|
|
9
|
+
$margin-x: sass.fn-naming-var("spacing", "x");
|
|
10
|
+
$width: sass.fn-naming-var("viewport", "width");
|
|
11
|
+
$max-width: sass.fn-naming-var("overlay", "max-width");
|
|
12
|
+
$height: sass.fn-naming-var("viewport", "height");
|
|
13
|
+
$max-height: sass.fn-naming-var("overlay", "max-height");
|
|
14
|
+
$background-color: sass.fn-naming-var("surface", "background-color");
|
|
15
|
+
$transition-duration: sass.fn-naming-var("motion", "duration");
|
|
16
|
+
$safe-area-bottom: sass.fn-naming-var("safe-area", "bottom");
|
|
17
|
+
$safe-area-top: sass.fn-naming-var("safe-area", "top");
|
|
18
|
+
$safe-area-left: sass.fn-naming-var("safe-area", "left");
|
|
19
|
+
$safe-area-right: sass.fn-naming-var("safe-area", "right");
|
|
20
|
+
$border-width: sass.fn-naming-var("stroke", "width");
|
|
21
|
+
$border-color: sass.fn-naming-var("item", "border-color");
|
|
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: rgb(#{$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
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ButtonVariant } from "../button/button.type";
|
|
2
|
+
import { PresentPlacement } from "../present";
|
|
3
|
+
|
|
4
|
+
export type ActionPlacement = PresentPlacement;
|
|
5
|
+
|
|
6
|
+
// Define
|
|
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
|
+
export type ActionProps = {
|
|
17
|
+
visible?: boolean;
|
|
18
|
+
dismiss?: string[];
|
|
19
|
+
actions: Array<ActionButton[]>;
|
|
20
|
+
role?: string;
|
|
21
|
+
shape?: string;
|
|
22
|
+
divider?: boolean;
|
|
23
|
+
shadow?: boolean;
|
|
24
|
+
placement?: ActionPlacement;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type ActionComposableProps = ActionProps & {
|
|
28
|
+
onClose?: (type?: string) => void;
|
|
29
|
+
onChoose?: (btn?: ActionButton) => void;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type ActionEmit = {
|
|
33
|
+
(e: "close", type?: string): void;
|
|
34
|
+
(e: "choose", btn: ActionButton): void;
|
|
35
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
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 { withPrefix } from "../../utils";
|
|
10
|
+
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
|
|
11
|
+
|
|
12
|
+
/// Define
|
|
13
|
+
/// ------------------------------------------------------------
|
|
14
|
+
const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
|
|
15
|
+
const emit = defineEmits<ActionEmit>();
|
|
16
|
+
const props = withDefaults(defineProps<ActionProps>(), {
|
|
17
|
+
visible: false,
|
|
18
|
+
shape: undefined,
|
|
19
|
+
role: undefined,
|
|
20
|
+
placement: "bottom",
|
|
21
|
+
divider: undefined,
|
|
22
|
+
shadow: undefined,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
/// State
|
|
26
|
+
/// ------------------------------------------------------------
|
|
27
|
+
const pop = ref(false);
|
|
28
|
+
|
|
29
|
+
/// Computed
|
|
30
|
+
/// ------------------------------------------------------------
|
|
31
|
+
const divider = computed(() => {
|
|
32
|
+
return (props?.divider !== undefined ? props.divider : appState?.divider.value) ?? false;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const shadow = computed(() => {
|
|
36
|
+
return (props?.shadow !== undefined ? props.shadow : appState?.shadow.value) ?? false;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const shape = computed(() => {
|
|
40
|
+
return props.shape ?? appState?.shape.value ?? "";
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const role = computed(() => {
|
|
44
|
+
return props.role ?? appState?.role.value ?? "";
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const actionAttrs = computed(() => {
|
|
48
|
+
return {
|
|
49
|
+
class: [
|
|
50
|
+
withPrefix("action"),
|
|
51
|
+
withPrefix(["layer", "surface"]),
|
|
52
|
+
withPrefix(["role", role.value]),
|
|
53
|
+
withPrefix(["shape", shape.value]),
|
|
54
|
+
props.placement,
|
|
55
|
+
{
|
|
56
|
+
pop: pop.value,
|
|
57
|
+
divider: divider.value,
|
|
58
|
+
shadow: shadow.value,
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
/// Methods
|
|
65
|
+
/// ------------------------------------------------------------
|
|
66
|
+
const onClose = (val: string) => {
|
|
67
|
+
if (props.dismiss && props.dismiss.includes(val)) {
|
|
68
|
+
emit("close", val);
|
|
69
|
+
} else if (val === "backdrop") {
|
|
70
|
+
pop.value = true;
|
|
71
|
+
setTimeout(() => {
|
|
72
|
+
pop.value = false;
|
|
73
|
+
}, 300);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const onChoose = (btn: ActionButton) => {
|
|
78
|
+
emit("close");
|
|
79
|
+
btn.handler?.();
|
|
80
|
+
emit("choose", btn);
|
|
81
|
+
};
|
|
82
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const APP_PROVIDER_STATE_KEY = "app-state";
|
|
@@ -0,0 +1,24 @@
|
|
|
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>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@use "@toife/sass-layer-generator" as sass;
|
|
2
|
+
|
|
3
|
+
// Class name
|
|
4
|
+
$app: sass.fn-naming-prefix("app");
|
|
5
|
+
|
|
6
|
+
// Property name - layer: base
|
|
7
|
+
$background-color: sass.fn-naming-var("base", "background-color");
|
|
8
|
+
$color: sass.fn-naming-var("base", "color");
|
|
9
|
+
$transition-duration: sass.fn-naming-var("motion", "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: rgb(#{$background-color});
|
|
17
|
+
color: rgb(#{$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
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Ref } from "vue";
|
|
2
|
+
|
|
3
|
+
export type AppDirection = "left" | "right";
|
|
4
|
+
|
|
5
|
+
export type AppProps = {
|
|
6
|
+
shape?: string;
|
|
7
|
+
divider?: boolean;
|
|
8
|
+
role?: string;
|
|
9
|
+
shadow?: boolean;
|
|
10
|
+
triple?: boolean;
|
|
11
|
+
direction?: AppDirection;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type AppProviderState = {
|
|
15
|
+
shape: Ref<string>;
|
|
16
|
+
divider: Ref<boolean>;
|
|
17
|
+
role: Ref<string>;
|
|
18
|
+
shadow: Ref<boolean>;
|
|
19
|
+
triple: Ref<boolean>;
|
|
20
|
+
direction: Ref<AppDirection>;
|
|
21
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<style lang="scss" src="./app.scss" scoped></style>
|
|
2
|
+
<template src="./app.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { withPrefix } 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
|
+
/// Define
|
|
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
|
|
27
|
+
/// ------------------------------------------------------------
|
|
28
|
+
// Present attributes
|
|
29
|
+
const appAttrs = computed(() => {
|
|
30
|
+
return {
|
|
31
|
+
class: [withPrefix(["layer", "base"]), withPrefix(["shape", shape.value]), withPrefix("app")],
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Export, Expose
|
|
36
|
+
/// ------------------------------------------------------------
|
|
37
|
+
provide<AppProviderState>(APP_PROVIDER_STATE_KEY, {
|
|
38
|
+
shape,
|
|
39
|
+
divider,
|
|
40
|
+
role,
|
|
41
|
+
shadow,
|
|
42
|
+
triple,
|
|
43
|
+
direction,
|
|
44
|
+
});
|
|
45
|
+
</script>
|