neko-ui 2.0.0-beta.9 → 2.0.1

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.
Files changed (68) hide show
  1. package/README.md +17 -27
  2. package/lib/avatar/group.d.ts +21 -0
  3. package/lib/avatar/index.d.ts +15 -24
  4. package/lib/back-top/index.d.ts +15 -26
  5. package/lib/back-top/style.d.ts +1 -0
  6. package/lib/basic-config/index.d.ts +90 -0
  7. package/lib/button/index.d.ts +18 -31
  8. package/lib/capture-screen/index.d.ts +11 -24
  9. package/lib/carousel/index.d.ts +14 -22
  10. package/lib/checkbox/index.d.ts +50 -29
  11. package/lib/checkbox/style.d.ts +1 -0
  12. package/lib/code/index.d.ts +16 -28
  13. package/lib/code/style.d.ts +1 -0
  14. package/lib/color-palette/index.d.ts +12 -25
  15. package/lib/color-picker/index.d.ts +15 -25
  16. package/lib/cron/begin-interval.d.ts +15 -0
  17. package/lib/cron/day.d.ts +3 -0
  18. package/lib/cron/hour.d.ts +3 -0
  19. package/lib/cron/index.d.ts +56 -0
  20. package/lib/cron/item.d.ts +10 -0
  21. package/lib/cron/minute.d.ts +3 -0
  22. package/lib/cron/month.d.ts +3 -0
  23. package/lib/cron/period.d.ts +14 -0
  24. package/lib/cron/second.d.ts +3 -0
  25. package/lib/cron/some.d.ts +12 -0
  26. package/lib/cron/style.d.ts +2 -0
  27. package/lib/cron/week.d.ts +3 -0
  28. package/lib/cron/year.d.ts +3 -0
  29. package/lib/dropdown/index.d.ts +15 -60
  30. package/lib/empty/index.d.ts +10 -25
  31. package/lib/from-schema/index.d.ts +26 -1
  32. package/lib/get-options/index.d.ts +2 -25
  33. package/lib/highlight-text/index.d.ts +18 -44
  34. package/lib/img/index.d.ts +13 -21
  35. package/lib/index.d.ts +72 -26
  36. package/lib/index.js +15 -2
  37. package/lib/input/index.d.ts +26 -27
  38. package/lib/input/style.d.ts +1 -0
  39. package/lib/input-number/index.d.ts +22 -23
  40. package/lib/katex/index.d.ts +50 -0
  41. package/lib/md/index.d.ts +24 -42
  42. package/lib/md/style.d.ts +1 -0
  43. package/lib/menu/index.d.ts +61 -0
  44. package/lib/menu/style.d.ts +1 -0
  45. package/lib/pkg.tsbuildinfo +1 -1
  46. package/lib/popover/index.d.ts +53 -35
  47. package/lib/radio/index.d.ts +18 -24
  48. package/lib/radio/style.d.ts +1 -0
  49. package/lib/segmented/index.d.ts +16 -30
  50. package/lib/segmented/style.d.ts +1 -0
  51. package/lib/select/index.d.ts +26 -44
  52. package/lib/skeleton/index.d.ts +21 -28
  53. package/lib/spin/index.d.ts +11 -25
  54. package/lib/switch/index.d.ts +11 -22
  55. package/lib/switch/style.d.ts +1 -0
  56. package/lib/tabs/index.d.ts +44 -0
  57. package/lib/tabs/style.d.ts +3 -0
  58. package/lib/tag/index.d.ts +27 -0
  59. package/lib/tag/style.d.ts +1 -0
  60. package/lib/theme/index.d.ts +15 -6
  61. package/lib/tree/index.d.ts +70 -89
  62. package/lib/tree/style.d.ts +1 -0
  63. package/lib/typography/index.d.ts +18 -28
  64. package/package.json +25 -23
  65. package/lib/avatar-group/index.d.ts +0 -30
  66. package/lib/code-live/index.d.ts +0 -0
  67. package/lib/highlight/index.d.ts +0 -0
  68. /package/lib/{dropdown → avatar}/style.d.ts +0 -0
package/README.md CHANGED
@@ -1,15 +1,17 @@
1
1
  # Neko UI
2
2
 
3
- > UI组件库
4
-
5
3
  [![version][version-tag]][npm-url]
6
4
  [![install size][size-tag]][size-url]
7
5
  [![download][download-tag]][npm-url]
8
6
 
9
- ## 使用
7
+ > 这是一个适用于任何技术栈的 WebComponents UI组件库
10
8
 
11
9
  [![neko-ui][install-tag]][npm-url]
12
10
 
11
+ [![docs-ui][docs-tag]][docs-url]
12
+
13
+ [docs-url]: https://monako97.github.io/neko-ui
14
+ [docs-tag]: https://cdn.staticaly.com/gh/monako97/cdn/main/image/202307281701250.svg
13
15
  [npm-url]: https://npmjs.org/package/neko-ui
14
16
  [install-tag]: https://nodei.co/npm/neko-ui.png
15
17
  [version-tag]: https://img.shields.io/npm/v/neko-ui/latest.svg?logo=npm
@@ -17,40 +19,28 @@
17
19
  [size-url]: https://packagephobia.com/result?p=neko-ui@latest
18
20
  [download-tag]: https://img.shields.io/npm/dm/neko-ui.svg?logo=docusign
19
21
 
20
- > 这是一个适用于任何技术栈的 WebComponents 组件库
21
-
22
- ## 安装依赖
22
+ ## 安装 (npm)
23
23
 
24
24
  ```shell
25
- npm install
25
+ npm install neko-ui -S
26
26
  # or
27
- yarn install
27
+ yarn add neko-ui -S
28
28
  ```
29
29
 
30
- ## 启动项目
30
+ ### 使用 (npm)
31
31
 
32
- ```shell
33
- npm start
34
- # or
35
- yarn start
32
+ ```html
33
+ <n-button>按钮</n-button>
36
34
  ```
37
35
 
38
- ## 打包项目
36
+ ## 安装 (umd)
39
37
 
40
- ```shell
41
- npm run build
42
- # or
43
- yarn build
38
+ ```html
39
+ <script src="https://cdn.staticaly.com/gh/monako97/cdn/main/npm/neko-ui/2.0.1/lib/index.js"></script>
44
40
  ```
45
41
 
46
- ## 打包项目`使用自定义配置`
47
-
48
- > 在打包其它有特殊配置的bundle时, 可以通过命令行参数来加载额外的配置文件;
49
-
50
- 例如: 使用 **config/index.ts** 与 **config/prod.ts** 合并后的配置进行编译.
42
+ ### 使用 (umd)
51
43
 
52
- ```shell
53
- npm run build --config=prod
54
- # or
55
- yarn build config=prod
44
+ ```html
45
+ <n-button>按钮</n-button>
56
46
  ```
@@ -0,0 +1,21 @@
1
+ import { type JSX } from 'solid-js';
2
+ import '../popover';
3
+ import type { BasicConfig, CustomElement } from '..';
4
+ import type { AvatarProps } from '../avatar';
5
+ export interface AvatarGroupProps extends Omit<JSX.ButtonHTMLAttributes<HTMLDivElement>, 'onChange' | 'ref'> {
6
+ /** 头像数据 */
7
+ data: Omit<AvatarProps, 'size'>[];
8
+ /** 头像尺寸
9
+ * @default 'normal'
10
+ */
11
+ size?: BasicConfig['size'];
12
+ /** 最多显示个数 */
13
+ maxCount?: number;
14
+ /** 自定义类名 */
15
+ class?: string;
16
+ /** 自定义样式表 */
17
+ css?: string;
18
+ }
19
+ export type AvatarGroupElement = CustomElement<AvatarGroupProps>;
20
+ declare function AvatarGroup(_props: AvatarGroupProps): JSX.Element;
21
+ export default AvatarGroup;
@@ -1,32 +1,23 @@
1
- import type { ComponentSize } from '../index';
2
- export interface AvatarProps {
1
+ import { type JSX } from 'solid-js';
2
+ import type { BasicConfig, CustomElement } from '../index';
3
+ export interface AvatarProps extends Omit<JSX.ButtonHTMLAttributes<HTMLDivElement>, 'onChange' | 'ref' | 'children'> {
4
+ /** 头像 */
3
5
  src?: string;
6
+ /** 替代文本 */
4
7
  alt?: string;
5
- size?: number | ComponentSize;
8
+ /** 尺寸
9
+ * @default 'normal'
10
+ */
11
+ size?: number | BasicConfig['size'];
12
+ /** 用户名 */
6
13
  username?: string;
14
+ /** 背景颜色 */
7
15
  color?: string;
16
+ /** 自定义类名 */
8
17
  class?: string;
18
+ /** 自定义样式表 */
9
19
  css?: string;
10
20
  }
11
- declare function Avatar(_props: AvatarProps): import("solid-js").JSX.Element;
12
- export interface AvatarElement extends AvatarProps {
13
- ref?: AvatarElement | {
14
- current: AvatarElement | null;
15
- };
16
- }
17
- interface CustomElementTags {
18
- 'n-avatar': AvatarElement;
19
- }
20
- declare module 'solid-js' {
21
- namespace JSX {
22
- interface IntrinsicElements extends HTMLElementTags, CustomElementTags {
23
- }
24
- }
25
- }
26
- declare global {
27
- export namespace JSX {
28
- interface IntrinsicElements extends CustomElementTags, CustomElementTags {
29
- }
30
- }
31
- }
21
+ export type AvatarElement = CustomElement<AvatarProps>;
22
+ declare function Avatar(_: AvatarProps): JSX.Element;
32
23
  export default Avatar;
@@ -1,32 +1,21 @@
1
- export interface BackTopProps {
2
- /** 设置需要监听其滚动事件的元素,值为一个selectors */
3
- target?: HTMLElement;
4
- /** 挂载到指定的元素,值为一个selectors 默认 body */
1
+ import { type JSX } from 'solid-js';
2
+ import type { CustomElement } from '..';
3
+ export interface BackTopProps extends Omit<JSX.ButtonHTMLAttributes<HTMLDivElement>, 'onChange'> {
4
+ /** 设置需要监听其滚动事件的元素
5
+ * @default window
6
+ */
7
+ target?: HTMLElement | (() => HTMLElement);
8
+ /** 挂载到指定的元素
9
+ * @default body
10
+ */
5
11
  mount?: HTMLElement;
6
12
  /** 滚动高度达到此参数值才出现 BackTop */
7
13
  visibilityHeight?: number;
8
- css?: string;
14
+ /** 自定义类名 */
9
15
  class?: string;
16
+ /** 自定义样式表 */
17
+ css?: string;
10
18
  }
11
- declare function BackTop(_props: BackTopProps): import("solid-js").JSX.Element;
12
- export interface BackTopElement extends BackTopProps {
13
- ref?: BackTopElement | {
14
- current: BackTopElement | null;
15
- };
16
- }
17
- interface CustomElementTags {
18
- 'n-back-top': BackTopElement;
19
- }
20
- declare module 'solid-js' {
21
- namespace JSX {
22
- interface IntrinsicElements extends HTMLElementTags, CustomElementTags {
23
- }
24
- }
25
- }
26
- declare global {
27
- export namespace JSX {
28
- interface IntrinsicElements extends CustomElementTags, CustomElementTags {
29
- }
30
- }
31
- }
19
+ declare function BackTop(_: BackTopProps): JSX.Element;
20
+ export type BackTopElement = CustomElement<BackTopProps>;
32
21
  export default BackTop;
@@ -0,0 +1 @@
1
+ export declare const style: string;
@@ -0,0 +1,90 @@
1
+ import type { JSXElement } from 'solid-js';
2
+ import type { ICustomElement } from 'component-register';
3
+ export interface BasicConfig {
4
+ /** 组件状态
5
+ * @default 'normal'
6
+ */
7
+ status: keyof typeof Status;
8
+ /** 组件尺寸
9
+ * @default 'normal'
10
+ */
11
+ size: keyof typeof Size;
12
+ /** 自定义 'label'、'value'、'options' 等映射的key */
13
+ fieldName: Partial<{
14
+ [key in keyof typeof FieldName]: string;
15
+ }>;
16
+ }
17
+ export declare enum Size {
18
+ /** 小 */
19
+ small = "small",
20
+ /** 默认: 中 */
21
+ normal = "normal",
22
+ /** 大 */
23
+ large = "large"
24
+ }
25
+ export declare enum Status {
26
+ /** 默认 */
27
+ normal = "normal",
28
+ /** 成功 */
29
+ success = "success",
30
+ /** 警告 */
31
+ warning = "warning",
32
+ /** 错误 */
33
+ error = "error",
34
+ /** 详细 */
35
+ info = "info",
36
+ /** 主要 */
37
+ primary = "primary"
38
+ }
39
+ export interface BaseOption {
40
+ /** 图标 */
41
+ icon?: JSXElement;
42
+ /** 值 */
43
+ value?: string | number;
44
+ /** 标题 */
45
+ label?: JSXElement;
46
+ /** 不可用状态 */
47
+ disabled?: boolean;
48
+ /** 自定义类名 */
49
+ class?: string;
50
+ /** 自定义样式 */
51
+ style?: Record<string, unknown>;
52
+ /** 选项状态
53
+ * @default 'normal'
54
+ */
55
+ status?: Status;
56
+ /** 分组子选项 */
57
+ options?: (BaseOption | string)[];
58
+ [key: string]: any;
59
+ }
60
+ export declare enum FieldName {
61
+ /** 标题 */
62
+ label = "label",
63
+ /** 值 */
64
+ value = "value",
65
+ /** 分组子选项 */
66
+ options = "options",
67
+ /** 子选项 */
68
+ children = "children",
69
+ /** 图标 */
70
+ icon = "icon",
71
+ /** 后缀图标 */
72
+ suffix = "suffix"
73
+ }
74
+ type IEvent<T> = (e: CustomEvent<T>) => void;
75
+ type ICustomEvent<T, K extends keyof T> = T extends {
76
+ [key in K]?: (v: infer V) => void;
77
+ } ? IEvent<V> : T extends {
78
+ [key in K]?: (...args: infer Args) => void;
79
+ } ? IEvent<Args> : never;
80
+ type IOmit<T, Keys extends keyof T> = Omit<T, Keys> & {
81
+ [K in Keys]?: ICustomEvent<T, K>;
82
+ };
83
+ export type CustomElement<T extends Partial<ICustomElement> = ICustomElement> = IOmit<T, 'onChange' | 'onOpenChange' | 'onErrorRecorder' | 'onStopRecorder' | 'onStartRecorder' | 'onRecorderDataAvailable' | 'onErrorCapture' | 'onStopCapture' | 'onStartCapture' | 'onSaveRecorder'> & {
84
+ ref?: CustomElement<T> | {
85
+ current: CustomElement<T> | null;
86
+ };
87
+ shadowRoot?: ShadowRoot | Element | null;
88
+ offsetWidth?: number;
89
+ };
90
+ export {};
@@ -1,9 +1,12 @@
1
- import { type JSXElement } from 'solid-js';
2
- import { type ComponentSize } from '../index';
3
- export type ButtonType = 'success' | 'error' | 'primary' | 'warning' | 'default';
4
- export interface ButtonProps extends Partial<Omit<HTMLButtonElement, 'type' | 'children'>> {
1
+ import { type JSX } from 'solid-js';
2
+ import type { BasicConfig, CustomElement } from '../index';
3
+ export interface ButtonProps extends Omit<JSX.ButtonHTMLAttributes<HTMLButtonElement>, 'type' | 'ref'> {
4
+ /** 自定义类名 */
5
+ class?: string;
6
+ /** 自定义样式表 */
7
+ css?: string;
5
8
  /** 按钮类型 */
6
- type?: ButtonType;
9
+ type?: 'success' | 'error' | 'primary' | 'warning' | 'default';
7
10
  /** 透明背景 */
8
11
  ghost?: boolean;
9
12
  /** 实色背景 */
@@ -22,31 +25,15 @@ export interface ButtonProps extends Partial<Omit<HTMLButtonElement, 'type' | 'c
22
25
  link?: boolean;
23
26
  /** 危险按钮 */
24
27
  danger?: boolean;
25
- size?: ComponentSize;
26
- onClick?: HTMLButtonElement['onclick'];
27
- class?: string;
28
- css?: string;
29
- children?: JSXElement;
30
- }
31
- declare function Button(_: ButtonProps): import("solid-js").JSX.Element;
32
- export interface ButtonElement extends ButtonProps {
33
- ref?: ButtonElement | {
34
- current: ButtonElement | null;
35
- };
36
- }
37
- interface CustomElementTags {
38
- 'n-button': ButtonElement;
39
- }
40
- declare module 'solid-js' {
41
- namespace JSX {
42
- interface IntrinsicElements extends HTMLElementTags, CustomElementTags {
43
- }
44
- }
45
- }
46
- declare global {
47
- export namespace JSX {
48
- interface IntrinsicElements extends CustomElementTags, CustomElementTags {
49
- }
50
- }
28
+ /** 按钮尺寸
29
+ * @default 'normal'
30
+ */
31
+ size?: BasicConfig['size'];
32
+ /** 按钮前面添加一个图标 */
33
+ icon?: (() => JSX.Element) | JSX.Element;
34
+ /** 按键抬起 */
35
+ onKeyUp?(e: KeyboardEvent): void;
51
36
  }
37
+ export type ButtonElement = CustomElement<ButtonProps>;
38
+ declare function Button(_: ButtonProps): JSX.Element;
52
39
  export default Button;
@@ -1,9 +1,15 @@
1
+ import { type JSX } from 'solid-js';
2
+ import type { CustomElement } from '../index';
1
3
  declare interface MediaRecorderDataAvailableEvent extends Event {
4
+ /** MediaRecorderDataAvailableEvent */
2
5
  data: any;
3
6
  }
4
- export interface CaptureScreenProps {
7
+ export interface CaptureScreenProps extends JSX.ButtonHTMLAttributes<HTMLDivElement> {
8
+ /** 自定义类名 */
5
9
  class?: string;
10
+ /** 自定义样式表 */
6
11
  css?: string;
12
+ /** MediaStreamConstraints */
7
13
  options?: MediaStreamConstraints;
8
14
  /** 是否预览 */
9
15
  preview?: boolean;
@@ -26,7 +32,7 @@ export interface CaptureScreenProps {
26
32
  /** 录制中按钮文字 */
27
33
  recorderingText?: string;
28
34
  /** 录制错误回调方法 */
29
- onErrorRecorder?: MediaRecorder['onerror'];
35
+ onErrorRecorder?: (e: Event) => void;
30
36
  /** 停止录制回调方法 */
31
37
  onStopRecorder?: () => void;
32
38
  /** 开始录制回调方法 */
@@ -34,7 +40,7 @@ export interface CaptureScreenProps {
34
40
  /** 记录媒体时触发 */
35
41
  onRecorderDataAvailable?: (e: MediaRecorderDataAvailableEvent) => void;
36
42
  /** 捕获屏幕错误回调方法 */
37
- onErrorCapture?: (err: any) => void;
43
+ onErrorCapture?: (err: unknown) => void;
38
44
  /** 停止捕获屏幕回调方法 */
39
45
  onStopCapture?: () => void;
40
46
  /** 开始捕获屏幕回调方法 */
@@ -42,25 +48,6 @@ export interface CaptureScreenProps {
42
48
  /** 自定义保存录制文件方法 */
43
49
  onSaveRecorder?: (blob: Blob, fileName: string) => void;
44
50
  }
45
- declare function CaptureScreen(_: CaptureScreenProps): import("solid-js").JSX.Element;
46
- export interface CaptureScreenElement extends CaptureScreenProps {
47
- ref?: CaptureScreenElement | {
48
- current: CaptureScreenElement | null;
49
- };
50
- }
51
- interface CustomElementTags {
52
- 'n-capture-screen': CaptureScreenElement;
53
- }
54
- declare module 'solid-js' {
55
- namespace JSX {
56
- interface IntrinsicElements extends HTMLElementTags, CustomElementTags {
57
- }
58
- }
59
- }
60
- declare global {
61
- export namespace JSX {
62
- interface IntrinsicElements extends CustomElementTags, CustomElementTags {
63
- }
64
- }
65
- }
51
+ export type CaptureScreenElement = CustomElement<CaptureScreenProps>;
52
+ declare function CaptureScreen(_: CaptureScreenProps): JSX.Element;
66
53
  export default CaptureScreen;
@@ -1,33 +1,25 @@
1
1
  import { type JSXElement } from 'solid-js';
2
+ import type { CustomElement } from '../index';
2
3
  export interface CarouselProps {
4
+ /** 自定义类名 */
3
5
  class?: string;
6
+ /** 自定义样式表 */
4
7
  css?: string;
8
+ /** 轮播的内容 */
5
9
  children?: JSXElement[];
10
+ /** 当前内容的位置
11
+ * @default 0
12
+ */
6
13
  offset?: number;
14
+ /** 开启指示器 */
7
15
  dots?: boolean;
16
+ /** 设置自动播放时长, 不设置时不自动播放 */
8
17
  autoplay?: number;
9
- header?: HTMLElement;
10
- onChange?(e: number): void;
18
+ /** 自定义头部 */
19
+ header?: (current: number) => JSXElement | ((current: number) => JSXElement);
20
+ /** 切换显示的位置时的回调方法 */
21
+ onChange?: (e: number) => void;
11
22
  }
23
+ export type CarouselElement = CustomElement<CarouselProps>;
12
24
  declare function Carousel(_props: CarouselProps): import("solid-js").JSX.Element;
13
- export interface CarouselElement extends CarouselProps {
14
- ref?: CarouselElement | {
15
- current: CarouselElement | null;
16
- };
17
- }
18
- interface CustomElementTags {
19
- 'n-carousel': CarouselElement;
20
- }
21
- declare module 'solid-js' {
22
- namespace JSX {
23
- interface IntrinsicElements extends HTMLElementTags, CustomElementTags {
24
- }
25
- }
26
- }
27
- declare global {
28
- export namespace JSX {
29
- interface IntrinsicElements extends CustomElementTags, CustomElementTags {
30
- }
31
- }
32
- }
33
25
  export default Carousel;
@@ -1,39 +1,60 @@
1
- import { type BaseOption, type FieldNames } from '../get-options';
2
- export interface CheckboxOption extends Omit<BaseOption, 'danger' | 'icon'> {
3
- indeterminate?: boolean;
4
- }
5
- export interface CheckboxProps {
1
+ import { type BaseOption, type BasicConfig, type CustomElement } from '../basic-config';
2
+ /** 通用API
3
+ * @since 1.0.0
4
+ */
5
+ export interface CheckboxBaseProps {
6
+ /** 自定义类名 */
6
7
  class?: string;
8
+ /** 自定义样式表 */
7
9
  css?: string;
10
+ /** input[type="checkbox"] 的 name 属性 */
8
11
  name?: string;
12
+ /** 只读 */
9
13
  disabled?: boolean;
10
- checkAll?: boolean;
11
- value?: string[];
12
- options: (CheckboxOption | string)[];
13
- onChange: (val: string[]) => void;
14
+ /** 选项排列方式
15
+ * @default 'horizontal'
16
+ */
14
17
  layout?: 'vertical' | 'horizontal';
15
- fieldNames?: Partial<FieldNames>;
18
+ /** 自定义节点 'label'、'value'、'options' 的字段 */
19
+ fieldNames?: BasicConfig['fieldName'];
16
20
  }
17
- declare function Checkbox(props: CheckboxProps): import("solid-js").JSX.Element;
18
- export interface CheckboxElement extends Omit<CheckboxProps, 'onChange'> {
19
- ref?: CheckboxElement | {
20
- current: CheckboxElement | null;
21
- };
22
- onChange?(val: CustomEvent<any[]>): void;
21
+ /** 复选框API */
22
+ export interface CheckboxBoolProps extends CheckboxBaseProps {
23
+ /** 一个 bool 值; */
24
+ value?: boolean;
25
+ /** 默认值 */
26
+ defaultValue?: boolean;
27
+ /** 值修改时的回调方法 */
28
+ onChange?: (val: boolean) => void;
29
+ checkAll?: never;
30
+ options?: never;
23
31
  }
24
- interface CustomElementTags {
25
- 'n-checkbox': CheckboxElement;
26
- }
27
- declare module 'solid-js' {
28
- namespace JSX {
29
- interface IntrinsicElements extends HTMLElementTags, CustomElementTags {
30
- }
31
- }
32
+ /** 通过数据渲染一组复选框按钮的API */
33
+ export interface CheckboxGroupProps extends CheckboxBaseProps {
34
+ /** 全选 */
35
+ checkAll?: boolean;
36
+ /** 值;
37
+ * 当设置了value时, 将是受控模式;
38
+ * 受控模式可通过 onChange 事件更新 value
39
+ **/
40
+ value?: (string | number)[];
41
+ /** 默认值 */
42
+ defaultValue?: (string | number)[];
43
+ /** 渲染选项所使用的数据,
44
+ * 当没有设置该值时, 将渲染一个切换 bool 值的按钮
45
+ * */
46
+ options?: (CheckboxOption | string)[];
47
+ /** 值修改时的回调方法 */
48
+ onChange?: (val: (string | number)[]) => void;
32
49
  }
33
- declare global {
34
- export namespace JSX {
35
- interface IntrinsicElements extends CustomElementTags, CustomElementTags {
36
- }
37
- }
50
+ /** 复选框选项
51
+ * @since 1.0.0
52
+ */
53
+ export interface CheckboxOption extends BaseOption {
54
+ /** 不确定状态 */
55
+ indeterminate?: boolean;
38
56
  }
57
+ declare function Checkbox(props: CheckboxBoolProps | CheckboxGroupProps): import("solid-js").JSX.Element;
58
+ export type CheckboxGroupElement = CustomElement<CheckboxGroupProps>;
59
+ export type CheckboxBoolElement = CustomElement<CheckboxBoolProps>;
39
60
  export default Checkbox;
@@ -0,0 +1 @@
1
+ export declare const style: string;
@@ -1,35 +1,23 @@
1
- import { type JSXElement } from 'solid-js';
2
- export interface CodeProps {
1
+ import { type JSX } from 'solid-js';
2
+ import type { CustomElement } from '..';
3
+ export interface CodeProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, 'onChange'> {
4
+ /** 自定义类名 */
3
5
  class?: string;
6
+ /** 自定义样式表 */
7
+ css?: string;
8
+ /** 内容 */
4
9
  code?: string;
10
+ /** 语言 */
5
11
  lang?: string;
6
- css?: string;
12
+ /** 显示代码行号 */
7
13
  lineNumber?: boolean;
8
- children?: JSXElement;
9
- edit?: boolean | 'true' | 'false';
14
+ /** 支持编辑 */
15
+ edit?: boolean;
16
+ /** 开启代码块工具条 */
10
17
  toolbar?: boolean;
11
- onChange?(code: string): void;
12
- }
13
- declare function Code(props: CodeProps): import("solid-js").JSX.Element;
14
- export interface CodeElement extends Omit<CodeProps, 'onChange'> {
15
- ref?: CodeElement | {
16
- current: CodeElement | null;
17
- };
18
- onChange?(event: CustomEvent<string>): void;
19
- }
20
- interface CustomElementTags {
21
- 'n-code': CodeElement;
22
- }
23
- declare module 'solid-js' {
24
- namespace JSX {
25
- interface IntrinsicElements extends HTMLElementTags, CustomElementTags {
26
- }
27
- }
28
- }
29
- declare global {
30
- export namespace JSX {
31
- interface IntrinsicElements extends CustomElementTags, CustomElementTags {
32
- }
33
- }
18
+ /** 编辑修改时的回调 */
19
+ onChange?: (code: string) => void;
34
20
  }
21
+ export type CodeElement = CustomElement<CodeProps>;
22
+ declare function Code(props: CodeProps): JSX.Element;
35
23
  export default Code;
@@ -0,0 +1 @@
1
+ export declare const style: string;
@@ -1,37 +1,24 @@
1
+ import { type JSX } from 'solid-js';
1
2
  import '../dropdown';
2
- import { type CSSProperties } from '../index';
3
3
  import '../input';
4
4
  import '../input-number';
5
- export interface ColorPaletteProps {
6
- style?: CSSProperties;
5
+ import type { CustomElement } from '../index';
6
+ export interface ColorPaletteProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, 'onChange'> {
7
+ /** 自定义类名 */
7
8
  class?: string;
9
+ /** 自定义样式表 */
8
10
  css?: string;
11
+ /** 颜色值 */
9
12
  value?: string;
13
+ /** 默认值
14
+ * @default '#5794ff'
15
+ */
10
16
  defaultValue?: string;
17
+ /** 变更时触发的方法 */
11
18
  onChange?: (color: string) => void;
12
19
  }
13
- declare function ColorPalette(props: ColorPaletteProps): import("solid-js").JSX.Element;
14
- export interface ColorPaletteElement extends Omit<ColorPaletteProps, 'onChange'> {
15
- ref?: ColorPaletteElement | {
16
- current: ColorPaletteElement | null;
17
- };
18
- onChange?(e: CustomEvent<string | undefined>): void;
19
- }
20
- interface CustomElementTags {
21
- 'n-color-palette': ColorPaletteElement;
22
- }
23
- declare module 'solid-js' {
24
- namespace JSX {
25
- interface IntrinsicElements extends HTMLElementTags, CustomElementTags {
26
- }
27
- }
28
- }
29
- declare global {
30
- export namespace JSX {
31
- interface IntrinsicElements extends CustomElementTags, CustomElementTags {
32
- }
33
- }
34
- }
20
+ export type ColorPaletteElement = CustomElement<ColorPaletteProps>;
21
+ declare function ColorPalette(_: ColorPaletteProps): JSX.Element;
35
22
  export declare const defaultColorPaletteProps: {
36
23
  class: undefined;
37
24
  style: undefined;