@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.
- package/README.md +54 -1
- package/package.json +7 -7
- package/src/components/action/action.md +115 -0
- package/src/components/action/action.scss +1 -2
- package/src/components/action/action.vue +9 -21
- package/src/components/app/app.md +77 -0
- package/src/components/app/app.scss +3 -3
- package/src/components/app/app.vue +1 -1
- package/src/components/avatar/avatar.md +64 -0
- package/src/components/avatar/avatar.scss +2 -2
- package/src/components/avatar/avatar.vue +1 -1
- package/src/components/button/button.md +66 -0
- package/src/components/button/button.scss +13 -13
- package/src/components/button/button.vue +6 -11
- package/src/components/cable/cable.md +57 -0
- package/src/components/cable/cable.vue +1 -1
- package/src/components/card/card/card.md +57 -0
- package/src/components/card/card/card.scss +3 -3
- package/src/components/card/card/card.vue +1 -1
- package/src/components/card/card-body/card-body.md +34 -0
- package/src/components/card/card-body/card-body.scss +3 -3
- package/src/components/card/card-body/card-body.vue +3 -8
- package/src/components/card/card-footer/card-footer.md +42 -0
- package/src/components/card/card-footer/card-footer.scss +4 -4
- package/src/components/card/card-footer/card-footer.vue +2 -5
- package/src/components/card/card-header/card-header.md +44 -0
- package/src/components/card/card-header/card-header.scss +4 -4
- package/src/components/card/card-header/card-header.vue +2 -5
- package/src/components/checkbox/checkbox.md +60 -0
- package/src/components/checkbox/checkbox.scss +8 -8
- package/src/components/checkbox/checkbox.vue +11 -24
- package/src/components/collapse/collapse.md +59 -0
- package/src/components/collapse/collapse.scss +2 -2
- package/src/components/collapse/collapse.vue +1 -1
- package/src/components/container/container.md +38 -0
- package/src/components/container/container.vue +3 -8
- package/src/components/decision-modal/decision-modal.md +79 -0
- package/src/components/decision-modal/decision-modal.scss +3 -3
- package/src/components/decision-modal/decision-modal.vue +1 -1
- package/src/components/divider/divider.md +42 -0
- package/src/components/divider/divider.scss +1 -1
- package/src/components/divider/divider.vue +3 -6
- package/src/components/field/field.md +68 -0
- package/src/components/field/outline/outline-field.md +44 -0
- package/src/components/field/outline/outline.scss +8 -8
- package/src/components/field/outline/outline.vue +2 -2
- package/src/components/form-group/form-group.md +41 -0
- package/src/components/gesture-indicator/gesture-indicator.md +42 -0
- package/src/components/gesture-indicator/gesture-indicator.scss +2 -2
- package/src/components/gesture-indicator/gesture-indicator.vue +3 -6
- package/src/components/image/image.md +41 -0
- package/src/components/modal/modal.md +65 -0
- package/src/components/modal/modal.scss +2 -2
- package/src/components/modal/modal.vue +1 -1
- package/src/components/page/page.md +39 -0
- package/src/components/page/page.vue +3 -8
- package/src/components/present/present.md +60 -0
- package/src/components/present/present.vue +1 -1
- package/src/components/radio/radio/radio.md +53 -0
- package/src/components/radio/radio/radio.scss +8 -8
- package/src/components/radio/radio/radio.vue +7 -11
- package/src/components/radio/radio-group/radio-group.md +62 -0
- package/src/components/radio/radio-group/radio-group.vue +1 -6
- package/src/components/refresher/refresher.md +53 -0
- package/src/components/route/route-navigator/route-navigator.md +50 -0
- package/src/components/route/route-navigator/route-navigator.scss +1 -1
- package/src/components/route/route-navigator/route-navigator.vue +14 -9
- package/src/components/route/route-outlet/route-outlet.md +30 -0
- package/src/components/route/route-provider/route-provider.md +46 -0
- package/src/components/route/route-wrapper/route-wrapper.composable.ts +29 -14
- package/src/components/route/route-wrapper/route-wrapper.md +45 -0
- package/src/components/route/route-wrapper/route-wrapper.type.ts +4 -0
- package/src/components/route/route-wrapper/route-wrapper.vue +13 -5
- package/src/components/route/route.type.ts +1 -0
- package/src/components/segmented-field/segmented-field.md +58 -0
- package/src/components/segmented-field/segmented-field.scss +3 -3
- package/src/components/segmented-field/segmented-field.vue +20 -26
- package/src/components/skeleton/skeleton.md +47 -0
- package/src/components/skeleton/skeleton.scss +3 -3
- package/src/components/skeleton/skeleton.vue +1 -1
- package/src/components/switch/switch.md +57 -0
- package/src/components/switch/switch.scss +8 -8
- package/src/components/switch/switch.vue +9 -20
- package/src/components/tabs/tab/tab.md +52 -0
- package/src/components/tabs/tabs/tabs.md +59 -0
- package/src/components/tabs/tabs/tabs.scss +4 -6
- package/src/components/tabs/tabs/tabs.vue +4 -6
- package/src/components/toast/toast/toast.md +56 -0
- package/src/components/toast/toast-content/toast-content.md +41 -0
- package/src/components/toast/toast-content/toast-content.scss +4 -4
- package/src/components/toast/toast-content/toast-content.vue +5 -11
- package/src/components/toolbar/toolbar.md +57 -0
- package/src/components/toolbar/toolbar.scss +2 -2
- package/src/components/toolbar/toolbar.vue +5 -11
- package/src/factory.ts +2 -0
- package/src/utils/element.md +33 -0
- package/src/utils/events.md +29 -0
- package/src/utils/style.md +49 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# `<t-toast-content>`
|
|
2
|
+
|
|
3
|
+
> Default prefix is `t-` — change via `createToife({ prefix: "..." })`.
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
Single toast line: shows `message`, auto-dismisses after `duration`, emits `close` after the exit animation (usually handled by `t-toast` → `useToast().close(id)`).
|
|
8
|
+
|
|
9
|
+
## Requirements / dependencies
|
|
10
|
+
|
|
11
|
+
| Item | Notes |
|
|
12
|
+
| ----- | -------------------------------------------------------------- |
|
|
13
|
+
| Vue | ^3.5 |
|
|
14
|
+
| Other | `t-app` for theme; usually rendered by `t-toast` in a `v-for`. |
|
|
15
|
+
|
|
16
|
+
## Props
|
|
17
|
+
|
|
18
|
+
| Prop | Type | Default | Description |
|
|
19
|
+
| ---------------- | --------------------- | -------- | --------------------------------- |
|
|
20
|
+
| `id` | `number` | — | Message id (`useToast` store). |
|
|
21
|
+
| `message` | `string` | `""` | Text. |
|
|
22
|
+
| `duration` | `number` | `2000` | ms before close animation starts. |
|
|
23
|
+
| `role` / `shape` | `string` | — | Theme. |
|
|
24
|
+
| `variant` | `ToastContentVariant` | `"fill"` | `fill` \| `text`. |
|
|
25
|
+
| `placement` | `ToastPlacement` | — | Set when pushing to the store. |
|
|
26
|
+
|
|
27
|
+
**Type source:** `src/components/toast/toast.type.ts`
|
|
28
|
+
|
|
29
|
+
## Events (emits)
|
|
30
|
+
|
|
31
|
+
| Event | Payload | Description |
|
|
32
|
+
| ------- | ------- | -------------------------------- |
|
|
33
|
+
| `close` | — | After delay + closing animation. |
|
|
34
|
+
|
|
35
|
+
## Slots
|
|
36
|
+
|
|
37
|
+
_None_ — single text `div`.
|
|
38
|
+
|
|
39
|
+
## See also
|
|
40
|
+
|
|
41
|
+
- Source: `src/components/toast/toast-content`
|
|
@@ -6,10 +6,10 @@ $toastContent: sass.fn-naming-prefix("toast-content");
|
|
|
6
6
|
// Properties
|
|
7
7
|
$space-x: sass.fn-naming-var("spacing", "x");
|
|
8
8
|
$transition-duration: sass.fn-naming-var("motion", "duration");
|
|
9
|
-
// layer:
|
|
10
|
-
$background-color: sass.fn-naming-var("
|
|
11
|
-
$color: sass.fn-naming-var("
|
|
12
|
-
$border-color: sass.fn-naming-var("
|
|
9
|
+
// layer: toast-content
|
|
10
|
+
$background-color: sass.fn-naming-var("toast", "background-color");
|
|
11
|
+
$color: sass.fn-naming-var("toast", "color");
|
|
12
|
+
$border-color: sass.fn-naming-var("toast", "border-color");
|
|
13
13
|
$border-radius: sass.fn-naming-var("border-radius");
|
|
14
14
|
$border-width: sass.fn-naming-var("stroke", "width");
|
|
15
15
|
$max-height: sass.fn-naming-var("overlay", "max-height");
|
|
@@ -22,20 +22,14 @@ const isClosing = ref(false);
|
|
|
22
22
|
|
|
23
23
|
/// Computed
|
|
24
24
|
/// ------------------------------------------------------------
|
|
25
|
-
const role = computed(() => {
|
|
26
|
-
return props.role || appState?.role.value || "";
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const shape = computed(() => {
|
|
30
|
-
return props.shape || appState?.shape.value || "";
|
|
31
|
-
});
|
|
32
|
-
|
|
33
25
|
const contentAttrs = computed(() => {
|
|
26
|
+
const role = props.role || appState?.role.value || "";
|
|
27
|
+
const shape = props.shape || appState?.shape.value || "";
|
|
34
28
|
return {
|
|
35
29
|
class: [
|
|
36
|
-
withPrefix(["layer", "
|
|
37
|
-
withPrefix(["role", role
|
|
38
|
-
withPrefix(["shape", shape
|
|
30
|
+
withPrefix(["layer", "toast"]),
|
|
31
|
+
withPrefix(["role", role]),
|
|
32
|
+
withPrefix(["shape", shape]),
|
|
39
33
|
withPrefix("toast-content"),
|
|
40
34
|
props.variant,
|
|
41
35
|
{
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# `<t-toolbar>`
|
|
2
|
+
|
|
3
|
+
> Default prefix is `t-` — change via `createToife({ prefix: "..." })`.
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
Toolbar surface with height / safe-area; `placement` comes from props or from `t-cable` (inject).
|
|
8
|
+
|
|
9
|
+
## Requirements / dependencies
|
|
10
|
+
|
|
11
|
+
| Item | Notes |
|
|
12
|
+
| ----- | ---------------------------------------------------------------- |
|
|
13
|
+
| Vue | ^3.5 |
|
|
14
|
+
| Other | Place inside `t-cable` to inherit placement; `t-app` for `role`. |
|
|
15
|
+
|
|
16
|
+
## Basic usage
|
|
17
|
+
|
|
18
|
+
```vue
|
|
19
|
+
<t-cable placement="bottom">
|
|
20
|
+
<t-toolbar>
|
|
21
|
+
<t-button>Home</t-button>
|
|
22
|
+
</t-toolbar>
|
|
23
|
+
</t-cable>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Props
|
|
27
|
+
|
|
28
|
+
| Prop | Type | Default | Description |
|
|
29
|
+
| ----------- | ------------------ | -------- | ------------------------------------------------- |
|
|
30
|
+
| `placement` | `string \| null` | `null` | Placement class; if null, uses `cable.placement`. |
|
|
31
|
+
| `safeArea` | `boolean` | `true` | Safe-area padding (notch, home indicator). |
|
|
32
|
+
| `size` | `string \| number` | `"50px"` | Toolbar height. |
|
|
33
|
+
| `role` | `string` | — | Theme. |
|
|
34
|
+
|
|
35
|
+
**Type source:** `src/components/toolbar/toolbar.type.ts`
|
|
36
|
+
|
|
37
|
+
## Events (emits)
|
|
38
|
+
|
|
39
|
+
_None._
|
|
40
|
+
|
|
41
|
+
## Slots
|
|
42
|
+
|
|
43
|
+
| Slot | Description |
|
|
44
|
+
| --------- | ---------------------------------------------- |
|
|
45
|
+
| `default` | Buttons / content (wrapped in an inner `div`). |
|
|
46
|
+
|
|
47
|
+
## Provide / inject
|
|
48
|
+
|
|
49
|
+
Optional inject `CABLE_PROVIDER_STATE_KEY` and `APP_PROVIDER_STATE_KEY`.
|
|
50
|
+
|
|
51
|
+
## Style / class notes
|
|
52
|
+
|
|
53
|
+
Variable `--<prefix>-toolbar-size`; classes `with-safe-area`, placement.
|
|
54
|
+
|
|
55
|
+
## See also
|
|
56
|
+
|
|
57
|
+
- Source: `src/components/toolbar`
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
// Class name
|
|
4
4
|
$toolbar: sass.fn-naming-prefix("toolbar");
|
|
5
5
|
|
|
6
|
-
// Property name - layer:
|
|
6
|
+
// Property name - layer: toolbar
|
|
7
7
|
$toolbar-size: sass.fn-naming-var("toolbar", "size");
|
|
8
|
-
$background-color: sass.fn-naming-var("
|
|
8
|
+
$background-color: sass.fn-naming-var("toolbar", "background-color");
|
|
9
9
|
$safe-area-right: sass.fn-naming-var("safe-area", "right");
|
|
10
10
|
$safe-area-left: sass.fn-naming-var("safe-area", "left");
|
|
11
11
|
$safe-area-bottom: sass.fn-naming-var("safe-area", "bottom");
|
|
@@ -20,21 +20,15 @@ const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
|
|
|
20
20
|
|
|
21
21
|
/// Computed
|
|
22
22
|
/// ------------------------------------------------------------
|
|
23
|
-
const role = computed(() => {
|
|
24
|
-
return props.role || appState?.role.value || "";
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const placement = computed(() => {
|
|
28
|
-
return props.placement || cable?.placement.value || "";
|
|
29
|
-
});
|
|
30
|
-
|
|
31
23
|
const toolbarAttrs = computed(() => {
|
|
24
|
+
const role = props.role || appState?.role.value || "";
|
|
25
|
+
const placement = props.placement || cable?.placement.value || "";
|
|
32
26
|
return {
|
|
33
27
|
class: [
|
|
34
|
-
withPrefix(["layer", "
|
|
35
|
-
withPrefix(["role", role
|
|
28
|
+
withPrefix(["layer", "toolbar"]),
|
|
29
|
+
withPrefix(["role", role]),
|
|
36
30
|
withPrefix("toolbar"),
|
|
37
|
-
placement
|
|
31
|
+
placement,
|
|
38
32
|
{
|
|
39
33
|
"with-safe-area": props.safeArea,
|
|
40
34
|
},
|
package/src/factory.ts
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
SegmentedField,
|
|
31
31
|
Skeleton,
|
|
32
32
|
Switch,
|
|
33
|
+
Tab,
|
|
33
34
|
Tabs,
|
|
34
35
|
Toast,
|
|
35
36
|
ToastContent,
|
|
@@ -72,6 +73,7 @@ export const createToife = (options?: CreateToifeOptions) => {
|
|
|
72
73
|
app.component(prefix + "segmented-field", SegmentedField);
|
|
73
74
|
app.component(prefix + "skeleton", Skeleton);
|
|
74
75
|
app.component(prefix + "switch", Switch);
|
|
76
|
+
app.component(prefix + "tab", Tab);
|
|
75
77
|
app.component(prefix + "tabs", Tabs);
|
|
76
78
|
app.component(prefix + "toast", Toast);
|
|
77
79
|
app.component(prefix + "toast-content", ToastContent);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Utils: `element`
|
|
2
|
+
|
|
3
|
+
> Import: `import { utils } from "@toife/vue"` then `utils.isFormElement`, `utils.blurCurrentActive` (see `src/index.ts`).
|
|
4
|
+
|
|
5
|
+
**Source:** `src/utils/element.ts`
|
|
6
|
+
|
|
7
|
+
## Description
|
|
8
|
+
|
|
9
|
+
Helpers to detect form-like elements and blur the active field (shared with global event handling).
|
|
10
|
+
|
|
11
|
+
## API
|
|
12
|
+
|
|
13
|
+
### `isFormElement(target: any): boolean`
|
|
14
|
+
|
|
15
|
+
Returns `true` if `target` is an `INPUT`, `TEXTAREA`, or `contentEditable` element.
|
|
16
|
+
|
|
17
|
+
### `blurCurrentActive(): void`
|
|
18
|
+
|
|
19
|
+
If the active element is an input/textarea/contentEditable, calls `.blur()`.
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { utils } from "@toife/vue";
|
|
25
|
+
|
|
26
|
+
document.addEventListener("click", (e) => {
|
|
27
|
+
if (!utils.isFormElement(e.target)) utils.blurCurrentActive();
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## See also
|
|
32
|
+
|
|
33
|
+
- [events.md](./events.md) — document listeners and virtual keyboard
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Utils: `events`
|
|
2
|
+
|
|
3
|
+
> Import: `import { utils } from "@toife/vue"` then `utils.preventDefault`.
|
|
4
|
+
|
|
5
|
+
**Source:** `src/utils/events.ts`
|
|
6
|
+
|
|
7
|
+
## Description
|
|
8
|
+
|
|
9
|
+
Registers global behavior: block context menu, blur on `pointerup` outside form elements (via `isFormElement` / `blurCurrentActive`), and set `navigator.virtualKeyboard.overlaysContent` when available.
|
|
10
|
+
|
|
11
|
+
## API
|
|
12
|
+
|
|
13
|
+
### `preventDefault(): void`
|
|
14
|
+
|
|
15
|
+
Call once at app bootstrap to attach the listeners above.
|
|
16
|
+
|
|
17
|
+
**Note:** No teardown is returned — for tests or SSR without `document`, avoid calling or wrap yourself.
|
|
18
|
+
|
|
19
|
+
## Example
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { utils } from "@toife/vue";
|
|
23
|
+
|
|
24
|
+
utils.preventDefault();
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## See also
|
|
28
|
+
|
|
29
|
+
- [element.md](./element.md)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Utils: `style`
|
|
2
|
+
|
|
3
|
+
> Import: `import { utils } from "@toife/vue"` then `utils.withPrefix`, … (or import from `src/utils` in the monorepo).
|
|
4
|
+
|
|
5
|
+
**Source:** `src/utils/style/index.ts`
|
|
6
|
+
|
|
7
|
+
## Description
|
|
8
|
+
|
|
9
|
+
Reads `--prefix` and `--separator` from `document.documentElement` (cached), then builds BEM-style class names and CSS variable names `--…` / `var(--…)` for dynamic theming.
|
|
10
|
+
|
|
11
|
+
## API
|
|
12
|
+
|
|
13
|
+
### `getPrefix(): string`
|
|
14
|
+
|
|
15
|
+
Trimmed `--prefix` on `:root` (singleton cache).
|
|
16
|
+
|
|
17
|
+
### `getSeparator(): string`
|
|
18
|
+
|
|
19
|
+
Trimmed `--separator` (often `-` or `_`) used to join name parts.
|
|
20
|
+
|
|
21
|
+
### `withPrefix(name: string | string[]): string`
|
|
22
|
+
|
|
23
|
+
If prefix exists: `[prefix, ...parts].join(separator)`. `name` can be a string or parts array (e.g. `['layer','surface']`).
|
|
24
|
+
|
|
25
|
+
### `property(name: string | string[]): string`
|
|
26
|
+
|
|
27
|
+
Returns the CSS custom property name **without** `var()`: `"--" + withPrefix(name)`.
|
|
28
|
+
|
|
29
|
+
### `variable(name: string | string[]): string`
|
|
30
|
+
|
|
31
|
+
Returns `var(--<prefixed…>)`.
|
|
32
|
+
|
|
33
|
+
## Example
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { utils } from "@toife/vue";
|
|
37
|
+
|
|
38
|
+
utils.withPrefix("button");
|
|
39
|
+
utils.property(["field", "line"]);
|
|
40
|
+
utils.variable(["field", "line"]);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Environment
|
|
44
|
+
|
|
45
|
+
Requires `document` and `getComputedStyle` — client-only after `:root` defines `--prefix` / `--separator`.
|
|
46
|
+
|
|
47
|
+
## See also
|
|
48
|
+
|
|
49
|
+
- Components using `withPrefix` for BEM classes
|