@mintplayer/vue-bootstrap 3.21.0 → 3.23.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.
@@ -1,6 +1,6 @@
1
- import { defineComponent as f, ref as v, onMounted as h, onBeforeUnmount as m, watch as n, openBlock as g, createElementBlock as w, mergeProps as y } from "vue";
1
+ import { defineComponent as w, ref as y, onMounted as m, onBeforeUnmount as b, watch as l, openBlock as g, createElementBlock as C, mergeProps as I } from "vue";
2
2
  import "@mintplayer/web-components/datatable";
3
- const I = /* @__PURE__ */ f({
3
+ const k = /* @__PURE__ */ w({
4
4
  inheritAttrs: !1,
5
5
  __name: "BsDatatable",
6
6
  props: {
@@ -17,48 +17,56 @@ const I = /* @__PURE__ */ f({
17
17
  selectionMode: {},
18
18
  selectionStrategy: {},
19
19
  selectedIds: {},
20
+ selectedRows: {},
21
+ rowLabel: { type: [Function, null] },
20
22
  distincts: { type: [Function, null] },
21
23
  labels: {}
22
24
  },
23
25
  emits: ["update:expandedIds", "update:selectedIds", "rowExpand", "rowCollapse", "sortChange", "selectionChange", "rowClick", "rowDblClick", "rowContextMenu", "pageChange", "perPageChange", "filterChange"],
24
- setup(i, { expose: r, emit: c }) {
25
- const e = i, l = c, a = v(null), d = () => {
26
- a.value && (a.value.columns = e.columns ?? [], e.fetch != null ? a.value.fetch = e.fetch : (a.value.fetch = null, a.value.data = e.data ?? []), e.rowKey !== void 0 && (a.value.rowKey = e.rowKey), e.rowRenderer !== void 0 && (a.value.rowRenderer = e.rowRenderer), e.tree !== void 0 && (a.value.tree = e.tree), e.idKey !== void 0 && (a.value.idKey = e.idKey), e.childCountKey !== void 0 && (a.value.childCountKey = e.childCountKey), e.treeIndent !== void 0 && (a.value.treeIndent = e.treeIndent), e.expandedIds !== void 0 && (a.value.expandedIds = e.expandedIds instanceof Set ? new Set(e.expandedIds) : new Set(e.expandedIds)), e.selectionMode !== void 0 && (a.value.selectionMode = e.selectionMode), e.selectionStrategy !== void 0 && (a.value.selectionStrategy = e.selectionStrategy), e.selectedIds !== void 0 && (a.value.selectedIds = [...e.selectedIds]), e.distincts !== void 0 && (a.value.distincts = e.distincts), e.labels !== void 0 && (a.value.labels = e.labels ?? void 0));
27
- }, s = {
28
- "mp-datatable-row-expand": (t) => l("rowExpand", t.detail),
29
- "mp-datatable-row-collapse": (t) => l("rowCollapse", t.detail),
26
+ setup(p, { expose: u, emit: v }) {
27
+ const e = p, n = v, a = y(null), d = () => {
28
+ a.value && (a.value.columns = e.columns ?? [], e.fetch != null ? a.value.fetch = e.fetch : (a.value.fetch = null, a.value.data = e.data ?? []), e.rowKey !== void 0 && (a.value.rowKey = e.rowKey), e.rowRenderer !== void 0 && (a.value.rowRenderer = e.rowRenderer), e.tree !== void 0 && (a.value.tree = e.tree), e.idKey !== void 0 && (a.value.idKey = e.idKey), e.childCountKey !== void 0 && (a.value.childCountKey = e.childCountKey), e.treeIndent !== void 0 && (a.value.treeIndent = e.treeIndent), e.selectionMode !== void 0 && (a.value.selectionMode = e.selectionMode), e.selectionStrategy !== void 0 && (a.value.selectionStrategy = e.selectionStrategy), e.distincts !== void 0 && (a.value.distincts = e.distincts), e.labels !== void 0 && (a.value.labels = e.labels ?? void 0), e.rowLabel !== void 0 && (a.value.rowLabel = e.rowLabel));
29
+ }, s = () => {
30
+ !a.value || e.expandedIds === void 0 || (a.value.expandedIds = new Set(e.expandedIds));
31
+ }, i = () => {
32
+ !a.value || e.selectedIds === void 0 || (a.value.selectedIds = [...e.selectedIds]);
33
+ }, r = () => {
34
+ !a.value || e.selectedRows === void 0 || (a.value.selectedRows = [...e.selectedRows]);
35
+ }, c = {
36
+ "mp-datatable-row-expand": (t) => n("rowExpand", t.detail),
37
+ "mp-datatable-row-collapse": (t) => n("rowCollapse", t.detail),
30
38
  "mp-datatable-expanded-ids-change": (t) => {
31
39
  const o = t.detail;
32
- l("update:expandedIds", new Set(o.expandedIds));
40
+ n("update:expandedIds", new Set(o.expandedIds));
33
41
  },
34
- "mp-datatable-sort-change": (t) => l("sortChange", t.detail),
42
+ "mp-datatable-sort-change": (t) => n("sortChange", t.detail),
35
43
  "mp-datatable-selection-change": (t) => {
36
44
  const o = t.detail;
37
- l("selectionChange", o), l("update:selectedIds", [...o.selectedIds]);
45
+ n("selectionChange", o), n("update:selectedIds", [...o.selectedIds]);
38
46
  },
39
- "mp-datatable-row-click": (t) => l("rowClick", t.detail),
40
- "mp-datatable-row-dblclick": (t) => l("rowDblClick", t.detail),
41
- "mp-datatable-row-contextmenu": (t) => l("rowContextMenu", t.detail),
42
- "mp-datatable-page-change": (t) => l("pageChange", t.detail),
43
- "mp-datatable-per-page-change": (t) => l("perPageChange", t.detail),
44
- "mp-datatable-filter-change": (t) => l("filterChange", t.detail)
45
- }, p = () => {
47
+ "mp-datatable-row-click": (t) => n("rowClick", t.detail),
48
+ "mp-datatable-row-dblclick": (t) => n("rowDblClick", t.detail),
49
+ "mp-datatable-row-contextmenu": (t) => n("rowContextMenu", t.detail),
50
+ "mp-datatable-page-change": (t) => n("pageChange", t.detail),
51
+ "mp-datatable-per-page-change": (t) => n("perPageChange", t.detail),
52
+ "mp-datatable-filter-change": (t) => n("filterChange", t.detail)
53
+ }, f = () => {
46
54
  if (a.value)
47
- for (const [t, o] of Object.entries(s))
55
+ for (const [t, o] of Object.entries(c))
48
56
  a.value.addEventListener(t, o);
49
- }, u = () => {
57
+ }, h = () => {
50
58
  if (a.value)
51
- for (const [t, o] of Object.entries(s))
59
+ for (const [t, o] of Object.entries(c))
52
60
  a.value.removeEventListener(t, o);
53
61
  };
54
- return h(() => {
55
- d(), p();
56
- }), m(u), n(() => e.columns, d, { deep: !1 }), n(() => e.data, d, { deep: !1 }), n(() => e.fetch, d), n(() => e.rowKey, d), n(() => e.tree, d), n(() => e.idKey, d), n(() => e.childCountKey, d), n(() => e.treeIndent, d), n(() => e.expandedIds, d, { deep: !1 }), n(() => e.selectionMode, d), n(() => e.selectionStrategy, d), n(() => e.selectedIds, d, { deep: !1 }), n(() => e.distincts, d), n(() => e.labels, d, { deep: !1 }), r({ el: a }), (t, o) => (g(), w("mp-datatable", y({
62
+ return m(() => {
63
+ d(), s(), i(), r(), f();
64
+ }), b(h), l(() => e.columns, d, { deep: !1 }), l(() => e.data, d, { deep: !1 }), l(() => e.fetch, d), l(() => e.rowKey, d), l(() => e.tree, d), l(() => e.idKey, d), l(() => e.childCountKey, d), l(() => e.treeIndent, d), l(() => e.selectionMode, d), l(() => e.selectionStrategy, d), l(() => e.distincts, d), l(() => e.labels, d, { deep: !1 }), l(() => e.rowLabel, d), l(() => e.expandedIds, s, { deep: !1 }), l(() => e.selectedIds, i, { deep: !1 }), l(() => e.selectedRows, r, { deep: !1 }), u({ el: a, reload: (t) => a.value?.reload(t), applyFetchState: (t) => a.value?.applyFetchState(t) }), (t, o) => (g(), C("mp-datatable", I({
57
65
  ref_key: "el",
58
66
  ref: a
59
67
  }, t.$attrs), null, 16));
60
68
  }
61
69
  });
62
70
  export {
63
- I as BsDatatable
71
+ k as BsDatatable
64
72
  };
@@ -1,4 +1,4 @@
1
- import { MpDatatable, DatatableColumnDef, DatatableFetch, RowKey, RowRenderer, DatatableSelectionMode, TreeIdKey, TreeSelectionStrategy, TreeRowExpandDetail, RowEventDetail, SortChangeEventDetail, SelectionChangeEventDetail, DatatableDistincts, DatatableLabels, FilterChangeDetail } from '@mintplayer/web-components/datatable';
1
+ import { MpDatatable, DatatableColumnDef, DatatableFetch, DatatableFetchState, DatatableReloadOptions, RowKey, RowRenderer, DatatableSelectionMode, TreeIdKey, TreeSelectionStrategy, TreeRowExpandDetail, RowEventDetail, SortChangeEventDetail, SelectionChangeEventDetail, DatatableDistincts, DatatableLabels, FilterChangeDetail } from '@mintplayer/web-components/datatable';
2
2
  type __VLS_Props = {
3
3
  columns?: DatatableColumnDef[];
4
4
  data?: unknown[];
@@ -16,9 +16,25 @@ type __VLS_Props = {
16
16
  childCountKey?: string | null;
17
17
  treeIndent?: number;
18
18
  expandedIds?: Set<unknown> | ReadonlyArray<unknown>;
19
+ /** `'none' | 'single' | 'multiple' | 'checkbox'` (`'checkbox'`: selection only through the checkbox column). */
19
20
  selectionMode?: DatatableSelectionMode;
20
21
  selectionStrategy?: TreeSelectionStrategy;
22
+ /** The selected keys; `v-model:selectedIds`. Authoritative. */
21
23
  selectedIds?: string[] | ReadonlyArray<string>;
24
+ /**
25
+ * Seeds the selection with row objects: REPLACES it, deriving the keys
26
+ * through `rowKey` and remembering the rows, so rows that are not loaded
27
+ * (another page, not fetched yet) are still reported in
28
+ * `selectionChange`'s `detail.selectedRows`. One-way: it is pushed when it
29
+ * changes, and takes precedence over `selectedIds` when both change at once.
30
+ * Read the selection back from `selectionChange` / `v-model:selectedIds`.
31
+ */
32
+ selectedRows?: unknown[] | ReadonlyArray<unknown>;
33
+ /**
34
+ * Names a row for its selection checkbox ("Select {label}"). Defaults to the
35
+ * text of the row's first cell, then the row number.
36
+ */
37
+ rowLabel?: ((row: unknown) => string) | null;
22
38
  /**
23
39
  * Source of distinct values for the filter panels. Required whenever the
24
40
  * element does not hold every row -- with `fetch`, external paging, or a tree
@@ -31,6 +47,8 @@ type __VLS_Props = {
31
47
  };
32
48
  declare const _default: import('vue').DefineComponent<__VLS_Props, {
33
49
  el: import('vue').Ref<MpDatatable | null, MpDatatable | null>;
50
+ reload: (options?: DatatableReloadOptions) => void | undefined;
51
+ applyFetchState: (state: DatatableFetchState) => void | undefined;
34
52
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
35
53
  "update:expandedIds": (value: Set<unknown>) => any;
36
54
  "update:selectedIds": (value: string[]) => any;
@@ -9,18 +9,18 @@ const _ = ["mode", "max-height"], $ = /* @__PURE__ */ r({
9
9
  },
10
10
  emits: ["select"],
11
11
  setup(e, { emit: t }) {
12
- const s = t, a = c(null);
13
- function n(o) {
14
- s("select", o.detail);
12
+ const s = t, o = c(null);
13
+ function a(n) {
14
+ s("select", n.detail);
15
15
  }
16
- return m(() => a.value?.addEventListener("select", n)), p(() => a.value?.removeEventListener("select", n)), (o, v) => (l(), d("mp-dropdown-menu", i({
16
+ return m(() => o.value?.addEventListener("select", a)), p(() => o.value?.removeEventListener("select", a)), (n, v) => (l(), d("mp-dropdown-menu", i({
17
17
  ref_key: "el",
18
- ref: a
19
- }, o.$attrs, {
18
+ ref: o
19
+ }, n.$attrs, {
20
20
  mode: e.mode,
21
21
  "max-height": e.maxHeight
22
22
  }), [
23
- u(o.$slots, "default")
23
+ u(n.$slots, "default")
24
24
  ], 16, _));
25
25
  }
26
26
  }), h = ["aria-disabled"], D = /* @__PURE__ */ r({
@@ -32,17 +32,17 @@ const _ = ["mode", "max-height"], $ = /* @__PURE__ */ r({
32
32
  value: {}
33
33
  },
34
34
  setup(e) {
35
- const t = e, s = c(null), a = () => {
36
- s.value && (s.value.value = t.value);
35
+ const t = e, s = c(null), o = () => {
36
+ s.value && (s.value.dropdownValue = t.value);
37
37
  };
38
- return m(a), f(() => t.value, a), (n, o) => (l(), d("li", i({
38
+ return m(o), f(() => t.value, o), (a, n) => (l(), d("li", i({
39
39
  ref_key: "el",
40
40
  ref: s
41
- }, n.$attrs, {
41
+ }, a.$attrs, {
42
42
  class: ["dropdown-item", { active: e.active, disabled: e.disabled }],
43
43
  "aria-disabled": e.disabled ? "true" : void 0
44
44
  }), [
45
- u(n.$slots, "default")
45
+ u(a.$slots, "default")
46
46
  ], 16, h));
47
47
  }
48
48
  }), b = /* @__PURE__ */ r({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintplayer/vue-bootstrap",
3
- "version": "3.21.0",
3
+ "version": "3.23.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": {
@@ -150,6 +150,10 @@
150
150
  "types": "./tab-control/src/index.d.ts",
151
151
  "import": "./tab-control/index.mjs"
152
152
  },
153
+ "./theming": {
154
+ "types": "./theming/src/index.d.ts",
155
+ "import": "./theming/index.mjs"
156
+ },
153
157
  "./tile-manager": {
154
158
  "types": "./tile-manager/src/index.d.ts",
155
159
  "import": "./tile-manager/index.mjs"
@@ -177,7 +181,7 @@
177
181
  },
178
182
  "peerDependencies": {
179
183
  "vue": "^3.5.0",
180
- "@mintplayer/web-components": "^2.0.0"
184
+ "@mintplayer/web-components": "^2.18.0"
181
185
  },
182
186
  "dependencies": {
183
187
  "tslib": "^2.3.0"
@@ -0,0 +1,57 @@
1
+ import { defineComponent as u, ref as a, onMounted as f, watch as M, openBlock as T, createElementBlock as p, mergeProps as _, shallowRef as i, getCurrentScope as E, onScopeDispose as h, getCurrentInstance as g, readonly as l } from "vue";
2
+ import { BS_THEME_DEFAULT_MODES as B, resolveMode as v, getBsThemeStore as m } from "@mintplayer/web-components/theming";
3
+ import { BS_THEME_COOKIE_NAME as y, BS_THEME_DEFAULT_MODES as O, BS_THEME_DEFAULT_MODE_META as H, configureBsTheme as F, getBsThemeStore as L, injectThemeAttribute as U, isValidThemeMode as x, readDefaultModeMeta as I, readThemeCookie as j, resolveMode as K, resolveServerTheme as N, writeThemeCookie as P } from "@mintplayer/web-components/theming";
4
+ const w = /* @__PURE__ */ u({
5
+ inheritAttrs: !1,
6
+ __name: "BsThemeToggle",
7
+ props: {
8
+ modes: {}
9
+ },
10
+ setup(o) {
11
+ const s = o, e = a(null), t = () => {
12
+ e.value && (e.value.modes = s.modes ?? B);
13
+ };
14
+ return f(t), M(() => s.modes, t), (r, n) => (T(), p("mp-theme-toggle", _({
15
+ ref_key: "el",
16
+ ref: e
17
+ }, r.$attrs), null, 16));
18
+ }
19
+ }), d = () => typeof window < "u", S = (o) => {
20
+ d() && m().setMode(o);
21
+ };
22
+ function C() {
23
+ const o = i("auto"), s = i(v("auto", !1));
24
+ let e = () => {
25
+ };
26
+ if (d()) {
27
+ const t = m(), r = () => {
28
+ o.value = t.getMode(), s.value = t.effectiveMode();
29
+ }, n = t.subscribe(r);
30
+ let c = !1;
31
+ e = () => {
32
+ c || (c = !0, n());
33
+ }, E() && h(e), g() ? f(r) : r();
34
+ }
35
+ return {
36
+ mode: l(o),
37
+ effectiveMode: l(s),
38
+ setMode: S,
39
+ stop: e
40
+ };
41
+ }
42
+ export {
43
+ y as BS_THEME_COOKIE_NAME,
44
+ O as BS_THEME_DEFAULT_MODES,
45
+ H as BS_THEME_DEFAULT_MODE_META,
46
+ w as BsThemeToggle,
47
+ F as configureBsTheme,
48
+ L as getBsThemeStore,
49
+ U as injectThemeAttribute,
50
+ x as isValidThemeMode,
51
+ I as readDefaultModeMeta,
52
+ j as readThemeCookie,
53
+ K as resolveMode,
54
+ N as resolveServerTheme,
55
+ C as useBsTheme,
56
+ P as writeThemeCookie
57
+ };
@@ -0,0 +1,8 @@
1
+ import { BsThemeToggleMode } from '@mintplayer/web-components/theming';
2
+ type __VLS_Props = {
3
+ modes?: readonly BsThemeToggleMode[];
4
+ };
5
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
6
+ el: unknown;
7
+ }, any>;
8
+ export default _default;
@@ -0,0 +1,3 @@
1
+ export { default as BsThemeToggle } from './BsThemeToggle.vue';
2
+ export { useBsTheme, type UseBsThemeResult } from './useBsTheme';
3
+ export { BS_THEME_COOKIE_NAME, BS_THEME_DEFAULT_MODE_META, BS_THEME_DEFAULT_MODES, configureBsTheme, getBsThemeStore, injectThemeAttribute, isValidThemeMode, readDefaultModeMeta, readThemeCookie, resolveMode, resolveServerTheme, writeThemeCookie, type BsEffectiveThemeMode, type BsThemeConfig, type BsThemeMode, type BsThemeStore, type BsThemeToggleMode, type ResolveServerThemeOptions, type WriteThemeCookieOptions, } from '@mintplayer/web-components/theming';
@@ -0,0 +1,35 @@
1
+ import { Ref } from 'vue';
2
+ import { BsEffectiveThemeMode, BsThemeMode } from '@mintplayer/web-components/theming';
3
+ export interface UseBsThemeResult {
4
+ /** The mode the user picked: `auto`, `light`, `dark` or a custom mode. */
5
+ mode: Readonly<Ref<BsThemeMode>>;
6
+ /** The mode applied to `<html data-bs-theme>`: `auto` resolved against the OS preference. */
7
+ effectiveMode: Readonly<Ref<BsEffectiveThemeMode>>;
8
+ /** Set, persist and apply a mode. An invalid mode is a no-op with a warning; a no-op on the server. */
9
+ setMode: (mode: BsThemeMode) => void;
10
+ /**
11
+ * Stop mirroring the store. Called automatically when the calling effect
12
+ * scope is disposed; call it yourself when using the composable outside any
13
+ * scope (a plain module, a store setup). Idempotent; a no-op on the server.
14
+ */
15
+ stop: () => void;
16
+ }
17
+ /**
18
+ * The document's colour mode as readonly refs, mirrored from the shared
19
+ * browser store (`@mintplayer/web-components/theming`). They update when the
20
+ * mode changes from anywhere: `setMode`, a `<BsThemeToggle>`, another
21
+ * framework's adapter on the same page, another tab, or the OS preference
22
+ * while in `auto`.
23
+ *
24
+ * The subscription is released when the calling effect scope is disposed
25
+ * (the component unmounts, or a manual `effectScope()` stops). Called outside
26
+ * any scope, nothing can release it automatically, so call the returned `stop()`.
27
+ *
28
+ * SSR-safe, and consistent with the React adapter: on the server the store is
29
+ * never touched and the refs hold `auto` resolved with `prefersDark = false`
30
+ * (`effectiveMode` = `light`), because the server cannot see the visitor's OS
31
+ * preference. Inside a component the refs keep that value until `onMounted`,
32
+ * so a hydrating client renders exactly what the server rendered and only
33
+ * then switches to the real mode; outside a component they sync immediately.
34
+ */
35
+ export declare function useBsTheme(): UseBsThemeResult;