@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toife/vue",
3
- "version": "3.0.3",
3
+ "version": "3.0.5",
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);
@@ -4,7 +4,9 @@
4
4
  $action: sass.fn-naming-prefix("action");
5
5
  $button: sass.fn-naming-prefix("button");
6
6
 
7
- // Property name
7
+ // Property name - layer: action
8
+ $action-border-color: sass.fn-naming-var("action", "border-color");
9
+
8
10
  $margin-y: sass.fn-naming-var("spacing", "y");
9
11
  $margin-x: sass.fn-naming-var("spacing", "x");
10
12
  $width: sass.fn-naming-var("viewport", "width");
@@ -17,7 +19,6 @@ $safe-area-top: sass.fn-naming-var("safe-area", "top");
17
19
  $safe-area-left: sass.fn-naming-var("safe-area", "left");
18
20
  $safe-area-right: sass.fn-naming-var("safe-area", "right");
19
21
  $border-width: sass.fn-naming-var("stroke", "width");
20
- $border-color: sass.fn-naming-var("action", "border-color");
21
22
 
22
23
  .#{$action} {
23
24
  // Styles
@@ -70,7 +71,7 @@ $border-color: sass.fn-naming-var("action", "border-color");
70
71
  &.divider {
71
72
  :deep(.#{$button}) {
72
73
  border-color: transparent;
73
- border-bottom-color: rgb(#{$border-color});
74
+ border-bottom-color: rgb(#{$action-border-color});
74
75
  }
75
76
  }
76
77
 
@@ -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") {
@@ -4,8 +4,8 @@
4
4
  $app: sass.fn-naming-prefix("app");
5
5
 
6
6
  // Property name - layer: app
7
- $background-color: sass.fn-naming-var("app", "background-color");
8
- $color: sass.fn-naming-var("app", "color");
7
+ $app-background-color: sass.fn-naming-var("app", "background-color");
8
+ $app-color: sass.fn-naming-var("app", "color");
9
9
  $transition-duration: sass.fn-naming-var("motion", "duration");
10
10
 
11
11
  .#{$app} {
@@ -13,8 +13,8 @@ $transition-duration: sass.fn-naming-var("motion", "duration");
13
13
  max-width: #{sass.fn-naming-var("viewport", "max-width")};
14
14
  height: #{sass.fn-naming-var("viewport", "height")};
15
15
  max-height: #{sass.fn-naming-var("viewport", "max-height")};
16
- background-color: rgb(#{$background-color});
17
- color: rgb(#{$color});
16
+ background-color: rgb(#{$app-background-color});
17
+ color: rgb(#{$app-color});
18
18
  transition:
19
19
  background-color #{$transition-duration} ease,
20
20
  color #{$transition-duration} ease,
@@ -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,
@@ -6,7 +6,7 @@ $shape-pill: sass.fn-naming-prefix("shape-pill");
6
6
 
7
7
  // Property - layer: avatar
8
8
  $border-radius: sass.fn-naming-var("border-radius");
9
- $background-color: sass.fn-naming-var("avatar", "background-color");
9
+ $avatar-background-color: sass.fn-naming-var("avatar", "background-color");
10
10
  $width: sass.fn-naming-var("width");
11
11
  $transition-duration: sass.fn-naming-var("motion", "duration");
12
12
 
@@ -15,7 +15,7 @@ $transition-duration: sass.fn-naming-var("motion", "duration");
15
15
  .#{$avatar} {
16
16
  position: relative;
17
17
  overflow: hidden;
18
- background-color: rgb(#{$background-color});
18
+ background-color: rgb(#{$avatar-background-color});
19
19
  width: #{$width};
20
20
  aspect-ratio: 1/1;
21
21
  border-radius: #{$border-radius};
@@ -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>
@@ -11,14 +11,19 @@ $transition-duration: sass.fn-naming-var("motion", "duration");
11
11
  $spacing-x: sass.fn-naming-var("spacing", "x");
12
12
  $spacing-y: sass.fn-naming-var("spacing", "y");
13
13
 
14
- $color: sass.fn-naming-var("button", "color");
14
+ $button-color: sass.fn-naming-var("button", "color");
15
15
 
16
- $border-color: sass.fn-naming-var("button", "border-color");
17
- $border-color-hover: sass.fn-naming-var("button", "border-color", "strong");
18
- $border-color-focus: sass.fn-naming-var("button", "border-color", "heavy");
19
- $border-color-active: sass.fn-naming-var("button", "border-color", "heavy");
20
- $border-color-disabled: sass.fn-naming-var("button", "border-color");
21
- $border-color-inactive: sass.fn-naming-var("button", "border-color", "soft");
16
+ $button-border-color: sass.fn-naming-var("button", "border-color");
17
+ $button-border-color-hover: sass.fn-naming-var("button", "border-color", "hover");
18
+ $button-border-color-focus: sass.fn-naming-var("button", "border-color", "focus");
19
+ $button-border-color-active: sass.fn-naming-var("button", "border-color", "active");
20
+ $button-border-color-disabled: sass.fn-naming-var("button", "border-color", "disabled");
21
+
22
+ $button-background-color: sass.fn-naming-var("button", "background-color");
23
+ $button-background-color-hover: sass.fn-naming-var("button", "background-color", "hover");
24
+ $button-background-color-focus: sass.fn-naming-var("button", "background-color", "focus");
25
+ $button-background-color-active: sass.fn-naming-var("button", "background-color", "active");
26
+ $button-background-color-disabled: sass.fn-naming-var("button", "background-color", "disabled");
22
27
 
23
28
  $size-font-size: sass.fn-naming-var("font-size");
24
29
  $size-height: sass.fn-naming-var("height");
@@ -26,22 +31,15 @@ $size-coefficient-x: sass.fn-naming-var("coefficient-x");
26
31
  $size-coefficient-y: sass.fn-naming-var("coefficient-y");
27
32
  $size-line-height: sass.fn-naming-var("line-height");
28
33
 
29
- $background-color: sass.fn-naming-var("button", "background-color");
30
- $background-color-hover: sass.fn-naming-var("button", "background-color", "strong");
31
- $background-color-focus: sass.fn-naming-var("button", "background-color", "heavy");
32
- $background-color-active: sass.fn-naming-var("button", "background-color", "heavy");
33
- $background-color-disabled: sass.fn-naming-var("button", "background-color");
34
- $background-color-inactive: sass.fn-naming-var("button", "background-color", "soft");
35
-
36
34
  .#{$button} {
37
35
  display: inline-flex;
38
36
  justify-content: center;
39
37
  align-items: center;
40
38
  position: relative;
41
39
  overflow: hidden;
42
- color: rgb(#{$color});
43
- background: rgb(#{$background-color});
44
- border-color: rgb(#{$border-color});
40
+ color: rgb(#{$button-color});
41
+ background: rgb(#{$button-background-color});
42
+ border-color: rgb(#{$button-border-color});
45
43
  border-style: solid;
46
44
  border-width: #{$border-width};
47
45
  white-space: nowrap;
@@ -61,30 +59,30 @@ $background-color-inactive: sass.fn-naming-var("button", "background-color", "so
61
59
  line-height: #{$size-line-height};
62
60
 
63
61
  &:hover {
64
- border-color: rgb(#{$border-color-hover});
65
- background-color: rgb(#{$background-color-hover});
62
+ border-color: rgb(#{$button-border-color-hover});
63
+ background-color: rgb(#{$button-background-color-hover});
66
64
  }
67
65
 
68
66
  &.focus,
69
67
  &:focus {
70
- border-color: rgb(#{$border-color-focus});
71
- background-color: rgb(#{$background-color-focus});
68
+ border-color: rgb(#{$button-border-color-focus});
69
+ background-color: rgb(#{$button-background-color-focus});
72
70
 
73
71
  &.shadow {
74
- box-shadow: 0 0 0 0.25rem rgb(#{$border-color}, 0.25);
72
+ box-shadow: 0 0 0 0.25rem rgb(#{$button-border-color}, 0.25);
75
73
  }
76
74
  }
77
75
 
78
76
  &:active,
79
77
  &.active {
80
- border-color: rgb(#{$border-color-active});
81
- background-color: rgb(#{$background-color-active});
78
+ border-color: rgb(#{$button-border-color-active});
79
+ background-color: rgb(#{$button-background-color-active});
82
80
  }
83
81
 
84
82
  &:disabled,
85
83
  &.disabled {
86
- border-color: rgba(#{$border-color-disabled}, 0.5);
87
- background-color: rgba(#{$background-color-disabled}, 0.5);
84
+ border-color: rgba(#{$button-border-color-disabled}, 0.5);
85
+ background-color: rgba(#{$button-background-color-disabled}, 0.5);
88
86
  cursor: not-allowed;
89
87
  }
90
88
 
@@ -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
  });
@@ -4,14 +4,15 @@
4
4
  $card: sass.fn-naming-prefix("card");
5
5
 
6
6
  // Property name - layer: card
7
- $background-color: sass.fn-naming-var("card", "background-color");
8
- $color: sass.fn-naming-var("card", "color");
7
+ $card-background-color: sass.fn-naming-var("card", "background-color");
8
+ $card-color: sass.fn-naming-var("card", "color");
9
+
9
10
  $border-radius: sass.fn-naming-var("border-radius");
10
11
  $transition-duration: sass.fn-naming-var("motion", "duration");
11
12
 
12
13
  .#{$card} {
13
- background-color: rgb(#{$background-color});
14
- color: rgb(#{$color});
14
+ background-color: rgb(#{$card-background-color});
15
+ color: rgb(#{$card-color});
15
16
  border-radius: #{$border-radius};
16
17
  transition:
17
18
  box-shadow #{$transition-duration} ease,
@@ -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,
@@ -4,15 +4,15 @@
4
4
  $card-body: sass.fn-naming-prefix("card-body");
5
5
 
6
6
  // Property name - layer: card
7
- $background-color: sass.fn-naming-var("card", "background-color");
8
- $color: sass.fn-naming-var("card", "color");
7
+ $card-background-color: sass.fn-naming-var("card", "background-color");
8
+ $card-color: sass.fn-naming-var("card", "color");
9
9
  $padding-y: sass.fn-naming-var("spacing", "y");
10
10
  $padding-x: sass.fn-naming-var("spacing", "x");
11
11
  $transition-duration: sass.fn-naming-var("motion", "duration");
12
12
 
13
13
  .#{$card-body} {
14
- background-color: rgb(#{$background-color});
15
- color: rgb(#{$color});
14
+ background-color: rgb(#{$card-background-color});
15
+ color: rgb(#{$card-color});
16
16
  padding: calc(#{$padding-y} * 4) calc(#{$padding-x} * 4);
17
17
  transition:
18
18
  box-shadow #{$transition-duration} ease,
@@ -4,18 +4,19 @@
4
4
  $card-footer: sass.fn-naming-prefix("card-footer");
5
5
 
6
6
  // Property name - layer: card
7
- $background-color: sass.fn-naming-var("card", "background-color");
8
- $color: sass.fn-naming-var("card", "color");
7
+ $card-background-color: sass.fn-naming-var("card", "background-color");
8
+ $card-color: sass.fn-naming-var("card", "color");
9
+ $card-border-color: sass.fn-naming-var("card", "border-color");
10
+
9
11
  $padding-y: sass.fn-naming-var("spacing", "y");
10
12
  $padding-x: sass.fn-naming-var("spacing", "x");
11
- $border-color: sass.fn-naming-var("card", "border-color");
12
13
  $border-width: sass.fn-naming-var("stroke", "width");
13
14
  $border: #{$border-width} solid transparent;
14
15
  $transition-duration: sass.fn-naming-var("motion", "duration");
15
16
 
16
17
  .#{$card-footer} {
17
- background-color: rgb(#{$background-color});
18
- color: rgb(#{$color});
18
+ background-color: rgb(#{$card-background-color});
19
+ color: rgb(#{$card-color});
19
20
  padding: calc(#{$padding-y} * 4) calc(#{$padding-x} * 4);
20
21
  border-top: #{$border};
21
22
  transition:
@@ -26,6 +27,6 @@ $transition-duration: sass.fn-naming-var("motion", "duration");
26
27
  border-radius #{$transition-duration} ease;
27
28
 
28
29
  &.divider {
29
- border-color: rgb(#{$border-color});
30
+ border-color: rgb(#{$card-border-color});
30
31
  }
31
32
  }
@@ -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 {
@@ -4,18 +4,19 @@
4
4
  $card-header: sass.fn-naming-prefix("card-header");
5
5
 
6
6
  // Property name - layer: card
7
- $background-color: sass.fn-naming-var("card", "background-color");
8
- $color: sass.fn-naming-var("card", "color");
7
+ $card-background-color: sass.fn-naming-var("card", "background-color");
8
+ $card-color: sass.fn-naming-var("card", "color");
9
+ $card-border-color: sass.fn-naming-var("card", "border-color");
10
+
9
11
  $padding-y: sass.fn-naming-var("spacing", "y");
10
12
  $padding-x: sass.fn-naming-var("spacing", "x");
11
- $border-color: sass.fn-naming-var("card", "border-color");
12
13
  $border-width: sass.fn-naming-var("stroke", "width");
13
14
  $border: #{$border-width} solid transparent;
14
15
  $transition-duration: sass.fn-naming-var("motion", "duration");
15
16
 
16
17
  .#{$card-header} {
17
- background-color: rgb(#{$background-color});
18
- color: rgb(#{$color});
18
+ background-color: rgb(#{$card-background-color});
19
+ color: rgb(#{$card-color});
19
20
  padding: calc(#{$padding-y} * 4) calc(#{$padding-x} * 4);
20
21
  border-bottom: #{$border};
21
22
  transition:
@@ -26,6 +27,6 @@ $transition-duration: sass.fn-naming-var("motion", "duration");
26
27
  border-radius #{$transition-duration} ease;
27
28
 
28
29
  &.divider {
29
- border-color: rgb(#{$border-color});
30
+ border-color: rgb(#{$card-border-color});
30
31
  }
31
32
  }
@@ -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 {