mamba-layout 0.5.0 → 0.7.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,10 @@
1
- import { default as e } from "./UserAvatar/src/UserAvatar.vue.js";
2
- import { default as o } from "../layout/components/UserInfo.vue.js";
1
+ import { default as a } from "./UserAvatar/src/UserAvatar.vue.js";
2
+ import { default as t } from "../layout/components/LayoutBreadcrumb.vue.js";
3
+ import { default as m } from "../layout/components/TimezoneSelect.vue.js";
4
+ import { default as u } from "../layout/components/UserInfo.vue.js";
3
5
  export {
4
- e as UserAvatar,
5
- o as UserInfo
6
+ t as LayoutBreadcrumb,
7
+ m as TimezoneSelect,
8
+ a as UserAvatar,
9
+ u as UserInfo
6
10
  };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,8 @@
1
1
  export { default as BaseLayout } from './layout/BaseLayout.vue';
2
- export { default, default as LayoutBreadcrumb, } from './layout/components/LayoutBreadcrumb.vue';
3
2
  export * from './layout/hooks/useApp';
4
- export * from './layout/hooks/useSetting';
5
3
  export * from './layout/hooks/useState';
6
- export * from './layout/hooks/useTheme';
4
+ export { useTheme } from './layout/hooks/useTheme';
7
5
  export * from './layout/hooks';
8
- export * from './layout/utils';
9
6
  export * from './components';
10
7
  export * from './layout/components';
11
8
  export { default as i18n } from './locales';
package/dist/index.js CHANGED
@@ -1,37 +1,35 @@
1
1
  import { default as o } from "./layout/BaseLayout.vue.js";
2
- import { default as a, default as m } from "./layout/components/LayoutBreadcrumb.vue.js";
3
- import { useApp as u } from "./layout/hooks/useApp.js";
4
- import { provideSetting as p, useSetting as i } from "./layout/hooks/useSetting.js";
5
- import { injectLayoutContext as x, provideLayoutContext as g, useStateHook as y } from "./layout/hooks/useState.js";
6
- import { initTheme as L, setTheme as l, syncThemeFromSetting as h, toggleTheme as S, useTheme as T } from "./layout/hooks/useTheme.js";
7
- import { getLayoutLoginPath as C, getLayoutUserCenterPath as v, getQueryString as P, redirectToLayoutLogin as U, setLayoutStyle as A, setPrimaryColor as B } from "./layout/utils/index.js";
8
- import { default as j } from "./components/UserAvatar/src/UserAvatar.vue.js";
9
- import { default as F } from "./layout/components/UserInfo.vue.js";
10
- import { default as I } from "./locales/index.js";
11
- import { messages as q } from "./locales/messages.js";
2
+ import { useApp as a } from "./layout/hooks/useApp.js";
3
+ import { injectLayoutContext as s, provideLayoutContext as f, useStateHook as p } from "./layout/hooks/useState.js";
4
+ import { applyThemeClass as x, getBrowserPreferredTheme as l, initTheme as n, normalizeTheme as i, resolveTheme as d, setTheme as T, syncThemeFromSetting as h, toggleTheme as g, useTheme as y } from "./layout/hooks/useTheme.js";
5
+ import { provideSetting as c, useSetting as v } from "./layout/hooks/useSetting.js";
6
+ import { default as B } from "./components/UserAvatar/src/UserAvatar.vue.js";
7
+ import { default as z } from "./layout/components/LayoutBreadcrumb.vue.js";
8
+ import { default as U } from "./layout/components/TimezoneSelect.vue.js";
9
+ import { default as j } from "./layout/components/UserInfo.vue.js";
10
+ import { default as w } from "./locales/index.js";
11
+ import { messages as H } from "./locales/messages.js";
12
12
  export {
13
13
  o as BaseLayout,
14
- a as LayoutBreadcrumb,
15
- j as UserAvatar,
16
- F as UserInfo,
17
- m as default,
18
- C as getLayoutLoginPath,
19
- v as getLayoutUserCenterPath,
20
- P as getQueryString,
21
- I as i18n,
22
- L as initTheme,
23
- x as injectLayoutContext,
24
- q as messages,
25
- g as provideLayoutContext,
26
- p as provideSetting,
27
- U as redirectToLayoutLogin,
28
- A as setLayoutStyle,
29
- B as setPrimaryColor,
30
- l as setTheme,
14
+ z as LayoutBreadcrumb,
15
+ U as TimezoneSelect,
16
+ B as UserAvatar,
17
+ j as UserInfo,
18
+ x as applyThemeClass,
19
+ l as getBrowserPreferredTheme,
20
+ w as i18n,
21
+ n as initTheme,
22
+ s as injectLayoutContext,
23
+ H as messages,
24
+ i as normalizeTheme,
25
+ f as provideLayoutContext,
26
+ c as provideSetting,
27
+ d as resolveTheme,
28
+ T as setTheme,
31
29
  h as syncThemeFromSetting,
32
- S as toggleTheme,
33
- u as useApp,
34
- i as useSetting,
35
- y as useStateHook,
36
- T as useTheme
30
+ g as toggleTheme,
31
+ a as useApp,
32
+ v as useSetting,
33
+ p as useStateHook,
34
+ y as useTheme
37
35
  };
@@ -0,0 +1 @@
1
+ .top-timezone-popover{padding:6px!important;border:1px solid var(--ui-border-default)!important;background:var(--ui-bg-card)!important;box-shadow:var(--ui-shadow-pop)!important}
@@ -0,0 +1,7 @@
1
+ type __VLS_Props = {
2
+ showLabel?: boolean;
3
+ };
4
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
5
+ showLabel: boolean;
6
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
7
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import o from "./TimezoneSelect.vue2.js";
2
+ /* empty css */
3
+ /* empty css */
4
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
5
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-e62f5f2d"]]);
6
+ export {
7
+ p as default
8
+ };
@@ -0,0 +1,78 @@
1
+ import { defineComponent as w, ref as y, computed as c, resolveComponent as f, openBlock as t, createBlock as d, withCtx as o, createElementVNode as i, createElementBlock as r, Fragment as T, renderList as Z, normalizeClass as L, toDisplayString as u, createVNode as n, unref as b, createCommentVNode as h } from "vue";
2
+ import { Clock as B, ArrowDown as N } from "@element-plus/icons-vue";
3
+ import { useCurrentTimeZone as x, getTimeZoneOptions as V, getTimeZoneLabel as D, setCurrentTimeZone as E } from "../../utils/repoUtils.js";
4
+ import O from "./NavIconBtn.vue.js";
5
+ const S = {
6
+ key: 0,
7
+ class: "timezone-select__current"
8
+ }, A = { class: "timezone-select__panel" }, F = ["onClick"], I = { class: "timezone-select__name" }, R = { class: "timezone-select__offset" }, H = /* @__PURE__ */ w({
9
+ __name: "TimezoneSelect",
10
+ props: {
11
+ showLabel: { type: Boolean, default: !1 }
12
+ },
13
+ setup(l) {
14
+ const z = x(), s = y(!1), a = c(() => z.value), C = c(() => V()), m = c(() => D(a.value)), k = (_) => {
15
+ E(_), s.value = !1;
16
+ };
17
+ return (_, p) => {
18
+ const v = f("el-icon"), g = f("el-popover");
19
+ return t(), d(g, {
20
+ visible: s.value,
21
+ "onUpdate:visible": p[0] || (p[0] = (e) => s.value = e),
22
+ placement: "bottom",
23
+ width: 280,
24
+ trigger: "hover",
25
+ "popper-class": "top-timezone-popover"
26
+ }, {
27
+ reference: o(() => [
28
+ n(O, {
29
+ tag: "div",
30
+ class: "timezone-select",
31
+ "icon-only": !l.showLabel,
32
+ title: m.value,
33
+ "aria-label": m.value
34
+ }, {
35
+ default: o(() => [
36
+ n(v, null, {
37
+ default: o(() => [
38
+ n(b(B))
39
+ ]),
40
+ _: 1
41
+ }),
42
+ l.showLabel ? (t(), r("span", S, u(a.value), 1)) : h("", !0),
43
+ l.showLabel ? (t(), d(v, {
44
+ key: 1,
45
+ class: "timezone-select__caret"
46
+ }, {
47
+ default: o(() => [
48
+ n(b(N))
49
+ ]),
50
+ _: 1
51
+ })) : h("", !0)
52
+ ]),
53
+ _: 1
54
+ }, 8, ["icon-only", "title", "aria-label"])
55
+ ]),
56
+ default: o(() => [
57
+ i("div", A, [
58
+ (t(!0), r(T, null, Z(C.value, (e) => (t(), r("button", {
59
+ key: e.value,
60
+ type: "button",
61
+ class: L(["timezone-select__option", {
62
+ "timezone-select__option--active": e.value === a.value
63
+ }]),
64
+ onClick: (U) => k(e.value)
65
+ }, [
66
+ i("span", I, u(e.value), 1),
67
+ i("span", R, u(e.offset), 1)
68
+ ], 10, F))), 128))
69
+ ])
70
+ ]),
71
+ _: 1
72
+ }, 8, ["visible"]);
73
+ };
74
+ }
75
+ });
76
+ export {
77
+ H as default
78
+ };
@@ -0,0 +1 @@
1
+ .timezone-select[data-v-e62f5f2d]{flex-shrink:0}.timezone-select__current[data-v-e62f5f2d]{max-width:132px;overflow:hidden;text-overflow:ellipsis;font-size:14px;font-weight:600;line-height:1}.timezone-select__caret[data-v-e62f5f2d]{font-size:12px}.timezone-select__panel[data-v-e62f5f2d]{display:grid;gap:4px;max-height:min(360px,70vh);overflow-y:auto}.timezone-select__option[data-v-e62f5f2d]{width:100%;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:10px;padding:10px 12px;border:0;border-radius:var(--ui-radius-control);background:transparent;color:var(--ui-text-primary);text-align:left;cursor:pointer;transition:background var(--ui-transition-fast),color var(--ui-transition-fast)}.timezone-select__option[data-v-e62f5f2d]:hover{background:var(--ui-bg-muted)}.timezone-select__name[data-v-e62f5f2d]{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.timezone-select__offset[data-v-e62f5f2d]{color:var(--ui-text-muted);font-size:12px;white-space:nowrap}.timezone-select__option--active[data-v-e62f5f2d]{color:var(--el-color-primary);background:var(--el-color-primary-light-10)}.timezone-select__option--active .timezone-select__offset[data-v-e62f5f2d]{color:var(--el-color-primary)}
@@ -1 +1,3 @@
1
+ export { default as LayoutBreadcrumb } from './LayoutBreadcrumb.vue';
2
+ export { default as TimezoneSelect } from './TimezoneSelect.vue';
1
3
  export { default as UserInfo } from './UserInfo.vue';
@@ -1,4 +1,8 @@
1
- import { default as o } from "./UserInfo.vue.js";
1
+ import { default as r } from "./LayoutBreadcrumb.vue.js";
2
+ import { default as t } from "./TimezoneSelect.vue.js";
3
+ import { default as m } from "./UserInfo.vue.js";
2
4
  export {
3
- o as UserInfo
5
+ r as LayoutBreadcrumb,
6
+ t as TimezoneSelect,
7
+ m as UserInfo
4
8
  };
@@ -1,17 +1,21 @@
1
1
  import { useApp as o } from "./useApp.js";
2
- import { provideSetting as m, useSetting as i } from "./useSetting.js";
3
- import { injectLayoutContext as p, provideLayoutContext as s, useStateHook as u } from "./useState.js";
4
- import { initTheme as g, setTheme as h, syncThemeFromSetting as T, toggleTheme as f, useTheme as S } from "./useTheme.js";
2
+ import { provideSetting as m, useSetting as p } from "./useSetting.js";
3
+ import { injectLayoutContext as h, provideLayoutContext as i, useStateHook as n } from "./useState.js";
4
+ import { applyThemeClass as a, getBrowserPreferredTheme as g, initTheme as u, normalizeTheme as x, resolveTheme as f, setTheme as l, syncThemeFromSetting as y, toggleTheme as S, useTheme as d } from "./useTheme.js";
5
5
  export {
6
- g as initTheme,
7
- p as injectLayoutContext,
8
- s as provideLayoutContext,
6
+ a as applyThemeClass,
7
+ g as getBrowserPreferredTheme,
8
+ u as initTheme,
9
+ h as injectLayoutContext,
10
+ x as normalizeTheme,
11
+ i as provideLayoutContext,
9
12
  m as provideSetting,
10
- h as setTheme,
11
- T as syncThemeFromSetting,
12
- f as toggleTheme,
13
+ f as resolveTheme,
14
+ l as setTheme,
15
+ y as syncThemeFromSetting,
16
+ S as toggleTheme,
13
17
  o as useApp,
14
- i as useSetting,
15
- u as useStateHook,
16
- S as useTheme
18
+ p as useSetting,
19
+ n as useStateHook,
20
+ d as useTheme
17
21
  };
@@ -1,4 +1,8 @@
1
1
  export type ThemeMode = "light" | "dark";
2
+ export declare const normalizeTheme: (value: unknown) => ThemeMode | null;
3
+ export declare const getBrowserPreferredTheme: () => ThemeMode;
4
+ export declare const resolveTheme: (fallback?: ThemeMode) => ThemeMode;
5
+ export declare const applyThemeClass: (value: ThemeMode) => void;
2
6
  export declare function initTheme(fallback?: ThemeMode): ThemeMode;
3
7
  export declare function setTheme(value: ThemeMode, options?: {
4
8
  persist?: boolean;
@@ -36,7 +36,11 @@ function w() {
36
36
  };
37
37
  }
38
38
  export {
39
+ c as applyThemeClass,
40
+ h as getBrowserPreferredTheme,
39
41
  l as initTheme,
42
+ d as normalizeTheme,
43
+ T as resolveTheme,
40
44
  i as setTheme,
41
45
  k as syncThemeFromSetting,
42
46
  g as toggleTheme,
@@ -1,11 +1,7 @@
1
- function $(e, o) {
2
- const n = new RegExp("(^|&)" + e + "=([^&]*)(&|$)", "i"), c = (o || window.location.search.replace(/^\?/, "")).match(n);
3
- return c != null ? decodeURI(c[2]) : "";
4
- }
5
- const h = () => typeof location > "u" ? "" : location.href, p = (e) => (e == null ? void 0 : e.loginPath) || `/login?redirect=${encodeURIComponent(h())}`, C = (e) => {
1
+ const u = () => typeof location > "u" ? "" : location.href, p = (e) => (e == null ? void 0 : e.loginPath) || `/login?redirect=${encodeURIComponent(u())}`, $ = (e) => {
6
2
  typeof location > "u" || (location.href = p(e));
7
- }, L = (e) => (e == null ? void 0 : e.userCenterPath) || "/usercenter/home", b = (e) => {
8
- var l;
3
+ }, C = (e) => (e == null ? void 0 : e.userCenterPath) || "/usercenter/home", L = (e) => {
4
+ var a;
9
5
  const o = e.themeColor, n = {};
10
6
  if (o)
11
7
  for (const r in o) {
@@ -14,33 +10,33 @@ const h = () => typeof location > "u" ? "" : location.href, p = (e) => (e == nul
14
10
  n[i] = o[r], r == "colorPrimary" && f(o[r]);
15
11
  }
16
12
  let t = document.getElementById("layout-style");
17
- t && ((l = t.parentNode) == null || l.removeChild(t)), t = document.createElement("style"), t.id = "layout-style", document.head.appendChild(t);
18
- const c = Object.keys(n).map((r) => r + ":" + n[r]).join(";");
19
- t.innerHTML = `html:root{${c}}`;
13
+ t && ((a = t.parentNode) == null || a.removeChild(t)), t = document.createElement("style"), t.id = "layout-style", document.head.appendChild(t);
14
+ const l = Object.keys(n).map((r) => r + ":" + n[r]).join(";");
15
+ t.innerHTML = `html:root{${l}}`;
20
16
  };
21
17
  function f(e) {
22
- var c;
18
+ var l;
23
19
  let o = document.getElementById("primary-style");
24
20
  if (e == "theme-default" && o) {
25
- (c = o.parentNode) == null || c.removeChild(o);
21
+ (l = o.parentNode) == null || l.removeChild(o);
26
22
  return;
27
23
  }
28
24
  const n = g(e);
29
25
  o || (o = document.createElement("style"), o.id = "primary-style", document.head.appendChild(o));
30
- const t = Object.keys(n).map((l) => l + ":" + n[l]).join(";");
26
+ const t = Object.keys(n).map((a) => a + ":" + n[a]).join(";");
31
27
  o.innerHTML = `html:root{${t}}`;
32
28
  }
33
29
  function g(e) {
34
- var m;
35
- const o = ((m = e.match(/\d+/g)) == null ? void 0 : m.map(Number)) || [], [n, t, c] = o, l = `rgb(${n}, ${t}, ${c})`, r = (d) => {
36
- const a = d / 100, u = Math.min(255, n + (255 - n) * a), y = Math.min(255, t + (255 - t) * a), s = Math.min(255, c + (255 - c) * a);
37
- return `rgb(${u.toFixed(1)}, ${y.toFixed(1)}, ${s.toFixed(1)})`;
38
- }, i = (d) => {
39
- const a = 1 - d / 100;
40
- return `rgb(${Math.round(n * a)} ${Math.round(t * a)} ${Math.round(c * a)})`;
30
+ var d;
31
+ const o = ((d = e.match(/\d+/g)) == null ? void 0 : d.map(Number)) || [], [n, t, l] = o, a = `rgb(${n}, ${t}, ${l})`, r = (m) => {
32
+ const c = m / 100, y = Math.min(255, n + (255 - n) * c), h = Math.min(255, t + (255 - t) * c), s = Math.min(255, l + (255 - l) * c);
33
+ return `rgb(${y.toFixed(1)}, ${h.toFixed(1)}, ${s.toFixed(1)})`;
34
+ }, i = (m) => {
35
+ const c = 1 - m / 100;
36
+ return `rgb(${Math.round(n * c)} ${Math.round(t * c)} ${Math.round(l * c)})`;
41
37
  };
42
38
  return {
43
- "--el-color-primary": l,
39
+ "--el-color-primary": a,
44
40
  "--el-color-primary-light-3": r(30),
45
41
  "--el-color-primary-light-5": r(50),
46
42
  "--el-color-primary-light-7": r(70),
@@ -51,9 +47,8 @@ function g(e) {
51
47
  }
52
48
  export {
53
49
  p as getLayoutLoginPath,
54
- L as getLayoutUserCenterPath,
55
- $ as getQueryString,
56
- C as redirectToLayoutLogin,
57
- b as setLayoutStyle,
50
+ C as getLayoutUserCenterPath,
51
+ $ as redirectToLayoutLogin,
52
+ L as setLayoutStyle,
58
53
  f as setPrimaryColor
59
54
  };