@rio-m3e/vue 0.8.0 → 0.8.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.
@@ -1,28 +1,38 @@
1
+ import { ModelModifiers, SelectionChange } from "../model/model.js";
1
2
  import { ButtonGroupProps, ButtonGroupSelected } from "@rio-m3e/core";
2
3
  import "@rio-m3e/styles/button-group.css";
3
- interface Props extends Omit<ButtonGroupProps, 'selected'> {
4
+ export interface Props<T extends ButtonGroupSelected, R extends boolean> extends Omit<ButtonGroupProps, 'selected' | 'required'> {
4
5
  /** The selected value (`single`) or values (`multiple`), with `v-model`. */
5
- modelValue?: ButtonGroupSelected;
6
- }
7
- type __VLS_Slots = {
6
+ modelValue?: T;
8
7
  /**
9
- * `RioButton`s and `RioIconButton`s. They take the group's size and shape unless they set their
10
- * own. With `overflow`, the ones that don't fit go into the menu, last first.
8
+ * With a selection, keeps at least one button selected: the last one can't be turned off, so a
9
+ * single selection never reports `undefined`.
11
10
  */
12
- default?: () => unknown;
13
- /** The "More options" button's icon, in place of the one the app registered (`more`) */
14
- 'more-icon'?: () => unknown;
15
- };
16
- declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
- "update:modelValue": (selected: ButtonGroupSelected) => any;
18
- }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
19
- "onUpdate:modelValue"?: ((selected: ButtonGroupSelected) => any) | undefined;
20
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
22
- declare const _default: typeof __VLS_export;
23
- type __VLS_WithSlots<T, S> = T & {
24
- new (): {
25
- $slots: S;
11
+ required?: R & boolean;
12
+ /** The modifiers given to `v-model`, as `.trim` */
13
+ modelModifiers?: ModelModifiers;
14
+ }
15
+ declare const __VLS_export: <T extends ButtonGroupSelected, R extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
16
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<Props<T, R> & {
17
+ "onUpdate:modelValue"?: ((selected: SelectionChange<T, R>) => any) | undefined;
18
+ }> & (typeof globalThis extends {
19
+ __VLS_PROPS_FALLBACK: infer P;
20
+ } ? P : {});
21
+ expose: (exposed: {}) => void;
22
+ attrs: any;
23
+ slots: {
24
+ /**
25
+ * `RioButton`s and `RioIconButton`s. They take the group's size and shape unless they set their
26
+ * own. With `overflow`, the ones that don't fit go into the menu, last first.
27
+ */
28
+ default?: () => unknown;
29
+ /** The "More options" button's icon, in place of the one the app registered (`more`) */
30
+ 'more-icon'?: () => unknown;
26
31
  };
32
+ emit: (evt: "update:modelValue", selected: SelectionChange<T, R>) => void;
33
+ }>) => import("vue").VNode & {
34
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
27
35
  };
36
+ declare const _default: typeof __VLS_export;
37
+ type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
28
38
  export { _default as default };
@@ -9,12 +9,13 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
9
9
  __name: "ButtonGroup",
10
10
  props: {
11
11
  modelValue: {},
12
+ required: { type: Boolean },
13
+ modelModifiers: {},
12
14
  variant: {},
13
15
  size: {},
14
16
  shape: {},
15
17
  color: {},
16
18
  selection: {},
17
- required: { type: Boolean },
18
19
  disabled: { type: Boolean },
19
20
  overflow: { type: Boolean },
20
21
  maxItems: {}
@@ -1,25 +1,35 @@
1
+ import { ModelModifiers, SelectionChange } from "../model/model.js";
1
2
  import { ChipSetProps, ChipSetSelected } from "@rio-m3e/core";
2
3
  import "@rio-m3e/styles/base/accent.css";
3
4
  import "@rio-m3e/styles/base/density.css";
4
5
  import "@rio-m3e/styles/chip.css";
5
- interface Props extends Omit<ChipSetProps, 'selected'> {
6
+ export interface Props<T extends ChipSetSelected, R extends boolean> extends Omit<ChipSetProps, 'selected' | 'required'> {
6
7
  /** The selected value (`single`) or values (`multiple`), with `v-model`. */
7
- modelValue?: ChipSetSelected;
8
+ modelValue?: T;
9
+ /**
10
+ * With a selection, keeps at least one chip selected: the last one can't be turned off, so a
11
+ * single selection never reports `undefined`.
12
+ */
13
+ required?: R & boolean;
14
+ /** The modifiers given to `v-model`, as `.trim` */
15
+ modelModifiers?: ModelModifiers;
8
16
  }
9
- type __VLS_Slots = {
10
- /** The chips. Filter chips with a `value` take their selection from the set, with `selection`. */
11
- default?: () => unknown;
12
- };
13
- declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
- "update:modelValue": (selected: ChipSetSelected) => any;
15
- }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
16
- "onUpdate:modelValue"?: ((selected: ChipSetSelected) => any) | undefined;
17
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
19
- declare const _default: typeof __VLS_export;
20
- type __VLS_WithSlots<T, S> = T & {
21
- new (): {
22
- $slots: S;
17
+ declare const __VLS_export: <T extends ChipSetSelected, R extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
18
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<Props<T, R> & {
19
+ "onUpdate:modelValue"?: ((selected: SelectionChange<T, R>) => any) | undefined;
20
+ }> & (typeof globalThis extends {
21
+ __VLS_PROPS_FALLBACK: infer P;
22
+ } ? P : {});
23
+ expose: (exposed: {}) => void;
24
+ attrs: any;
25
+ slots: {
26
+ /** The chips. Filter chips with a `value` take their selection from the set, with `selection`. */
27
+ default?: () => unknown;
23
28
  };
29
+ emit: (evt: "update:modelValue", selected: SelectionChange<T, R>) => void;
30
+ }>) => import("vue").VNode & {
31
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
24
32
  };
33
+ declare const _default: typeof __VLS_export;
34
+ type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
25
35
  export { _default as default };
@@ -9,8 +9,9 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
9
9
  __name: "ChipSet",
10
10
  props: {
11
11
  modelValue: {},
12
- selection: {},
13
12
  required: { type: Boolean },
13
+ modelModifiers: {},
14
+ selection: {},
14
15
  scroll: { type: Boolean },
15
16
  color: {},
16
17
  density: {}
@@ -97,6 +97,15 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
97
97
  });
98
98
  watch(open, (next) => handle?.sync(next), { flush: "post" });
99
99
  onBeforeUnmount(() => handle?.detach());
100
+ /**
101
+ * What the field's input takes besides the text field's props: no autofill, and the picker's commit
102
+ * and keys, after the app's own listeners
103
+ */
104
+ const fieldInput = {
105
+ autocomplete: "off",
106
+ onChange: picker.commitText,
107
+ onKeydown: picker.handleFieldKeydown
108
+ };
100
109
  return (_ctx, _cache) => {
101
110
  return openBlock(), createElementBlock("div", mergeProps({
102
111
  ref_key: "root",
@@ -105,21 +114,17 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
105
114
  class: _ctx.$attrs.class,
106
115
  style: _ctx.$attrs.style
107
116
  }), [
108
- createElementVNode("div", mergeProps(unref(picker).parts.field(), { onClick: _cache[1] || (_cache[1] = (...args) => unref(picker).handleFieldClick && unref(picker).handleFieldClick(...args)) }), [createVNode(_sfc_main$3, mergeProps({
117
+ createElementVNode("div", mergeProps(unref(picker).parts.field(), { onClick: _cache[1] || (_cache[1] = (...args) => unref(picker).handleFieldClick && unref(picker).handleFieldClick(...args)) }), [createVNode(_sfc_main$3, mergeProps(mergeProps({
109
118
  ..._ctx.$attrs,
110
119
  class: void 0,
111
- style: void 0,
112
- ...unref(picker).field()
113
- }, {
120
+ style: void 0
121
+ }, { ...unref(picker).field() }, fieldInput), {
114
122
  "model-value": state.text,
115
123
  variant: __props.fieldVariant ?? "outlined",
116
124
  label: __props.label,
117
125
  required: __props.required,
118
126
  disabled: __props.disabled,
119
- autocomplete: "off",
120
- "onUpdate:modelValue": _cache[0] || (_cache[0] = (text) => unref(picker).textInput(String(text))),
121
- onChange: unref(picker).commitText,
122
- onKeydown: unref(picker).handleFieldKeydown
127
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = (text) => unref(picker).textInput(String(text)))
123
128
  }), {
124
129
  "trailing-icon": withCtx(() => [createVNode(_sfc_main$2, mergeProps(unref(picker).parts.calendarButton(), {
125
130
  variant: "standard",
@@ -140,9 +145,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
140
145
  "variant",
141
146
  "label",
142
147
  "required",
143
- "disabled",
144
- "onChange",
145
- "onKeydown"
148
+ "disabled"
146
149
  ])], 16),
147
150
  unref(picker).submits() ? (openBlock(), createElementBlock("input", normalizeProps(mergeProps({ key: 0 }, unref(picker).parts.formValue())), null, 16)) : createCommentVNode("v-if", true),
148
151
  unref(picker).docked() ? (openBlock(), createElementBlock("div", mergeProps({
@@ -99,6 +99,13 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
99
99
  });
100
100
  onUpdated(() => handle?.update());
101
101
  onBeforeUnmount(() => handle?.detach());
102
+ /**
103
+ * What the field's input takes besides the text field's props: no autofill, and the dialog's keys
104
+ */
105
+ const fieldInput = {
106
+ autocomplete: "off",
107
+ onKeydown: dialog.handleFieldKeydown
108
+ };
102
109
  return (_ctx, _cache) => {
103
110
  return openBlock(), createElementBlock("dialog", mergeProps({
104
111
  ref_key: "root",
@@ -193,18 +200,15 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
193
200
  "messages",
194
201
  "onSelect"
195
202
  ])) : createCommentVNode("v-if", true),
196
- unref(dialog).inputMode() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 3 }, unref(dialog).parts.input())), [createVNode(_sfc_main$3, mergeProps(unref(dialog).field(), {
203
+ unref(dialog).inputMode() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 3 }, unref(dialog).parts.input())), [createVNode(_sfc_main$3, mergeProps({
204
+ ...unref(dialog).field(),
205
+ ...fieldInput
206
+ }, {
197
207
  "model-value": state.text,
198
208
  variant: "outlined",
199
209
  label: unref(messages).fieldLabel,
200
- autocomplete: "off",
201
- "onUpdate:modelValue": _cache[6] || (_cache[6] = (text) => unref(dialog).textInput(String(text))),
202
- onKeydown: unref(dialog).handleFieldKeydown
203
- }), null, 16, [
204
- "model-value",
205
- "label",
206
- "onKeydown"
207
- ])], 16)) : createCommentVNode("v-if", true),
210
+ "onUpdate:modelValue": _cache[6] || (_cache[6] = (text) => unref(dialog).textInput(String(text)))
211
+ }), null, 16, ["model-value", "label"])], 16)) : createCommentVNode("v-if", true),
208
212
  createElementVNode("div", normalizeProps(guardReactiveProps(unref(dialog).parts.actions())), [
209
213
  unref(dialog).showsClear() ? (openBlock(), createBlock(_sfc_main$1, {
210
214
  key: 0,
@@ -107,6 +107,14 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
107
107
  watch(open, (next) => handle?.sync(next), { flush: "post" });
108
108
  onUpdated(() => handle?.update());
109
109
  onBeforeUnmount(() => handle?.detach());
110
+ /**
111
+ * What each field's input takes besides the text field's props: no autofill, and the dialog's
112
+ * keys
113
+ */
114
+ const fieldInput = {
115
+ autocomplete: "off",
116
+ onKeydown: dialog.handleFieldKeydown
117
+ };
110
118
  return (_ctx, _cache) => {
111
119
  return openBlock(), createElementBlock("dialog", mergeProps({
112
120
  ref_key: "root",
@@ -168,29 +176,23 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
168
176
  "is-date-disabled",
169
177
  "onSelect"
170
178
  ])) : createCommentVNode("v-if", true),
171
- unref(dialog).inputMode() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 2 }, unref(dialog).parts.input())), [createVNode(_sfc_main$3, mergeProps(unref(dialog).startField(), {
179
+ unref(dialog).inputMode() ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 2 }, unref(dialog).parts.input())), [createVNode(_sfc_main$3, mergeProps({
180
+ ...unref(dialog).startField(),
181
+ ...fieldInput
182
+ }, {
172
183
  "model-value": state.startText,
173
184
  variant: "outlined",
174
185
  label: unref(messages).startDate,
175
- autocomplete: "off",
176
- "onUpdate:modelValue": _cache[3] || (_cache[3] = (text) => unref(dialog).startInput(String(text))),
177
- onKeydown: unref(dialog).handleFieldKeydown
178
- }), null, 16, [
179
- "model-value",
180
- "label",
181
- "onKeydown"
182
- ]), createVNode(_sfc_main$3, mergeProps(unref(dialog).endField(), {
186
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = (text) => unref(dialog).startInput(String(text)))
187
+ }), null, 16, ["model-value", "label"]), createVNode(_sfc_main$3, mergeProps({
188
+ ...unref(dialog).endField(),
189
+ ...fieldInput
190
+ }, {
183
191
  "model-value": state.endText,
184
192
  variant: "outlined",
185
193
  label: unref(messages).endDate,
186
- autocomplete: "off",
187
- "onUpdate:modelValue": _cache[4] || (_cache[4] = (text) => unref(dialog).endInput(String(text))),
188
- onKeydown: unref(dialog).handleFieldKeydown
189
- }), null, 16, [
190
- "model-value",
191
- "label",
192
- "onKeydown"
193
- ])], 16)) : createCommentVNode("v-if", true),
194
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = (text) => unref(dialog).endInput(String(text)))
195
+ }), null, 16, ["model-value", "label"])], 16)) : createCommentVNode("v-if", true),
194
196
  createElementVNode("div", normalizeProps(guardReactiveProps(unref(dialog).parts.actions())), [
195
197
  unref(dialog).showsClear() ? (openBlock(), createBlock(_sfc_main$1, {
196
198
  key: 0,
@@ -1,24 +1,34 @@
1
+ import { ModelModifiers, SelectionChange } from "../model/model.js";
1
2
  import { ListProps, ListSelected } from "@rio-m3e/core";
2
3
  import "@rio-m3e/styles/base/accent.css";
3
4
  import "@rio-m3e/styles/list.css";
4
- interface Props extends Omit<ListProps, 'selected'> {
5
+ export interface Props<T extends ListSelected, R extends boolean> extends Omit<ListProps, 'selected' | 'required'> {
5
6
  /** The selected value (`single`) or values (`multiple`), with `v-model`. */
6
- modelValue?: ListSelected;
7
+ modelValue?: T;
8
+ /**
9
+ * With a selection, keeps one item selected: the last one can't be turned off, so a single
10
+ * selection never reports `undefined`.
11
+ */
12
+ required?: R & boolean;
13
+ /** The modifiers given to `v-model`, as `.trim` */
14
+ modelModifiers?: ModelModifiers;
7
15
  }
8
- type __VLS_Slots = {
9
- /** The items (`RioListItem`). With `selection`, those with a `value` are chosen. */
10
- default?: () => unknown;
11
- };
12
- declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
- "update:modelValue": (selected: ListSelected) => any;
14
- }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
15
- "onUpdate:modelValue"?: ((selected: ListSelected) => any) | undefined;
16
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
18
- declare const _default: typeof __VLS_export;
19
- type __VLS_WithSlots<T, S> = T & {
20
- new (): {
21
- $slots: S;
16
+ declare const __VLS_export: <T extends ListSelected, R extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
17
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<Props<T, R> & {
18
+ "onUpdate:modelValue"?: ((selected: SelectionChange<T, R>) => any) | undefined;
19
+ }> & (typeof globalThis extends {
20
+ __VLS_PROPS_FALLBACK: infer P;
21
+ } ? P : {});
22
+ expose: (exposed: {}) => void;
23
+ attrs: any;
24
+ slots: {
25
+ /** The items (`RioListItem`). With `selection`, those with a `value` are chosen. */
26
+ default?: () => unknown;
22
27
  };
28
+ emit: (evt: "update:modelValue", selected: SelectionChange<T, R>) => void;
29
+ }>) => import("vue").VNode & {
30
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
23
31
  };
32
+ declare const _default: typeof __VLS_export;
33
+ type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
24
34
  export { _default as default };
@@ -8,9 +8,10 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
8
8
  __name: "List",
9
9
  props: {
10
10
  modelValue: {},
11
+ required: { type: Boolean },
12
+ modelModifiers: {},
11
13
  variant: {},
12
14
  selection: {},
13
- required: { type: Boolean },
14
15
  control: {},
15
16
  controlPosition: {},
16
17
  label: {},
@@ -0,0 +1,8 @@
1
+ import "vue";
2
+ /** The modifiers an app gives `v-model`, as `.trim`, which Vue applies to the value reported */
3
+ export type ModelModifiers = Partial<Record<string, true>>;
4
+ /**
5
+ * What a selection that can be cleared reports: a list as it is; a single value, or `undefined`
6
+ * once its last one is turned off, unless `required` keeps one (`R` true).
7
+ */
8
+ export type SelectionChange<T, R extends boolean> = T extends readonly unknown[] ? T : R extends true ? T : T | undefined;
@@ -0,0 +1,15 @@
1
+ import { useModel } from "vue";
2
+ // src/model/model.ts
3
+ /**
4
+ * `v-model`'s value, as `defineModel` keeps it: the app's while it binds one, and the component's
5
+ * own otherwise. The component declares the `modelValue` prop and its `update:modelValue` event
6
+ * itself, with the value alone as the event's type, so an app's ref of a narrower type binds under
7
+ * `strictTemplates`, where `defineModel`'s event would add `undefined`. Call it in `setup`, with a
8
+ * getter of the destructured prop.
9
+ */
10
+ function useValueModel(value) {
11
+ return useModel({ get modelValue() {
12
+ return value();
13
+ } }, "modelValue");
14
+ }
15
+ export { useValueModel };
@@ -1,31 +1,36 @@
1
+ import { ModelModifiers } from "../model/model.js";
1
2
  import { NavigationBarMessages, NavigationBarProps, NavigationBarValue } from "@rio-m3e/core";
2
3
  import "@rio-m3e/styles/base/accent.css";
3
4
  import "@rio-m3e/styles/base/reduced-motion.css";
4
5
  import "@rio-m3e/styles/navigation-bar.css";
5
- interface Props extends Omit<NavigationBarProps, 'active'> {
6
+ export interface Props<T extends NavigationBarValue> extends Omit<NavigationBarProps, 'active'> {
6
7
  /** The value of the active destination's item, with `v-model`. */
7
- modelValue?: NavigationBarValue;
8
+ modelValue?: T;
8
9
  /** A language tag, for badges' counts. Without it, the one provided, or the page's. */
9
10
  locale?: string;
10
11
  /** Replaces what a small badge says. */
11
12
  messages?: Partial<NavigationBarMessages>;
12
13
  /** The element whose scrolling hides the bar, with `hideOnScroll`. Defaults to the window. */
13
14
  scrollTarget?: HTMLElement | null;
15
+ /** The modifiers given to `v-model`, as `.trim` */
16
+ modelModifiers?: ModelModifiers;
14
17
  }
15
- type __VLS_Slots = {
16
- /** The destinations (`RioNavigationBarItem`) */
17
- default?: () => unknown;
18
- };
19
- declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
- "update:modelValue": (value: NavigationBarValue) => any;
21
- }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
22
- "onUpdate:modelValue"?: ((value: NavigationBarValue) => any) | undefined;
23
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
25
- declare const _default: typeof __VLS_export;
26
- type __VLS_WithSlots<T, S> = T & {
27
- new (): {
28
- $slots: S;
18
+ declare const __VLS_export: <T extends NavigationBarValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
19
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<Props<T> & {
20
+ "onUpdate:modelValue"?: ((value: T) => any) | undefined;
21
+ }> & (typeof globalThis extends {
22
+ __VLS_PROPS_FALLBACK: infer P;
23
+ } ? P : {});
24
+ expose: (exposed: {}) => void;
25
+ attrs: any;
26
+ slots: {
27
+ /** The destinations (`RioNavigationBarItem`) */
28
+ default?: () => unknown;
29
29
  };
30
+ emit: (evt: "update:modelValue", value: T) => void;
31
+ }>) => import("vue").VNode & {
32
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
30
33
  };
34
+ declare const _default: typeof __VLS_export;
35
+ type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
31
36
  export { _default as default };
@@ -13,6 +13,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
13
13
  locale: {},
14
14
  messages: {},
15
15
  scrollTarget: {},
16
+ modelModifiers: {},
16
17
  layout: {},
17
18
  label: {},
18
19
  color: {},
@@ -1,46 +1,47 @@
1
+ import { ModelModifiers } from "../model/model.js";
1
2
  import { NavigationRailMessages, NavigationRailProps, NavigationRailValue } from "@rio-m3e/core";
2
3
  import "@rio-m3e/styles/base/accent.css";
3
4
  import "@rio-m3e/styles/base/reduced-motion.css";
4
5
  import "@rio-m3e/styles/base/direction.css";
5
6
  import "@rio-m3e/styles/navigation-rail.css";
6
- interface Props extends Omit<NavigationRailProps, 'active' | 'expanded'> {
7
+ export interface Props<T extends NavigationRailValue> extends Omit<NavigationRailProps, 'active' | 'expanded'> {
7
8
  /** The value of the active destination's item, with `v-model`. */
8
- modelValue?: NavigationRailValue;
9
+ modelValue?: T;
9
10
  /** A language tag, for the menu button's name and badges' counts. Without it, the one provided, or the page's. */
10
11
  locale?: string;
11
12
  /** Replaces the menu button's name, the modal's, and what a small badge says. */
12
13
  messages?: Partial<NavigationRailMessages>;
14
+ /** The modifiers given to `v-model`, as `.trim` */
15
+ modelModifiers?: ModelModifiers;
13
16
  }
14
- type __VLS_Props = Props;
15
- type __VLS_Slots = {
16
- /** The destinations (`RioNavigationRailItem`) and sections (`RioNavigationRailSection`) */
17
- default?: () => unknown;
18
- /** A FAB above the destinations: bind `expanded` to its `extended`, so it extends with the rail. */
19
- fab?: (props: {
20
- expanded: boolean;
21
- }) => unknown;
22
- /** The menu button's icon while the rail is collapsed, in place of the one the app registered (`expand-rail`) */
23
- 'expand-icon'?: () => unknown;
24
- /** The menu button's icon while the rail is expanded, in place of the one the app registered (`collapse-rail`) */
25
- 'collapse-icon'?: () => unknown;
26
- };
27
- type __VLS_ModelProps = {
28
- /** Whether the rail is expanded, with `v-model:expanded`. */
29
- 'expanded'?: boolean;
30
- };
31
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
32
- declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
33
- "update:modelValue": (value: NavigationRailValue) => any;
34
- "update:expanded": (value: boolean) => any;
35
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
36
- "onUpdate:modelValue"?: ((value: NavigationRailValue) => any) | undefined;
37
- "onUpdate:expanded"?: ((value: boolean) => any) | undefined;
38
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
39
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
40
- declare const _default: typeof __VLS_export;
41
- type __VLS_WithSlots<T, S> = T & {
42
- new (): {
43
- $slots: S;
17
+ declare const __VLS_export: <T extends NavigationRailValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
18
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(Props<T> & {
19
+ /** Whether the rail is expanded, with `v-model:expanded`. */
20
+ expanded?: boolean;
21
+ }) & {
22
+ "onUpdate:modelValue"?: ((value: T) => any) | undefined;
23
+ "onUpdate:expanded"?: ((value: boolean) => any) | undefined;
24
+ }> & (typeof globalThis extends {
25
+ __VLS_PROPS_FALLBACK: infer P;
26
+ } ? P : {});
27
+ expose: (exposed: {}) => void;
28
+ attrs: any;
29
+ slots: {
30
+ /** The destinations (`RioNavigationRailItem`) and sections (`RioNavigationRailSection`) */
31
+ default?: () => unknown;
32
+ /** A FAB above the destinations: bind `expanded` to its `extended`, so it extends with the rail. */
33
+ fab?: (props: {
34
+ expanded: boolean;
35
+ }) => unknown;
36
+ /** The menu button's icon while the rail is collapsed, in place of the one the app registered (`expand-rail`) */
37
+ 'expand-icon'?: () => unknown;
38
+ /** The menu button's icon while the rail is expanded, in place of the one the app registered (`collapse-rail`) */
39
+ 'collapse-icon'?: () => unknown;
44
40
  };
41
+ emit: ((evt: "update:modelValue", value: T) => void) & ((event: "update:expanded", value: boolean) => void);
42
+ }>) => import("vue").VNode & {
43
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
45
44
  };
45
+ declare const _default: typeof __VLS_export;
46
+ type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
46
47
  export { _default as default };
@@ -16,6 +16,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
16
16
  modelValue: {},
17
17
  locale: {},
18
18
  messages: {},
19
+ modelModifiers: {},
19
20
  modal: { type: Boolean },
20
21
  hideWhenCollapsed: { type: Boolean },
21
22
  align: {},
@@ -5,7 +5,7 @@ import _sfc_main$3 from "../menu/Menu.vue.js";
5
5
  import _sfc_main$4 from "../menu/MenuItem.vue.js";
6
6
  import _sfc_main$5 from "../tooltip/Tooltip.vue.js";
7
7
  import { overflowKey } from "./overflow.js";
8
- import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createSlots, createVNode, defineComponent, openBlock, provide, ref, renderList, renderSlot, unref, useTemplateRef, watchEffect, withCtx } from "vue";
8
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createSlots, createVNode, defineComponent, mergeProps, openBlock, provide, ref, renderList, renderSlot, unref, useTemplateRef, watchEffect, withCtx } from "vue";
9
9
  import "@rio-m3e/styles/base/overflow.css";
10
10
  // src/overflow/OverflowMenu.vue
11
11
  const _hoisted_1 = { class: "rio-overflow" };
@@ -16,6 +16,11 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
16
16
  provide(overflowKey, null);
17
17
  const text = useMessages("overflow", useLocale(() => void 0), () => void 0);
18
18
  const open = ref(false);
19
+ /** What the button says of the menu it opens, which the icon button passes on to its element */
20
+ const opensMenu = computed(() => ({
21
+ "aria-haspopup": "menu",
22
+ "aria-expanded": open.value
23
+ }));
19
24
  const indicator = useTemplateRef("indicator");
20
25
  watchEffect(() => __props.host.indicator.value = indicator.value?.$el ?? null);
21
26
  /** Renders what an entry gives: text, or a slot of the button it stands for */
@@ -30,22 +35,15 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
30
35
  };
31
36
  return (_ctx, _cache) => {
32
37
  return openBlock(), createElementBlock("span", _hoisted_1, [createVNode(_sfc_main$5, { text: unref(text).more }, {
33
- default: withCtx(() => [createVNode(_sfc_main$1, {
38
+ default: withCtx(() => [createVNode(_sfc_main$1, mergeProps({
34
39
  ref_key: "indicator",
35
40
  ref: indicator,
36
41
  label: unref(text).more,
37
- variant: __props.host.indicatorVariant(),
38
- "aria-haspopup": "menu",
39
- "aria-expanded": open.value,
40
- onClick: _cache[0] || (_cache[0] = ($event) => open.value = !open.value)
41
- }, {
42
+ variant: __props.host.indicatorVariant()
43
+ }, opensMenu.value, { onClick: _cache[0] || (_cache[0] = ($event) => open.value = !open.value) }), {
42
44
  default: withCtx(() => [renderSlot(_ctx.$slots, "icon", {}, () => [createVNode(_sfc_main$2, { alias: "more" })])]),
43
45
  _: 3
44
- }, 8, [
45
- "label",
46
- "variant",
47
- "aria-expanded"
48
- ])]),
46
+ }, 16, ["label", "variant"])]),
49
47
  _: 3
50
48
  }, 8, ["text"]), createVNode(_sfc_main$3, {
51
49
  open: open.value,