@mfs-atomic/ui 1.0.0 → 1.1.0

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 CHANGED
@@ -69,6 +69,107 @@ const name = ref('')
69
69
 
70
70
  > Components can also be imported individually (e.g., `import { Button, Card, Input } from '@mfs-atomic/ui'`).
71
71
 
72
+ ## Highlighted & Newly Added Components
73
+
74
+ | Category | Components |
75
+ | --- | --- |
76
+ | **Forms & Validation** | `Form`, `FormField`, `Mentions`, `SignaturePad`, `CodeEditor` |
77
+ | **Overlays & Portals** | `CommandPalette`, `DynamicDialog`, `Portal`, `OverlayBadge` |
78
+ | **Media & Visuals** | `ImageCropper`, `ImageCompare`, `AvatarGroup` |
79
+ | **Data & Lists** | `DataTable`, `InfiniteScroll`, `Select`, `AutoComplete` |
80
+
81
+ ## Local Filter vs Remote Search & Server-Side Data
82
+
83
+ Choose the data mode based on dataset size:
84
+
85
+ - **Local filtering (default)**: Best for small, in-memory datasets (< 200 items). Leave `remote` / `lazy` off and pass the full `options`, `items`, or `value` array; the component filters/sorts/paginates on the client.
86
+ - **Remote search (`remote` + `@search` + `loading`)**: Best for large or server-backed lists in `CommandPalette`, `Mentions`, `Select`, and `AutoComplete`. Setting `remote` disables built-in client filtering so your `@search` handler can fetch and update options while `loading` displays a spinner.
87
+ - **Server-side pagination & scrolling (`lazy`)**: Best for unbounded tables and feeds. Use `DataTable` with `lazy` (`@page`, `@sort`, `@filter`) or `InfiniteScroll` (`@load`, `hasMore`, `loading`).
88
+
89
+ ```vue
90
+ <!-- Remote Search (CommandPalette / Mentions / Select / AutoComplete) -->
91
+ <CommandPalette
92
+ v-model:open="isOpen"
93
+ :items="remoteItems"
94
+ remote
95
+ :loading="isSearching"
96
+ @search="fetchCommands"
97
+ />
98
+
99
+ <Mentions
100
+ v-model="comment"
101
+ :options="userSuggestions"
102
+ remote
103
+ :loading="isSearchingUsers"
104
+ @search="({ trigger, query }) => fetchMentions(trigger, query)"
105
+ />
106
+
107
+ <!-- Server-Side DataTable & InfiniteScroll -->
108
+ <DataTable
109
+ :value="rows"
110
+ :columns="columns"
111
+ lazy
112
+ paginator
113
+ :loading="isLoadingTable"
114
+ @page="onPage"
115
+ @sort="onSort"
116
+ @filter="onFilter"
117
+ />
118
+
119
+ <InfiniteScroll :loading="isLoadingMore" :has-more="hasNextPage" @load="loadNextPage">
120
+ <div v-for="item in feed" :key="item.id">{{ item.title }}</div>
121
+ </InfiniteScroll>
122
+ ```
123
+
124
+ ## XSS-Safe `CodeEditor`
125
+
126
+ `CodeEditor` tokenizes source code into plain-text `<span>` elements (`{{ tok.text }}`) rather than `v-html`, preventing XSS injection even when rendering untrusted user input.
127
+
128
+ ```vue
129
+ <script setup lang="ts">
130
+ import { ref } from 'vue'
131
+ import { CodeEditor } from '@mfs-atomic/ui'
132
+
133
+ const code = ref(`<script setup>\nconst msg = 'Safe by default'\n<\/script>`)
134
+ </script>
135
+
136
+ <template>
137
+ <CodeEditor
138
+ v-model="code"
139
+ language="vue"
140
+ filename="Example.vue"
141
+ :line-numbers="true"
142
+ :copyable="true"
143
+ />
144
+ </template>
145
+ ```
146
+
147
+ ## `v-animate-on-scroll` Zero-CSS Presets
148
+
149
+ Animate elements on viewport entry without writing custom keyframes. Supports 5 built-in presets (`fade-up`, `fade-down`, `fade-left`, `fade-right`, `zoom-in`), respects `prefers-reduced-motion`, and also accepts custom `enterClass` / `leaveClass` options.
150
+
151
+ ```vue
152
+ <script setup lang="ts">
153
+ import { vAnimateOnScroll } from '@mfs-atomic/ui'
154
+ </script>
155
+
156
+ <template>
157
+ <!-- Default preset ('fade-up') -->
158
+ <Card v-animate-on-scroll title="Fade Up" />
159
+
160
+ <!-- Shorthand preset string -->
161
+ <Card v-animate-on-scroll="'fade-left'" title="Slide Left" />
162
+
163
+ <!-- Full options object -->
164
+ <Card
165
+ v-animate-on-scroll="{ animation: 'zoom-in', duration: 600, delay: 150, once: false }"
166
+ title="Zoom In"
167
+ />
168
+ </template>
169
+ ```
170
+
171
+ > When registered globally via `ThemePlugin`, the directive is available as `v-animateonscroll`.
172
+
72
173
  ## Built-in Themes
73
174
 
74
175
  All 20 theme IDs supported by `ThemePlugin` (`defaultTheme`) and `setTheme(id)`: