@lobehub/ui 6.0.0-beta.3 → 6.0.0-beta.5
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/es/Accordion/style.d.mts +1 -1
- package/es/Anchor/Anchor.mjs +2 -2
- package/es/Anchor/Anchor.mjs.map +1 -1
- package/es/AutoComplete/style.d.mts +1 -1
- package/es/Carousel/Carousel.mjs +1 -1
- package/es/Carousel/Carousel.mjs.map +1 -1
- package/es/CodeDiff/CodeDiff.mjs.map +1 -1
- package/es/CodeDiff/PatchDiff.mjs.map +1 -1
- package/es/CodeDiff/theme.mjs.map +1 -1
- package/es/CodeDiff/type.d.mts +2 -2
- package/es/CodeEditor/CodeEditor.mjs +1 -1
- package/es/CodeEditor/CodeEditor.mjs.map +1 -1
- package/es/ColorPicker/ColorPicker.mjs +1 -1
- package/es/ColorPicker/ColorPicker.mjs.map +1 -1
- package/es/ColorSwatches/ColorSwatches.mjs +1 -1
- package/es/ColorSwatches/ColorSwatches.mjs.map +1 -1
- package/es/ConfigProvider/cdnAssets.mjs +6 -0
- package/es/ConfigProvider/cdnAssets.mjs.map +1 -0
- package/es/ConfigProvider/index.mjs +2 -1
- package/es/ConfigProvider/index.mjs.map +1 -1
- package/es/ContextMenu/store.d.mts +0 -1
- package/es/ContextMenu/store.mjs.map +1 -1
- package/es/DatePicker/DatePicker.mjs +1 -1
- package/es/DatePicker/DatePicker.mjs.map +1 -1
- package/es/DatePicker/DateRangePicker.mjs +1 -1
- package/es/DatePicker/DateRangePicker.mjs.map +1 -1
- package/es/DraggablePanel/atoms.mjs +1 -1
- package/es/DraggablePanel/atoms.mjs.map +1 -1
- package/es/DraggableSideNav/DraggableSideNav.mjs +2 -2
- package/es/DraggableSideNav/DraggableSideNav.mjs.map +1 -1
- package/es/Drawer/atoms.mjs +1 -1
- package/es/Drawer/atoms.mjs.map +1 -1
- package/es/DropdownMenu/atoms.mjs +1 -1
- package/es/DropdownMenu/atoms.mjs.map +1 -1
- package/es/EditableText/ControlInput.mjs +42 -29
- package/es/EditableText/ControlInput.mjs.map +1 -1
- package/es/EditableText/EditableText.mjs +1 -1
- package/es/EditableText/EditableText.mjs.map +1 -1
- package/es/EmojiPicker/EmojiPicker.mjs +3 -9
- package/es/EmojiPicker/EmojiPicker.mjs.map +1 -1
- package/es/EmojiPicker/useEmojiMartI18n.mjs +37 -0
- package/es/EmojiPicker/useEmojiMartI18n.mjs.map +1 -0
- package/es/FormKit/engine/tanstack.mjs +1 -1
- package/es/FormKit/engine/tanstack.mjs.map +1 -1
- package/es/HotkeyInput/HotkeyInput.mjs +1 -1
- package/es/HotkeyInput/HotkeyInput.mjs.map +1 -1
- package/es/Image/viewer/ImageViewer.mjs +1 -1
- package/es/Image/viewer/ImageViewer.mjs.map +1 -1
- package/es/ImageSelect/ImageSelect.mjs +1 -1
- package/es/ImageSelect/ImageSelect.mjs.map +1 -1
- package/es/Input/Input.mjs +7 -5
- package/es/Input/Input.mjs.map +1 -1
- package/es/Input/TextArea.mjs +1 -1
- package/es/Input/TextArea.mjs.map +1 -1
- package/es/Modal/atoms.mjs +3 -3
- package/es/Modal/atoms.mjs.map +1 -1
- package/es/Pagination/Pagination.mjs +1 -1
- package/es/Pagination/Pagination.mjs.map +1 -1
- package/es/Popover/PopoverInGroup.mjs +1 -1
- package/es/Popover/PopoverInGroup.mjs.map +1 -1
- package/es/Popover/atoms.mjs +1 -1
- package/es/Popover/atoms.mjs.map +1 -1
- package/es/Rate/Rate.mjs +1 -1
- package/es/Rate/Rate.mjs.map +1 -1
- package/es/ScrollShadow/ScrollShadow.mjs +1 -1
- package/es/ScrollShadow/ScrollShadow.mjs.map +1 -1
- package/es/SearchBar/SearchBar.mjs +31 -25
- package/es/SearchBar/SearchBar.mjs.map +1 -1
- package/es/Segmented/Segmented.mjs +1 -1
- package/es/Segmented/Segmented.mjs.map +1 -1
- package/es/Select/atoms.mjs +1 -1
- package/es/Select/atoms.mjs.map +1 -1
- package/es/Switch/atoms.mjs +1 -1
- package/es/Switch/atoms.mjs.map +1 -1
- package/es/Tabs/Tabs.mjs +35 -21
- package/es/Tabs/Tabs.mjs.map +1 -1
- package/es/Text/style.d.mts +3 -3
- package/es/ToggleGroup/ToggleGroup.mjs +1 -1
- package/es/ToggleGroup/ToggleGroup.mjs.map +1 -1
- package/es/Tooltip/TooltipInGroup.mjs +1 -1
- package/es/Tooltip/TooltipInGroup.mjs.map +1 -1
- package/es/Tooltip/TooltipStandalone.mjs +1 -1
- package/es/Tooltip/TooltipStandalone.mjs.map +1 -1
- package/es/Tree/Tree.mjs +1 -1
- package/es/Tree/Tree.mjs.map +1 -1
- package/es/Video/context.mjs.map +1 -1
- package/es/Video/parts/Caption.mjs +4 -1
- package/es/Video/parts/Caption.mjs.map +1 -1
- package/es/Video/parts/Controls.mjs +6 -1
- package/es/Video/parts/Controls.mjs.map +1 -1
- package/es/Video/parts/Frame.mjs +9 -2
- package/es/Video/parts/Frame.mjs.map +1 -1
- package/es/awesome/Giscus/style.mjs +9 -9
- package/es/awesome/Giscus/style.mjs.map +1 -1
- package/es/awesome/GridBackground/GridBackground.mjs +1 -1
- package/es/awesome/GridBackground/GridBackground.mjs.map +1 -1
- package/es/awesome/GridBackground/GridShowcase.mjs +4 -4
- package/es/awesome/GridBackground/GridShowcase.mjs.map +1 -1
- package/es/awesome/Spline/ParentSize.mjs +1 -1
- package/es/awesome/Spline/ParentSize.mjs.map +1 -1
- package/es/chat/BackBottom/BackBottom.mjs +1 -1
- package/es/chat/BackBottom/BackBottom.mjs.map +1 -1
- package/es/chat/BackBottom/type.d.mts +2 -2
- package/es/chat/EditableMessage/EditableMessage.mjs +1 -1
- package/es/chat/EditableMessage/EditableMessage.mjs.map +1 -1
- package/es/chat/EditableMessageList/EditableMessageList.mjs +1 -1
- package/es/chat/EditableMessageList/EditableMessageList.mjs.map +1 -1
- package/es/chat/EditableMessageList/messageReducer.mjs +30 -23
- package/es/chat/EditableMessageList/messageReducer.mjs.map +1 -1
- package/es/chat/MessageModal/MessageModal.mjs +1 -1
- package/es/chat/MessageModal/MessageModal.mjs.map +1 -1
- package/es/chat/TokenTag/TokenTag.mjs +2 -3
- package/es/chat/TokenTag/TokenTag.mjs.map +1 -1
- package/es/hooks/useControlledState.mjs +20 -0
- package/es/hooks/useControlledState.mjs.map +1 -0
- package/es/hooks/useHighlight.mjs +2 -2
- package/es/hooks/useHighlight.mjs.map +1 -1
- package/es/hooks/useHover.mjs +22 -0
- package/es/hooks/useHover.mjs.map +1 -0
- package/es/hooks/useScroll.d.mts +8 -0
- package/es/hooks/useScroll.mjs +33 -0
- package/es/hooks/useScroll.mjs.map +1 -0
- package/es/hooks/useSize.mjs +26 -0
- package/es/hooks/useSize.mjs.map +1 -0
- package/es/internal/virtual/VirtualScrollArea.mjs +1 -1
- package/es/internal/virtual/VirtualScrollArea.mjs.map +1 -1
- package/es/mobile/ChatInputArea/ChatInputArea.mjs +1 -1
- package/es/mobile/ChatInputArea/ChatInputArea.mjs.map +1 -1
- package/es/mobile/TabBar/TabBar.mjs +1 -1
- package/es/mobile/TabBar/TabBar.mjs.map +1 -1
- package/es/node_modules/.pnpm/@eslint_core@1.2.1/node_modules/@eslint/core/dist/esm/types.d.mts +2 -46
- package/es/node_modules/.pnpm/@eslint_plugin-kit@0.7.3/node_modules/@eslint/plugin-kit/dist/cjs/index.d.mts +1 -1
- package/es/node_modules/.pnpm/@types_estree@1.0.9/node_modules/@types/estree/index.d.mts +1 -4
- package/es/node_modules/.pnpm/eslint@10.12.0_jiti@2.6.1_supports-color@10.2.2/node_modules/eslint/lib/types/index.d.mts +1 -1
- package/es/styles/theme/token/neutral.mjs +5 -5
- package/es/styles/theme/token/neutral.mjs.map +1 -1
- package/es/utils/colorMath.mjs +52 -0
- package/es/utils/colorMath.mjs.map +1 -0
- package/es/utils/formatNumber.mjs +7 -0
- package/es/utils/formatNumber.mjs.map +1 -0
- package/es/utils/genCdnUrl.mjs +6 -3
- package/es/utils/genCdnUrl.mjs.map +1 -1
- package/es/utils/hashString.mjs +19 -0
- package/es/utils/hashString.mjs.map +1 -0
- package/es/utils/mergeRefs.mjs +20 -0
- package/es/utils/mergeRefs.mjs.map +1 -0
- package/es/utils/placement.d.mts +5 -5
- package/es/utils/placement.mjs.map +1 -1
- package/package.json +16 -42
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBar.mjs","names":["
|
|
1
|
+
{"version":3,"file":"TabBar.mjs","names":["Flexbox"],"sources":["../../../src/mobile/TabBar/TabBar.tsx"],"sourcesContent":["'use client';\n\nimport * as stylex from '@stylexjs/stylex';\nimport { memo } from 'react';\n\nimport { Flexbox } from '@/Flex';\nimport { useControlledState } from '@/hooks/useControlledState';\nimport SafeArea from '@/mobile/SafeArea';\nimport { styleProps } from '@/styles/stylex/props';\n\nimport { styles } from './style';\nimport type { TabBarProps } from './type';\n\nconst TabBar = memo<TabBarProps>(\n ({ ref, className, safeArea, items, activeKey, defaultActiveKey, onChange, ...rest }) => {\n const [currentActive, setCurrentActive] = useControlledState<string>(\n defaultActiveKey || items[0].key,\n {\n defaultValue: defaultActiveKey,\n onChange,\n value: activeKey,\n },\n );\n\n return (\n <Flexbox\n as={'footer'}\n flex={'none'}\n ref={ref}\n width={'100vw'}\n {...styleProps(styles.container, className)}\n {...rest}\n >\n <Flexbox\n horizontal\n align={'center'}\n height={48}\n justify={'space-around'}\n {...styleProps(styles.inner, className)}\n >\n {items.map((item) => {\n const active = item.key === currentActive;\n return (\n <Flexbox\n align={'center'}\n gap={4}\n height={48}\n justify={'center'}\n key={item.key}\n width={48}\n {...stylex.props(styles.tab, active && styles.active)}\n onClick={() => {\n setCurrentActive(item.key);\n item?.onClick?.();\n }}\n >\n <Flexbox\n align={'center'}\n height={24}\n justify={'center'}\n width={24}\n {...stylex.props(styles.icon)}\n >\n {typeof item.icon === 'function' ? item.icon(active) : item.icon}\n </Flexbox>\n <div {...stylex.props(styles.title)}>\n {typeof item.title === 'function' ? item.title(active) : item.title}\n </div>\n </Flexbox>\n );\n })}\n </Flexbox>\n {safeArea && <SafeArea position={'bottom'} />}\n </Flexbox>\n );\n },\n);\n\nTabBar.displayName = 'MobileTabBar';\n\nexport default TabBar;\n"],"mappings":";;;;;;;;;;AAUA,MAAM,SAAS,MAAmB,EAChC,KACA,WACA,UACA,OACA,WACA,kBACA,UACA,GAAG,WACC;CACJ,MAAM,CAAC,eAAe,oBAAoB,mBAA2B,oBAAoB,MAAM,EAAE,CAAC,KAAK;EACrG,cAAc;EACd;EACA,OAAO;CACT,CAAC;CACD,OAAO,qBAACA,mBAAD;EAAS,IAAI;EAAU,MAAM;EAAa;EAAK,OAAO;EAAS,GAAI,WAAW,OAAO,WAAW,SAAS;EAAG,GAAI;EAAhH,UAAA,CACD,oBAACA,mBAAD;GAAS,YAAA;GAAW,OAAO;GAAU,QAAQ;GAAI,SAAS;GAAgB,GAAI,WAAW,OAAO,OAAO,SAAS;GAC7G,UAAA,MAAM,KAAI,SAAQ;IACrB,MAAM,SAAS,KAAK,QAAQ;IAC5B,OAAO,qBAACA,mBAAD;KAAS,OAAO;KAAU,KAAK;KAAG,QAAQ;KAAI,SAAS;KAAyB,OAAO;KAAI,GAAI,OAAO,MAAM,OAAO,KAAK,UAAU,OAAO,MAAM;KAAG,eAAe;MACtK,iBAAiB,KAAK,GAAG;MACzB,MAAM,UAAU;KAClB;KAHO,UAAA,CAIC,oBAACA,mBAAD;MAAS,OAAO;MAAU,QAAQ;MAAI,SAAS;MAAU,OAAO;MAAI,GAAI,OAAO,MAAM,OAAO,IAAI;MAC7F,UAAA,OAAO,KAAK,SAAS,aAAa,KAAK,KAAK,MAAM,IAAI,KAAK;KACrD,CAAA,GACT,oBAAC,OAAD;MAAK,GAAI,OAAO,MAAM,OAAO,KAAK;MAC/B,UAAA,OAAO,KAAK,UAAU,aAAa,KAAK,MAAM,MAAM,IAAI,KAAK;KAC3D,CAAA,CACE;IAV8D,GAAA,KAAK,GAUnE;GACjB,CAAC;EACU,CAAA,GACR,YAAY,oBAAC,UAAD,EAAU,UAAU,SAAW,CAAA,CACrC;;AACf,CAAC;AACD,OAAO,cAAc"}
|
package/es/node_modules/.pnpm/@eslint_core@1.2.1/node_modules/@eslint/core/dist/esm/types.d.mts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { JSONSchema4 } from "../../../../../../@types_json-schema@7.0.15/node_modules/@types/json-schema/index.mjs";
|
|
2
|
-
|
|
3
|
-
export { BaseConfig, BinarySourceCode, CallTraversalStep, ConfigObject, ConfigOverride, CustomRuleDefinitionType, CustomRuleTypeDefinitions, DeprecatedInfo, Directive, DirectiveType, EcmaVersion, EnvironmentConfig, ExternalSpecifier, File, FileError, FileProblem, GlobalAccess, GlobalsConfig, HasRules, JavaScriptParserOptionsConfig, JavaScriptSourceType, Language, LanguageContext, LanguageOptions, LanguageTypeOptions, LegacyConfigObject, LintMessage, LintSuggestion, LinterOptionsConfig, MessagePlaceholderData, NotOkParseResult, ObjectMetaProperties, OkParseResult, ParseResult, Plugin, Position, PositionWithOffset, Processor, ProcessorFile, ReplacedByInfo, RuleConfig, RuleContext, RuleContextTypeOptions, RuleDefinition, RuleDefinitionTypeOptions, RuleFixType, RuleFixer, RuleTextEdit, RuleTextEditor, RuleType, RuleVisitor, RulesConfig, RulesMeta, RulesMetaDocs, SettingsConfig, Severity, SeverityLevel, SeverityName, SourceCode, SourceCodeBaseTypeOptions, SourceLocation, SourceLocationWithOffset, SourceRange, SuggestedEdit, SuggestedEditBase, SuggestionMessage, TextSourceCode, TraversalStep, ViolationLocation, ViolationMessage, ViolationReport, ViolationReportBase, VisitTraversalStep };
|
|
4
|
-
}
|
|
2
|
+
//#region node_modules/.pnpm/@eslint+core@1.2.1/node_modules/@eslint/core/dist/esm/types.d.ts
|
|
5
3
|
/**
|
|
6
4
|
* Represents an error inside of a file.
|
|
7
5
|
*/
|
|
@@ -27,13 +25,6 @@ export interface SourceLocation {
|
|
|
27
25
|
start: Position;
|
|
28
26
|
end: Position;
|
|
29
27
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Represents the start and end coordinates of a node inside the source with an offset.
|
|
32
|
-
*/
|
|
33
|
-
export interface SourceLocationWithOffset {
|
|
34
|
-
start: PositionWithOffset;
|
|
35
|
-
end: PositionWithOffset;
|
|
36
|
-
}
|
|
37
28
|
/**
|
|
38
29
|
* Represents a location coordinate inside the source. ESLint-style formats
|
|
39
30
|
* have just `line` and `column` while others may have `offset` as well.
|
|
@@ -42,12 +33,6 @@ export interface Position {
|
|
|
42
33
|
line: number;
|
|
43
34
|
column: number;
|
|
44
35
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Represents a location coordinate inside the source with an offset.
|
|
47
|
-
*/
|
|
48
|
-
export interface PositionWithOffset extends Position {
|
|
49
|
-
offset: number;
|
|
50
|
-
}
|
|
51
36
|
/**
|
|
52
37
|
* Represents a range of characters in the source.
|
|
53
38
|
*/
|
|
@@ -472,35 +457,6 @@ export interface RuleDefinition<Options extends RuleDefinitionTypeOptions = Rule
|
|
|
472
457
|
MessageIds: Options["MessageIds"];
|
|
473
458
|
}>): Options["Visitor"];
|
|
474
459
|
}
|
|
475
|
-
/**
|
|
476
|
-
* Defaults for non-language-related `RuleDefinition` options.
|
|
477
|
-
* @deprecated Use the same type from `@eslint/plugin-kit` instead.
|
|
478
|
-
*/
|
|
479
|
-
export interface CustomRuleTypeDefinitions {
|
|
480
|
-
RuleOptions: unknown[];
|
|
481
|
-
MessageIds: string;
|
|
482
|
-
ExtRuleDocs: Record<string, unknown>;
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* A helper type to define language specific specializations of the `RuleDefinition` type.
|
|
486
|
-
* @deprecated Use the same type from `@eslint/plugin-kit` instead.
|
|
487
|
-
*
|
|
488
|
-
* @example
|
|
489
|
-
* ```ts
|
|
490
|
-
* type YourRuleDefinition<
|
|
491
|
-
* Options extends Partial<CustomRuleTypeDefinitions> = {},
|
|
492
|
-
* > = CustomRuleDefinitionType<
|
|
493
|
-
* {
|
|
494
|
-
* LangOptions: YourLanguageOptions;
|
|
495
|
-
* Code: YourSourceCode;
|
|
496
|
-
* Visitor: YourRuleVisitor;
|
|
497
|
-
* Node: YourNode;
|
|
498
|
-
* },
|
|
499
|
-
* Options
|
|
500
|
-
* >;
|
|
501
|
-
* ```
|
|
502
|
-
*/
|
|
503
|
-
export type CustomRuleDefinitionType<LanguageSpecificOptions extends Omit<RuleDefinitionTypeOptions, keyof CustomRuleTypeDefinitions>, Options extends Partial<CustomRuleTypeDefinitions>> = RuleDefinition<LanguageSpecificOptions & Required<Options & Omit<CustomRuleTypeDefinitions, keyof Options>>>;
|
|
504
460
|
/**
|
|
505
461
|
* The human readable severity level used in a configuration.
|
|
506
462
|
*/
|
|
@@ -1157,5 +1113,5 @@ export interface Directive {
|
|
|
1157
1113
|
justification?: string;
|
|
1158
1114
|
}
|
|
1159
1115
|
//#endregion
|
|
1160
|
-
export {
|
|
1116
|
+
export {};
|
|
1161
1117
|
//# sourceMappingURL=types.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RuleVisitor as RuleVisitor$1
|
|
1
|
+
import { RuleVisitor as RuleVisitor$1 } from "../../../../../../@eslint_core@1.2.1/node_modules/@eslint/core/dist/esm/types.mjs";
|
|
2
2
|
import { CustomRuleVisitorWithExit as CustomRuleVisitorWithExit$1 } from "./types.mjs";
|
|
3
3
|
//#region node_modules/.pnpm/@eslint+plugin-kit@0.7.3/node_modules/@eslint/plugin-kit/dist/cjs/index.d.cts
|
|
4
4
|
export type RuleVisitor = RuleVisitor$1;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export { ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, AssignmentOperator, AssignmentPattern, AssignmentProperty, AwaitExpression, BaseCallExpression, BaseClass, BaseDeclaration, BaseExpression, BaseForXStatement, BaseFunction, BaseModuleDeclaration, BaseModuleSpecifier, BaseNode, BaseNodeWithoutComments, BasePattern, BaseStatement, BigIntLiteral, BinaryExpression, BinaryOperator, BlockStatement, BreakStatement, CallExpression, CatchClause, ChainElement, ChainExpression, Class, ClassBody, ClassDeclaration, ClassExpression, Comment, ConditionalExpression, ContinueStatement, DebuggerStatement, Declaration, Directive, DoWhileStatement, EmptyStatement, ExportAllDeclaration, ExportDefaultDeclaration, ExportNamedDeclaration, ExportSpecifier, Expression, ExpressionMap, ExpressionStatement, ForInStatement, ForOfStatement, ForStatement, Function, FunctionDeclaration, FunctionExpression, Identifier, IfStatement, ImportAttribute, ImportDeclaration, ImportDefaultSpecifier, ImportExpression, ImportNamespaceSpecifier, ImportSpecifier, LabeledStatement, Literal, LogicalExpression, LogicalOperator, MaybeNamedClassDeclaration, MaybeNamedFunctionDeclaration, MemberExpression, MetaProperty, MethodDefinition, ModuleDeclaration, ModuleSpecifier, NewExpression, Node, NodeMap, ObjectExpression, ObjectPattern, Pattern, Position, PrivateIdentifier, Program, Property, PropertyDefinition, RegExpLiteral, RestElement, ReturnStatement, SequenceExpression, SimpleCallExpression, SimpleLiteral, SourceLocation, SpreadElement, Statement, StaticBlock, Super, SwitchCase, SwitchStatement, TaggedTemplateExpression, TemplateElement, TemplateLiteral, ThisExpression, ThrowStatement, TryStatement, UnaryExpression, UnaryOperator, UpdateExpression, UpdateOperator, VariableDeclaration, VariableDeclarator, WhileStatement, WithStatement, YieldExpression };
|
|
3
|
-
}
|
|
1
|
+
//#region node_modules/.pnpm/@types+estree@1.0.9/node_modules/@types/estree/index.d.ts
|
|
4
2
|
// This definition file follows a somewhat unusual format. ESTree allows
|
|
5
3
|
// runtime type checks based on the `type` parameter. In order to explain this
|
|
6
4
|
// to typescript we want to use discriminated union types:
|
|
@@ -526,5 +524,4 @@ export interface AwaitExpression extends BaseExpression {
|
|
|
526
524
|
argument: Expression;
|
|
527
525
|
}
|
|
528
526
|
//#endregion
|
|
529
|
-
export { index_d_exports };
|
|
530
527
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrowFunctionExpression, AssignmentExpression, BaseNode, CatchClause, ClassDeclaration, ClassExpression, Comment, Expression, ForInStatement, ForOfStatement, FunctionDeclaration, FunctionExpression, Identifier, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, Node as Node$1, Position, Program, SourceLocation as SourceLocation$1, VariableDeclaration, VariableDeclarator
|
|
1
|
+
import { ArrowFunctionExpression, AssignmentExpression, BaseNode, CatchClause, ClassDeclaration, ClassExpression, Comment, Expression, ForInStatement, ForOfStatement, FunctionDeclaration, FunctionExpression, Identifier, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, Node as Node$1, Position, Program, SourceLocation as SourceLocation$1, VariableDeclaration, VariableDeclarator } from "../../../../../@types_estree@1.0.9/node_modules/@types/estree/index.mjs";
|
|
2
2
|
import { BaseConfig, ConfigObject, ConfigOverride, DeprecatedInfo, EcmaVersion as EcmaVersion$1, EnvironmentConfig, GlobalAccess, GlobalsConfig, HasRules, JavaScriptSourceType, LanguageOptions, LegacyConfigObject, LintMessage as LintMessage$1, LintSuggestion, LinterOptionsConfig, ObjectMetaProperties, Plugin as Plugin$1, Processor, ProcessorFile as ProcessorFile$1, RuleConfig, RuleContext as RuleContext$1, RuleDefinition, RuleFixer, RuleTextEdit, RuleTextEditor, RulesConfig, RulesMeta, Severity, SeverityLevel, SeverityName, SourceRange, SuggestedEdit, SuggestedEditBase, SuggestionMessage, TextSourceCode, TraversalStep, ViolationLocation, ViolationMessage, ViolationReport, ViolationReportBase } from "../../../../../@eslint_core@1.2.1/node_modules/@eslint/core/dist/esm/types.mjs";
|
|
3
3
|
import { CustomRuleVisitorWithExit } from "../../../../../@eslint_plugin-kit@0.7.3/node_modules/@eslint/plugin-kit/dist/cjs/index.mjs";
|
|
4
4
|
//#region node_modules/.pnpm/eslint@10.12.0_jiti@2.6.1_supports-color@10.2.2/node_modules/eslint/lib/types/index.d.ts
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import gray from "../../../color/colors/gray.mjs";
|
|
2
2
|
import { neutralColorScales } from "../../../color/neutrals/index.mjs";
|
|
3
|
+
import { mixColors, parseRgb } from "../../../utils/colorMath.mjs";
|
|
3
4
|
import { generateColorNeutralPalette } from "../generateColorPalette.mjs";
|
|
4
|
-
import { mix, parseToRgb } from "polished";
|
|
5
5
|
//#region src/styles/theme/token/neutral.ts
|
|
6
6
|
const isChannel = (value) => value >= 0 && value <= 255;
|
|
7
7
|
const getAlphaColor = (front, back) => {
|
|
8
|
-
const f =
|
|
9
|
-
if (
|
|
10
|
-
const b =
|
|
8
|
+
const f = parseRgb(front);
|
|
9
|
+
if (f.alpha !== void 0) return front;
|
|
10
|
+
const b = parseRgb(back);
|
|
11
11
|
for (let alpha = .01; alpha <= 1; alpha += .01) {
|
|
12
12
|
const r = Math.round((f.red - b.red * (1 - alpha)) / alpha);
|
|
13
13
|
const g = Math.round((f.green - b.green * (1 - alpha)) / alpha);
|
|
@@ -28,7 +28,7 @@ const createNeutralToken = (appearance, neutralColor, status) => {
|
|
|
28
28
|
return {
|
|
29
29
|
...token,
|
|
30
30
|
colorBgContainerDisabled: token.colorFillTertiary,
|
|
31
|
-
colorBgContainerSecondary:
|
|
31
|
+
colorBgContainerSecondary: mixColors(.5, token.colorBgLayout, token.colorBgContainer),
|
|
32
32
|
colorBgTextActive: token.colorFill,
|
|
33
33
|
colorBgTextHover: token.colorFillSecondary,
|
|
34
34
|
colorBorderBg: token.colorBgContainer,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"neutral.mjs","names":[],"sources":["../../../../src/styles/theme/token/neutral.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"neutral.mjs","names":[],"sources":["../../../../src/styles/theme/token/neutral.ts"],"sourcesContent":["import { gray } from '@/color/colors';\nimport { neutralColorScales } from '@/color/neutrals';\nimport { mixColors, parseRgb } from '@/utils/colorMath';\n\nimport type { NeutralColors } from '../../customTheme';\nimport { generateColorNeutralPalette } from '../generateColorPalette';\n\nconst isChannel = (value: number) => value >= 0 && value <= 255;\n\n// port of antd's getAlphaColor: the most transparent rgba that renders `front` over `back`\nconst getAlphaColor = (front: string, back: string) => {\n const f = parseRgb(front);\n if (f.alpha !== undefined) return front;\n const b = parseRgb(back);\n\n for (let alpha = 0.01; alpha <= 1; alpha += 0.01) {\n const r = Math.round((f.red - b.red * (1 - alpha)) / alpha);\n const g = Math.round((f.green - b.green * (1 - alpha)) / alpha);\n const bl = Math.round((f.blue - b.blue * (1 - alpha)) / alpha);\n if (isChannel(r) && isChannel(g) && isChannel(bl)) {\n const a = Math.round(alpha * 100) / 100;\n return a === 1 ? `rgb(${r},${g},${bl})` : `rgba(${r},${g},${bl},${a})`;\n }\n }\n\n return `rgb(${f.red},${f.green},${f.blue})`;\n};\n\nexport const createNeutralToken = (\n appearance: 'light' | 'dark',\n neutralColor: NeutralColors | undefined,\n status: { colorErrorBg: string; colorWarningBg: string },\n) => {\n const scale = (neutralColor && neutralColorScales[neutralColor]) || gray;\n const token = generateColorNeutralPalette({ appearance, scale });\n\n return {\n ...token,\n colorBgContainerDisabled: token.colorFillTertiary,\n colorBgContainerSecondary: mixColors(0.5, token.colorBgLayout, token.colorBgContainer),\n colorBgTextActive: token.colorFill,\n colorBgTextHover: token.colorFillSecondary,\n colorBorderBg: token.colorBgContainer,\n colorErrorOutline: getAlphaColor(status.colorErrorBg, token.colorBgContainer),\n colorFillAlter: token.colorFillQuaternary,\n colorFillContent: token.colorFillSecondary,\n colorFillContentHover: token.colorFill,\n colorIcon: token.colorTextTertiary,\n colorIconHover: token.colorText,\n colorSplit: getAlphaColor(token.colorBorderSecondary, token.colorBgContainer),\n colorTextDescription: token.colorTextTertiary,\n colorTextDisabled: token.colorTextQuaternary,\n colorTextHeading: token.colorText,\n colorTextLabel: token.colorTextSecondary,\n colorTextPlaceholder: token.colorTextQuaternary,\n colorWarningOutline: getAlphaColor(status.colorWarningBg, token.colorBgContainer),\n controlItemBgActiveDisabled: token.colorFill,\n controlItemBgHover: token.colorFillTertiary,\n controlTmpOutline: token.colorFillQuaternary,\n };\n};\n"],"mappings":";;;;;AAOA,MAAM,aAAa,UAAkB,SAAS,KAAK,SAAS;AAG5D,MAAM,iBAAiB,OAAe,SAAiB;CACrD,MAAM,IAAI,SAAS,KAAK;CACxB,IAAI,EAAE,UAAU,KAAA,GAAW,OAAO;CAClC,MAAM,IAAI,SAAS,IAAI;CAEvB,KAAK,IAAI,QAAQ,KAAM,SAAS,GAAG,SAAS,KAAM;EAChD,MAAM,IAAI,KAAK,OAAO,EAAE,MAAM,EAAE,OAAO,IAAI,UAAU,KAAK;EAC1D,MAAM,IAAI,KAAK,OAAO,EAAE,QAAQ,EAAE,SAAS,IAAI,UAAU,KAAK;EAC9D,MAAM,KAAK,KAAK,OAAO,EAAE,OAAO,EAAE,QAAQ,IAAI,UAAU,KAAK;EAC7D,IAAI,UAAU,CAAC,KAAK,UAAU,CAAC,KAAK,UAAU,EAAE,GAAG;GACjD,MAAM,IAAI,KAAK,MAAM,QAAQ,GAAG,IAAI;GACpC,OAAO,MAAM,IAAI,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,KAAK,QAAQ,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE;EACtE;CACF;CAEA,OAAO,OAAO,EAAE,IAAI,GAAG,EAAE,MAAM,GAAG,EAAE,KAAK;AAC3C;AAEA,MAAa,sBACX,YACA,cACA,WACG;CACH,MAAM,QAAS,gBAAgB,mBAAmB,iBAAkB;CACpE,MAAM,QAAQ,4BAA4B;EAAE;EAAY;CAAM,CAAC;CAE/D,OAAO;EACL,GAAG;EACH,0BAA0B,MAAM;EAChC,2BAA2B,UAAU,IAAK,MAAM,eAAe,MAAM,gBAAgB;EACrF,mBAAmB,MAAM;EACzB,kBAAkB,MAAM;EACxB,eAAe,MAAM;EACrB,mBAAmB,cAAc,OAAO,cAAc,MAAM,gBAAgB;EAC5E,gBAAgB,MAAM;EACtB,kBAAkB,MAAM;EACxB,uBAAuB,MAAM;EAC7B,WAAW,MAAM;EACjB,gBAAgB,MAAM;EACtB,YAAY,cAAc,MAAM,sBAAsB,MAAM,gBAAgB;EAC5E,sBAAsB,MAAM;EAC5B,mBAAmB,MAAM;EACzB,kBAAkB,MAAM;EACxB,gBAAgB,MAAM;EACtB,sBAAsB,MAAM;EAC5B,qBAAqB,cAAc,OAAO,gBAAgB,MAAM,gBAAgB;EAChF,6BAA6B,MAAM;EACnC,oBAAoB,MAAM;EAC1B,mBAAmB,MAAM;CAC3B;AACF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import chroma from "chroma-js";
|
|
2
|
+
//#region src/utils/colorMath.ts
|
|
3
|
+
const parseRgb = (color) => {
|
|
4
|
+
const [red, green, blue, alpha] = chroma(color).rgba();
|
|
5
|
+
return alpha < 1 ? {
|
|
6
|
+
alpha,
|
|
7
|
+
blue,
|
|
8
|
+
green,
|
|
9
|
+
red
|
|
10
|
+
} : {
|
|
11
|
+
blue,
|
|
12
|
+
green,
|
|
13
|
+
red
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
const toHex = (channel) => channel.toString(16).padStart(2, "0");
|
|
17
|
+
const toHexColor = ({ red, green, blue }) => {
|
|
18
|
+
const hex = `#${toHex(red)}${toHex(green)}${toHex(blue)}`;
|
|
19
|
+
return hex[1] === hex[2] && hex[3] === hex[4] && hex[5] === hex[6] ? `#${hex[1]}${hex[3]}${hex[5]}` : hex;
|
|
20
|
+
};
|
|
21
|
+
const mixColors = (weight, color, otherColor) => {
|
|
22
|
+
if (color === "transparent") return otherColor;
|
|
23
|
+
if (otherColor === "transparent") return color;
|
|
24
|
+
if (weight === 0) return otherColor;
|
|
25
|
+
const first = {
|
|
26
|
+
alpha: 1,
|
|
27
|
+
...parseRgb(color)
|
|
28
|
+
};
|
|
29
|
+
const second = {
|
|
30
|
+
alpha: 1,
|
|
31
|
+
...parseRgb(otherColor)
|
|
32
|
+
};
|
|
33
|
+
const alphaDelta = first.alpha - second.alpha;
|
|
34
|
+
const x = weight * 2 - 1;
|
|
35
|
+
const weight1 = ((x * alphaDelta === -1 ? x : x + alphaDelta) / (1 + x * alphaDelta) + 1) / 2;
|
|
36
|
+
const weight2 = 1 - weight1;
|
|
37
|
+
const mixed = {
|
|
38
|
+
alpha: first.alpha * weight + second.alpha * (1 - weight),
|
|
39
|
+
blue: Math.floor(first.blue * weight1 + second.blue * weight2),
|
|
40
|
+
green: Math.floor(first.green * weight1 + second.green * weight2),
|
|
41
|
+
red: Math.floor(first.red * weight1 + second.red * weight2)
|
|
42
|
+
};
|
|
43
|
+
return mixed.alpha >= 1 ? toHexColor(mixed) : `rgba(${mixed.red},${mixed.green},${mixed.blue},${mixed.alpha})`;
|
|
44
|
+
};
|
|
45
|
+
const withAlpha = (color, alpha) => {
|
|
46
|
+
const { red, green, blue } = parseRgb(color);
|
|
47
|
+
return `rgba(${red},${green},${blue},${alpha})`;
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
export { mixColors, parseRgb, withAlpha };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=colorMath.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorMath.mjs","names":[],"sources":["../../src/utils/colorMath.ts"],"sourcesContent":["import chroma from 'chroma-js';\n\nexport interface RgbColor {\n alpha?: number;\n blue: number;\n green: number;\n red: number;\n}\n\nexport const parseRgb = (color: string): RgbColor => {\n const [red, green, blue, alpha] = chroma(color).rgba();\n return alpha < 1 ? { alpha, blue, green, red } : { blue, green, red };\n};\n\nconst toHex = (channel: number) => channel.toString(16).padStart(2, '0');\n\nconst toHexColor = ({ red, green, blue }: RgbColor) => {\n const hex = `#${toHex(red)}${toHex(green)}${toHex(blue)}`;\n return hex[1] === hex[2] && hex[3] === hex[4] && hex[5] === hex[6]\n ? `#${hex[1]}${hex[3]}${hex[5]}`\n : hex;\n};\n\n// Byte-compatible with polished's mix (Sass formula, floored channels) so generated tokens stay stable.\nexport const mixColors = (weight: number, color: string, otherColor: string): string => {\n if (color === 'transparent') return otherColor;\n if (otherColor === 'transparent') return color;\n if (weight === 0) return otherColor;\n\n const first = { alpha: 1, ...parseRgb(color) };\n const second = { alpha: 1, ...parseRgb(otherColor) };\n\n const alphaDelta = first.alpha - second.alpha;\n const x = weight * 2 - 1;\n const y = x * alphaDelta === -1 ? x : x + alphaDelta;\n const z = 1 + x * alphaDelta;\n const weight1 = (y / z + 1) / 2;\n const weight2 = 1 - weight1;\n\n const mixed = {\n alpha: first.alpha * weight + second.alpha * (1 - weight),\n blue: Math.floor(first.blue * weight1 + second.blue * weight2),\n green: Math.floor(first.green * weight1 + second.green * weight2),\n red: Math.floor(first.red * weight1 + second.red * weight2),\n };\n\n return mixed.alpha >= 1\n ? toHexColor(mixed)\n : `rgba(${mixed.red},${mixed.green},${mixed.blue},${mixed.alpha})`;\n};\n\nexport const withAlpha = (color: string, alpha: number): string => {\n const { red, green, blue } = parseRgb(color);\n return `rgba(${red},${green},${blue},${alpha})`;\n};\n"],"mappings":";;AASA,MAAa,YAAY,UAA4B;CACnD,MAAM,CAAC,KAAK,OAAO,MAAM,SAAS,OAAO,KAAK,CAAC,CAAC,KAAK;CACrD,OAAO,QAAQ,IAAI;EAAE;EAAO;EAAM;EAAO;CAAI,IAAI;EAAE;EAAM;EAAO;CAAI;AACtE;AAEA,MAAM,SAAS,YAAoB,QAAQ,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG;AAEvE,MAAM,cAAc,EAAE,KAAK,OAAO,WAAqB;CACrD,MAAM,MAAM,IAAI,MAAM,GAAG,IAAI,MAAM,KAAK,IAAI,MAAM,IAAI;CACtD,OAAO,IAAI,OAAO,IAAI,MAAM,IAAI,OAAO,IAAI,MAAM,IAAI,OAAO,IAAI,KAC5D,IAAI,IAAI,KAAK,IAAI,KAAK,IAAI,OAC1B;AACN;AAGA,MAAa,aAAa,QAAgB,OAAe,eAA+B;CACtF,IAAI,UAAU,eAAe,OAAO;CACpC,IAAI,eAAe,eAAe,OAAO;CACzC,IAAI,WAAW,GAAG,OAAO;CAEzB,MAAM,QAAQ;EAAE,OAAO;EAAG,GAAG,SAAS,KAAK;CAAE;CAC7C,MAAM,SAAS;EAAE,OAAO;EAAG,GAAG,SAAS,UAAU;CAAE;CAEnD,MAAM,aAAa,MAAM,QAAQ,OAAO;CACxC,MAAM,IAAI,SAAS,IAAI;CAGvB,MAAM,YAFI,IAAI,eAAe,KAAK,IAAI,IAAI,eAChC,IAAI,IAAI,cACO,KAAK;CAC9B,MAAM,UAAU,IAAI;CAEpB,MAAM,QAAQ;EACZ,OAAO,MAAM,QAAQ,SAAS,OAAO,SAAS,IAAI;EAClD,MAAM,KAAK,MAAM,MAAM,OAAO,UAAU,OAAO,OAAO,OAAO;EAC7D,OAAO,KAAK,MAAM,MAAM,QAAQ,UAAU,OAAO,QAAQ,OAAO;EAChE,KAAK,KAAK,MAAM,MAAM,MAAM,UAAU,OAAO,MAAM,OAAO;CAC5D;CAEA,OAAO,MAAM,SAAS,IAClB,WAAW,KAAK,IAChB,QAAQ,MAAM,IAAI,GAAG,MAAM,MAAM,GAAG,MAAM,KAAK,GAAG,MAAM,MAAM;AACpE;AAEA,MAAa,aAAa,OAAe,UAA0B;CACjE,MAAM,EAAE,KAAK,OAAO,SAAS,SAAS,KAAK;CAC3C,OAAO,QAAQ,IAAI,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM;AAC/C"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/utils/formatNumber.ts
|
|
2
|
+
const integerFormat = new Intl.NumberFormat("en-US", { maximumFractionDigits: 0 });
|
|
3
|
+
const formatNumber = (value) => integerFormat.format(value);
|
|
4
|
+
//#endregion
|
|
5
|
+
export { formatNumber };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=formatNumber.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatNumber.mjs","names":[],"sources":["../../src/utils/formatNumber.ts"],"sourcesContent":["const integerFormat = new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 });\n\nexport const formatNumber = (value: number): string => integerFormat.format(value);\n"],"mappings":";AAAA,MAAM,gBAAgB,IAAI,KAAK,aAAa,SAAS,EAAE,uBAAuB,EAAE,CAAC;AAEjF,MAAa,gBAAgB,UAA0B,cAAc,OAAO,KAAK"}
|
package/es/utils/genCdnUrl.mjs
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import urlJoin from "url-join";
|
|
2
1
|
//#region src/utils/genCdnUrl.ts
|
|
3
2
|
const UNPKG_API = "https://unpkg.com";
|
|
4
3
|
const ALIYUN_API = "https://registry.npmmirror.com";
|
|
4
|
+
const joinUrl = (base, ...segments) => {
|
|
5
|
+
const joined = [base.replace(/\/+$/, ""), ...segments.map((segment) => segment.replaceAll(/^\/+|\/+$/g, ""))].filter(Boolean).join("/");
|
|
6
|
+
return segments.at(-1)?.endsWith("/") ? `${joined}/` : joined;
|
|
7
|
+
};
|
|
5
8
|
const genCdnUrl = ({ pkg, version = "latest", path, proxy }) => {
|
|
6
9
|
switch (proxy) {
|
|
7
|
-
case "unpkg": return
|
|
8
|
-
default: return
|
|
10
|
+
case "unpkg": return joinUrl(UNPKG_API, `${pkg}@${version}`, path);
|
|
11
|
+
default: return joinUrl(ALIYUN_API, pkg, version, "files", path);
|
|
9
12
|
}
|
|
10
13
|
};
|
|
11
14
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genCdnUrl.mjs","names":[],"sources":["../../src/utils/genCdnUrl.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"genCdnUrl.mjs","names":[],"sources":["../../src/utils/genCdnUrl.ts"],"sourcesContent":["const UNPKG_API = 'https://unpkg.com';\nconst ALIYUN_API = 'https://registry.npmmirror.com';\n\nconst joinUrl = (base: string, ...segments: string[]): string => {\n const joined = [\n base.replace(/\\/+$/, ''),\n ...segments.map((segment) => segment.replaceAll(/^\\/+|\\/+$/g, '')),\n ]\n .filter(Boolean)\n .join('/');\n return segments.at(-1)?.endsWith('/') ? `${joined}/` : joined;\n};\n\nexport type CDN = 'aliyun' | 'unpkg';\nexport interface CdnApi {\n path: string;\n pkg: string;\n proxy?: CDN;\n version?: string;\n}\n\nexport const genCdnUrl = ({ pkg, version = 'latest', path, proxy }: CdnApi): string => {\n switch (proxy) {\n case 'unpkg': {\n return joinUrl(UNPKG_API, `${pkg}@${version}`, path);\n }\n default: {\n return joinUrl(ALIYUN_API, pkg, version, 'files', path);\n }\n }\n};\n\nexport { ALIYUN_API, UNPKG_API };\n"],"mappings":";AAAA,MAAM,YAAY;AAClB,MAAM,aAAa;AAEnB,MAAM,WAAW,MAAc,GAAG,aAA+B;CAC/D,MAAM,SAAS,CACb,KAAK,QAAQ,QAAQ,EAAE,GACvB,GAAG,SAAS,KAAK,YAAY,QAAQ,WAAW,cAAc,EAAE,CAAC,CACnE,CAAC,CACE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;CACX,OAAO,SAAS,GAAG,EAAE,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,OAAO,KAAK;AACzD;AAUA,MAAa,aAAa,EAAE,KAAK,UAAU,UAAU,MAAM,YAA4B;CACrF,QAAQ,OAAR;EACE,KAAK,SACH,OAAO,QAAQ,WAAW,GAAG,IAAI,GAAG,WAAW,IAAI;EAErD,SACE,OAAO,QAAQ,YAAY,KAAK,SAAS,SAAS,IAAI;CAE1D;AACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/utils/hashString.ts
|
|
2
|
+
const hashString = (input) => {
|
|
3
|
+
let h1 = 3735928559;
|
|
4
|
+
let h2 = 1103547991;
|
|
5
|
+
for (let index = 0; index < input.length; index++) {
|
|
6
|
+
const code = input.charCodeAt(index);
|
|
7
|
+
h1 = Math.imul(h1 ^ code, 2654435761);
|
|
8
|
+
h2 = Math.imul(h2 ^ code, 1597334677);
|
|
9
|
+
}
|
|
10
|
+
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507);
|
|
11
|
+
h1 ^= Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
12
|
+
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507);
|
|
13
|
+
h2 ^= Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
14
|
+
return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(36);
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { hashString };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=hashString.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashString.mjs","names":[],"sources":["../../src/utils/hashString.ts"],"sourcesContent":["// cyrb53: a fast non-cryptographic 53-bit string hash, enough for in-memory cache keys.\nexport const hashString = (input: string): string => {\n let h1 = 0xDE_AD_BE_EF;\n let h2 = 0x41_C6_CE_57;\n for (let index = 0; index < input.length; index++) {\n const code = input.charCodeAt(index);\n h1 = Math.imul(h1 ^ code, 2_654_435_761);\n h2 = Math.imul(h2 ^ code, 1_597_334_677);\n }\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2_246_822_507);\n h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3_266_489_909);\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2_246_822_507);\n h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3_266_489_909);\n return (4_294_967_296 * (2_097_151 & h2) + (h1 >>> 0)).toString(36);\n};\n"],"mappings":";AACA,MAAa,cAAc,UAA0B;CACnD,IAAI,KAAK;CACT,IAAI,KAAK;CACT,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS;EACjD,MAAM,OAAO,MAAM,WAAW,KAAK;EACnC,KAAK,KAAK,KAAK,KAAK,MAAM,UAAa;EACvC,KAAK,KAAK,KAAK,KAAK,MAAM,UAAa;CACzC;CACA,KAAK,KAAK,KAAK,KAAM,OAAO,IAAK,UAAa;CAC9C,MAAM,KAAK,KAAK,KAAM,OAAO,IAAK,UAAa;CAC/C,KAAK,KAAK,KAAK,KAAM,OAAO,IAAK,UAAa;CAC9C,MAAM,KAAK,KAAK,KAAM,OAAO,IAAK,UAAa;CAC/C,QAAQ,cAAiB,UAAY,OAAO,OAAO,GAAA,CAAI,SAAS,EAAE;AACpE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
//#region src/utils/mergeRefs.ts
|
|
3
|
+
const assignRef = (ref, value) => {
|
|
4
|
+
if (typeof ref === "function") return ref(value);
|
|
5
|
+
if (ref) ref.current = value;
|
|
6
|
+
};
|
|
7
|
+
const mergeRefs = (refs) => (value) => {
|
|
8
|
+
const cleanups = refs.map((ref) => {
|
|
9
|
+
const cleanup = assignRef(ref, value);
|
|
10
|
+
return typeof cleanup === "function" ? cleanup : () => assignRef(ref, null);
|
|
11
|
+
});
|
|
12
|
+
return () => {
|
|
13
|
+
for (const cleanup of cleanups) cleanup();
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
const useMergeRefs = (refs) => useMemo(() => mergeRefs(refs), refs);
|
|
17
|
+
//#endregion
|
|
18
|
+
export { mergeRefs, useMergeRefs };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=mergeRefs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeRefs.mjs","names":[],"sources":["../../src/utils/mergeRefs.ts"],"sourcesContent":["import { type Ref, type RefCallback, useMemo } from 'react';\n\ntype MaybeRef<T> = Ref<T> | undefined;\n\nconst assignRef = <T>(ref: MaybeRef<T>, value: T | null): ReturnType<RefCallback<T>> => {\n if (typeof ref === 'function') return ref(value);\n if (ref) ref.current = value;\n};\n\nexport const mergeRefs =\n <T>(refs: MaybeRef<T>[]): RefCallback<T> =>\n (value) => {\n const cleanups = refs.map((ref) => {\n const cleanup = assignRef(ref, value);\n return typeof cleanup === 'function' ? cleanup : () => assignRef(ref, null);\n });\n return () => {\n for (const cleanup of cleanups) cleanup();\n };\n };\n\nexport const useMergeRefs = <T>(refs: MaybeRef<T>[]): RefCallback<T> =>\n useMemo(() => mergeRefs(refs), refs);\n"],"mappings":";;AAIA,MAAM,aAAgB,KAAkB,UAAgD;CACtF,IAAI,OAAO,QAAQ,YAAY,OAAO,IAAI,KAAK;CAC/C,IAAI,KAAK,IAAI,UAAU;AACzB;AAEA,MAAa,aACP,UACH,UAAU;CACT,MAAM,WAAW,KAAK,KAAK,QAAQ;EACjC,MAAM,UAAU,UAAU,KAAK,KAAK;EACpC,OAAO,OAAO,YAAY,aAAa,gBAAgB,UAAU,KAAK,IAAI;CAC5E,CAAC;CACD,aAAa;EACX,KAAK,MAAM,WAAW,UAAU,QAAQ;CAC1C;AACF;AAEF,MAAa,gBAAmB,SAC9B,cAAc,UAAU,IAAI,GAAG,IAAI"}
|
package/es/utils/placement.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Placement } from "@floating-ui/react";
|
|
2
1
|
//#region src/utils/placement.d.ts
|
|
2
|
+
type FloatingUIPlacement = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
|
|
3
3
|
/**
|
|
4
4
|
* Base UI uses a small set of string literal unions for alignment and side.
|
|
5
5
|
* We re-declare them here to avoid importing internal/non-exported Base UI paths.
|
|
@@ -16,12 +16,12 @@ export type PlacementConfig = {
|
|
|
16
16
|
* - Ant Design style: topLeft, topCenter, topRight, etc.
|
|
17
17
|
* - Additional aliases: top (same as topCenter), bottom (same as bottomCenter)
|
|
18
18
|
*/
|
|
19
|
-
type Placement
|
|
19
|
+
export type Placement = 'top' | 'topLeft' | 'topCenter' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomCenter' | 'bottomRight' | 'left' | 'leftTop' | 'leftBottom' | 'right' | 'rightTop' | 'rightBottom';
|
|
20
20
|
/**
|
|
21
21
|
* Map of placement values to Base UI placement config
|
|
22
22
|
* Used by Popover and DropdownMenu components
|
|
23
23
|
*/
|
|
24
|
-
export declare const placementMap: Record<Placement
|
|
24
|
+
export declare const placementMap: Record<Placement, PlacementConfig>;
|
|
25
25
|
/**
|
|
26
26
|
* Convert unified Placement to Floating UI placement format
|
|
27
27
|
* Used by Tooltip component which uses @floating-ui/react
|
|
@@ -29,7 +29,7 @@ export declare const placementMap: Record<Placement$1, PlacementConfig>;
|
|
|
29
29
|
* @param placement - Unified placement value
|
|
30
30
|
* @returns Floating UI placement (e.g., 'top-start', 'bottom-end')
|
|
31
31
|
*/
|
|
32
|
-
export declare const toFloatingUIPlacement: (placement?: Placement
|
|
32
|
+
export declare const toFloatingUIPlacement: (placement?: Placement) => FloatingUIPlacement;
|
|
33
33
|
//#endregion
|
|
34
|
-
export {
|
|
34
|
+
export {};
|
|
35
35
|
//# sourceMappingURL=placement.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placement.mjs","names":[],"sources":["../../src/utils/placement.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"placement.mjs","names":[],"sources":["../../src/utils/placement.ts"],"sourcesContent":["type FloatingUIPlacement =\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'left'\n | 'left-start'\n | 'left-end';\n\n/**\n * Base UI uses a small set of string literal unions for alignment and side.\n * We re-declare them here to avoid importing internal/non-exported Base UI paths.\n */\nexport type Side = 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start';\nexport type Align = 'start' | 'center' | 'end';\n\nexport type PlacementConfig = {\n align: Align;\n side: Side;\n};\n\n/**\n * All supported placement values\n * - Unified placement names for Tooltip, Popover, and DropdownMenu\n * - Ant Design style: topLeft, topCenter, topRight, etc.\n * - Additional aliases: top (same as topCenter), bottom (same as bottomCenter)\n */\nexport type Placement =\n | 'top'\n | 'topLeft'\n | 'topCenter'\n | 'topRight'\n | 'bottom'\n | 'bottomLeft'\n | 'bottomCenter'\n | 'bottomRight'\n | 'left'\n | 'leftTop'\n | 'leftBottom'\n | 'right'\n | 'rightTop'\n | 'rightBottom';\n\nconst top: PlacementConfig = { align: 'center', side: 'top' };\nconst topLeft: PlacementConfig = { align: 'start', side: 'top' };\nconst topRight: PlacementConfig = { align: 'end', side: 'top' };\nconst bottom: PlacementConfig = { align: 'center', side: 'bottom' };\nconst bottomLeft: PlacementConfig = { align: 'start', side: 'bottom' };\nconst bottomRight: PlacementConfig = { align: 'end', side: 'bottom' };\nconst left: PlacementConfig = { align: 'center', side: 'left' };\nconst leftTop: PlacementConfig = { align: 'start', side: 'left' };\nconst leftBottom: PlacementConfig = { align: 'end', side: 'left' };\nconst right: PlacementConfig = { align: 'center', side: 'right' };\nconst rightTop: PlacementConfig = { align: 'start', side: 'right' };\nconst rightBottom: PlacementConfig = { align: 'end', side: 'right' };\n\n/**\n * Map of placement values to Base UI placement config\n * Used by Popover and DropdownMenu components\n */\nexport const placementMap: Record<Placement, PlacementConfig> = {\n bottom,\n bottomCenter: bottom,\n bottomLeft,\n bottomRight,\n left,\n leftBottom,\n leftTop,\n right,\n rightBottom,\n rightTop,\n top,\n topCenter: top,\n topLeft,\n topRight,\n};\n\n/**\n * Convert unified Placement to Floating UI placement format\n * Used by Tooltip component which uses @floating-ui/react\n *\n * @param placement - Unified placement value\n * @returns Floating UI placement (e.g., 'top-start', 'bottom-end')\n */\nexport const toFloatingUIPlacement = (placement?: Placement): FloatingUIPlacement => {\n if (!placement) return 'top';\n\n switch (placement) {\n case 'topLeft': {\n return 'top-start';\n }\n case 'top':\n case 'topCenter': {\n return 'top';\n }\n case 'topRight': {\n return 'top-end';\n }\n case 'bottomLeft': {\n return 'bottom-start';\n }\n case 'bottom':\n case 'bottomCenter': {\n return 'bottom';\n }\n case 'bottomRight': {\n return 'bottom-end';\n }\n case 'leftTop': {\n return 'left-start';\n }\n case 'left': {\n return 'left';\n }\n case 'leftBottom': {\n return 'left-end';\n }\n case 'rightTop': {\n return 'right-start';\n }\n case 'right': {\n return 'right';\n }\n case 'rightBottom': {\n return 'right-end';\n }\n default: {\n return 'top';\n }\n }\n};\n"],"mappings":";AAgDA,MAAM,MAAuB;CAAE,OAAO;CAAU,MAAM;AAAM;AAC5D,MAAM,UAA2B;CAAE,OAAO;CAAS,MAAM;AAAM;AAC/D,MAAM,WAA4B;CAAE,OAAO;CAAO,MAAM;AAAM;AAC9D,MAAM,SAA0B;CAAE,OAAO;CAAU,MAAM;AAAS;;;;;AAclE,MAAa,eAAmD;CAC9D;CACA,cAAc;CACd;EAhBoC,OAAO;EAAS,MAAM;CAgB1D;CACA;EAhBqC,OAAO;EAAO,MAAM;CAgBzD;CACA;EAhB8B,OAAO;EAAU,MAAM;CAgBrD;CACA;EAfoC,OAAO;EAAO,MAAM;CAexD;CACA;EAjBiC,OAAO;EAAS,MAAM;CAiBvD;CACA;EAhB+B,OAAO;EAAU,MAAM;CAgBtD;CACA;EAfqC,OAAO;EAAO,MAAM;CAezD;CACA;EAjBkC,OAAO;EAAS,MAAM;CAiBxD;CACA;CACA,WAAW;CACX;CACA;AACF;;;;;;;;AASA,MAAa,yBAAyB,cAA+C;CACnF,IAAI,CAAC,WAAW,OAAO;CAEvB,QAAQ,WAAR;EACE,KAAK,WACH,OAAO;EAET,KAAK;EACL,KAAK,aACH,OAAO;EAET,KAAK,YACH,OAAO;EAET,KAAK,cACH,OAAO;EAET,KAAK;EACL,KAAK,gBACH,OAAO;EAET,KAAK,eACH,OAAO;EAET,KAAK,WACH,OAAO;EAET,KAAK,QACH,OAAO;EAET,KAAK,cACH,OAAO;EAET,KAAK,YACH,OAAO;EAET,KAAK,SACH,OAAO;EAET,KAAK,eACH,OAAO;EAET,SACE,OAAO;CAEX;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/ui",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.5",
|
|
4
4
|
"description": "Lobe UI is an open-source UI component library for building AIGC web apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"type-check": "lobedocs typegen && tsc --noEmit && tsc --noEmit -p tsconfig.site.json"
|
|
130
130
|
},
|
|
131
131
|
"dependencies": {
|
|
132
|
-
"@base-ui/react": "1.
|
|
132
|
+
"@base-ui/react": "1.9.0",
|
|
133
133
|
"@dnd-kit/core": "^6.3.1",
|
|
134
134
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
135
135
|
"@dnd-kit/sortable": "^10.0.0",
|
|
@@ -137,74 +137,48 @@
|
|
|
137
137
|
"@emoji-mart/data": "^1.2.1",
|
|
138
138
|
"@emoji-mart/react": "^1.1.1",
|
|
139
139
|
"@emotion/css": "^11.13.5",
|
|
140
|
-
"@emotion/is-prop-valid": "^1.4.0",
|
|
141
140
|
"@emotion/serialize": "^1.3.3",
|
|
142
|
-
"@floating-ui/react": "^0.27.19",
|
|
143
141
|
"@giscus/react": "^3.1.0",
|
|
144
|
-
"@lobehub/streamdown": "^1.
|
|
142
|
+
"@lobehub/streamdown": "^1.4.0",
|
|
145
143
|
"@mdx-js/mdx": "^3.1.1",
|
|
146
|
-
"@
|
|
147
|
-
"@
|
|
148
|
-
"@
|
|
149
|
-
"@shikijs/
|
|
150
|
-
"@shikijs/stream": "^4.3.1",
|
|
151
|
-
"@shikijs/transformers": "^4.3.1",
|
|
144
|
+
"@pierre/diffs": "1.5.2",
|
|
145
|
+
"@shikijs/core": "^4.5.0",
|
|
146
|
+
"@shikijs/stream": "^4.5.0",
|
|
147
|
+
"@shikijs/transformers": "^4.5.0",
|
|
152
148
|
"@splinetool/runtime": "1.12.98",
|
|
153
149
|
"@stylexjs/stylex": "0.19.1",
|
|
154
150
|
"@tanstack/form-core": "^1.33.5",
|
|
155
|
-
"@tanstack/react-table": "^9.2.
|
|
156
|
-
"ahooks": "^3.9.7",
|
|
151
|
+
"@tanstack/react-table": "^9.2.8",
|
|
157
152
|
"beautiful-mermaid": "^1.1.3",
|
|
158
153
|
"chroma-js": "^3.2.0",
|
|
159
|
-
"class-variance-authority": "^0.7.1",
|
|
160
154
|
"clsx": "^2.1.1",
|
|
161
155
|
"dayjs": "^1.11.21",
|
|
162
156
|
"emoji-mart": "^5.6.0",
|
|
163
|
-
"es-toolkit": "^1.
|
|
164
|
-
"fast-deep-equal": "^3.1.3",
|
|
157
|
+
"es-toolkit": "^1.52.0",
|
|
165
158
|
"hast-util-from-html-isomorphic": "^2.0.0",
|
|
166
|
-
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
167
159
|
"hast-util-to-text": "^4.0.2",
|
|
168
|
-
"
|
|
169
|
-
"immer": "^11.1.11",
|
|
170
|
-
"katex": "^0.18.1",
|
|
160
|
+
"katex": "^0.18.1 || ^0.19.0",
|
|
171
161
|
"leva": "^0.10.1",
|
|
172
|
-
"lucide-react": "^1.
|
|
173
|
-
"marked": "^18.0.6",
|
|
162
|
+
"lucide-react": "^1.55.0",
|
|
174
163
|
"motion": "^13.0.0 || ^14.0.0",
|
|
175
|
-
"numeral": "^2.0.6",
|
|
176
|
-
"polished": "^4.3.1",
|
|
177
|
-
"query-string": "^9.4.1",
|
|
178
164
|
"re-resizable": "^6.11.2",
|
|
179
|
-
"react-avatar-editor": "^
|
|
180
|
-
"react-error-boundary": "^6.1.
|
|
165
|
+
"react-avatar-editor": "^16.0.0",
|
|
166
|
+
"react-error-boundary": "^6.1.6",
|
|
181
167
|
"react-hotkeys-hook": "^5.3.3",
|
|
182
168
|
"react-markdown": "^10.1.0",
|
|
183
|
-
"react-merge-refs": "^3.0.2",
|
|
184
|
-
"react-rnd": "^10.5.3",
|
|
185
|
-
"react-zoom-pan-pinch": "^4.0.3",
|
|
186
169
|
"rehype-github-alerts": "^4.2.0",
|
|
187
170
|
"rehype-raw": "^7.0.0",
|
|
188
171
|
"rehype-sanitize": "^6.0.0",
|
|
189
172
|
"remark-breaks": "^4.0.0",
|
|
190
|
-
"remark-cjk-friendly": "^2.3.
|
|
173
|
+
"remark-cjk-friendly": "^2.3.2",
|
|
191
174
|
"remark-gfm": "^4.0.1",
|
|
192
|
-
"remark-github": "^12.0.0",
|
|
193
175
|
"remark-math": "^6.0.0",
|
|
194
|
-
"
|
|
195
|
-
"remark-rehype": "^11.1.2",
|
|
196
|
-
"remend": "^1.3.0",
|
|
197
|
-
"shiki": "^4.3.1",
|
|
198
|
-
"swr": "^2.4.2",
|
|
199
|
-
"ts-md5": "^2.0.1",
|
|
176
|
+
"shiki": "^4.5.0",
|
|
200
177
|
"unified": "^11.0.5",
|
|
201
178
|
"unist-util-visit-parents": "^6.0.2",
|
|
202
179
|
"uqr": "^0.1.3",
|
|
203
|
-
"url-join": "^5.0.0",
|
|
204
|
-
"use-merge-value": "^1.2.0",
|
|
205
|
-
"uuid": "^14.0.1",
|
|
206
180
|
"vfile": "^6.0.3",
|
|
207
|
-
"virtua": "^0.
|
|
181
|
+
"virtua": "^0.53.5"
|
|
208
182
|
},
|
|
209
183
|
"peerDependencies": {
|
|
210
184
|
"@lobehub/fluent-emoji": "^5.0.0-beta.1",
|