@lark-apaas/miaoda-core 0.1.0-alpha.23 → 0.1.0-alpha.25

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,5 @@
1
1
  export * from './SidebarNav';
2
2
  export * from './User';
3
- export * from './TopNav';
4
3
  export * from './SidebarNav';
5
4
  export * from './User';
6
5
  export * from './theme';
@@ -1,6 +1,5 @@
1
1
  export * from "./SidebarNav/index.js";
2
2
  export * from "./User/index.js";
3
- export * from "./TopNav/index.js";
4
3
  export * from "./theme/index.js";
5
4
  export * from "./AppContainer/index.js";
6
5
  export * from "./ErrorRender/index.js";
@@ -0,0 +1,40 @@
1
+ @font-face {
2
+ font-family: LarkChineseQuote;
3
+ font-weight: 300;
4
+ src: local(PingFangSC-Light);
5
+ unicode-range: U+2018, U+2019, U+201A, U+201C, U+201D, U+201E;
6
+ }
7
+
8
+ @font-face {
9
+ font-family: LarkChineseQuote;
10
+ font-weight: 400;
11
+ src: local(PingFangSC-Regular);
12
+ unicode-range: U+2018, U+2019, U+201A, U+201C, U+201D, U+201E;
13
+ }
14
+
15
+ @font-face {
16
+ font-family: LarkChineseQuote;
17
+ font-weight: 500;
18
+ src: local(PingFangSC-Medium);
19
+ unicode-range: U+2018, U+2019, U+201A, U+201C, U+201D, U+201E;
20
+ }
21
+
22
+ @font-face {
23
+ font-family: LarkChineseQuote;
24
+ font-weight: 600;
25
+ src: local(PingFangSC-Semibold);
26
+ unicode-range: U+2018, U+2019, U+201A, U+201C, U+201D, U+201E;
27
+ }
28
+
29
+ @font-face {
30
+ font-family: LarkEmojiFont;
31
+ src: local(Apple Color Emoji), local(Noto Color Emoji);
32
+ unicode-range: U+1F21A, U+1F250, U+1F237, U+26A0;
33
+ }
34
+
35
+ @font-face {
36
+ font-family: LarkHackSafariFont;
37
+ src: local(Helvetica Neue);
38
+ unicode-range: U+0;
39
+ }
40
+
package/lib/index.css CHANGED
@@ -1,4 +1,5 @@
1
1
  @import "./theme-layer.css";
2
2
  @import "./tailwind-theme.css";
3
3
  @import "./override.css";
4
+ @import "./font-family.css";
4
5
 
@@ -1,7 +1,7 @@
1
1
  function getPreviewParentOrigin() {
2
2
  const { origin } = window.location;
3
- if (origin.includes('miaoda.feishuapp.net')) return 'https://miaoda.feishu.cn';
4
- if (origin.includes('miaoda-pre.feishuapp.net')) return 'https://miaoda.feishu-pre.cn';
3
+ if (origin.includes('feishuapp.cn') || origin.includes('miaoda.feishuapp.net')) return 'https://miaoda.feishu.cn';
4
+ if (origin.includes('fsapp.kundou.cn') || origin.includes('miaoda-pre.feishuapp.net')) return 'https://miaoda.feishu-pre.cn';
5
5
  return 'https://miaoda.feishu-boe.cn';
6
6
  }
7
7
  export { getPreviewParentOrigin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/miaoda-core",
3
- "version": "0.1.0-alpha.23",
3
+ "version": "0.1.0-alpha.25",
4
4
  "types": "./lib/index.d.ts",
5
5
  "main": "./lib/index.js",
6
6
  "files": [
@@ -76,7 +76,7 @@
76
76
  "@ant-design/colors": "^7.2.1",
77
77
  "@ant-design/cssinjs": "^1.24.0",
78
78
  "@data-loom/js": "0.3.1",
79
- "@lark-apaas/miaoda-inspector": "0.1.0-alpha.7",
79
+ "@lark-apaas/miaoda-inspector": "0.1.0-alpha.8",
80
80
  "clsx": "~2.0.1",
81
81
  "dayjs": "^1.11.13",
82
82
  "echarts": "^6.0.0",
@@ -1 +0,0 @@
1
- export { default as TopNav } from '../../components/TopNav';
@@ -1,2 +0,0 @@
1
- import TopNav from "../../components/TopNav/index.js";
2
- export { TopNav };
@@ -1,12 +0,0 @@
1
- /**
2
- * 底部导航栏:应用模式,移动端转用
3
- */
4
- import * as React from 'react';
5
- import { NavItemProps } from '../common';
6
- import { BaseNavProps } from '../../types';
7
- interface BottomNavProps extends BaseNavProps {
8
- navList: NavItemProps[];
9
- maxBottomItems?: number;
10
- }
11
- export declare function BottomNav({ navList, className, maxBottomItems, }: BottomNavProps): React.JSX.Element;
12
- export {};
@@ -1,81 +0,0 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { useEffect, useMemo, useRef, useState } from "react";
3
- import { clsxWithTw } from "../../utils/utils.js";
4
- import { BottomBarThemeClass, MaskThemeClass, MoreNavItem, NavItem } from "../common/index.js";
5
- function BottomNav({ navList = [], className, maxBottomItems = 6 }) {
6
- const [isExpanded, setIsExpanded] = useState(false);
7
- const bottomBarRef = useRef(null);
8
- const hasMoreItems = navList.length > maxBottomItems;
9
- const bottomNavItems = hasMoreItems ? navList.slice(0, maxBottomItems - 1) : navList.slice(0, maxBottomItems);
10
- const expandedNavItems = hasMoreItems ? navList.slice(maxBottomItems - 1) : [];
11
- const expandedNavItemsPath = useMemo(()=>expandedNavItems.map((item)=>item.to), [
12
- expandedNavItems
13
- ]);
14
- const toggleExpanded = ()=>{
15
- setIsExpanded(!isExpanded);
16
- };
17
- const collapsePanel = ()=>{
18
- setIsExpanded(false);
19
- };
20
- const displayGridCols = bottomNavItems.length + (hasMoreItems ? 1 : 0);
21
- useEffect(()=>{
22
- if (bottomBarRef.current) {
23
- const bottomNavMask = document.createElement('div');
24
- bottomNavMask.className = 'w-full h-16';
25
- bottomNavMask.style.height = `${bottomBarRef.current.offsetHeight}px`;
26
- document.body.appendChild(bottomNavMask);
27
- return ()=>{
28
- document.body.removeChild(bottomNavMask);
29
- };
30
- }
31
- }, []);
32
- return /*#__PURE__*/ jsxs(Fragment, {
33
- children: [
34
- isExpanded ? /*#__PURE__*/ jsx("div", {
35
- className: clsxWithTw('fixed inset-0 z-20', MaskThemeClass),
36
- onClick: collapsePanel
37
- }) : null,
38
- /*#__PURE__*/ jsx("div", {
39
- className: clsxWithTw(BottomBarThemeClass, 'fixed inset-x-0 z-20 rounded-t-2xl shadow-lg transform transition-transform duration-300 ease-in-out', 'bottom-16', 'max-h-[calc(100vh-4rem)] overflow-y-auto', className, isExpanded ? 'translate-y-0' : 'translate-y-full'),
40
- children: /*#__PURE__*/ jsx("div", {
41
- className: "grid grid-cols-4 gap-2 py-3",
42
- children: expandedNavItems.map((item, index)=>/*#__PURE__*/ jsx(NavItem, {
43
- direction: "vertical",
44
- className: "text-xs h-20 gap-2",
45
- ...item,
46
- onClick: collapsePanel
47
- }, index))
48
- })
49
- }),
50
- /*#__PURE__*/ jsxs("div", {
51
- ref: bottomBarRef,
52
- className: clsxWithTw(BottomBarThemeClass, 'pt-2.5 pb-2.5 fixed h-16 inset-x-0 bottom-0 z-20 border-gray-200 border-t grid items-center', {
53
- 'grid-cols-1': 1 === displayGridCols,
54
- 'grid-cols-2': 2 === displayGridCols,
55
- 'grid-cols-3': 3 === displayGridCols,
56
- 'grid-cols-4': 4 === displayGridCols,
57
- 'grid-cols-5': 5 === displayGridCols,
58
- 'grid-cols-6': 6 === displayGridCols
59
- }, className),
60
- children: [
61
- bottomNavItems.map((item, index)=>/*#__PURE__*/ jsx(NavItem, {
62
- className: "text-xs",
63
- hideActive: isExpanded,
64
- direction: "vertical",
65
- onClick: collapsePanel,
66
- ...item
67
- }, index)),
68
- hasMoreItems ? /*#__PURE__*/ jsx(MoreNavItem, {
69
- direction: "vertical",
70
- className: "text-xs",
71
- name: "更多",
72
- onClick: toggleExpanded,
73
- isExpanded: isExpanded,
74
- expandedNavItemsPath: expandedNavItemsPath
75
- }) : null
76
- ]
77
- })
78
- ]
79
- });
80
- }
81
- export { BottomNav };
@@ -1,10 +0,0 @@
1
- /**
2
- * 顶部导航栏:应用模式,移动端转用
3
- * 仅展示标题
4
- */
5
- import React from 'react';
6
- import type { NavItemProps } from '../common';
7
- export declare const TitleBar: React.FC<{
8
- navList: NavItemProps[];
9
- className?: string;
10
- }>;
@@ -1,130 +0,0 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { useMemo, useState } from "react";
3
- import { Link, matchPath, useLocation } from "react-router-dom";
4
- import { LogOut, MoreHorizontal, X } from "lucide-react";
5
- import { clsxWithTw, isSparkRuntime } from "../../utils/utils.js";
6
- import { useAppInfo, useCurrentUserProfile, useLogout } from "../../hooks/index.js";
7
- import { DropdownThemeClass, MaskThemeClass, TopHeaderThemeClass } from "../common/index.js";
8
- const TitleBar = ({ navList, className })=>{
9
- const { pathname } = useLocation();
10
- const title = useMemo(()=>{
11
- const matched = navList.find((navItem)=>{
12
- const match = matchPath(navItem.to, pathname);
13
- return match && match.pathname === pathname;
14
- });
15
- return matched?.name;
16
- }, [
17
- navList,
18
- pathname
19
- ]);
20
- const { appName, appLogo } = useAppInfo();
21
- const { name: userName, avatar: userAvatar } = useCurrentUserProfile();
22
- const { handlerLogout } = useLogout();
23
- const [isMenuOpen, setIsMenuOpen] = useState(false);
24
- const closeMenu = ()=>{
25
- setIsMenuOpen(false);
26
- };
27
- return /*#__PURE__*/ jsxs(Fragment, {
28
- children: [
29
- /*#__PURE__*/ jsx("header", {
30
- className: clsxWithTw('px-2 md:px-4 sticky top-0 z-20 w-full h-14', TopHeaderThemeClass, className),
31
- children: /*#__PURE__*/ jsxs("div", {
32
- className: "flex justify-center items-center w-full h-full px-6",
33
- children: [
34
- /*#__PURE__*/ jsx("div", {
35
- className: "font-semibold w-ful text-ellipsis overflow-hidden whitespace-nowrap",
36
- children: title
37
- }),
38
- isMenuOpen ? /*#__PURE__*/ jsx(X, {
39
- className: "w-5 h-5 absolute right-4 top-1/2 -translate-y-1/2 cursor-pointer",
40
- onClick: ()=>setIsMenuOpen(!isMenuOpen)
41
- }) : /*#__PURE__*/ jsx(MoreHorizontal, {
42
- onClick: ()=>setIsMenuOpen(!isMenuOpen),
43
- className: "w-5 h-5 absolute right-4 top-1/2 -translate-y-1/2 cursor-pointer"
44
- })
45
- ]
46
- })
47
- }),
48
- isMenuOpen ? /*#__PURE__*/ jsx("div", {
49
- className: clsxWithTw('fixed inset-x-0 top-14 bottom-0 z-10', MaskThemeClass),
50
- onClick: closeMenu
51
- }) : null,
52
- /*#__PURE__*/ jsx("div", {
53
- className: clsxWithTw('fixed inset-x-0 z-10 transform transition-transform duration-300 ease-in-out', 'top-14', DropdownThemeClass, 'max-h-[calc(100vh-3.5rem)] overflow-y-auto', className, isMenuOpen ? 'translate-y-0 shadow-lg' : '-translate-y-full'),
54
- children: /*#__PURE__*/ jsxs("div", {
55
- className: "container space-y-4 py-6",
56
- hidden: !isMenuOpen,
57
- children: [
58
- /*#__PURE__*/ jsxs(Link, {
59
- to: "/",
60
- className: "flex flex-col justify-center items-center space-x-2",
61
- onClick: closeMenu,
62
- children: [
63
- appLogo ? /*#__PURE__*/ jsx("img", {
64
- src: appLogo,
65
- alt: "avatar",
66
- className: "w-14 h-14 mb-4"
67
- }) : null,
68
- /*#__PURE__*/ jsx("span", {
69
- className: "text-xl text-center font-medium w-full text-ellipsis overflow-hidden whitespace-nowrap ",
70
- children: appName || '新应用'
71
- }),
72
- /*#__PURE__*/ jsx("div", {
73
- className: "text-center justify-center text-token-text-title font-medium leading-relaxed"
74
- })
75
- ]
76
- }),
77
- userAvatar ? /*#__PURE__*/ jsxs("div", {
78
- children: [
79
- /*#__PURE__*/ jsxs("div", {
80
- className: "flex items-center justify-between border-gray-200 border-t py-4 ",
81
- children: [
82
- /*#__PURE__*/ jsx("div", {
83
- children: "当前用户"
84
- }),
85
- /*#__PURE__*/ jsxs("div", {
86
- className: "flex items-center",
87
- children: [
88
- /*#__PURE__*/ jsx("span", {
89
- className: "flex-1 text-ellipsis overflow-hidden whitespace-nowrap",
90
- children: userName
91
- }),
92
- /*#__PURE__*/ jsx("img", {
93
- onClick: ()=>{
94
- if (isSparkRuntime()) location.href = '/suda/user?brand=1';
95
- },
96
- src: userAvatar,
97
- alt: "avatar",
98
- className: "w-8 h-8 rounded-full ml-2"
99
- })
100
- ]
101
- })
102
- ]
103
- }),
104
- /*#__PURE__*/ jsxs("div", {
105
- className: "flex items-center justify-between border-t border-gray-200 py-4 cursor-pointer",
106
- onClick: async ()=>{
107
- await handlerLogout();
108
- closeMenu();
109
- },
110
- children: [
111
- /*#__PURE__*/ jsx("div", {
112
- children: "退出登录"
113
- }),
114
- /*#__PURE__*/ jsx("div", {
115
- className: "flex items-center",
116
- children: /*#__PURE__*/ jsx(LogOut, {
117
- className: "w-5 h-5"
118
- })
119
- })
120
- ]
121
- })
122
- ]
123
- }) : null
124
- ]
125
- })
126
- })
127
- ]
128
- });
129
- };
130
- export { TitleBar };
@@ -1,10 +0,0 @@
1
- /**
2
- * 顶部标题导航栏:支持 PC 和移动端
3
- * 移动端收起导航,点击下拉使用
4
- */
5
- import * as React from 'react';
6
- import { BaseNavProps } from '../../types';
7
- export interface TopNavProps extends BaseNavProps {
8
- align?: 'left' | 'center' | 'right';
9
- }
10
- export declare function TopNav({ navList, align, className, activeClassName, }: TopNavProps): React.JSX.Element;
@@ -1,86 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useRef, useState } from "react";
3
- import { Menu, X } from "lucide-react";
4
- import { Link } from "react-router-dom";
5
- import { clsxWithTw } from "../../utils/utils.js";
6
- import { useAppInfo } from "../../hooks/useAppInfo.js";
7
- import { useCurrentUserProfile } from "../../hooks/useCurrentUserProfile.js";
8
- import { DropdownThemeClass, NavMenu, TopHeaderThemeClass, UserAvatarMenu } from "../common/index.js";
9
- function TopNav({ navList = [], align = 'left', className, activeClassName }) {
10
- const [isMenuOpen, setIsMenuOpen] = useState(false);
11
- const navRef = useRef(null);
12
- const { appName, appLogo } = useAppInfo();
13
- const { avatar: userAvatar } = useCurrentUserProfile();
14
- return /*#__PURE__*/ jsxs("header", {
15
- ref: navRef,
16
- className: clsxWithTw('miao-top-nav h-14 items-end w-[100vw] px-3 md:px-4 sticky top-0 z-50 shadow-xs flex', TopHeaderThemeClass, className),
17
- children: [
18
- /*#__PURE__*/ jsxs("div", {
19
- className: "flex w-full h-full items-center justify-between",
20
- children: [
21
- /*#__PURE__*/ jsx("div", {
22
- className: "flex items-center gap-6 md:gap-10 text-ellipsis overflow-hidden whitespace-nowrap",
23
- children: /*#__PURE__*/ jsx(Link, {
24
- to: "/",
25
- className: "flex items-center space-x-2 w-[100%]",
26
- children: /*#__PURE__*/ jsxs("div", {
27
- className: "flex items-center gap-2 w-[100%]",
28
- children: [
29
- appLogo ? /*#__PURE__*/ jsx("img", {
30
- src: appLogo,
31
- alt: "avatar",
32
- className: "w-7 h-7"
33
- }) : null,
34
- /*#__PURE__*/ jsx("span", {
35
- className: "max-w-[240px] font-medium w-full truncate",
36
- title: appName,
37
- children: appName || '新应用'
38
- })
39
- ]
40
- })
41
- })
42
- }),
43
- /*#__PURE__*/ jsx("div", {
44
- className: clsxWithTw('flex-1 overflow-hidden ml-5 hidden md:block h-full', {
45
- 'items-start': 'left' === align,
46
- 'items-center': 'center' === align,
47
- 'items-end': 'right' === align
48
- }),
49
- children: /*#__PURE__*/ jsx(NavMenu, {
50
- navList: navList,
51
- className: className,
52
- activeClassName: activeClassName
53
- })
54
- }),
55
- userAvatar ? /*#__PURE__*/ jsx(UserAvatarMenu, {
56
- className: className
57
- }) : null,
58
- navList.length > 0 ? /*#__PURE__*/ jsx("div", {
59
- className: "md:hidden flex items-center",
60
- children: isMenuOpen ? /*#__PURE__*/ jsx(X, {
61
- className: "h-5 w-5 mx-3 cursor-pointer",
62
- onClick: ()=>setIsMenuOpen(!isMenuOpen)
63
- }) : /*#__PURE__*/ jsx(Menu, {
64
- className: "h-5 w-5 mx-3 cursor-pointer",
65
- onClick: ()=>setIsMenuOpen(!isMenuOpen)
66
- })
67
- }) : null
68
- ]
69
- }),
70
- isMenuOpen && navList.length > 0 ? /*#__PURE__*/ jsx("div", {
71
- className: "md:hidden",
72
- children: /*#__PURE__*/ jsx("div", {
73
- className: clsxWithTw('overflow-y-auto max-h-[482px] border-t border-gray-200 py-2 absolute top-14 left-0 right-0 shadow-lg', DropdownThemeClass, className),
74
- children: /*#__PURE__*/ jsx(NavMenu, {
75
- navList: navList,
76
- className: className,
77
- activeClassName: activeClassName,
78
- onClick: ()=>setIsMenuOpen(false),
79
- mode: "vertical"
80
- })
81
- })
82
- }) : null
83
- ]
84
- });
85
- }
86
- export { TopNav };
@@ -1,12 +0,0 @@
1
- import * as React from 'react';
2
- import { NavProps } from '../../types';
3
- interface NavBarProps extends Omit<NavProps, 'mobileVariant'> {
4
- align?: 'left' | 'center' | 'right';
5
- /**
6
- * 移动端导航栏 变体
7
- */
8
- mobileVariant?: 'bottomBar' | 'dropdown';
9
- }
10
- export declare function Navigation(props: NavBarProps): React.JSX.Element;
11
- export { Navigation as TopNav };
12
- export default Navigation;
@@ -1,65 +0,0 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { useEffect, useMemo } from "react";
3
- import { useIsMobile } from "../../hooks/useIsMobile.js";
4
- import { BottomNav } from "./BottomNav.js";
5
- import { TitleBar } from "./TitleBar.js";
6
- import { TopNav } from "./TopNav.js";
7
- import { ConfigProvider } from "antd";
8
- import { useTheme } from "../../hooks/useTheme.js";
9
- import { useLocation } from "react-router-dom";
10
- import { generateDarkTheme, generateLightTheme } from "../theme/util.js";
11
- function NavigationBar({ navList = [], align, className, activeClassName, mobileVariant = 'dropdown' }) {
12
- const isMobile = useIsMobile();
13
- const location = useLocation();
14
- useEffect(()=>{
15
- window.scrollTo(0, 0);
16
- }, [
17
- location.pathname
18
- ]);
19
- if (isMobile && 'bottomBar' === mobileVariant) {
20
- if (0 === navList.length) return null;
21
- return /*#__PURE__*/ jsxs(Fragment, {
22
- children: [
23
- /*#__PURE__*/ jsx(TitleBar, {
24
- className: className,
25
- navList: navList
26
- }),
27
- /*#__PURE__*/ jsx(BottomNav, {
28
- navList: navList,
29
- className: className
30
- })
31
- ]
32
- });
33
- }
34
- return /*#__PURE__*/ jsx(TopNav, {
35
- navList: navList,
36
- activeClassName: activeClassName,
37
- align: align,
38
- className: className
39
- });
40
- }
41
- function Navigation(props) {
42
- const { theme } = useTheme();
43
- const { darkColorPrimary, lightColorPrimary } = props;
44
- const themeToken = useMemo(()=>{
45
- if ('dark' === theme && darkColorPrimary) return generateDarkTheme({
46
- colorPrimary: darkColorPrimary
47
- });
48
- if ('light' === theme && lightColorPrimary) return generateLightTheme({
49
- colorPrimary: lightColorPrimary
50
- });
51
- return {};
52
- }, [
53
- theme,
54
- darkColorPrimary,
55
- lightColorPrimary
56
- ]);
57
- return /*#__PURE__*/ jsx(ConfigProvider, {
58
- theme: themeToken,
59
- children: /*#__PURE__*/ jsx(NavigationBar, {
60
- ...props
61
- })
62
- });
63
- }
64
- const components_TopNav = Navigation;
65
- export { Navigation, Navigation as TopNav, components_TopNav as default };