@mintplayer/vue-bootstrap 3.21.0 → 3.22.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.
@@ -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.22.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.17.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;