@toife/vue 3.0.3 → 3.0.4

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 (66) hide show
  1. package/package.json +1 -1
  2. package/src/components/action/action.composable.ts +1 -0
  3. package/src/components/action/action.type.ts +10 -1
  4. package/src/components/action/action.vue +12 -10
  5. package/src/components/app/app.type.ts +9 -0
  6. package/src/components/app/app.vue +8 -7
  7. package/src/components/avatar/avatar.type.ts +1 -1
  8. package/src/components/avatar/avatar.vue +4 -13
  9. package/src/components/button/button.type.ts +1 -1
  10. package/src/components/button/button.vue +8 -8
  11. package/src/components/cable/cable.type.ts +1 -1
  12. package/src/components/cable/cable.vue +8 -8
  13. package/src/components/card/card/card.type.ts +1 -1
  14. package/src/components/card/card/card.vue +6 -6
  15. package/src/components/card/card-footer/card-footer.vue +4 -4
  16. package/src/components/card/card-header/card-header.vue +4 -4
  17. package/src/components/checkbox/checkbox.vue +8 -8
  18. package/src/components/collapse/collapse.type.ts +1 -1
  19. package/src/components/collapse/collapse.vue +15 -19
  20. package/src/components/container/container.vue +1 -0
  21. package/src/components/decision-modal/decision-modal.composable.ts +1 -0
  22. package/src/components/decision-modal/decision-modal.type.ts +1 -1
  23. package/src/components/decision-modal/decision-modal.vue +11 -11
  24. package/src/components/divider/divider.vue +4 -4
  25. package/src/components/field/field.type.ts +1 -1
  26. package/src/components/field/field.vue +7 -6
  27. package/src/components/field/outline/outline.vue +10 -10
  28. package/src/components/form-group/form-group.vue +4 -4
  29. package/src/components/gesture-indicator/gesture-indicator.type.ts +1 -1
  30. package/src/components/gesture-indicator/gesture-indicator.vue +5 -5
  31. package/src/components/image/image.type.ts +1 -1
  32. package/src/components/image/image.vue +10 -12
  33. package/src/components/modal/modal.vue +11 -9
  34. package/src/components/page/page.vue +1 -0
  35. package/src/components/present/present.composable.ts +1 -0
  36. package/src/components/present/present.vue +12 -12
  37. package/src/components/radio/radio/radio.type.ts +1 -1
  38. package/src/components/radio/radio/radio.vue +8 -8
  39. package/src/components/radio/radio-group/radio-group.vue +6 -6
  40. package/src/components/refresher/refresher.type.ts +1 -1
  41. package/src/components/refresher/refresher.vue +11 -11
  42. package/src/components/route/route-navigator/route-navigator.type.ts +24 -0
  43. package/src/components/route/route-navigator/route-navigator.vue +33 -16
  44. package/src/components/route/route-outlet/route-outlet.vue +20 -11
  45. package/src/components/route/route-provider/route-provider.vue +6 -6
  46. package/src/components/route/route-wrapper/route-wrapper.composable.ts +4 -3
  47. package/src/components/route/route-wrapper/route-wrapper.vue +7 -5
  48. package/src/components/route/route.util.ts +1 -0
  49. package/src/components/segmented-field/segmented-field.vue +8 -8
  50. package/src/components/skeleton/skeleton.type.ts +1 -1
  51. package/src/components/skeleton/skeleton.vue +4 -4
  52. package/src/components/switch/switch.type.ts +1 -1
  53. package/src/components/switch/switch.vue +8 -8
  54. package/src/components/tabs/tab/tab.type.ts +1 -1
  55. package/src/components/tabs/tab/tab.vue +6 -6
  56. package/src/components/tabs/tabs/tabs.type.ts +1 -1
  57. package/src/components/tabs/tabs/tabs.vue +13 -13
  58. package/src/components/toast/toast/toast.vue +6 -6
  59. package/src/components/toast/toast-content/toast-content.vue +7 -7
  60. package/src/components/toast/toast.composable.ts +1 -1
  61. package/src/components/toolbar/toolbar.type.ts +1 -1
  62. package/src/components/toolbar/toolbar.vue +4 -4
  63. package/src/factory.ts +2 -1
  64. package/src/utils/element.ts +6 -0
  65. package/src/utils/events.ts +8 -2
  66. package/src/utils/style/index.ts +17 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toife/vue",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "description": "A Frontend framework for Vue",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -7,6 +7,7 @@ const visible = ref(false);
7
7
  export const useAction = () => {
8
8
  const open = (props: ActionComposableProps) => {
9
9
  data.value = props;
10
+ // Defer showing one frame so Present/transition hooks see a clean open cycle
10
11
  setTimeout(() => {
11
12
  visible.value = true;
12
13
  }, 50);
@@ -3,7 +3,7 @@ import { PresentPlacement } from "../present";
3
3
 
4
4
  export type ActionPlacement = PresentPlacement;
5
5
 
6
- // Define
6
+ // Type definitions
7
7
  export type ActionButton = {
8
8
  text?: string;
9
9
  role?: string;
@@ -13,6 +13,9 @@ export type ActionButton = {
13
13
  data?: unknown;
14
14
  };
15
15
 
16
+ /**
17
+ * Action Props Type
18
+ */
16
19
  export type ActionProps = {
17
20
  visible?: boolean;
18
21
  dismiss?: string[];
@@ -24,11 +27,17 @@ export type ActionProps = {
24
27
  placement?: ActionPlacement;
25
28
  };
26
29
 
30
+ /**
31
+ * Action Composable Props Type
32
+ */
27
33
  export type ActionComposableProps = ActionProps & {
28
34
  onClose?: (type?: string) => void;
29
35
  onChoose?: (btn?: ActionButton) => void;
30
36
  };
31
37
 
38
+ /**
39
+ * Action Emit Type
40
+ */
32
41
  export type ActionEmit = {
33
42
  (e: "close", type?: string): void;
34
43
  (e: "choose", btn: ActionButton): void;
@@ -9,10 +9,8 @@ import { type ActionEmit, type ActionButton, type ActionProps } from "./action.t
9
9
  import { withPrefix } from "../../utils";
10
10
  import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
11
11
 
12
- /// Define
13
- /// ------------------------------------------------------------
14
- const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
15
- const emit = defineEmits<ActionEmit>();
12
+ // Component setup (props, emits, injects)
13
+ // ----------------------------------------------------------------------------
16
14
  const props = withDefaults(defineProps<ActionProps>(), {
17
15
  visible: false,
18
16
  shape: undefined,
@@ -21,13 +19,16 @@ const props = withDefaults(defineProps<ActionProps>(), {
21
19
  divider: undefined,
22
20
  shadow: undefined,
23
21
  });
22
+ const emit = defineEmits<ActionEmit>();
23
+ const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
24
24
 
25
- /// State
26
- /// ------------------------------------------------------------
25
+ // Reactive state
26
+ // ----------------------------------------------------------------------------
27
+ // Brief "pop" class toggle when backdrop is tapped but the sheet stays open (visual feedback)
27
28
  const pop = ref(false);
28
29
 
29
- /// Computed
30
- /// ------------------------------------------------------------
30
+ // Computed properties
31
+ // ----------------------------------------------------------------------------
31
32
  const actionAttrs = computed(() => {
32
33
  const divider = (props?.divider !== undefined ? props.divider : appState?.divider.value) ?? false;
33
34
  const shadow = (props?.shadow !== undefined ? props.shadow : appState?.shadow.value) ?? false;
@@ -49,9 +50,10 @@ const actionAttrs = computed(() => {
49
50
  };
50
51
  });
51
52
 
52
- /// Methods
53
- /// ------------------------------------------------------------
53
+ // Methods
54
+ // ----------------------------------------------------------------------------
54
55
  const onClose = (val: string) => {
56
+ // Named dismiss sources close the sheet; backdrop tap may only play feedback unless listed in dismiss
55
57
  if (props.dismiss && props.dismiss.includes(val)) {
56
58
  emit("close", val);
57
59
  } else if (val === "backdrop") {
@@ -1,7 +1,13 @@
1
1
  import type { Ref } from "vue";
2
2
 
3
+ /**
4
+ * App Direction Type
5
+ */
3
6
  export type AppDirection = "left" | "right";
4
7
 
8
+ /**
9
+ * App Props Type
10
+ */
5
11
  export type AppProps = {
6
12
  shape?: string;
7
13
  divider?: boolean;
@@ -11,6 +17,9 @@ export type AppProps = {
11
17
  direction?: AppDirection;
12
18
  };
13
19
 
20
+ /**
21
+ * App Provider State Type
22
+ */
14
23
  export type AppProviderState = {
15
24
  shape: Ref<string>;
16
25
  divider: Ref<boolean>;
@@ -9,8 +9,8 @@ import { DecisionModal, useDecisionModal } from "../decision-modal";
9
9
  import { type AppProviderState, type AppProps } from "./app.type";
10
10
  import { APP_PROVIDER_STATE_KEY } from "./app.constants";
11
11
 
12
- /// Define
13
- /// ------------------------------------------------------------
12
+ // Component setup (props, emits, injects)
13
+ // ----------------------------------------------------------------------------
14
14
  const props = withDefaults(defineProps<AppProps>(), {
15
15
  shape: "pill",
16
16
  divider: false,
@@ -23,17 +23,18 @@ const { shape, divider, role, shadow, triple, direction } = toRefs(props);
23
23
  const decisionModal = useDecisionModal();
24
24
  const action = useAction();
25
25
 
26
- /// Computed
27
- /// ------------------------------------------------------------
28
- // Present attributes
26
+ // Computed properties
27
+ // ----------------------------------------------------------------------------
28
+ // Root layout classes for the application shell (global theme layer)
29
29
  const appAttrs = computed(() => {
30
30
  return {
31
31
  class: [withPrefix(["layer", "app"]), withPrefix(["shape", shape.value]), withPrefix("app")],
32
32
  };
33
33
  });
34
34
 
35
- // Export, Expose
36
- /// ------------------------------------------------------------
35
+ // Provide / expose (public API)
36
+ // ----------------------------------------------------------------------------
37
+ // Theme tokens for child components (shape, role, shadows, navigation direction)
37
38
  provide<AppProviderState>(APP_PROVIDER_STATE_KEY, {
38
39
  shape,
39
40
  divider,
@@ -1,4 +1,4 @@
1
- // Define
1
+ // Type definitions
2
2
  export type AvatarProps = {
3
3
  shape?: string;
4
4
  size?: string | number;
@@ -6,16 +6,16 @@ import { type AvatarProps } from "./avatar.type";
6
6
  import { property, 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<AvatarProps>(), {
12
12
  size: "22px",
13
13
  src: "",
14
14
  });
15
15
  const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
16
16
 
17
- /// Computed
18
- /// ------------------------------------------------------------
17
+ // Computed properties
18
+ // ----------------------------------------------------------------------------
19
19
  const avatarAttrs = computed(() => {
20
20
  const shape = props?.shape || appState?.shape.value || "";
21
21
  const role = appState?.role.value || "";
@@ -33,13 +33,4 @@ const avatarAttrs = computed(() => {
33
33
  },
34
34
  };
35
35
  });
36
-
37
- /// Methods
38
- /// ------------------------------------------------------------
39
-
40
- // Lifecycle
41
- /// ------------------------------------------------------------
42
-
43
- // Export, Expose
44
- /// ------------------------------------------------------------
45
36
  </script>
@@ -1,4 +1,4 @@
1
- // Define
1
+ // Type definitions
2
2
  export type ButtonVariant = "fill" | "outline" | "text" | "link";
3
3
 
4
4
  export type ButtonSize = "small" | "standard" | "large";
@@ -6,8 +6,8 @@ import { type ButtonProps } from "./button.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<ButtonProps>(), {
12
12
  size: "standard",
13
13
  block: false,
@@ -17,12 +17,12 @@ const props = withDefaults(defineProps<ButtonProps>(), {
17
17
  });
18
18
  const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
19
19
 
20
- /// State
21
- /// ------------------------------------------------------------
20
+ // Reactive state
21
+ // ----------------------------------------------------------------------------
22
22
  const isFocused = ref(false);
23
23
 
24
- /// Computed
25
- /// ------------------------------------------------------------
24
+ // Computed properties
25
+ // ----------------------------------------------------------------------------
26
26
  const buttonAttrs = computed(() => {
27
27
  const shape = props.shape || appState?.shape.value || "";
28
28
  const role = props.role || appState?.role.value || "";
@@ -49,8 +49,8 @@ const loaderAttrs = {
49
49
  class: [withPrefix("loader")],
50
50
  } as const;
51
51
 
52
- /// Methods
53
- /// ------------------------------------------------------------
52
+ // Methods
53
+ // ----------------------------------------------------------------------------
54
54
  const onFocus = () => {
55
55
  isFocused.value = true;
56
56
  };
@@ -1,6 +1,6 @@
1
1
  import type { Ref } from "vue";
2
2
 
3
- // Define
3
+ // Type definitions
4
4
  export type CableProps = {
5
5
  keyboard?: boolean;
6
6
  placement?: string;
@@ -6,27 +6,27 @@ import { type CableProviderState, type CableProps } from "./cable.type";
6
6
  import { withPrefix } from "../../utils";
7
7
  import { CABLE_PROVIDER_STATE_KEY } from "./cable.constants";
8
8
 
9
- /// Define
10
- /// ------------------------------------------------------------
9
+ // Component setup (props, emits, injects)
10
+ // ----------------------------------------------------------------------------
11
11
  const props = withDefaults(defineProps<CableProps>(), {
12
12
  keyboard: false,
13
13
  placement: "bottom",
14
14
  });
15
15
 
16
- /// State
17
- /// ------------------------------------------------------------
16
+ // Reactive state
17
+ // ----------------------------------------------------------------------------
18
18
  const { placement } = toRefs(props);
19
19
 
20
- /// Computed
21
- /// ------------------------------------------------------------
20
+ // Computed properties
21
+ // ----------------------------------------------------------------------------
22
22
  const cableAttrs = computed(() => {
23
23
  return {
24
24
  class: [withPrefix(["layer", "cable"]), withPrefix("cable"), placement.value],
25
25
  };
26
26
  });
27
27
 
28
- // Export, Expose
29
- /// ------------------------------------------------------------
28
+ // Provide / expose (public API)
29
+ // ----------------------------------------------------------------------------
30
30
  provide<CableProviderState>(CABLE_PROVIDER_STATE_KEY, {
31
31
  placement,
32
32
  });
@@ -1,6 +1,6 @@
1
1
  import { ComputedRef, Ref } from "vue";
2
2
 
3
- // Define
3
+ // Type definitions
4
4
  export type CardProps = {
5
5
  role?: string;
6
6
  shape?: string;
@@ -7,8 +7,8 @@ import { withPrefix } from "../../../utils";
7
7
  import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../../app";
8
8
  import { CARD_PROVIDER_STATE_KEY } from "./card.constants";
9
9
 
10
- /// Define
11
- /// ------------------------------------------------------------
10
+ // Component setup (props, emits, injects)
11
+ // ----------------------------------------------------------------------------
12
12
  const props = withDefaults(defineProps<CardProps>(), {
13
13
  divider: undefined,
14
14
  shape: undefined,
@@ -16,8 +16,8 @@ const props = withDefaults(defineProps<CardProps>(), {
16
16
  });
17
17
  const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
18
18
 
19
- /// Computed
20
- /// ------------------------------------------------------------
19
+ // Computed properties
20
+ // ----------------------------------------------------------------------------
21
21
  const divider = computed(() => {
22
22
  return (props?.divider !== undefined ? props.divider : appState?.divider.value) ?? false;
23
23
  });
@@ -52,8 +52,8 @@ const cardProviderState = computed(() => {
52
52
  };
53
53
  });
54
54
 
55
- /// Export, Expose
56
- /// ------------------------------------------------------------
55
+ // Provide / expose (public API)
56
+ // ----------------------------------------------------------------------------
57
57
  provide<CardProviderState>(CARD_PROVIDER_STATE_KEY, {
58
58
  role,
59
59
  shape,
@@ -5,12 +5,12 @@ import { computed, inject } from "vue";
5
5
  import { withPrefix } from "../../../utils";
6
6
  import { type CardProviderState, CARD_PROVIDER_STATE_KEY } from "../card";
7
7
 
8
- /// Define
9
- /// ------------------------------------------------------------
8
+ // Component setup (props, emits, injects)
9
+ // ----------------------------------------------------------------------------
10
10
  const cardProviderState = inject<CardProviderState>(CARD_PROVIDER_STATE_KEY);
11
11
 
12
- /// Computed
13
- /// ------------------------------------------------------------
12
+ // Computed properties
13
+ // ----------------------------------------------------------------------------
14
14
  const cardFooterAttrs = computed(() => {
15
15
  const divider = cardProviderState?.divider.value ?? false;
16
16
  return {
@@ -5,12 +5,12 @@ import { computed, inject } from "vue";
5
5
  import { withPrefix } from "../../../utils";
6
6
  import { type CardProviderState, CARD_PROVIDER_STATE_KEY } from "../card";
7
7
 
8
- /// Define
9
- /// ------------------------------------------------------------
8
+ // Component setup (props, emits, injects)
9
+ // ----------------------------------------------------------------------------
10
10
  const cardProviderState = inject<CardProviderState>(CARD_PROVIDER_STATE_KEY);
11
11
 
12
- /// Computed
13
- /// ------------------------------------------------------------
12
+ // Computed properties
13
+ // ----------------------------------------------------------------------------
14
14
  const cardHeaderAttrs = computed(() => {
15
15
  const divider = cardProviderState?.divider.value ?? false;
16
16
  return {
@@ -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);
@@ -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);
@@ -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>
@@ -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 {