@appsbd/vue3-appsbd-ui 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/.ai/ai_ref_AbAvatar.md +1 -11
  2. package/.ai/ai_ref_AbBadge.md +2 -11
  3. package/.ai/ai_ref_AbButton.md +4 -23
  4. package/.ai/ai_ref_AbCard.md +6 -25
  5. package/.ai/ai_ref_AbCarousel.md +1 -12
  6. package/.ai/ai_ref_AbChart.md +16 -57
  7. package/.ai/ai_ref_AbColorPicker.md +1 -14
  8. package/.ai/ai_ref_AbConfirmPopover.md +1 -6
  9. package/.ai/ai_ref_AbCustomField.md +1 -9
  10. package/.ai/ai_ref_AbDarkModeToggler.md +1 -10
  11. package/.ai/ai_ref_AbDateTimePicker.md +4 -38
  12. package/.ai/ai_ref_AbEasyModal.md +2 -8
  13. package/.ai/ai_ref_AbField.md +1 -9
  14. package/.ai/ai_ref_AbFileUploader.md +3 -19
  15. package/.ai/ai_ref_AbFilterPanel.md +0 -4
  16. package/.ai/ai_ref_AbFormCheck.md +2 -19
  17. package/.ai/ai_ref_AbImageRadioInput.md +1 -9
  18. package/.ai/ai_ref_AbInputField.md +1 -9
  19. package/.ai/ai_ref_AbInputTag.md +2 -22
  20. package/.ai/ai_ref_AbKbd.md +0 -12
  21. package/.ai/ai_ref_AbKbdGroup.md +1 -13
  22. package/.ai/ai_ref_AbModal.md +98 -103
  23. package/.ai/ai_ref_AbMultiSelect.md +3 -37
  24. package/.ai/ai_ref_AbNumberField.md +5 -30
  25. package/.ai/ai_ref_AbPinInput.md +1 -13
  26. package/.ai/ai_ref_AbPopover.md +2 -12
  27. package/.ai/ai_ref_AbPricingCard.md +0 -8
  28. package/.ai/ai_ref_AbPricingContainer.md +0 -8
  29. package/.ai/ai_ref_AbPricingTable.md +20 -36
  30. package/.ai/ai_ref_AbProgressbar.md +1 -11
  31. package/.ai/ai_ref_AbScrollbar.md +2 -12
  32. package/.ai/ai_ref_AbSettingsForm.md +1 -9
  33. package/.ai/ai_ref_AbSideMenuItem.md +1 -12
  34. package/.ai/ai_ref_AbSidebar.md +2 -10
  35. package/.ai/ai_ref_AbSkeleton.md +0 -18
  36. package/.ai/ai_ref_AbSlider.md +1 -20
  37. package/.ai/ai_ref_AbTab.md +0 -8
  38. package/.ai/ai_ref_AbTable.md +0 -10
  39. package/.ai/ai_ref_AbTabs.md +1 -11
  40. package/.ai/ai_ref_AbToggle.md +4 -23
  41. package/.ai/ai_ref_AbTooltip.md +1 -15
  42. package/.ai/ai_ref_AbWizard.md +7 -20
  43. package/.ai/ai_ref_AbWizardStep.md +1 -13
  44. package/.ai/ai_ref_abEventBus.md +66 -94
  45. package/.ai/ai_ref_abRequestParam.md +40 -55
  46. package/.ai/ai_ref_abTranslate.md +30 -15
  47. package/.ai/ai_ref_abVeeRules.md +33 -42
  48. package/.ai/ai_ref_global_config.md +7 -17
  49. package/.ai/ai_ref_useAlert.md +45 -63
  50. package/.ai/ai_ref_useFileValidator.md +31 -46
  51. package/.ai/ai_ref_useResponsive.md +41 -55
  52. package/.ai/ai_ref_useTheme.md +28 -39
  53. package/.ai/ai_ref_useToast.md +30 -42
  54. package/AI_REF.md +114 -0
  55. package/AI_REFERENCE.md +82 -1153
  56. package/dist/skins/black.css +1 -1
  57. package/dist/skins/cyan.css +1 -1
  58. package/dist/skins/default.css +1 -1
  59. package/dist/skins/gray.css +1 -1
  60. package/dist/skins/green.css +1 -1
  61. package/dist/skins/orange.css +1 -1
  62. package/dist/skins/pink.css +1 -1
  63. package/dist/skins/purple.css +1 -1
  64. package/dist/skins/red.css +1 -1
  65. package/dist/skins/themes/_blue.scss +35 -35
  66. package/dist/skins/themes/_common_variable.scss +101 -6
  67. package/dist/skins/themes/_cyan.scss +1 -1
  68. package/dist/skins/themes/_gray.scss +2 -1
  69. package/dist/skins/themes/_green.scss +1 -1
  70. package/dist/skins/themes/_grid.scss +4 -1
  71. package/dist/skins/themes/_orange.scss +1 -1
  72. package/dist/skins/themes/_pink.scss +1 -1
  73. package/dist/skins/themes/_purple.scss +1 -1
  74. package/dist/skins/themes/_red.scss +1 -1
  75. package/dist/skins/themes/_violet.scss +1 -1
  76. package/dist/skins/violet.css +1 -1
  77. package/dist/style.css +1 -1
  78. package/dist/vue3-appsbd-ui.cjs.js +93 -61
  79. package/dist/vue3-appsbd-ui.es.js +26869 -17342
  80. package/package.json +7 -1
  81. package/readme.md +59 -1
  82. package/scripts/postinstall.js +55 -0
  83. package/scripts/setup.js +16 -0
  84. package/scripts/skill-groups.js +38 -0
  85. package/skills/commands/generate-module.md +76 -0
  86. package/skills/commands/settings-form.md +175 -0
  87. package/skills/commands/use-appsbd-ui.md +40 -0
@@ -2,22 +2,12 @@
2
2
 
3
3
  Styled custom scrollbar wrapper for overflowing content. Emits scroll position events and supports hover-expand.
4
4
 
5
- ## Installation
6
-
7
- Globally registered by the plugin.
8
-
9
5
  ## Usage
10
6
 
11
7
  ```vue
12
8
  <template>
13
- <ab-scrollbar
14
- size="md"
15
- is-hover-increase
16
- @scroll-end="loadMore"
17
- >
18
- <div style="height: 2000px">
19
- <!-- long content -->
20
- </div>
9
+ <ab-scrollbar size="md" is-hover-increase @scroll-end="loadMore">
10
+ <div style="height: 2000px"><!-- long content --></div>
21
11
  </ab-scrollbar>
22
12
  </template>
23
13
  ```
@@ -1,10 +1,6 @@
1
1
  # AbSettingsForm — AI Reference
2
2
 
3
- Composite settings-style form layout. When nested inside an `AbWizardStep` / `AbWizard`, auto-registers itself as the wizard step's validator — returning `false` from `onSubmit` blocks the wizard from advancing.
4
-
5
- ## Installation
6
-
7
- Globally registered by the plugin.
3
+ Composite settings-style form layout. When nested inside an `AbWizardStep`, auto-registers itself as the wizard step's validator — returning `false` from `onSubmit` blocks the wizard from advancing.
8
4
 
9
5
  ## Usage
10
6
 
@@ -39,10 +35,6 @@ async function validateProfile(values) {
39
35
  | --- | --- | --- | --- |
40
36
  | `onSubmit` | `Function` | `() => {}` | Called with form values on submit. Return `false` (or throw) to block wizard progression. |
41
37
 
42
- ## Events
43
-
44
- None at the component level — form submission is handled via the `onSubmit` prop.
45
-
46
38
  ## Slots
47
39
 
48
40
  | Name | Description |
@@ -1,26 +1,19 @@
1
1
  # AbSideMenuItem — AI Reference
2
2
 
3
- Single entry in an `AbSidebar`. Can render as a router-link, a plain anchor, a section title, or a parent node with a submenu.
4
-
5
- ## Installation
6
-
7
- Globally registered by the plugin.
3
+ Single entry in an `AbSidebar`. Renders as a router-link, plain anchor, section title, or parent node with a submenu.
8
4
 
9
5
  ## Usage
10
6
 
11
7
  ```vue
12
- <!-- Router-link item -->
13
8
  <ab-side-menu-item :to="{ name: 'dashboard' }">
14
9
  <template #icon><i class="bi bi-house"></i></template>
15
10
  Dashboard
16
11
  </ab-side-menu-item>
17
12
 
18
- <!-- Section title -->
19
13
  <ab-side-menu-item>
20
14
  <template #sectiontitle>Account</template>
21
15
  </ab-side-menu-item>
22
16
 
23
- <!-- Parent with submenu -->
24
17
  <ab-side-menu-item href="#">
25
18
  <template #icon><i class="bi bi-gear"></i></template>
26
19
  Settings
@@ -38,10 +31,6 @@ Globally registered by the plugin.
38
31
  | `to` | `String \| Object` | Router-link target. When this item has a submenu, `to` makes the label clickable as a link. |
39
32
  | `href` | `String` | Plain anchor target. With a submenu, `href` makes the item a submenu toggle instead of a link. |
40
33
 
41
- ## Events
42
-
43
- None.
44
-
45
34
  ## Slots
46
35
 
47
36
  | Name | Description |
@@ -1,10 +1,6 @@
1
1
  # AbSidebar — AI Reference
2
2
 
3
- Collapsible application sidebar. Hosts `AbSideMenuItem` children, supports a header/footer, optional search, and persists its collapse state to `localStorage`.
4
-
5
- ## Installation
6
-
7
- Globally registered by the plugin.
3
+ Collapsible application sidebar. Hosts `AbSideMenuItem` children, supports header/footer, optional search, and persists collapse state to `localStorage`.
8
4
 
9
5
  ## Usage
10
6
 
@@ -44,16 +40,12 @@ Globally registered by the plugin.
44
40
 
45
41
  | Name | Type | Default | Description |
46
42
  | --- | --- | --- | --- |
47
- | `appUniqueId` | `String` | `"apbd"` | Unique key used for the `localStorage` entry that stores collapse state. |
43
+ | `appUniqueId` | `String` | `"apbd"` | Unique key for the `localStorage` entry that stores collapse state. |
48
44
  | `hideSeperator` | `Boolean` | `false` | Hide dividers between sections. |
49
45
  | `mobileFullHeight` | `Boolean` | `false` | Force full-viewport height on mobile. |
50
46
  | `enableSearch` | `Boolean` | `false` | Show a search box that filters menu items. |
51
47
  | `searchTargetClass` | `String` | `"nav-item"` | CSS class of items that the search should match. |
52
48
 
53
- ## Events
54
-
55
- None.
56
-
57
49
  ## Slots
58
50
 
59
51
  | Name | Description |
@@ -2,18 +2,12 @@
2
2
 
3
3
  Pulsing placeholder for loading states. Forwards all `$attrs` to the root `<div>`, so size and shape are controlled through utility classes or inline styles.
4
4
 
5
- ## Installation
6
-
7
- Globally registered by the plugin.
8
-
9
5
  ## Usage
10
6
 
11
7
  ```vue
12
8
  <template>
13
- <!-- Heading skeleton -->
14
9
  <ab-skeleton style="height: 24px; width: 60%;" />
15
10
 
16
- <!-- Card skeleton -->
17
11
  <ab-card>
18
12
  <template #body>
19
13
  <ab-skeleton style="height: 160px; border-radius: 8px;" />
@@ -24,18 +18,6 @@ Globally registered by the plugin.
24
18
  </template>
25
19
  ```
26
20
 
27
- ## Props
28
-
29
- No declared props.
30
-
31
- ## Events
32
-
33
- None.
34
-
35
- ## Slots
36
-
37
- None.
38
-
39
21
  ## Notes
40
22
 
41
23
  Apply `width`, `height`, `border-radius`, etc. via `style` or a utility class.
@@ -2,29 +2,14 @@
2
2
 
3
3
  Single or range numeric slider with custom thumb rendering and size variants.
4
4
 
5
- ## Installation
6
-
7
- Globally registered by the plugin.
8
-
9
5
  ## Usage
10
6
 
11
7
  ```vue
12
8
  <template>
13
- <!-- Single -->
14
9
  <ab-slider v-model="volume" :min="0" :max="100" label="Volume" show-labels />
15
10
 
16
- <!-- Range -->
17
- <ab-slider
18
- v-model="priceRange"
19
- :min="0"
20
- :max="5000"
21
- :step="50"
22
- range
23
- show-labels
24
- :format-label="v => '$' + v"
25
- />
11
+ <ab-slider v-model="priceRange" :min="0" :max="5000" :step="50" range show-labels :format-label="v => '$' + v" />
26
12
 
27
- <!-- Custom thumb -->
28
13
  <ab-slider v-model="progress" show-labels>
29
14
  <template #thumb="{ value, type }">
30
15
  <div class="custom-thumb">{{ value }}</div>
@@ -65,7 +50,3 @@ Globally registered by the plugin.
65
50
  | `postfix` | — | Postfix content (after the track). |
66
51
  | `thumb` | `{ value, type }` | Custom thumb rendering. `type` is `"min"`, `"max"`, or `"single"`. |
67
52
  | `hints` | — | Custom hints. |
68
-
69
- ## v-model
70
-
71
- Yes.
@@ -2,10 +2,6 @@
2
2
 
3
3
  Single tab pane / link. Must be used inside an `AbTabs` parent.
4
4
 
5
- ## Installation
6
-
7
- Globally registered by the plugin.
8
-
9
5
  ## Usage
10
6
 
11
7
  ```vue
@@ -26,10 +22,6 @@ Globally registered by the plugin.
26
22
  | `selected` | `Boolean` | `false` | Mark this tab as initially selected. |
27
23
  | `to` | `String \| Object` | `null` | Router-link target (only used when the parent `AbTabs` has `is-route-mode`). |
28
24
 
29
- ## Events
30
-
31
- None.
32
-
33
25
  ## Slots
34
26
 
35
27
  | Name | Description |
@@ -2,10 +2,6 @@
2
2
 
3
3
  Data grid with column definitions, per-cell and per-header slot overrides, and an `empty` slot.
4
4
 
5
- ## Installation
6
-
7
- Globally registered by the plugin.
8
-
9
5
  ## Usage
10
6
 
11
7
  ```vue
@@ -19,10 +15,8 @@ Globally registered by the plugin.
19
15
  { key: 'actions', label: '' },
20
16
  ]"
21
17
  >
22
- <!-- Custom header -->
23
18
  <template #head(name)>Full Name</template>
24
19
 
25
- <!-- Custom cell -->
26
20
  <template #cell(role)="{ value }">
27
21
  <ab-badge class="bg-primary">{{ value }}</ab-badge>
28
22
  </template>
@@ -44,10 +38,6 @@ Globally registered by the plugin.
44
38
  | `fields` | `Array` | `[]` | Column definitions — each string key or `{ key, label }`. |
45
39
  | `tableClass` | `String \| Array \| Object` | `""` | CSS class(es) applied to the `<table>`. |
46
40
 
47
- ## Events
48
-
49
- None.
50
-
51
41
  ## Slots
52
42
 
53
43
  | Name | Scope | Description |
@@ -1,23 +1,17 @@
1
1
  # AbTabs — AI Reference
2
2
 
3
- Parent container for tabbed interfaces. Pair with `AbTab` children. Supports both "content-switching" mode (default) and "router-link" mode for navigation-driven tabs.
4
-
5
- ## Installation
6
-
7
- Globally registered by the plugin.
3
+ Parent container for tabbed interfaces. Pair with `AbTab` children. Supports content-switching mode (default) and router-link mode for navigation-driven tabs.
8
4
 
9
5
  ## Usage
10
6
 
11
7
  ```vue
12
8
  <template>
13
- <!-- Content-switching tabs -->
14
9
  <ab-tabs nav-class="nav-pills">
15
10
  <ab-tab title="Overview" selected>Overview content</ab-tab>
16
11
  <ab-tab title="Billing">Billing content</ab-tab>
17
12
  <ab-tab title="Security">Security content</ab-tab>
18
13
  </ab-tabs>
19
14
 
20
- <!-- Router-link tabs -->
21
15
  <ab-tabs is-route-mode>
22
16
  <ab-tab title="Users" :to="{ name: 'users' }" />
23
17
  <ab-tab title="Teams" :to="{ name: 'teams' }" />
@@ -36,10 +30,6 @@ Globally registered by the plugin.
36
30
  | `tabClass` | `String` | `""` | Class on each individual tab link. |
37
31
  | `isRouteMode` | `Boolean` | `false` | When `true`, tab clicks perform router navigation. |
38
32
 
39
- ## Events
40
-
41
- None.
42
-
43
33
  ## Slots
44
34
 
45
35
  | Name | Description |
@@ -2,29 +2,13 @@
2
2
 
3
3
  Accessible switch/toggle control. Supports title + description layout and custom `trueValue` / `falseValue` values (defaults to `"Y"` / `"N"`).
4
4
 
5
- ## Installation
6
-
7
- Globally registered by the plugin.
8
-
9
5
  ## Usage
10
6
 
11
7
  ```vue
12
8
  <template>
13
- <ab-toggle
14
- v-model="settings.notifications"
15
- name="notifications"
16
- title="Email notifications"
17
- description="Receive weekly digest emails."
18
- />
9
+ <ab-toggle v-model="settings.notifications" name="notifications" title="Email notifications" description="Receive weekly digest emails." />
19
10
 
20
- <!-- Boolean values -->
21
- <ab-toggle
22
- v-model="isActive"
23
- name="active"
24
- :true-value="true"
25
- :false-value="false"
26
- label="Active"
27
- />
11
+ <ab-toggle v-model="isActive" name="active" :true-value="true" :false-value="false" label="Active" />
28
12
  </template>
29
13
  ```
30
14
 
@@ -33,7 +17,8 @@ Globally registered by the plugin.
33
17
  | Name | Type | Default | Description |
34
18
  | --- | --- | --- | --- |
35
19
  | `modelValue` | `any` | — | v-model binding. |
36
- | `label` | `String \| null` | `null` | Field label (above the toggle). |
20
+ | `label` | `String \| null` | `null` | Field label. |
21
+ | `variant` | `String` | `"inline"` | Layout variant (`"inline"` or `"column"`). |
37
22
  | `val` | `any` | `"N"` | Initial value when `modelValue` is empty. |
38
23
  | `name` | `String` | **required** | VeeValidate field name. |
39
24
  | `containerClass` | `String` | `"mb-3"` | Wrapper class. |
@@ -59,7 +44,3 @@ Globally registered by the plugin.
59
44
  | `description` | Custom description. |
60
45
  | `descriptionContainer` | Wraps the entire title + description block. |
61
46
  | `hints` | Custom hints. |
62
-
63
- ## v-model
64
-
65
- Yes.
@@ -1,21 +1,15 @@
1
1
  # AbTooltip — AI Reference
2
2
 
3
- Programmatic tooltip component. Complements the `v-tooltip` directive — use this when you need slot-driven rich content or interactive tooltips.
4
-
5
- ## Installation
6
-
7
- Globally registered by the plugin.
3
+ Programmatic tooltip component. Use when you need slot-driven rich content or interactive tooltips; use the `v-tooltip` directive for simple string hints.
8
4
 
9
5
  ## Usage
10
6
 
11
7
  ```vue
12
8
  <template>
13
- <!-- Simple -->
14
9
  <ab-tooltip content="Save changes" placement="top">
15
10
  <ab-button class="btn-primary"><i class="bi bi-save"></i></ab-button>
16
11
  </ab-tooltip>
17
12
 
18
- <!-- Rich content -->
19
13
  <ab-tooltip placement="bottom" interactive>
20
14
  <ab-button class="btn-outline-secondary">Info</ab-button>
21
15
  <template #content>
@@ -37,17 +31,9 @@ Globally registered by the plugin.
37
31
  | `arrow` | `Boolean` | `true` | Show the arrow pointer. |
38
32
  | `interactive` | `Boolean` | `false` | Allow hovering the tooltip without it hiding. |
39
33
 
40
- ## Events
41
-
42
- None.
43
-
44
34
  ## Slots
45
35
 
46
36
  | Name | Description |
47
37
  | --- | --- |
48
38
  | `default` | Trigger element. |
49
39
  | `content` | Tooltip body (overrides the `content` prop). |
50
-
51
- ## See also
52
-
53
- - `v-tooltip` directive for simple string hints (`<ab-button v-tooltip="'Hello'">`).
@@ -1,10 +1,6 @@
1
1
  # AbWizard — AI Reference
2
2
 
3
- Multi-step wizard container. Hosts `AbWizardStep` children, supports horizontal / vertical orientations, and multiple visual variants (including modal-rendered wizards).
4
-
5
- ## Installation
6
-
7
- Globally registered by the plugin.
3
+ Multi-step wizard container. Hosts `AbWizardStep` children, supports horizontal/vertical orientations, and multiple visual variants including modal-rendered wizards.
8
4
 
9
5
  ## Usage
10
6
 
@@ -17,27 +13,18 @@ Globally registered by the plugin.
17
13
  @finished="handleFinished"
18
14
  @step-changed="onStepChange"
19
15
  >
20
- <ab-wizard-step title="Account" description="Basic info">
21
- <!-- step content -->
22
- </ab-wizard-step>
23
-
24
- <ab-wizard-step title="Profile">
25
- <!-- step content -->
26
- </ab-wizard-step>
27
-
28
- <ab-wizard-step title="Confirm">
29
- <!-- step content -->
30
- </ab-wizard-step>
16
+ <ab-wizard-step title="Account" description="Basic info"><!-- step content --></ab-wizard-step>
17
+ <ab-wizard-step title="Profile"><!-- step content --></ab-wizard-step>
18
+ <ab-wizard-step title="Confirm"><!-- step content --></ab-wizard-step>
31
19
  </ab-wizard>
32
20
  </template>
33
21
 
34
22
  <script setup>
35
23
  async function handleBeforeNext(currentStepIndex) {
36
- // Return false to block navigation
37
- return true;
24
+ return true; // return false to block navigation
38
25
  }
39
- function handleFinished() { /* all steps done */ }
40
- function onStepChange(newIndex) { /* active step changed */ }
26
+ function handleFinished() {}
27
+ function onStepChange(newIndex) {}
41
28
  </script>
42
29
  ```
43
30
 
@@ -2,19 +2,11 @@
2
2
 
3
3
  Single step inside an `AbWizard`. Declares its title, optional description, and an optional icon shown in the stepper.
4
4
 
5
- ## Installation
6
-
7
- Globally registered by the plugin.
8
-
9
5
  ## Usage
10
6
 
11
7
  ```vue
12
8
  <ab-wizard>
13
- <ab-wizard-step
14
- title="Account"
15
- description="Create your account"
16
- :icon="UserIcon"
17
- >
9
+ <ab-wizard-step title="Account" description="Create your account" :icon="UserIcon">
18
10
  <ab-input-field v-model="form.email" name="email" label="Email" rules="required|email" />
19
11
  </ab-wizard-step>
20
12
 
@@ -33,10 +25,6 @@ Globally registered by the plugin.
33
25
  | `icon` | `Object \| String \| Function` | `null` | Icon component, icon class string, or render function. |
34
26
  | `disableClose` | `Boolean` | `false` | Disable the close button while this step is active. |
35
27
 
36
- ## Events
37
-
38
- None.
39
-
40
28
  ## Slots
41
29
 
42
30
  | Name | Description |
@@ -1,94 +1,66 @@
1
- # abEventBus (abEmitter)
2
-
3
- A lightweight, global event bus built on top of `tiny-emitter`. Provides a Vue 3 plugin for the `$eventBus` global property and a standalone `emitterObj` for non-component usage.
4
-
5
- ## Installation
6
-
7
- ```javascript
8
- npm install @vue3-appsbd-ui
9
- ```
10
-
11
- ## Usage
12
-
13
- ### Standalone (Composable / Utilities)
14
-
15
- Import `emitterObj` directly for use outside of Vue components — utilities, stores, service modules, etc.
16
-
17
- ```javascript
18
- import { emitterObj } from "@vue3-appsbd-ui";
19
- import { onUnmounted } from "vue";
20
-
21
- function handler(data) {
22
- console.log("Received:", data);
23
- }
24
-
25
- // Subscribe
26
- emitterObj.$on("my-event", handler);
27
-
28
- // Emit
29
- emitterObj.$emit("my-event", { message: "Hello" });
30
-
31
- // Cleanup
32
- onUnmounted(() => {
33
- emitterObj.$off("my-event", handler);
34
- });
35
- ```
36
-
37
- ### Plugin Usage (Options API or `this` context)
38
-
39
- Register the event bus as a Vue plugin to access `$eventBus` from any component via `this.$eventBus`.
40
-
41
- ```javascript
42
- // main.js
43
- import { createApp } from "vue";
44
- import abEventBus from "@vue3-appsbd-ui/libraries/abEmitter";
45
-
46
- const app = createApp(App);
47
- app.use(abEventBus);
48
- app.mount("#app");
49
- ```
50
-
51
- ```javascript
52
- // Inside any Options-API component:
53
- export default {
54
- mounted() {
55
- this.$eventBus.$on("my-event", this.handleEvent);
56
- },
57
- beforeUnmount() {
58
- this.$eventBus.$off("my-event", this.handleEvent);
59
- },
60
- methods: {
61
- handleEvent(payload) {
62
- console.log("Received:", payload);
63
- }
64
- }
65
- }
66
- ```
67
-
68
- ### One-Time Listener
69
-
70
- Use `$once` to subscribe to an event that automatically unsubscribes after the first invocation.
71
-
72
- ```javascript
73
- emitterObj.$once("init-complete", () => {
74
- console.log("Initialization done — this runs only once.");
75
- });
76
- ```
77
-
78
- ## API Reference
79
-
80
- ### `emitterObj` Methods
81
-
82
- | Method | Signature | Description |
83
- |---|---|---|
84
- | `$on` | `(event: string, callback: Function)` | Subscribe to an event. |
85
- | `$once` | `(event: string, callback: Function)` | Subscribe to an event; auto-unsubscribe after first fire. |
86
- | `$off` | `(event: string, callback: Function)` | Unsubscribe from an event (pass the same handler reference). |
87
- | `$emit` | `(event: string, ...args: any[])` | Fire an event with optional payload arguments. |
88
-
89
- ### Plugin (default export)
90
-
91
- | Property | Type | Description |
92
- |---|---|---|
93
- | `emitterObj` | `Object` | Direct reference to the emitter wrapper. |
94
- | `install(app)` | `Function` | Vue plugin install hook — registers `$eventBus` on `globalProperties`. |
1
+ # abEventBus (abEmitter)
2
+
3
+ Lightweight global event bus built on `tiny-emitter`. Provides a Vue 3 plugin for the `$eventBus` global property and a standalone `emitterObj` for non-component usage.
4
+
5
+ ## Usage
6
+
7
+ ### Standalone (Composable / Utilities)
8
+
9
+ ```javascript
10
+ import { emitterObj } from "@vue3-appsbd-ui";
11
+ import { onUnmounted } from "vue";
12
+
13
+ function handler(data) { console.log("Received:", data); }
14
+
15
+ emitterObj.$on("my-event", handler);
16
+ emitterObj.$emit("my-event", { message: "Hello" });
17
+
18
+ onUnmounted(() => {
19
+ emitterObj.$off("my-event", handler);
20
+ });
21
+ ```
22
+
23
+ ### Plugin Usage (Options API)
24
+
25
+ ```javascript
26
+ // main.js
27
+ import abEventBus from "@vue3-appsbd-ui/libraries/abEmitter";
28
+ app.use(abEventBus);
29
+ ```
30
+
31
+ ```javascript
32
+ // Inside any Options-API component:
33
+ export default {
34
+ mounted() { this.$eventBus.$on("my-event", this.handleEvent); },
35
+ beforeUnmount() { this.$eventBus.$off("my-event", this.handleEvent); },
36
+ methods: {
37
+ handleEvent(payload) { console.log("Received:", payload); }
38
+ }
39
+ }
40
+ ```
41
+
42
+ ### One-Time Listener
43
+
44
+ ```javascript
45
+ emitterObj.$once("init-complete", () => {
46
+ console.log("Runs only once.");
47
+ });
48
+ ```
49
+
50
+ ## API Reference
51
+
52
+ ### `emitterObj` Methods
53
+
54
+ | Method | Signature | Description |
55
+ |---|---|---|
56
+ | `$on` | `(event: string, callback: Function)` | Subscribe to an event. |
57
+ | `$once` | `(event: string, callback: Function)` | Subscribe; auto-unsubscribe after first fire. |
58
+ | `$off` | `(event: string, callback: Function)` | Unsubscribe (pass the same handler reference). |
59
+ | `$emit` | `(event: string, ...args: any[])` | Fire an event with optional payload arguments. |
60
+
61
+ ### Plugin (default export)
62
+
63
+ | Property | Type | Description |
64
+ |---|---|---|
65
+ | `emitterObj` | `Object` | Direct reference to the emitter wrapper. |
66
+ | `install(app)` | `Function` | Vue plugin install hook — registers `$eventBus` on `globalProperties`. |