@vc-shell/vc-app-skill 2.0.0-alpha.33 → 2.0.0-alpha.34
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/CHANGELOG.md +78 -54
- package/README.md +42 -12
- package/package.json +4 -4
- package/runtime/VERSION +1 -1
- package/runtime/agents/api-analyzer.md +31 -16
- package/runtime/agents/blade-enhancer.md +15 -9
- package/runtime/agents/details-blade-generator.md +47 -31
- package/runtime/agents/list-blade-generator.md +21 -37
- package/runtime/agents/locales-generator.md +3 -0
- package/runtime/agents/migration-agent.md +18 -7
- package/runtime/agents/module-analyzer.md +2 -0
- package/runtime/agents/module-assembler.md +15 -0
- package/runtime/agents/promote-agent.md +15 -4
- package/runtime/agents/type-checker.md +11 -0
- package/runtime/knowledge/docs/_BUILD_HASH.md +1 -1
- package/runtime/knowledge/docs/core/api/platform.docs.md +30 -30
- package/runtime/knowledge/docs/core/blade-navigation/blade-nav-composables.docs.md +41 -41
- package/runtime/knowledge/docs/core/composables/bladeContext/index.docs.md +12 -10
- package/runtime/knowledge/docs/core/composables/useApiClient/useApiClient.docs.md +11 -14
- package/runtime/knowledge/docs/core/composables/useAppBarMobileButtons/useAppBarMobileButtons.docs.md +35 -35
- package/runtime/knowledge/docs/core/composables/useAppBarWidget/useAppBarWidget.docs.md +35 -35
- package/runtime/knowledge/docs/core/composables/useAppInsights/useAppInsights.docs.md +15 -15
- package/runtime/knowledge/docs/core/composables/useAssets/useAssets.docs.md +21 -18
- package/runtime/knowledge/docs/core/composables/useAssetsManager/useAssetsManager.docs.md +28 -24
- package/runtime/knowledge/docs/core/composables/useAsync/useAsync.docs.md +90 -61
- package/runtime/knowledge/docs/core/composables/useBeforeUnload/useBeforeUnload.docs.md +19 -18
- package/runtime/knowledge/docs/core/composables/useBlade/useBlade.docs.md +89 -68
- package/runtime/knowledge/docs/core/composables/useBladeForm/useBladeForm.docs.md +27 -25
- package/runtime/knowledge/docs/core/composables/useBladeRegistry/useBladeRegistry.docs.md +15 -15
- package/runtime/knowledge/docs/core/composables/useBladeWidgets/index.docs.md +43 -47
- package/runtime/knowledge/docs/core/composables/useBreadcrumbs/useBreadcrumbs.docs.md +11 -11
- package/runtime/knowledge/docs/core/composables/useConnectionStatus/useConnectionStatus.docs.md +27 -15
- package/runtime/knowledge/docs/core/composables/useDashboard/useDashboard.docs.md +30 -30
- package/runtime/knowledge/docs/core/composables/useDynamicProperties/useDynamicProperties.docs.md +34 -36
- package/runtime/knowledge/docs/core/composables/useErrorHandler/useErrorHandler.docs.md +44 -23
- package/runtime/knowledge/docs/core/composables/useFunctions/useFunctions.docs.md +14 -11
- package/runtime/knowledge/docs/core/composables/useKeyboardNavigation/useKeyboardNavigation.docs.md +47 -38
- package/runtime/knowledge/docs/core/composables/useLanguages/useLanguages.docs.md +37 -28
- package/runtime/knowledge/docs/core/composables/useLoading/useLoading.docs.md +23 -17
- package/runtime/knowledge/docs/core/composables/useMenuExpanded/index.docs.md +9 -9
- package/runtime/knowledge/docs/core/composables/useMenuService/useMenuService.docs.md +42 -42
- package/runtime/knowledge/docs/core/composables/useModificationTracker/useModificationTracker.docs.md +22 -12
- package/runtime/knowledge/docs/core/composables/useNotifications/useNotifications.docs.md +33 -41
- package/runtime/knowledge/docs/core/composables/usePermissions/usePermissions.docs.md +16 -16
- package/runtime/knowledge/docs/core/composables/usePlatformLocaleSync/usePlatformLocaleSync.docs.md +28 -0
- package/runtime/knowledge/docs/core/composables/usePopup/usePopup.docs.md +32 -24
- package/runtime/knowledge/docs/core/composables/useResponsive/useResponsive.docs.md +32 -11
- package/runtime/knowledge/docs/core/composables/useSettings/useSettings.docs.md +22 -13
- package/runtime/knowledge/docs/core/composables/useSettingsMenu/useSettingsMenu.docs.md +7 -7
- package/runtime/knowledge/docs/core/composables/useSidebarState/useSidebarState.docs.md +32 -24
- package/runtime/knowledge/docs/core/composables/useSlowNetworkDetection/useSlowNetworkDetection.docs.md +21 -17
- package/runtime/knowledge/docs/core/composables/useTheme/useTheme.docs.md +24 -24
- package/runtime/knowledge/docs/core/composables/useToolbar/useToolbar.docs.md +28 -31
- package/runtime/knowledge/docs/core/composables/useUser/useUser.docs.md +43 -24
- package/runtime/knowledge/docs/core/composables/useUserManagement/useUserManagement.docs.md +68 -48
- package/runtime/knowledge/docs/core/composables/useWebVitals/useWebVitals.docs.md +19 -19
- package/runtime/knowledge/docs/core/composables/useWidgets/useWidgets.docs.md +42 -47
- package/runtime/knowledge/docs/core/directives/autofocus/autofocus.docs.md +10 -4
- package/runtime/knowledge/docs/core/directives/loading/loading.docs.md +35 -20
- package/runtime/knowledge/docs/core/notifications/notifications.docs.md +36 -35
- package/runtime/knowledge/docs/core/plugins/ai-agent/ai-agent.docs.md +38 -38
- package/runtime/knowledge/docs/core/plugins/extension-points/extension-points.docs.md +79 -62
- package/runtime/knowledge/docs/core/plugins/global-error-handler/global-error-handler.docs.md +10 -10
- package/runtime/knowledge/docs/core/plugins/i18n/i18n.docs.md +21 -23
- package/runtime/knowledge/docs/core/plugins/modularity/modularity.docs.md +91 -83
- package/runtime/knowledge/docs/core/plugins/permissions/permissions.docs.md +10 -16
- package/runtime/knowledge/docs/core/plugins/signalR/signalR.docs.md +9 -9
- package/runtime/knowledge/docs/core/plugins/validation/validation.docs.md +65 -22
- package/runtime/knowledge/docs/core/services/services.docs.md +19 -22
- package/runtime/knowledge/docs/core/types/types.docs.md +40 -40
- package/runtime/knowledge/docs/core/utilities/date/date-utilities.docs.md +27 -27
- package/runtime/knowledge/docs/core/utilities/shared-utilities.docs.md +23 -23
- package/runtime/knowledge/docs/core/utilities/thumbnail/thumbnail.docs.md +22 -25
- package/runtime/knowledge/docs/core/utilities/utilities.docs.md +64 -64
- package/runtime/knowledge/docs/injection-keys.docs.md +52 -51
- package/runtime/knowledge/docs/modules/assets-manager/assets-manager.docs.md +9 -9
- package/runtime/knowledge/docs/shell/_internal/popup/common/popup-common.docs.md +23 -43
- package/runtime/knowledge/docs/shell/auth/ChangePasswordPage/change-password-page.docs.md +5 -5
- package/runtime/knowledge/docs/shell/auth/ForgotPasswordPage/forgot-password-page.docs.md +5 -5
- package/runtime/knowledge/docs/shell/auth/InvitePage/invite-page.docs.md +8 -7
- package/runtime/knowledge/docs/shell/auth/LoginPage/login-page.docs.md +7 -7
- package/runtime/knowledge/docs/shell/auth/ResetPasswordPage/reset-password-page.docs.md +8 -7
- package/runtime/knowledge/docs/shell/auth/sign-in/sign-in.docs.md +29 -13
- package/runtime/knowledge/docs/shell/components/change-password/change-password.docs.md +13 -16
- package/runtime/knowledge/docs/shell/components/change-password-button/change-password-button.docs.md +1 -7
- package/runtime/knowledge/docs/shell/components/error-interceptor/error-interceptor.docs.md +5 -5
- package/runtime/knowledge/docs/shell/components/language-selector/language-selector.docs.md +1 -1
- package/runtime/knowledge/docs/shell/components/logout-button/logout-button.docs.md +1 -1
- package/runtime/knowledge/docs/shell/components/notification-template/notification-template.docs.md +17 -9
- package/runtime/knowledge/docs/shell/components/settings-menu/settings-menu.docs.md +11 -17
- package/runtime/knowledge/docs/shell/components/settings-menu-item/settings-menu-item.docs.md +34 -65
- package/runtime/knowledge/docs/shell/components/sidebar/sidebar.docs.md +16 -26
- package/runtime/knowledge/docs/shell/components/theme-selector/theme-selector.docs.md +2 -2
- package/runtime/knowledge/docs/shell/components/user-dropdown-button/user-dropdown-button.docs.md +7 -9
- package/runtime/knowledge/docs/shell/dashboard/dashboard-charts/dashboard-charts.docs.md +30 -40
- package/runtime/knowledge/docs/shell/dashboard/dashboard-widget-card/dashboard-widget-card.docs.md +26 -19
- package/runtime/knowledge/docs/shell/dashboard/draggable-dashboard/draggable-dashboard.docs.md +15 -12
- package/runtime/knowledge/docs/ui/components/atoms/vc-badge/vc-badge.docs.md +15 -26
- package/runtime/knowledge/docs/ui/components/atoms/vc-banner/vc-banner.docs.md +21 -19
- package/runtime/knowledge/docs/ui/components/atoms/vc-button/vc-button.docs.md +83 -67
- package/runtime/knowledge/docs/ui/components/atoms/vc-card/vc-card.docs.md +100 -59
- package/runtime/knowledge/docs/ui/components/atoms/vc-col/vc-col.docs.md +28 -11
- package/runtime/knowledge/docs/ui/components/atoms/vc-container/vc-container.docs.md +20 -17
- package/runtime/knowledge/docs/ui/components/atoms/vc-hint/vc-hint.docs.md +26 -17
- package/runtime/knowledge/docs/ui/components/atoms/vc-icon/vc-icon.docs.md +30 -32
- package/runtime/knowledge/docs/ui/components/atoms/vc-image/vc-image.docs.md +25 -48
- package/runtime/knowledge/docs/ui/components/atoms/vc-label/vc-label.docs.md +29 -24
- package/runtime/knowledge/docs/ui/components/atoms/vc-link/vc-link.docs.md +23 -15
- package/runtime/knowledge/docs/ui/components/atoms/vc-loading/vc-loading.docs.md +22 -13
- package/runtime/knowledge/docs/ui/components/atoms/vc-progress/vc-progress.docs.md +33 -18
- package/runtime/knowledge/docs/ui/components/atoms/vc-row/vc-row.docs.md +56 -15
- package/runtime/knowledge/docs/ui/components/atoms/vc-scrollable-container/vc-scrollable-container.docs.md +28 -15
- package/runtime/knowledge/docs/ui/components/atoms/vc-skeleton/vc-skeleton.docs.md +40 -20
- package/runtime/knowledge/docs/ui/components/atoms/vc-status/vc-status.docs.md +25 -14
- package/runtime/knowledge/docs/ui/components/atoms/vc-status-icon/vc-status-icon.docs.md +40 -14
- package/runtime/knowledge/docs/ui/components/atoms/vc-tooltip/vc-tooltip.docs.md +54 -42
- package/runtime/knowledge/docs/ui/components/atoms/vc-video/vc-video.docs.md +17 -17
- package/runtime/knowledge/docs/ui/components/atoms/vc-widget/vc-widget.docs.md +21 -21
- package/runtime/knowledge/docs/ui/components/molecules/multilanguage-selector/multilanguage-selector.docs.md +23 -10
- package/runtime/knowledge/docs/ui/components/molecules/vc-accordion/vc-accordion.docs.md +55 -44
- package/runtime/knowledge/docs/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.docs.md +23 -20
- package/runtime/knowledge/docs/ui/components/molecules/vc-checkbox/vc-checkbox.docs.md +92 -65
- package/runtime/knowledge/docs/ui/components/molecules/vc-checkbox-group/vc-checkbox-group.docs.md +22 -36
- package/runtime/knowledge/docs/ui/components/molecules/vc-color-input/vc-color-input.docs.md +65 -23
- package/runtime/knowledge/docs/ui/components/molecules/vc-date-picker/vc-date-picker.docs.md +52 -73
- package/runtime/knowledge/docs/ui/components/molecules/vc-dropdown/vc-dropdown.docs.md +91 -85
- package/runtime/knowledge/docs/ui/components/molecules/vc-dropdown-panel/vc-dropdown-panel.docs.md +38 -42
- package/runtime/knowledge/docs/ui/components/molecules/vc-editor/vc-editor.docs.md +56 -73
- package/runtime/knowledge/docs/ui/components/molecules/vc-field/vc-field.docs.md +61 -27
- package/runtime/knowledge/docs/ui/components/molecules/vc-file-upload/vc-file-upload.docs.md +42 -50
- package/runtime/knowledge/docs/ui/components/molecules/vc-form/vc-form.docs.md +35 -64
- package/runtime/knowledge/docs/ui/components/molecules/vc-image-tile/vc-image-tile.docs.md +38 -41
- package/runtime/knowledge/docs/ui/components/molecules/vc-input/vc-input.docs.md +109 -131
- package/runtime/knowledge/docs/ui/components/molecules/vc-input-currency/vc-input-currency.docs.md +47 -88
- package/runtime/knowledge/docs/ui/components/molecules/vc-input-dropdown/vc-input-dropdown.docs.md +50 -64
- package/runtime/knowledge/docs/ui/components/molecules/vc-input-group/vc-input-group.docs.md +29 -24
- package/runtime/knowledge/docs/ui/components/molecules/vc-menu/vc-menu.docs.md +32 -28
- package/runtime/knowledge/docs/ui/components/molecules/vc-multivalue/vc-multivalue.docs.md +57 -65
- package/runtime/knowledge/docs/ui/components/molecules/vc-pagination/vc-pagination.docs.md +28 -26
- package/runtime/knowledge/docs/ui/components/molecules/vc-radio-button/vc-radio-button.docs.md +55 -20
- package/runtime/knowledge/docs/ui/components/molecules/vc-radio-group/vc-radio-group.docs.md +21 -35
- package/runtime/knowledge/docs/ui/components/molecules/vc-rating/vc-rating.docs.md +38 -33
- package/runtime/knowledge/docs/ui/components/molecules/vc-select/vc-select.docs.md +72 -83
- package/runtime/knowledge/docs/ui/components/molecules/vc-slider/vc-slider.docs.md +21 -16
- package/runtime/knowledge/docs/ui/components/molecules/vc-switch/vc-switch.docs.md +55 -64
- package/runtime/knowledge/docs/ui/components/molecules/vc-textarea/vc-textarea.docs.md +51 -70
- package/runtime/knowledge/docs/ui/components/molecules/vc-toast/vc-toast.docs.md +58 -57
- package/runtime/knowledge/docs/ui/components/organisms/vc-app/vc-app.docs.md +49 -26
- package/runtime/knowledge/docs/ui/components/organisms/vc-auth-layout/vc-auth-layout.docs.md +82 -28
- package/runtime/knowledge/docs/ui/components/organisms/vc-blade/vc-blade.docs.md +90 -75
- package/runtime/knowledge/docs/ui/components/organisms/vc-data-table/composables/table-composables.docs.md +99 -48
- package/runtime/knowledge/docs/ui/components/organisms/vc-data-table/vc-data-table.docs.md +548 -367
- package/runtime/knowledge/docs/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.docs.md +35 -52
- package/runtime/knowledge/docs/ui/components/organisms/vc-gallery/vc-gallery.docs.md +33 -62
- package/runtime/knowledge/docs/ui/components/organisms/vc-image-upload/vc-image-upload.docs.md +17 -23
- package/runtime/knowledge/docs/ui/components/organisms/vc-popup/vc-popup.docs.md +109 -68
- package/runtime/knowledge/docs/ui/components/organisms/vc-sidebar/vc-sidebar.docs.md +82 -44
- package/runtime/knowledge/docs/ui/composables/ui-composables.docs.md +8 -8
- package/runtime/knowledge/docs/ui/composables/useDataTablePagination.docs.md +164 -0
- package/runtime/knowledge/docs/ui/composables/useDataTableSort.docs.md +34 -26
- package/runtime/knowledge/docs/ui/composables/useTableSelection.docs.md +48 -40
- package/runtime/knowledge/docs/ui/composables/useTableSort.docs.md +30 -17
- package/runtime/knowledge/docs/ui/types/ui-types.docs.md +40 -29
- package/runtime/knowledge/examples/offers-module.md +15 -13
- package/runtime/knowledge/examples/team-module.md +82 -119
- package/runtime/knowledge/examples/videos-module.md +44 -17
- package/runtime/knowledge/index.md +22 -0
- package/runtime/knowledge/migration-prompts/blade-form-migration.md +17 -8
- package/runtime/knowledge/migration-prompts/blade-props-migration.md +1 -2
- package/runtime/knowledge/migration-prompts/datatable-migration.md +801 -0
- package/runtime/knowledge/migration-prompts/icon-migration.md +97 -0
- package/runtime/knowledge/migration-prompts/manual-migration-audit.md +117 -0
- package/runtime/knowledge/migration-prompts/notifications-migration.md +8 -3
- package/runtime/knowledge/migration-prompts/nswag-migration.md +25 -29
- package/runtime/knowledge/migration-prompts/use-assets-migration.md +164 -0
- package/runtime/knowledge/migration-prompts/use-data-table-pagination-migration.md +176 -0
- package/runtime/knowledge/migration-prompts/widgets-migration.md +48 -27
- package/runtime/knowledge/patterns/assets-management.md +20 -20
- package/runtime/knowledge/patterns/blade-navigation.md +7 -14
- package/runtime/knowledge/patterns/blade-widget.md +19 -17
- package/runtime/knowledge/patterns/child-blade-flow.md +19 -7
- package/runtime/knowledge/patterns/composable-details.md +20 -50
- package/runtime/knowledge/patterns/composable-list.md +43 -31
- package/runtime/knowledge/patterns/dashboard-widget.md +14 -16
- package/runtime/knowledge/patterns/datatable-pattern.md +521 -0
- package/runtime/knowledge/patterns/details-blade-pattern.md +78 -116
- package/runtime/knowledge/patterns/extension-points-usage.md +53 -44
- package/runtime/knowledge/patterns/form-validation.md +28 -64
- package/runtime/knowledge/patterns/list-blade-pattern.md +33 -21
- package/runtime/knowledge/patterns/module-structure.md +7 -1
- package/runtime/knowledge/patterns/multilanguage-fields.md +8 -14
- package/runtime/knowledge/patterns/notification-template.md +21 -14
- package/runtime/knowledge/patterns/signalr-notifications.md +30 -32
- package/runtime/knowledge/patterns/toolbar-pattern.md +18 -20
- package/runtime/vc-app.md +241 -62
|
@@ -13,17 +13,24 @@ Captures and normalizes errors within a component's subtree using Vue's `onError
|
|
|
13
13
|
|
|
14
14
|
```vue
|
|
15
15
|
<script setup lang="ts">
|
|
16
|
-
import { useErrorHandler } from
|
|
16
|
+
import { useErrorHandler } from "@vc-shell/framework";
|
|
17
17
|
|
|
18
18
|
// capture: true prevents the error from propagating further up the tree
|
|
19
19
|
const { error, reset } = useErrorHandler(true);
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
22
|
<template>
|
|
23
|
-
<div
|
|
23
|
+
<div
|
|
24
|
+
v-if="error"
|
|
25
|
+
class="tw-p-4 tw-bg-red-50 tw-border tw-border-red-200 tw-rounded"
|
|
26
|
+
>
|
|
24
27
|
<p class="tw-text-red-700 tw-font-semibold">{{ error.message }}</p>
|
|
25
28
|
<p class="tw-text-red-500 tw-text-sm tw-mt-1">{{ error.details }}</p>
|
|
26
|
-
<VcButton
|
|
29
|
+
<VcButton
|
|
30
|
+
class="tw-mt-2"
|
|
31
|
+
@click="reset"
|
|
32
|
+
>Dismiss</VcButton
|
|
33
|
+
>
|
|
27
34
|
</div>
|
|
28
35
|
<slot v-else />
|
|
29
36
|
</template>
|
|
@@ -33,28 +40,29 @@ const { error, reset } = useErrorHandler(true);
|
|
|
33
40
|
|
|
34
41
|
### Parameters
|
|
35
42
|
|
|
36
|
-
| Parameter | Type
|
|
37
|
-
|
|
38
|
-
| `capture` | `boolean` | No
|
|
43
|
+
| Parameter | Type | Required | Description |
|
|
44
|
+
| --------- | --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
45
|
+
| `capture` | `boolean` | No | If `true`, prevents the error from propagating further up the component tree (the error is "swallowed" at this level). If `false` or `undefined`, the error continues propagating to parent error handlers. |
|
|
39
46
|
|
|
40
47
|
### Returns
|
|
41
48
|
|
|
42
|
-
| Property | Type
|
|
43
|
-
|
|
44
|
-
| `error`
|
|
45
|
-
| `reset`
|
|
49
|
+
| Property | Type | Description |
|
|
50
|
+
| -------- | ------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
51
|
+
| `error` | `Ref<DisplayableError \| null>` | The most recently captured error, or `null` if no error has occurred or it has been reset. |
|
|
52
|
+
| `reset` | `() => void` | Clears the error state (sets `error` to `null`) and emits a `reset` event on the component instance. |
|
|
46
53
|
|
|
47
54
|
### DisplayableError
|
|
48
55
|
|
|
49
|
-
| Property
|
|
50
|
-
|
|
51
|
-
| `message`
|
|
52
|
-
| `details`
|
|
53
|
-
| `originalError` | `unknown` | The original thrown value, preserved for programmatic inspection.
|
|
56
|
+
| Property | Type | Description |
|
|
57
|
+
| --------------- | --------- | ------------------------------------------------------------------- |
|
|
58
|
+
| `message` | `string` | Short, user-facing error message suitable for display in the UI. |
|
|
59
|
+
| `details` | `string` | Detailed technical description (stack trace, API error body, etc.). |
|
|
60
|
+
| `originalError` | `unknown` | The original thrown value, preserved for programmatic inspection. |
|
|
54
61
|
|
|
55
62
|
### Emitted Events
|
|
56
63
|
|
|
57
64
|
The composable emits events on the current component instance (accessible via `@error` and `@reset` in the parent template):
|
|
65
|
+
|
|
58
66
|
- `error` -- emitted with the `DisplayableError` when an error is captured
|
|
59
67
|
- `reset` -- emitted when `reset()` is called
|
|
60
68
|
|
|
@@ -75,7 +83,7 @@ Create a reusable error boundary that wraps any blade content:
|
|
|
75
83
|
```vue
|
|
76
84
|
<!-- ErrorBoundary.vue -->
|
|
77
85
|
<script setup lang="ts">
|
|
78
|
-
import { useErrorHandler } from
|
|
86
|
+
import { useErrorHandler } from "@vc-shell/framework";
|
|
79
87
|
|
|
80
88
|
const props = defineProps<{
|
|
81
89
|
fallbackMessage?: string;
|
|
@@ -85,13 +93,23 @@ const { error, reset } = useErrorHandler(true);
|
|
|
85
93
|
</script>
|
|
86
94
|
|
|
87
95
|
<template>
|
|
88
|
-
<div
|
|
89
|
-
|
|
96
|
+
<div
|
|
97
|
+
v-if="error"
|
|
98
|
+
class="tw-flex tw-flex-col tw-items-center tw-justify-center tw-p-8"
|
|
99
|
+
>
|
|
100
|
+
<VcIcon
|
|
101
|
+
icon="fas fa-exclamation-triangle"
|
|
102
|
+
class="tw-text-4xl tw-text-warning-500 tw-mb-4"
|
|
103
|
+
/>
|
|
90
104
|
<h3 class="tw-text-lg tw-font-semibold">
|
|
91
|
-
{{ fallbackMessage ??
|
|
105
|
+
{{ fallbackMessage ?? "Something went wrong" }}
|
|
92
106
|
</h3>
|
|
93
107
|
<p class="tw-text-sm tw-text-gray-500 tw-mt-2">{{ error.message }}</p>
|
|
94
|
-
<VcButton
|
|
108
|
+
<VcButton
|
|
109
|
+
class="tw-mt-4"
|
|
110
|
+
@click="reset"
|
|
111
|
+
>Try Again</VcButton
|
|
112
|
+
>
|
|
95
113
|
</div>
|
|
96
114
|
<slot v-else />
|
|
97
115
|
</template>
|
|
@@ -113,17 +131,20 @@ Usage in a blade:
|
|
|
113
131
|
|
|
114
132
|
```vue
|
|
115
133
|
<template>
|
|
116
|
-
<ChildBlade
|
|
134
|
+
<ChildBlade
|
|
135
|
+
@error="onChildError"
|
|
136
|
+
@reset="onChildReset"
|
|
137
|
+
/>
|
|
117
138
|
</template>
|
|
118
139
|
|
|
119
140
|
<script setup lang="ts">
|
|
120
141
|
function onChildError(error: DisplayableError) {
|
|
121
|
-
console.error(
|
|
142
|
+
console.error("Child blade error:", error.message);
|
|
122
143
|
// Optionally show a notification or log to external service
|
|
123
144
|
}
|
|
124
145
|
|
|
125
146
|
function onChildReset() {
|
|
126
|
-
console.log(
|
|
147
|
+
console.log("Child blade error was dismissed");
|
|
127
148
|
}
|
|
128
149
|
</script>
|
|
129
150
|
```
|
|
@@ -12,7 +12,7 @@ Provides lightweight utility functions for timing control: debounce, throttle, d
|
|
|
12
12
|
## Quick Start
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
|
-
import { useFunctions } from
|
|
15
|
+
import { useFunctions } from "@vc-shell/framework";
|
|
16
16
|
|
|
17
17
|
const { debounce, throttle, delay, once } = useFunctions();
|
|
18
18
|
|
|
@@ -31,7 +31,7 @@ delay(() => showTooltip(), 500);
|
|
|
31
31
|
|
|
32
32
|
// Ensure a function runs only once (e.g., expensive initialization)
|
|
33
33
|
const initOnce = once(() => {
|
|
34
|
-
console.log(
|
|
34
|
+
console.log("This runs exactly once");
|
|
35
35
|
return expensiveSetup();
|
|
36
36
|
});
|
|
37
37
|
initOnce(); // runs and caches the result
|
|
@@ -43,12 +43,12 @@ initOnce(); // still returns cached result
|
|
|
43
43
|
|
|
44
44
|
### Returns
|
|
45
45
|
|
|
46
|
-
| Property
|
|
47
|
-
|
|
48
|
-
| `debounce` | `(fn, delay: number) => (...args) => void` | Delays invocation until `delay` ms after the last call. Each new call resets the timer.
|
|
46
|
+
| Property | Type | Description |
|
|
47
|
+
| ---------- | ------------------------------------------ | -------------------------------------------------------------------------------------------------------- |
|
|
48
|
+
| `debounce` | `(fn, delay: number) => (...args) => void` | Delays invocation until `delay` ms after the last call. Each new call resets the timer. |
|
|
49
49
|
| `throttle` | `(fn, delay: number) => (...args) => void` | Invokes at most once per `delay` ms on the leading edge. Subsequent calls within the window are ignored. |
|
|
50
|
-
| `delay`
|
|
51
|
-
| `once`
|
|
50
|
+
| `delay` | `(fn, ms?: number) => void` | Runs `fn` after `ms` milliseconds (default 0, which defers to the next macrotask via `setTimeout`). |
|
|
51
|
+
| `once` | `(fn) => (...args) => unknown` | Ensures `fn` executes only once; subsequent calls return the cached result of the first invocation. |
|
|
52
52
|
|
|
53
53
|
## How They Work
|
|
54
54
|
|
|
@@ -61,11 +61,11 @@ initOnce(); // still returns cached result
|
|
|
61
61
|
|
|
62
62
|
```vue
|
|
63
63
|
<script setup lang="ts">
|
|
64
|
-
import { useFunctions } from
|
|
65
|
-
import { ref } from
|
|
64
|
+
import { useFunctions } from "@vc-shell/framework";
|
|
65
|
+
import { ref } from "vue";
|
|
66
66
|
|
|
67
67
|
const { debounce } = useFunctions();
|
|
68
|
-
const searchQuery = ref(
|
|
68
|
+
const searchQuery = ref("");
|
|
69
69
|
const results = ref<Product[]>([]);
|
|
70
70
|
|
|
71
71
|
const performSearch = debounce(async (query: string) => {
|
|
@@ -91,7 +91,10 @@ function onSearchInput(value: string) {
|
|
|
91
91
|
@update:model-value="onSearchInput"
|
|
92
92
|
/>
|
|
93
93
|
</template>
|
|
94
|
-
<div
|
|
94
|
+
<div
|
|
95
|
+
v-for="product in results"
|
|
96
|
+
:key="product.id"
|
|
97
|
+
>
|
|
95
98
|
{{ product.name }}
|
|
96
99
|
</div>
|
|
97
100
|
</VcBlade>
|
package/runtime/knowledge/docs/core/composables/useKeyboardNavigation/useKeyboardNavigation.docs.md
CHANGED
|
@@ -14,11 +14,11 @@ The composable supports two attachment modes: **auto-attach** on mount via a CSS
|
|
|
14
14
|
|
|
15
15
|
```vue
|
|
16
16
|
<script setup lang="ts">
|
|
17
|
-
import { useKeyboardNavigation } from
|
|
18
|
-
import { ref } from
|
|
17
|
+
import { useKeyboardNavigation } from "@vc-shell/framework";
|
|
18
|
+
import { ref } from "vue";
|
|
19
19
|
|
|
20
20
|
const menuRef = ref<HTMLElement | null>(null);
|
|
21
|
-
const items = ref([
|
|
21
|
+
const items = ref(["Dashboard", "Products", "Orders", "Settings"]);
|
|
22
22
|
|
|
23
23
|
const { initKeyboardNavigation, focusFirstElement } = useKeyboardNavigation({
|
|
24
24
|
itemSelector: '[role="menuitem"]',
|
|
@@ -43,7 +43,10 @@ function openMenu() {
|
|
|
43
43
|
</script>
|
|
44
44
|
|
|
45
45
|
<template>
|
|
46
|
-
<div
|
|
46
|
+
<div
|
|
47
|
+
ref="menuRef"
|
|
48
|
+
role="menu"
|
|
49
|
+
>
|
|
47
50
|
<div
|
|
48
51
|
v-for="item in items"
|
|
49
52
|
:key="item"
|
|
@@ -61,26 +64,26 @@ function openMenu() {
|
|
|
61
64
|
|
|
62
65
|
### Parameters (Options Object)
|
|
63
66
|
|
|
64
|
-
| Parameter
|
|
65
|
-
|
|
66
|
-
| `containerSelector` | `string`
|
|
67
|
-
| `itemSelector`
|
|
68
|
-
| `onEnter`
|
|
69
|
-
| `onEscape`
|
|
70
|
-
| `loop`
|
|
67
|
+
| Parameter | Type | Default | Description |
|
|
68
|
+
| ------------------- | --------------------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------- |
|
|
69
|
+
| `containerSelector` | `string` | `'[role="menu"]'` | CSS selector to auto-find the container on mount. Set to empty string to disable auto-attach. |
|
|
70
|
+
| `itemSelector` | `string` | `'[tabindex="0"]'` | CSS selector for focusable items inside the container. |
|
|
71
|
+
| `onEnter` | `(el: HTMLElement) => void` | `undefined` | Called when Enter or Space is pressed on a focused item. Falls back to `el.click()` if not provided. |
|
|
72
|
+
| `onEscape` | `() => void` | `undefined` | Called when Escape is pressed. Typically used to close the menu or popover. |
|
|
73
|
+
| `loop` | `boolean` | `true` | When `true`, pressing ArrowDown on the last item wraps to the first, and ArrowUp on the first wraps to the last. |
|
|
71
74
|
|
|
72
75
|
### Returns
|
|
73
76
|
|
|
74
|
-
| Property
|
|
75
|
-
|
|
76
|
-
| `initKeyboardNavigation`
|
|
77
|
-
| `cleanupKeyboardNavigation` | `() => void`
|
|
78
|
-
| `focusNextElement`
|
|
79
|
-
| `focusPreviousElement`
|
|
80
|
-
| `focusFirstElement`
|
|
81
|
-
| `focusLastElement`
|
|
82
|
-
| `setFocusedIndex`
|
|
83
|
-
| `getFocusedIndex`
|
|
77
|
+
| Property | Type | Description |
|
|
78
|
+
| --------------------------- | --------------------------- | ----------------------------------------------------------------------------------------- |
|
|
79
|
+
| `initKeyboardNavigation` | `(el: HTMLElement) => void` | Manually attach keyboard listener to an element. Cleans up any previous attachment first. |
|
|
80
|
+
| `cleanupKeyboardNavigation` | `() => void` | Remove listener and reset state. Called automatically on `onBeforeUnmount`. |
|
|
81
|
+
| `focusNextElement` | `() => void` | Move focus to the next item. Wraps if `loop` is `true`. |
|
|
82
|
+
| `focusPreviousElement` | `() => void` | Move focus to the previous item. Wraps if `loop` is `true`. |
|
|
83
|
+
| `focusFirstElement` | `() => void` | Focus the first matching item in the container. |
|
|
84
|
+
| `focusLastElement` | `() => void` | Focus the last matching item in the container. |
|
|
85
|
+
| `setFocusedIndex` | `(index: number) => void` | Set focus to a specific index. No-op if index is out of bounds. |
|
|
86
|
+
| `getFocusedIndex` | `() => number` | Get the currently focused index (`-1` if no item is focused). |
|
|
84
87
|
|
|
85
88
|
## How It Works
|
|
86
89
|
|
|
@@ -99,26 +102,25 @@ Auto-attach happens in `onMounted`: if `containerSelector` is set and a matching
|
|
|
99
102
|
|
|
100
103
|
```vue
|
|
101
104
|
<script setup lang="ts">
|
|
102
|
-
import { useKeyboardNavigation } from
|
|
103
|
-
import { ref, watch, nextTick } from
|
|
105
|
+
import { useKeyboardNavigation } from "@vc-shell/framework";
|
|
106
|
+
import { ref, watch, nextTick } from "vue";
|
|
104
107
|
|
|
105
108
|
const dropdownRef = ref<HTMLElement | null>(null);
|
|
106
109
|
const isOpen = ref(false);
|
|
107
110
|
const suggestions = ref<string[]>([]);
|
|
108
111
|
|
|
109
|
-
const { initKeyboardNavigation, cleanupKeyboardNavigation, focusFirstElement } =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
});
|
|
112
|
+
const { initKeyboardNavigation, cleanupKeyboardNavigation, focusFirstElement } = useKeyboardNavigation({
|
|
113
|
+
containerSelector: "", // disable auto-attach
|
|
114
|
+
itemSelector: ".suggestion-item",
|
|
115
|
+
onEnter: (el) => {
|
|
116
|
+
selectSuggestion(el.dataset.value!);
|
|
117
|
+
isOpen.value = false;
|
|
118
|
+
},
|
|
119
|
+
onEscape: () => {
|
|
120
|
+
isOpen.value = false;
|
|
121
|
+
},
|
|
122
|
+
loop: true,
|
|
123
|
+
});
|
|
122
124
|
|
|
123
125
|
watch(isOpen, async (open) => {
|
|
124
126
|
if (open) {
|
|
@@ -139,8 +141,15 @@ function selectSuggestion(value: string) {
|
|
|
139
141
|
|
|
140
142
|
<template>
|
|
141
143
|
<div>
|
|
142
|
-
<VcInput
|
|
143
|
-
|
|
144
|
+
<VcInput
|
|
145
|
+
@focus="isOpen = true"
|
|
146
|
+
@input="fetchSuggestions"
|
|
147
|
+
/>
|
|
148
|
+
<div
|
|
149
|
+
v-if="isOpen"
|
|
150
|
+
ref="dropdownRef"
|
|
151
|
+
class="suggestion-dropdown"
|
|
152
|
+
>
|
|
144
153
|
<div
|
|
145
154
|
v-for="item in suggestions"
|
|
146
155
|
:key="item"
|
|
@@ -15,26 +15,35 @@ Also exports `provideLanguages()` for framework-level initialization.
|
|
|
15
15
|
|
|
16
16
|
```vue
|
|
17
17
|
<script setup lang="ts">
|
|
18
|
-
import { useLanguages } from
|
|
19
|
-
import { ref, onMounted } from
|
|
18
|
+
import { useLanguages } from "@vc-shell/framework";
|
|
19
|
+
import { ref, onMounted } from "vue";
|
|
20
20
|
|
|
21
21
|
const { currentLocale, setLocale, getFlag, getCountryCode } = useLanguages();
|
|
22
|
-
const flagUrl = ref(
|
|
22
|
+
const flagUrl = ref("");
|
|
23
23
|
|
|
24
24
|
onMounted(async () => {
|
|
25
25
|
flagUrl.value = await getFlag(currentLocale.value);
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
function switchToGerman() {
|
|
29
|
-
setLocale(
|
|
29
|
+
setLocale("de-DE");
|
|
30
30
|
}
|
|
31
31
|
</script>
|
|
32
32
|
|
|
33
33
|
<template>
|
|
34
34
|
<div class="tw-flex tw-items-center tw-gap-2">
|
|
35
|
-
<img
|
|
35
|
+
<img
|
|
36
|
+
v-if="flagUrl"
|
|
37
|
+
:src="flagUrl"
|
|
38
|
+
alt="flag"
|
|
39
|
+
class="tw-w-6 tw-h-4"
|
|
40
|
+
/>
|
|
36
41
|
<span>{{ currentLocale }}</span>
|
|
37
|
-
<VcButton
|
|
42
|
+
<VcButton
|
|
43
|
+
size="sm"
|
|
44
|
+
@click="switchToGerman"
|
|
45
|
+
>Deutsch</VcButton
|
|
46
|
+
>
|
|
38
47
|
</div>
|
|
39
48
|
</template>
|
|
40
49
|
```
|
|
@@ -47,19 +56,19 @@ None.
|
|
|
47
56
|
|
|
48
57
|
### Returns (`ILanguageService`)
|
|
49
58
|
|
|
50
|
-
| Property / Method
|
|
51
|
-
|
|
52
|
-
| `currentLocale`
|
|
53
|
-
| `setLocale`
|
|
54
|
-
| `getLocaleByTag`
|
|
55
|
-
| `resolveCamelCaseLocale` | `(locale: string) => string`
|
|
56
|
-
| `getFlag`
|
|
57
|
-
| `getCountryCode`
|
|
59
|
+
| Property / Method | Type | Description |
|
|
60
|
+
| ------------------------ | -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
61
|
+
| `currentLocale` | `ComputedRef<string>` | The currently active locale code (e.g., `"en-US"`, `"de-DE"`). |
|
|
62
|
+
| `setLocale` | `(locale: string) => void` | Switches the application locale. This updates `vue-i18n`'s locale and triggers re-rendering of all translated text. |
|
|
63
|
+
| `getLocaleByTag` | `(localeTag: string) => string \| undefined` | Resolves a locale tag to its display string (e.g., `"en-US"` to `"English (United States)"`). Returns `undefined` if the tag is not recognized. |
|
|
64
|
+
| `resolveCamelCaseLocale` | `(locale: string) => string` | Converts a locale code to camelCase format (e.g., `"en-US"` to `"enUs"`). Useful for dynamic property access on objects keyed by locale. |
|
|
65
|
+
| `getFlag` | `(language: string) => Promise<string>` | Fetches a flag image URL for the given language/locale. Returns a promise because flags may be loaded lazily. |
|
|
66
|
+
| `getCountryCode` | `(language: string) => string` | Extracts the country code from a language tag (e.g., `"en-US"` to `"US"`, `"de-DE"` to `"DE"`). |
|
|
58
67
|
|
|
59
68
|
### Additional Exports
|
|
60
69
|
|
|
61
|
-
| Export
|
|
62
|
-
|
|
70
|
+
| Export | Description |
|
|
71
|
+
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
63
72
|
| `provideLanguages()` | Creates and provides the language service via Vue injection. Returns existing service if already provided in the current tree. Falls back to a module-level singleton if no injection context is available. |
|
|
64
73
|
|
|
65
74
|
## How It Works
|
|
@@ -77,19 +86,17 @@ The fallback behavior means `useLanguages()` is safe to call in module `install(
|
|
|
77
86
|
|
|
78
87
|
```vue
|
|
79
88
|
<script setup lang="ts">
|
|
80
|
-
import { useLanguages } from
|
|
81
|
-
import { ref, onMounted, watch } from
|
|
89
|
+
import { useLanguages } from "@vc-shell/framework";
|
|
90
|
+
import { ref, onMounted, watch } from "vue";
|
|
82
91
|
|
|
83
92
|
const { currentLocale, setLocale, getFlag } = useLanguages();
|
|
84
93
|
|
|
85
|
-
const availableLocales = [
|
|
94
|
+
const availableLocales = ["en-US", "de-DE", "fr-FR", "es-ES"];
|
|
86
95
|
const flags = ref<Record<string, string>>({});
|
|
87
96
|
|
|
88
97
|
onMounted(async () => {
|
|
89
98
|
// Pre-fetch all flags in parallel
|
|
90
|
-
const entries = await Promise.all(
|
|
91
|
-
availableLocales.map(async (locale) => [locale, await getFlag(locale)] as const),
|
|
92
|
-
);
|
|
99
|
+
const entries = await Promise.all(availableLocales.map(async (locale) => [locale, await getFlag(locale)] as const));
|
|
93
100
|
flags.value = Object.fromEntries(entries);
|
|
94
101
|
});
|
|
95
102
|
|
|
@@ -107,7 +114,11 @@ function onLocaleChange(locale: string) {
|
|
|
107
114
|
:class="{ 'tw-bg-primary-50': locale === currentLocale }"
|
|
108
115
|
@click="onLocaleChange(locale)"
|
|
109
116
|
>
|
|
110
|
-
<img
|
|
117
|
+
<img
|
|
118
|
+
v-if="flags[locale]"
|
|
119
|
+
:src="flags[locale]"
|
|
120
|
+
class="tw-w-6 tw-h-4"
|
|
121
|
+
/>
|
|
111
122
|
<span>{{ locale }}</span>
|
|
112
123
|
</div>
|
|
113
124
|
</div>
|
|
@@ -117,16 +128,14 @@ function onLocaleChange(locale: string) {
|
|
|
117
128
|
## Recipe: Locale-Aware Dynamic Property Display
|
|
118
129
|
|
|
119
130
|
```typescript
|
|
120
|
-
import { useLanguages } from
|
|
121
|
-
import { useDynamicProperties } from
|
|
131
|
+
import { useLanguages } from "@vc-shell/framework";
|
|
132
|
+
import { useDynamicProperties } from "@vc-shell/framework";
|
|
122
133
|
|
|
123
134
|
const { currentLocale } = useLanguages();
|
|
124
135
|
const { getPropertyValue } = useDynamicProperties(/* ... */);
|
|
125
136
|
|
|
126
137
|
// Read a multilanguage property value for the current locale
|
|
127
|
-
const displayValue = computed(() =>
|
|
128
|
-
getPropertyValue(property.value, currentLocale.value),
|
|
129
|
-
);
|
|
138
|
+
const displayValue = computed(() => getPropertyValue(property.value, currentLocale.value));
|
|
130
139
|
```
|
|
131
140
|
|
|
132
141
|
## Tips
|
|
@@ -11,7 +11,7 @@ Aggregates multiple reactive boolean loading refs into a single computed that is
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { useLoading } from
|
|
14
|
+
import { useLoading } from "@vc-shell/framework";
|
|
15
15
|
|
|
16
16
|
const combinedLoading = useLoading(loadingA, loadingB, loadingC);
|
|
17
17
|
// combinedLoading.value === true when ANY of the three is true
|
|
@@ -21,14 +21,14 @@ const combinedLoading = useLoading(loadingA, loadingB, loadingC);
|
|
|
21
21
|
|
|
22
22
|
### Parameters
|
|
23
23
|
|
|
24
|
-
| Parameter | Type
|
|
25
|
-
|
|
26
|
-
| `...args` | `Readonly<Ref<boolean>>[]` | Yes
|
|
24
|
+
| Parameter | Type | Required | Description |
|
|
25
|
+
| --------- | -------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
26
|
+
| `...args` | `Readonly<Ref<boolean>>[]` | Yes | One or more reactive boolean refs to aggregate. Accepts `Ref<boolean>`, `ComputedRef<boolean>`, or any `Readonly<Ref<boolean>>`. |
|
|
27
27
|
|
|
28
28
|
### Returns
|
|
29
29
|
|
|
30
|
-
| Type
|
|
31
|
-
|
|
30
|
+
| Type | Description |
|
|
31
|
+
| ---------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
32
32
|
| `ComputedRef<boolean>` | `true` if any of the input refs is `true`, `false` otherwise. Re-evaluates whenever any input changes. |
|
|
33
33
|
|
|
34
34
|
## How It Works
|
|
@@ -36,7 +36,7 @@ const combinedLoading = useLoading(loadingA, loadingB, loadingC);
|
|
|
36
36
|
The implementation is a single `computed` that calls `Array.some()` on the input refs:
|
|
37
37
|
|
|
38
38
|
```typescript
|
|
39
|
-
computed(() => args.some((item) => item.value))
|
|
39
|
+
computed(() => args.some((item) => item.value));
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
Because `computed` tracks all `.value` accesses, Vue knows to re-evaluate whenever any of the input refs changes. The `some()` short-circuits on the first `true`, so it is efficient even with many inputs.
|
|
@@ -45,7 +45,10 @@ Because `computed` tracks all `.value` accesses, Vue knows to re-evaluate whenev
|
|
|
45
45
|
|
|
46
46
|
```vue
|
|
47
47
|
<template>
|
|
48
|
-
<VcBlade
|
|
48
|
+
<VcBlade
|
|
49
|
+
title="Order Details"
|
|
50
|
+
:loading="isLoading"
|
|
51
|
+
>
|
|
49
52
|
<div class="tw-grid tw-grid-cols-2 tw-gap-4">
|
|
50
53
|
<VcCard title="Order Info">
|
|
51
54
|
<p>{{ order?.number }}</p>
|
|
@@ -54,15 +57,18 @@ Because `computed` tracks all `.value` accesses, Vue knows to re-evaluate whenev
|
|
|
54
57
|
<p>{{ customer?.name }}</p>
|
|
55
58
|
</VcCard>
|
|
56
59
|
</div>
|
|
57
|
-
<VcDataTable
|
|
60
|
+
<VcDataTable
|
|
61
|
+
:items="lineItems"
|
|
62
|
+
:columns="columns"
|
|
63
|
+
/>
|
|
58
64
|
</VcBlade>
|
|
59
65
|
</template>
|
|
60
66
|
|
|
61
67
|
<script setup lang="ts">
|
|
62
|
-
import { useLoading } from
|
|
63
|
-
import { useOrder } from
|
|
64
|
-
import { useCustomer } from
|
|
65
|
-
import { useLineItems } from
|
|
68
|
+
import { useLoading } from "@vc-shell/framework";
|
|
69
|
+
import { useOrder } from "../composables/useOrder";
|
|
70
|
+
import { useCustomer } from "../composables/useCustomer";
|
|
71
|
+
import { useLineItems } from "../composables/useLineItems";
|
|
66
72
|
|
|
67
73
|
const { order, loading: orderLoading } = useOrder(props.orderId);
|
|
68
74
|
const { customer, loading: customerLoading } = useCustomer(props.customerId);
|
|
@@ -76,8 +82,8 @@ const isLoading = useLoading(orderLoading, customerLoading, lineItemsLoading);
|
|
|
76
82
|
## Recipe: Combining with useAsync
|
|
77
83
|
|
|
78
84
|
```typescript
|
|
79
|
-
import { useLoading } from
|
|
80
|
-
import { useAsync } from
|
|
85
|
+
import { useLoading } from "@vc-shell/framework";
|
|
86
|
+
import { useAsync } from "@vc-shell/framework";
|
|
81
87
|
|
|
82
88
|
const { loading: saveLoading, action: save } = useAsync(saveItem);
|
|
83
89
|
const { loading: deleteLoading, action: remove } = useAsync(deleteItem);
|
|
@@ -92,8 +98,8 @@ const isBusy = useLoading(saveLoading, deleteLoading, validateLoading);
|
|
|
92
98
|
If you have a variable number of loading sources (e.g., loaded from a plugin system), collect them into an array and spread:
|
|
93
99
|
|
|
94
100
|
```typescript
|
|
95
|
-
import { useLoading } from
|
|
96
|
-
import { Ref } from
|
|
101
|
+
import { useLoading } from "@vc-shell/framework";
|
|
102
|
+
import { Ref } from "vue";
|
|
97
103
|
|
|
98
104
|
const loadingRefs: Ref<boolean>[] = [];
|
|
99
105
|
|
|
@@ -11,7 +11,7 @@ Manages the sidebar menu expanded/collapsed and hover-expanded state with localS
|
|
|
11
11
|
## Basic Usage
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { useMenuExpanded } from
|
|
14
|
+
import { useMenuExpanded } from "@vc-shell/framework";
|
|
15
15
|
|
|
16
16
|
const { isExpanded, toggleExpanded, isHoverExpanded, toggleHoverExpanded } = useMenuExpanded();
|
|
17
17
|
|
|
@@ -19,19 +19,19 @@ const { isExpanded, toggleExpanded, isHoverExpanded, toggleHoverExpanded } = use
|
|
|
19
19
|
toggleExpanded();
|
|
20
20
|
|
|
21
21
|
// Hover expand with 200ms delay
|
|
22
|
-
toggleHoverExpanded(true);
|
|
23
|
-
toggleHoverExpanded(false);
|
|
22
|
+
toggleHoverExpanded(true); // opens after delay
|
|
23
|
+
toggleHoverExpanded(false); // closes immediately
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
## API
|
|
27
27
|
|
|
28
28
|
### Returns
|
|
29
29
|
|
|
30
|
-
| Property
|
|
31
|
-
|
|
32
|
-
| `isExpanded`
|
|
33
|
-
| `toggleExpanded`
|
|
34
|
-
| `isHoverExpanded`
|
|
30
|
+
| Property | Type | Description |
|
|
31
|
+
| --------------------- | ---------------------------------- | ---------------------------------------------------------------- |
|
|
32
|
+
| `isExpanded` | `Ref<boolean>` | Pinned state, persisted via `useLocalStorage` |
|
|
33
|
+
| `toggleExpanded` | `() => void` | Toggle the pinned state |
|
|
34
|
+
| `isHoverExpanded` | `Ref<boolean>` | Temporary hover expansion (not persisted) |
|
|
35
35
|
| `toggleHoverExpanded` | `(shouldExpand?: boolean) => void` | Set hover state; opening has a 200ms delay, closing is immediate |
|
|
36
36
|
|
|
37
37
|
## Recipe: Custom Sidebar with Hover Expand
|
|
@@ -59,7 +59,7 @@ const isVisuallyExpanded = computed(() => isExpanded.value || isHoverExpanded.va
|
|
|
59
59
|
<!-- menu items -->
|
|
60
60
|
</nav>
|
|
61
61
|
<button @click="toggleExpanded">
|
|
62
|
-
{{ isExpanded ?
|
|
62
|
+
{{ isExpanded ? "Unpin" : "Pin" }}
|
|
63
63
|
</button>
|
|
64
64
|
</aside>
|
|
65
65
|
</template>
|