feather-k-demo-utils 0.0.48 → 0.1.1

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/DEMO-UTILS.md CHANGED
@@ -156,54 +156,135 @@ import { DemoSettings } from "feather-k-demo-utils";
156
156
  }
157
157
  ```
158
158
 
159
- ### Demo Layout Structure (required for consistent utility styles)
159
+
160
+ ### Demo Layout Structure
161
+
162
+ #### App.vue (Root Level)
163
+
164
+ The root layout begins with a single `.demo-app` wrapper. This is the top-level container for all demo content and navigation. DemoStats is typically rendered at this level, after the demo selection and main content.
160
165
 
161
166
  ```html
162
- <!-- App.vue top level "demo-app" -->
167
+ <!-- App.vue -->
163
168
  <div class="demo-app">
164
- <!-- each demo (if there are multiple)-->
165
- <div class="featherk-demo">
166
- <form class="demo-form">
167
- <!-- one or more .fk-field-block rows -->
168
-
169
- <div class="demo-actions">
170
- <!-- action buttons (Clear / Submit, etc.) -->
171
- </div>
172
- </form>
173
-
174
- <div class="demo-notes">
175
- <!-- notes content -->
176
- </div>
169
+ <div class="fk-field-block demo-selection">
170
+ <!-- Demo selection UI (DropDownList, Label, etc.) -->
171
+ </div>
172
+ <h1>Grid Exploration</h1>
173
+ <div>
174
+ <!-- Demo component is conditionally rendered here -->
175
+ <BasicGrid v-if="selectedDemo === 'Basic'" />
176
+ <RowNavGrid v-if="selectedDemo === 'RowNavigation'" />
177
+ <!-- ...other demo components... -->
177
178
  </div>
179
+ <DemoStats
180
+ v-if="stylesVersion"
181
+ :version="stylesVersion"
182
+ :publishDate="publishDate"
183
+ :active="false"
184
+ />
185
+ <!-- Optionally, DemoNotes can also be used at this level -->
178
186
  </div>
179
-
180
- Keep this aligned with whichever demo-utils release you want to display.
181
187
  ```
182
188
 
183
- ### Required Demo Shell Structure
189
+ **Where the layout begins and ends:**
190
+ - `.demo-app` starts at the top of App.vue and wraps all demo navigation, content, and stats.
191
+ - Each demo component (e.g., BasicGrid.vue) is rendered inside `.demo-app` but outside of `.fk-field-block.demo-selection`.
192
+
193
+ #### Demo Component Level (e.g., BasicGrid.vue, RowNavGrid.vue)
184
194
 
185
- All demo components must use the following structure for consistent styling:
195
+ Each individual demo component must begin with a `.featherk-demo` wrapper. This ensures consistent styling and utility support. DemoSettings, DemoDebug, and DemoNotes are most often used at this level.
186
196
 
187
197
  ```html
188
- <div class="demo-app">
189
- <div class="featherk-demo">
190
- <form class="demo-form">
191
- <div class="fk-field-block">
192
- <!-- Field content here -->
193
- </div>
194
- <div class="demo-actions">
195
- <!-- Action buttons here -->
196
- </div>
197
- </form>
198
- <div class="demo-notes">
199
- <!-- Notes content here -->
200
- </div>
198
+ <!-- BasicGrid.vue, RowNavGrid.vue, etc. -->
199
+ <div class="featherk-demo">
200
+ <h1>Demo Title</h1>
201
+ <div class="demo-form">
202
+ <!-- Demo form content, grid, etc. -->
201
203
  </div>
204
+ <DemoNotes>
205
+ <!-- Notes specific to this demo -->
206
+ </DemoNotes>
207
+ <DemoSettings>
208
+ <!-- Optional: settings panel for this demo -->
209
+ </DemoSettings>
210
+ <DemoDebug>
211
+ <!-- Optional: debug panel for this demo -->
212
+ </DemoDebug>
202
213
  </div>
203
214
  ```
204
215
 
216
+ **Where the layout begins and ends:**
217
+ - `.featherk-demo` starts at the top of each demo component and wraps all demo-specific content, including forms, notes, settings, and debug panels.
218
+
219
+ **Component Placement Guidelines:**
220
+ - `DemoStats`: Typically rendered at the App.vue (`.demo-app`) level, after the main demo content.
221
+ - `DemoNotes`: Can be used at both the App.vue and demo component level for contextual notes.
222
+ - `DemoSettings` and `DemoDebug`: Most often used inside each demo component, after the main demo content.
223
+
205
224
  **Always use these class names and hierarchy in your demo components.**
206
- This ensures demo-utils styles and features work as intended.
225
+ This ensures demo-utils styles and features work as intended and matches the feather-k-grid project structure.
226
+
227
+
228
+ # Multi-Demo Navigation with DemoSelection
229
+
230
+ For projects with multiple demos, use the `DemoSelection` component from `feather-k-demo-utils` to provide a consistent, accessible demo picker and slot-based rendering for your demo components.
231
+
232
+ **Important:** Always import `DemoSelection` from `feather-k-demo-utils`. Do not use a local `DemoSelection.vue` file. The package provides the official, up-to-date version.
233
+
234
+ ## DemoSelection Component
235
+
236
+ `DemoSelection` encapsulates a Kendo UI for Vue DropDownList and exposes the selected value to its slot, allowing you to conditionally render demo components in a clean, reusable way.
237
+
238
+ ### Props
239
+ - `options: Array<{ text: string; value: string }>` — List of demo options to display in the DropDownList.
240
+ - `modelValue: string` — The currently selected demo value (for v-model binding).
241
+
242
+ ### Emits
243
+ - `update:modelValue` — Emitted when the user selects a new demo.
244
+
245
+ ### Slot
246
+ - Default slot receives an object with `{ selected }`, where `selected` is the currently selected demo value.
247
+ - If no slot content is provided, nothing is rendered.
248
+
249
+ ### Example Usage
250
+
251
+
252
+ ```vue
253
+ <script setup lang="ts">
254
+ import { ref } from "vue";
255
+ import { DemoSelection } from "feather-k-demo-utils";
256
+ import BasicGrid from "./basic/BasicGrid.vue";
257
+ import DetailsGrid from "./details/DetailsGrid.vue";
258
+ // ...other imports
259
+
260
+ const demoOptions = [
261
+ { text: "✔️ Basic", value: "Basic" },
262
+ { text: "✔️ Details", value: "Details" },
263
+ // ...other options
264
+ ];
265
+ const selectedDemo = ref("Basic");
266
+ </script>
267
+
268
+ <template>
269
+ <DemoSelection :options="demoOptions" v-model="selectedDemo">
270
+ <template #default="{ selected }">
271
+ <BasicGrid v-if="selected === 'Basic'" />
272
+ <DetailsGrid v-if="selected === 'Details'" />
273
+ <!-- ...other demo components... -->
274
+ </template>
275
+ </DemoSelection>
276
+ </template>
277
+ ```
278
+
279
+ ### Behavior
280
+ - The DropDownList is only rendered if slot content is provided.
281
+ - The selected value is always kept in sync with the parent via v-model.
282
+ - The slot prop `selected` is the current value, so you can use it for conditional rendering.
283
+
284
+ ### Benefits
285
+ - Consistent demo navigation UI across projects.
286
+ - Keeps demo selection logic and rendering decoupled and reusable.
287
+ - No need to maintain a local DemoSelection.vue; always use the package version for updates and bugfixes.
207
288
 
208
289
  # Multi-Demo Navigation with DropDownList
209
290
 
package/README.md CHANGED
@@ -1,88 +1,126 @@
1
- # feather-k-demo-utils
2
-
3
- Shared demo utilities for Feather K Vue component demo repositories.
4
-
5
- ## Purpose
6
-
7
-
8
- `feather-k-demo-utils` centralizes common demo functionality used across feather-k-<control> demo projects, including:
9
-
10
- - Shared demo styles
11
- - Shared demo UI components (such as `DemoStats`, `DemoDebug`, and `DemoSettings`)
12
- - Shared utility helpers (for example, CDN/version helpers)
13
-
14
- This package is intended for internal/demo scenarios and consistency across Feather K demos, not as a general-purpose application UI library.
15
-
16
-
17
- ## What's Included
18
-
19
- - `feather-k-demo-utils` (root exports)
20
- - Demo components and top-level exports
21
- - `feather-k-demo-utils/components`
22
- - Component-focused exports:
23
- - `DemoStats`: Demo stats footer
24
- - `DemoDebug`: Collapsible debug panel (slot-based)
25
- - `DemoSettings`: Collapsible settings panel (slot-based)
26
- - `feather-k-demo-utils/utils`
27
- - Utility helpers used by demo apps
28
- - `feather-k-demo-utils/styles/demo.css`
29
- - Demo-only stylesheet for shared demo layout and component styling
30
-
31
- ## Quick Usage
32
-
33
- Install:
34
-
35
- ```bash
36
- npm install feather-k-demo-utils
37
- ```
38
-
39
- Import demo styles once in your app entry:
40
-
41
- ```ts
42
- import "feather-k-demo-utils/styles/demo.css";
43
- ```
44
-
45
-
46
- Import what you need:
47
-
48
- ```ts
49
- import { DemoStats, DemoDebug, DemoSettings } from "feather-k-demo-utils";
50
- import { getFeatherkStylesVersionFromUrl } from "feather-k-demo-utils/utils";
51
- ```
52
-
53
- ### DemoDebug
54
-
55
- Collapsible debug panel. Slot content is only shown if provided.
56
-
57
- ```vue
58
- <DemoDebug>
59
- <pre>{{ debugInfo }}</pre>
60
- </DemoDebug>
61
- ```
62
-
63
- ### DemoSettings
64
-
65
- Collapsible settings panel. Slot content is only shown if provided.
66
-
67
- ```vue
68
- <DemoSettings>
69
- <div>Settings content here</div>
70
- </DemoSettings>
71
- ```
72
-
73
-
74
- For full integration steps (Vite env setup, stylesheet injection, and component usage), see [DEMO-UTILS.md](https://github.com/NantHealth/feather-k-demo-utils/blob/integration/DEMO-UTILS.md).
75
-
76
- ## Publishing
77
-
78
- Package publishing is handled via npm.
79
-
80
- ```bash
81
- npm login
82
- npm run build
83
- npm publish
84
- ```
85
-
86
- ## Build-Time Publish Date
87
-
1
+ # feather-k-demo-utils
2
+
3
+ Shared demo utilities for Feather K Vue component demo repositories.
4
+
5
+ ## Purpose
6
+
7
+
8
+ `feather-k-demo-utils` centralizes common demo functionality used across feather-k-<control> demo projects, including:
9
+
10
+ - Shared demo styles
11
+ - Shared demo UI components (such as `DemoStats`, `DemoDebug`, and `DemoSettings`)
12
+ - Shared utility helpers (for example, CDN/version helpers)
13
+
14
+ This package is intended for internal/demo scenarios and consistency across Feather K demos, not as a general-purpose application UI library.
15
+
16
+
17
+
18
+ ## What's Included
19
+
20
+ - `feather-k-demo-utils` (root exports)
21
+ - Demo components and top-level exports
22
+ - `feather-k-demo-utils/components`
23
+ - Component-focused exports:
24
+ - `DemoStats`: Demo stats footer
25
+ - `DemoDebug`: Collapsible debug panel (slot-based)
26
+ - `DemoSettings`: Collapsible settings panel (slot-based)
27
+ - `DemoNotes`: Notes/info panel (slot-based)
28
+ - `DemoSelection`: Demo selector dropdown (slot-based, enables switching between demos)
29
+ - `feather-k-demo-utils/utils`
30
+ - Utility helpers used by demo apps
31
+ - `feather-k-demo-utils/styles/demo.css`
32
+ - Demo-only stylesheet for shared demo layout and component styling
33
+
34
+ ## Quick Usage
35
+
36
+ Install:
37
+
38
+ ```bash
39
+ npm install feather-k-demo-utils
40
+ ```
41
+
42
+ Import demo styles once in your app entry:
43
+
44
+ ```ts
45
+ import "feather-k-demo-utils/styles/demo.css";
46
+ ```
47
+
48
+
49
+
50
+ Import what you need:
51
+
52
+ ```ts
53
+ import { DemoStats, DemoDebug, DemoSettings, DemoNotes, DemoSelection } from "feather-k-demo-utils";
54
+ import { getFeatherkStylesVersionFromUrl } from "feather-k-demo-utils/utils";
55
+ ```
56
+
57
+
58
+ ### DemoSelection
59
+
60
+ Dropdown selector for switching between multiple demos. Uses a slot to render the selected demo. Example:
61
+
62
+ ```vue
63
+ <DemoSelection :options="demoOptions" v-model="selectedDemo">
64
+ <template #default="{ selected }">
65
+ <Demo1 v-if="selected === 'demo1'" />
66
+ <Demo2 v-else-if="selected === 'demo2'" />
67
+ </template>
68
+ </DemoSelection>
69
+ ```
70
+
71
+ Where `demoOptions` is an array like:
72
+
73
+ ```js
74
+ const demoOptions = [
75
+ { text: "Demo 1", value: "demo1" },
76
+ { text: "Demo 2", value: "demo2" },
77
+ ];
78
+ ```
79
+
80
+ ### DemoDebug
81
+
82
+ Collapsible debug panel. Slot content is only shown if provided.
83
+
84
+ ```vue
85
+ <DemoDebug>
86
+ <pre>{{ debugInfo }}</pre>
87
+ </DemoDebug>
88
+ ```
89
+
90
+ ### DemoSettings
91
+
92
+ Collapsible settings panel. Slot content is only shown if provided.
93
+
94
+ ```vue
95
+ <DemoSettings>
96
+ <div>Settings content here</div>
97
+ </DemoSettings>
98
+ ```
99
+
100
+ ### DemoNotes
101
+
102
+ Panel for displaying notes or additional information. Slot content is only shown if provided.
103
+
104
+ ```vue
105
+ <DemoNotes>
106
+ <h3>Notes</h3>
107
+ <p>Some information about this demo.</p>
108
+ </DemoNotes>
109
+ ```
110
+
111
+
112
+ For full integration steps (Vite env setup, stylesheet injection, and component usage), see [DEMO-UTILS.md](https://github.com/NantHealth/feather-k-demo-utils/blob/integration/DEMO-UTILS.md).
113
+
114
+ ## Publishing
115
+
116
+ Package publishing is handled via npm.
117
+
118
+ ```bash
119
+ npm login
120
+ npm run build
121
+ npm publish
122
+ ```
123
+
124
+ ## Build-Time Publish Date
125
+
88
126
  This package does not export an in-package `PUBLISH_DATE`. If a consuming demo needs publish date display, inject it at build time (for example via Vite `define`) in the consuming app.