@toife/vue 3.0.3 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/package.json +1 -1
  2. package/src/components/action/action.composable.ts +1 -0
  3. package/src/components/action/action.scss +4 -3
  4. package/src/components/action/action.type.ts +10 -1
  5. package/src/components/action/action.vue +12 -10
  6. package/src/components/app/app.scss +4 -4
  7. package/src/components/app/app.type.ts +9 -0
  8. package/src/components/app/app.vue +8 -7
  9. package/src/components/avatar/avatar.scss +2 -2
  10. package/src/components/avatar/avatar.type.ts +1 -1
  11. package/src/components/avatar/avatar.vue +4 -13
  12. package/src/components/button/button.scss +24 -26
  13. package/src/components/button/button.type.ts +1 -1
  14. package/src/components/button/button.vue +8 -8
  15. package/src/components/cable/cable.type.ts +1 -1
  16. package/src/components/cable/cable.vue +8 -8
  17. package/src/components/card/card/card.scss +5 -4
  18. package/src/components/card/card/card.type.ts +1 -1
  19. package/src/components/card/card/card.vue +6 -6
  20. package/src/components/card/card-body/card-body.scss +4 -4
  21. package/src/components/card/card-footer/card-footer.scss +7 -6
  22. package/src/components/card/card-footer/card-footer.vue +4 -4
  23. package/src/components/card/card-header/card-header.scss +7 -6
  24. package/src/components/card/card-header/card-header.vue +4 -4
  25. package/src/components/checkbox/checkbox.html +0 -1
  26. package/src/components/checkbox/checkbox.scss +20 -20
  27. package/src/components/checkbox/checkbox.vue +8 -8
  28. package/src/components/collapse/collapse.scss +7 -7
  29. package/src/components/collapse/collapse.type.ts +1 -1
  30. package/src/components/collapse/collapse.vue +15 -19
  31. package/src/components/container/container.vue +1 -0
  32. package/src/components/decision-modal/decision-modal.composable.ts +1 -0
  33. package/src/components/decision-modal/decision-modal.scss +5 -4
  34. package/src/components/decision-modal/decision-modal.type.ts +1 -1
  35. package/src/components/decision-modal/decision-modal.vue +11 -11
  36. package/src/components/divider/divider.scss +4 -4
  37. package/src/components/divider/divider.vue +4 -4
  38. package/src/components/field/field.type.ts +1 -1
  39. package/src/components/field/field.vue +7 -6
  40. package/src/components/field/outline/outline.scss +13 -12
  41. package/src/components/field/outline/outline.vue +10 -10
  42. package/src/components/form-group/form-group.vue +4 -4
  43. package/src/components/gesture-indicator/gesture-indicator.scss +2 -2
  44. package/src/components/gesture-indicator/gesture-indicator.type.ts +1 -1
  45. package/src/components/gesture-indicator/gesture-indicator.vue +5 -5
  46. package/src/components/image/image.type.ts +1 -1
  47. package/src/components/image/image.vue +10 -13
  48. package/src/components/modal/modal.scss +2 -2
  49. package/src/components/modal/modal.vue +11 -9
  50. package/src/components/page/page.vue +1 -0
  51. package/src/components/present/present.composable.ts +1 -0
  52. package/src/components/present/present.scss +3 -3
  53. package/src/components/present/present.vue +12 -12
  54. package/src/components/radio/radio/radio.scss +26 -21
  55. package/src/components/radio/radio/radio.type.ts +1 -1
  56. package/src/components/radio/radio/radio.vue +8 -8
  57. package/src/components/radio/radio-group/radio-group.vue +6 -6
  58. package/src/components/refresher/refresher.type.ts +1 -1
  59. package/src/components/refresher/refresher.vue +11 -11
  60. package/src/components/route/route-navigator/route-navigator.type.ts +24 -0
  61. package/src/components/route/route-navigator/route-navigator.vue +33 -16
  62. package/src/components/route/route-outlet/route-outlet.vue +20 -11
  63. package/src/components/route/route-provider/route-provider.vue +6 -6
  64. package/src/components/route/route-wrapper/route-wrapper.composable.ts +4 -3
  65. package/src/components/route/route-wrapper/route-wrapper.vue +7 -5
  66. package/src/components/route/route.util.ts +1 -0
  67. package/src/components/segmented-field/segmented-field.scss +4 -3
  68. package/src/components/segmented-field/segmented-field.vue +8 -8
  69. package/src/components/skeleton/skeleton.scss +14 -9
  70. package/src/components/skeleton/skeleton.type.ts +1 -1
  71. package/src/components/skeleton/skeleton.vue +4 -4
  72. package/src/components/switch/switch.html +0 -1
  73. package/src/components/switch/switch.scss +15 -14
  74. package/src/components/switch/switch.type.ts +1 -1
  75. package/src/components/switch/switch.vue +8 -8
  76. package/src/components/tabs/tab/tab.type.ts +1 -1
  77. package/src/components/tabs/tab/tab.vue +6 -6
  78. package/src/components/tabs/tabs/tabs.scss +14 -15
  79. package/src/components/tabs/tabs/tabs.type.ts +1 -1
  80. package/src/components/tabs/tabs/tabs.vue +13 -13
  81. package/src/components/toast/toast/toast.vue +6 -6
  82. package/src/components/toast/toast-content/toast-content.scss +8 -8
  83. package/src/components/toast/toast-content/toast-content.vue +7 -7
  84. package/src/components/toast/toast.composable.ts +1 -1
  85. package/src/components/toolbar/toolbar.scss +2 -2
  86. package/src/components/toolbar/toolbar.type.ts +1 -1
  87. package/src/components/toolbar/toolbar.vue +4 -4
  88. package/src/factory.ts +2 -1
  89. package/src/utils/element.ts +6 -0
  90. package/src/utils/events.ts +8 -2
  91. package/src/utils/style/index.ts +17 -2
  92. package/src/components/image/image.scss +0 -1
@@ -1,7 +1,6 @@
1
1
  <div
2
2
  v-bind="checkboxAttrs"
3
3
  :tabindex="disabled ? -1 : 0"
4
- role="checkbox"
5
4
  :aria-checked="props.modelValue"
6
5
  @click="onCheckbox"
7
6
  @focus="onFocus"
@@ -7,16 +7,16 @@ $shape-rounded: sass.fn-naming-prefix("shape-rounded");
7
7
  $shape-pill: sass.fn-naming-prefix("shape-pill");
8
8
 
9
9
  // Properties - layer: item
10
- $background-color: sass.fn-naming-var("checkbox", "background-color");
11
- $background-color-hover: sass.fn-naming-var("checkbox", "background-color", "soft");
12
- $background-color-inactive: sass.fn-naming-var("checkbox", "background-color", "soft");
13
- $background-color-contrast: sass.fn-naming-var("checkbox", "background-color", "contrast");
14
- $background-color-disabled: sass.fn-naming-var("checkbox", "background-color", "subtle");
10
+ $checkbox-background-color: sass.fn-naming-var("checkbox", "background-color");
11
+ $checkbox-background-color-hover: sass.fn-naming-var("checkbox", "background-color", "hover");
12
+ $checkbox-background-color-inactive: sass.fn-naming-var("checkbox", "background-color", "inactive");
13
+ $checkbox-background-color-contrast: sass.fn-naming-var("checkbox", "background-color", "contrast");
14
+ $checkbox-background-color-disabled: sass.fn-naming-var("checkbox", "background-color", "disabled");
15
15
 
16
- $color: sass.fn-naming-var("checkbox", "color");
16
+ $checkbox-color: sass.fn-naming-var("checkbox", "color");
17
17
 
18
- $border-color: sass.fn-naming-var("checkbox", "border-color");
19
- $border-color-inactive: sass.fn-naming-var("checkbox", "border-color", "subtle");
18
+ $checkbox-border-color: sass.fn-naming-var("checkbox", "border-color");
19
+ $checkbox-border-color-inactive: sass.fn-naming-var("checkbox", "border-color", "inactive");
20
20
 
21
21
  $transition-duration: sass.fn-naming-var("motion", "duration");
22
22
  $border-radius: sass.fn-naming-var("border-radius");
@@ -37,7 +37,7 @@ $border-radius: sass.fn-naming-var("border-radius");
37
37
  display: flex;
38
38
  align-items: center;
39
39
  justify-content: center;
40
- border: 1px solid rgb(#{$border-color-inactive});
40
+ border: 1px solid rgb(#{$checkbox-border-color-inactive});
41
41
  background-color: transparent;
42
42
  transition:
43
43
  box-shadow #{$transition-duration} ease,
@@ -53,7 +53,7 @@ $border-radius: sass.fn-naming-var("border-radius");
53
53
  content: "";
54
54
  width: 0.2rem;
55
55
  height: 0.5rem;
56
- border: solid rgb(#{$background-color-contrast});
56
+ border: solid rgb(#{$checkbox-background-color-contrast});
57
57
  border-width: 0 2px 2px 0;
58
58
  transform: rotate(45deg) scale(0);
59
59
  transform-origin: center;
@@ -77,13 +77,13 @@ $border-radius: sass.fn-naming-var("border-radius");
77
77
  &:not(.on) {
78
78
  .#{$checkbox-icon} {
79
79
  background-color: transparent;
80
- border-color: rgb(#{$border-color-inactive});
80
+ border-color: rgb(#{$checkbox-border-color-inactive});
81
81
  }
82
82
 
83
83
  &:not(.disabled):not(.readonly):hover {
84
84
  .#{$checkbox-icon} {
85
- border-color: rgb(#{$border-color});
86
- background-color: rgba(#{$background-color-hover}, 0.2);
85
+ border-color: rgb(#{$checkbox-border-color});
86
+ background-color: rgba(#{$checkbox-background-color-hover}, 0.2);
87
87
  }
88
88
  }
89
89
  }
@@ -91,8 +91,8 @@ $border-radius: sass.fn-naming-var("border-radius");
91
91
  &.on {
92
92
  &.fill {
93
93
  .#{$checkbox-icon} {
94
- background-color: rgb(#{$background-color});
95
- border-color: rgb(#{$background-color});
94
+ background-color: rgb(#{$checkbox-background-color});
95
+ border-color: rgb(#{$checkbox-background-color});
96
96
 
97
97
  &::after {
98
98
  transform: rotate(45deg) scale(1);
@@ -102,11 +102,11 @@ $border-radius: sass.fn-naming-var("border-radius");
102
102
 
103
103
  &.outline {
104
104
  .#{$checkbox-icon} {
105
- border-color: rgb(#{$background-color});
105
+ border-color: rgb(#{$checkbox-background-color});
106
106
 
107
107
  &::after {
108
108
  transform: rotate(45deg) scale(1);
109
- border-color: rgb(#{$background-color});
109
+ border-color: rgb(#{$checkbox-background-color});
110
110
  }
111
111
  }
112
112
  }
@@ -118,8 +118,8 @@ $border-radius: sass.fn-naming-var("border-radius");
118
118
 
119
119
  &.on {
120
120
  .#{$checkbox-icon} {
121
- background-color: rgb(#{$background-color-disabled});
122
- border-color: rgb(#{$background-color-disabled});
121
+ background-color: rgb(#{$checkbox-background-color-disabled});
122
+ border-color: rgb(#{$checkbox-background-color-disabled});
123
123
  }
124
124
  }
125
125
  }
@@ -131,7 +131,7 @@ $border-radius: sass.fn-naming-var("border-radius");
131
131
  &.focus {
132
132
  &.shadow {
133
133
  .#{$checkbox-icon} {
134
- box-shadow: 0 0 0 0.25rem rgb(#{$border-color}, 0.25);
134
+ box-shadow: 0 0 0 0.25rem rgb(#{$checkbox-border-color}, 0.25);
135
135
  }
136
136
  }
137
137
  }
@@ -6,8 +6,8 @@ import type { CheckboxProps, CheckboxEmit } from "./checkbox.type";
6
6
  import { withPrefix } from "../../utils";
7
7
  import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
8
8
 
9
- /// Define
10
- /// ------------------------------------------------------------
9
+ // Component setup (props, emits, injects)
10
+ // ----------------------------------------------------------------------------
11
11
  const props = withDefaults(defineProps<CheckboxProps>(), {
12
12
  modelValue: false,
13
13
  disabled: false,
@@ -18,12 +18,12 @@ const props = withDefaults(defineProps<CheckboxProps>(), {
18
18
  const emit = defineEmits<CheckboxEmit>();
19
19
  const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
20
20
 
21
- /// State
22
- /// ------------------------------------------------------------
21
+ // Reactive state
22
+ // ----------------------------------------------------------------------------
23
23
  const isFocused = ref(false);
24
24
 
25
- /// Computed
26
- /// ------------------------------------------------------------
25
+ // Computed properties
26
+ // ----------------------------------------------------------------------------
27
27
  const checkboxAttrs = computed(() => {
28
28
  const baseRole = appState?.role.value || "";
29
29
  const role = props.role || baseRole;
@@ -51,8 +51,8 @@ const checkboxIconAttrs = {
51
51
  class: [withPrefix("checkbox-icon")],
52
52
  } as const;
53
53
 
54
- /// Methods
55
- /// ------------------------------------------------------------
54
+ // Methods
55
+ // ----------------------------------------------------------------------------
56
56
  const onCheckbox = () => {
57
57
  if (props.disabled || props.readonly) return;
58
58
  emit("update:modelValue", !props.modelValue);
@@ -6,21 +6,21 @@ $collapse-trigger: sass.fn-naming-prefix("collapse-trigger");
6
6
  $collapse-content: sass.fn-naming-prefix("collapse-content");
7
7
  $collapse-content-inner: sass.fn-naming-prefix("collapse-content-inner");
8
8
 
9
- // Property
10
- $collapse-height: sass.fn-naming-dvar("collapse-height", 0);
9
+ // Property name - layer: collapse
10
+ $collapse-height: sass.fn-naming-dvar(("collapse", "height"), 0);
11
11
  $collapse-duration: sass.fn-naming-dvar(
12
- "collapse-duration",
12
+ ("collapse", "duration"),
13
13
  sass.fn-naming-var("motion", "duration")
14
14
  );
15
15
 
16
- $background-color: sass.fn-naming-var("collapse", "background-color");
17
- $color: sass.fn-naming-var("collapse", "color");
16
+ $collapse-background-color: sass.fn-naming-var("collapse", "background-color");
17
+ $collapse-color: sass.fn-naming-var("collapse", "color");
18
18
  $transition-duration: sass.fn-naming-var("motion", "duration");
19
19
 
20
20
  // Collapse
21
21
  .#{$collapse} {
22
- background-color: rgb(#{$background-color});
23
- color: rgb(#{$color});
22
+ background-color: rgb(#{$collapse-background-color});
23
+ color: rgb(#{$collapse-color});
24
24
  transition:
25
25
  background-color #{$transition-duration} ease,
26
26
  color #{$transition-duration} ease;
@@ -1,4 +1,4 @@
1
- // Define
1
+ // Type definitions
2
2
  export type CollapseProps = {
3
3
  modelValue?: boolean;
4
4
  duration?: number;
@@ -6,8 +6,8 @@ import type { CollapseEmit, CollapseProps } from "./collapse.type";
6
6
  import { withPrefix, property } from "../../utils";
7
7
  import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
8
8
 
9
- /// Define
10
- /// ------------------------------------------------------------
9
+ // Component setup (props, emits, injects)
10
+ // ----------------------------------------------------------------------------
11
11
  const props = withDefaults(defineProps<CollapseProps>(), {
12
12
  modelValue: false,
13
13
  duration: undefined,
@@ -17,14 +17,14 @@ const props = withDefaults(defineProps<CollapseProps>(), {
17
17
  const emit = defineEmits<CollapseEmit>();
18
18
  const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
19
19
 
20
- /// State
21
- /// ------------------------------------------------------------
20
+ // Reactive state
21
+ // ----------------------------------------------------------------------------
22
22
  const contentRef = ref<HTMLElement | null>(null);
23
23
  const contentHeight = ref(0);
24
24
  const isOpen = ref(false);
25
25
 
26
- /// Computed
27
- /// ------------------------------------------------------------
26
+ // Computed properties
27
+ // ----------------------------------------------------------------------------
28
28
  const role = computed(() => {
29
29
  return props.role ?? appState?.role.value ?? "";
30
30
  });
@@ -67,8 +67,8 @@ const contentAttrs = computed(() => {
67
67
 
68
68
  const contentInnerClass = computed(() => withPrefix("collapse-content-inner"));
69
69
 
70
- /// Methods
71
- /// ------------------------------------------------------------
70
+ // Methods
71
+ // ----------------------------------------------------------------------------
72
72
  const measureContent = () => {
73
73
  if (contentRef.value) {
74
74
  contentHeight.value = contentRef.value.scrollHeight;
@@ -85,15 +85,8 @@ const onTransitionEnd = () => {
85
85
  // Optional: hook for transition end (e.g. a11y)
86
86
  };
87
87
 
88
- /// Lifecycle
89
- /// ------------------------------------------------------------
90
- onMounted(async () => {
91
- if (isOpen.value) {
92
- await nextTick();
93
- measureContent();
94
- }
95
- });
96
-
88
+ // Lifecycle
89
+ // ----------------------------------------------------------------------------
97
90
  watch(
98
91
  () => props.modelValue,
99
92
  async (open) => {
@@ -125,7 +118,10 @@ watch(
125
118
  }
126
119
  );
127
120
 
128
- onMounted(() => {
129
- isOpen.value = Boolean(props.modelValue);
121
+ onMounted(async () => {
122
+ await nextTick();
123
+ if (isOpen.value) {
124
+ measureContent();
125
+ }
130
126
  });
131
127
  </script>
@@ -3,6 +3,7 @@
3
3
  <script lang="ts" setup>
4
4
  import { withPrefix } from "../../utils";
5
5
 
6
+ // Static layout wrapper classes
6
7
  const containerAttrs = {
7
8
  class: [withPrefix("container")],
8
9
  } as const;
@@ -7,6 +7,7 @@ const visible = ref(false);
7
7
  export const useDecisionModal = () => {
8
8
  const open = (props: DecisionModalComposableProps) => {
9
9
  data.value = props;
10
+ // Defer visibility so the modal mounts with props before entering the open transition
10
11
  setTimeout(() => {
11
12
  visible.value = true;
12
13
  }, 50);
@@ -9,8 +9,10 @@ $button: sass.fn-naming-prefix("button");
9
9
  $shape-pill: sass.fn-naming-prefix("shape-pill");
10
10
 
11
11
  // Property name - layer: decision-modal
12
+ $decision-modal-background-color: sass.fn-naming-var("decision-modal", "background-color");
13
+ $decision-modal-border-color: sass.fn-naming-var("decision-modal", "border-color");
14
+
12
15
  $border-radius: sass.fn-naming-var("border-radius");
13
- $background-color: sass.fn-naming-var("decision-modal", "background-color");
14
16
  $width: sass.fn-naming-var("viewport", "width");
15
17
  $max-width: sass.fn-naming-var("overlay", "max-width");
16
18
  $padding-y: sass.fn-naming-var("spacing", "y");
@@ -19,12 +21,11 @@ $margin-y: sass.fn-naming-var("spacing", "y");
19
21
  $margin-x: sass.fn-naming-var("spacing", "x");
20
22
  $animation-duration: sass.fn-naming-var("motion", "duration");
21
23
  $border-width: sass.fn-naming-var("stroke", "width");
22
- $border-color: sass.fn-naming-var("decision-modal", "border-color");
23
24
  $transition-duration: sass.fn-naming-var("motion", "duration");
24
25
 
25
26
  .#{$decision-modal} {
26
27
  // Styles
27
- background-color: rgb(#{$background-color});
28
+ background-color: rgb(#{$decision-modal-background-color});
28
29
  width: #{$width};
29
30
  max-width: #{$max-width};
30
31
  overflow: hidden;
@@ -103,7 +104,7 @@ $transition-duration: sass.fn-naming-var("motion", "duration");
103
104
  &.divider {
104
105
  .#{$decision-modal-header},
105
106
  .#{$decision-modal-footer} {
106
- border-color: rgb(#{$border-color});
107
+ border-color: rgb(#{$decision-modal-border-color});
107
108
  }
108
109
  }
109
110
 
@@ -1,6 +1,6 @@
1
1
  import { ButtonVariant } from "../button/button.type";
2
2
 
3
- // Define
3
+ // Type definitions
4
4
  export type DecisionModalButton = {
5
5
  text?: string;
6
6
  role?: string;
@@ -12,10 +12,8 @@ import {
12
12
  import { withPrefix } from "../../utils";
13
13
  import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
14
14
 
15
- /// Define
16
- /// ------------------------------------------------------------
17
- const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
18
- const emit = defineEmits<DecisionModalEmit>();
15
+ // Component setup (props, emits, injects)
16
+ // ----------------------------------------------------------------------------
19
17
  const props = withDefaults(defineProps<DecisionModalProps>(), {
20
18
  placement: "center",
21
19
  keepalive: false,
@@ -25,13 +23,15 @@ const props = withDefaults(defineProps<DecisionModalProps>(), {
25
23
  divider: undefined,
26
24
  flow: "row",
27
25
  });
26
+ const emit = defineEmits<DecisionModalEmit>();
27
+ const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
28
28
 
29
- /// State
30
- /// ------------------------------------------------------------
29
+ // Reactive state
30
+ // ----------------------------------------------------------------------------
31
31
  const pop = ref(false);
32
32
 
33
- /// Computed
34
- /// ------------------------------------------------------------
33
+ // Computed properties
34
+ // ----------------------------------------------------------------------------
35
35
  const shape = computed(() => {
36
36
  return props.shape || appState?.shape.value || "";
37
37
  });
@@ -77,8 +77,8 @@ const decisionModalFooterAttrs = computed(() => {
77
77
  };
78
78
  });
79
79
 
80
- /// Methods
81
- /// ------------------------------------------------------------
80
+ // Methods
81
+ // ----------------------------------------------------------------------------
82
82
  const onClose = (val: string) => {
83
83
  if (props.dismiss && props.dismiss.includes(val)) {
84
84
  emit("close", val);
@@ -92,7 +92,7 @@ const onClose = (val: string) => {
92
92
 
93
93
  const onChoose = (btn: DecisionModalButton) => {
94
94
  emit("close");
95
- btn.handler && btn.handler();
95
+ btn.handler?.();
96
96
  emit("choose", btn);
97
97
  };
98
98
  </script>
@@ -3,8 +3,8 @@
3
3
  // Class
4
4
  $divider: sass.fn-naming-prefix("divider");
5
5
 
6
- // Property - layer: stroke
7
- $border-color: sass.fn-naming-var("divider", "border-color");
6
+ // Property name - layer: divider
7
+ $divider-border-color: sass.fn-naming-var("divider", "border-color");
8
8
  $border-width: sass.fn-naming-var("stroke", "width");
9
9
  $transition-duration: sass.fn-naming-var("motion", "duration");
10
10
 
@@ -19,11 +19,11 @@ $transition-duration: sass.fn-naming-var("motion", "duration");
19
19
 
20
20
  &.horizontal {
21
21
  width: 100%;
22
- border-bottom: #{$border-width} solid rgb(#{$border-color});
22
+ border-bottom: #{$border-width} solid rgb(#{$divider-border-color});
23
23
  }
24
24
 
25
25
  &.vertical {
26
26
  height: 100%;
27
- border-right: #{$border-width} solid rgb(#{$border-color});
27
+ border-right: #{$border-width} solid rgb(#{$divider-border-color});
28
28
  }
29
29
  }
@@ -6,15 +6,15 @@ import { type DividerProps } from "./divider.type";
6
6
  import { computed, inject } from "vue";
7
7
  import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
8
8
 
9
- /// Define
10
- /// ------------------------------------------------------------
9
+ // Component setup (props, emits, injects)
10
+ // ----------------------------------------------------------------------------
11
11
  const props = withDefaults(defineProps<DividerProps>(), {
12
12
  orientation: "horizontal",
13
13
  });
14
14
  const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
15
15
 
16
- /// Computed
17
- /// ------------------------------------------------------------
16
+ // Computed properties
17
+ // ----------------------------------------------------------------------------
18
18
  const dividerAttrs = computed(() => {
19
19
  const role = props.role || appState?.role.value || "";
20
20
  return {
@@ -4,7 +4,7 @@ export type FieldVariant = "outline" | "fill" | "underline";
4
4
  export type FieldSize = "small" | "standard" | "large";
5
5
  export type FieldType = "text" | "number" | "email" | "password" | "tel" | "url" | "paragraph";
6
6
 
7
- // Define
7
+ // Type definitions
8
8
  export type FieldProps = {
9
9
  // Wrapper
10
10
  modelValue?: string;
@@ -6,8 +6,8 @@ import type { FieldEmit } from "./field.type";
6
6
  import { OutlineField } from "./outline";
7
7
  import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
8
8
 
9
- /// Define
10
- /// ------------------------------------------------------------
9
+ // Component setup (props, emits, injects)
10
+ // ----------------------------------------------------------------------------
11
11
  const props = withDefaults(defineProps<FieldProps>(), {
12
12
  modelValue: "",
13
13
  type: "text",
@@ -25,8 +25,8 @@ const props = withDefaults(defineProps<FieldProps>(), {
25
25
  const emit = defineEmits<FieldEmit>();
26
26
  const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
27
27
 
28
- /// Computed
29
- /// ------------------------------------------------------------
28
+ // Computed properties
29
+ // ----------------------------------------------------------------------------
30
30
  const role = computed(() => {
31
31
  return props.role || appState?.role.value || "";
32
32
  });
@@ -57,10 +57,11 @@ const fieldAttrs = computed(() => {
57
57
  };
58
58
  });
59
59
 
60
- /// Methods
61
- /// ------------------------------------------------------------
60
+ // Methods
61
+ // ----------------------------------------------------------------------------
62
62
  const onInput = (event: Event) => {
63
63
  let raw = "";
64
+ // Outline variant uses contenteditable for non-password types; password uses a real input
64
65
  if (props.type !== "password") {
65
66
  raw = (event.target as HTMLElement).innerText;
66
67
  } else {
@@ -9,14 +9,15 @@ $field-help: sass.fn-naming-prefix("field-help");
9
9
  $field-direction-left: sass.fn-naming-prefix("direction", "left");
10
10
  $field-direction-right: sass.fn-naming-prefix("direction", "right");
11
11
 
12
- // Property name
12
+ // Property name - layer: field
13
+ $field-border-color: sass.fn-naming-var("field", "border-color");
14
+ $field-background-color: sass.fn-naming-var("field", "background-color");
15
+ $field-line: sass.fn-naming-var("field", "line");
16
+ $field-max-line: sass.fn-naming-var("field", "max-line");
17
+
13
18
  $border-radius: sass.fn-naming-var("border-radius");
14
19
  $border-width: sass.fn-naming-var("stroke", "width");
15
- $border-color: sass.fn-naming-var("field", "border-color");
16
- $role-color: sass.fn-naming-var("field", "background-color");
17
20
  $app-color: sass.fn-naming-var("app", "color");
18
- $line: sass.fn-naming-var("field", "line");
19
- $max-line: sass.fn-naming-var("field", "max-line");
20
21
 
21
22
  $spacing-x: sass.fn-naming-var("spacing", "x");
22
23
  $spacing-y: sass.fn-naming-var("spacing", "y");
@@ -41,7 +42,7 @@ $transition-duration: sass.fn-naming-var("motion", "duration");
41
42
  background-color #{$transition-duration} ease,
42
43
  color #{$transition-duration} ease,
43
44
  border-radius #{$transition-duration} ease;
44
- border-color: rgb(#{$border-color});
45
+ border-color: rgb(#{$field-border-color});
45
46
  border-radius: #{$border-radius};
46
47
  border-width: #{$border-width};
47
48
  border-style: solid;
@@ -58,8 +59,8 @@ $transition-duration: sass.fn-naming-var("motion", "duration");
58
59
  position: relative;
59
60
  background-color: transparent;
60
61
  z-index: 2;
61
- min-height: calc(#{$line} * #{$size-height} - 2 * #{$border-width});
62
- max-height: calc(#{$max-line} * #{$size-height} - 2 * #{$border-width});
62
+ min-height: calc(#{$field-line} * #{$size-height} - 2 * #{$border-width});
63
+ max-height: calc(#{$field-max-line} * #{$size-height} - 2 * #{$border-width});
63
64
  color: rgb(#{$app-color});
64
65
  caret-color: rgb(#{$app-color});
65
66
  border: none;
@@ -99,7 +100,7 @@ $transition-duration: sass.fn-naming-var("motion", "duration");
99
100
 
100
101
  // Message
101
102
  .#{$field-message} {
102
- color: rgb(#{$role-color});
103
+ color: rgb(#{$field-background-color});
103
104
  font-size: 0.9em;
104
105
  line-height: 1.5;
105
106
  transition:
@@ -126,15 +127,15 @@ $transition-duration: sass.fn-naming-var("motion", "duration");
126
127
  // State
127
128
  &.active {
128
129
  .#{$field-content} {
129
- border-color: rgb(#{$border-color});
130
- box-shadow: 0 0 0 calc(#{$border-width} * 1.5) rgb(#{$border-color});
130
+ border-color: rgb(#{$field-border-color});
131
+ box-shadow: 0 0 0 calc(#{$border-width} * 1.5) rgb(#{$field-border-color});
131
132
  }
132
133
  }
133
134
 
134
135
  &.focus {
135
136
  &.shadow {
136
137
  .#{$field-content} {
137
- box-shadow: 0 0 0 0.25rem rgb(#{$border-color}, 0.25);
138
+ box-shadow: 0 0 0 0.25rem rgb(#{$field-border-color}, 0.25);
138
139
  }
139
140
  }
140
141
  }
@@ -5,8 +5,8 @@ import { computed, nextTick, ref, watch } from "vue";
5
5
  import type { FieldProps, FieldEmit } from "../field.type";
6
6
  import { property, withPrefix } from "../../../utils";
7
7
 
8
- /// Define
9
- /// ------------------------------------------------------------
8
+ // Component setup (props, emits, injects)
9
+ // ----------------------------------------------------------------------------
10
10
  const props = withDefaults(defineProps<FieldProps>(), {
11
11
  modelValue: "",
12
12
  type: "text",
@@ -22,15 +22,15 @@ const props = withDefaults(defineProps<FieldProps>(), {
22
22
  });
23
23
  const emit = defineEmits<FieldEmit>();
24
24
 
25
- /// State
26
- /// ------------------------------------------------------------
25
+ // Reactive state
26
+ // ----------------------------------------------------------------------------
27
27
  const isFocus = ref(false);
28
28
  const contentRef = ref<HTMLElement>();
29
29
  const caret = ref(0);
30
30
  const isComposing = ref(false);
31
31
 
32
- /// Computed
33
- /// ------------------------------------------------------------
32
+ // Computed properties
33
+ // ----------------------------------------------------------------------------
34
34
  const content = computed(() => {
35
35
  return props.value || props.modelValue;
36
36
  });
@@ -87,8 +87,8 @@ const fieldHelpAttrs = computed(() => ({
87
87
  class: [withPrefix("field-help")],
88
88
  }));
89
89
 
90
- /// Methods
91
- /// ------------------------------------------------------------
90
+ // Methods
91
+ // ----------------------------------------------------------------------------
92
92
  const isBr = (node: Node): node is HTMLBRElement =>
93
93
  node.nodeType === 1 && (node as HTMLElement).tagName === "BR";
94
94
 
@@ -226,8 +226,8 @@ const onBeforeinput = (ev: Event) => {
226
226
  emit("beforeinput", ev);
227
227
  };
228
228
 
229
- /// Lifecycle
230
- /// ------------------------------------------------------------
229
+ // Lifecycle
230
+ // ----------------------------------------------------------------------------
231
231
  watch(
232
232
  () => content.value,
233
233
  async (val) => {
@@ -5,14 +5,14 @@ import { withPrefix } from "../../utils";
5
5
  import { computed } from "vue";
6
6
  import { type FormGroupProps } from "./form-group.type";
7
7
 
8
- /// Defined
9
- /// ------------------------------------------------------------
8
+ // Component setup (props, emits, injects)
9
+ // ----------------------------------------------------------------------------
10
10
  const props = withDefaults(defineProps<FormGroupProps>(), {
11
11
  orientation: "horizontal",
12
12
  });
13
13
 
14
- /// Computed
15
- /// ------------------------------------------------------------
14
+ // Computed properties
15
+ // ----------------------------------------------------------------------------
16
16
  const formGroupAttrs = computed(() => {
17
17
  return {
18
18
  class: [withPrefix("form-group"), props.orientation],
@@ -4,11 +4,11 @@
4
4
  $gesture-indicator: sass.fn-naming-prefix("gesture-indicator");
5
5
 
6
6
  // Property name - layer: gesture-indicator
7
- $border-color: sass.fn-naming-var("gesture-indicator", "border-color");
7
+ $gesture-indicator-border-color: sass.fn-naming-var("gesture-indicator", "border-color");
8
8
  $transition-duration: sass.fn-naming-var("motion", "duration");
9
9
 
10
10
  .#{$gesture-indicator} {
11
- background-color: rgb(#{$border-color});
11
+ background-color: rgb(#{$gesture-indicator-border-color});
12
12
  transition:
13
13
  box-shadow #{$transition-duration} ease,
14
14
  border-color #{$transition-duration} ease,
@@ -1,4 +1,4 @@
1
- // Define
1
+ // Type definitions
2
2
  export type GestureIndicatorProps = {
3
3
  placement?: string;
4
4
  };
@@ -6,15 +6,15 @@ import { type GestureIndicatorProps } from "./gesture-indicator.type";
6
6
  import { computed, inject } from "vue";
7
7
  import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
8
8
 
9
- /// Define
10
- /// ------------------------------------------------------------
11
- const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
9
+ // Component setup (props, emits, injects)
10
+ // ----------------------------------------------------------------------------
12
11
  const props = withDefaults(defineProps<GestureIndicatorProps>(), {
13
12
  placement: "bottom",
14
13
  });
14
+ const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
15
15
 
16
- /// Computed
17
- /// ------------------------------------------------------------
16
+ // Computed properties
17
+ // ----------------------------------------------------------------------------
18
18
  const gestureIndicatorAttrs = computed(() => {
19
19
  const role = appState?.role.value || "";
20
20
  return {