@toife/vue 2.2.0 → 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/{dist/components/gesture-indicator/gesture-indicator.type.d.ts → src/components/gesture-indicator/gesture-indicator.type.ts} +2 -1
- 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/{dist/type.d.ts → src/type.ts} +1 -1
- 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/action/action.type.d.ts +0 -17
- package/dist/components/action/action.vue.d.ts +0 -14
- package/dist/components/action/factory.d.ts +0 -3
- package/dist/components/action/index.d.ts +0 -2
- package/dist/components/alert/alert.type.d.ts +0 -16
- package/dist/components/alert/alert.vue.d.ts +0 -14
- package/dist/components/alert/factory.d.ts +0 -3
- package/dist/components/alert/index.d.ts +0 -2
- package/dist/components/app/app.type.d.ts +0 -1
- package/dist/components/app/app.vue.d.ts +0 -3
- package/dist/components/app/index.d.ts +0 -1
- package/dist/components/avatar/avatar.type.d.ts +0 -4
- package/dist/components/avatar/avatar.vue.d.ts +0 -6
- package/dist/components/avatar/index.d.ts +0 -1
- package/dist/components/back-button/back-button.type.d.ts +0 -4
- package/dist/components/back-button/back-button.vue.d.ts +0 -3
- package/dist/components/back-button/index.d.ts +0 -1
- package/dist/components/button/button.type.d.ts +0 -10
- package/dist/components/button/button.vue.d.ts +0 -12
- package/dist/components/button/index.d.ts +0 -1
- package/dist/components/cable/cable.type.d.ts +0 -4
- package/dist/components/cable/cable.vue.d.ts +0 -6
- package/dist/components/cable/index.d.ts +0 -1
- package/dist/components/card/card.type.d.ts +0 -3
- package/dist/components/card/card.vue.d.ts +0 -5
- package/dist/components/card/index.d.ts +0 -1
- package/dist/components/checkbox/checkbox.type.d.ts +0 -12
- package/dist/components/checkbox/checkbox.vue.d.ts +0 -14
- package/dist/components/checkbox/index.d.ts +0 -1
- package/dist/components/collapse/collapse.type.d.ts +0 -6
- package/dist/components/collapse/collapse.vue.d.ts +0 -7
- package/dist/components/collapse/index.d.ts +0 -1
- package/dist/components/content/content.type.d.ts +0 -1
- package/dist/components/content/content.vue.d.ts +0 -3
- package/dist/components/content/index.d.ts +0 -1
- package/dist/components/divider/divider.type.d.ts +0 -3
- package/dist/components/divider/divider.vue.d.ts +0 -5
- package/dist/components/divider/index.d.ts +0 -1
- package/dist/components/flex/flex.type.d.ts +0 -4
- package/dist/components/flex/flex.vue.d.ts +0 -6
- package/dist/components/flex/index.d.ts +0 -1
- package/dist/components/gesture-indicator/gesture-indicator.vue.d.ts +0 -5
- package/dist/components/gesture-indicator/index.d.ts +0 -1
- package/dist/components/grid/grid.type.d.ts +0 -4
- package/dist/components/grid/grid.vue.d.ts +0 -6
- package/dist/components/grid/index.d.ts +0 -1
- package/dist/components/icon-spinner/icon-spinner.type.d.ts +0 -4
- package/dist/components/icon-spinner/icon-spinner.vue.d.ts +0 -6
- package/dist/components/icon-spinner/index.d.ts +0 -1
- package/dist/components/image/image.type.d.ts +0 -4
- 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 -36
- package/dist/components/input/index.d.ts +0 -1
- package/dist/components/input/input.type.d.ts +0 -15
- package/dist/components/input/input.vue.d.ts +0 -16
- package/dist/components/keyboard-space/factory.d.ts +0 -3
- package/dist/components/keyboard-space/index.d.ts +0 -2
- package/dist/components/keyboard-space/keyboard-space.type.d.ts +0 -1
- package/dist/components/keyboard-space/keyboard-space.vue.d.ts +0 -3
- package/dist/components/loading/factory.d.ts +0 -4
- package/dist/components/loading/index.d.ts +0 -2
- package/dist/components/loading/loading.type.d.ts +0 -6
- package/dist/components/loading/loading.vue.d.ts +0 -12
- package/dist/components/present/factory.d.ts +0 -1
- package/dist/components/present/index.d.ts +0 -2
- package/dist/components/present/present.type.d.ts +0 -13
- package/dist/components/present/present.vue.d.ts +0 -17
- package/dist/components/refresher/index.d.ts +0 -1
- package/dist/components/refresher/refresher.type.d.ts +0 -11
- package/dist/components/refresher/refresher.vue.d.ts +0 -17
- package/dist/components/richtext/index.d.ts +0 -1
- package/dist/components/richtext/richtext.type.d.ts +0 -1
- package/dist/components/richtext/richtext.vue.d.ts +0 -3
- package/dist/components/ripple/index.d.ts +0 -1
- package/dist/components/ripple/ripple.type.d.ts +0 -3
- package/dist/components/ripple/ripple.vue.d.ts +0 -5
- package/dist/components/screen/index.d.ts +0 -1
- package/dist/components/screen/screen.type.d.ts +0 -1
- package/dist/components/screen/screen.vue.d.ts +0 -3
- package/dist/components/screen-router/factory.d.ts +0 -19
- package/dist/components/screen-router/index.d.ts +0 -2
- package/dist/components/screen-router/screen-router.type.d.ts +0 -8
- package/dist/components/screen-router/screen-router.vue.d.ts +0 -9
- package/dist/components/sheet/index.d.ts +0 -1
- package/dist/components/sheet/sheet.type.d.ts +0 -18
- package/dist/components/sheet/sheet.vue.d.ts +0 -18
- package/dist/components/skeleton/index.d.ts +0 -1
- package/dist/components/skeleton/skeleton.type.d.ts +0 -6
- package/dist/components/skeleton/skeleton.vue.d.ts +0 -8
- package/dist/components/switch/index.d.ts +0 -1
- package/dist/components/switch/switch.type.d.ts +0 -7
- package/dist/components/switch/switch.vue.d.ts +0 -9
- package/dist/components/tab/index.d.ts +0 -1
- package/dist/components/tab/tab.type.d.ts +0 -4
- package/dist/components/tab/tab.vue.d.ts +0 -5
- package/dist/components/tabs/index.d.ts +0 -1
- package/dist/components/tabs/tabs.type.d.ts +0 -13
- package/dist/components/tabs/tabs.vue.d.ts +0 -15
- package/dist/components/text/index.d.ts +0 -1
- package/dist/components/text/text.type.d.ts +0 -4
- package/dist/components/text/text.vue.d.ts +0 -6
- package/dist/components/textarea/index.d.ts +0 -1
- package/dist/components/textarea/textarea.type.d.ts +0 -1
- package/dist/components/textarea/textarea.vue.d.ts +0 -3
- package/dist/components/toast/factory.d.ts +0 -3
- package/dist/components/toast/index.d.ts +0 -2
- package/dist/components/toast/toast.type.d.ts +0 -11
- package/dist/components/toast/toast.vue.d.ts +0 -16
- package/dist/components/toggle-password/index.d.ts +0 -1
- package/dist/components/toggle-password/toggle-password.type.d.ts +0 -6
- package/dist/components/toggle-password/toggle-password.vue.d.ts +0 -9
- package/dist/components/toolbar/index.d.ts +0 -1
- package/dist/components/toolbar/toolbar.type.d.ts +0 -5
- package/dist/components/toolbar/toolbar.vue.d.ts +0 -7
- package/dist/factory.d.ts +0 -4
- package/dist/index.css +0 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.es.js +0 -1836
- package/dist/index.umd.js +0 -1
- package/dist/utils/element.d.ts +0 -2
- package/dist/utils/events.d.ts +0 -1
- package/dist/utils/index.d.ts +0 -2
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
@use "@toife/sass-layer-generator" as sass;
|
|
2
|
+
|
|
3
|
+
// Class name
|
|
4
|
+
$field: sass.fn-naming-prefix("field");
|
|
5
|
+
$field-content: sass.fn-naming-prefix("field-content");
|
|
6
|
+
$field-input: sass.fn-naming-prefix("field-input");
|
|
7
|
+
$field-message: sass.fn-naming-prefix("field-message");
|
|
8
|
+
$field-help: sass.fn-naming-prefix("field-help");
|
|
9
|
+
$field-direction-left: sass.fn-naming-prefix("direction", "left");
|
|
10
|
+
$field-direction-right: sass.fn-naming-prefix("direction", "right");
|
|
11
|
+
|
|
12
|
+
// Property name
|
|
13
|
+
$border-radius: sass.fn-naming-var("border-radius");
|
|
14
|
+
$border-width: sass.fn-naming-var("stroke", "width");
|
|
15
|
+
$border-color: sass.fn-naming-var("item", "border-color");
|
|
16
|
+
$role-color: sass.fn-naming-var("item", "background-color");
|
|
17
|
+
$base-color: sass.fn-naming-var("base", "color");
|
|
18
|
+
$line: sass.fn-naming-var("field", "line");
|
|
19
|
+
$max-line: sass.fn-naming-var("field", "max-line");
|
|
20
|
+
|
|
21
|
+
$spacing-x: sass.fn-naming-var("spacing", "x");
|
|
22
|
+
$spacing-y: sass.fn-naming-var("spacing", "y");
|
|
23
|
+
|
|
24
|
+
$size-font-size: sass.fn-naming-var("font-size");
|
|
25
|
+
$size-height: sass.fn-naming-var("height");
|
|
26
|
+
$size-coefficient-x: sass.fn-naming-var("coefficient-x");
|
|
27
|
+
$size-coefficient-y: sass.fn-naming-var("coefficient-y");
|
|
28
|
+
$size-line-height: sass.fn-naming-var("line-height");
|
|
29
|
+
|
|
30
|
+
$transition-duration: sass.fn-naming-var("motion", "duration");
|
|
31
|
+
|
|
32
|
+
.#{$field} {
|
|
33
|
+
width: 100%;
|
|
34
|
+
box-shadow: none !important;
|
|
35
|
+
|
|
36
|
+
// Field
|
|
37
|
+
.#{$field-content} {
|
|
38
|
+
transition:
|
|
39
|
+
box-shadow #{$transition-duration} ease,
|
|
40
|
+
border-color #{$transition-duration} ease,
|
|
41
|
+
background-color #{$transition-duration} ease,
|
|
42
|
+
color #{$transition-duration} ease,
|
|
43
|
+
border-radius #{$transition-duration} ease;
|
|
44
|
+
border-color: rgb(#{$border-color});
|
|
45
|
+
border-radius: #{$border-radius};
|
|
46
|
+
border-width: #{$border-width};
|
|
47
|
+
border-style: solid;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
line-height: 0;
|
|
50
|
+
height: fit-content;
|
|
51
|
+
position: relative;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Input
|
|
55
|
+
.#{$field-input} {
|
|
56
|
+
padding: calc(#{$spacing-y} * #{$size-coefficient-y})
|
|
57
|
+
calc(#{$spacing-x} * #{$size-coefficient-x});
|
|
58
|
+
position: relative;
|
|
59
|
+
background-color: transparent;
|
|
60
|
+
z-index: 2;
|
|
61
|
+
min-height: calc(#{$line} * #{$size-height} - 2 * #{$border-width});
|
|
62
|
+
max-height: calc(#{$max-line} * #{$size-height} - 2 * #{$border-width});
|
|
63
|
+
color: rgb(#{$base-color});
|
|
64
|
+
caret-color: rgb(#{$base-color});
|
|
65
|
+
border: none;
|
|
66
|
+
user-select: all;
|
|
67
|
+
font-size: #{$size-font-size};
|
|
68
|
+
line-height: #{$size-line-height};
|
|
69
|
+
box-sizing: border-box;
|
|
70
|
+
transition:
|
|
71
|
+
box-shadow #{$transition-duration} ease,
|
|
72
|
+
border-color #{$transition-duration} ease,
|
|
73
|
+
background-color #{$transition-duration} ease,
|
|
74
|
+
color #{$transition-duration} ease,
|
|
75
|
+
border-radius #{$transition-duration} ease;
|
|
76
|
+
|
|
77
|
+
&:focus,
|
|
78
|
+
&:active,
|
|
79
|
+
&:hover {
|
|
80
|
+
outline: none;
|
|
81
|
+
border: none;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Firefox
|
|
85
|
+
-moz-appearance: textfield;
|
|
86
|
+
appearance: textfield;
|
|
87
|
+
|
|
88
|
+
// Chrome, Edge, Safari
|
|
89
|
+
&::-webkit-outer-spin-button,
|
|
90
|
+
&::-webkit-inner-spin-button {
|
|
91
|
+
-webkit-appearance: none;
|
|
92
|
+
margin: 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&::placeholder {
|
|
96
|
+
color: rgba(#{$base-color}, 0.5);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Message
|
|
101
|
+
.#{$field-message} {
|
|
102
|
+
color: rgb(#{$role-color});
|
|
103
|
+
font-size: 0.9em;
|
|
104
|
+
line-height: 1.5;
|
|
105
|
+
transition:
|
|
106
|
+
box-shadow #{$transition-duration} ease,
|
|
107
|
+
border-color #{$transition-duration} ease,
|
|
108
|
+
background-color #{$transition-duration} ease,
|
|
109
|
+
color #{$transition-duration} ease,
|
|
110
|
+
border-radius #{$transition-duration} ease;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Help
|
|
114
|
+
.#{$field-help} {
|
|
115
|
+
color: rgb(#{$base-color}, 0.75);
|
|
116
|
+
font-size: 0.8em;
|
|
117
|
+
line-height: 1.5;
|
|
118
|
+
transition:
|
|
119
|
+
box-shadow #{$transition-duration} ease,
|
|
120
|
+
border-color #{$transition-duration} ease,
|
|
121
|
+
background-color #{$transition-duration} ease,
|
|
122
|
+
color #{$transition-duration} ease,
|
|
123
|
+
border-radius #{$transition-duration} ease;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// State
|
|
127
|
+
&.active {
|
|
128
|
+
.#{$field-content} {
|
|
129
|
+
border-color: rgb(#{$border-color});
|
|
130
|
+
box-shadow: 0 0 0 calc(#{$border-width} * 1.5) rgb(#{$border-color});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&.focus {
|
|
135
|
+
&.shadow {
|
|
136
|
+
.#{$field-content} {
|
|
137
|
+
box-shadow: 0 0 0 0.25rem rgb(#{$border-color}, 0.25);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&.disabled {
|
|
143
|
+
opacity: 0.5;
|
|
144
|
+
cursor: not-allowed;
|
|
145
|
+
.#{$field-input} {
|
|
146
|
+
cursor: not-allowed;
|
|
147
|
+
user-select: none;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&.empty:not(.typing) {
|
|
152
|
+
.#{$field-input} {
|
|
153
|
+
&::before {
|
|
154
|
+
content: attr(placeholder);
|
|
155
|
+
color: rgba(#{$base-color}, 0.5);
|
|
156
|
+
transition: color #{$transition-duration} ease;
|
|
157
|
+
position: absolute;
|
|
158
|
+
height: calc(#{$size-height} - #{$border-width} * 2);
|
|
159
|
+
box-sizing: border-box;
|
|
160
|
+
top: 0;
|
|
161
|
+
pointer-events: none;
|
|
162
|
+
z-index: 0;
|
|
163
|
+
display: block;
|
|
164
|
+
white-space: pre-wrap;
|
|
165
|
+
word-break: break-word;
|
|
166
|
+
padding: inherit;
|
|
167
|
+
line-height: inherit;
|
|
168
|
+
font-size: inherit;
|
|
169
|
+
display: flex;
|
|
170
|
+
align-items: center;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Type
|
|
176
|
+
&.paragraph {
|
|
177
|
+
.#{$field-input} {
|
|
178
|
+
white-space: pre-wrap;
|
|
179
|
+
word-break: break-word;
|
|
180
|
+
display: flex;
|
|
181
|
+
align-items: start;
|
|
182
|
+
overflow: auto;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&.text {
|
|
187
|
+
.#{$field-input} {
|
|
188
|
+
white-space: nowrap;
|
|
189
|
+
display: flex;
|
|
190
|
+
align-items: center;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
&.password {
|
|
195
|
+
.#{$field-input} {
|
|
196
|
+
white-space: nowrap;
|
|
197
|
+
display: flex;
|
|
198
|
+
align-items: center;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Direction
|
|
203
|
+
&.#{$field-direction-left} {
|
|
204
|
+
.#{$field-input} {
|
|
205
|
+
justify-content: start;
|
|
206
|
+
text-align: left;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.#{$field-input}::before {
|
|
210
|
+
left: 0;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
&.#{$field-direction-right} {
|
|
215
|
+
.#{$field-input} {
|
|
216
|
+
justify-content: end;
|
|
217
|
+
text-align: right;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.#{$field-input}::before {
|
|
221
|
+
right: 0;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
<style lang="scss" src="./outline.scss" scoped></style>
|
|
2
|
+
<template src="./outline.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { computed, nextTick, ref, watch } from "vue";
|
|
5
|
+
import type { FieldProps, FieldEmit } from "../field.type";
|
|
6
|
+
import { property, withPrefix } from "../../../utils";
|
|
7
|
+
|
|
8
|
+
/// Define
|
|
9
|
+
/// ------------------------------------------------------------
|
|
10
|
+
const props = withDefaults(defineProps<FieldProps>(), {
|
|
11
|
+
modelValue: "",
|
|
12
|
+
type: "text",
|
|
13
|
+
size: "standard",
|
|
14
|
+
disabled: false,
|
|
15
|
+
readonly: false,
|
|
16
|
+
message: "",
|
|
17
|
+
help: "",
|
|
18
|
+
variant: "fill",
|
|
19
|
+
placeholder: "",
|
|
20
|
+
shadow: undefined,
|
|
21
|
+
direction: undefined,
|
|
22
|
+
});
|
|
23
|
+
const emit = defineEmits<FieldEmit>();
|
|
24
|
+
|
|
25
|
+
/// State
|
|
26
|
+
/// ------------------------------------------------------------
|
|
27
|
+
const isFocus = ref(false);
|
|
28
|
+
const contentRef = ref<HTMLElement>();
|
|
29
|
+
const caret = ref(0);
|
|
30
|
+
const isComposing = ref(false);
|
|
31
|
+
|
|
32
|
+
/// Computed
|
|
33
|
+
/// ------------------------------------------------------------
|
|
34
|
+
const content = computed(() => {
|
|
35
|
+
return props.value || props.modelValue;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const fieldAttrs = computed(() => {
|
|
39
|
+
return {
|
|
40
|
+
class: [
|
|
41
|
+
withPrefix(["layer", "item"]),
|
|
42
|
+
withPrefix(["role", props.role || ""]),
|
|
43
|
+
withPrefix(["shape", props.shape || ""]),
|
|
44
|
+
withPrefix("field"),
|
|
45
|
+
withPrefix(["size", props.size]),
|
|
46
|
+
withPrefix(["direction", props.direction || "left"]),
|
|
47
|
+
props.variant,
|
|
48
|
+
props.type,
|
|
49
|
+
{
|
|
50
|
+
disabled: props.disabled,
|
|
51
|
+
active: isFocus.value || props.message,
|
|
52
|
+
focus: isFocus.value,
|
|
53
|
+
shadow: props.shadow,
|
|
54
|
+
empty: !content.value,
|
|
55
|
+
readonly: props.readonly,
|
|
56
|
+
typing: isComposing.value,
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
style: {
|
|
60
|
+
[property(["field", "line"])]: props.line,
|
|
61
|
+
[property(["field", "max-line"])]: props.maxLine || props.line,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const fieldContentAttrs = computed(() => ({
|
|
67
|
+
class: [withPrefix("field-content")],
|
|
68
|
+
}));
|
|
69
|
+
|
|
70
|
+
const fieldInputAttrs = computed(() => ({
|
|
71
|
+
class: [withPrefix("field-input")],
|
|
72
|
+
name: props.name,
|
|
73
|
+
id: props.id,
|
|
74
|
+
placeholder: props.placeholder,
|
|
75
|
+
contenteditable: props.type !== "password" ? !props.disabled && !props.readonly : undefined,
|
|
76
|
+
autocomplete: props.autocomplete,
|
|
77
|
+
tabindex: props.disabled ? -1 : props.tabindex,
|
|
78
|
+
readonly: props.type === "password" ? props.readonly : undefined,
|
|
79
|
+
disabled: props.type === "password" ? props.disabled : undefined,
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
const fieldMessageAttrs = computed(() => ({
|
|
83
|
+
class: [withPrefix("field-message")],
|
|
84
|
+
}));
|
|
85
|
+
|
|
86
|
+
const fieldHelpAttrs = computed(() => ({
|
|
87
|
+
class: [withPrefix("field-help"), withPrefix(["layer", "surface"]), withPrefix(["role", "mode"])],
|
|
88
|
+
}));
|
|
89
|
+
|
|
90
|
+
/// Methods
|
|
91
|
+
/// ------------------------------------------------------------
|
|
92
|
+
const isBr = (node: Node): node is HTMLBRElement =>
|
|
93
|
+
node.nodeType === 1 && (node as HTMLElement).tagName === "BR";
|
|
94
|
+
|
|
95
|
+
const isBlockLineBreak = (node: Node, parent: Node | null): node is HTMLElement =>
|
|
96
|
+
parent != null && node.nodeType === 1 && ["DIV", "P"].includes((node as HTMLElement).tagName);
|
|
97
|
+
|
|
98
|
+
const getCaretOffset = (el: HTMLElement) => {
|
|
99
|
+
const selection = window.getSelection();
|
|
100
|
+
if (!selection || selection.rangeCount === 0) return 0;
|
|
101
|
+
|
|
102
|
+
const range = selection.getRangeAt(0);
|
|
103
|
+
const endContainer = range.endContainer;
|
|
104
|
+
const endOffset = range.endOffset;
|
|
105
|
+
let offset = 0;
|
|
106
|
+
|
|
107
|
+
function walk(node: Node, parent: Node | null): boolean {
|
|
108
|
+
if (node === endContainer) {
|
|
109
|
+
if (node.nodeType === 3) {
|
|
110
|
+
offset += endOffset;
|
|
111
|
+
} else if (isBr(node)) {
|
|
112
|
+
offset += endOffset > 0 ? 1 : 0;
|
|
113
|
+
} else if (isBlockLineBreak(node, parent)) {
|
|
114
|
+
offset += 1;
|
|
115
|
+
} else if (node === el) {
|
|
116
|
+
for (let i = 0; i < endOffset; i++) {
|
|
117
|
+
const child = node.childNodes[i];
|
|
118
|
+
if (!child) break;
|
|
119
|
+
if (child.nodeType === 3) offset += child.textContent?.length ?? 0;
|
|
120
|
+
else if (isBr(child)) offset += 1;
|
|
121
|
+
else if (isBlockLineBreak(child, el)) offset += 1;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
if (node.nodeType === 3) {
|
|
127
|
+
offset += node.textContent?.length ?? 0;
|
|
128
|
+
} else if (isBr(node)) {
|
|
129
|
+
offset += 1;
|
|
130
|
+
} else if (isBlockLineBreak(node, parent)) {
|
|
131
|
+
offset += 1;
|
|
132
|
+
}
|
|
133
|
+
for (const child of Array.from(node.childNodes)) {
|
|
134
|
+
if (walk(child, node)) return true;
|
|
135
|
+
}
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
walk(el, null);
|
|
139
|
+
return offset;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const setCaretOffset = (el: HTMLElement, offset: number) => {
|
|
143
|
+
const sel = window.getSelection();
|
|
144
|
+
if (!sel) return;
|
|
145
|
+
let current = 0;
|
|
146
|
+
const range = document.createRange();
|
|
147
|
+
|
|
148
|
+
function walk(node: Node): boolean {
|
|
149
|
+
if (node.nodeType === 3) {
|
|
150
|
+
const len = node.textContent?.length ?? 0;
|
|
151
|
+
const next = current + len;
|
|
152
|
+
if (offset <= next) {
|
|
153
|
+
range.setStart(node, Math.min(offset - current, len));
|
|
154
|
+
range.collapse(true);
|
|
155
|
+
sel!.removeAllRanges();
|
|
156
|
+
sel!.addRange(range);
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
current = next;
|
|
160
|
+
} else if (isBr(node)) {
|
|
161
|
+
if (offset <= current) {
|
|
162
|
+
range.setStartBefore(node);
|
|
163
|
+
range.collapse(true);
|
|
164
|
+
sel!.removeAllRanges();
|
|
165
|
+
sel!.addRange(range);
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
if (offset <= current + 1) {
|
|
169
|
+
range.setStartAfter(node);
|
|
170
|
+
range.collapse(true);
|
|
171
|
+
sel!.removeAllRanges();
|
|
172
|
+
sel!.addRange(range);
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
current += 1;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
for (const child of Array.from(node.childNodes)) {
|
|
179
|
+
if (walk(child)) return true;
|
|
180
|
+
}
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
walk(el);
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const onInput = (ev: Event) => {
|
|
188
|
+
if (props.disabled || props.readonly || isComposing.value) return;
|
|
189
|
+
|
|
190
|
+
caret.value = getCaretOffset(ev.target as HTMLElement);
|
|
191
|
+
emit("input", ev);
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const onCompositionStart = () => {
|
|
195
|
+
isComposing.value = true;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const onCompositionEnd = (ev: CompositionEvent) => {
|
|
199
|
+
const el = ev.target as HTMLElement;
|
|
200
|
+
isComposing.value = false;
|
|
201
|
+
nextTick(() => {
|
|
202
|
+
caret.value = getCaretOffset(el);
|
|
203
|
+
const inputEv = new InputEvent("input", { bubbles: true });
|
|
204
|
+
el.dispatchEvent(inputEv);
|
|
205
|
+
emit("input", inputEv);
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const onFocus = (ev: FocusEvent) => {
|
|
210
|
+
if (props.disabled) return;
|
|
211
|
+
isFocus.value = true;
|
|
212
|
+
emit("focus", ev);
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const onBlur = (ev: FocusEvent) => {
|
|
216
|
+
if (props.disabled) return;
|
|
217
|
+
isFocus.value = false;
|
|
218
|
+
emit("blur", ev);
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
const onBeforeinput = (ev: Event) => {
|
|
222
|
+
if (props.disabled || props.readonly) {
|
|
223
|
+
ev.preventDefault();
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
emit("beforeinput", ev);
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
/// Lifecycle
|
|
230
|
+
/// ------------------------------------------------------------
|
|
231
|
+
watch(
|
|
232
|
+
() => content.value,
|
|
233
|
+
async (val) => {
|
|
234
|
+
if (!isFocus.value || isComposing.value) return;
|
|
235
|
+
const el = contentRef.value;
|
|
236
|
+
if (!el) return;
|
|
237
|
+
await nextTick();
|
|
238
|
+
el.focus();
|
|
239
|
+
setCaretOffset(el, caret.value);
|
|
240
|
+
},
|
|
241
|
+
{ immediate: true }
|
|
242
|
+
);
|
|
243
|
+
</script>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
@use "@toife/sass-layer-generator" as sass;
|
|
2
|
+
|
|
3
|
+
// Classes
|
|
4
|
+
$form-group: sass.fn-naming-prefix("form-group");
|
|
5
|
+
$button: sass.fn-naming-prefix("button");
|
|
6
|
+
$field: sass.fn-naming-prefix("field");
|
|
7
|
+
$field-content: sass.fn-naming-prefix("field-content");
|
|
8
|
+
|
|
9
|
+
.#{$form-group} {
|
|
10
|
+
display: flex;
|
|
11
|
+
|
|
12
|
+
> :deep(*) {
|
|
13
|
+
flex: 1;
|
|
14
|
+
|
|
15
|
+
&.focus {
|
|
16
|
+
z-index: 2;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&.horizontal {
|
|
21
|
+
flex-direction: row;
|
|
22
|
+
|
|
23
|
+
:deep(.#{$button}) {
|
|
24
|
+
&:not(:last-child):not(:first-child) {
|
|
25
|
+
border-radius: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&:first-child:not(:last-child) {
|
|
29
|
+
border-top-right-radius: 0;
|
|
30
|
+
border-bottom-right-radius: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&:last-child:not(:first-child) {
|
|
34
|
+
border-top-left-radius: 0;
|
|
35
|
+
border-bottom-left-radius: 0;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:deep(.#{$field}) {
|
|
40
|
+
&:not(:last-child):not(:first-child) .#{$field-content} {
|
|
41
|
+
border-radius: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:first-child:not(:last-child) .#{$field-content} {
|
|
45
|
+
border-top-right-radius: 0;
|
|
46
|
+
border-bottom-right-radius: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&:last-child:not(:first-child) .#{$field-content} {
|
|
50
|
+
border-top-left-radius: 0;
|
|
51
|
+
border-bottom-left-radius: 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&.vertical {
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
|
|
59
|
+
:deep(.#{$button}) {
|
|
60
|
+
&:not(:last-child):not(:first-child) {
|
|
61
|
+
border-radius: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&:first-child:not(:last-child) {
|
|
65
|
+
border-bottom-left-radius: 0;
|
|
66
|
+
border-bottom-right-radius: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&:last-child:not(:first-child) {
|
|
70
|
+
border-top-left-radius: 0;
|
|
71
|
+
border-top-right-radius: 0;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:deep(.#{$field}) {
|
|
76
|
+
&:not(:last-child):not(:first-child) .#{$field-content} {
|
|
77
|
+
border-radius: 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:first-child:not(:last-child) .#{$field-content} {
|
|
81
|
+
border-bottom-left-radius: 0;
|
|
82
|
+
border-bottom-right-radius: 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&:last-child:not(:first-child) .#{$field-content} {
|
|
86
|
+
border-top-left-radius: 0;
|
|
87
|
+
border-top-right-radius: 0;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<style lang="scss" src="./form-group.scss" scoped></style>
|
|
2
|
+
<template src="./form-group.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { withPrefix } from "@/utils";
|
|
5
|
+
import { computed } from "vue";
|
|
6
|
+
import { type FormGroupProps } from "./form-group.type";
|
|
7
|
+
|
|
8
|
+
/// Defined
|
|
9
|
+
/// ------------------------------------------------------------
|
|
10
|
+
const props = withDefaults(defineProps<FormGroupProps>(), {
|
|
11
|
+
orientation: "horizontal",
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
/// Computed
|
|
15
|
+
/// ------------------------------------------------------------
|
|
16
|
+
const formGroupAttrs = computed(() => {
|
|
17
|
+
return {
|
|
18
|
+
class: [withPrefix("form-group"), props.orientation],
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div v-bind="gestureIndicatorAttrs"></div>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
@use "@toife/sass-layer-generator" as sass;
|
|
2
|
+
|
|
3
|
+
// Class name
|
|
4
|
+
$gesture-indicator: sass.fn-naming-prefix("gesture-indicator");
|
|
5
|
+
|
|
6
|
+
// Property name - layer: stroke
|
|
7
|
+
$border-color: sass.fn-naming-var("stroke", "border-color");
|
|
8
|
+
$transition-duration: sass.fn-naming-var("motion", "duration");
|
|
9
|
+
|
|
10
|
+
.#{$gesture-indicator} {
|
|
11
|
+
background-color: rgb(#{$border-color});
|
|
12
|
+
transition:
|
|
13
|
+
box-shadow #{$transition-duration} ease,
|
|
14
|
+
border-color #{$transition-duration} ease,
|
|
15
|
+
background-color #{$transition-duration} ease,
|
|
16
|
+
color #{$transition-duration} ease,
|
|
17
|
+
border-radius #{$transition-duration} ease;
|
|
18
|
+
position: absolute;
|
|
19
|
+
border-radius: 3px;
|
|
20
|
+
z-index: 99;
|
|
21
|
+
|
|
22
|
+
&.bottom {
|
|
23
|
+
width: 40px;
|
|
24
|
+
height: 4px;
|
|
25
|
+
top: 5px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&.top {
|
|
29
|
+
width: 40px;
|
|
30
|
+
height: 4px;
|
|
31
|
+
bottom: 5px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&.left {
|
|
35
|
+
height: 40px;
|
|
36
|
+
width: 4px;
|
|
37
|
+
right: 5px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.right {
|
|
41
|
+
height: 40px;
|
|
42
|
+
width: 4px;
|
|
43
|
+
left: 5px;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<style lang="scss" src="./gesture-indicator.scss" scoped></style>
|
|
2
|
+
<template src="./gesture-indicator.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { withPrefix } from "../../utils";
|
|
5
|
+
import { type GestureIndicatorProps } from "./gesture-indicator.type";
|
|
6
|
+
import { computed, inject } from "vue";
|
|
7
|
+
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
|
|
8
|
+
|
|
9
|
+
/// Define
|
|
10
|
+
/// ------------------------------------------------------------
|
|
11
|
+
const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
|
|
12
|
+
const props = withDefaults(defineProps<GestureIndicatorProps>(), {
|
|
13
|
+
placement: "bottom",
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
/// Computed
|
|
17
|
+
/// ------------------------------------------------------------
|
|
18
|
+
const role = computed(() => {
|
|
19
|
+
return appState?.role.value || "";
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const gestureIndicatorAttrs = computed(() => {
|
|
23
|
+
return {
|
|
24
|
+
class: [
|
|
25
|
+
withPrefix(["layer", "stroke"]),
|
|
26
|
+
withPrefix(["role", role.value]),
|
|
27
|
+
withPrefix("gesture-indicator"),
|
|
28
|
+
props.placement,
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as GestureIndicator } from "./gesture-indicator.vue";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<img @error="handleError" :src="dataSrc" />
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Add styles here if needed
|