@mintplayer/vue-bootstrap 3.25.0 → 3.26.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/chunks/useMachine-DLZ7g_H3.mjs +14 -0
- package/dropdown-menu/index.mjs +3 -9
- package/dropdown-menu/src/BsDropdownItem.vue.d.ts +1 -1
- package/dropdown-menu/src/BsDropdownMenu.vue.d.ts +2 -6
- package/dropdown-menu/src/index.d.ts +1 -1
- package/machine/index.mjs +1 -0
- package/machine/src/index.d.ts +1 -0
- package/machine/src/useMachine.d.ts +13 -0
- package/machine/src/useMachine.spec.d.ts +1 -0
- package/package.json +11 -2
- package/typeahead/index.mjs +119 -0
- package/typeahead/src/BsTypeahead.vue.d.ts +46 -0
- package/typeahead/src/index.d.ts +3 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { onScopeDispose as e, shallowRef as t } from "vue";
|
|
2
|
+
//#region libs/mintplayer-vue-bootstrap/machine/src/useMachine.ts
|
|
3
|
+
function n(n) {
|
|
4
|
+
let r = t(n.snapshot), i = n.subscribe((e) => {
|
|
5
|
+
r.value = e;
|
|
6
|
+
});
|
|
7
|
+
return e(i), r;
|
|
8
|
+
}
|
|
9
|
+
function r(t) {
|
|
10
|
+
let r = t();
|
|
11
|
+
return e(() => r.destroy()), [r, n(r)];
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { n, r as t };
|
package/dropdown-menu/index.mjs
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { createElementBlock as e, defineComponent as t, mergeProps as n, onBeforeUnmount as r, onMounted as i, openBlock as a, ref as o, renderSlot as s, watch as c } from "vue";
|
|
2
2
|
import "@mintplayer/web-components/dropdown-menu";
|
|
3
3
|
//#region libs/mintplayer-vue-bootstrap/dropdown-menu/src/BsDropdownMenu.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
-
var l = ["
|
|
4
|
+
var l = ["max-height"], u = /* @__PURE__ */ t({
|
|
5
5
|
inheritAttrs: !1,
|
|
6
6
|
__name: "BsDropdownMenu",
|
|
7
|
-
props: {
|
|
8
|
-
mode: { default: "menu" },
|
|
9
|
-
maxHeight: {}
|
|
10
|
-
},
|
|
7
|
+
props: { maxHeight: {} },
|
|
11
8
|
emits: ["select"],
|
|
12
9
|
setup(t, { emit: c }) {
|
|
13
10
|
let u = c, d = o(null);
|
|
@@ -17,10 +14,7 @@ var l = ["mode", "max-height"], u = /* @__PURE__ */ t({
|
|
|
17
14
|
return i(() => d.value?.addEventListener("select", f)), r(() => d.value?.removeEventListener("select", f)), (r, i) => (a(), e("mp-dropdown-menu", n({
|
|
18
15
|
ref_key: "el",
|
|
19
16
|
ref: d
|
|
20
|
-
}, r.$attrs, {
|
|
21
|
-
mode: t.mode,
|
|
22
|
-
"max-height": t.maxHeight
|
|
23
|
-
}), [s(r.$slots, "default")], 16, l));
|
|
17
|
+
}, r.$attrs, { "max-height": t.maxHeight }), [s(r.$slots, "default")], 16, l));
|
|
24
18
|
}
|
|
25
19
|
}), d = ["aria-disabled"], f = /* @__PURE__ */ t({
|
|
26
20
|
inheritAttrs: !1,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DropdownSelectEventDetail } from '@mintplayer/web-components/dropdown-menu';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
/** `menu` (default) exposes roving-tabindex menu semantics | `listbox`. */
|
|
4
|
-
mode?: DropdownMode;
|
|
5
3
|
/** Max panel height in px before the item list scrolls. */
|
|
6
4
|
maxHeight?: number;
|
|
7
5
|
};
|
|
@@ -20,9 +18,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
|
|
|
20
18
|
select: (detail: DropdownSelectEventDetail) => any;
|
|
21
19
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
22
20
|
onSelect?: ((detail: DropdownSelectEventDetail) => any) | undefined;
|
|
23
|
-
}>, {
|
|
24
|
-
mode: DropdownMode;
|
|
25
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
21
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
26
22
|
el: unknown;
|
|
27
23
|
}, any>;
|
|
28
24
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
@@ -2,4 +2,4 @@ export { default as BsDropdownMenu } from './BsDropdownMenu.vue';
|
|
|
2
2
|
export { default as BsDropdownItem } from './BsDropdownItem.vue';
|
|
3
3
|
export { default as BsDropdownDivider } from './BsDropdownDivider.vue';
|
|
4
4
|
export { default as BsDropdownHeader } from './BsDropdownHeader.vue';
|
|
5
|
-
export type {
|
|
5
|
+
export type { DropdownSelectEventDetail } from '@mintplayer/web-components/dropdown-menu';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as useMachine, n as useSnapshot } from "../chunks/useMachine-DLZ7g_H3.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useMachine';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ShallowRef } from 'vue';
|
|
2
|
+
import { SnapshotOf, Store } from '@mintplayer/ui-core/store';
|
|
3
|
+
/**
|
|
4
|
+
* Read a `@mintplayer/ui-core` store from a Vue component: a `shallowRef` of
|
|
5
|
+
* the snapshot, set from `subscribe` and released with the effect scope.
|
|
6
|
+
* Shallow on purpose — the snapshot is replaced wholesale and never mutated,
|
|
7
|
+
* so deep reactivity would only cost proxies (spike S1, `useMachine.spec.ts`).
|
|
8
|
+
*/
|
|
9
|
+
export declare function useSnapshot<S extends object>(store: Store<S>): Readonly<ShallowRef<S>>;
|
|
10
|
+
/** Own a machine for the component's lifetime: created in `setup`, destroyed with the scope. */
|
|
11
|
+
export declare function useMachine<M extends Store<object> & {
|
|
12
|
+
destroy(): void;
|
|
13
|
+
}>(create: () => M): [M, Readonly<ShallowRef<SnapshotOf<M>>>];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintplayer/vue-bootstrap",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.26.0",
|
|
4
4
|
"description": "Vue 3.5 SFC adapters around @mintplayer/web-components. Each sub-entry maps one-to-one with a WC sub-entry and exposes typed Vue components with v-model support for input WCs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -90,6 +90,10 @@
|
|
|
90
90
|
"types": "./input-group/src/index.d.ts",
|
|
91
91
|
"import": "./input-group/index.mjs"
|
|
92
92
|
},
|
|
93
|
+
"./machine": {
|
|
94
|
+
"types": "./machine/src/index.d.ts",
|
|
95
|
+
"import": "./machine/index.mjs"
|
|
96
|
+
},
|
|
93
97
|
"./multi-range": {
|
|
94
98
|
"types": "./multi-range/src/index.d.ts",
|
|
95
99
|
"import": "./multi-range/index.mjs"
|
|
@@ -177,11 +181,16 @@
|
|
|
177
181
|
"./treeview": {
|
|
178
182
|
"types": "./treeview/src/index.d.ts",
|
|
179
183
|
"import": "./treeview/index.mjs"
|
|
184
|
+
},
|
|
185
|
+
"./typeahead": {
|
|
186
|
+
"types": "./typeahead/src/index.d.ts",
|
|
187
|
+
"import": "./typeahead/index.mjs"
|
|
180
188
|
}
|
|
181
189
|
},
|
|
182
190
|
"peerDependencies": {
|
|
191
|
+
"@mintplayer/ui-core": "^1.0.0",
|
|
183
192
|
"vue": "^3.5.0",
|
|
184
|
-
"@mintplayer/web-components": "^2.
|
|
193
|
+
"@mintplayer/web-components": "^2.21.0"
|
|
185
194
|
},
|
|
186
195
|
"dependencies": {
|
|
187
196
|
"tslib": "^2.3.0"
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { t as e } from "../chunks/useMachine-DLZ7g_H3.mjs";
|
|
2
|
+
import { Fragment as t, computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, defineComponent as s, getCurrentInstance as c, mergeModels as l, mergeProps as u, openBlock as d, renderList as f, renderSlot as p, toDisplayString as m, unref as h, useAttrs as g, useModel as _, watch as v, withModifiers as y } from "vue";
|
|
3
|
+
import { installLightStyles as b } from "@mintplayer/ui-core/scoped-styles";
|
|
4
|
+
import { TYPEAHEAD_SCOPE as x, TypeaheadMachine as S, connect as C, inMemoryTypeaheadProvider as w, typeaheadScopedStyles as T } from "@mintplayer/ui-core/typeahead";
|
|
5
|
+
//#region libs/mintplayer-vue-bootstrap/typeahead/src/BsTypeahead.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var E = ["value"], D = ["onClick"], O = /* @__PURE__ */ s({
|
|
7
|
+
inheritAttrs: !1,
|
|
8
|
+
__name: "BsTypeahead",
|
|
9
|
+
props: /*@__PURE__*/ l({
|
|
10
|
+
provider: {
|
|
11
|
+
type: [Function, null],
|
|
12
|
+
default: null
|
|
13
|
+
},
|
|
14
|
+
debounceMs: { default: 200 },
|
|
15
|
+
minLength: { default: 1 },
|
|
16
|
+
itemText: {},
|
|
17
|
+
itemKey: {},
|
|
18
|
+
disabled: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: !1
|
|
21
|
+
},
|
|
22
|
+
name: { default: null },
|
|
23
|
+
inputLabel: { default: null },
|
|
24
|
+
loadingLabel: {},
|
|
25
|
+
noResultsLabel: {},
|
|
26
|
+
resultsLabel: {},
|
|
27
|
+
errorText: { default: null }
|
|
28
|
+
}, {
|
|
29
|
+
modelValue: { default: "" },
|
|
30
|
+
modelModifiers: {}
|
|
31
|
+
}),
|
|
32
|
+
emits: /*@__PURE__*/ l([
|
|
33
|
+
"select",
|
|
34
|
+
"submit",
|
|
35
|
+
"open",
|
|
36
|
+
"close",
|
|
37
|
+
"loadError"
|
|
38
|
+
], ["update:modelValue"]),
|
|
39
|
+
setup(s, { emit: l }) {
|
|
40
|
+
let w = s, O = _(s, "modelValue"), k = l, A = `bs-typeahead-${c()?.uid ?? Math.random().toString(36).slice(2)}`, [j, M] = e(() => new S({
|
|
41
|
+
id: A,
|
|
42
|
+
value: O.value,
|
|
43
|
+
onChange: (e) => {
|
|
44
|
+
O.value = e;
|
|
45
|
+
},
|
|
46
|
+
onSelect: (e, t) => k("select", e, t),
|
|
47
|
+
onSubmit: (e) => k("submit", e),
|
|
48
|
+
onOpen: () => k("open"),
|
|
49
|
+
onClose: () => k("close"),
|
|
50
|
+
onError: (e) => k("loadError", e)
|
|
51
|
+
}));
|
|
52
|
+
b(x, T), v(() => w.provider, (e) => j.provider = e, { immediate: !0 }), v(() => w.debounceMs, (e) => j.debounceMs = e, { immediate: !0 }), v(() => w.minLength, (e) => j.minLength = e, { immediate: !0 }), v(() => [w.itemText, w.itemKey], ([e, t]) => {
|
|
53
|
+
j.itemText = e, j.itemKey = t;
|
|
54
|
+
}, { immediate: !0 }), v(() => w.disabled, (e) => j.setDisabled(e), { immediate: !0 }), v(() => w.errorText, (e) => j.setErrorText(e), { immediate: !0 }), v(() => [
|
|
55
|
+
w.inputLabel,
|
|
56
|
+
w.loadingLabel,
|
|
57
|
+
w.noResultsLabel,
|
|
58
|
+
w.resultsLabel
|
|
59
|
+
], ([e, t, n, r]) => {
|
|
60
|
+
let i = { input: e ?? null };
|
|
61
|
+
t !== void 0 && (i.loading = t), n !== void 0 && (i.noResults = n), r !== void 0 && (i.results = r), j.setLabels(i);
|
|
62
|
+
}, { immediate: !0 }), v(O, (e) => {
|
|
63
|
+
e !== j.snapshot.term && j.setValue(e);
|
|
64
|
+
});
|
|
65
|
+
let N = n(() => C(M.value, A, { name: w.name })), P = n(() => {
|
|
66
|
+
let { value: e, ...t } = N.value.input;
|
|
67
|
+
return t;
|
|
68
|
+
});
|
|
69
|
+
function F(e, t) {
|
|
70
|
+
return w.itemKey ? w.itemKey(e) : j.itemTextOf(e) || t;
|
|
71
|
+
}
|
|
72
|
+
function I(e) {
|
|
73
|
+
j.setTerm(e.target.value);
|
|
74
|
+
}
|
|
75
|
+
function L(e) {
|
|
76
|
+
j.keydown(e.key, e) && e.preventDefault();
|
|
77
|
+
}
|
|
78
|
+
let R = g();
|
|
79
|
+
function z() {
|
|
80
|
+
let { role: e, ...t } = R;
|
|
81
|
+
return t;
|
|
82
|
+
}
|
|
83
|
+
return (e, n) => (d(), i("div", u({ class: "mp-typeahead" }, N.value.root), [
|
|
84
|
+
a("input", u({
|
|
85
|
+
class: "form-control",
|
|
86
|
+
type: "text"
|
|
87
|
+
}, {
|
|
88
|
+
...P.value,
|
|
89
|
+
...z()
|
|
90
|
+
}, {
|
|
91
|
+
role: "combobox",
|
|
92
|
+
value: h(M).term,
|
|
93
|
+
onInput: I,
|
|
94
|
+
onKeydown: L,
|
|
95
|
+
onBlur: n[0] ||= (e) => h(j).blur()
|
|
96
|
+
}), null, 16, E),
|
|
97
|
+
a("ul", u({ class: "dropdown-menu" }, N.value.listbox), [N.value.status ? (d(), i("li", u({
|
|
98
|
+
key: 0,
|
|
99
|
+
class: "ta-status"
|
|
100
|
+
}, N.value.status.attrs), m(N.value.status.text), 17)) : r("", !0), (d(!0), i(t, null, f(h(M).items, (t, r) => (d(), i("li", u({
|
|
101
|
+
key: F(t, r),
|
|
102
|
+
class: "dropdown-item"
|
|
103
|
+
}, { ref_for: !0 }, N.value.option(r), {
|
|
104
|
+
onMousedown: n[1] ||= y(() => {}, ["prevent"]),
|
|
105
|
+
onClick: (e) => h(j).pick(r)
|
|
106
|
+
}), [p(e.$slots, "item", {
|
|
107
|
+
item: t,
|
|
108
|
+
term: h(M).term
|
|
109
|
+
}, () => [o(m(h(j).itemTextOf(t)), 1)])], 16, D))), 128))], 16),
|
|
110
|
+
a("span", u({ class: "visually-hidden" }, N.value.live.attrs), m(N.value.live.text), 17),
|
|
111
|
+
N.value.error ? (d(), i("div", u({
|
|
112
|
+
key: 0,
|
|
113
|
+
class: "ta-error"
|
|
114
|
+
}, N.value.error.attrs), m(N.value.error.text), 17)) : r("", !0)
|
|
115
|
+
], 16));
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
//#endregion
|
|
119
|
+
export { O as BsTypeahead, w as inMemoryTypeaheadProvider };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TypeaheadProvider } from '@mintplayer/ui-core/typeahead';
|
|
2
|
+
declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
4
|
+
readonly onSelect?: ((item: T, value: string) => any) | undefined;
|
|
5
|
+
readonly onOpen?: (() => any) | undefined;
|
|
6
|
+
readonly "onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
7
|
+
readonly onClose?: (() => any) | undefined;
|
|
8
|
+
readonly onSubmit?: ((value: string) => any) | undefined;
|
|
9
|
+
readonly onLoadError?: ((error: unknown) => any) | undefined;
|
|
10
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onSubmit" | "onSelect" | "onUpdate:modelValue" | "onClose" | "onOpen" | "onLoadError"> & ({
|
|
11
|
+
modelValue?: string;
|
|
12
|
+
} & {
|
|
13
|
+
provider?: TypeaheadProvider<T> | null;
|
|
14
|
+
debounceMs?: number;
|
|
15
|
+
minLength?: number;
|
|
16
|
+
itemText?: (item: T) => string;
|
|
17
|
+
itemKey?: (item: T) => string | number;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
name?: string | null;
|
|
20
|
+
inputLabel?: string | null;
|
|
21
|
+
loadingLabel?: string;
|
|
22
|
+
noResultsLabel?: string;
|
|
23
|
+
resultsLabel?: (count: number) => string;
|
|
24
|
+
errorText?: string | null;
|
|
25
|
+
}) & Partial<{}>> & import('vue').PublicProps;
|
|
26
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
27
|
+
attrs: any;
|
|
28
|
+
slots: Readonly<{
|
|
29
|
+
item?(props: {
|
|
30
|
+
item: T;
|
|
31
|
+
term: string;
|
|
32
|
+
}): unknown;
|
|
33
|
+
}> & {
|
|
34
|
+
item?(props: {
|
|
35
|
+
item: T;
|
|
36
|
+
term: string;
|
|
37
|
+
}): unknown;
|
|
38
|
+
};
|
|
39
|
+
emit: (((evt: "select", item: T, value: string) => void) & ((evt: "open") => void) & ((evt: "close") => void) & ((evt: "submit", value: string) => void) & ((evt: "loadError", error: unknown) => void)) & ((evt: "update:modelValue", value: string) => void);
|
|
40
|
+
}>) => import('vue').VNode & {
|
|
41
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
42
|
+
};
|
|
43
|
+
export default _default;
|
|
44
|
+
type __VLS_PrettifyLocal<T> = {
|
|
45
|
+
[K in keyof T]: T[K];
|
|
46
|
+
} & {};
|