antd-solid 0.0.11 → 0.0.13
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/css/index.css +10 -73
- package/dist/index.esm.js +7802 -2378
- package/dist/index.umd.js +1 -1
- package/es/Alert/index.d.ts +10 -0
- package/es/Alert/index.js +26 -0
- package/es/Button/index.d.ts +32 -0
- package/es/Button/index.js +123 -0
- package/es/Button/index.scss.js +6 -0
- package/es/Checkbox/Group.d.ts +19 -0
- package/es/Checkbox/Group.js +49 -0
- package/es/Checkbox/index.d.ts +15 -0
- package/es/Checkbox/index.js +60 -0
- package/es/CodeInput/index.d.ts +18 -0
- package/es/CodeInput/index.js +72 -0
- package/es/Collapse/Item.d.ts +46 -0
- package/es/Collapse/Item.js +130 -0
- package/es/Collapse/context.d.ts +5 -0
- package/es/Collapse/context.js +8 -0
- package/es/Collapse/index.d.ts +25 -10
- package/es/Collapse/index.js +95 -74
- package/es/Collapse/utils.d.ts +8 -0
- package/es/Collapse/utils.js +35 -0
- package/es/ColorPicker/ColorPickerInput.d.ts +3 -0
- package/es/ColorPicker/ColorPickerInput.js +250 -0
- package/es/ColorPicker/ColorPickerSelect.d.ts +3 -0
- package/es/ColorPicker/ColorPickerSelect.js +71 -0
- package/es/ColorPicker/ColorPickerSlider.d.ts +3 -0
- package/es/ColorPicker/ColorPickerSlider.js +115 -0
- package/es/ColorPicker/color.d.ts +24 -0
- package/es/ColorPicker/color.js +63 -0
- package/es/ColorPicker/context.d.ts +9 -0
- package/es/ColorPicker/context.js +5 -0
- package/es/ColorPicker/index.d.ts +31 -0
- package/es/ColorPicker/index.js +139 -0
- package/es/Command/context.d.ts +9 -0
- package/es/Command/context.js +11 -0
- package/es/Command/createCommand.d.ts +17 -0
- package/es/Command/createCommand.js +112 -0
- package/es/Command/index.d.ts +7 -0
- package/es/Command/index.js +9 -0
- package/es/Command/useCommandProps.d.ts +13 -0
- package/es/Command/useCommandProps.js +28 -0
- package/es/Compact/CompactContextIsolator.d.ts +3 -0
- package/es/Compact/CompactContextIsolator.js +15 -0
- package/es/Compact/context.d.ts +4 -0
- package/es/Compact/context.js +7 -0
- package/es/Compact/index.d.ts +14 -0
- package/es/Compact/index.js +32 -0
- package/es/Compact/index.scss.js +6 -0
- package/es/ConfigProvider/context.d.ts +11 -0
- package/es/ConfigProvider/context.js +15 -0
- package/es/ConfigProvider/dark/colorAlgorithm.d.ts +2 -0
- package/es/ConfigProvider/dark/colorAlgorithm.js +9 -0
- package/es/ConfigProvider/dark/colors.d.ts +3 -0
- package/es/ConfigProvider/dark/colors.js +47 -0
- package/es/ConfigProvider/dark/index.d.ts +2 -0
- package/es/ConfigProvider/dark/index.js +11 -0
- package/es/ConfigProvider/index.d.ts +32 -0
- package/es/ConfigProvider/index.js +44 -0
- package/es/ConfigProvider/light/colorAlgorithm.d.ts +2 -0
- package/es/ConfigProvider/light/colorAlgorithm.js +9 -0
- package/es/ConfigProvider/light/colors.d.ts +3 -0
- package/es/ConfigProvider/light/colors.js +45 -0
- package/es/ConfigProvider/light/index.d.ts +2 -0
- package/es/ConfigProvider/light/index.js +11 -0
- package/es/ConfigProvider/seed.d.ts +3 -0
- package/es/ConfigProvider/seed.js +22 -0
- package/es/ConfigProvider/types/index.d.ts +594 -0
- package/es/ConfigProvider/types/index.js +1 -0
- package/es/ConfigProvider/utils/genColorMapToken.d.ts +7 -0
- package/es/ConfigProvider/utils/genColorMapToken.js +85 -0
- package/es/ConfigProvider/utils/getAlphaColor.d.ts +2 -0
- package/es/ConfigProvider/utils/getAlphaColor.js +44 -0
- package/es/ConfigProvider/utils/index.d.ts +3 -0
- package/es/ConfigProvider/utils/index.js +181 -0
- package/es/ContextMenu/index.d.ts +8 -0
- package/es/ContextMenu/index.js +99 -0
- package/es/Cursor/index.d.ts +6 -0
- package/es/Cursor/index.js +71 -0
- package/es/DelayShow/index.d.ts +16 -0
- package/es/DelayShow/index.js +27 -0
- package/es/Divider/index.d.ts +17 -0
- package/es/Divider/index.js +71 -0
- package/es/Drawer/index.d.ts +20 -16
- package/es/Drawer/index.js +162 -112
- package/es/Drawer/index.scss.js +1 -1
- package/es/Dropdown/index.d.ts +16 -0
- package/es/Dropdown/index.js +47 -0
- package/es/Element/index.d.ts +10 -0
- package/es/Element/index.js +42 -0
- package/es/Empty/PRESENTED_IMAGE_SIMPLE.d.ts +2 -1
- package/es/Empty/PRESENTED_IMAGE_SIMPLE.js +25 -9
- package/es/Empty/assets/EmptySvg.js +1 -1
- package/es/Empty/assets/SimpleEmptySvg.js +1 -1
- package/es/Empty/index.d.ts +9 -3
- package/es/Empty/index.js +24 -9
- package/es/Form/Form.d.ts +8 -5
- package/es/Form/Form.js +50 -34
- package/es/Form/FormItem.d.ts +10 -5
- package/es/Form/FormItem.js +121 -104
- package/es/Form/context.d.ts +9 -9
- package/es/Form/context.js +4 -2
- package/es/Fragment/index.d.ts +4 -0
- package/es/Fragment/index.js +7 -0
- package/es/Image/index.d.ts +10 -0
- package/es/Image/index.js +37 -0
- package/es/Input/TextArea.d.ts +23 -0
- package/es/Input/TextArea.js +84 -0
- package/es/Input/index.d.ts +44 -0
- package/es/Input/index.js +213 -0
- package/es/Input/index.scss.js +6 -0
- package/es/InputNumber/index.d.ts +30 -0
- package/es/InputNumber/index.js +122 -0
- package/es/{InputNumber.test.js → InputNumber/index.test.js} +2 -1
- package/es/Menu/InternalMenu.d.ts +22 -0
- package/es/Menu/InternalMenu.js +196 -0
- package/es/Menu/index.d.ts +75 -0
- package/es/Menu/index.js +64 -0
- package/es/Message/Message.d.ts +9 -0
- package/es/Message/Message.js +34 -0
- package/es/Message/index.d.ts +12 -0
- package/es/Message/index.js +80 -0
- package/es/Message/index.scss.js +6 -0
- package/es/Message/useMessage.d.ts +6 -0
- package/es/Message/useMessage.js +54 -0
- package/es/Modal/index.d.ts +73 -0
- package/es/Modal/index.js +237 -0
- package/es/Modal/index.scss.js +6 -0
- package/es/Modal/useModal.d.ts +5 -0
- package/es/Modal/useModal.js +51 -0
- package/es/Modal/warning.d.ts +5 -0
- package/es/Modal/warning.js +43 -0
- package/es/{Popconfirm.d.ts → Popconfirm/index.d.ts} +2 -2
- package/es/Popconfirm/index.js +62 -0
- package/es/{Popover.d.ts → Popover/index.d.ts} +2 -2
- package/es/{Popover.js → Popover/index.js} +7 -12
- package/es/Progress/Circle.d.ts +16 -0
- package/es/Progress/Circle.js +122 -0
- package/es/Progress/index.d.ts +6 -4
- package/es/Progress/index.js +75 -60
- package/es/Radio/Button.d.ts +7 -0
- package/es/Radio/Button.js +72 -0
- package/es/Radio/Group.d.ts +18 -0
- package/es/Radio/Group.js +57 -0
- package/es/Radio/index.d.ts +14 -0
- package/es/Radio/index.js +68 -0
- package/es/RangeInput/index.d.ts +23 -0
- package/es/RangeInput/index.js +208 -0
- package/es/Result/index.js +49 -0
- package/es/Segmented/index.d.ts +10 -7
- package/es/Segmented/index.js +54 -53
- package/es/Select/index.d.ts +17 -0
- package/es/Select/index.js +75 -0
- package/es/SelectInput/index.d.ts +39 -0
- package/es/SelectInput/index.js +245 -0
- package/es/Slider/index.d.ts +47 -0
- package/es/Slider/index.js +177 -0
- package/es/Space/index.d.ts +13 -0
- package/es/Space/index.js +16 -0
- package/es/Spin/index.d.ts +19 -0
- package/es/Spin/index.js +82 -0
- package/es/{Switch.d.ts → Switch/index.d.ts} +9 -0
- package/es/Switch/index.js +41 -0
- package/es/{Table.d.ts → Table/index.d.ts} +6 -2
- package/es/Table/index.js +71 -0
- package/es/Tabs/index.d.ts +49 -0
- package/es/Tabs/index.js +256 -0
- package/es/Timeline/index.js +31 -0
- package/es/Tooltip/context.d.ts +5 -0
- package/es/Tooltip/context.js +5 -0
- package/es/Tooltip/index.d.ts +64 -0
- package/es/Tooltip/index.js +499 -0
- package/es/Transformer/index.d.ts +88 -0
- package/es/Transformer/index.js +882 -0
- package/es/Tree/SingleLevelTree.d.ts +28 -0
- package/es/Tree/SingleLevelTree.js +299 -0
- package/es/Tree/index.d.ts +83 -0
- package/es/Tree/index.js +197 -0
- package/es/TreeFor/index.d.ts +31 -0
- package/es/TreeFor/index.js +80 -0
- package/es/TreeSelect/index.d.ts +26 -0
- package/es/TreeSelect/index.js +98 -0
- package/es/Upload/index.d.ts +64 -0
- package/es/Upload/index.js +112 -0
- package/es/assets/svg/ColorPickUp.d.ts +4 -0
- package/es/assets/svg/ColorPickUp.js +25 -0
- package/es/assets/svg/Crosshair.d.ts +7 -0
- package/es/assets/svg/Crosshair.js +51 -0
- package/es/assets/svg/Resize.d.ts +4 -0
- package/es/assets/svg/Resize.js +25 -0
- package/es/assets/svg/Rotate.d.ts +4 -0
- package/es/assets/svg/Rotate.js +20 -0
- package/es/assets/svg/RotateArrow.d.ts +4 -0
- package/es/assets/svg/RotateArrow.js +21 -0
- package/es/assets/svg/common.d.ts +2 -0
- package/es/assets/svg/common.js +9 -0
- package/es/hooks/createControllableValue.d.ts +1 -1
- package/es/hooks/createControllableValue.js +16 -17
- package/es/hooks/createTransition.d.ts +6 -2
- package/es/hooks/createTransition.js +12 -8
- package/es/hooks/useClickAway.d.ts +1 -1
- package/es/hooks/useClickAway.js +4 -3
- package/es/hooks/useComponentSize.d.ts +3 -0
- package/es/hooks/useComponentSize.js +12 -0
- package/es/hooks/useCounter.d.ts +12 -0
- package/es/hooks/useCounter.js +30 -0
- package/es/hooks/useFocus.d.ts +2 -0
- package/es/hooks/useFocus.js +24 -0
- package/es/hooks/useHover.d.ts +2 -0
- package/es/hooks/useHover.js +33 -0
- package/es/hooks/useLocale.d.ts +1 -0
- package/es/hooks/useLocale.js +11 -0
- package/es/hooks/useMouse.d.ts +1 -0
- package/es/hooks/useMouse.js +18 -0
- package/es/hooks/useScroll.d.ts +2 -0
- package/es/hooks/useScroll.js +29 -0
- package/es/hooks/useSize.d.ts +8 -2
- package/es/hooks/useSize.js +25 -13
- package/es/hooks/useVirtualList.d.ts +14 -0
- package/es/hooks/useVirtualList.js +45 -0
- package/es/index.d.ts +59 -8
- package/es/index.js +53 -23
- package/es/locale/en_US.d.ts +3 -0
- package/es/locale/en_US.js +9 -0
- package/es/locale/index.d.ts +5 -0
- package/es/locale/index.js +1 -0
- package/es/locale/zh_CN.d.ts +3 -0
- package/es/locale/zh_CN.js +9 -0
- package/es/types/index.d.ts +11 -2
- package/es/utils/animation.d.ts +6 -0
- package/es/utils/animation.js +20 -0
- package/es/utils/array.d.ts +2 -1
- package/es/utils/array.js +5 -1
- package/es/utils/domPoint.d.ts +7 -0
- package/es/utils/domPoint.js +11 -0
- package/es/utils/math.d.ts +17 -0
- package/es/utils/math.js +25 -0
- package/es/utils/number.d.ts +1 -0
- package/es/utils/number.js +14 -0
- package/es/utils/setupGlobalDrag.d.ts +10 -0
- package/es/utils/setupGlobalDrag.js +38 -0
- package/es/utils/solid.d.ts +2 -2
- package/es/utils/solid.js +7 -8
- package/package.json +10 -11
- package/es/Button.d.ts +0 -19
- package/es/Button.js +0 -73
- package/es/ColorPicker.d.ts +0 -8
- package/es/ColorPicker.js +0 -6
- package/es/Compact.d.ts +0 -12
- package/es/Compact.js +0 -17
- package/es/DatePicker.d.ts +0 -19
- package/es/DatePicker.js +0 -9
- package/es/Image.d.ts +0 -9
- package/es/Image.js +0 -22
- package/es/Input.d.ts +0 -29
- package/es/Input.js +0 -144
- package/es/InputNumber.d.ts +0 -11
- package/es/InputNumber.js +0 -92
- package/es/Modal.d.ts +0 -48
- package/es/Modal.js +0 -209
- package/es/Popconfirm.js +0 -64
- package/es/Radio.d.ts +0 -27
- package/es/Radio.js +0 -93
- package/es/Result.js +0 -29
- package/es/Select.d.ts +0 -16
- package/es/Select.js +0 -113
- package/es/Skeleton.d.ts +0 -9
- package/es/Skeleton.js +0 -9
- package/es/Spin.d.ts +0 -9
- package/es/Spin.js +0 -22
- package/es/Switch.js +0 -30
- package/es/Table.js +0 -57
- package/es/Tabs.d.ts +0 -17
- package/es/Tabs.js +0 -117
- package/es/Timeline.js +0 -30
- package/es/Tooltip.d.ts +0 -34
- package/es/Tooltip.js +0 -302
- package/es/Tree.d.ts +0 -28
- package/es/Tree.js +0 -198
- package/es/Upload.d.ts +0 -11
- package/es/Upload.js +0 -6
- package/es/hooks/createUpdateEffect.d.ts +0 -5
- package/es/hooks/createUpdateEffect.js +0 -12
- package/es/utils/EventEmitter.d.ts +0 -7
- package/es/utils/EventEmitter.js +0 -13
- package/es/utils/ReactToSolid.d.ts +0 -8
- package/es/utils/ReactToSolid.js +0 -30
- package/es/utils/SolidToReact.d.ts +0 -8
- package/es/utils/SolidToReact.js +0 -23
- package/es/utils/component.d.ts +0 -31
- package/es/utils/component.js +0 -68
- package/es/utils/zh_CN.d.ts +0 -2
- package/es/utils/zh_CN.js +0 -236
- package/src/Button.tsx +0 -128
- package/src/Collapse/index.tsx +0 -86
- package/src/ColorPicker.tsx +0 -11
- package/src/Compact.tsx +0 -15
- package/src/DatePicker.tsx +0 -30
- package/src/Drawer/index.scss +0 -53
- package/src/Drawer/index.tsx +0 -212
- package/src/Empty/PRESENTED_IMAGE_SIMPLE.tsx +0 -15
- package/src/Empty/assets/EmptySvg.tsx +0 -43
- package/src/Empty/assets/SimpleEmptySvg.tsx +0 -16
- package/src/Empty/index.tsx +0 -20
- package/src/Form/Form.tsx +0 -94
- package/src/Form/FormItem.tsx +0 -141
- package/src/Form/context.ts +0 -16
- package/src/Form/index.ts +0 -13
- package/src/Image.tsx +0 -29
- package/src/Input.tsx +0 -202
- package/src/InputNumber.test.tsx +0 -46
- package/src/InputNumber.tsx +0 -125
- package/src/Modal.tsx +0 -220
- package/src/Popconfirm.tsx +0 -75
- package/src/Popover.tsx +0 -30
- package/src/Progress/index.tsx +0 -73
- package/src/Radio.tsx +0 -142
- package/src/Result.tsx +0 -38
- package/src/Segmented/index.tsx +0 -95
- package/src/Select.tsx +0 -128
- package/src/Skeleton.tsx +0 -14
- package/src/Spin.tsx +0 -23
- package/src/Switch.tsx +0 -34
- package/src/Table.tsx +0 -53
- package/src/Tabs.tsx +0 -131
- package/src/Timeline.tsx +0 -33
- package/src/Tooltip.tsx +0 -340
- package/src/Tree.tsx +0 -246
- package/src/Upload.tsx +0 -10
- package/src/hooks/createControllableValue.ts +0 -68
- package/src/hooks/createTransition.ts +0 -52
- package/src/hooks/createUpdateEffect.ts +0 -16
- package/src/hooks/index.ts +0 -2
- package/src/hooks/useClickAway.ts +0 -18
- package/src/hooks/useSize.ts +0 -26
- package/src/index.ts +0 -47
- package/src/types/index.ts +0 -5
- package/src/utils/EventEmitter.ts +0 -15
- package/src/utils/ReactToSolid.tsx +0 -38
- package/src/utils/SolidToReact.tsx +0 -27
- package/src/utils/array.ts +0 -21
- package/src/utils/component.tsx +0 -85
- package/src/utils/solid.ts +0 -61
- package/src/utils/zh_CN.ts +0 -236
- /package/es/{InputNumber.test.d.ts → InputNumber/index.test.d.ts} +0 -0
- /package/es/{Result.d.ts → Result/index.d.ts} +0 -0
- /package/es/{Timeline.d.ts → Timeline/index.d.ts} +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createComponent } from 'solid-js/web';
|
|
2
|
+
import { mergeProps } from 'solid-js';
|
|
3
|
+
import cs from 'classnames';
|
|
4
|
+
import Element from '../Element/index.js';
|
|
5
|
+
import './index.scss.js';
|
|
6
|
+
import CompactContext from './context.js';
|
|
7
|
+
|
|
8
|
+
function Compact(_props) {
|
|
9
|
+
const props = mergeProps({
|
|
10
|
+
direction: 'horizontal'
|
|
11
|
+
}, _props);
|
|
12
|
+
return createComponent(Element, {
|
|
13
|
+
get ["class"]() {
|
|
14
|
+
return cs('ant-compact', `ant-compact-${props.direction}`, props.block ? 'flex w-full' : 'inline-flex', props.class);
|
|
15
|
+
},
|
|
16
|
+
get style() {
|
|
17
|
+
return props.style;
|
|
18
|
+
},
|
|
19
|
+
get children() {
|
|
20
|
+
return createComponent(CompactContext.Provider, {
|
|
21
|
+
value: {
|
|
22
|
+
compact: true
|
|
23
|
+
},
|
|
24
|
+
get children() {
|
|
25
|
+
return props.children;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { Compact as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import styleInject from '../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".ant-compact:not(.ant-compact-vertical) > *:not(:first-child) {\n margin-left: -1px;\n}\n.ant-compact.ant-compact-vertical {\n flex-direction: column;\n}\n.ant-compact.ant-compact-vertical > *:not(:first-child) {\n margin-top: -1px;\n}\n\n.ant-compact :hover,\n.ant-compact :focus,\n.ant-compact :focus-within {\n z-index: 10;\n}\n.ant-compact > :not(:first-child).ant-compact-item, .ant-compact > :not(:first-child) .ant-compact-item {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n.ant-compact > :not(:last-child).ant-compact-item, .ant-compact > :not(:last-child) .ant-compact-item {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}";
|
|
4
|
+
styleInject(css_248z);
|
|
5
|
+
|
|
6
|
+
export { css_248z as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Accessor } from 'solid-js';
|
|
2
|
+
import { type CssVariables } from './types';
|
|
3
|
+
import { type Locale } from '../locale';
|
|
4
|
+
declare const ConfigProviderContext: import("solid-js").Context<{
|
|
5
|
+
theme: Accessor<"light" | "dark">;
|
|
6
|
+
cssVariablesClass: string;
|
|
7
|
+
cssVariables: Accessor<CssVariables>;
|
|
8
|
+
componentSize: Accessor<"small" | "middle" | "large">;
|
|
9
|
+
locale: Accessor<Locale>;
|
|
10
|
+
}>;
|
|
11
|
+
export default ConfigProviderContext;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createContext } from 'solid-js';
|
|
2
|
+
import { createCssVariables, getCssVariablesClass } from './utils/index.js';
|
|
3
|
+
import { lightSeedToken } from './seed.js';
|
|
4
|
+
import locale from '../locale/zh_CN.js';
|
|
5
|
+
|
|
6
|
+
const defaultCssVariables = createCssVariables(lightSeedToken);
|
|
7
|
+
const ConfigProviderContext = createContext({
|
|
8
|
+
theme: () => 'light',
|
|
9
|
+
cssVariablesClass: getCssVariablesClass(),
|
|
10
|
+
cssVariables: () => defaultCssVariables,
|
|
11
|
+
componentSize: () => 'middle',
|
|
12
|
+
locale: () => locale
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export { ConfigProviderContext as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TinyColor } from '@ctrl/tinycolor';
|
|
2
|
+
|
|
3
|
+
const getAlphaColor = (baseColor, alpha) => new TinyColor(baseColor).setAlpha(alpha).toRgbString();
|
|
4
|
+
const getSolidColor = (baseColor, brightness) => {
|
|
5
|
+
const instance = new TinyColor(baseColor);
|
|
6
|
+
return instance.lighten(brightness).toHexString();
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { getAlphaColor, getSolidColor };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { generate } from '@ant-design/colors';
|
|
2
|
+
import { getAlphaColor, getSolidColor } from './colorAlgorithm.js';
|
|
3
|
+
|
|
4
|
+
const generateColorPalettes = baseColor => {
|
|
5
|
+
const colors = generate(baseColor, {
|
|
6
|
+
theme: 'dark'
|
|
7
|
+
});
|
|
8
|
+
return {
|
|
9
|
+
1: colors[0],
|
|
10
|
+
2: colors[1],
|
|
11
|
+
3: colors[2],
|
|
12
|
+
4: colors[3],
|
|
13
|
+
5: colors[6],
|
|
14
|
+
6: colors[5],
|
|
15
|
+
7: colors[4],
|
|
16
|
+
8: colors[6],
|
|
17
|
+
9: colors[5],
|
|
18
|
+
10: colors[4]
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
const generateNeutralColorPalettes = (bgBaseColor, textBaseColor) => {
|
|
22
|
+
const colorBgBase = bgBaseColor || '#000';
|
|
23
|
+
const colorTextBase = textBaseColor || '#fff';
|
|
24
|
+
return {
|
|
25
|
+
colorBgBase,
|
|
26
|
+
colorTextBase,
|
|
27
|
+
colorText: getAlphaColor(colorTextBase, 0.85),
|
|
28
|
+
colorTextSecondary: getAlphaColor(colorTextBase, 0.65),
|
|
29
|
+
colorTextTertiary: getAlphaColor(colorTextBase, 0.45),
|
|
30
|
+
colorTextQuaternary: getAlphaColor(colorTextBase, 0.25),
|
|
31
|
+
colorFill: getAlphaColor(colorTextBase, 0.18),
|
|
32
|
+
colorFillSecondary: getAlphaColor(colorTextBase, 0.12),
|
|
33
|
+
colorFillTertiary: getAlphaColor(colorTextBase, 0.08),
|
|
34
|
+
colorFillQuaternary: getAlphaColor(colorTextBase, 0.04),
|
|
35
|
+
colorBgElevated: getSolidColor(colorBgBase, 12),
|
|
36
|
+
colorBgContainer: getSolidColor(colorBgBase, 8),
|
|
37
|
+
colorBgContainerSecondary: getSolidColor(colorBgBase, 12),
|
|
38
|
+
colorBgContainerTertiary: getSolidColor(colorBgBase, 16),
|
|
39
|
+
colorBgLayout: getSolidColor(colorBgBase, 0),
|
|
40
|
+
colorBgSpotlight: getSolidColor(colorBgBase, 26),
|
|
41
|
+
colorBgBlur: getAlphaColor(colorTextBase, 0.04),
|
|
42
|
+
colorBorder: getSolidColor(colorBgBase, 26),
|
|
43
|
+
colorBorderSecondary: getSolidColor(colorBgBase, 19)
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { generateColorPalettes, generateNeutralColorPalettes };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import genColorMapToken from '../utils/genColorMapToken.js';
|
|
2
|
+
import { generateColorPalettes, generateNeutralColorPalettes } from './colors.js';
|
|
3
|
+
|
|
4
|
+
function genDarkColorMapToken (token) {
|
|
5
|
+
return genColorMapToken(token, {
|
|
6
|
+
generateColorPalettes,
|
|
7
|
+
generateNeutralColorPalettes
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { genDarkColorMapToken as default };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ParentProps, type Component } from 'solid-js';
|
|
2
|
+
import { type SeedToken } from './types';
|
|
3
|
+
import { type Locale } from '../locale';
|
|
4
|
+
interface ConfigProviderProps extends ParentProps {
|
|
5
|
+
/**
|
|
6
|
+
* 主题
|
|
7
|
+
* 默认 'light'
|
|
8
|
+
*/
|
|
9
|
+
theme?: 'light' | 'dark';
|
|
10
|
+
token?: SeedToken;
|
|
11
|
+
/**
|
|
12
|
+
* 设置 antd 组件大小
|
|
13
|
+
* 默认 'middle'
|
|
14
|
+
*/
|
|
15
|
+
componentSize?: 'small' | 'middle' | 'large';
|
|
16
|
+
locale?: Locale;
|
|
17
|
+
/**
|
|
18
|
+
* 初始化时样式是否挂载 body 上
|
|
19
|
+
*/
|
|
20
|
+
mountBodyStyle?: boolean;
|
|
21
|
+
}
|
|
22
|
+
declare function useConfig(): {
|
|
23
|
+
theme: import("solid-js").Accessor<"light" | "dark">;
|
|
24
|
+
cssVariablesClass: string;
|
|
25
|
+
cssVariables: import("solid-js").Accessor<import("./types").CssVariables>;
|
|
26
|
+
componentSize: import("solid-js").Accessor<"small" | "middle" | "large">;
|
|
27
|
+
locale: import("solid-js").Accessor<Locale>;
|
|
28
|
+
};
|
|
29
|
+
declare const ConfigProvider: Component<ConfigProviderProps> & {
|
|
30
|
+
useConfig: typeof useConfig;
|
|
31
|
+
};
|
|
32
|
+
export default ConfigProvider;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createComponent } from 'solid-js/web';
|
|
2
|
+
import { mergeProps, untrack, createMemo, onMount, useContext } from 'solid-js';
|
|
3
|
+
import ConfigProviderContext from './context.js';
|
|
4
|
+
import { createCssVariables, getCssVariablesClass } from './utils/index.js';
|
|
5
|
+
import { darkSeedToken, lightSeedToken } from './seed.js';
|
|
6
|
+
|
|
7
|
+
function useConfig() {
|
|
8
|
+
return useContext(ConfigProviderContext);
|
|
9
|
+
}
|
|
10
|
+
const ConfigProvider = _props => {
|
|
11
|
+
const config = useConfig();
|
|
12
|
+
const props = mergeProps({
|
|
13
|
+
theme: untrack(config.theme),
|
|
14
|
+
locale: untrack(config.locale),
|
|
15
|
+
componentSize: 'middle'
|
|
16
|
+
}, _props);
|
|
17
|
+
const mergedToken = createMemo(() => ({
|
|
18
|
+
...(props.theme === 'dark' ? darkSeedToken : lightSeedToken),
|
|
19
|
+
...props.token
|
|
20
|
+
}));
|
|
21
|
+
const cssVariables = createMemo(() => createCssVariables(mergedToken(), props.theme));
|
|
22
|
+
const locale = createMemo(() => props.locale);
|
|
23
|
+
const cssVariablesClass = getCssVariablesClass();
|
|
24
|
+
onMount(() => {
|
|
25
|
+
if (props.mountBodyStyle) {
|
|
26
|
+
document.body.classList.add(cssVariablesClass);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return createComponent(ConfigProviderContext.Provider, {
|
|
30
|
+
value: {
|
|
31
|
+
theme: () => props.theme,
|
|
32
|
+
cssVariablesClass,
|
|
33
|
+
cssVariables,
|
|
34
|
+
componentSize: () => props.componentSize,
|
|
35
|
+
locale
|
|
36
|
+
},
|
|
37
|
+
get children() {
|
|
38
|
+
return props.children;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
ConfigProvider.useConfig = useConfig;
|
|
43
|
+
|
|
44
|
+
export { ConfigProvider as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TinyColor } from '@ctrl/tinycolor';
|
|
2
|
+
|
|
3
|
+
const getAlphaColor = (baseColor, alpha) => new TinyColor(baseColor).setAlpha(alpha).toRgbString();
|
|
4
|
+
const getSolidColor = (baseColor, brightness) => {
|
|
5
|
+
const instance = new TinyColor(baseColor);
|
|
6
|
+
return instance.darken(brightness).toHexString();
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { getAlphaColor, getSolidColor };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { generate } from '@ant-design/colors';
|
|
2
|
+
import { getAlphaColor, getSolidColor } from './colorAlgorithm.js';
|
|
3
|
+
|
|
4
|
+
const generateColorPalettes = baseColor => {
|
|
5
|
+
const colors = generate(baseColor);
|
|
6
|
+
return {
|
|
7
|
+
1: colors[0],
|
|
8
|
+
2: colors[1],
|
|
9
|
+
3: colors[2],
|
|
10
|
+
4: colors[3],
|
|
11
|
+
5: colors[4],
|
|
12
|
+
6: colors[5],
|
|
13
|
+
7: colors[6],
|
|
14
|
+
8: colors[4],
|
|
15
|
+
9: colors[5],
|
|
16
|
+
10: colors[6]
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
const generateNeutralColorPalettes = (bgBaseColor, textBaseColor) => {
|
|
20
|
+
const colorBgBase = bgBaseColor || '#fff';
|
|
21
|
+
const colorTextBase = textBaseColor || '#000';
|
|
22
|
+
return {
|
|
23
|
+
colorBgBase,
|
|
24
|
+
colorTextBase,
|
|
25
|
+
colorText: getAlphaColor(colorTextBase, 0.88),
|
|
26
|
+
colorTextSecondary: getAlphaColor(colorTextBase, 0.65),
|
|
27
|
+
colorTextTertiary: getAlphaColor(colorTextBase, 0.45),
|
|
28
|
+
colorTextQuaternary: getAlphaColor(colorTextBase, 0.25),
|
|
29
|
+
colorFill: getAlphaColor(colorTextBase, 0.15),
|
|
30
|
+
colorFillSecondary: getAlphaColor(colorTextBase, 0.06),
|
|
31
|
+
colorFillTertiary: getAlphaColor(colorTextBase, 0.04),
|
|
32
|
+
colorFillQuaternary: getAlphaColor(colorTextBase, 0.02),
|
|
33
|
+
colorBgElevated: getSolidColor(colorBgBase, 0),
|
|
34
|
+
colorBgContainer: getSolidColor(colorBgBase, 0),
|
|
35
|
+
colorBgLayout: getSolidColor(colorBgBase, 4),
|
|
36
|
+
colorBgContainerSecondary: getSolidColor(colorBgBase, 0),
|
|
37
|
+
colorBgContainerTertiary: getSolidColor(colorBgBase, 0),
|
|
38
|
+
colorBgSpotlight: getAlphaColor(colorTextBase, 0.85),
|
|
39
|
+
colorBgBlur: 'transparent',
|
|
40
|
+
colorBorder: getSolidColor(colorBgBase, 15),
|
|
41
|
+
colorBorderSecondary: getSolidColor(colorBgBase, 6)
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { generateColorPalettes, generateNeutralColorPalettes };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import genColorMapToken from '../utils/genColorMapToken.js';
|
|
2
|
+
import { generateColorPalettes, generateNeutralColorPalettes } from './colors.js';
|
|
3
|
+
|
|
4
|
+
function genLightColorMapToken (token) {
|
|
5
|
+
return genColorMapToken(token, {
|
|
6
|
+
generateColorPalettes,
|
|
7
|
+
generateNeutralColorPalettes
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { genLightColorMapToken as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const lightSeedToken = {
|
|
2
|
+
colorPrimary: '#1677ff',
|
|
3
|
+
colorSuccess: '#52c41a',
|
|
4
|
+
colorWarning: '#faad14',
|
|
5
|
+
colorError: '#ff4d4f',
|
|
6
|
+
colorInfo: '#1677ff',
|
|
7
|
+
colorTextBase: '#000',
|
|
8
|
+
colorBgBase: '#fff',
|
|
9
|
+
colorLink: '#1677ff'
|
|
10
|
+
};
|
|
11
|
+
const darkSeedToken = {
|
|
12
|
+
colorPrimary: '#1677ff',
|
|
13
|
+
colorSuccess: '#52c41a',
|
|
14
|
+
colorWarning: '#faad14',
|
|
15
|
+
colorError: '#ff4d4f',
|
|
16
|
+
colorInfo: '#1677ff',
|
|
17
|
+
colorTextBase: '#fff',
|
|
18
|
+
colorBgBase: '#000',
|
|
19
|
+
colorLink: '#1677ff'
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { darkSeedToken, lightSeedToken };
|