feather-k-demo-utils 0.1.1 → 0.1.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/DEMO-UTILS.md +5 -0
- package/README.md +7 -0
- package/lib/{DemoSelection.vue_vue_type_script_setup_true_lang-DaLhEeza.js → DemoSelection.vue_vue_type_script_setup_true_lang-DIdktGNu.js} +558 -494
- package/lib/components/DemoSelection.vue.d.ts +7 -5
- package/lib/components/demoSelectionQueryParam.d.ts +6 -0
- package/lib/components/index.es.js +1 -1
- package/lib/index.es.js +1 -1
- package/lib/utils/index.es.js +1 -1
- package/package.json +1 -1
package/DEMO-UTILS.md
CHANGED
|
@@ -238,6 +238,8 @@ For projects with multiple demos, use the `DemoSelection` component from `feathe
|
|
|
238
238
|
### Props
|
|
239
239
|
- `options: Array<{ text: string; value: string }>` — List of demo options to display in the DropDownList.
|
|
240
240
|
- `modelValue: string` — The currently selected demo value (for v-model binding).
|
|
241
|
+
- `syncQueryParam?: boolean` — Optional. Defaults to `true`. Syncs the selected demo to a query parameter and initializes from it.
|
|
242
|
+
- `queryParamName?: string` — Optional. Defaults to `"demo"`. Query parameter key used when `syncQueryParam` is enabled.
|
|
241
243
|
|
|
242
244
|
### Emits
|
|
243
245
|
- `update:modelValue` — Emitted when the user selects a new demo.
|
|
@@ -280,6 +282,9 @@ const selectedDemo = ref("Basic");
|
|
|
280
282
|
- The DropDownList is only rendered if slot content is provided.
|
|
281
283
|
- The selected value is always kept in sync with the parent via v-model.
|
|
282
284
|
- The slot prop `selected` is the current value, so you can use it for conditional rendering.
|
|
285
|
+
- By default, the component reads `?demo=<value>` on load and uses it when the value exists in `options`.
|
|
286
|
+
- Query matching is case-insensitive, so values like `?demo=basic`, `?demo=Basic`, and `?demo=BASIC` resolve to the same option.
|
|
287
|
+
- When the selection changes, the component updates the query parameter with `history.replaceState` (no page reload).
|
|
283
288
|
|
|
284
289
|
### Benefits
|
|
285
290
|
- Consistent demo navigation UI across projects.
|
package/README.md
CHANGED
|
@@ -77,6 +77,13 @@ const demoOptions = [
|
|
|
77
77
|
];
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
+
By default, `DemoSelection` also keeps the selected demo in the URL query string using `demo` (for example, `?demo=demo2`), and initializes selection from that query value when valid. Query matching is case-insensitive, so `?demo=DEMO2` and `?demo=demo2` both resolve.
|
|
81
|
+
|
|
82
|
+
Optional props:
|
|
83
|
+
|
|
84
|
+
- `syncQueryParam?: boolean` (default `true`) - Enable/disable URL query synchronization.
|
|
85
|
+
- `queryParamName?: string` (default `"demo"`) - Change the query key used for sync.
|
|
86
|
+
|
|
80
87
|
### DemoDebug
|
|
81
88
|
|
|
82
89
|
Collapsible debug panel. Slot content is only shown if provided.
|