@toife/vue 3.0.0 → 3.0.2

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 (98) hide show
  1. package/README.md +54 -1
  2. package/package.json +7 -7
  3. package/src/components/action/action.md +115 -0
  4. package/src/components/action/action.scss +1 -2
  5. package/src/components/action/action.vue +9 -21
  6. package/src/components/app/app.md +77 -0
  7. package/src/components/app/app.scss +3 -3
  8. package/src/components/app/app.vue +1 -1
  9. package/src/components/avatar/avatar.md +64 -0
  10. package/src/components/avatar/avatar.scss +2 -2
  11. package/src/components/avatar/avatar.vue +1 -1
  12. package/src/components/button/button.md +66 -0
  13. package/src/components/button/button.scss +13 -13
  14. package/src/components/button/button.vue +6 -11
  15. package/src/components/cable/cable.md +57 -0
  16. package/src/components/cable/cable.vue +1 -1
  17. package/src/components/card/card/card.md +57 -0
  18. package/src/components/card/card/card.scss +3 -3
  19. package/src/components/card/card/card.vue +1 -1
  20. package/src/components/card/card-body/card-body.md +34 -0
  21. package/src/components/card/card-body/card-body.scss +3 -3
  22. package/src/components/card/card-body/card-body.vue +3 -8
  23. package/src/components/card/card-footer/card-footer.md +42 -0
  24. package/src/components/card/card-footer/card-footer.scss +4 -4
  25. package/src/components/card/card-footer/card-footer.vue +2 -5
  26. package/src/components/card/card-header/card-header.md +44 -0
  27. package/src/components/card/card-header/card-header.scss +4 -4
  28. package/src/components/card/card-header/card-header.vue +2 -5
  29. package/src/components/checkbox/checkbox.md +60 -0
  30. package/src/components/checkbox/checkbox.scss +8 -8
  31. package/src/components/checkbox/checkbox.vue +11 -24
  32. package/src/components/collapse/collapse.md +59 -0
  33. package/src/components/collapse/collapse.scss +2 -2
  34. package/src/components/collapse/collapse.vue +1 -1
  35. package/src/components/container/container.md +38 -0
  36. package/src/components/container/container.vue +3 -8
  37. package/src/components/decision-modal/decision-modal.md +79 -0
  38. package/src/components/decision-modal/decision-modal.scss +3 -3
  39. package/src/components/decision-modal/decision-modal.vue +1 -1
  40. package/src/components/divider/divider.md +42 -0
  41. package/src/components/divider/divider.scss +1 -1
  42. package/src/components/divider/divider.vue +3 -6
  43. package/src/components/field/field.md +68 -0
  44. package/src/components/field/outline/outline-field.md +44 -0
  45. package/src/components/field/outline/outline.scss +8 -8
  46. package/src/components/field/outline/outline.vue +2 -2
  47. package/src/components/form-group/form-group.md +41 -0
  48. package/src/components/gesture-indicator/gesture-indicator.md +42 -0
  49. package/src/components/gesture-indicator/gesture-indicator.scss +2 -2
  50. package/src/components/gesture-indicator/gesture-indicator.vue +3 -6
  51. package/src/components/image/image.md +41 -0
  52. package/src/components/modal/modal.md +65 -0
  53. package/src/components/modal/modal.scss +2 -2
  54. package/src/components/modal/modal.vue +1 -1
  55. package/src/components/page/page.md +39 -0
  56. package/src/components/page/page.vue +3 -8
  57. package/src/components/present/present.md +60 -0
  58. package/src/components/present/present.vue +1 -1
  59. package/src/components/radio/radio/radio.md +53 -0
  60. package/src/components/radio/radio/radio.scss +8 -8
  61. package/src/components/radio/radio/radio.vue +7 -11
  62. package/src/components/radio/radio-group/radio-group.md +62 -0
  63. package/src/components/radio/radio-group/radio-group.vue +1 -6
  64. package/src/components/refresher/refresher.md +53 -0
  65. package/src/components/route/route-navigator/route-navigator.md +50 -0
  66. package/src/components/route/route-navigator/route-navigator.scss +1 -1
  67. package/src/components/route/route-navigator/route-navigator.vue +14 -9
  68. package/src/components/route/route-outlet/route-outlet.md +30 -0
  69. package/src/components/route/route-provider/route-provider.md +46 -0
  70. package/src/components/route/route-wrapper/route-wrapper.composable.ts +29 -14
  71. package/src/components/route/route-wrapper/route-wrapper.md +45 -0
  72. package/src/components/route/route-wrapper/route-wrapper.type.ts +4 -0
  73. package/src/components/route/route-wrapper/route-wrapper.vue +13 -5
  74. package/src/components/route/route.type.ts +1 -0
  75. package/src/components/segmented-field/segmented-field.md +58 -0
  76. package/src/components/segmented-field/segmented-field.scss +3 -3
  77. package/src/components/segmented-field/segmented-field.vue +20 -26
  78. package/src/components/skeleton/skeleton.md +47 -0
  79. package/src/components/skeleton/skeleton.scss +3 -3
  80. package/src/components/skeleton/skeleton.vue +1 -1
  81. package/src/components/switch/switch.md +57 -0
  82. package/src/components/switch/switch.scss +8 -8
  83. package/src/components/switch/switch.vue +9 -20
  84. package/src/components/tabs/tab/tab.md +52 -0
  85. package/src/components/tabs/tabs/tabs.md +59 -0
  86. package/src/components/tabs/tabs/tabs.scss +4 -6
  87. package/src/components/tabs/tabs/tabs.vue +4 -6
  88. package/src/components/toast/toast/toast.md +56 -0
  89. package/src/components/toast/toast-content/toast-content.md +41 -0
  90. package/src/components/toast/toast-content/toast-content.scss +4 -4
  91. package/src/components/toast/toast-content/toast-content.vue +5 -11
  92. package/src/components/toolbar/toolbar.md +57 -0
  93. package/src/components/toolbar/toolbar.scss +2 -2
  94. package/src/components/toolbar/toolbar.vue +5 -11
  95. package/src/factory.ts +2 -0
  96. package/src/utils/element.md +33 -0
  97. package/src/utils/events.md +29 -0
  98. package/src/utils/style.md +49 -0
package/README.md CHANGED
@@ -2,6 +2,59 @@
2
2
 
3
3
  Vue 3 component library for Toife. The package ships **source** (`src/`): your app bundles it and compiles Sass with your own configuration.
4
4
 
5
+ ## Documentation
6
+
7
+ Usage docs live **next to source** under `src/`. Authoring scaffold: [docs/template.md](docs/template.md).
8
+
9
+ ### Components
10
+
11
+ | Doc | Tag / export |
12
+ |-----|----------------|
13
+ | [action.md](src/components/action/action.md) | `t-action` |
14
+ | [app.md](src/components/app/app.md) | `t-app` |
15
+ | [avatar.md](src/components/avatar/avatar.md) | `t-avatar` |
16
+ | [button.md](src/components/button/button.md) | `t-button` |
17
+ | [cable.md](src/components/cable/cable.md) | `t-cable` |
18
+ | [card.md](src/components/card/card/card.md) | `t-card` |
19
+ | [card-header.md](src/components/card/card-header/card-header.md) | `t-card-header` |
20
+ | [card-body.md](src/components/card/card-body/card-body.md) | `t-card-body` |
21
+ | [card-footer.md](src/components/card/card-footer/card-footer.md) | `t-card-footer` |
22
+ | [checkbox.md](src/components/checkbox/checkbox.md) | `t-checkbox` |
23
+ | [collapse.md](src/components/collapse/collapse.md) | `t-collapse` |
24
+ | [container.md](src/components/container/container.md) | `t-container` |
25
+ | [decision-modal.md](src/components/decision-modal/decision-modal.md) | `t-decision-modal` |
26
+ | [divider.md](src/components/divider/divider.md) | `t-divider` |
27
+ | [field.md](src/components/field/field.md) | `t-field` |
28
+ | [form-group.md](src/components/form-group/form-group.md) | `t-form-group` |
29
+ | [gesture-indicator.md](src/components/gesture-indicator/gesture-indicator.md) | `t-gesture-indicator` |
30
+ | [image.md](src/components/image/image.md) | `t-image` |
31
+ | [modal.md](src/components/modal/modal.md) | `t-modal` |
32
+ | [page.md](src/components/page/page.md) | `t-page` |
33
+ | [present.md](src/components/present/present.md) | `t-present` |
34
+ | [radio.md](src/components/radio/radio/radio.md) | `t-radio` |
35
+ | [radio-group.md](src/components/radio/radio-group/radio-group.md) | `t-radio-group` |
36
+ | [refresher.md](src/components/refresher/refresher.md) | `t-refresher` |
37
+ | [route-navigator.md](src/components/route/route-navigator/route-navigator.md) | `t-route-navigator` |
38
+ | [route-wrapper.md](src/components/route/route-wrapper/route-wrapper.md) | `t-route-wrapper` |
39
+ | [route-provider.md](src/components/route/route-provider/route-provider.md) | `t-route-provider` |
40
+ | [route-outlet.md](src/components/route/route-outlet/route-outlet.md) | `t-route-outlet` |
41
+ | [segmented-field.md](src/components/segmented-field/segmented-field.md) | `t-segmented-field` |
42
+ | [skeleton.md](src/components/skeleton/skeleton.md) | `t-skeleton` |
43
+ | [switch.md](src/components/switch/switch.md) | `t-switch` |
44
+ | [tab.md](src/components/tabs/tab/tab.md) | `t-tab`) |
45
+ | [tabs.md](src/components/tabs/tabs/tabs.md) | `t-tabs` |
46
+ | [toast.md](src/components/toast/toast/toast.md) | `t-toast` |
47
+ | [toast-content.md](src/components/toast/toast-content/toast-content.md) | `t-toast-content` |
48
+ | [toolbar.md](src/components/toolbar/toolbar.md) | `t-toolbar` |
49
+
50
+ ### Utils
51
+
52
+ | Doc | Contents |
53
+ |-----|----------|
54
+ | [element.md](src/utils/element.md) | `isFormElement`, `blurCurrentActive` |
55
+ | [events.md](src/utils/events.md) | `preventDefault` |
56
+ | [style.md](src/utils/style.md) | `withPrefix`, `property`, `variable`, … |
57
+
5
58
  ## Requirements
6
59
 
7
60
  | Package | Notes |
@@ -160,7 +213,7 @@ import { utils } from "@toife/vue";
160
213
  // utils.* — see exports under src/utils
161
214
  ```
162
215
 
163
- See `src/utils` in the repo for concrete APIs.
216
+ See [src/utils/element.md](src/utils/element.md), [src/utils/events.md](src/utils/events.md), [src/utils/style.md](src/utils/style.md) and `src/utils/*.ts` for concrete APIs.
164
217
 
165
218
  ## Sass / theming
166
219
 
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@toife/vue",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "A Frontend framework for Vue",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
+ "main": "./src/index.ts",
8
+ "module": "./src/index.ts",
9
+ "types": "./src/index.ts",
7
10
  "exports": {
8
11
  ".": {
9
12
  "types": "./src/index.ts",
@@ -20,7 +23,7 @@
20
23
  "frontend",
21
24
  "web"
22
25
  ],
23
- "author": "Toikit",
26
+ "author": "Toivibe",
24
27
  "license": "MIT",
25
28
  "publishConfig": {
26
29
  "access": "public",
@@ -34,12 +37,10 @@
34
37
  },
35
38
  "scripts": {
36
39
  "dev": "vite",
37
- "typecheck": "tsc --noEmit",
40
+ "typecheck": "tsc",
38
41
  "build": "vite build",
39
42
  "format": "prettier . --write",
40
- "prepare": "husky",
41
- "test:dev": "vite --config test/vite.config.ts",
42
- "test:build": "vite build --config test/vite.config.ts"
43
+ "prepare": "husky"
43
44
  },
44
45
  "lint-staged": {
45
46
  "*.{js,ts,vue,json,css,scss,sass,md,html}": "prettier --write"
@@ -56,7 +57,6 @@
56
57
  "sass": "^1.90.0",
57
58
  "typescript": "^5.9.2",
58
59
  "vite": "^7.0.6",
59
- "vite-plugin-dts": "^4.5.4",
60
60
  "vue": "^3.5.0",
61
61
  "vue-router": "^4.0.0"
62
62
  },
@@ -0,0 +1,115 @@
1
+ # `<t-action>`
2
+
3
+ > Default prefix is `t-` — change via `createToife({ prefix: "..." })`.
4
+
5
+ ## Description
6
+
7
+ Action sheet: groups of buttons rendered inside `Present`, typically for quick choices or secondary menus. Control via props or the `useAction()` composable wired by `t-app`.
8
+
9
+ ## Requirements / dependencies
10
+
11
+ | Item | Notes |
12
+ | ----- | ----------------------------------------------------------------------------------------- |
13
+ | Vue | ^3.5 |
14
+ | Other | Prefer `t-app` for theme/context (`inject`). Depends on `Present`, `FormGroup`, `Button`. |
15
+
16
+ ## Basic usage
17
+
18
+ ```vue
19
+ <template>
20
+ <t-action
21
+ :visible="show"
22
+ :actions="[[{ text: 'Confirm', variant: 'fill', handler: onOk }]]"
23
+ placement="bottom"
24
+ @close="show = false"
25
+ @choose="onChoose"
26
+ />
27
+ </template>
28
+ ```
29
+
30
+ Or open via `useAction()` (wired by `t-app`):
31
+
32
+ ```ts
33
+ import { useAction } from "@toife/vue";
34
+
35
+ const action = useAction();
36
+ action.open({
37
+ actions: [[{ text: "OK", handler: () => {} }]],
38
+ onClose: () => {},
39
+ onChoose: (btn) => {},
40
+ });
41
+ ```
42
+
43
+ ## Props
44
+
45
+ | Prop | Type | Default | Description |
46
+ | ----------- | ----------------------- | ------------ | -------------------------------------------------------------- |
47
+ | `visible` | `boolean` | `false` | Show the action layer. |
48
+ | `dismiss` | `string[]` | — | `Present` close reasons that emit `close` (e.g. `'backdrop'`). |
49
+ | `actions` | `Array<ActionButton[]>` | _(required)_ | Rows of button groups; each row is an array of buttons. |
50
+ | `role` | `string` | — | Theme role override; default from `t-app`. |
51
+ | `shape` | `string` | — | Shape override; default from `t-app`. |
52
+ | `divider` | `boolean` | — | Divider; default from `t-app`. |
53
+ | `shadow` | `boolean` | — | Shadow; default from `t-app`. |
54
+ | `placement` | `PresentPlacement` | `"bottom"` | `Present` placement (`top`, `bottom`, …). |
55
+
56
+ **Type source:** `src/components/action/action.type.ts`
57
+
58
+ `ActionButton`: `text`, `role`, `variant`, `shadow`, `handler`, `data`.
59
+
60
+ ## Events (emits)
61
+
62
+ | Event | Payload | Description |
63
+ | -------- | ------------------- | --------------------------------------------------------- |
64
+ | `close` | `type?: string` | When `dismiss` matches the close reason. |
65
+ | `choose` | `btn: ActionButton` | After a button is chosen (after that button’s `handler`). |
66
+
67
+ ## Slots
68
+
69
+ | Slot | Slot props | Description |
70
+ | ------ | ---------- | -------------------------------------------- |
71
+ | `body` | — | Replaces the default button layout entirely. |
72
+
73
+ ## `v-model`
74
+
75
+ No `v-model` support.
76
+
77
+ ## Provide / inject / context
78
+
79
+ Injects `APP_PROVIDER_STATE_KEY` from `t-app` for `divider`, `shadow`, `shape`, `role` when props are omitted.
80
+
81
+ ## Expose (template ref)
82
+
83
+ Nothing exposed.
84
+
85
+ ## Special behavior
86
+
87
+ - Backdrop close: if the payload is not in `dismiss`, a short `pop` animation runs instead of emitting `close`.
88
+
89
+ ## Accessibility (a11y)
90
+
91
+ Inherits from `Present` (backdrop, focus). Buttons use inner `Button`.
92
+
93
+ ## Style / class notes
94
+
95
+ BEM-style classes via `withPrefix`: `action`, `layer`, `surface`, `role`, `shape`, placement, `pop`, `divider`, `shadow`.
96
+
97
+ ## Advanced example
98
+
99
+ ```vue
100
+ <t-action
101
+ :visible="open"
102
+ :dismiss="['backdrop']"
103
+ :actions="[
104
+ [{ text: 'Cancel', variant: 'text', handler: cancel }],
105
+ [{ text: 'Delete', variant: 'fill', role: 'danger', handler: remove }],
106
+ ]"
107
+ placement="bottom"
108
+ @close="(t) => console.log(t)"
109
+ />
110
+ ```
111
+
112
+ ## See also
113
+
114
+ - Source: `src/components/action`
115
+ - Composable: `action.composable.ts` (`useAction`)
@@ -11,14 +11,13 @@ $width: sass.fn-naming-var("viewport", "width");
11
11
  $max-width: sass.fn-naming-var("overlay", "max-width");
12
12
  $height: sass.fn-naming-var("viewport", "height");
13
13
  $max-height: sass.fn-naming-var("overlay", "max-height");
14
- $background-color: sass.fn-naming-var("surface", "background-color");
15
14
  $transition-duration: sass.fn-naming-var("motion", "duration");
16
15
  $safe-area-bottom: sass.fn-naming-var("safe-area", "bottom");
17
16
  $safe-area-top: sass.fn-naming-var("safe-area", "top");
18
17
  $safe-area-left: sass.fn-naming-var("safe-area", "left");
19
18
  $safe-area-right: sass.fn-naming-var("safe-area", "right");
20
19
  $border-width: sass.fn-naming-var("stroke", "width");
21
- $border-color: sass.fn-naming-var("item", "border-color");
20
+ $border-color: sass.fn-naming-var("action", "border-color");
22
21
 
23
22
  .#{$action} {
24
23
  // Styles
@@ -28,34 +28,22 @@ const pop = ref(false);
28
28
 
29
29
  /// Computed
30
30
  /// ------------------------------------------------------------
31
- const divider = computed(() => {
32
- return (props?.divider !== undefined ? props.divider : appState?.divider.value) ?? false;
33
- });
34
-
35
- const shadow = computed(() => {
36
- return (props?.shadow !== undefined ? props.shadow : appState?.shadow.value) ?? false;
37
- });
38
-
39
- const shape = computed(() => {
40
- return props.shape ?? appState?.shape.value ?? "";
41
- });
42
-
43
- const role = computed(() => {
44
- return props.role ?? appState?.role.value ?? "";
45
- });
46
-
47
31
  const actionAttrs = computed(() => {
32
+ const divider = (props?.divider !== undefined ? props.divider : appState?.divider.value) ?? false;
33
+ const shadow = (props?.shadow !== undefined ? props.shadow : appState?.shadow.value) ?? false;
34
+ const shape = props.shape ?? appState?.shape.value ?? "";
35
+ const role = props.role ?? appState?.role.value ?? "";
48
36
  return {
49
37
  class: [
50
38
  withPrefix("action"),
51
- withPrefix(["layer", "surface"]),
52
- withPrefix(["role", role.value]),
53
- withPrefix(["shape", shape.value]),
39
+ withPrefix(["layer", "action"]),
40
+ withPrefix(["role", role]),
41
+ withPrefix(["shape", shape]),
54
42
  props.placement,
55
43
  {
56
44
  pop: pop.value,
57
- divider: divider.value,
58
- shadow: shadow.value,
45
+ divider,
46
+ shadow,
59
47
  },
60
48
  ],
61
49
  };
@@ -0,0 +1,77 @@
1
+ # `<t-app>`
2
+
3
+ > Default prefix is `t-` — change via `createToife({ prefix: "..." })`.
4
+
5
+ ## Description
6
+
7
+ Library root layout: provides theme/context (`provide`) for descendants, mounts multiple `Toast` regions by placement, and hosts `Action` / `DecisionModal` when using `useAction` / `useDecisionModal`.
8
+
9
+ ## Requirements / dependencies
10
+
11
+ | Item | Notes |
12
+ | ----- | -------------------- |
13
+ | Vue | ^3.5 |
14
+ | Other | Router not required. |
15
+
16
+ ## Basic usage
17
+
18
+ ```vue
19
+ <template>
20
+ <t-app>
21
+ <t-page>App content</t-page>
22
+ </t-app>
23
+ </template>
24
+ ```
25
+
26
+ ## Props
27
+
28
+ | Prop | Type | Default | Description |
29
+ | ----------- | ------------------- | -------- | ------------------------------------------------ |
30
+ | `shape` | `string` | `"pill"` | Default shape for children (buttons, fields, …). |
31
+ | `divider` | `boolean` | `false` | Default divider flag. |
32
+ | `role` | `string` | `"mode"` | Default theme role. |
33
+ | `shadow` | `boolean` | `false` | Default shadow. |
34
+ | `triple` | `boolean` | `false` | Layout flag (provided to children). |
35
+ | `direction` | `"left" \| "right"` | `"left"` | Direction (fields, …). |
36
+
37
+ **Type source:** `src/components/app/app.type.ts`
38
+
39
+ ## Events (emits)
40
+
41
+ _No public emits._
42
+
43
+ ## Slots
44
+
45
+ | Slot | Description |
46
+ | --------- | ----------------------------------------------------- |
47
+ | `default` | Main app content. |
48
+ | `global` | Extra slot (after default, before internal overlays). |
49
+
50
+ ## `v-model`
51
+
52
+ No.
53
+
54
+ ## Provide / inject / context
55
+
56
+ `provide(APP_PROVIDER_STATE_KEY)`: `{ shape, divider, role, shadow, triple, direction }` — children inject for consistent theming.
57
+
58
+ ## Expose
59
+
60
+ Nothing.
61
+
62
+ ## Special behavior
63
+
64
+ - Renders several `Toast` instances with fixed placements (top/bottom × start/center/end).
65
+ - When `useAction()` / `useDecisionModal()` has `data`, renders the matching `Action` / `DecisionModal`.
66
+
67
+ ## Accessibility (a11y)
68
+
69
+ Wrapper only; no special root role.
70
+
71
+ ## Style / class notes
72
+
73
+ Classes: `layer`, `base`, `shape`, `app`.
74
+
75
+ ## See also
76
+
77
+ - Source: `src/components/app`
@@ -3,9 +3,9 @@
3
3
  // Class name
4
4
  $app: sass.fn-naming-prefix("app");
5
5
 
6
- // Property name - layer: base
7
- $background-color: sass.fn-naming-var("base", "background-color");
8
- $color: sass.fn-naming-var("base", "color");
6
+ // Property name - layer: app
7
+ $background-color: sass.fn-naming-var("app", "background-color");
8
+ $color: sass.fn-naming-var("app", "color");
9
9
  $transition-duration: sass.fn-naming-var("motion", "duration");
10
10
 
11
11
  .#{$app} {
@@ -28,7 +28,7 @@ const action = useAction();
28
28
  // Present attributes
29
29
  const appAttrs = computed(() => {
30
30
  return {
31
- class: [withPrefix(["layer", "base"]), withPrefix(["shape", shape.value]), withPrefix("app")],
31
+ class: [withPrefix(["layer", "app"]), withPrefix(["shape", shape.value]), withPrefix("app")],
32
32
  };
33
33
  });
34
34
 
@@ -0,0 +1,64 @@
1
+ # `<t-avatar>`
2
+
3
+ > Default prefix is `t-` — change via `createToife({ prefix: "..." })`.
4
+
5
+ ## Description
6
+
7
+ Displays an avatar image as a CSS `background-image` inside a themed frame (shape/role from app when omitted).
8
+
9
+ ## Requirements / dependencies
10
+
11
+ | Item | Notes |
12
+ | ----- | ------------------------------------------------- |
13
+ | Vue | ^3.5 |
14
+ | Other | `t-app` recommended for default `role` / `shape`. |
15
+
16
+ ## Basic usage
17
+
18
+ ```vue
19
+ <t-avatar src="/user.png" size="40px" />
20
+ ```
21
+
22
+ ## Props
23
+
24
+ | Prop | Type | Default | Description |
25
+ | ------- | ------------------ | -------- | ------------------------------------- |
26
+ | `shape` | `string` | — | Shape override; default from `t-app`. |
27
+ | `size` | `string \| number` | `"22px"` | Size (number is treated as px). |
28
+ | `src` | `string` | `""` | Image URL for background. |
29
+
30
+ **Type source:** `src/components/avatar/avatar.type.ts`
31
+
32
+ ## Events (emits)
33
+
34
+ _None._
35
+
36
+ ## Slots
37
+
38
+ | Slot | Description |
39
+ | --------- | ------------------------------ |
40
+ | `default` | Optional inner content (rare). |
41
+
42
+ ## `v-model`
43
+
44
+ No.
45
+
46
+ ## Provide / inject
47
+
48
+ Injects `AppProviderState` for `role` / `shape`.
49
+
50
+ ## Expose
51
+
52
+ Nothing.
53
+
54
+ ## Accessibility (a11y)
55
+
56
+ Decorative background image — add `aria-label` on a parent if a name must be announced.
57
+
58
+ ## Style / class notes
59
+
60
+ CSS variable `--<prefix>-width` via `property("width")`.
61
+
62
+ ## See also
63
+
64
+ - Source: `src/components/avatar`
@@ -4,9 +4,9 @@
4
4
  $avatar: sass.fn-naming-prefix("avatar");
5
5
  $shape-pill: sass.fn-naming-prefix("shape-pill");
6
6
 
7
- // Property - layer: surface
7
+ // Property - layer: avatar
8
8
  $border-radius: sass.fn-naming-var("border-radius");
9
- $background-color: sass.fn-naming-var("surface", "background-color");
9
+ $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
 
@@ -22,7 +22,7 @@ const avatarAttrs = computed(() => {
22
22
 
23
23
  return {
24
24
  class: [
25
- withPrefix(["layer", "surface"]),
25
+ withPrefix(["layer", "avatar"]),
26
26
  withPrefix(["role", role]),
27
27
  withPrefix(["shape", shape]),
28
28
  withPrefix("avatar"),
@@ -0,0 +1,66 @@
1
+ # `<t-button>`
2
+
3
+ > Default prefix is `t-` — change via `createToife({ prefix: "..." })`.
4
+
5
+ ## Description
6
+
7
+ Button with variants, sizes, loading state, and theming from `t-app`.
8
+
9
+ ## Requirements / dependencies
10
+
11
+ | Item | Notes |
12
+ | ----- | ---------------------------------------------------- |
13
+ | Vue | ^3.5 |
14
+ | Other | `t-app` recommended for `shape` / `role` / `shadow`. |
15
+
16
+ ## Basic usage
17
+
18
+ ```vue
19
+ <t-button variant="fill" @click="save">Save</t-button>
20
+ <t-button loading>Loading</t-button>
21
+ ```
22
+
23
+ ## Props
24
+
25
+ | Prop | Type | Default | Description |
26
+ | --------- | ---------------------------------- | ------------ | ---------------------------------------- |
27
+ | `role` | `string` | — | Theme role; default from app. |
28
+ | `size` | `"small" \| "standard" \| "large"` | `"standard"` | Size. |
29
+ | `shape` | `string` | — | Shape; default from app. |
30
+ | `block` | `boolean` | `false` | Full-width button. |
31
+ | `loading` | `boolean` | `false` | Hides label, shows `loading` slot. |
32
+ | `variant` | `ButtonVariant` | `"fill"` | `fill` \| `outline` \| `text` \| `link`. |
33
+ | `shadow` | `boolean` | — | Default from app if unset. |
34
+
35
+ **Type source:** `src/components/button/button.type.ts`
36
+
37
+ ## Events (emits)
38
+
39
+ _No declared emits_ — use native DOM listeners (`@click`).
40
+
41
+ ## Slots
42
+
43
+ | Slot | Description |
44
+ | --------- | ------------------------------------- |
45
+ | `default` | Button label (hidden when `loading`). |
46
+ | `loading` | Content when `loading`. |
47
+
48
+ ## `v-model`
49
+
50
+ No.
51
+
52
+ ## Provide / inject
53
+
54
+ Injects theme from `t-app`.
55
+
56
+ ## Expose
57
+
58
+ Nothing.
59
+
60
+ ## Accessibility (a11y)
61
+
62
+ Native `<button>`; focus/blur styling handled internally.
63
+
64
+ ## See also
65
+
66
+ - Source: `src/components/button`
@@ -11,14 +11,14 @@ $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("item", "color");
14
+ $color: sass.fn-naming-var("button", "color");
15
15
 
16
- $border-color: sass.fn-naming-var("item", "border-color");
17
- $border-color-hover: sass.fn-naming-var("item", "border-color", "strong");
18
- $border-color-focus: sass.fn-naming-var("item", "border-color", "heavy");
19
- $border-color-active: sass.fn-naming-var("item", "border-color", "heavy");
20
- $border-color-disabled: sass.fn-naming-var("item", "border-color");
21
- $border-color-inactive: sass.fn-naming-var("item", "border-color", "soft");
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");
22
22
 
23
23
  $size-font-size: sass.fn-naming-var("font-size");
24
24
  $size-height: sass.fn-naming-var("height");
@@ -26,12 +26,12 @@ $size-coefficient-x: sass.fn-naming-var("coefficient-x");
26
26
  $size-coefficient-y: sass.fn-naming-var("coefficient-y");
27
27
  $size-line-height: sass.fn-naming-var("line-height");
28
28
 
29
- $background-color: sass.fn-naming-var("item", "background-color");
30
- $background-color-hover: sass.fn-naming-var("item", "background-color", "strong");
31
- $background-color-focus: sass.fn-naming-var("item", "background-color", "heavy");
32
- $background-color-active: sass.fn-naming-var("item", "background-color", "heavy");
33
- $background-color-disabled: sass.fn-naming-var("item", "background-color");
34
- $background-color-inactive: sass.fn-naming-var("item", "background-color", "soft");
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
35
 
36
36
  .#{$button} {
37
37
  display: inline-flex;
@@ -23,17 +23,14 @@ const isFocused = ref(false);
23
23
 
24
24
  /// Computed
25
25
  /// ------------------------------------------------------------
26
- const shadow = computed(() => {
27
- return (props?.shadow !== undefined ? props.shadow : appState?.shadow.value) ?? false;
28
- });
29
-
30
26
  const buttonAttrs = computed(() => {
31
27
  const shape = props.shape || appState?.shape.value || "";
32
28
  const role = props.role || appState?.role.value || "";
29
+ const shadow = (props?.shadow !== undefined ? props.shadow : appState?.shadow.value) ?? false;
33
30
 
34
31
  return {
35
32
  class: [
36
- withPrefix(["layer", "item"]),
33
+ withPrefix(["layer", "button"]),
37
34
  withPrefix(["role", role]),
38
35
  withPrefix(["shape", shape]),
39
36
  withPrefix("button"),
@@ -41,18 +38,16 @@ const buttonAttrs = computed(() => {
41
38
  props.variant,
42
39
  {
43
40
  block: props.block,
44
- shadow: shadow.value,
41
+ shadow,
45
42
  focus: isFocused.value,
46
43
  },
47
44
  ],
48
45
  };
49
46
  });
50
47
 
51
- const loaderAttrs = computed(() => {
52
- return {
53
- class: [withPrefix("loader")],
54
- };
55
- });
48
+ const loaderAttrs = {
49
+ class: [withPrefix("loader")],
50
+ } as const;
56
51
 
57
52
  /// Methods
58
53
  /// ------------------------------------------------------------