Refactor IconPackage

This commit is contained in:
chinboy
2025-02-15 17:08:40 +08:00
parent 0d4f47a0c1
commit 2ce345078f
7 changed files with 908 additions and 15011 deletions
@@ -228,11 +228,12 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme
{
var transitionsStyle = new Style(selector => selector.Nesting().PropertyEquals(AddOnDecoratedInnerBox.IsMotionEnabledProperty, true));
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart));
decoratorStyle.Add(new Setter(Border.TransitionsProperty, new Transitions
decoratorStyle.Add(new Setter(Border.TransitionsProperty, new SetterValueFactory<Transitions>(() => new Transitions
{
AnimationUtils.CreateTransition<SolidColorBrushTransition>(Border.BorderBrushProperty),
AnimationUtils.CreateTransition<SolidColorBrushTransition>(Border.BackgroundProperty)
}));
})));
transitionsStyle.Add(decoratorStyle);
commonStyle.Add(transitionsStyle);
}
@@ -317,8 +318,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme
{
var innerBoxDecoratorStyle =
new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart));
innerBoxDecoratorStyle.Add(Border.BorderBrushProperty,
AddOnDecoratedBoxTokenKey.HoverBorderColor);
innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, AddOnDecoratedBoxTokenKey.HoverBorderColor);
hoverStyle.Add(innerBoxDecoratorStyle);
}
@@ -328,8 +328,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme
{
var innerBoxDecoratorStyle =
new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart));
innerBoxDecoratorStyle.Add(Border.BorderBrushProperty,
AddOnDecoratedBoxTokenKey.ActiveBorderColor);
innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, AddOnDecoratedBoxTokenKey.ActiveBorderColor);
focusStyle.Add(innerBoxDecoratorStyle);
}
outlineStyle.Add(focusStyle);
@@ -431,8 +430,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme
{
var innerBoxDecoratorStyle =
new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart));
innerBoxDecoratorStyle.Add(Border.BorderBrushProperty,
AddOnDecoratedBoxTokenKey.ActiveBorderColor);
innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, AddOnDecoratedBoxTokenKey.ActiveBorderColor);
innerBoxDecoratorStyle.Add(Border.BackgroundProperty, SharedTokenKey.ColorTransparent);
focusStyle.Add(innerBoxDecoratorStyle);
}
+3 -15
View File
@@ -139,13 +139,7 @@ internal class AlertTheme : BaseControlTheme
{
Name = InfoIconPart
};
infoIcon.Bind(Visual.IsVisibleProperty, new Binding("IsShowIcon")
{
RelativeSource = new RelativeSource
{
Mode = RelativeSourceMode.TemplatedParent
}
});
CreateTemplateParentBinding(infoIcon, Visual.IsVisibleProperty, Alert.IsShowIconProperty);
Grid.SetRow(infoIcon, 0);
Grid.SetColumn(infoIcon, 0);
return infoIcon;
@@ -174,13 +168,7 @@ internal class AlertTheme : BaseControlTheme
HorizontalAlignment = HorizontalAlignment.Stretch,
Padding = new Thickness(0)
};
label.Bind(Visual.IsVisibleProperty, new Binding("IsMessageMarqueEnabled")
{
RelativeSource = new RelativeSource
{
Mode = RelativeSourceMode.TemplatedParent
}
});
CreateTemplateParentBinding(label, Visual.IsVisibleProperty, Alert.IsMessageMarqueEnabledProperty);
BindUtils.RelayBind(alert, Alert.MessageProperty, label, MarqueeLabel.TextProperty);
return label;
}
@@ -343,7 +331,7 @@ internal class AlertTheme : BaseControlTheme
var successStyle = new Style(selector =>
selector.Nesting().PropertyEquals(Alert.TypeProperty, AlertType.Success));
var infoIconStyle = new Style(selector => infoIconSelector);
infoIconStyle.Add(Icon.IconInfoProperty, AntDesignIconPackage.Current.GetIconInfo(AntDesignIconKind.CheckCircleFilled));
infoIconStyle.Add(Icon.IconInfoProperty, new SetterValueFactory<IconInfo>(() => AntDesignIconPackage.Current.GetIconInfo(AntDesignIconKind.CheckCircleFilled)));
infoIconStyle.Add(Icon.NormalFilledBrushProperty, SharedTokenKey.ColorSuccess);
successStyle.Add(infoIconStyle);
Add(successStyle);
@@ -1,838 +0,0 @@
///
/// This code is auto generated. Do not amend.
///
namespace AtomUI.IconPkg.AntDesign;
public enum AntDesignIconKind
{
AccountBookFilled = 1,
AlertFilled = 2,
AlipayCircleFilled = 3,
AlipaySquareFilled = 4,
AliwangwangFilled = 5,
AmazonCircleFilled = 6,
AmazonSquareFilled = 7,
AndroidFilled = 8,
ApiFilled = 9,
AppleFilled = 10,
AppstoreFilled = 11,
AudioFilled = 12,
BackwardFilled = 13,
BankFilled = 14,
BehanceCircleFilled = 15,
BehanceSquareFilled = 16,
BellFilled = 17,
BilibiliFilled = 18,
BookFilled = 19,
BoxPlotFilled = 20,
BugFilled = 21,
BuildFilled = 22,
BulbFilled = 23,
CalculatorFilled = 24,
CalendarFilled = 25,
CameraFilled = 26,
CarFilled = 27,
CaretDownFilled = 28,
CaretLeftFilled = 29,
CaretRightFilled = 30,
CaretUpFilled = 31,
CarryOutFilled = 32,
CheckCircleFilled = 33,
CheckSquareFilled = 34,
ChromeFilled = 35,
CiCircleFilled = 36,
ClockCircleFilled = 37,
CloseCircleFilled = 38,
CloseSquareFilled = 39,
CloudFilled = 40,
CodeSandboxCircleFilled = 41,
CodeSandboxSquareFilled = 42,
CodeFilled = 43,
CodepenCircleFilled = 44,
CodepenSquareFilled = 45,
CompassFilled = 46,
ContactsFilled = 47,
ContainerFilled = 48,
ControlFilled = 49,
CopyFilled = 50,
CopyrightCircleFilled = 51,
CreditCardFilled = 52,
CrownFilled = 53,
CustomerServiceFilled = 54,
DashboardFilled = 55,
DatabaseFilled = 56,
DeleteFilled = 57,
DiffFilled = 58,
DingtalkCircleFilled = 59,
DingtalkSquareFilled = 60,
DiscordFilled = 61,
DislikeFilled = 62,
DollarCircleFilled = 63,
DownCircleFilled = 64,
DownSquareFilled = 65,
DribbbleCircleFilled = 66,
DribbbleSquareFilled = 67,
DropboxCircleFilled = 68,
DropboxSquareFilled = 69,
EditFilled = 70,
EnvironmentFilled = 71,
EuroCircleFilled = 72,
ExclamationCircleFilled = 73,
ExperimentFilled = 74,
EyeInvisibleFilled = 75,
EyeFilled = 76,
FacebookFilled = 77,
FastBackwardFilled = 78,
FastForwardFilled = 79,
FileAddFilled = 80,
FileExcelFilled = 81,
FileExclamationFilled = 82,
FileImageFilled = 83,
FileMarkdownFilled = 84,
FilePdfFilled = 85,
FilePptFilled = 86,
FileTextFilled = 87,
FileUnknownFilled = 88,
FileWordFilled = 89,
FileZipFilled = 90,
FileFilled = 91,
FilterFilled = 92,
FireFilled = 93,
FlagFilled = 94,
FolderAddFilled = 95,
FolderOpenFilled = 96,
FolderFilled = 97,
FormatPainterFilled = 98,
ForwardFilled = 99,
FrownFilled = 100,
FundFilled = 101,
FunnelPlotFilled = 102,
GiftFilled = 103,
GithubFilled = 104,
GitlabFilled = 105,
GoldFilled = 106,
GoldenFilled = 107,
GoogleCircleFilled = 108,
GooglePlusCircleFilled = 109,
GooglePlusSquareFilled = 110,
GoogleSquareFilled = 111,
HddFilled = 112,
HeartFilled = 113,
HighlightFilled = 114,
HomeFilled = 115,
HourglassFilled = 116,
Html5Filled = 117,
IdcardFilled = 118,
IeCircleFilled = 119,
IeSquareFilled = 120,
InfoCircleFilled = 121,
InstagramFilled = 122,
InsuranceFilled = 123,
InteractionFilled = 124,
LayoutFilled = 125,
LeftCircleFilled = 126,
LeftSquareFilled = 127,
LikeFilled = 128,
LinkedinFilled = 129,
LockFilled = 130,
MacCommandFilled = 131,
MailFilled = 132,
MedicineBoxFilled = 133,
MediumCircleFilled = 134,
MediumSquareFilled = 135,
MehFilled = 136,
MergeFilled = 137,
MessageFilled = 138,
MinusCircleFilled = 139,
MinusSquareFilled = 140,
MobileFilled = 141,
MoneyCollectFilled = 142,
MoonFilled = 143,
MutedFilled = 144,
NotificationFilled = 145,
OpenAIFilled = 146,
PauseCircleFilled = 147,
PayCircleFilled = 148,
PhoneFilled = 149,
PictureFilled = 150,
PieChartFilled = 151,
PinterestFilled = 152,
PlayCircleFilled = 153,
PlaySquareFilled = 154,
PlusCircleFilled = 155,
PlusSquareFilled = 156,
PoundCircleFilled = 157,
PrinterFilled = 158,
ProductFilled = 159,
ProfileFilled = 160,
ProjectFilled = 161,
PropertySafetyFilled = 162,
PushpinFilled = 163,
QqCircleFilled = 164,
QqSquareFilled = 165,
QuestionCircleFilled = 166,
ReadFilled = 167,
ReconciliationFilled = 168,
RedEnvelopeFilled = 169,
RedditCircleFilled = 170,
RedditSquareFilled = 171,
RestFilled = 172,
RightCircleFilled = 173,
RightSquareFilled = 174,
RobotFilled = 175,
RocketFilled = 176,
SafetyCertificateFilled = 177,
SaveFilled = 178,
ScheduleFilled = 179,
SecurityScanFilled = 180,
SettingFilled = 181,
ShopFilled = 182,
ShoppingFilled = 183,
SignalFilled = 184,
SignatureFilled = 185,
SketchCircleFilled = 186,
SketchSquareFilled = 187,
SkinFilled = 188,
SkypeFilled = 189,
SlackCircleFilled = 190,
SlackSquareFilled = 191,
SlidersFilled = 192,
SmileFilled = 193,
SnippetsFilled = 194,
SoundFilled = 195,
SpotifyFilled = 196,
StarFilled = 197,
StepBackwardFilled = 198,
StepForwardFilled = 199,
StopFilled = 200,
SunFilled = 201,
SwitcherFilled = 202,
TabletFilled = 203,
TagFilled = 204,
TagsFilled = 205,
TaobaoCircleFilled = 206,
TaobaoSquareFilled = 207,
ThunderboltFilled = 208,
TikTokFilled = 209,
ToolFilled = 210,
TrademarkCircleFilled = 211,
TrophyFilled = 212,
TruckFilled = 213,
TwitchFilled = 214,
TwitterCircleFilled = 215,
TwitterSquareFilled = 216,
UnlockFilled = 217,
UpCircleFilled = 218,
UpSquareFilled = 219,
UsbFilled = 220,
VideoCameraFilled = 221,
WalletFilled = 222,
WarningFilled = 223,
WechatWorkFilled = 224,
WechatFilled = 225,
WeiboCircleFilled = 226,
WeiboSquareFilled = 227,
WindowsFilled = 228,
XFilled = 229,
YahooFilled = 230,
YoutubeFilled = 231,
YuqueFilled = 232,
ZhihuCircleFilled = 233,
ZhihuSquareFilled = 234,
AccountBookOutlined = 235,
AimOutlined = 236,
AlertOutlined = 237,
AlibabaOutlined = 238,
AlignCenterOutlined = 239,
AlignLeftOutlined = 240,
AlignRightOutlined = 241,
AlipayCircleOutlined = 242,
AlipayOutlined = 243,
AliwangwangOutlined = 244,
AliyunOutlined = 245,
AmazonOutlined = 246,
AndroidOutlined = 247,
AntCloudOutlined = 248,
AntDesignOutlined = 249,
ApartmentOutlined = 250,
ApiOutlined = 251,
AppleOutlined = 252,
AppstoreAddOutlined = 253,
AppstoreOutlined = 254,
AreaChartOutlined = 255,
ArrowDownOutlined = 256,
ArrowLeftOutlined = 257,
ArrowRightOutlined = 258,
ArrowUpOutlined = 259,
ArrowsAltOutlined = 260,
AudioMutedOutlined = 261,
AudioOutlined = 262,
AuditOutlined = 263,
BackwardOutlined = 264,
BaiduOutlined = 265,
BankOutlined = 266,
BarChartOutlined = 267,
BarcodeOutlined = 268,
BarsOutlined = 269,
BehanceSquareOutlined = 270,
BehanceOutlined = 271,
BellOutlined = 272,
BgColorsOutlined = 273,
BilibiliOutlined = 274,
BlockOutlined = 275,
BoldOutlined = 276,
BookOutlined = 277,
BorderBottomOutlined = 278,
BorderHorizontalOutlined = 279,
BorderInnerOutlined = 280,
BorderLeftOutlined = 281,
BorderOuterOutlined = 282,
BorderRightOutlined = 283,
BorderTopOutlined = 284,
BorderVerticleOutlined = 285,
BorderOutlined = 286,
BorderlessTableOutlined = 287,
BoxPlotOutlined = 288,
BranchesOutlined = 289,
BugOutlined = 290,
BuildOutlined = 291,
BulbOutlined = 292,
CalculatorOutlined = 293,
CalendarOutlined = 294,
CameraOutlined = 295,
CarOutlined = 296,
CaretDownOutlined = 297,
CaretLeftOutlined = 298,
CaretRightOutlined = 299,
CaretUpOutlined = 300,
CarryOutOutlined = 301,
CheckCircleOutlined = 302,
CheckSquareOutlined = 303,
CheckOutlined = 304,
ChromeOutlined = 305,
CiCircleOutlined = 306,
CiOutlined = 307,
ClearOutlined = 308,
ClockCircleOutlined = 309,
CloseCircleOutlined = 310,
CloseSquareOutlined = 311,
CloseOutlined = 312,
CloudDownloadOutlined = 313,
CloudServerOutlined = 314,
CloudSyncOutlined = 315,
CloudUploadOutlined = 316,
CloudOutlined = 317,
ClusterOutlined = 318,
CodeSandboxOutlined = 319,
CodeOutlined = 320,
CodepenCircleOutlined = 321,
CodepenOutlined = 322,
CoffeeOutlined = 323,
ColumnHeightOutlined = 324,
ColumnWidthOutlined = 325,
CommentOutlined = 326,
CompassOutlined = 327,
CompressOutlined = 328,
ConsoleSqlOutlined = 329,
ContactsOutlined = 330,
ContainerOutlined = 331,
ControlOutlined = 332,
CopyOutlined = 333,
CopyrightCircleOutlined = 334,
CopyrightOutlined = 335,
CreditCardOutlined = 336,
CrownOutlined = 337,
CustomerServiceOutlined = 338,
DashOutlined = 339,
DashboardOutlined = 340,
DatabaseOutlined = 341,
DeleteColumnOutlined = 342,
DeleteRowOutlined = 343,
DeleteOutlined = 344,
DeliveredProcedureOutlined = 345,
DeploymentUnitOutlined = 346,
DesktopOutlined = 347,
DiffOutlined = 348,
DingdingOutlined = 349,
DingtalkOutlined = 350,
DisconnectOutlined = 351,
DiscordOutlined = 352,
DislikeOutlined = 353,
DockerOutlined = 354,
DollarCircleOutlined = 355,
DollarOutlined = 356,
DotChartOutlined = 357,
DotNetOutlined = 358,
DoubleLeftOutlined = 359,
DoubleRightOutlined = 360,
DownCircleOutlined = 361,
DownSquareOutlined = 362,
DownOutlined = 363,
DownloadOutlined = 364,
DragOutlined = 365,
DribbbleSquareOutlined = 366,
DribbbleOutlined = 367,
DropboxOutlined = 368,
EditOutlined = 369,
EllipsisOutlined = 370,
EnterOutlined = 371,
EnvironmentOutlined = 372,
EuroCircleOutlined = 373,
EuroOutlined = 374,
ExceptionOutlined = 375,
ExclamationCircleOutlined = 376,
ExclamationOutlined = 377,
ExpandAltOutlined = 378,
ExpandOutlined = 379,
ExperimentOutlined = 380,
ExportOutlined = 381,
EyeInvisibleOutlined = 382,
EyeOutlined = 383,
FacebookOutlined = 384,
FallOutlined = 385,
FastBackwardOutlined = 386,
FastForwardOutlined = 387,
FieldBinaryOutlined = 388,
FieldNumberOutlined = 389,
FieldStringOutlined = 390,
FieldTimeOutlined = 391,
FileAddOutlined = 392,
FileDoneOutlined = 393,
FileExcelOutlined = 394,
FileExclamationOutlined = 395,
FileGifOutlined = 396,
FileImageOutlined = 397,
FileJpgOutlined = 398,
FileMarkdownOutlined = 399,
FilePdfOutlined = 400,
FilePptOutlined = 401,
FileProtectOutlined = 402,
FileSearchOutlined = 403,
FileSyncOutlined = 404,
FileTextOutlined = 405,
FileUnknownOutlined = 406,
FileWordOutlined = 407,
FileZipOutlined = 408,
FileOutlined = 409,
FilterOutlined = 410,
FireOutlined = 411,
FlagOutlined = 412,
FolderAddOutlined = 413,
FolderOpenOutlined = 414,
FolderViewOutlined = 415,
FolderOutlined = 416,
FontColorsOutlined = 417,
FontSizeOutlined = 418,
ForkOutlined = 419,
FormOutlined = 420,
FormatPainterOutlined = 421,
ForwardOutlined = 422,
FrownOutlined = 423,
FullscreenExitOutlined = 424,
FullscreenOutlined = 425,
FunctionOutlined = 426,
FundProjectionScreenOutlined = 427,
FundViewOutlined = 428,
FundOutlined = 429,
FunnelPlotOutlined = 430,
GatewayOutlined = 431,
GifOutlined = 432,
GiftOutlined = 433,
GithubOutlined = 434,
GitlabOutlined = 435,
GlobalOutlined = 436,
GoldOutlined = 437,
GooglePlusOutlined = 438,
GoogleOutlined = 439,
GroupOutlined = 440,
HarmonyOSOutlined = 441,
HddOutlined = 442,
HeartOutlined = 443,
HeatMapOutlined = 444,
HighlightOutlined = 445,
HistoryOutlined = 446,
HolderOutlined = 447,
HomeOutlined = 448,
HourglassOutlined = 449,
Html5Outlined = 450,
IdcardOutlined = 451,
IeOutlined = 452,
ImportOutlined = 453,
InboxOutlined = 454,
InfoCircleOutlined = 455,
InfoOutlined = 456,
InsertRowAboveOutlined = 457,
InsertRowBelowOutlined = 458,
InsertRowLeftOutlined = 459,
InsertRowRightOutlined = 460,
InstagramOutlined = 461,
InsuranceOutlined = 462,
InteractionOutlined = 463,
IssuesCloseOutlined = 464,
ItalicOutlined = 465,
JavaScriptOutlined = 466,
JavaOutlined = 467,
KeyOutlined = 468,
KubernetesOutlined = 469,
LaptopOutlined = 470,
LayoutOutlined = 471,
LeftCircleOutlined = 472,
LeftSquareOutlined = 473,
LeftOutlined = 474,
LikeOutlined = 475,
LineChartOutlined = 476,
LineHeightOutlined = 477,
LineOutlined = 478,
LinkOutlined = 479,
LinkedinOutlined = 480,
LinuxOutlined = 481,
Loading3QuartersOutlined = 482,
LoadingOutlined = 483,
LockOutlined = 484,
LoginOutlined = 485,
LogoutOutlined = 486,
MacCommandOutlined = 487,
MailOutlined = 488,
ManOutlined = 489,
MedicineBoxOutlined = 490,
MediumWorkmarkOutlined = 491,
MediumOutlined = 492,
MehOutlined = 493,
MenuFoldOutlined = 494,
MenuUnfoldOutlined = 495,
MenuOutlined = 496,
MergeCellsOutlined = 497,
MergeOutlined = 498,
MessageOutlined = 499,
MinusCircleOutlined = 500,
MinusSquareOutlined = 501,
MinusOutlined = 502,
MobileOutlined = 503,
MoneyCollectOutlined = 504,
MonitorOutlined = 505,
MoonOutlined = 506,
MoreOutlined = 507,
MutedOutlined = 508,
NodeCollapseOutlined = 509,
NodeExpandOutlined = 510,
NodeIndexOutlined = 511,
NotificationOutlined = 512,
NumberOutlined = 513,
OneToOneOutlined = 514,
OpenAIOutlined = 515,
OrderedListOutlined = 516,
PaperClipOutlined = 517,
PartitionOutlined = 518,
PauseCircleOutlined = 519,
PauseOutlined = 520,
PayCircleOutlined = 521,
PercentageOutlined = 522,
PhoneOutlined = 523,
PicCenterOutlined = 524,
PicLeftOutlined = 525,
PicRightOutlined = 526,
PictureOutlined = 527,
PieChartOutlined = 528,
PinterestOutlined = 529,
PlayCircleOutlined = 530,
PlaySquareOutlined = 531,
PlusCircleOutlined = 532,
PlusSquareOutlined = 533,
PlusOutlined = 534,
PoundCircleOutlined = 535,
PoundOutlined = 536,
PoweroffOutlined = 537,
PrinterOutlined = 538,
ProductOutlined = 539,
ProfileOutlined = 540,
ProjectOutlined = 541,
PropertySafetyOutlined = 542,
PullRequestOutlined = 543,
PushpinOutlined = 544,
PythonOutlined = 545,
QqOutlined = 546,
QrcodeOutlined = 547,
QuestionCircleOutlined = 548,
QuestionOutlined = 549,
RadarChartOutlined = 550,
RadiusBottomleftOutlined = 551,
RadiusBottomrightOutlined = 552,
RadiusSettingOutlined = 553,
RadiusUpleftOutlined = 554,
RadiusUprightOutlined = 555,
ReadOutlined = 556,
ReconciliationOutlined = 557,
RedEnvelopeOutlined = 558,
RedditOutlined = 559,
RedoOutlined = 560,
ReloadOutlined = 561,
RestOutlined = 562,
RetweetOutlined = 563,
RightCircleOutlined = 564,
RightSquareOutlined = 565,
RightOutlined = 566,
RiseOutlined = 567,
RobotOutlined = 568,
RocketOutlined = 569,
RollbackOutlined = 570,
RotateLeftOutlined = 571,
RotateRightOutlined = 572,
RubyOutlined = 573,
SafetyCertificateOutlined = 574,
SafetyOutlined = 575,
SaveOutlined = 576,
ScanOutlined = 577,
ScheduleOutlined = 578,
ScissorOutlined = 579,
SearchOutlined = 580,
SecurityScanOutlined = 581,
SelectOutlined = 582,
SendOutlined = 583,
SettingOutlined = 584,
ShakeOutlined = 585,
ShareAltOutlined = 586,
ShopOutlined = 587,
ShoppingCartOutlined = 588,
ShoppingOutlined = 589,
ShrinkOutlined = 590,
SignatureOutlined = 591,
SisternodeOutlined = 592,
SketchOutlined = 593,
SkinOutlined = 594,
SkypeOutlined = 595,
SlackSquareOutlined = 596,
SlackOutlined = 597,
SlidersOutlined = 598,
SmallDashOutlined = 599,
SmileOutlined = 600,
SnippetsOutlined = 601,
SolutionOutlined = 602,
SortAscendingOutlined = 603,
SortDescendingOutlined = 604,
SoundOutlined = 605,
SplitCellsOutlined = 606,
SpotifyOutlined = 607,
StarOutlined = 608,
StepBackwardOutlined = 609,
StepForwardOutlined = 610,
StockOutlined = 611,
StopOutlined = 612,
StrikethroughOutlined = 613,
SubnodeOutlined = 614,
SunOutlined = 615,
SwapLeftOutlined = 616,
SwapRightOutlined = 617,
SwapOutlined = 618,
SwitcherOutlined = 619,
SyncOutlined = 620,
TableOutlined = 621,
TabletOutlined = 622,
TagOutlined = 623,
TagsOutlined = 624,
TaobaoCircleOutlined = 625,
TaobaoOutlined = 626,
TeamOutlined = 627,
ThunderboltOutlined = 628,
TikTokOutlined = 629,
ToTopOutlined = 630,
ToolOutlined = 631,
TrademarkCircleOutlined = 632,
TrademarkOutlined = 633,
TransactionOutlined = 634,
TranslationOutlined = 635,
TrophyOutlined = 636,
TruckOutlined = 637,
TwitchOutlined = 638,
TwitterOutlined = 639,
UnderlineOutlined = 640,
UndoOutlined = 641,
UngroupOutlined = 642,
UnlockOutlined = 643,
UnorderedListOutlined = 644,
UpCircleOutlined = 645,
UpSquareOutlined = 646,
UpOutlined = 647,
UploadOutlined = 648,
UsbOutlined = 649,
UserAddOutlined = 650,
UserDeleteOutlined = 651,
UserSwitchOutlined = 652,
UserOutlined = 653,
UsergroupAddOutlined = 654,
UsergroupDeleteOutlined = 655,
VerifiedOutlined = 656,
VerticalAlignBottomOutlined = 657,
VerticalAlignMiddleOutlined = 658,
VerticalAlignTopOutlined = 659,
VerticalLeftOutlined = 660,
VerticalRightOutlined = 661,
VideoCameraAddOutlined = 662,
VideoCameraOutlined = 663,
WalletOutlined = 664,
WarningOutlined = 665,
WechatWorkOutlined = 666,
WechatOutlined = 667,
WeiboCircleOutlined = 668,
WeiboSquareOutlined = 669,
WeiboOutlined = 670,
WhatsAppOutlined = 671,
WifiOutlined = 672,
WindowsOutlined = 673,
WomanOutlined = 674,
XOutlined = 675,
YahooOutlined = 676,
YoutubeOutlined = 677,
YuqueOutlined = 678,
ZhihuOutlined = 679,
ZoomInOutlined = 680,
ZoomOutOutlined = 681,
AccountBookTwoTone = 682,
AlertTwoTone = 683,
ApiTwoTone = 684,
AppstoreTwoTone = 685,
AudioTwoTone = 686,
BankTwoTone = 687,
BellTwoTone = 688,
BookTwoTone = 689,
BoxPlotTwoTone = 690,
BugTwoTone = 691,
BuildTwoTone = 692,
BulbTwoTone = 693,
CalculatorTwoTone = 694,
CalendarTwoTone = 695,
CameraTwoTone = 696,
CarTwoTone = 697,
CarryOutTwoTone = 698,
CheckCircleTwoTone = 699,
CheckSquareTwoTone = 700,
CiCircleTwoTone = 701,
CiTwoTone = 702,
ClockCircleTwoTone = 703,
CloseCircleTwoTone = 704,
CloseSquareTwoTone = 705,
CloudTwoTone = 706,
CodeTwoTone = 707,
CompassTwoTone = 708,
ContactsTwoTone = 709,
ContainerTwoTone = 710,
ControlTwoTone = 711,
CopyTwoTone = 712,
CopyrightCircleTwoTone = 713,
CopyrightTwoTone = 714,
CreditCardTwoTone = 715,
CrownTwoTone = 716,
CustomerServiceTwoTone = 717,
DashboardTwoTone = 718,
DatabaseTwoTone = 719,
DeleteTwoTone = 720,
DiffTwoTone = 721,
DislikeTwoTone = 722,
DollarCircleTwoTone = 723,
DollarTwoTone = 724,
DownCircleTwoTone = 725,
DownSquareTwoTone = 726,
EditTwoTone = 727,
EnvironmentTwoTone = 728,
EuroCircleTwoTone = 729,
EuroTwoTone = 730,
ExclamationCircleTwoTone = 731,
ExperimentTwoTone = 732,
EyeInvisibleTwoTone = 733,
EyeTwoTone = 734,
FileAddTwoTone = 735,
FileExcelTwoTone = 736,
FileExclamationTwoTone = 737,
FileImageTwoTone = 738,
FileMarkdownTwoTone = 739,
FilePdfTwoTone = 740,
FilePptTwoTone = 741,
FileTextTwoTone = 742,
FileUnknownTwoTone = 743,
FileWordTwoTone = 744,
FileZipTwoTone = 745,
FileTwoTone = 746,
FilterTwoTone = 747,
FireTwoTone = 748,
FlagTwoTone = 749,
FolderAddTwoTone = 750,
FolderOpenTwoTone = 751,
FolderTwoTone = 752,
FrownTwoTone = 753,
FundTwoTone = 754,
FunnelPlotTwoTone = 755,
GiftTwoTone = 756,
GoldTwoTone = 757,
HddTwoTone = 758,
HeartTwoTone = 759,
HighlightTwoTone = 760,
HomeTwoTone = 761,
HourglassTwoTone = 762,
Html5TwoTone = 763,
IdcardTwoTone = 764,
InfoCircleTwoTone = 765,
InsuranceTwoTone = 766,
InteractionTwoTone = 767,
LayoutTwoTone = 768,
LeftCircleTwoTone = 769,
LeftSquareTwoTone = 770,
LikeTwoTone = 771,
LockTwoTone = 772,
MailTwoTone = 773,
MedicineBoxTwoTone = 774,
MehTwoTone = 775,
MessageTwoTone = 776,
MinusCircleTwoTone = 777,
MinusSquareTwoTone = 778,
MobileTwoTone = 779,
MoneyCollectTwoTone = 780,
NotificationTwoTone = 781,
PauseCircleTwoTone = 782,
PhoneTwoTone = 783,
PictureTwoTone = 784,
PieChartTwoTone = 785,
PlayCircleTwoTone = 786,
PlaySquareTwoTone = 787,
PlusCircleTwoTone = 788,
PlusSquareTwoTone = 789,
PoundCircleTwoTone = 790,
PrinterTwoTone = 791,
ProfileTwoTone = 792,
ProjectTwoTone = 793,
PropertySafetyTwoTone = 794,
PushpinTwoTone = 795,
QuestionCircleTwoTone = 796,
ReconciliationTwoTone = 797,
RedEnvelopeTwoTone = 798,
RestTwoTone = 799,
RightCircleTwoTone = 800,
RightSquareTwoTone = 801,
RocketTwoTone = 802,
SafetyCertificateTwoTone = 803,
SaveTwoTone = 804,
ScheduleTwoTone = 805,
SecurityScanTwoTone = 806,
SettingTwoTone = 807,
ShopTwoTone = 808,
ShoppingTwoTone = 809,
SkinTwoTone = 810,
SlidersTwoTone = 811,
SmileTwoTone = 812,
SnippetsTwoTone = 813,
SoundTwoTone = 814,
StarTwoTone = 815,
StopTwoTone = 816,
SwitcherTwoTone = 817,
TabletTwoTone = 818,
TagTwoTone = 819,
TagsTwoTone = 820,
ThunderboltTwoTone = 821,
ToolTwoTone = 822,
TrademarkCircleTwoTone = 823,
TrophyTwoTone = 824,
UnlockTwoTone = 825,
UpCircleTwoTone = 826,
UpSquareTwoTone = 827,
UsbTwoTone = 828,
VideoCameraTwoTone = 829,
WalletTwoTone = 830,
WarningTwoTone = 831,
}
@@ -1,4 +1,5 @@
using System.Collections.Immutable;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using Microsoft.CodeAnalysis;
@@ -60,7 +61,7 @@ public class IconPackageGenerator : IIncrementalGenerator
initContext.RegisterSourceOutput(mergeInfo, (ctx, mergeInfo) =>
{
var packageName = mergeInfo.Left.Name;
var fileInfos = mergeInfo.Right;
var fileInfos = mergeInfo.Right.Sort((info1, info2) => string.Compare(info1.ThemeType, info2.ThemeType, StringComparison.InvariantCulture));
GenerateIconKind(packageName, fileInfos, ctx);
GenerateIconPackage(packageName, fileInfos, ctx);
});
@@ -131,7 +132,7 @@ public class IconPackageGenerator : IIncrementalGenerator
sourceText.Append(
$" _iconInfoPool.Add((int){packageName}IconKind.{info.Name}{info.ThemeType}, ");
sourceText.Append("new Lazy<IconInfo>(() => new IconInfo(");
sourceText.Append("() => new IconInfo(");
sourceText.Append($"\"{info.Name}{info.ThemeType}\", ");
if (info.ThemeType == "TwoTone")
{
@@ -167,7 +168,46 @@ public class IconPackageGenerator : IIncrementalGenerator
}
}
sourceText.Append("})));\n");
sourceText.Append("}));\n");
}
// 生成 Range 设置代码
var ranges = new Dictionary<string, List<int>>();
for (var i = 0; i < fileInfos.Length; ++i)
{
var themeType = fileInfos[i].ThemeType;
if (!ranges.ContainsKey(themeType))
{
var rangeInfo = new List<int>()
{
-1, -1
};
ranges.Add(themeType, rangeInfo);
}
var range = ranges[themeType];
Debug.Assert(range != null);
var currentValue = i + 1;
var min = range![0];
var max = range[1];
if (min == -1)
{
min = currentValue;
}
else
{
min = Math.Min(min, currentValue);
}
max = Math.Max(max, currentValue);
range[0] = min;
range[1] = max;
}
foreach (var rangeInfo in ranges)
{
var themeType = rangeInfo.Key!;
var range = rangeInfo.Value;
sourceText.Append($" IconThemeRanges.Add(IconThemeType.{themeType}, ({range[0]}, {range[1]}));\n");
}
sourceText.AppendLine(" }");
+22 -8
View File
@@ -4,7 +4,7 @@ namespace AtomUI.IconPkg;
public abstract class IconPackage : IIconPackage
{
protected IDictionary<int, Lazy<IconInfo>> _iconInfoPool;
protected IDictionary<int, Func<IconInfo>> _iconInfoPool;
public ColorInfo DefaultColorInfo { get; set; }
@@ -13,17 +13,20 @@ public abstract class IconPackage : IIconPackage
public string Id { get; }
public int Priority { get; set; } = 0;
protected IDictionary<IconThemeType, (int, int)> IconThemeRanges { get; }
public IconPackage(string id)
{
Id = id;
_iconInfoPool = new Dictionary<int, Lazy<IconInfo>>();
_iconInfoPool = new Dictionary<int, Func<IconInfo>>();
DefaultColorInfo = new ColorInfo(Color.FromRgb(85, 85, 85)); // #333
DefaultTwoToneColorInfo = new TwoToneColorInfo
{
PrimaryColor = Color.FromRgb(22, 119, 255),
SecondaryColor = Color.FromRgb(230, 244, 255)
};
IconThemeRanges = new Dictionary<IconThemeType, (int, int)>();
}
public abstract IconInfo? GetIconInfo(string iconKind);
@@ -83,7 +86,7 @@ public abstract class IconPackage : IIconPackage
return null;
}
var iconInfo = _iconInfoPool[iconKind].Value;
var iconInfo = _iconInfoPool[iconKind]();
if (!iconInfo.IsTwoTone)
{
iconInfo.ColorInfo = DefaultColorInfo;
@@ -132,21 +135,32 @@ public abstract class IconPackage : IIconPackage
{
return _iconInfoPool.Values.Select(x =>
{
var iconInfo = x.Value;
var iconInfo = x();
EnsureDefaultColorInfo(iconInfo);
return iconInfo;
});
}
return _iconInfoPool.Values.Where(iconInfo => iconInfo.Value.ThemeType == iconThemeType.Value)
.Select(x =>
return _iconInfoPool.Where(entry => GetIconThemeType(entry.Key) == iconThemeType.Value)
.Select(entry =>
{
var iconInfo = x.Value;
var iconInfo = entry.Value();
EnsureDefaultColorInfo(iconInfo);
return iconInfo;
});
}
private IconThemeType GetIconThemeType(int id)
{
foreach (var entry in IconThemeRanges)
{
if (id >= entry.Value.Item1 && id <= entry.Value.Item2)
{
return entry.Key;
}
}
throw new ArgumentException($"Unknown icon kind: {id}");
}
private void EnsureDefaultColorInfo(IconInfo iconInfo)
{
if (!iconInfo.IsTwoTone)