@lobehub/ui 1.69.0 → 1.70.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.
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ import { DivProps } from "../types";
3
+ declare enum Line {
4
+ l7 = 0,
5
+ l6 = 1,
6
+ l5 = 2,
7
+ l4 = 3,
8
+ l3 = 4,
9
+ l2 = 5,
10
+ l1 = 6,
11
+ center = 7,
12
+ r1 = 8,
13
+ r2 = 9,
14
+ r3 = 10,
15
+ r4 = 11,
16
+ r5 = 12,
17
+ r6 = 13,
18
+ r7 = 14
19
+ }
20
+ export interface GridProps extends DivProps {
21
+ color?: string;
22
+ linePick?: Line;
23
+ strokeWidth?: number;
24
+ }
25
+ declare const Grid: import("react").NamedExoticComponent<GridProps>;
26
+ export default Grid;
@@ -0,0 +1,99 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["color", "strokeWidth", "linePick"];
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
+ import { isUndefined } from 'lodash-es';
7
+ import { memo, useCallback } from 'react';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { Fragment as _Fragment } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ var Line = /*#__PURE__*/function (Line) {
12
+ Line[Line["l7"] = 0] = "l7";
13
+ Line[Line["l6"] = 1] = "l6";
14
+ Line[Line["l5"] = 2] = "l5";
15
+ Line[Line["l4"] = 3] = "l4";
16
+ Line[Line["l3"] = 4] = "l3";
17
+ Line[Line["l2"] = 5] = "l2";
18
+ Line[Line["l1"] = 6] = "l1";
19
+ Line[Line["center"] = 7] = "center";
20
+ Line[Line["r1"] = 8] = "r1";
21
+ Line[Line["r2"] = 9] = "r2";
22
+ Line[Line["r3"] = 10] = "r3";
23
+ Line[Line["r4"] = 11] = "r4";
24
+ Line[Line["r5"] = 12] = "r5";
25
+ Line[Line["r6"] = 13] = "r6";
26
+ Line[Line["r7"] = 14] = "r7";
27
+ return Line;
28
+ }(Line || {});
29
+ var Grid = /*#__PURE__*/memo(function (_ref) {
30
+ var _ref$color = _ref.color,
31
+ color = _ref$color === void 0 ? '#fff' : _ref$color,
32
+ _ref$strokeWidth = _ref.strokeWidth,
33
+ strokeWidth = _ref$strokeWidth === void 0 ? 3 : _ref$strokeWidth,
34
+ linePick = _ref.linePick,
35
+ props = _objectWithoutProperties(_ref, _excluded);
36
+ var isUnpick = isUndefined(linePick);
37
+ var showLine = useCallback(function (l) {
38
+ return isUnpick || linePick === l;
39
+ }, [linePick]);
40
+ var vLine = /*#__PURE__*/_jsxs(_Fragment, {
41
+ children: [showLine(Line.l7) && /*#__PURE__*/_jsx("path", {
42
+ d: "M2 420v-60.343c0-21.82 14.15-41.12 34.959-47.684L1026 0h0"
43
+ }), showLine(Line.l6) && /*#__PURE__*/_jsx("path", {
44
+ d: "M268 420v-62.077c0-20.977 13.094-39.724 32.789-46.944L1149 0h0"
45
+ }), showLine(Line.l5) && /*#__PURE__*/_jsx("path", {
46
+ d: "M534 420v-64.358a50 50 0 0129.884-45.775L1269 0h0"
47
+ }), showLine(Line.l4) && /*#__PURE__*/_jsx("path", {
48
+ d: "M800 420v-67.395a50 50 0 0125.958-43.84L1389 0h0"
49
+ }), showLine(Line.l3) && /*#__PURE__*/_jsx("path", {
50
+ d: "M1066 420v-71.645a50 50 0 0120.456-40.337L1507 0h0"
51
+ }), showLine(Line.l2) && /*#__PURE__*/_jsx("path", {
52
+ d: "M1332 420v-77.506a50 50 0 0113.194-33.843L1629 0h0"
53
+ }), showLine(Line.l1) && /*#__PURE__*/_jsx("path", {
54
+ d: "M1598 420v-86.225a50 50 0 014.438-20.594L1744 0h0"
55
+ }), showLine(Line.center) && /*#__PURE__*/_jsx("path", {
56
+ d: "M1864 420V0h0"
57
+ }), showLine(Line.r1) && /*#__PURE__*/_jsx("path", {
58
+ d: "M2130 420v-86.225a50 50 0 00-4.438-20.594L1984 0h0"
59
+ }), showLine(Line.r2) && /*#__PURE__*/_jsx("path", {
60
+ d: "M2396 420v-77.506a50 50 0 00-13.194-33.843L2099 0h0"
61
+ }), showLine(Line.r3) && /*#__PURE__*/_jsx("path", {
62
+ d: "M2662 420v-71.645a50 50 0 00-20.456-40.337L2221 0h0"
63
+ }), showLine(Line.r4) && /*#__PURE__*/_jsx("path", {
64
+ d: "M2928 420v-67.395a50 50 0 00-25.958-43.84L2339 0h0"
65
+ }), showLine(Line.r5) && /*#__PURE__*/_jsx("path", {
66
+ d: "M3194 420v-64.358a50 50 0 00-29.884-45.775L2459 0h0"
67
+ }), showLine(Line.r6) && /*#__PURE__*/_jsx("path", {
68
+ d: "M3460 420v-62.077c0-20.977-13.094-39.724-32.789-46.944L2579 0h0"
69
+ }), showLine(Line.r7) && /*#__PURE__*/_jsx("path", {
70
+ d: "M3726 420v-60.343c0-21.82-14.15-41.12-34.959-47.684L2702 0h0"
71
+ })]
72
+ });
73
+ var hLine = isUnpick && /*#__PURE__*/_jsxs(_Fragment, {
74
+ children: [/*#__PURE__*/_jsx("path", {
75
+ d: "M2835 42H892"
76
+ }), /*#__PURE__*/_jsx("path", {
77
+ d: "M595 136h2538"
78
+ }), /*#__PURE__*/_jsx("path", {
79
+ d: "M237 249h3254"
80
+ })]
81
+ });
82
+ return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({}, props), {}, {
83
+ children: /*#__PURE__*/_jsx("svg", {
84
+ style: {
85
+ width: '100%'
86
+ },
87
+ viewBox: "0 0 3728 422",
88
+ xmlns: "http://www.w3.org/2000/svg",
89
+ children: /*#__PURE__*/_jsxs("g", {
90
+ fill: "none",
91
+ fillRule: "evenodd",
92
+ stroke: color,
93
+ strokeWidth: strokeWidth,
94
+ children: [vLine, hLine]
95
+ })
96
+ })
97
+ }));
98
+ });
99
+ export default Grid;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { DivProps } from "../types";
3
+ import { type GridBackgroundProps } from './index';
4
+ export interface GridShowcaseProps extends DivProps {
5
+ backgroundColor?: GridBackgroundProps['backgroundColor'];
6
+ }
7
+ declare const GridShowcase: import("react").NamedExoticComponent<GridShowcaseProps>;
8
+ export default GridShowcase;
@@ -0,0 +1,49 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["style", "children", "backgroundColor"];
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
+ import { useTheme } from 'antd-style';
7
+ import { rgba } from 'polished';
8
+ import { memo } from 'react';
9
+ import { Flexbox } from 'react-layout-kit';
10
+ import GridBackground from "./index";
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ var GridShowcase = /*#__PURE__*/memo(function (_ref) {
14
+ var style = _ref.style,
15
+ children = _ref.children,
16
+ _ref$backgroundColor = _ref.backgroundColor,
17
+ backgroundColor = _ref$backgroundColor === void 0 ? '#001dff' : _ref$backgroundColor,
18
+ props = _objectWithoutProperties(_ref, _excluded);
19
+ var theme = useTheme();
20
+ return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
21
+ style: _objectSpread({
22
+ position: 'relative'
23
+ }, style)
24
+ }, props), {}, {
25
+ children: [/*#__PURE__*/_jsx(GridBackground, {
26
+ animation: true,
27
+ colorBack: rgba(theme.colorText, 0.12),
28
+ colorFront: rgba(theme.colorText, 0.6),
29
+ flip: true
30
+ }), /*#__PURE__*/_jsx(Flexbox, {
31
+ align: 'center',
32
+ style: {
33
+ zIndex: 4
34
+ },
35
+ children: children
36
+ }), /*#__PURE__*/_jsx(GridBackground, {
37
+ animation: true,
38
+ backgroundColor: backgroundColor,
39
+ colorBack: rgba(theme.colorText, 0.24),
40
+ colorFront: theme.colorText,
41
+ random: true,
42
+ showBackground: true,
43
+ style: {
44
+ zIndex: 0
45
+ }
46
+ })]
47
+ }));
48
+ });
49
+ export default GridShowcase;
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ import { DivProps } from "../types";
3
+ export interface GridBackgroundProps extends DivProps {
4
+ animation?: boolean;
5
+ animationDuration?: number;
6
+ backgroundColor?: string;
7
+ colorBack?: string;
8
+ colorFront?: string;
9
+ flip?: boolean;
10
+ random?: boolean;
11
+ reverse?: boolean;
12
+ showBackground?: boolean;
13
+ strokeWidth?: number;
14
+ }
15
+ declare const GridBackground: import("react").NamedExoticComponent<GridBackgroundProps>;
16
+ export default GridBackground;
@@ -0,0 +1,87 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["flip", "reverse", "showBackground", "backgroundColor", "random", "animationDuration", "className", "colorFront", "colorBack", "strokeWidth", "style", "animation"];
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
+ import { useSize } from 'ahooks';
7
+ import { shuffle } from 'lodash-es';
8
+ import { memo, useCallback, useMemo, useRef } from 'react';
9
+ import Grid from "./Grid";
10
+ import { useStyles } from "./style";
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
14
+ var GridBackground = /*#__PURE__*/memo(function (_ref) {
15
+ var flip = _ref.flip,
16
+ reverse = _ref.reverse,
17
+ showBackground = _ref.showBackground,
18
+ backgroundColor = _ref.backgroundColor,
19
+ random = _ref.random,
20
+ _ref$animationDuratio = _ref.animationDuration,
21
+ animationDuration = _ref$animationDuratio === void 0 ? 8 : _ref$animationDuratio,
22
+ className = _ref.className,
23
+ colorFront = _ref.colorFront,
24
+ colorBack = _ref.colorBack,
25
+ strokeWidth = _ref.strokeWidth,
26
+ style = _ref.style,
27
+ animation = _ref.animation,
28
+ props = _objectWithoutProperties(_ref, _excluded);
29
+ var ref = useRef(null);
30
+ var size = useSize(ref);
31
+ var _useStyles = useStyles({
32
+ backgroundColor: backgroundColor,
33
+ reverse: reverse
34
+ }),
35
+ styles = _useStyles.styles,
36
+ cx = _useStyles.cx;
37
+ var gridProps = useMemo(function () {
38
+ return {
39
+ className: styles.highlight,
40
+ color: colorFront,
41
+ strokeWidth: strokeWidth
42
+ };
43
+ }, [reverse, colorFront, strokeWidth]);
44
+ var HighlightGrid = useCallback(function () {
45
+ if (!random) return /*#__PURE__*/_jsx(Grid, _objectSpread({
46
+ style: {
47
+ '--duration': "".concat(animationDuration, "s")
48
+ }
49
+ }, gridProps));
50
+ var group = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14];
51
+ return /*#__PURE__*/_jsx(_Fragment, {
52
+ children: shuffle(group).map(function (item, index) {
53
+ return /*#__PURE__*/_jsx(Grid, _objectSpread({
54
+ linePick: item,
55
+ style: {
56
+ '--delay': "".concat(index + Math.random(), "s"),
57
+ '--duration': "".concat(animationDuration, "s")
58
+ }
59
+ }, gridProps), item);
60
+ })
61
+ });
62
+ }, [random, animationDuration, gridProps]);
63
+ return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
64
+ className: cx(styles.container, className),
65
+ ref: ref,
66
+ style: flip ? _objectSpread({
67
+ transform: 'scaleY(-1)'
68
+ }, style) : style
69
+ }, props), {}, {
70
+ children: [/*#__PURE__*/_jsx(Grid, {
71
+ color: colorBack,
72
+ strokeWidth: strokeWidth,
73
+ style: {
74
+ zIndex: 2
75
+ }
76
+ }), animation && /*#__PURE__*/_jsx(HighlightGrid, {}), showBackground && /*#__PURE__*/_jsx("div", {
77
+ className: styles.backgroundContainer,
78
+ style: size ? {
79
+ fontSize: size.width / 80
80
+ } : {},
81
+ children: /*#__PURE__*/_jsx("div", {
82
+ className: styles.background
83
+ })
84
+ })]
85
+ }));
86
+ });
87
+ export default GridBackground;
@@ -0,0 +1,9 @@
1
+ export declare const useStyles: (props?: {
2
+ backgroundColor?: string | undefined;
3
+ reverse?: boolean | undefined;
4
+ } | undefined) => import("antd-style").ReturnStyles<{
5
+ background: import("antd-style").SerializedStyles;
6
+ backgroundContainer: import("antd-style").SerializedStyles;
7
+ container: import("antd-style").SerializedStyles;
8
+ highlight: import("antd-style").SerializedStyles;
9
+ }>;
@@ -0,0 +1,22 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
3
+ import { createStyles, keyframes } from 'antd-style';
4
+ import chroma from 'chroma-js';
5
+ export var useStyles = createStyles(function (_ref, _ref2) {
6
+ var css = _ref.css,
7
+ token = _ref.token;
8
+ var reverse = _ref2.reverse,
9
+ _ref2$backgroundColor = _ref2.backgroundColor,
10
+ backgroundColor = _ref2$backgroundColor === void 0 ? 'blue' : _ref2$backgroundColor;
11
+ var highlightAnimation = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n mask-position: 100% 0%;\n }\n 16%,100% {\n mask-position: 100% 200%;\n }\n "])));
12
+ var highlightAnimationReverse = keyframes(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n 0% {\n mask-position: 100% 200%;\n }\n 16%,100% {\n mask-position: 100% 0%;\n }\n "])));
13
+ var scale = chroma.bezier([token.colorText, backgroundColor, token.colorBgLayout]).scale().mode('lch').correctLightness().colors(6);
14
+ var width = 24;
15
+ var height = 36;
16
+ return {
17
+ background: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n top: ", "%;\n left: ", "%;\n transform: rotateX(60deg);\n\n width: ", "%;\n height: ", "%;\n\n background: ", ";\n filter: blur(2em) saturate(400%);\n border-radius: 50%;\n box-shadow:\n 0 0 1em 2em ", ",\n 0 0 3em 6em ", ",\n 0 0 6em 10em ", ",\n 0 0 8em 16em ", ";\n "])), 60 - height / 2, 50 - width / 2, width, height, scale[1], scale[1], scale[2], scale[3], scale[4]),
18
+ backgroundContainer: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: -1;\n inset: 0;\n\n width: 100%;\n height: 100%;\n\n perspective: 200px;\n "]))),
19
+ container: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: relative;\n\n mask-image: linear-gradient(to bottom, transparent, #fff 30%, #fff 70%, transparent);\n mask-size: cover;\n "]))),
20
+ highlight: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n --duration: 6s;\n --delay: 0s;\n\n position: absolute;\n z-index: 1;\n inset: 0;\n\n animation: ", " var(--duration)\n cubic-bezier(0.62, 0.62, 0.28, 0.67) infinite;\n animation-delay: var(--delay);\n\n mask-image: linear-gradient(to bottom, transparent 40%, #fff 60%, transparent);\n mask-size: 100% 200%;\n "])), reverse ? highlightAnimationReverse : highlightAnimation)
21
+ };
22
+ });
package/es/index.d.ts CHANGED
@@ -31,6 +31,8 @@ export { default as FormItem, type FormItemProps } from './Form/components/FormI
31
31
  export { default as FormTitle, type FormTitleProps } from './Form/components/FormTitle';
32
32
  export { default as Giscus, type GiscusProps } from './Giscus';
33
33
  export { default as GradientButton, type GradientButtonProps } from './GradientButton';
34
+ export { default as GridBackground, type GridBackgroundProps } from './GridBackground';
35
+ export { default as GridShowcase, type GridShowcaseProps } from './GridBackground/GridShowcase';
34
36
  export { default as Header, type HeaderProps } from './Header';
35
37
  export { default as Hero, type HeroAction, type HeroProps } from './Hero';
36
38
  export { default as Highlighter, type HighlighterProps, SyntaxHighlighter, type SyntaxHighlighterProps, } from './Highlighter';
package/es/index.js CHANGED
@@ -30,6 +30,8 @@ export { default as FormItem } from "./Form/components/FormItem";
30
30
  export { default as FormTitle } from "./Form/components/FormTitle";
31
31
  export { default as Giscus } from "./Giscus";
32
32
  export { default as GradientButton } from "./GradientButton";
33
+ export { default as GridBackground } from "./GridBackground";
34
+ export { default as GridShowcase } from "./GridBackground/GridShowcase";
33
35
  export { default as Header } from "./Header";
34
36
  export { default as Hero } from "./Hero";
35
37
  export { default as Highlighter, SyntaxHighlighter } from "./Highlighter";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.69.0",
3
+ "version": "1.70.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",