enr 0.2.3-alpha.2
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.
- package/209.mjs +10 -0
- package/209.mjs.map +1 -0
- package/LICENSE +25 -0
- package/README.md +139 -0
- package/client.mjs +10 -0
- package/components/ThemeContext/index.d.ts +11 -0
- package/components/ThemeContext/types.d.ts +26 -0
- package/components/button/button.d.ts +10 -0
- package/components/button/index.d.ts +9 -0
- package/components/image/index.d.ts +11 -0
- package/components/image/types.d.ts +13 -0
- package/components/image/useSrcChange.d.ts +11 -0
- package/components/layout/content.d.ts +17 -0
- package/components/layout/footer.d.ts +21 -0
- package/components/layout/get-value.d.ts +10 -0
- package/components/layout/header.d.ts +23 -0
- package/components/layout/index.d.ts +8 -0
- package/components/layout/is-fragment.d.ts +9 -0
- package/components/layout/layout.d.ts +55 -0
- package/components/layout/sidebar.d.ts +29 -0
- package/components/layout/types.d.ts +99 -0
- package/components/marquee/MarqueeEle.d.ts +15 -0
- package/components/marquee/index.d.ts +7 -0
- package/components/marquee/type.d.ts +9 -0
- package/components/menu/index.d.ts +6 -0
- package/components/menu/menu.d.ts +6 -0
- package/components/ripples/Content.d.ts +8 -0
- package/components/ripples/LazyRippleEle.d.ts +42 -0
- package/components/ripples/RipplesEle.d.ts +42 -0
- package/components/ripples/index.d.ts +11 -0
- package/components/ripples/types.d.ts +17 -0
- package/components/ripples/useOptionUpdate.d.ts +12 -0
- package/components/shared/EnLayoutContent/index.d.ts +19 -0
- package/components/shared/EnLayoutContent/types.d.ts +17 -0
- package/components/switch/SwitchContainer.d.ts +7 -0
- package/components/switch/SwitchContent.d.ts +10 -0
- package/components/switch/SwitchLabel.d.ts +9 -0
- package/components/switch/index.d.ts +14 -0
- package/customHooks/use-xcn/index.d.ts +14 -0
- package/customHooks/useAnimationFrame.d.ts +58 -0
- package/customHooks/useInputIsComposing.d.ts +44 -0
- package/customHooks/useRipples/buildBackground/create-background-color.d.ts +9 -0
- package/customHooks/useRipples/buildBackground/create-linear-gradient.d.ts +9 -0
- package/customHooks/useRipples/buildBackground/default-background/_createImageData.d.ts +13 -0
- package/customHooks/useRipples/buildBackground/default-background/circleDataList.d.ts +24 -0
- package/customHooks/useRipples/buildBackground/default-background/createCanvasElementBySize.d.ts +8 -0
- package/customHooks/useRipples/buildBackground/default-background/createDefault.d.ts +8 -0
- package/customHooks/useRipples/buildBackground/default-background/index.d.ts +18 -0
- package/customHooks/useRipples/buildBackground/load-image.d.ts +19 -0
- package/customHooks/useRipples/buildBackground/run-side.d.ts +15 -0
- package/customHooks/useRipples/buildBackground/type.d.ts +37 -0
- package/customHooks/useRipples/buildBackground/utils/bind-image.d.ts +10 -0
- package/customHooks/useRipples/buildBackground/utils/create-canvas-element.d.ts +9 -0
- package/customHooks/useRipples/buildBackground/utils/create-image-by-src.d.ts +8 -0
- package/customHooks/useRipples/buildBackground/utils/get-background-style.d.ts +9 -0
- package/customHooks/useRipples/buildBackground/utils/hide-css-background.d.ts +16 -0
- package/customHooks/useRipples/buildBackground/utils/restore-css-background.d.ts +13 -0
- package/customHooks/useRipples/callback/can-side.d.ts +14 -0
- package/customHooks/useRipples/callback/destroy.d.ts +9 -0
- package/customHooks/useRipples/callback/drop.d.ts +9 -0
- package/customHooks/useRipples/callback/extract-url.d.ts +8 -0
- package/customHooks/useRipples/callback/fade.d.ts +9 -0
- package/customHooks/useRipples/callback/get-new-image.d.ts +14 -0
- package/customHooks/useRipples/callback/reload-background.d.ts +12 -0
- package/customHooks/useRipples/callback/scale.d.ts +8 -0
- package/customHooks/useRipples/index.d.ts +45 -0
- package/customHooks/useRipples/init/index.d.ts +11 -0
- package/customHooks/useRipples/init/initEvent.d.ts +11 -0
- package/customHooks/useRipples/init/initShaders.d.ts +13 -0
- package/customHooks/useRipples/init/initTexture.d.ts +13 -0
- package/customHooks/useRipples/render/computeTextureBoundaries.d.ts +9 -0
- package/customHooks/useRipples/render/draw.d.ts +13 -0
- package/customHooks/useRipples/render/drawQuad.d.ts +13 -0
- package/customHooks/useRipples/render/dropAtPointer.d.ts +13 -0
- package/customHooks/useRipples/render/index.d.ts +12 -0
- package/customHooks/useRipples/render/swapBufferIndices.d.ts +11 -0
- package/customHooks/useRipples/render/update.d.ts +11 -0
- package/customHooks/useRipples/rippersData/defaultData.d.ts +11 -0
- package/customHooks/useRipples/rippersData/fadeData.d.ts +51 -0
- package/customHooks/useRipples/rippersData/index.d.ts +46 -0
- package/customHooks/useRipples/rippersData/loadConfig.d.ts +25 -0
- package/customHooks/useRipples/rippersData/renderData.d.ts +80 -0
- package/customHooks/useRipples/rippersData/useOptions.d.ts +91 -0
- package/customHooks/useRipples/rippersData/vertexSource.d.ts +34 -0
- package/customHooks/useRipples/ripple.html.d.ts +12 -0
- package/customHooks/useRipples/ripplesClass.d.ts +57 -0
- package/customHooks/useRipples/tools.d.ts +37 -0
- package/customHooks/useRipples/types.d.ts +209 -0
- package/customHooks/useRipples/use-lazy-ripple.d.ts +15 -0
- package/customHooks/useTimeId.d.ts +50 -0
- package/index.client.d.ts +20 -0
- package/index.d.ts +8 -0
- package/index.mjs +3 -0
- package/index.server.d.ts +8 -0
- package/layoutUtil.mjs +10 -0
- package/layoutUtil.mjs.map +1 -0
- package/package.json +82 -0
- package/server.mjs +8 -0
- package/server.mjs.map +1 -0
- package/storage/main-logic .d.ts +26 -0
- package/storage/storage-store.d.ts +14 -0
- package/styles/common.css +1012 -0
- package/styles/common.scss +453 -0
- package/styles/reset.scss +93 -0
- package/styles/respond.scss +54 -0
- package/styles/root.scss +212 -0
- package/styles/vars-color.scss +247 -0
- package/utilities/cookie.d.ts +28 -0
- package/utilities/sys.d.ts +41 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@components/layout/sidebar.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
import { LayoutSideBarProps } from './types';
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* children side bar
|
|
11
|
+
*
|
|
12
|
+
* 侧边栏
|
|
13
|
+
*
|
|
14
|
+
*
|
|
15
|
+
* @param children 子元素
|
|
16
|
+
* @param ref 组件引用
|
|
17
|
+
* @param props 组件属性
|
|
18
|
+
* @param className 自定义类名
|
|
19
|
+
* @param width 侧边栏的宽度
|
|
20
|
+
* 缺省值为 `150px`
|
|
21
|
+
* @param right 是否居右
|
|
22
|
+
* 缺省值为 `false`
|
|
23
|
+
* @param full 是否占用所有空间
|
|
24
|
+
* 缺省值为 `false`
|
|
25
|
+
* @returns `ReactElement`;
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
declare const InternalValueS: import("react").ForwardRefExoticComponent<LayoutSideBarProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
29
|
+
export { InternalValueS };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@components/layout/types.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
import { CSSProperties, HTMLAttributes } from 'react';
|
|
8
|
+
/**
|
|
9
|
+
* 布局
|
|
10
|
+
*/
|
|
11
|
+
export interface LayoutProps extends HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
classes?: string | string[];
|
|
13
|
+
/** 布局的 */
|
|
14
|
+
/**
|
|
15
|
+
* 布局的宽
|
|
16
|
+
*
|
|
17
|
+
*
|
|
18
|
+
* 缺省值为 100vw
|
|
19
|
+
*/
|
|
20
|
+
width?: string | number;
|
|
21
|
+
/**
|
|
22
|
+
* 布局可视界面的高
|
|
23
|
+
*
|
|
24
|
+
* 用于限制 side bar 的高度
|
|
25
|
+
*
|
|
26
|
+
* 缺省值为 100vh
|
|
27
|
+
*
|
|
28
|
+
* 为具体值。当为 100% 时 side bar 渲染不正确
|
|
29
|
+
*/
|
|
30
|
+
height?: string | number;
|
|
31
|
+
/** 其他的组件样式 */
|
|
32
|
+
/** 样式 */
|
|
33
|
+
style?: CSSProperties;
|
|
34
|
+
/** 其他的组件样式 */
|
|
35
|
+
theme?: LayoutTheme;
|
|
36
|
+
}
|
|
37
|
+
/** 侧边 sidebar 的参数 */
|
|
38
|
+
export interface LayoutSideBarProps extends HTMLAttributes<HTMLDivElement> {
|
|
39
|
+
classes?: string | string[];
|
|
40
|
+
/**
|
|
41
|
+
* 侧边栏的宽度
|
|
42
|
+
*
|
|
43
|
+
* 缺省值为 150
|
|
44
|
+
*/
|
|
45
|
+
width?: number | string;
|
|
46
|
+
/**
|
|
47
|
+
* 是否居右
|
|
48
|
+
*
|
|
49
|
+
* 缺省值为 false
|
|
50
|
+
*/
|
|
51
|
+
right?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* 是否占用所有空间
|
|
54
|
+
*
|
|
55
|
+
* 缺省值为 false
|
|
56
|
+
*/
|
|
57
|
+
full?: boolean;
|
|
58
|
+
}
|
|
59
|
+
/** Header 的 props */
|
|
60
|
+
export interface LayoutHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
61
|
+
classes?: string | string[];
|
|
62
|
+
/**
|
|
63
|
+
* header 的高度
|
|
64
|
+
*
|
|
65
|
+
* 缺省值为 2.8rem
|
|
66
|
+
*/
|
|
67
|
+
height?: number | string;
|
|
68
|
+
/**
|
|
69
|
+
* 是否取消悬挂粘连
|
|
70
|
+
*
|
|
71
|
+
* 缺省值为 false
|
|
72
|
+
*/
|
|
73
|
+
noSticky?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/** 脚组件的参数类型 */
|
|
76
|
+
export interface LayoutFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
77
|
+
classes?: string | string[];
|
|
78
|
+
/**
|
|
79
|
+
* footer 的高度
|
|
80
|
+
*
|
|
81
|
+
* 缺省值为 2rem
|
|
82
|
+
*/
|
|
83
|
+
height?: number | string;
|
|
84
|
+
}
|
|
85
|
+
/** 定义布局主题类型 */
|
|
86
|
+
export interface LayoutTheme {
|
|
87
|
+
/** 组件的宽 */
|
|
88
|
+
layoutWith: string | number;
|
|
89
|
+
/** 组件的高 */
|
|
90
|
+
layoutHeight: string | number;
|
|
91
|
+
/** 侧边的宽 */
|
|
92
|
+
sideBarWidth: string | number;
|
|
93
|
+
/** 头部的高 */
|
|
94
|
+
headerHeight: string | number;
|
|
95
|
+
/** 底部的高 */
|
|
96
|
+
footerHeight: string | number;
|
|
97
|
+
}
|
|
98
|
+
/** 可使用的样式类型 */
|
|
99
|
+
export type EnLayoutContentType = 'simple' | 'only-footer' | 'only-header' | 'no-sidebar' | 'side-full' | 'side-right-full-all' | 'side-right-full-no-footer' | 'side-right-full-no-header' | 'side-right-full-only-side' | 'side-right-all' | 'side-right-no-footer' | 'side-right-no-header' | 'side-right-only-side' | 'side-full-all' | 'side-full-no-footer' | 'side-full-no-header' | 'side-full-only-side' | 'simple-all' | 'simple-no-footer' | 'simple-no-header' | 'simple-only-side';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@components/marquee/MarqueeEle.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
import { HTMLAttributes } from 'react';
|
|
8
|
+
import { MarqueeProps } from './type';
|
|
9
|
+
import './index.scss';
|
|
10
|
+
/**
|
|
11
|
+
* 一个跑马灯一样的东东
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
declare const MarqueeEle: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & MarqueeProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
15
|
+
export { MarqueeEle };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@components/ripples/Content.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
/** 内容组件 */
|
|
8
|
+
export declare const Content: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@components/ripples/LazyRippleEle.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
import { RipplesOptions } from '../../customHooks/useRipples/types';
|
|
8
|
+
import { RippleEle } from './types';
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* ### 一个 ripple 背景组件
|
|
12
|
+
*
|
|
13
|
+
*
|
|
14
|
+
* *需要为该组件或父组件设置背景,否则即便的渲染了,效果不明显*
|
|
15
|
+
*
|
|
16
|
+
* 参数 props 属性:
|
|
17
|
+
* - children 内嵌的 ReactNode
|
|
18
|
+
* - style 更改显示的样式
|
|
19
|
+
* - option 初始化 ripples 的原始数据
|
|
20
|
+
* @param props 使用参数
|
|
21
|
+
* @version 0.0.1
|
|
22
|
+
* @see https://earthnut.dev/earthnut/lazy-background-ripple
|
|
23
|
+
* @example
|
|
24
|
+
* 使用:
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { BackgroundRipple } from 'earthnut/BackgroundRipple';
|
|
28
|
+
* // 也可以全量导入
|
|
29
|
+
* // import { BackgroundRipple } from 'earthnut';
|
|
30
|
+
* ...
|
|
31
|
+
* const animationFrameId = useAnimationFrame();
|
|
32
|
+
*
|
|
33
|
+
* return <BackgroundRipple>
|
|
34
|
+
* ...
|
|
35
|
+
* </BackgroundRipple>
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
declare const LazyBackgroundRipple: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLDivElement> & {
|
|
40
|
+
option?: RipplesOptions;
|
|
41
|
+
} & import("react").RefAttributes<RippleEle>>;
|
|
42
|
+
export { LazyBackgroundRipple };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@components/ripples/RipplesEle.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
import { RipplesOptions } from '../../customHooks/useRipples/types';
|
|
8
|
+
import { RippleEle } from './types';
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* ### 一个 ripple 背景组件
|
|
12
|
+
*
|
|
13
|
+
*
|
|
14
|
+
* *需要为该组件或父组件设置背景,否则即便的渲染了,效果不明显*
|
|
15
|
+
*
|
|
16
|
+
* 参数 props 属性:
|
|
17
|
+
* - children 内嵌的 ReactNode
|
|
18
|
+
* - style 更改显示的样式
|
|
19
|
+
* - option 初始化 ripples 的原始数据
|
|
20
|
+
* @param props 使用参数
|
|
21
|
+
* @version 0.0.1
|
|
22
|
+
* @see https://earthnut.dev/earthnut/background-ripple
|
|
23
|
+
* @example
|
|
24
|
+
* 使用:
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { BackgroundRipple } from 'earthnut';
|
|
28
|
+
* // 也可以全量导入
|
|
29
|
+
* // import { BackgroundRipple } from 'earthnut';
|
|
30
|
+
* ...
|
|
31
|
+
* const animationFrameId = useAnimationFrame();
|
|
32
|
+
*
|
|
33
|
+
* return <BackgroundRipple>
|
|
34
|
+
* ...
|
|
35
|
+
* </BackgroundRipple>
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
declare const BackgroundRipple: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLDivElement> & {
|
|
40
|
+
option?: RipplesOptions;
|
|
41
|
+
} & import("react").RefAttributes<RippleEle>>;
|
|
42
|
+
export { BackgroundRipple };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@components/ripples/index.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
import { RippleEle } from './types';
|
|
8
|
+
export { BackgroundRipple } from './RipplesEle';
|
|
9
|
+
export { LazyBackgroundRipple } from './LazyRippleEle';
|
|
10
|
+
export type { Ripples, BackgroundRipplesProps, RipplesOptions, RippleImgUrl, } from '../../customHooks/useRipples/index';
|
|
11
|
+
export type { RippleEle };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@components/ripples/types.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
import { RipplesOptions } from '../../customHooks/useRipples';
|
|
8
|
+
export type RippleEle = {
|
|
9
|
+
/** 切换当前的状态 */
|
|
10
|
+
toggleState(): void;
|
|
11
|
+
/** 获取当前的状态 */
|
|
12
|
+
state: boolean;
|
|
13
|
+
/** 暂停当前涟漪的渲染 */
|
|
14
|
+
pause(): void;
|
|
15
|
+
/** 设置属性 */
|
|
16
|
+
set(options?: RipplesOptions): void;
|
|
17
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@components/ripples/useOptionUpdate.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
import { Ripples, RipplesOptions } from '../../customHooks/useRipples/index';
|
|
8
|
+
import { RefObject } from 'react';
|
|
9
|
+
/**
|
|
10
|
+
* 更新参数数据
|
|
11
|
+
*/
|
|
12
|
+
export declare function useOptionUpdate(ripplesRef: RefObject<Ripples | null>, option: RipplesOptions | undefined): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@components/shared/EnLayoutContent/index.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
import { EnLayoutContentProps } from './types';
|
|
8
|
+
/** 创建带样式的组件 */
|
|
9
|
+
export declare const LayoutContentContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;
|
|
10
|
+
/** 带样式的组件 */
|
|
11
|
+
export declare const LayoutFooterContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
12
|
+
/** 带样式的头部 */
|
|
13
|
+
export declare const LayoutHeaderContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;
|
|
14
|
+
/** 带样式的组件 */
|
|
15
|
+
export declare const LayoutSideBarContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;
|
|
16
|
+
/** 内容区域容器 */
|
|
17
|
+
export declare const LayoutContentWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
18
|
+
/** 元始的外壳 */
|
|
19
|
+
export declare const EnLayoutContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, EnLayoutContentProps>> & string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@components/shared/EnLayoutContent/types.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
import { EnLayoutContentType } from 'components/layout/types';
|
|
8
|
+
/** 组件的样式 */
|
|
9
|
+
export interface EnLayoutContentProps {
|
|
10
|
+
$header: string;
|
|
11
|
+
$content: string;
|
|
12
|
+
$sidebar: string;
|
|
13
|
+
$footer: string;
|
|
14
|
+
$main: string;
|
|
15
|
+
$headerNoSticky: boolean;
|
|
16
|
+
$layoutType: EnLayoutContentType;
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@components/switch/SwitchContainer.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
export declare const SwitchContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@components/switch/SwitchContent.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
/** 开关的内容包装 */
|
|
8
|
+
export declare const SwitchContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
9
|
+
$type: "left" | "right";
|
|
10
|
+
}>> & string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@components/switch/SwitchLabel.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
export declare const SwitchLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
8
|
+
$type: boolean;
|
|
9
|
+
}>> & string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@components/switch/index.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
import { HTMLAttributes } from 'react';
|
|
8
|
+
/**
|
|
9
|
+
* 开关
|
|
10
|
+
*/
|
|
11
|
+
export declare function Switch({ value, change, children, ...props }: {
|
|
12
|
+
value: boolean;
|
|
13
|
+
change?: (e?: React.MouseEvent) => void;
|
|
14
|
+
} & HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@customHooks/use-xcn/index.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
/** 其实这并不是一个自定义钩子 */
|
|
8
|
+
import { EnTypeofClassNameItem, EnXcn } from 'xcn';
|
|
9
|
+
type EnClassName = 'en-flex' | 'en-flex-row' | 'en-flex-row-reverse' | 'en-flex-column' | 'en-flex-column-reverse' | 'en-flex-wrap' | 'en-full-container' | 'en-inline-block' | 'en-padding-horizontal-4' | 'en-padding-horizontal-8' | 'en-padding-horizontal-12' | 'en-padding-horizontal-16' | 'en-padding-horizontal-20' | 'en-padding-horizontal-24' | 'en-padding-horizontal-28' | 'en-padding-horizontal-32' | 'en-padding-horizontal-36' | 'en-padding-horizontal-40' | 'en-padding-vertical-4' | 'en-padding-vertical-8' | 'en-padding-vertical-12' | 'en-padding-vertical-16' | 'en-padding-vertical-20' | 'en-padding-vertical-24' | 'en-padding-vertical-28' | 'en-padding-vertical-32' | 'en-padding-vertical-36' | 'en-padding-vertical-40' | 'en-padding-4' | 'en-padding-8' | 'en-padding-12' | 'en-padding-16' | 'en-padding-20' | 'en-padding-24' | 'en-padding-28' | 'en-padding-32' | 'en-padding-36' | 'en-padding-40' | 'en-margin-horizontal-4' | 'en-margin-horizontal-8' | 'en-margin-horizontal-12' | 'en-margin-horizontal-16' | 'en-margin-horizontal-20' | 'en-margin-horizontal-24' | 'en-margin-horizontal-28' | 'en-margin-horizontal-32' | 'en-margin-horizontal-36' | 'en-margin-horizontal-40' | 'en-margin-vertical-4' | 'en-margin-vertical-8' | 'en-margin-vertical-12' | 'en-margin-vertical-16' | 'en-margin-vertical-20' | 'en-margin-vertical-24' | 'en-margin-vertical-28' | 'en-margin-vertical-32' | 'en-margin-vertical-36' | 'en-margin-vertical-40' | 'en-margin-4' | 'en-margin-8' | 'en-margin-12' | 'en-margin-16' | 'en-margin-20' | 'en-margin-24' | 'en-margin-28' | 'en-margin-32' | 'en-margin-36' | 'en-margin-40' | 'en-box-shadow-light-red100' | 'en-box-shadow-light-red100' | 'en-box-shadow-light-red100' | 'en-box-shadow-light-red100' | 'en-box-shadow-light-red100' | 'en-box-shadow-light-red100' | 'en-box-shadow-light-red100' | 'en-box-shadow-light-red100' | 'en-box-shadow-light-red100' | 'en-box-shadow-light-red100' | 'en-box-shadow-light-red100' | 'en-border-radius-4' | 'en-border-radius-8' | 'en-border-radius-12' | 'en-border-radius-16' | 'en-border-radius-20' | 'en-border-radius-24' | 'en-border-radius-28' | 'en-border-radius-32' | 'en-border-radius-36' | 'en-border-radius-40' | 'en-center' | 'en-dust' | 'en-text-in-one-line' | 'en-text-in-one-line-hide' | 'en-text-in-two-line' | 'en-color-text' | 'en-bg-red' | 'en-float-left' | 'en-float' | 'en-float-right' | 'en-clear-float' | 'en-clear' | 'en-loading' | 'en-text-center' | 'en-text-right' | 'eb-text-small' | 'en-relative' | 'en-user-select-text' | 'en-cursor-pointer';
|
|
10
|
+
/** 在 xcn 中使用 earthnut 样式类 */
|
|
11
|
+
export declare function _en<T extends EnClassName[]>(...classNameList: T): EnXcn<{
|
|
12
|
+
[K in keyof T]: EnTypeofClassNameItem<T[K]>;
|
|
13
|
+
}>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@customHooks/useAnimationFrame.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
/** 使用动画结果 */
|
|
8
|
+
export interface UseAnimationFrameResult {
|
|
9
|
+
/** 取消执行动画 */
|
|
10
|
+
cancel(): void;
|
|
11
|
+
/** 当前取消的状态 */
|
|
12
|
+
canceled: boolean;
|
|
13
|
+
/** 再次执行 */
|
|
14
|
+
render(): void;
|
|
15
|
+
}
|
|
16
|
+
export type AnimationFrameOption = boolean | {
|
|
17
|
+
immediately?: boolean;
|
|
18
|
+
once?: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* 该钩子在组件卸载时会自动调用 `window.cancelAnimationFrame` 清理传入的回调方法。
|
|
23
|
+
* 默认是传入即启动调用方法
|
|
24
|
+
*
|
|
25
|
+
* @description 创建一个会自己关闭(组建卸载时)的 animationFrame。当然,可以通过返回值手动终止
|
|
26
|
+
* @param callback 使用回调函数。回调函数有两个参数,除了默认的时间,还有另一个用于暂停后的记时时间。如果没有主动暂停,两者时间总是趋近于相等的(可能有其他延迟造成时间差越来越大)。如果没有暂停需求,使用第一个默认时间就可以了。
|
|
27
|
+
* @param [option=false] 使用第二参数,可指定是否立即执行及是否仅执行一次
|
|
28
|
+
* @returns 返回值包含执行状态
|
|
29
|
+
* @version 0.2.0
|
|
30
|
+
* @see https://earthnut.dev/custom-hooks/use-animation-frame
|
|
31
|
+
* @example
|
|
32
|
+
* 使用:
|
|
33
|
+
*
|
|
34
|
+
* ```ts
|
|
35
|
+
* // import { useAnimationFrame } from 'earthnut';
|
|
36
|
+
* ...
|
|
37
|
+
*
|
|
38
|
+
* export function Home () {
|
|
39
|
+
* // 如果没有主动暂停的需要,直接使用默认的 time 最好。如果中间有使用暂停。那么 time 值是不连贯的,而 runTime 是连贯的
|
|
40
|
+
* const result = useAnimationFrame((time ,runTime) => {
|
|
41
|
+
* ... //
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
*
|
|
45
|
+
* return <>
|
|
46
|
+
*
|
|
47
|
+
* <button onclick={() => result.cancel()}>暂停</button>
|
|
48
|
+
* <button onclick={() => result.render()}>恢复</button>
|
|
49
|
+
* </>
|
|
50
|
+
* }
|
|
51
|
+
* ...
|
|
52
|
+
*
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* 当然,可使用第二参数执行立即执行还是仅执行一次(作用不大,不与赘述)
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
export declare function useAnimationFrame(callback: (time: number, runtime: number) => void, option?: AnimationFrameOption): UseAnimationFrameResult;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@customHooks/useInputIsComposing.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
import { RefObject } from 'react';
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* ### 导出一个使用 `useRef` 创建的 `boolean`
|
|
11
|
+
*
|
|
12
|
+
* *由于是包裹在 RefObject 之中,判断时务必使用 `isComposing.current` 进行判断*
|
|
13
|
+
* @description 用于判断当前的输入状态是否结束
|
|
14
|
+
* @param inputRef [RefObject<HTMLInputElement | HTMLTextAreaElement>] 输入框的 ref
|
|
15
|
+
* @returns RefObject<boolean>
|
|
16
|
+
* @version 0.0.4
|
|
17
|
+
* @see https://earthnut.dev/custom-hooks/use-input-is-composing
|
|
18
|
+
* @example
|
|
19
|
+
*
|
|
20
|
+
* 使用:
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { useInputIsComposing } from 'earthnut';
|
|
24
|
+
*
|
|
25
|
+
* ...
|
|
26
|
+
* const inputRef = useRef<HTMLInputElement>(null);
|
|
27
|
+
*
|
|
28
|
+
* const inputIsComposing = useInputIsComposing(inputRef);
|
|
29
|
+
* ...
|
|
30
|
+
* function enterDown(e: React.KeyboardEvent<HTMLInputElement>) {
|
|
31
|
+
* if (e.key === 'Enter') {
|
|
32
|
+
* if (isComposing.current) {
|
|
33
|
+
* console.log("此时此景,按回车键说明为了从候选词中挑选");
|
|
34
|
+
* } else {
|
|
35
|
+
* console.log("输入完毕,敲回车是为了看一些开发者是否绑定了其他事件");
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
* }
|
|
39
|
+
* ...
|
|
40
|
+
* <input type="text" onKeyDown={enterDown} ref={inputRef} />
|
|
41
|
+
* ...
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function useInputIsComposing(inputRef: RefObject<HTMLInputElement | HTMLTextAreaElement | null>): RefObject<boolean>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@customHooks/useRipples/buildBackground/create-background-color.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
import { Ripples } from '../ripplesClass';
|
|
8
|
+
/** 构建背景色 */
|
|
9
|
+
export declare function createBackgroundColor(this: Ripples): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@customHooks/useRipples/buildBackground/create-linear-gradient.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
import { Ripples } from '../ripplesClass';
|
|
8
|
+
/** 构建渐变背景色图 */
|
|
9
|
+
export declare function createLinearGradient(this: Ripples): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@customHooks/useRipples/buildBackground/default-background/_createImageData.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
import { Ripples } from '../../ripplesClass';
|
|
8
|
+
/**
|
|
9
|
+
* 创建一个隐含像素数据的区域
|
|
10
|
+
*
|
|
11
|
+
* 用于构建默认的背景图
|
|
12
|
+
*/
|
|
13
|
+
export declare function createImageData(this: Ripples, bindImage: () => void): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@customHooks/useRipples/buildBackground/default-background/circleDataList.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
/** 圆数据 */
|
|
8
|
+
export declare const circleDataList: {
|
|
9
|
+
/** 计数器 */
|
|
10
|
+
#cum: number;
|
|
11
|
+
/** 构建新的数据依据 */
|
|
12
|
+
build(darkMode: boolean): void;
|
|
13
|
+
/** 数据依据 */
|
|
14
|
+
data: {
|
|
15
|
+
/** 数据 */
|
|
16
|
+
list: [number, number, number, number][][];
|
|
17
|
+
/** 直径 */
|
|
18
|
+
diameter: number;
|
|
19
|
+
/** 半径 */
|
|
20
|
+
radius: number;
|
|
21
|
+
/** 晶格数 */
|
|
22
|
+
cells: number;
|
|
23
|
+
};
|
|
24
|
+
};
|
package/customHooks/useRipples/buildBackground/default-background/createCanvasElementBySize.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@customHooks/useRipples/buildBackground/default-background/createCanvasElementBySize.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
/** 通过尺寸创建一个默认图 */
|
|
8
|
+
export declare function createCanvasElementBySize(width: number, height: number): HTMLCanvasElement;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@customHooks/useRipples/buildBackground/default-background/createDefault.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
/** 构建默认的背景图 */
|
|
8
|
+
export declare function createDefault(width: number, height: number): ImageData;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@customHooks/useRipples/buildBackground/default-background/index.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
import { Ripples } from '../../ripplesClass';
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* 设置透明的纹理
|
|
11
|
+
*
|
|
12
|
+
*
|
|
13
|
+
* 透明的纹理*默认会自动切换*
|
|
14
|
+
*
|
|
15
|
+
* @param [executeImmediately=true] 立即执行
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export declare function setTransparentTexture(this: Ripples, executeImmediately?: boolean): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license MIT
|
|
3
|
+
* earthnut@customHooks/useRipples/buildBackground/load-image.d.ts
|
|
4
|
+
* Copyright (c) 2025 earthnut.dev
|
|
5
|
+
* 请在项目根参看详细许可证明
|
|
6
|
+
*/
|
|
7
|
+
import { Ripples } from '../ripplesClass';
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* 加载图像
|
|
11
|
+
*
|
|
12
|
+
* - 初始化的时候首先触发加载背景图像
|
|
13
|
+
* - 通过 Ripple 的 set 方法设置属性 imgUrl 值时将触发
|
|
14
|
+
* - 尺寸发生变化时亦将触发更改
|
|
15
|
+
* - 父元素的样式属性发生变更时也会触发
|
|
16
|
+
*
|
|
17
|
+
* 在加载过程中如果渲染的图片为非法的(加载错误)那么将查找当前的背景色或是背景图作为依据,再就是都没有的情况下将会渲染一个类似于旧地板的色
|
|
18
|
+
*/
|
|
19
|
+
export declare function loadImage(this: Ripples): void;
|